ver:init

Committer:
iv123
Date:
Sun Jun 18 16:11:03 2017 +0000
Revision:
0:4946262d6030
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
iv123 0:4946262d6030 1 /******************** (C) COPYRIGHT 2014 STMicroelectronics ********************
iv123 0:4946262d6030 2 * File Name : bluenrg_hal_aci.h
iv123 0:4946262d6030 3 * Author : AMS - AAS
iv123 0:4946262d6030 4 * Version : V1.0.0
iv123 0:4946262d6030 5 * Date : 26-Jun-2014
iv123 0:4946262d6030 6 * Description : Header file with HCI commands for BlueNRG FW6.3.
iv123 0:4946262d6030 7 ********************************************************************************
iv123 0:4946262d6030 8 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
iv123 0:4946262d6030 9 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
iv123 0:4946262d6030 10 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
iv123 0:4946262d6030 11 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
iv123 0:4946262d6030 12 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
iv123 0:4946262d6030 13 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
iv123 0:4946262d6030 14 *******************************************************************************/
iv123 0:4946262d6030 15
iv123 0:4946262d6030 16 #ifndef __BLUENRG_HAL_ACI_H__
iv123 0:4946262d6030 17 #define __BLUENRG_HAL_ACI_H__
iv123 0:4946262d6030 18
iv123 0:4946262d6030 19 /**
iv123 0:4946262d6030 20 *@addtogroup HAL HAL
iv123 0:4946262d6030 21 *@brief Hardware Abstraction Layer.
iv123 0:4946262d6030 22 *@{
iv123 0:4946262d6030 23 */
iv123 0:4946262d6030 24
iv123 0:4946262d6030 25 /**
iv123 0:4946262d6030 26 * @defgroup HAL_Functions HAL functions
iv123 0:4946262d6030 27 * @brief API for BlueNRG HAL layer.
iv123 0:4946262d6030 28 * @{
iv123 0:4946262d6030 29 */
iv123 0:4946262d6030 30
iv123 0:4946262d6030 31 /**
iv123 0:4946262d6030 32 * @brief This command writes a value to a low level configure data structure.
iv123 0:4946262d6030 33 * @note It is useful to setup directly some low level parameters for the system at runtime.
iv123 0:4946262d6030 34 * @param offset Offset in the data structure. The starting member in the data structure will have an offset 0.\n
iv123 0:4946262d6030 35 * See @ref Config_vals.
iv123 0:4946262d6030 36 *
iv123 0:4946262d6030 37 * @param len Length of data to be written
iv123 0:4946262d6030 38 * @param[out] val Data to be written
iv123 0:4946262d6030 39 * @return Value indicating success or error code.
iv123 0:4946262d6030 40 */
iv123 0:4946262d6030 41 tBleStatus aci_hal_write_config_data(uint8_t offset,
iv123 0:4946262d6030 42 uint8_t len,
iv123 0:4946262d6030 43 const uint8_t *val);
iv123 0:4946262d6030 44
iv123 0:4946262d6030 45 /**
iv123 0:4946262d6030 46 * @brief This command requests the value in the low level configure data structure.
iv123 0:4946262d6030 47 * The number of read bytes changes for different Offset.
iv123 0:4946262d6030 48 * @param offset Offset in the data structure. The starting member in the data structure will have an offset 0.\n
iv123 0:4946262d6030 49 * See @ref Config_vals.
iv123 0:4946262d6030 50 * @param data_len Length of the data buffer
iv123 0:4946262d6030 51 * @param[out] data_len_out_p length of the data returned by the read.
iv123 0:4946262d6030 52 * @param[out] data Read data
iv123 0:4946262d6030 53 * @return Value indicating success or error code.
iv123 0:4946262d6030 54 */
iv123 0:4946262d6030 55 tBleStatus aci_hal_read_config_data(uint8_t offset, uint16_t data_len, uint8_t *data_len_out_p, uint8_t *data);
iv123 0:4946262d6030 56
iv123 0:4946262d6030 57 /**
iv123 0:4946262d6030 58 * @brief This command sets the TX power level of the BlueNRG.
iv123 0:4946262d6030 59 * @note By controlling the EN_HIGH_POWER and the PA_LEVEL, the combination of the 2 determines
iv123 0:4946262d6030 60 * the output power level (dBm).
iv123 0:4946262d6030 61 * When the system starts up or reboots, the default TX power level will be used, which is
iv123 0:4946262d6030 62 * the maximum value of 8dBm. Once this command is given, the output power will be changed
iv123 0:4946262d6030 63 * instantly, regardless if there is Bluetooth communication going on or not. For example,
iv123 0:4946262d6030 64 * for debugging purpose, the BlueNRG can be set to advertise all the time and use this
iv123 0:4946262d6030 65 * command to observe the signal strength changing. The system will keep the last received
iv123 0:4946262d6030 66 * TX power level from the command, i.e. the 2nd command overwrites the previous TX power
iv123 0:4946262d6030 67 * level. The new TX power level remains until another Set TX Power command, or the system
iv123 0:4946262d6030 68 * reboots.\n
iv123 0:4946262d6030 69 * @param en_high_power Can be only 0 or 1. Set high power bit on or off. It is strongly adviced to use the
iv123 0:4946262d6030 70 * right value, depending on the selected hardware configuration for the RF network:
iv123 0:4946262d6030 71 * normal mode or high power mode.
iv123 0:4946262d6030 72 * @param pa_level Can be from 0 to 7. Set the PA level value.
iv123 0:4946262d6030 73 * @return Value indicating success or error code.
iv123 0:4946262d6030 74 */
iv123 0:4946262d6030 75 tBleStatus aci_hal_set_tx_power_level(uint8_t en_high_power, uint8_t pa_level);
iv123 0:4946262d6030 76
iv123 0:4946262d6030 77 /**
iv123 0:4946262d6030 78 * @brief This command returns the number of packets sent in Direct Test Mode.
iv123 0:4946262d6030 79 * @note When the Direct TX test is started, a 32-bit counter is used to count how many packets
iv123 0:4946262d6030 80 * have been transmitted. This command can be used to check how many packets have been sent
iv123 0:4946262d6030 81 * during the Direct TX test.\n
iv123 0:4946262d6030 82 * The counter starts from 0 and counts upwards. The counter can wrap and start from 0 again.
iv123 0:4946262d6030 83 * The counter is not cleared until the next Direct TX test starts.
iv123 0:4946262d6030 84 * @param[out] number_of_packets Number of packets sent during the last Direct TX test.
iv123 0:4946262d6030 85 * @return Value indicating success or error code.
iv123 0:4946262d6030 86 */
iv123 0:4946262d6030 87 tBleStatus aci_hal_le_tx_test_packet_number(uint32_t *number_of_packets);
iv123 0:4946262d6030 88
iv123 0:4946262d6030 89 /**
iv123 0:4946262d6030 90 * @brief Put the device in standby mode.
iv123 0:4946262d6030 91 * @note Normally the BlueNRG will automatically enter sleep mode to save power. This command puts the
iv123 0:4946262d6030 92 * device into the Standby mode instead of the sleep mode. The difference is that, in sleep mode,
iv123 0:4946262d6030 93 * the device can still wake up itself with the internal timer. But in standby mode, this timer is
iv123 0:4946262d6030 94 * disabled. So the only possibility to wake up the device is by external signals, e.g. a HCI command
iv123 0:4946262d6030 95 * sent via SPI bus.
iv123 0:4946262d6030 96 * The command is only accepted when there is no other Bluetooth activity. Otherwise an error code
iv123 0:4946262d6030 97 * ERR_COMMAND_DISALLOWED will be returned.
iv123 0:4946262d6030 98 *
iv123 0:4946262d6030 99 * @return Value indicating success or error code.
iv123 0:4946262d6030 100 */
iv123 0:4946262d6030 101 tBleStatus aci_hal_device_standby(void);
iv123 0:4946262d6030 102
iv123 0:4946262d6030 103 /**
iv123 0:4946262d6030 104 * @brief This command starts a carrier frequency, i.e. a tone, on a specific channel.
iv123 0:4946262d6030 105 * @note The frequency sine wave at the specific channel may be used for test purpose only.
iv123 0:4946262d6030 106 * 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.
iv123 0:4946262d6030 107 * This command shouldn't be used when normal Bluetooth activities are ongoing.
iv123 0:4946262d6030 108 * The tone should be stopped by aci_hal_tone_stop() command.
iv123 0:4946262d6030 109 *
iv123 0:4946262d6030 110 * @param rf_channel BLE Channel ID, from 0 to 39 meaning (2.402 + 2*N) GHz. Actually the tone will be emitted at the
iv123 0:4946262d6030 111 * channel central frequency minus 250 kHz.
iv123 0:4946262d6030 112 * @return Value indicating success or error code.
iv123 0:4946262d6030 113 */
iv123 0:4946262d6030 114 tBleStatus aci_hal_tone_start(uint8_t rf_channel);
iv123 0:4946262d6030 115
iv123 0:4946262d6030 116 /**
iv123 0:4946262d6030 117 * This command is used to stop the previously started aci_hal_tone_start() command.
iv123 0:4946262d6030 118 * @return Value indicating success or error code.
iv123 0:4946262d6030 119 */
iv123 0:4946262d6030 120 tBleStatus aci_hal_tone_stop(void);
iv123 0:4946262d6030 121
iv123 0:4946262d6030 122 /**
iv123 0:4946262d6030 123 * @}
iv123 0:4946262d6030 124 */
iv123 0:4946262d6030 125
iv123 0:4946262d6030 126 /**
iv123 0:4946262d6030 127 * @defgroup Config_vals Offsets and lengths for configuration values.
iv123 0:4946262d6030 128 * @brief Offsets and lengths for configuration values.
iv123 0:4946262d6030 129 * See aci_hal_write_config_data().
iv123 0:4946262d6030 130 * @{
iv123 0:4946262d6030 131 */
iv123 0:4946262d6030 132
iv123 0:4946262d6030 133 /**
iv123 0:4946262d6030 134 * @name Configuration values.
iv123 0:4946262d6030 135 * See @ref aci_hal_write_config_data().
iv123 0:4946262d6030 136 * @{
iv123 0:4946262d6030 137 */
iv123 0:4946262d6030 138 #define CONFIG_DATA_PUBADDR_OFFSET (0x00) /**< Bluetooth public address */
iv123 0:4946262d6030 139 #define CONFIG_DATA_DIV_OFFSET (0x06) /**< DIV used to derive CSRK */
iv123 0:4946262d6030 140 #define CONFIG_DATA_ER_OFFSET (0x08) /**< Encryption root key used to derive LTK and CSRK */
iv123 0:4946262d6030 141 #define CONFIG_DATA_IR_OFFSET (0x18) /**< Identity root key used to derive LTK and CSRK */
iv123 0:4946262d6030 142 #define CONFIG_DATA_LL_WITHOUT_HOST (0x2C) /**< Switch on/off Link Layer only mode. Set to 1 to disable Host.
iv123 0:4946262d6030 143 It can be written only if aci_hal_write_config_data() is the first command
iv123 0:4946262d6030 144 after reset. */
iv123 0:4946262d6030 145
iv123 0:4946262d6030 146 #define CONFIG_DATA_RANDOM_ADDRESS_IDB05A1 (0x80) /**< Stored static random address. Read-only (IDB05A1 only) */
iv123 0:4946262d6030 147
iv123 0:4946262d6030 148 /**
iv123 0:4946262d6030 149 * Select the BlueNRG roles and mode configurations.\n
iv123 0:4946262d6030 150 * @li Mode 1: slave or master, 1 connection, RAM1 only (small GATT DB)
iv123 0:4946262d6030 151 * @li Mode 2: slave or master, 1 connection, RAM1 and RAM2 (large GATT DB)
iv123 0:4946262d6030 152 * @li Mode 3: master only, 8 connections, RAM1 and RAM2.
iv123 0:4946262d6030 153 */
iv123 0:4946262d6030 154 #define CONFIG_DATA_ROLE (0x2D)
iv123 0:4946262d6030 155 /**
iv123 0:4946262d6030 156 * @}
iv123 0:4946262d6030 157 */
iv123 0:4946262d6030 158
iv123 0:4946262d6030 159 /**
iv123 0:4946262d6030 160 * @name Length for configuration values.
iv123 0:4946262d6030 161 * See @ref aci_hal_write_config_data().
iv123 0:4946262d6030 162 * @{
iv123 0:4946262d6030 163 */
iv123 0:4946262d6030 164 #define CONFIG_DATA_PUBADDR_LEN (6)
iv123 0:4946262d6030 165 #define CONFIG_DATA_DIV_LEN (2)
iv123 0:4946262d6030 166 #define CONFIG_DATA_ER_LEN (16)
iv123 0:4946262d6030 167 #define CONFIG_DATA_IR_LEN (16)
iv123 0:4946262d6030 168 #define CONFIG_DATA_LL_WITHOUT_HOST_LEN (1)
iv123 0:4946262d6030 169 #define CONFIG_DATA_ROLE_LEN (1)
iv123 0:4946262d6030 170 /**
iv123 0:4946262d6030 171 * @}
iv123 0:4946262d6030 172 */
iv123 0:4946262d6030 173
iv123 0:4946262d6030 174 /**
iv123 0:4946262d6030 175 * @}
iv123 0:4946262d6030 176 */
iv123 0:4946262d6030 177
iv123 0:4946262d6030 178 /**
iv123 0:4946262d6030 179 * @}
iv123 0:4946262d6030 180 */
iv123 0:4946262d6030 181
iv123 0:4946262d6030 182
iv123 0:4946262d6030 183 #endif /* __BLUENRG_HAL_ACI_H__ */