1 /***************************************************************************** 2 * @file ble_const.h 3 * @author MCD Application Team 4 * @brief This file contains the definitions which are compiler dependent. 5 ***************************************************************************** 6 * @attention 7 * 8 * <h2><center>© Copyright (c) 2019 STMicroelectronics. 9 * All rights reserved.</center></h2> 10 * 11 * This software component is licensed by ST under Ultimate Liberty license 12 * SLA0044, the "License"; You may not use this file except in compliance with 13 * the License. You may obtain a copy of the License at: 14 * www.st.com/SLA0044 15 * 16 ****************************************************************************** 17 */ 18 19 #ifndef BLE_CONST_H__ 20 #define BLE_CONST_H__ 21 22 23 #include <stdint.h> 24 #include <string.h> 25 #include "ble_std.h" 26 #include "ble_defs.h" 27 #include "osal.h" 28 29 30 /* Size of command/events buffers: 31 * 32 * To change the size of commands and events parameters used in the 33 * auto-generated files, you need to update 2 defines: 34 * 35 * - BLE_CMD_MAX_PARAM_LEN 36 * - BLE_EVT_MAX_PARAM_LEN 37 * 38 * These 2 defines are set below with default values and can be changed. 39 * 40 * To compute the value to support a characteristic of 512 bytes for a specific 41 * command or an event, you need to look in "ble_types.h". 42 * 43 * Here are 2 examples, one with a command and one with an event: 44 * 45 * - aci_gatt_update_char_value_ext_cp0 46 * ---------------------------------- 47 * 48 * we have in the structure: 49 * 50 * uint8_t Value[(BLE_CMD_MAX_PARAM_LEN- 12)/sizeof(uint8_t)]; 51 * 52 * so to support a 512 byte value, we need to have 53 * 54 * BLE_CMD_MAX_PARAM_LEN at least equal to: 512 + 12 = 524 55 * 56 * - aci_gatt_read_handle_value_rp0 57 * ------------------------------ 58 * 59 * we have in the structure: 60 * 61 * uint8_t Value[((BLE_EVT_MAX_PARAM_LEN - 3) - 5)/sizeof(uint8_t)]; 62 * 63 * so to support a 512 byte value, we need to have 64 * 65 * BLE_EVT_MAX_PARAM_LEN at least equal to: 512 + 3 + 5 = 520 66 * 67 * If you need several events or commands with 512-size values, you need to 68 * take the maximum values for BLE_EVT_MAX_PARAM_LEN and BLE_CMD_MAX_PARAM_LEN. 69 * 70 */ 71 72 /* Maximum parameter size of BLE commands. 73 * Change this value if needed. */ 74 #define BLE_CMD_MAX_PARAM_LEN HCI_COMMAND_MAX_PARAM_LEN 75 76 /* Maximum parameter size of BLE responses/events. 77 * Change this value if needed. */ 78 #define BLE_EVT_MAX_PARAM_LEN HCI_EVENT_MAX_PARAM_LEN 79 80 81 /* Callback function to send command and receive response */ 82 struct hci_request 83 { 84 uint16_t ogf; 85 uint16_t ocf; 86 int event; 87 void* cparam; 88 int clen; 89 void* rparam; 90 int rlen; 91 }; 92 extern int hci_send_req( struct hci_request* req, uint8_t async ); 93 94 95 /* Byte order conversions */ 96 #define htob( d, n ) (d) /* LE */ 97 #define btoh( d, n ) (d) /* LE */ 98 99 100 #ifndef FALSE 101 #define FALSE 0 102 #endif 103 104 #ifndef MIN 105 #define MIN( a, b ) (((a) < (b)) ? (a) : (b)) 106 #endif 107 108 #ifndef MAX 109 #define MAX( a, b ) (((a) > (b)) ? (a) : (b)) 110 #endif 111 112 113 #endif /* ! BLE_CONST_H__ */ 114 115 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE***/ 116