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