Fork of ble-x-nucleo-idb0xa1 with changes required by BleStarMbed
bluenrg/bluenrg-hci/bluenrg_hal_aci.h@0:ac0b0725c6fa, 2018-02-20 (annotated)
- Committer:
- lorevee
- Date:
- Tue Feb 20 11:07:16 2018 +0000
- Revision:
- 0:ac0b0725c6fa
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lorevee | 0:ac0b0725c6fa | 1 | /******************** (C) COPYRIGHT 2014 STMicroelectronics ******************** |
lorevee | 0:ac0b0725c6fa | 2 | * File Name : bluenrg_hal_aci.h |
lorevee | 0:ac0b0725c6fa | 3 | * Author : AMS - AAS |
lorevee | 0:ac0b0725c6fa | 4 | * Version : V1.0.0 |
lorevee | 0:ac0b0725c6fa | 5 | * Date : 26-Jun-2014 |
lorevee | 0:ac0b0725c6fa | 6 | * Description : Header file with HCI commands for BlueNRG |
lorevee | 0:ac0b0725c6fa | 7 | ******************************************************************************** |
lorevee | 0:ac0b0725c6fa | 8 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
lorevee | 0:ac0b0725c6fa | 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. |
lorevee | 0:ac0b0725c6fa | 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, |
lorevee | 0:ac0b0725c6fa | 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE |
lorevee | 0:ac0b0725c6fa | 12 | * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING |
lorevee | 0:ac0b0725c6fa | 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
lorevee | 0:ac0b0725c6fa | 14 | *******************************************************************************/ |
lorevee | 0:ac0b0725c6fa | 15 | |
lorevee | 0:ac0b0725c6fa | 16 | #ifndef __BLUENRG_HAL_ACI_H__ |
lorevee | 0:ac0b0725c6fa | 17 | #define __BLUENRG_HAL_ACI_H__ |
lorevee | 0:ac0b0725c6fa | 18 | |
lorevee | 0:ac0b0725c6fa | 19 | /** |
lorevee | 0:ac0b0725c6fa | 20 | *@addtogroup HAL HAL |
lorevee | 0:ac0b0725c6fa | 21 | *@brief Hardware Abstraction Layer. |
lorevee | 0:ac0b0725c6fa | 22 | *@{ |
lorevee | 0:ac0b0725c6fa | 23 | */ |
lorevee | 0:ac0b0725c6fa | 24 | |
lorevee | 0:ac0b0725c6fa | 25 | /** |
lorevee | 0:ac0b0725c6fa | 26 | * @defgroup HAL_Functions HAL functions |
lorevee | 0:ac0b0725c6fa | 27 | * @brief API for BlueNRG HAL layer. |
lorevee | 0:ac0b0725c6fa | 28 | * @{ |
lorevee | 0:ac0b0725c6fa | 29 | */ |
lorevee | 0:ac0b0725c6fa | 30 | |
lorevee | 0:ac0b0725c6fa | 31 | /** |
lorevee | 0:ac0b0725c6fa | 32 | * @brief This command retrieves the buid number of the firmware. |
lorevee | 0:ac0b0725c6fa | 33 | * @param[out] build_number Build number identifying the firmware release. |
lorevee | 0:ac0b0725c6fa | 34 | * @return Value indicating success or error code. |
lorevee | 0:ac0b0725c6fa | 35 | */ |
lorevee | 0:ac0b0725c6fa | 36 | tBleStatus aci_hal_get_fw_build_number(uint16_t *build_number); |
lorevee | 0:ac0b0725c6fa | 37 | |
lorevee | 0:ac0b0725c6fa | 38 | /** |
lorevee | 0:ac0b0725c6fa | 39 | * @brief This command writes a value to a low level configure data structure. |
lorevee | 0:ac0b0725c6fa | 40 | * @note It is useful to setup directly some low level parameters for the system at runtime. |
lorevee | 0:ac0b0725c6fa | 41 | * @param offset Offset in the data structure. The starting member in the data structure will have an offset 0.\n |
lorevee | 0:ac0b0725c6fa | 42 | * See @ref Config_vals. |
lorevee | 0:ac0b0725c6fa | 43 | * |
lorevee | 0:ac0b0725c6fa | 44 | * @param len Length of data to be written |
lorevee | 0:ac0b0725c6fa | 45 | * @param[out] val Data to be written |
lorevee | 0:ac0b0725c6fa | 46 | * @return Value indicating success or error code. |
lorevee | 0:ac0b0725c6fa | 47 | */ |
lorevee | 0:ac0b0725c6fa | 48 | tBleStatus aci_hal_write_config_data(uint8_t offset, |
lorevee | 0:ac0b0725c6fa | 49 | uint8_t len, |
lorevee | 0:ac0b0725c6fa | 50 | const uint8_t *val); |
lorevee | 0:ac0b0725c6fa | 51 | |
lorevee | 0:ac0b0725c6fa | 52 | /** |
lorevee | 0:ac0b0725c6fa | 53 | * @brief This command requests the value in the low level configure data structure. |
lorevee | 0:ac0b0725c6fa | 54 | * The number of read bytes changes for different Offset. |
lorevee | 0:ac0b0725c6fa | 55 | * @param offset Offset in the data structure. The starting member in the data structure will have an offset 0.\n |
lorevee | 0:ac0b0725c6fa | 56 | * See @ref Config_vals. |
lorevee | 0:ac0b0725c6fa | 57 | * @param data_len Length of the data buffer |
lorevee | 0:ac0b0725c6fa | 58 | * @param[out] data_len_out_p length of the data returned by the read. |
lorevee | 0:ac0b0725c6fa | 59 | * @param[out] data Read data |
lorevee | 0:ac0b0725c6fa | 60 | * @return Value indicating success or error code. |
lorevee | 0:ac0b0725c6fa | 61 | */ |
lorevee | 0:ac0b0725c6fa | 62 | tBleStatus aci_hal_read_config_data(uint8_t offset, uint16_t data_len, uint8_t *data_len_out_p, uint8_t *data); |
lorevee | 0:ac0b0725c6fa | 63 | |
lorevee | 0:ac0b0725c6fa | 64 | /** |
lorevee | 0:ac0b0725c6fa | 65 | * @brief This command sets the TX power level of the BlueNRG. |
lorevee | 0:ac0b0725c6fa | 66 | * @note By controlling the EN_HIGH_POWER and the PA_LEVEL, the combination of the 2 determines |
lorevee | 0:ac0b0725c6fa | 67 | * the output power level (dBm). |
lorevee | 0:ac0b0725c6fa | 68 | * When the system starts up or reboots, the default TX power level will be used, which is |
lorevee | 0:ac0b0725c6fa | 69 | * the maximum value of 8dBm. Once this command is given, the output power will be changed |
lorevee | 0:ac0b0725c6fa | 70 | * instantly, regardless if there is Bluetooth communication going on or not. For example, |
lorevee | 0:ac0b0725c6fa | 71 | * for debugging purpose, the BlueNRG can be set to advertise all the time and use this |
lorevee | 0:ac0b0725c6fa | 72 | * command to observe the signal strength changing. The system will keep the last received |
lorevee | 0:ac0b0725c6fa | 73 | * TX power level from the command, i.e. the 2nd command overwrites the previous TX power |
lorevee | 0:ac0b0725c6fa | 74 | * level. The new TX power level remains until another Set TX Power command, or the system |
lorevee | 0:ac0b0725c6fa | 75 | * reboots.\n |
lorevee | 0:ac0b0725c6fa | 76 | * @param en_high_power Can be only 0 or 1. Set high power bit on or off. It is strongly adviced to use the |
lorevee | 0:ac0b0725c6fa | 77 | * right value, depending on the selected hardware configuration for the RF network: |
lorevee | 0:ac0b0725c6fa | 78 | * normal mode or high power mode. |
lorevee | 0:ac0b0725c6fa | 79 | * @param pa_level Can be from 0 to 7. Set the PA level value. |
lorevee | 0:ac0b0725c6fa | 80 | * @return Value indicating success or error code. |
lorevee | 0:ac0b0725c6fa | 81 | */ |
lorevee | 0:ac0b0725c6fa | 82 | tBleStatus aci_hal_set_tx_power_level(uint8_t en_high_power, uint8_t pa_level); |
lorevee | 0:ac0b0725c6fa | 83 | |
lorevee | 0:ac0b0725c6fa | 84 | /** |
lorevee | 0:ac0b0725c6fa | 85 | * @brief This command returns the number of packets sent in Direct Test Mode. |
lorevee | 0:ac0b0725c6fa | 86 | * @note When the Direct TX test is started, a 32-bit counter is used to count how many packets |
lorevee | 0:ac0b0725c6fa | 87 | * have been transmitted. This command can be used to check how many packets have been sent |
lorevee | 0:ac0b0725c6fa | 88 | * during the Direct TX test.\n |
lorevee | 0:ac0b0725c6fa | 89 | * The counter starts from 0 and counts upwards. The counter can wrap and start from 0 again. |
lorevee | 0:ac0b0725c6fa | 90 | * The counter is not cleared until the next Direct TX test starts. |
lorevee | 0:ac0b0725c6fa | 91 | * @param[out] number_of_packets Number of packets sent during the last Direct TX test. |
lorevee | 0:ac0b0725c6fa | 92 | * @return Value indicating success or error code. |
lorevee | 0:ac0b0725c6fa | 93 | */ |
lorevee | 0:ac0b0725c6fa | 94 | tBleStatus aci_hal_le_tx_test_packet_number(uint32_t *number_of_packets); |
lorevee | 0:ac0b0725c6fa | 95 | |
lorevee | 0:ac0b0725c6fa | 96 | /** |
lorevee | 0:ac0b0725c6fa | 97 | * @brief Put the device in standby mode. |
lorevee | 0:ac0b0725c6fa | 98 | * @note Normally the BlueNRG will automatically enter sleep mode to save power. This command puts the |
lorevee | 0:ac0b0725c6fa | 99 | * device into the Standby mode instead of the sleep mode. The difference is that, in sleep mode, |
lorevee | 0:ac0b0725c6fa | 100 | * the device can still wake up itself with the internal timer. But in standby mode, this timer is |
lorevee | 0:ac0b0725c6fa | 101 | * disabled. So the only possibility to wake up the device is by external signals, e.g. a HCI command |
lorevee | 0:ac0b0725c6fa | 102 | * sent via SPI bus. |
lorevee | 0:ac0b0725c6fa | 103 | * The command is only accepted when there is no other Bluetooth activity. Otherwise an error code |
lorevee | 0:ac0b0725c6fa | 104 | * ERR_COMMAND_DISALLOWED will be returned. |
lorevee | 0:ac0b0725c6fa | 105 | * |
lorevee | 0:ac0b0725c6fa | 106 | * @return Value indicating success or error code. |
lorevee | 0:ac0b0725c6fa | 107 | */ |
lorevee | 0:ac0b0725c6fa | 108 | tBleStatus aci_hal_device_standby(void); |
lorevee | 0:ac0b0725c6fa | 109 | |
lorevee | 0:ac0b0725c6fa | 110 | /** |
lorevee | 0:ac0b0725c6fa | 111 | * @brief This command starts a carrier frequency, i.e. a tone, on a specific channel. |
lorevee | 0:ac0b0725c6fa | 112 | * @note The frequency sine wave at the specific channel may be used for test purpose only. |
lorevee | 0:ac0b0725c6fa | 113 | * The channel ID is a parameter from 0 to 39 for the 40 BLE channels, e.g. 0 for 2.402GHz, 1 for 2.404GHz etc. |
lorevee | 0:ac0b0725c6fa | 114 | * This command shouldn't be used when normal Bluetooth activities are ongoing. |
lorevee | 0:ac0b0725c6fa | 115 | * The tone should be stopped by aci_hal_tone_stop() command. |
lorevee | 0:ac0b0725c6fa | 116 | * |
lorevee | 0:ac0b0725c6fa | 117 | * @param rf_channel BLE Channel ID, from 0 to 39 meaning (2.402 + 2*N) GHz. Actually the tone will be emitted at the |
lorevee | 0:ac0b0725c6fa | 118 | * channel central frequency minus 250 kHz. |
lorevee | 0:ac0b0725c6fa | 119 | * @return Value indicating success or error code. |
lorevee | 0:ac0b0725c6fa | 120 | */ |
lorevee | 0:ac0b0725c6fa | 121 | tBleStatus aci_hal_tone_start(uint8_t rf_channel); |
lorevee | 0:ac0b0725c6fa | 122 | |
lorevee | 0:ac0b0725c6fa | 123 | /** |
lorevee | 0:ac0b0725c6fa | 124 | * This command is used to stop the previously started aci_hal_tone_start() command. |
lorevee | 0:ac0b0725c6fa | 125 | * @return Value indicating success or error code. |
lorevee | 0:ac0b0725c6fa | 126 | */ |
lorevee | 0:ac0b0725c6fa | 127 | tBleStatus aci_hal_tone_stop(void); |
lorevee | 0:ac0b0725c6fa | 128 | |
lorevee | 0:ac0b0725c6fa | 129 | /** |
lorevee | 0:ac0b0725c6fa | 130 | * @brief This command returns the status of all the connections. |
lorevee | 0:ac0b0725c6fa | 131 | * @note This command returns the status of the 8 Bluetooth low energy links managed by the device. |
lorevee | 0:ac0b0725c6fa | 132 | * @param[out] link_status Array of link status (8 links). See @ref Link_Status. |
lorevee | 0:ac0b0725c6fa | 133 | * @param[out] conn_handle Array of connection handles for each link. |
lorevee | 0:ac0b0725c6fa | 134 | * @return Value indicating success or error code. |
lorevee | 0:ac0b0725c6fa | 135 | */ |
lorevee | 0:ac0b0725c6fa | 136 | tBleStatus aci_hal_get_link_status(uint8_t link_status[8], uint16_t conn_handle[8]); |
lorevee | 0:ac0b0725c6fa | 137 | |
lorevee | 0:ac0b0725c6fa | 138 | /** |
lorevee | 0:ac0b0725c6fa | 139 | * @brief This command returns the anchor period and the largest available slot. |
lorevee | 0:ac0b0725c6fa | 140 | * @note This command returns information about the anchor period to help application in selecting |
lorevee | 0:ac0b0725c6fa | 141 | * slot timings when operating in multi-link scenarios. |
lorevee | 0:ac0b0725c6fa | 142 | * @param anchor_period Current anchor period (multiple of 0.625 ms). |
lorevee | 0:ac0b0725c6fa | 143 | * @param max_free_slot Maximum available time (multiple of 0.625 ms) that can be allocated for a new slot. |
lorevee | 0:ac0b0725c6fa | 144 | * @return Value indicating success or error code. |
lorevee | 0:ac0b0725c6fa | 145 | */ |
lorevee | 0:ac0b0725c6fa | 146 | tBleStatus aci_hal_get_anchor_period(uint32_t *anchor_period, uint32_t *max_free_slot); |
lorevee | 0:ac0b0725c6fa | 147 | |
lorevee | 0:ac0b0725c6fa | 148 | /** |
lorevee | 0:ac0b0725c6fa | 149 | * @} |
lorevee | 0:ac0b0725c6fa | 150 | */ |
lorevee | 0:ac0b0725c6fa | 151 | |
lorevee | 0:ac0b0725c6fa | 152 | /** |
lorevee | 0:ac0b0725c6fa | 153 | * @defgroup HAL_Events HAL events |
lorevee | 0:ac0b0725c6fa | 154 | * The structures are the data field of @ref evt_blue_aci. |
lorevee | 0:ac0b0725c6fa | 155 | * @{ |
lorevee | 0:ac0b0725c6fa | 156 | */ |
lorevee | 0:ac0b0725c6fa | 157 | |
lorevee | 0:ac0b0725c6fa | 158 | /** HCI vendor specific event, raised at BlueNRG power-up or reboot. */ |
lorevee | 0:ac0b0725c6fa | 159 | #define EVT_BLUE_HAL_INITIALIZED (0x0001) |
lorevee | 0:ac0b0725c6fa | 160 | typedef __packed struct _evt_hal_initialized{ |
lorevee | 0:ac0b0725c6fa | 161 | uint8_t reason_code; /**< Reset reason. See @ref Reset_Reasons */ |
lorevee | 0:ac0b0725c6fa | 162 | } PACKED evt_hal_initialized; |
lorevee | 0:ac0b0725c6fa | 163 | |
lorevee | 0:ac0b0725c6fa | 164 | /** |
lorevee | 0:ac0b0725c6fa | 165 | * This event is generated when an overflow occurs in the event queue read by the external microcontroller. |
lorevee | 0:ac0b0725c6fa | 166 | * This is normally caused when the external microcontroller does not read pending events. |
lorevee | 0:ac0b0725c6fa | 167 | * The returned bitmap indicates which event has been lost. Please note that one bit set to 1 indicates one or |
lorevee | 0:ac0b0725c6fa | 168 | * more occurrences of the particular events. The event EVT_BLUE_HAL_EVENTS_LOST cannot be lost and it will |
lorevee | 0:ac0b0725c6fa | 169 | * be inserted in the event queue as soon as a position is freed in the event queue. This event should not |
lorevee | 0:ac0b0725c6fa | 170 | * happen under normal operating condition where external microcontroller promptly reads events signaled by |
lorevee | 0:ac0b0725c6fa | 171 | * IRQ pin. It is provided to detected unexpected behavior of the external microcontroller or to allow |
lorevee | 0:ac0b0725c6fa | 172 | * application to recover situations where critical events are lost. |
lorevee | 0:ac0b0725c6fa | 173 | */ |
lorevee | 0:ac0b0725c6fa | 174 | #define EVT_BLUE_HAL_EVENTS_LOST_IDB05A1 (0x0002) |
lorevee | 0:ac0b0725c6fa | 175 | typedef __packed struct _evt_hal_events_lost{ |
lorevee | 0:ac0b0725c6fa | 176 | uint8_t lost_events[8]; /**< Bitmap of lost events. Each bit indicates one or more occurrences of the specific event. See @ref Lost_Events */ |
lorevee | 0:ac0b0725c6fa | 177 | } PACKED evt_hal_events_lost_IDB05A1; |
lorevee | 0:ac0b0725c6fa | 178 | |
lorevee | 0:ac0b0725c6fa | 179 | |
lorevee | 0:ac0b0725c6fa | 180 | /** |
lorevee | 0:ac0b0725c6fa | 181 | * This event is given to the application after the @ref ACI_BLUE_INITIALIZED_EVENT |
lorevee | 0:ac0b0725c6fa | 182 | * when a system crash is detected. This events returns system crash information for debugging purposes. |
lorevee | 0:ac0b0725c6fa | 183 | * Information reported are useful to understand the root cause of the crash. |
lorevee | 0:ac0b0725c6fa | 184 | */ |
lorevee | 0:ac0b0725c6fa | 185 | #define EVT_BLUE_HAL_CRASH_INFO_IDB05A1 (0x0003) |
lorevee | 0:ac0b0725c6fa | 186 | typedef __packed struct _evt_hal_crash_info{ |
lorevee | 0:ac0b0725c6fa | 187 | uint8_t crash_type; /**< Type of crash: Assert failed (0), NMI Fault (1), Hard Fault (2) */ |
lorevee | 0:ac0b0725c6fa | 188 | uint32_t sp; /**< SP register */ |
lorevee | 0:ac0b0725c6fa | 189 | uint32_t r0; /**< R0 register */ |
lorevee | 0:ac0b0725c6fa | 190 | uint32_t r1; /**< R1 register */ |
lorevee | 0:ac0b0725c6fa | 191 | uint32_t r2; /**< R2 register */ |
lorevee | 0:ac0b0725c6fa | 192 | uint32_t r3; /**< R3 register */ |
lorevee | 0:ac0b0725c6fa | 193 | uint32_t r12; /**< R12 register */ |
lorevee | 0:ac0b0725c6fa | 194 | uint32_t lr; /**< LR register */ |
lorevee | 0:ac0b0725c6fa | 195 | uint32_t pc; /**< PC register */ |
lorevee | 0:ac0b0725c6fa | 196 | uint32_t xpsr; /**< xPSR register */ |
lorevee | 0:ac0b0725c6fa | 197 | uint8_t debug_data_len; /**< length of debug_data field */ |
lorevee | 0:ac0b0725c6fa | 198 | uint8_t debug_data[VARIABLE_SIZE]; /**< Debug data */ |
lorevee | 0:ac0b0725c6fa | 199 | } PACKED evt_hal_crash_info_IDB05A1; |
lorevee | 0:ac0b0725c6fa | 200 | |
lorevee | 0:ac0b0725c6fa | 201 | |
lorevee | 0:ac0b0725c6fa | 202 | /** |
lorevee | 0:ac0b0725c6fa | 203 | * @} |
lorevee | 0:ac0b0725c6fa | 204 | */ |
lorevee | 0:ac0b0725c6fa | 205 | |
lorevee | 0:ac0b0725c6fa | 206 | |
lorevee | 0:ac0b0725c6fa | 207 | /** |
lorevee | 0:ac0b0725c6fa | 208 | * @anchor Reset_Reasons |
lorevee | 0:ac0b0725c6fa | 209 | * @name Reset Reasons |
lorevee | 0:ac0b0725c6fa | 210 | * See @ref EVT_BLUE_HAL_INITIALIZED. |
lorevee | 0:ac0b0725c6fa | 211 | * @{ |
lorevee | 0:ac0b0725c6fa | 212 | */ |
lorevee | 0:ac0b0725c6fa | 213 | #define RESET_NORMAL 1 /**< Normal startup. */ |
lorevee | 0:ac0b0725c6fa | 214 | #define RESET_UPDATER_ACI 2 /**< Updater mode entered with ACI command */ |
lorevee | 0:ac0b0725c6fa | 215 | #define RESET_UPDATER_BAD_FLAG 3 /**< Updater mode entered due to a bad BLUE flag */ |
lorevee | 0:ac0b0725c6fa | 216 | #define RESET_UPDATER_PIN 4 /**< Updater mode entered with IRQ pin */ |
lorevee | 0:ac0b0725c6fa | 217 | #define RESET_WATCHDOG 5 /**< Reset caused by watchdog */ |
lorevee | 0:ac0b0725c6fa | 218 | #define RESET_LOCKUP 6 /**< Reset due to lockup */ |
lorevee | 0:ac0b0725c6fa | 219 | #define RESET_BROWNOUT 7 /**< Brownout reset */ |
lorevee | 0:ac0b0725c6fa | 220 | #define RESET_CRASH 8 /**< Reset caused by a crash (NMI or Hard Fault) */ |
lorevee | 0:ac0b0725c6fa | 221 | #define RESET_ECC_ERR 9 /**< Reset caused by an ECC error */ |
lorevee | 0:ac0b0725c6fa | 222 | /** |
lorevee | 0:ac0b0725c6fa | 223 | * @} |
lorevee | 0:ac0b0725c6fa | 224 | */ |
lorevee | 0:ac0b0725c6fa | 225 | |
lorevee | 0:ac0b0725c6fa | 226 | |
lorevee | 0:ac0b0725c6fa | 227 | /** |
lorevee | 0:ac0b0725c6fa | 228 | * @defgroup Config_vals Offsets and lengths for configuration values. |
lorevee | 0:ac0b0725c6fa | 229 | * @brief Offsets and lengths for configuration values. |
lorevee | 0:ac0b0725c6fa | 230 | * See aci_hal_write_config_data(). |
lorevee | 0:ac0b0725c6fa | 231 | * @{ |
lorevee | 0:ac0b0725c6fa | 232 | */ |
lorevee | 0:ac0b0725c6fa | 233 | |
lorevee | 0:ac0b0725c6fa | 234 | /** |
lorevee | 0:ac0b0725c6fa | 235 | * @name Configuration values. |
lorevee | 0:ac0b0725c6fa | 236 | * See @ref aci_hal_write_config_data(). |
lorevee | 0:ac0b0725c6fa | 237 | * @{ |
lorevee | 0:ac0b0725c6fa | 238 | */ |
lorevee | 0:ac0b0725c6fa | 239 | #define CONFIG_DATA_PUBADDR_OFFSET (0x00) /**< Bluetooth public address */ |
lorevee | 0:ac0b0725c6fa | 240 | #define CONFIG_DATA_DIV_OFFSET (0x06) /**< DIV used to derive CSRK */ |
lorevee | 0:ac0b0725c6fa | 241 | #define CONFIG_DATA_ER_OFFSET (0x08) /**< Encryption root key used to derive LTK and CSRK */ |
lorevee | 0:ac0b0725c6fa | 242 | #define CONFIG_DATA_IR_OFFSET (0x18) /**< Identity root key used to derive LTK and CSRK */ |
lorevee | 0:ac0b0725c6fa | 243 | #define CONFIG_DATA_LL_WITHOUT_HOST (0x2C) /**< Switch on/off Link Layer only mode. Set to 1 to disable Host. |
lorevee | 0:ac0b0725c6fa | 244 | It can be written only if aci_hal_write_config_data() is the first command after reset. */ |
lorevee | 0:ac0b0725c6fa | 245 | #define CONFIG_DATA_RANDOM_ADDRESS (0x80) /**< Stored static random address. Read-only. */ |
lorevee | 0:ac0b0725c6fa | 246 | |
lorevee | 0:ac0b0725c6fa | 247 | /** |
lorevee | 0:ac0b0725c6fa | 248 | * Select the BlueNRG mode configurations.\n |
lorevee | 0:ac0b0725c6fa | 249 | * @li Mode 1: slave or master, 1 connection, RAM1 only (small GATT DB) |
lorevee | 0:ac0b0725c6fa | 250 | * @li Mode 2: slave or master, 1 connection, RAM1 and RAM2 (large GATT DB) |
lorevee | 0:ac0b0725c6fa | 251 | * @li Mode 3: master/slave, 8 connections, RAM1 and RAM2. |
lorevee | 0:ac0b0725c6fa | 252 | * @li Mode 4: master/slave, 4 connections, RAM1 and RAM2 simultaneous scanning and advertising. |
lorevee | 0:ac0b0725c6fa | 253 | */ |
lorevee | 0:ac0b0725c6fa | 254 | #define CONFIG_DATA_MODE_OFFSET (0x2D) |
lorevee | 0:ac0b0725c6fa | 255 | |
lorevee | 0:ac0b0725c6fa | 256 | #define CONFIG_DATA_WATCHDOG_DISABLE (0x2F) /**< Set to 1 to disable watchdog. It is enabled by default. */ |
lorevee | 0:ac0b0725c6fa | 257 | /** |
lorevee | 0:ac0b0725c6fa | 258 | * @} |
lorevee | 0:ac0b0725c6fa | 259 | */ |
lorevee | 0:ac0b0725c6fa | 260 | |
lorevee | 0:ac0b0725c6fa | 261 | /** |
lorevee | 0:ac0b0725c6fa | 262 | * @name Length for configuration values. |
lorevee | 0:ac0b0725c6fa | 263 | * See @ref aci_hal_write_config_data(). |
lorevee | 0:ac0b0725c6fa | 264 | * @{ |
lorevee | 0:ac0b0725c6fa | 265 | */ |
lorevee | 0:ac0b0725c6fa | 266 | #define CONFIG_DATA_PUBADDR_LEN (6) |
lorevee | 0:ac0b0725c6fa | 267 | #define CONFIG_DATA_DIV_LEN (2) |
lorevee | 0:ac0b0725c6fa | 268 | #define CONFIG_DATA_ER_LEN (16) |
lorevee | 0:ac0b0725c6fa | 269 | #define CONFIG_DATA_IR_LEN (16) |
lorevee | 0:ac0b0725c6fa | 270 | #define CONFIG_DATA_LL_WITHOUT_HOST_LEN (1) |
lorevee | 0:ac0b0725c6fa | 271 | #define CONFIG_DATA_MODE_LEN (1) |
lorevee | 0:ac0b0725c6fa | 272 | #define CONFIG_DATA_WATCHDOG_DISABLE_LEN (1) |
lorevee | 0:ac0b0725c6fa | 273 | /** |
lorevee | 0:ac0b0725c6fa | 274 | * @} |
lorevee | 0:ac0b0725c6fa | 275 | */ |
lorevee | 0:ac0b0725c6fa | 276 | |
lorevee | 0:ac0b0725c6fa | 277 | /** |
lorevee | 0:ac0b0725c6fa | 278 | * @anchor Link_Status |
lorevee | 0:ac0b0725c6fa | 279 | * @name Status of the link |
lorevee | 0:ac0b0725c6fa | 280 | * See @ref aci_hal_get_link_status(). |
lorevee | 0:ac0b0725c6fa | 281 | * @{ |
lorevee | 0:ac0b0725c6fa | 282 | */ |
lorevee | 0:ac0b0725c6fa | 283 | #define STATUS_IDLE 0 |
lorevee | 0:ac0b0725c6fa | 284 | #define STATUS_ADVERTISING 1 |
lorevee | 0:ac0b0725c6fa | 285 | #define STATUS_CONNECTED_AS_SLAVE 2 |
lorevee | 0:ac0b0725c6fa | 286 | #define STATUS_SCANNING 3 |
lorevee | 0:ac0b0725c6fa | 287 | #define STATUS_CONNECTED_AS_MASTER 5 |
lorevee | 0:ac0b0725c6fa | 288 | #define STATUS_TX_TEST 6 |
lorevee | 0:ac0b0725c6fa | 289 | #define STATUS_RX_TEST 7 |
lorevee | 0:ac0b0725c6fa | 290 | /** |
lorevee | 0:ac0b0725c6fa | 291 | * @} |
lorevee | 0:ac0b0725c6fa | 292 | */ |
lorevee | 0:ac0b0725c6fa | 293 | |
lorevee | 0:ac0b0725c6fa | 294 | /** |
lorevee | 0:ac0b0725c6fa | 295 | * @} |
lorevee | 0:ac0b0725c6fa | 296 | */ |
lorevee | 0:ac0b0725c6fa | 297 | |
lorevee | 0:ac0b0725c6fa | 298 | /** |
lorevee | 0:ac0b0725c6fa | 299 | * @anchor Lost_Events |
lorevee | 0:ac0b0725c6fa | 300 | * @name Lost events bitmap |
lorevee | 0:ac0b0725c6fa | 301 | * See @ref EVT_BLUE_HAL_EVENTS_LOST. |
lorevee | 0:ac0b0725c6fa | 302 | * @{ |
lorevee | 0:ac0b0725c6fa | 303 | */ |
lorevee | 0:ac0b0725c6fa | 304 | #define EVT_DISCONN_COMPLETE_BIT 0 |
lorevee | 0:ac0b0725c6fa | 305 | #define EVT_ENCRYPT_CHANGE_BIT 1 |
lorevee | 0:ac0b0725c6fa | 306 | #define EVT_READ_REMOTE_VERSION_COMPLETE_BIT 2 |
lorevee | 0:ac0b0725c6fa | 307 | #define EVT_CMD_COMPLETE_BIT 3 |
lorevee | 0:ac0b0725c6fa | 308 | #define EVT_CMD_STATUS_BIT 4 |
lorevee | 0:ac0b0725c6fa | 309 | #define EVT_HARDWARE_ERROR_BIT 5 |
lorevee | 0:ac0b0725c6fa | 310 | #define EVT_NUM_COMP_PKTS_BIT 6 |
lorevee | 0:ac0b0725c6fa | 311 | #define EVT_ENCRYPTION_KEY_REFRESH_BIT 7 |
lorevee | 0:ac0b0725c6fa | 312 | #define EVT_BLUE_HAL_INITIALIZED_BIT 8 |
lorevee | 0:ac0b0725c6fa | 313 | #define EVT_BLUE_GAP_SET_LIMITED_DISCOVERABLE_BIT 9 |
lorevee | 0:ac0b0725c6fa | 314 | #define EVT_BLUE_GAP_PAIRING_CMPLT_BIT 10 |
lorevee | 0:ac0b0725c6fa | 315 | #define EVT_BLUE_GAP_PASS_KEY_REQUEST_BIT 11 |
lorevee | 0:ac0b0725c6fa | 316 | #define EVT_BLUE_GAP_AUTHORIZATION_REQUEST_BIT 12 |
lorevee | 0:ac0b0725c6fa | 317 | #define EVT_BLUE_GAP_SECURITY_REQ_INITIATED_BIT 13 |
lorevee | 0:ac0b0725c6fa | 318 | #define EVT_BLUE_GAP_BOND_LOST_BIT 14 |
lorevee | 0:ac0b0725c6fa | 319 | #define EVT_BLUE_GAP_PROCEDURE_COMPLETE_BIT 15 |
lorevee | 0:ac0b0725c6fa | 320 | #define EVT_BLUE_GAP_ADDR_NOT_RESOLVED_BIT 16 |
lorevee | 0:ac0b0725c6fa | 321 | #define EVT_BLUE_L2CAP_CONN_UPDATE_RESP_BIT 17 |
lorevee | 0:ac0b0725c6fa | 322 | #define EVT_BLUE_L2CAP_PROCEDURE_TIMEOUT_BIT 18 |
lorevee | 0:ac0b0725c6fa | 323 | #define EVT_BLUE_L2CAP_CONN_UPDATE_REQ_BIT 19 |
lorevee | 0:ac0b0725c6fa | 324 | #define EVT_BLUE_GATT_ATTRIBUTE_MODIFIED_BIT 20 |
lorevee | 0:ac0b0725c6fa | 325 | #define EVT_BLUE_GATT_PROCEDURE_TIMEOUT_BIT 21 |
lorevee | 0:ac0b0725c6fa | 326 | #define EVT_BLUE_EXCHANGE_MTU_RESP_BIT 22 |
lorevee | 0:ac0b0725c6fa | 327 | #define EVT_BLUE_ATT_FIND_INFORMATION_RESP_BIT 23 |
lorevee | 0:ac0b0725c6fa | 328 | #define EVT_BLUE_ATT_FIND_BY_TYPE_VAL_RESP_BIT 24 |
lorevee | 0:ac0b0725c6fa | 329 | #define EVT_BLUE_ATT_READ_BY_TYPE_RESP_BIT 25 |
lorevee | 0:ac0b0725c6fa | 330 | #define EVT_BLUE_ATT_READ_RESP_BIT 26 |
lorevee | 0:ac0b0725c6fa | 331 | #define EVT_BLUE_ATT_READ_BLOB_RESP_BIT 27 |
lorevee | 0:ac0b0725c6fa | 332 | #define EVT_BLUE_ATT_READ_MULTIPLE_RESP_BIT 28 |
lorevee | 0:ac0b0725c6fa | 333 | #define EVT_BLUE_ATT_READ_BY_GROUP_RESP_BIT 29 |
lorevee | 0:ac0b0725c6fa | 334 | #define EVT_BLUE_ATT_WRITE_RESP_BIT 30 |
lorevee | 0:ac0b0725c6fa | 335 | #define EVT_BLUE_ATT_PREPARE_WRITE_RESP_BIT 31 |
lorevee | 0:ac0b0725c6fa | 336 | #define EVT_BLUE_ATT_EXEC_WRITE_RESP_BIT 32 |
lorevee | 0:ac0b0725c6fa | 337 | #define EVT_BLUE_GATT_INDICATION_BIT 33 |
lorevee | 0:ac0b0725c6fa | 338 | #define EVT_BLUE_GATT_NOTIFICATION_BIT 34 |
lorevee | 0:ac0b0725c6fa | 339 | #define EVT_BLUE_GATT_PROCEDURE_COMPLETE_BIT 35 |
lorevee | 0:ac0b0725c6fa | 340 | #define EVT_BLUE_GATT_ERROR_RESP_BIT 36 |
lorevee | 0:ac0b0725c6fa | 341 | #define EVT_BLUE_GATT_DISC_READ_CHARAC_BY_UUID_RESP_BIT 37 |
lorevee | 0:ac0b0725c6fa | 342 | #define EVT_BLUE_GATT_WRITE_PERMIT_REQ_BIT 38 |
lorevee | 0:ac0b0725c6fa | 343 | #define EVT_BLUE_GATT_READ_PERMIT_REQ_BIT 39 |
lorevee | 0:ac0b0725c6fa | 344 | #define EVT_BLUE_GATT_READ_MULTI_PERMIT_REQ_BIT 40 |
lorevee | 0:ac0b0725c6fa | 345 | #define EVT_BLUE_GATT_TX_POOL_AVAILABLE_BIT 41 |
lorevee | 0:ac0b0725c6fa | 346 | #define EVT_BLUE_GATT_SERVER_RX_CONFIRMATION_BIT 42 |
lorevee | 0:ac0b0725c6fa | 347 | #define EVT_BLUE_GATT_PREPARE_WRITE_PERMIT_REQ_BIT 43 |
lorevee | 0:ac0b0725c6fa | 348 | #define EVT_LL_CONNECTION_COMPLETE_BIT 44 |
lorevee | 0:ac0b0725c6fa | 349 | #define EVT_LL_ADVERTISING_REPORT_BIT 45 |
lorevee | 0:ac0b0725c6fa | 350 | #define EVT_LL_CONNECTION_UPDATE_COMPLETE_BIT 46 |
lorevee | 0:ac0b0725c6fa | 351 | #define EVT_LL_READ_REMOTE_USED_FEATURES_BIT 47 |
lorevee | 0:ac0b0725c6fa | 352 | #define EVT_LL_LTK_REQUEST_BIT 48 |
lorevee | 0:ac0b0725c6fa | 353 | /** |
lorevee | 0:ac0b0725c6fa | 354 | * @} |
lorevee | 0:ac0b0725c6fa | 355 | */ |
lorevee | 0:ac0b0725c6fa | 356 | |
lorevee | 0:ac0b0725c6fa | 357 | /** |
lorevee | 0:ac0b0725c6fa | 358 | * @name Hardware error event codes |
lorevee | 0:ac0b0725c6fa | 359 | * See @ref EVT_HARDWARE_ERROR. |
lorevee | 0:ac0b0725c6fa | 360 | * @{ |
lorevee | 0:ac0b0725c6fa | 361 | */ |
lorevee | 0:ac0b0725c6fa | 362 | /** |
lorevee | 0:ac0b0725c6fa | 363 | * Error on the SPI bus has been detected, most likely caused by incorrect SPI configuration on the external micro-controller. |
lorevee | 0:ac0b0725c6fa | 364 | */ |
lorevee | 0:ac0b0725c6fa | 365 | #define SPI_FRAMING_ERROR 0 |
lorevee | 0:ac0b0725c6fa | 366 | /** |
lorevee | 0:ac0b0725c6fa | 367 | * Caused by a slow crystal startup and they are an indication that the HS_STARTUP_TIME |
lorevee | 0:ac0b0725c6fa | 368 | * in the device configuration needs to be tuned. After this event is recommended to hardware reset the device. |
lorevee | 0:ac0b0725c6fa | 369 | */ |
lorevee | 0:ac0b0725c6fa | 370 | #define RADIO_STATE_ERROR 1 |
lorevee | 0:ac0b0725c6fa | 371 | /** |
lorevee | 0:ac0b0725c6fa | 372 | * Caused by a slow crystal startup and they are an indication that the HS_STARTUP_TIME |
lorevee | 0:ac0b0725c6fa | 373 | * in the device configuration needs to be tuned. After this event is recommended to hardware reset the device. |
lorevee | 0:ac0b0725c6fa | 374 | */ |
lorevee | 0:ac0b0725c6fa | 375 | #define TIMER_OVERRUN_ERROR 2 |
lorevee | 0:ac0b0725c6fa | 376 | |
lorevee | 0:ac0b0725c6fa | 377 | /** |
lorevee | 0:ac0b0725c6fa | 378 | * @} |
lorevee | 0:ac0b0725c6fa | 379 | */ |
lorevee | 0:ac0b0725c6fa | 380 | |
lorevee | 0:ac0b0725c6fa | 381 | /** |
lorevee | 0:ac0b0725c6fa | 382 | * @} |
lorevee | 0:ac0b0725c6fa | 383 | */ |
lorevee | 0:ac0b0725c6fa | 384 | |
lorevee | 0:ac0b0725c6fa | 385 | #endif /* __BLUENRG_HAL_ACI_H__ */ |