• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef _HAL_GAPM_TASK_H
16 #define _HAL_GAPM_TASK_H
17 
18 #include "ble_ip_task.h" // Task definitions
19 #include "hal_gap.h"
20 #include "wb_co_math.h"
21 
22 /// Offset for List Management Operation Codes
23 #define GAPM_OP_OFFSET_LIST_MGMT  (0x90)
24 /// Offset for Extended Air Operation Codes
25 #define GAPM_OP_OFFSET_EXT_AIR    (0xA0)
26 
27 /*
28  * ENUMERATIONS
29  ****************************************************************************************
30  */
31 
32 /// GAP Manager Message Interface
33 /*@TRACE*/
34 enum gapm_msg_id
35 {
36     /* Default event */
37     /// Command Complete event
38     GAPM_CMP_EVT = TASK_FIRST_MSG(TASK_ID_GAPM),
39 
40     /* Default commands */
41     /// Reset link layer and the host command
42     GAPM_RESET_CMD = GAPM_CMP_EVT + 2,
43 
44     /* Device Configuration */
45     /// Set device configuration command
46     GAPM_SET_DEV_CONFIG_CMD = GAPM_RESET_CMD + 2,
47     /// Set device channel map
48     GAPM_SET_CHANNEL_MAP_CMD,
49 
50     /* Local device information */
51     /// Get local device info command
52     GAPM_GET_DEV_INFO_CMD,
53     /// Local device version indication event
54     GAPM_DEV_VERSION_IND,
55     /// Local device BD Address indication event
56     GAPM_DEV_BDADDR_IND,
57     /// Advertising channel Tx power level
58     GAPM_DEV_ADV_TX_POWER_IND,
59     /// Indication containing information about memory usage.
60     GAPM_DBG_MEM_INFO_IND,
61 
62     /// Name of peer device indication
63     GAPM_PEER_NAME_IND = GAPM_DBG_MEM_INFO_IND + 8,
64 
65     /* Security / Encryption Toolbox */
66     /// Resolve address command
67     GAPM_RESOLV_ADDR_CMD = GAPM_PEER_NAME_IND + 2,
68     /// Indicate that resolvable random address has been solved
69     GAPM_ADDR_SOLVED_IND,
70     /// Generate a random address.
71     GAPM_GEN_RAND_ADDR_CMD,
72     /// Use the AES-128 block in the controller
73     GAPM_USE_ENC_BLOCK_CMD,
74     ///  AES-128 block result indication
75     GAPM_USE_ENC_BLOCK_IND,
76     /// Generate a 8-byte random number
77     GAPM_GEN_RAND_NB_CMD,
78     /// Random Number Indication
79     GAPM_GEN_RAND_NB_IND,
80 
81     /* Profile Management */
82     /// Create new task for specific profile
83     GAPM_PROFILE_TASK_ADD_CMD,
84     /// Inform that profile task has been added.
85     GAPM_PROFILE_ADDED_IND,
86 
87     /// Indicate that a message has been received on an unknown task
88     GAPM_UNKNOWN_TASK_IND,
89 
90     /* Data Length Extension */
91     /// Suggested Default Data Length indication
92     GAPM_SUGG_DFLT_DATA_LEN_IND,
93     /// Maximum Data Length indication
94     GAPM_MAX_DATA_LEN_IND,
95 
96     /* Resolving list for controller-based privacy*/
97     /// Resolving address list address indication
98     GAPM_RAL_ADDR_IND = GAPM_MAX_DATA_LEN_IND + 3,
99 
100     /* Set new IRK */
101     /// Modify current IRK
102     GAPM_SET_IRK_CMD,
103 
104     /* LE Protocol/Service Multiplexer Management */
105     /// Register a LE Protocol/Service Multiplexer command
106     GAPM_LEPSM_REGISTER_CMD,
107     /// Unregister a LE Protocol/Service Multiplexer command
108     GAPM_LEPSM_UNREGISTER_CMD,
109 
110     /* LE Test Mode */
111     /// Control of the test mode command
112     GAPM_LE_TEST_MODE_CTRL_CMD,
113     /// Indicate end of test mode
114     GAPM_LE_TEST_END_IND,
115 
116     /// Provide statistic information about ISO exchange
117     GAPM_ISO_STAT_IND,
118 
119     /* Secure Connections */
120     /// Request to provide DH Key
121     GAPM_GEN_DH_KEY_CMD,
122     /// Indicates the DH Key computation is complete and available
123     GAPM_GEN_DH_KEY_IND,
124     /// Retrieve Public Key
125     GAPM_GET_PUB_KEY_CMD,
126     /// Indicates the Public Key Pair value
127     GAPM_PUB_KEY_IND,
128 
129     /* ************************************************ */
130     /* ------------ NEW COMMANDS FOR BLE 5 ------------ */
131     /* ************************************************ */
132 
133     /* List Management Operations */
134     /// Get local or peer address
135     /// @see struct gapm_get_ral_addr_cmd
136     GAPM_GET_RAL_ADDR_CMD = TASK_FIRST_MSG(TASK_ID_GAPM) + GAPM_OP_OFFSET_LIST_MGMT,
137     /// Set content of either white list or resolving list or periodic advertiser list
138     /// @see struct gapm_list_set_wl_cmd
139     /// @see struct gapm_list_set_ral_cmd
140     /// @see struct gapm_list_set_pal_cmd
141     GAPM_LIST_SET_CMD,
142     /// Indicate size of list indicated in GAPM_GET_DEV_CONFIG_CMD message
143     /// @see struct gapm_list_size_ind
144     GAPM_LIST_SIZE_IND,
145 
146     /* Extended Air Operations */
147     /// Create an advertising, a scanning, an initiating or a periodic synchronization activity
148     /// @see struct gapm_activity_create_cmd
149     /// @see struct gapm_activity_create_adv_cmd
150     GAPM_ACTIVITY_CREATE_CMD = TASK_FIRST_MSG(TASK_ID_GAPM) + GAPM_OP_OFFSET_EXT_AIR,
151     /// Start a previously created activity
152     /// @see struct gapm_activity_start_cmd
153     GAPM_ACTIVITY_START_CMD,
154     /// Stop either a given activity or all existing activities
155     /// @see struct gapm_activity_stop_cmd
156     GAPM_ACTIVITY_STOP_CMD,
157     /// Delete either a given activity or all existing activities
158     /// @see struct gapm_activity_delete_cmd
159     GAPM_ACTIVITY_DELETE_CMD,
160     /// Indicate that an activity has well been created
161     /// @see struct gapm_activity_create_ind
162     GAPM_ACTIVITY_CREATED_IND,
163     /// Indicate that an activity has been stopped and can be restarted
164     /// @see struct gapm_activity_stopped_ind
165     GAPM_ACTIVITY_STOPPED_IND,
166     /// Set either advertising data or scan response data or periodic advertising data
167     /// @see struct gapm_set_adv_data_cmd
168     GAPM_SET_ADV_DATA_CMD,
169     /// Indicate reception of an advertising report (periodic or not), a scan response report
170     /// @see struct gapm_ext_adv_report_ind
171     GAPM_EXT_ADV_REPORT_IND,
172     /// Indicate reception of a scan request
173     /// @see struct gapm_scan_request_ind
174     GAPM_SCAN_REQUEST_IND,
175     /// Indicate that synchronization has been successfully established with a periodic advertiser
176     /// @see struct gapm_sync_established_ind
177     GAPM_SYNC_ESTABLISHED_IND,
178     /// Indicate maximum advertising data length supported by controller
179     /// @see struct gapm_max_adv_data_len_ind
180     GAPM_MAX_ADV_DATA_LEN_IND,
181     /// Indicate number of available advertising sets
182     /// @see struct gapm_nb_adv_sets_ind
183     GAPM_NB_ADV_SETS_IND,
184     /// Indicate the transmit powers supported by the controller
185     /// @see struct gapm_dev_tx_power_ind
186     GAPM_DEV_TX_PWR_IND,
187     /// Indicate the RF path compensation values
188     /// @see struct gapm_dev_rf_path_comp_ind
189     GAPM_DEV_RF_PATH_COMP_IND,
190     /// Indication to the task that sends the unknown message
191     /// @see struct gapm_unknown_msg_ind
192     GAPM_UNKNOWN_MSG_IND,
193 
194     /* ************************************************ */
195     /* -------------- Internal usage only ------------- */
196     /* ************************************************ */
197     /// Message received to unknown task received
198     GAPM_UNKNOWN_TASK_MSG,
199 
200     /* Internal messages for timer events, not part of API */
201     /// Address renewal timeout indication
202     GAPM_ADDR_RENEW_TO_IND,
203     /// Automatic connection establishment timeout indication
204     GAPM_AUTO_CONN_TO_IND,
205 
206     /* Addresses Management */
207     /// Renew random private addresses
208     /// @see struct gapm_addr_renew_cmd
209     GAPM_ADDR_RENEW_CMD,
210 };
211 
212 
213 /// GAP Manager operation type - application interface
214 /*@TRACE*/
215 enum gapm_operation
216 {
217     /* No Operation (if nothing has been requested)     */
218     /* ************************************************ */
219     /// No operation.
220     GAPM_NO_OP                                     = 0x00,
221 
222     /* Default operations                               */
223     /* ************************************************ */
224     /// Reset BLE subsystem: LL and HL.
225     GAPM_RESET,
226 
227     /* Configuration operations                         */
228     /* ************************************************ */
229     /// Set device configuration
230     GAPM_SET_DEV_CONFIG = GAPM_RESET + 2,
231     /// Set device channel map
232     GAPM_SET_CHANNEL_MAP,
233 
234     /* Retrieve device information                      */
235     /* ************************************************ */
236     /// Get Local device version
237     GAPM_GET_DEV_VERSION,
238     /// Get Local device BD Address
239     GAPM_GET_DEV_BDADDR,
240     /// Get device advertising power level
241     GAPM_GET_DEV_ADV_TX_POWER,
242     /// Get White List Size.
243     GAPM_GET_WLIST_SIZE,
244 
245     /* Security / Encryption Toolbox                    */
246     /* ************************************************ */
247     /// Resolve device address
248     GAPM_RESOLV_ADDR = GAPM_GET_WLIST_SIZE + 15,
249     /// Generate a random address
250     GAPM_GEN_RAND_ADDR,
251     /// Use the controller's AES-128 block
252     GAPM_USE_ENC_BLOCK,
253     /// Generate a 8-byte random number
254     GAPM_GEN_RAND_NB,
255 
256     /* Profile Management                               */
257     /* ************************************************ */
258     /// Create new task for specific profile
259     GAPM_PROFILE_TASK_ADD,
260 
261     /* DEBUG                                            */
262     /* ************************************************ */
263     /// Get memory usage
264     GAPM_DBG_GET_MEM_INFO,
265     /// Perform a platform reset
266     GAPM_PLF_RESET,
267 
268     /* Data Length Extension                            */
269     /* ************************************************ */
270     /// Set Suggested Default LE Data Length
271     GAPM_SET_SUGGESTED_DFLT_LE_DATA_LEN,
272     /// Get Suggested Default LE Data Length
273     GAPM_GET_SUGGESTED_DFLT_LE_DATA_LEN,
274     /// Get Maximum LE Data Length
275     GAPM_GET_MAX_LE_DATA_LEN,
276 
277     /* Operation on Resolving List                      */
278     /* ************************************************ */
279     /// Get resolving address list size
280     GAPM_GET_RAL_SIZE,
281     /// Get resolving local address
282     GAPM_GET_RAL_LOC_ADDR,
283     /// Get resolving peer address
284     GAPM_GET_RAL_PEER_ADDR,
285 
286     /* Change current IRK                               */
287     /* ************************************************ */
288     /// Set IRK
289     GAPM_SET_IRK = GAPM_GET_RAL_PEER_ADDR + 5,
290 
291     /* LE Protocol/Service Multiplexer management       */
292     /* ************************************************ */
293     /// Register a LE Protocol/Service Multiplexer
294     GAPM_LEPSM_REG,
295     /// Unregister a LE Protocol/Service Multiplexer
296     GAPM_LEPSM_UNREG,
297 
298     /* LE Direct Test Mode                              */
299     /* ************************************************ */
300     /// Stop the test mode
301     GAPM_LE_TEST_STOP,
302     /// Start RX Test Mode
303     GAPM_LE_TEST_RX_START,
304     /// Start TX Test Mode
305     GAPM_LE_TEST_TX_START,
306 
307     /* Secure Connection                                */
308     /* ************************************************ */
309     /// Generate DH_Key
310     GAPM_GEN_DH_KEY,
311     /// Retrieve Public Key
312     GAPM_GET_PUB_KEY,
313 
314     /* List Management                                  */
315     /* ************************************************ */
316     /// Set content of white list
317     GAPM_SET_WL = GAPM_NO_OP + GAPM_OP_OFFSET_LIST_MGMT,
318     /// Set content of resolving list
319     GAPM_SET_RAL,
320     /// Set content of periodic advertiser list
321     GAPM_SET_PAL,
322     /// Get white list size
323     //GAPM_GET_WHITE_LIST_SIZE,
324     /// Get resolving list size
325     //GAPM_GET_RAL_SIZE,
326     /// Get periodic advertiser list size
327     GAPM_GET_PAL_SIZE = GAPM_SET_PAL + 3,
328 
329     /* Air Operations                                   */
330     /* ************************************************ */
331     /// Create advertising activity
332     GAPM_CREATE_ADV_ACTIVITY = GAPM_NO_OP + GAPM_OP_OFFSET_EXT_AIR,
333     /// Create scanning activity
334     GAPM_CREATE_SCAN_ACTIVITY,
335     /// Create initiating activity
336     GAPM_CREATE_INIT_ACTIVITY,
337     /// Create periodic synchronization activity
338     GAPM_CREATE_PERIOD_SYNC_ACTIVITY,
339     /// Start an activity
340     GAPM_START_ACTIVITY,
341     /// Stop an activity
342     GAPM_STOP_ACTIVITY,
343     /// Stop all activities
344     GAPM_STOP_ALL_ACTIVITIES,
345     /// Delete an activity
346     GAPM_DELETE_ACTIVITY,
347     /// Delete all activities
348     GAPM_DELETE_ALL_ACTIVITIES,
349     /// Set advertising data
350     GAPM_SET_ADV_DATA,
351     /// Set scan response data
352     GAPM_SET_SCAN_RSP_DATA,
353     /// Set periodic advertising data
354     GAPM_SET_PERIOD_ADV_DATA,
355     /// Get number of available advertising sets
356     GAPM_GET_NB_ADV_SETS,
357     /// Get maximum advertising data length supported by the controller
358     GAPM_GET_MAX_LE_ADV_DATA_LEN,
359     /// Get minimum and maximum transmit powers supported by the controller
360     GAPM_GET_DEV_TX_PWR,
361     /// Get the RF Path Compensation values used in the TX Power Level and RSSI calculation
362     GAPM_GET_DEV_RF_PATH_COMP,
363     /// INTERNAL OPERATION - Renew random addresses
364     GAPM_RENEW_ADDR,
365 };
366 
367 /// Own BD address source of the device
368 enum gapm_own_addr
369 {
370    /// Public or Private Static Address according to device address configuration
371    GAPM_STATIC_ADDR,
372    /// Generated resolvable private random address
373    GAPM_GEN_RSLV_ADDR,
374    /// Generated non-resolvable private random address
375    GAPM_GEN_NON_RSLV_ADDR,
376 };
377 
378 /// Device Attribute write permission requirement
379 enum gapm_write_att_perm
380 {
381     /// Disable write access
382     GAPM_WRITE_DISABLE     = 0,
383     /// Enable write access - no authentication required
384     GAPM_WRITE_NO_AUTH     = 1,
385     /// Write access requires unauthenticated link
386     GAPM_WRITE_UNAUTH      = 2,
387     /// Write access requires authenticated link
388     GAPM_WRITE_AUTH        = 3,
389     /// Write access requires secure connected link
390     GAPM_WRITE_SEC_CON     = 4
391 };
392 
393 /// Attribute database configuration
394 ///   15   14   13   12   11   10    9    8    7    6    5    4    3    2    1    0
395 /// +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
396 /// | DBG|DBGT|          RFU                | SC |PCP |   APP_PERM   |   NAME_PERM  |
397 /// +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
398 /// - Bit [0-2] : Device Name write permission requirements for peer device (@see gapm_write_att_perm)
399 /// - Bit [3-5] : Device Appearance write permission requirements for peer device (@see gapm_write_att_perm)
400 /// - Bit [6]   : Slave Preferred Connection Parameters present
401 /// - Bit [7]   : Service change feature present in GATT attribute database.
402 /// - Bit [8-13]: Reserved
403 /// - Bit [14]  : if Debug Mode enabled, forward all L2cap traffic to application
404 /// - Bit [15]  : Enable Debug Mode
405 enum gapm_att_cfg_flag
406 {
407     /// Device Name write permission requirements for peer device (@see gapm_write_att_perm)
408     GAPM_MASK_ATT_NAME_PERM            = 0x0007,
409     GAPM_POS_ATT_NAME_PERM             = 0x00,
410     /// Device Appearance write permission requirements for peer device (@see gapm_write_att_perm)
411     GAPM_MASK_ATT_APPEARENCE_PERM      = 0x0038,
412     GAPM_POS_ATT_APPEARENCE_PERM       = 0x03,
413     /// Slave Preferred Connection Parameters present in GAP attribute database.
414     GAPM_MASK_ATT_SLV_PREF_CON_PAR_EN  = 0x0040,
415     GAPM_POS_ATT_SLV_PREF_CON_PAR_EN   = 0x06,
416     /// Service change feature present in GATT attribute database.
417     GAPM_MASK_ATT_SVC_CHG_EN           = 0x0080,
418     GAPM_POS_ATT_SVC_CHG_EN            = 0x07,
419     /// if Debug Mode enabled, forward all L2cap traffic to application
420     GAPM_MASK_ATT_DBG_L2CAP_TRAFFIC_EN = 0x4000,
421     GAPM_POS_ATT_DBG_L2CAP_TRAFFIC_EN  = 0x0E,
422     /// Enable Debug Mode
423     GAPM_MASK_ATT_DBG_MODE_EN          = 0x8000,
424     GAPM_POS_ATT_DBG_MODE_EN           = 0x0F,
425 };
426 
427 /// Pairing mode authorized on the device
428 ///    7    6    5    4    3    2    1    0
429 /// +----+----+----+----+----+----+----+----+
430 /// |             RFU             | SCP| LP |
431 /// +----+----+----+----+----+----+----+----+
432 enum gapm_pairing_mode
433 {
434     /// No pairing authorized
435     GAPM_PAIRING_DISABLE  = 0,
436     /// Legacy pairing Authorized
437     GAPM_PAIRING_LEGACY   = (1 << 0),
438     /// Secure Connection pairing Authorized
439     GAPM_PAIRING_SEC_CON  = (1 << 1),
440 };
441 
442 /// LE Audio Mode Configuration
443 ///   15   14   13   12   11   10    9    8    7    6    5    4    3    2    1    0
444 /// +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
445 /// |                                 RFU                                      | AM0|
446 /// +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
447 enum gapm_audio_cfg_flag
448 {
449     /// LE Audio Mode 0 Supported
450     GAPM_MASK_AUDIO_AM0_SUP           = 0x0001,
451     GAPM_POS_AUDIO_AM0_SUP            = 0x00,
452 };
453 
454 /// Security level
455 ///   7   6   5   4   3   2   1   0
456 /// +---+---+---+---+---+---+---+---+
457 /// |MI |      RFU      |EKS|SEC_LVL|
458 /// +---+---+---+---+---+---+---+---+
459 /// bit[0-1]: Security level requirement (0=NO_AUTH, 1=UNAUTH, 2=AUTH, 3=SEC_CON)
460 /// bit[2]  : Encryption Key Size length must have 16 bytes
461 /// bit[7]  : Multi-instantiated task
462 enum gapm_le_psm_sec_mask
463 {
464     /// bit[0-1]: Security level requirement (0=NO_AUTH, 1=UNAUTH, 2=AUTH, 3=SEC_CON)
465     /// bit[2]  : Encryption Key Size length must have 16 bytes
466     GAPM_LE_PSM_SEC_LVL_MASK  = 0x07,
467     /// bit[7]  : Multi-instantiated task
468     GAPM_LE_PSM_MI_TASK_MASK  = 0x80,
469 };
470 
471 /// Type of activities that can be created
472 /*@TRACE*/
473 enum gapm_actv_type
474 {
475     /// Advertising activity
476     GAPM_ACTV_TYPE_ADV = 0,
477     /// Scanning activity
478     GAPM_ACTV_TYPE_SCAN,
479     /// Initiating activity
480     GAPM_ACTV_TYPE_INIT,
481     /// Periodic synchronization activity
482     GAPM_ACTV_TYPE_PER_SYNC,
483 };
484 
485 /// Type of advertising that can be created
486 enum gapm_adv_type
487 {
488     /// Legacy advertising
489     GAPM_ADV_TYPE_LEGACY = 0,
490     /// Extended advertising
491     GAPM_ADV_TYPE_EXTENDED,
492     /// Periodic advertising
493     GAPM_ADV_TYPE_PERIODIC,
494 };
495 
496 /// Advertising report type
497 enum gapm_adv_report_type
498 {
499     /// Extended advertising report
500     GAPM_REPORT_TYPE_ADV_EXT = 0,
501     /// Legacy advertising report
502     GAPM_REPORT_TYPE_ADV_LEG,
503     /// Extended scan response report
504     GAPM_REPORT_TYPE_SCAN_RSP_EXT,
505     /// Legacy scan response report
506     GAPM_REPORT_TYPE_SCAN_RSP_LEG,
507     /// Periodic advertising report
508     GAPM_REPORT_TYPE_PER_ADV,
509 };
510 
511 /// Advertising properties bit field bit positions
512 enum gapm_adv_prop_pos
513 {
514     /// Indicate that advertising is connectable, reception of CONNECT_REQ or AUX_CONNECT_REQ
515     /// PDUs is accepted. Not applicable for periodic advertising.
516     GAPM_ADV_PROP_CONNECTABLE_POS     = 0,
517     /// Indicate that advertising is scannable, reception of SCAN_REQ or AUX_SCAN_REQ PDUs is
518     /// accepted
519     GAPM_ADV_PROP_SCANNABLE_POS,
520     /// Indicate that advertising targets a specific device. Only apply in following cases:
521     ///   - Legacy advertising: if connectable
522     ///   - Extended advertising: connectable or (non connectable and non discoverable)
523     GAPM_ADV_PROP_DIRECTED_POS,
524     /// Indicate that High Duty Cycle has to be used for advertising on primary channel
525     /// Apply only if created advertising is not an extended advertising
526     GAPM_ADV_PROP_HDC_POS,
527     /// Bit 4 is reserved
528     GAPM_ADV_PROP_RESERVED_4_POS,
529     /// Enable anonymous mode. Device address won't appear in send PDUs
530     /// Valid only if created advertising is an extended advertising
531     GAPM_ADV_PROP_ANONYMOUS_POS,
532     /// Include TX Power in the extended header of the advertising PDU.
533     /// Valid only if created advertising is not a legacy advertising
534     GAPM_ADV_PROP_TX_PWR_POS,
535     /// Include TX Power in the periodic advertising PDU.
536     /// Valid only if created advertising is a periodic advertising
537     GAPM_ADV_PROP_PER_TX_PWR_POS,
538     /// Indicate if application must be informed about received scan requests PDUs
539     GAPM_ADV_PROP_SCAN_REQ_NTF_EN_POS,
540 };
541 
542 /// Advertising properties bit field bit value
543 enum gapm_adv_prop
544 {
545     /// Indicate that advertising is connectable, reception of CONNECT_REQ or AUX_CONNECT_REQ
546     /// PDUs is accepted. Not applicable for periodic advertising.
547     GAPM_ADV_PROP_CONNECTABLE_BIT     = CO_BIT(GAPM_ADV_PROP_CONNECTABLE_POS),
548     /// Indicate that advertising is scannable, reception of SCAN_REQ or AUX_SCAN_REQ PDUs is
549     /// accepted
550     GAPM_ADV_PROP_SCANNABLE_BIT       = CO_BIT(GAPM_ADV_PROP_SCANNABLE_POS),
551     /// Indicate that advertising targets a specific device. Only apply in following cases:
552     ///   - Legacy advertising: if connectable
553     ///   - Extended advertising: connectable or (non connectable and non discoverable)
554     GAPM_ADV_PROP_DIRECTED_BIT        = CO_BIT(GAPM_ADV_PROP_DIRECTED_POS),
555     /// Indicate that High Duty Cycle has to be used for advertising on primary channel
556     /// Apply only if created advertising is not an extended advertising
557     GAPM_ADV_PROP_HDC_BIT             = CO_BIT(GAPM_ADV_PROP_HDC_POS),
558     /// Bit 4 is reserved
559     GAPM_ADV_PROP_RESERVED_4_BIT      = CO_BIT(GAPM_ADV_PROP_RESERVED_4_POS),
560     /// Enable anonymous mode. Device address won't appear in send PDUs
561     /// Valid only if created advertising is an extended advertising
562     GAPM_ADV_PROP_ANONYMOUS_BIT       = CO_BIT(GAPM_ADV_PROP_ANONYMOUS_POS),
563     /// Include TX Power in the extended header of the advertising PDU.
564     /// Valid only if created advertising is not a legacy advertising
565     GAPM_ADV_PROP_TX_PWR_BIT          = CO_BIT(GAPM_ADV_PROP_TX_PWR_POS),
566     /// Include TX Power in the periodic advertising PDU.
567     /// Valid only if created advertising is a periodic advertising
568     GAPM_ADV_PROP_PER_TX_PWR_BIT      = CO_BIT(GAPM_ADV_PROP_PER_TX_PWR_POS),
569     /// Indicate if application must be informed about received scan requests PDUs
570     GAPM_ADV_PROP_SCAN_REQ_NTF_EN_BIT = CO_BIT(GAPM_ADV_PROP_SCAN_REQ_NTF_EN_POS),
571 };
572 
573 /// Advertising discovery mode
574 enum gapm_adv_disc_mode
575 {
576     /// Mode in non-discoverable
577     GAPM_ADV_MODE_NON_DISC = 0,
578     /// Mode in general discoverable
579     GAPM_ADV_MODE_GEN_DISC,
580     /// Mode in limited discoverable
581     GAPM_ADV_MODE_LIM_DISC,
582     /// Broadcast mode without presence of AD_TYPE_FLAG in advertising data
583     GAPM_ADV_MODE_BEACON,
584     GAPM_ADV_MODE_MAX,
585 };
586 
587 /// Scanning Types
588 enum gapm_scan_type
589 {
590     /// General discovery
591     GAPM_SCAN_TYPE_GEN_DISC = 0,
592     /// Limited discovery
593     GAPM_SCAN_TYPE_LIM_DISC,
594     /// Observer
595     GAPM_SCAN_TYPE_OBSERVER,
596     /// Selective observer
597     GAPM_SCAN_TYPE_SEL_OBSERVER,
598     /// Connectable discovery
599     GAPM_SCAN_TYPE_CONN_DISC,
600     /// Selective connectable discovery
601     GAPM_SCAN_TYPE_SEL_CONN_DISC,
602 };
603 
604 /// Scanning properties bit field bit value
605 enum gapm_scan_prop
606 {
607     /// Scan advertisement on the LE 1M PHY
608     GAPM_SCAN_PROP_PHY_1M_BIT       = (1 << 0),
609     /// Scan advertisement on the LE Coded PHY
610     GAPM_SCAN_PROP_PHY_CODED_BIT    = (1 << 1),
611     /// Active scan on LE 1M PHY (Scan Request PDUs may be sent)
612     GAPM_SCAN_PROP_ACTIVE_1M_BIT    = (1 << 2),
613     /// Active scan on LE Coded PHY (Scan Request PDUs may be sent)
614     GAPM_SCAN_PROP_ACTIVE_CODED_BIT = (1 << 3),
615     /// Accept directed advertising packets if we use a RPA and target address cannot be solved by the
616     /// controller
617     GAPM_SCAN_PROP_ACCEPT_RPA_BIT   = (1 << 4),
618     /// Filter truncated advertising or scan response reports
619     GAPM_SCAN_PROP_FILT_TRUNC_BIT   = (1 << 5),
620 };
621 
622 /// Initiating Types
623 enum gapm_init_type
624 {
625     /// Direct connection establishment, establish a connection with an indicated device
626     GAPM_INIT_TYPE_DIRECT_CONN_EST = 0,
627     /// Automatic connection establishment, establish a connection with all devices whose address is
628     /// present in the white list
629     GAPM_INIT_TYPE_AUTO_CONN_EST,
630     /// Name discovery, Establish a connection with an indicated device in order to read content of its
631     /// Device Name characteristic. Connection is closed once this operation is stopped.
632     GAPM_INIT_TYPE_NAME_DISC,
633 };
634 
635 /// Initiating Properties
636 enum gapm_init_prop
637 {
638     /// Scan connectable advertisements on the LE 1M PHY. Connection parameters for the LE 1M PHY are provided
639     GAPM_INIT_PROP_1M_BIT       = (1 << 0),
640     /// Connection parameters for the LE 2M PHY are provided
641     GAPM_INIT_PROP_2M_BIT       = (1 << 1),
642     /// Scan connectable advertisements on the LE Coded PHY. Connection parameters for the LE Coded PHY are provided
643     GAPM_INIT_PROP_CODED_BIT    = (1 << 2),
644 };
645 
646 /// Advertising report information
647 enum gapm_adv_report_info
648 {
649     /// Report Type
650     GAPM_REPORT_INFO_REPORT_TYPE_MASK    = 0x07,
651     /// Report is complete
652     GAPM_REPORT_INFO_COMPLETE_BIT        = (1 << 3),
653     /// Connectable advertising
654     GAPM_REPORT_INFO_CONN_ADV_BIT        = (1 << 4),
655     /// Scannable advertising
656     GAPM_REPORT_INFO_SCAN_ADV_BIT        = (1 << 5),
657     /// Directed advertising
658     GAPM_REPORT_INFO_DIR_ADV_BIT         = (1 << 6),
659 };
660 
661 /// Filtering policy for duplicated packets
662 enum gapm_dup_filter_pol
663 {
664     /// Disable filtering of duplicated packets
665     GAPM_DUP_FILT_DIS = 0,
666     /// Enable filtering of duplicated packets
667     GAPM_DUP_FILT_EN,
668     /// Enable filtering of duplicated packets, reset for each scan period
669     GAPM_DUP_FILT_EN_PERIOD,
670 };
671 
672 /// Periodic synchronization types
673 enum gapm_per_sync_type
674 {
675     /// Do not use periodic advertiser list for synchronization. Use advertiser information provided
676     /// in the GAPM_ACTIVITY_START_CMD.
677     GAPM_PER_SYNC_TYPE_GENERAL = 0,
678     /// Use periodic advertiser list for synchronization
679     GAPM_PER_SYNC_TYPE_SELECTIVE,
680 };
681 
682 /// PHY Type
683 enum gapm_phy_type
684 {
685     /// LE 1M
686     GAPM_PHY_TYPE_LE_1M = 0,
687     /// LE 2M
688     GAPM_PHY_TYPE_LE_2M,
689     /// LE Coded
690     GAPM_PHY_TYPE_LE_CODED,
691 };
692 
693 /// -------------------------------------------------------------------------------------
694 /// Masks for advertising properties
695 /// -------------------------------------------------------------------------------------
696 
697 /// Advertising properties configurations for legacy advertising
698 enum gapm_leg_adv_prop
699 {
700     /// Non connectable non scannable advertising
701     GAPM_ADV_PROP_NON_CONN_NON_SCAN_MASK  = 0x0000,
702     /// Broadcast non scannable advertising - Discovery mode must be Non Discoverable
703     GAPM_ADV_PROP_BROADCAST_NON_SCAN_MASK = GAPM_ADV_PROP_NON_CONN_NON_SCAN_MASK,
704     /// Non connectable scannable advertising
705     GAPM_ADV_PROP_NON_CONN_SCAN_MASK      = GAPM_ADV_PROP_SCANNABLE_BIT,
706     /// Broadcast non scannable advertising - Discovery mode must be Non Discoverable
707     GAPM_ADV_PROP_BROADCAST_SCAN_MASK     = GAPM_ADV_PROP_NON_CONN_SCAN_MASK,
708     /// Undirected connectable advertising
709     GAPM_ADV_PROP_UNDIR_CONN_MASK         = GAPM_ADV_PROP_CONNECTABLE_BIT | GAPM_ADV_PROP_SCANNABLE_BIT,
710     /// Directed connectable advertising
711     GAPM_ADV_PROP_DIR_CONN_MASK           = GAPM_ADV_PROP_DIRECTED_BIT | GAPM_ADV_PROP_CONNECTABLE_BIT,
712     /// Directed connectable with Low Duty Cycle
713     GAPM_ADV_PROP_DIR_CONN_LDC_MASK       = GAPM_ADV_PROP_DIR_CONN_MASK,
714     /// Directed connectable with High Duty Cycle
715     GAPM_ADV_PROP_DIR_CONN_HDC_MASK       = GAPM_ADV_PROP_DIR_CONN_MASK | GAPM_ADV_PROP_HDC_BIT,
716 };
717 
718 /// Advertising properties configurations for extended advertising
719 enum gapm_ext_adv_prop
720 {
721     /// Non connectable non scannable extended advertising
722     GAPM_EXT_ADV_PROP_NON_CONN_NON_SCAN_MASK = 0x0000,
723     /// Non connectable scannable extended advertising
724     GAPM_EXT_ADV_PROP_NON_CONN_SCAN_MASK     = GAPM_ADV_PROP_SCANNABLE_BIT,
725     /// Non connectable scannable directed extended advertising
726     GAPM_EXT_ADV_PROP_NON_CONN_SCAN_DIR_MASK = GAPM_ADV_PROP_SCANNABLE_BIT | GAPM_ADV_PROP_DIRECTED_BIT,
727     /// Non connectable anonymous directed extended advertising
728     GAPM_EXT_ADV_PROP_ANONYM_DIR_MASK        = GAPM_ADV_PROP_ANONYMOUS_BIT | GAPM_ADV_PROP_DIRECTED_BIT,
729     /// Undirected connectable extended advertising
730     GAPM_EXT_ADV_PROP_UNDIR_CONN_MASK        = GAPM_ADV_PROP_CONNECTABLE_BIT,
731     /// Directed connectable extended advertising
732     GAPM_EXT_ADV_PROP_DIR_CONN_MASK          = GAPM_ADV_PROP_CONNECTABLE_BIT | GAPM_ADV_PROP_DIRECTED_BIT,
733 };
734 
735 /// Advertising properties configurations for periodic advertising
736 enum gapm_per_adv_prop
737 {
738     /// Undirected periodic advertising
739     GAPM_PER_ADV_PROP_UNDIR_MASK = 0x0000,
740     /// Directed periodic advertising
741     GAPM_PER_ADV_PROP_DIR_MASK   = GAPM_ADV_PROP_DIRECTED_BIT,
742 };
743 
744 /// Clock accuracy values
745 enum gapm_clk_acc
746 {
747     /// 500 ppm
748     GAPM_CLK_ACC_500 = 0,
749     /// 250 ppm
750     GAPM_CLK_ACC_250,
751     /// 150 ppm
752     GAPM_CLK_ACC_150,
753     /// 100 ppm
754     GAPM_CLK_ACC_100,
755     /// 75 ppm
756     GAPM_CLK_ACC_75,
757     /// 50 ppm
758     GAPM_CLK_ACC_50,
759     /// 30 ppm
760     GAPM_CLK_ACC_30,
761     /// 20 ppm
762     GAPM_CLK_ACC_20,
763 };
764 
765 /// Privacy configuration
766 enum gapm_priv_cfg
767 {
768     /// Indicate if identity address is a public (0) or static private random (1) address
769     GAPM_PRIV_CFG_PRIV_ADDR_BIT = (1 << 0),
770     /// Reserved
771     GAPM_PRIV_CFG_RSVD          = (1 << 1),
772     /// Indicate if controller privacy is enabled
773     GAPM_PRIV_CFG_PRIV_EN_BIT   = (1 << 2),
774 };
775 
776 /*
777  * TYPE DEFINITIONS
778  ****************************************************************************************
779  */
780 
781 /// Configuration for advertising on primary channel
782 /*@TRACE*/
783 struct gapm_adv_prim_cfg
784 {
785     /// Minimum advertising interval (in unit of 625us). Must be greater than 20ms
786     uint32_t adv_intv_min;
787     /// Maximum advertising interval (in unit of 625us). Must be greater than 20ms
788     uint32_t adv_intv_max;
789     /// Bit field indicating the channel mapping
790     uint8_t chnl_map;
791     /// Indicate on which PHY primary advertising has to be performed (@see enum gapm_phy_type)
792     /// Note that LE 2M PHY is not allowed and that legacy advertising only support LE 1M PHY
793     uint8_t phy;
794 };
795 
796 /// Configuration for advertising on secondary channel
797 struct gapm_adv_second_cfg
798 {
799     /// Maximum number of advertising events the controller can skip before sending the
800     /// AUX_ADV_IND packets. 0 means that AUX_ADV_IND PDUs shall be sent prior each
801     /// advertising events
802     uint8_t max_skip;
803     /// Indicate on which PHY secondary advertising has to be performed (@see enum gapm_phy_type)
804     uint8_t phy;
805     /// Advertising SID
806     uint8_t adv_sid;
807 };
808 
809 /// Configuration for periodic advertising
810 struct gapm_adv_period_cfg
811 {
812     /// Minimum advertising interval (in unit of 1.25ms). Must be greater than 20ms
813     uint16_t adv_intv_min;
814     /// Maximum advertising interval (in unit of 1.25ms). Must be greater than 20ms
815     uint16_t adv_intv_max;
816 };
817 
818 /// Advertising parameters for advertising creation
819 struct gapm_adv_create_param
820 {
821     /// Advertising type (@see enum gapm_adv_type)
822     uint8_t type;
823     /// Discovery mode (@see enum gapm_adv_disc_mode)
824     uint8_t disc_mode;
825     /// Bit field value provided advertising properties (@see enum gapm_adv_prop for bit signification)
826     uint16_t prop;
827     /// Maximum power level at which the advertising packets have to be transmitted
828     /// (between -127 and 126 dBm)
829     int8_t max_tx_pwr;
830     /// Advertising filtering policy (@see enum adv_filter_policy)
831     uint8_t filter_pol;
832     /// Peer address configuration (only used in case of directed advertising)
833     struct gap_bdaddr peer_addr;
834     /// Configuration for primary advertising
835     struct gapm_adv_prim_cfg prim_cfg;
836     /// Configuration for secondary advertising (valid only if advertising type is
837     /// GAPM_ADV_TYPE_EXTENDED or GAPM_ADV_TYPE_PERIODIC)
838     struct gapm_adv_second_cfg second_cfg;
839     /// Configuration for periodic advertising (valid only if advertising type os
840     /// GAPM_ADV_TYPE_PERIODIC)
841     struct gapm_adv_period_cfg period_cfg;
842 };
843 
844 /// Additional advertising parameters
845 /*@TRACE*/
846 struct gapm_adv_param
847 {
848     /// Advertising duration (in unit of 10ms). 0 means that advertising continues
849     /// until the host disable it
850     uint16_t duration;
851     /// Maximum number of extended advertising events the controller shall attempt to send prior to
852     /// terminating the extending advertising
853     /// Valid only if extended advertising
854     uint8_t max_adv_evt;
855 };
856 
857 /// Scan Window operation parameters
858 /*@TRACE*/
859 struct gapm_scan_wd_op_param
860 {
861     /// Scan interval
862     uint16_t scan_intv;
863     /// Scan window
864     uint16_t scan_wd;
865 };
866 
867 /// Scanning parameters
868 /*@TRACE*/
869 struct gapm_scan_param
870 {
871     /// Type of scanning to be started (@see enum gapm_scan_type)
872     uint8_t type;
873     /// Properties for the scan procedure (@see enum gapm_scan_prop for bit signification)
874     uint8_t prop;
875     /// Duplicate packet filtering policy
876     uint8_t dup_filt_pol;
877     /// Reserved for future use
878     uint8_t rsvd;
879     /// Scan window opening parameters for LE 1M PHY
880     struct gapm_scan_wd_op_param scan_param_1m;
881     /// Scan window opening parameters for LE Coded PHY
882     struct gapm_scan_wd_op_param scan_param_coded;
883     /// Scan duration (in unit of 10ms). 0 means that the controller will scan continuously until
884     /// reception of a stop command from the application
885     uint16_t duration;
886     /// Scan period (in unit of 1.28s). Time interval betweem two consequent starts of a scan duration
887     /// by the controller. 0 means that the scan procedure is not periodic
888     uint16_t period;
889 };
890 
891 /// Connection parameters
892 /*@TRACE*/
893 struct gapm_conn_param
894 {
895     /// Minimum value for the connection interval (in unit of 1.25ms). Shall be less than or equal to
896     /// conn_intv_max value. Allowed range is 7.5ms to 4s.
897     uint16_t conn_intv_min;
898     /// Maximum value for the connection interval (in unit of 1.25ms). Shall be greater than or equal to
899     /// conn_intv_min value. Allowed range is 7.5ms to 4s.
900     uint16_t conn_intv_max;
901     /// Slave latency. Number of events that can be missed by a connected slave device
902     uint16_t conn_latency;
903     /// Link supervision timeout (in unit of 10ms). Allowed range is 100ms to 32s
904     uint16_t supervision_to;
905     /// Recommended minimum duration of connection events (in unit of 625us)
906     uint16_t ce_len_min;
907     /// Recommended maximum duration of connection events (in unit of 625us)
908     uint16_t ce_len_max;
909 };
910 
911 /// Initiating parameters
912 /*@TRACE*/
913 struct gapm_init_param
914 {
915     /// Initiating type (@see enum gapm_init_type)
916     uint8_t type;
917     /// Properties for the initiating procedure (@see enum gapm_init_prop for bit signification)
918     uint8_t prop;
919     /// Timeout for automatic connection establishment (in unit of 10ms). Cancel the procedure if not all
920     /// indicated devices have been connected when the timeout occurs. 0 means there is no timeout
921     uint16_t conn_to;
922     /// Scan window opening parameters for LE 1M PHY
923     struct gapm_scan_wd_op_param scan_param_1m;
924     /// Scan window opening parameters for LE Coded PHY
925     struct gapm_scan_wd_op_param scan_param_coded;
926     /// Connection parameters for LE 1M PHY
927     struct gapm_conn_param conn_param_1m;
928     /// Connection parameters for LE 2M PHY
929     struct gapm_conn_param conn_param_2m;
930     /// Connection parameters for LE Coded PHY
931     struct gapm_conn_param conn_param_coded;
932     /// Address of peer device in case white list is not used for connection
933     struct gap_bdaddr peer_addr;
934 };
935 
936 /// Periodic advertising information
937 /*@TRACE*/
938 struct gapm_period_adv_addr_cfg
939 {
940     /// Advertiser address information
941     struct gap_bdaddr addr;
942     /// Advertising SID
943     uint8_t adv_sid;
944 };
945 
946 /// Periodic synchronization parameters
947 /*@TRACE*/
948 struct gapm_per_sync_param
949 {
950     /// Number of periodic advertising that can be skipped after a successful receive. Maximum authorized
951     /// value is 499
952     uint16_t skip;
953     /// Synchronization timeout for the periodic advertising (in unit of 10ms between 100ms and 163.84s)
954     uint16_t sync_to;
955     /// Periodic synchronization type (@see enum gapm_per_sync_type)
956     uint8_t type;
957     /// Reserved for future use
958     uint8_t rsvd;
959     /// Address of advertiser with which synchronization has to be established (used only if use_pal is false)
960     struct gapm_period_adv_addr_cfg adv_addr;
961 };
962 
963 /// Operation command structure in order to keep requested operation.
964 struct gapm_operation_cmd
965 {
966     /// GAP request type
967     uint8_t operation;
968 };
969 
970 /// Command complete event data structure
971 /*@TRACE*/
972 struct gapm_cmp_evt
973 {
974     /// GAP requested operation
975     uint8_t operation;
976     /// Status of the request
977     uint8_t status;
978 };
979 
980 ///  Reset link layer and the host command
981 /*@TRACE*/
982 struct gapm_reset_cmd
983 {
984     /// GAPM requested operation:
985     /// - GAPM_RESET: Reset BLE subsystem: LL and HL.
986     uint8_t operation;
987 };
988 
989 /// Set device configuration command
990 /*@TRACE*/
991 struct gapm_set_dev_config_cmd
992 {
993     /// GAPM requested operation:
994     ///  - GAPM_SET_DEV_CONFIG: Set device configuration
995     uint8_t operation;
996     /// Device Role: Central, Peripheral, Observer, Broadcaster or All roles.
997     uint8_t role;
998 
999     /// -------------- Privacy Config -----------------------
1000     /// Duration before regenerate device address when privacy is enabled. - in seconds
1001     uint16_t renew_dur;
1002     /// Provided own static private random address
1003     bd_addr_t addr;
1004     /// Device IRK used for resolvable random BD address generation (LSB first)
1005     struct gap_sec_key irk;
1006     /// Privacy configuration bit field (@see enum gapm_priv_cfg for bit signification)
1007     uint8_t privacy_cfg;
1008 
1009     /// -------------- Security Config -----------------------
1010 
1011     /// Pairing mode authorized (@see enum gapm_pairing_mode)
1012     uint8_t pairing_mode;
1013 
1014     /// -------------- ATT Database Config -----------------------
1015 
1016     /// GAP service start handle
1017     uint16_t gap_start_hdl;
1018     /// GATT service start handle
1019     uint16_t gatt_start_hdl;
1020 
1021     /// Attribute database configuration (@see enum gapm_att_cfg_flag)
1022     uint16_t  att_cfg;
1023 
1024     /// -------------- LE Data Length Extension -----------------------
1025     ///Suggested value for the Controller's maximum transmitted number of payload octets to be used
1026     uint16_t sugg_max_tx_octets;
1027     ///Suggested value for the Controller's maximum packet transmission time to be used
1028     uint16_t sugg_max_tx_time;
1029 
1030     /// --------------- L2CAP Configuration ---------------------------
1031     /// Maximal MTU acceptable for device
1032     uint16_t max_mtu;
1033     /// Maximal MPS Packet size acceptable for device
1034     uint16_t max_mps;
1035     /// Maximum number of LE Credit based connection that can be established
1036     uint8_t  max_nb_lecb;
1037 
1038     /// --------------- LE Audio Mode Supported -----------------------
1039     ///
1040     /// LE Audio Mode Configuration (@see gapm_audio_cfg_flag)
1041     uint16_t  audio_cfg;
1042 
1043     /// ------------------ LE PHY Management  -------------------------
1044     /// Preferred LE PHY for data transmission (@see enum gap_phy)
1045     uint8_t tx_pref_phy;
1046     /// Preferred LE PHY for data reception (@see enum gap_phy)
1047     uint8_t rx_pref_phy;
1048 
1049     /// ------------------ Miscellaneous 2 ----------------------------
1050     /// RF TX Path Compensation value (from -128dB to 128dB, unit is 0.1dB)
1051     uint16_t tx_path_comp;
1052     /// RF RX Path Compensation value (from -128dB to 128dB, unit is 0.1dB)
1053     uint16_t rx_path_comp;
1054 };
1055 
1056 /// Set new IRK
1057 /*@TRACE*/
1058 struct gapm_set_irk_cmd
1059 {
1060     /// GAPM requested operation:
1061     ///  - GAPM_SET_IRK: Set device configuration
1062     uint8_t operation;
1063     /// Device IRK used for resolvable random BD address generation (LSB first)
1064     struct gap_sec_key irk;
1065 };
1066 
1067 /// Set device channel map
1068 /*@TRACE*/
1069 struct gapm_set_channel_map_cmd
1070 {
1071     /// GAPM requested operation:
1072     ///  - GAPM_SET_CHANNEL_MAP: Set device channel map.
1073     uint8_t operation;
1074     /// Channel map
1075     le_chnl_map_t chmap;
1076 };
1077 
1078 /// Get local device info command
1079 /*@TRACE*/
1080 struct gapm_get_dev_info_cmd
1081 {
1082     /// GAPM requested operation:
1083     ///  - GAPM_GET_DEV_VERSION: Get Local device version
1084     ///  - GAPM_GET_DEV_BDADDR: Get Local device BD Address
1085     ///  - GAPM_GET_DEV_ADV_TX_POWER: Get device advertising power level
1086     ///  - GAPM_DBG_GET_MEM_INFO: Get memory usage (debug only)
1087     uint8_t operation;
1088 };
1089 
1090 /// Local device version indication event
1091 /*@TRACE*/
1092 struct gapm_dev_version_ind
1093 {
1094     /// HCI version
1095     uint8_t hci_ver;
1096     /// LMP version
1097     uint8_t lmp_ver;
1098     /// Host version
1099     uint8_t host_ver;
1100     /// HCI revision
1101     uint16_t hci_subver;
1102     /// LMP subversion
1103     uint16_t lmp_subver;
1104     /// Host revision
1105     uint16_t host_subver;
1106     /// Manufacturer name
1107     uint16_t manuf_name;
1108 };
1109 
1110 /// Local device BD Address indication event
1111 /*@TRACE*/
1112 struct gapm_dev_bdaddr_ind
1113 {
1114     /// Local device address information
1115     struct gap_bdaddr addr;
1116     /// Activity index
1117     uint8_t actv_idx;
1118 };
1119 
1120 /// Advertising channel Tx power level indication event
1121 /*@TRACE*/
1122 struct gapm_dev_adv_tx_power_ind
1123 {
1124     /// Advertising channel Tx power level
1125     int8_t     power_lvl;
1126 };
1127 
1128 /// Resolving Address indication event
1129 /*@TRACE*/
1130 struct gapm_ral_addr_ind
1131 {
1132     /// Peer or local read operation
1133     uint8_t operation;
1134     /// Resolving List address
1135     struct gap_bdaddr addr;
1136 };
1137 
1138 /// Resolve Address command
1139 /*@TRACE*/
1140 struct gapm_resolv_addr_cmd
1141 {
1142     /// GAPM requested operation:
1143     ///  - GAPM_RESOLV_ADDR: Resolve device address
1144     uint8_t operation;
1145     /// Number of provided IRK (sahlle be > 0)
1146     uint8_t nb_key;
1147     /// Resolvable random address to solve
1148     bd_addr_t addr;
1149     /// Array of IRK used for address resolution (MSB -> LSB)
1150     struct gap_sec_key irk[__ARRAY_EMPTY];
1151 };
1152 
1153 /// Indicate that resolvable random address has been solved
1154 /*@TRACE*/
1155 struct gapm_addr_solved_ind
1156 {
1157     /// Resolvable random address solved
1158     bd_addr_t addr;
1159     /// IRK that correctly solved the random address
1160     struct gap_sec_key irk;
1161 };
1162 
1163 /// Name of peer device indication
1164 /*@TRACE*/
1165 struct gapm_peer_name_ind
1166 {
1167     /// peer device bd address
1168     bd_addr_t addr;
1169     /// peer device address type
1170     uint8_t addr_type;
1171     /// peer device name length
1172     uint8_t name_len;
1173     /// peer device name
1174     uint8_t name[__ARRAY_EMPTY];
1175 };
1176 
1177 /// Generate a random address.
1178 /*@TRACE*/
1179 struct gapm_gen_rand_addr_cmd
1180 {
1181     /// GAPM requested operation:
1182     ///  - GAPM_GEN_RAND_ADDR: Generate a random address
1183     uint8_t  operation;
1184     /// Dummy parameter used to store the prand part of the address
1185     uint8_t  prand[GAP_ADDR_PRAND_LEN];
1186     /// Random address type @see gap_rnd_addr_type
1187     ///  - GAP_STATIC_ADDR: Static random address
1188     ///  - GAP_NON_RSLV_ADDR: Private non resolvable address
1189     ///  - GAP_RSLV_ADDR: Private resolvable address
1190     uint8_t rnd_type;
1191 };
1192 
1193 /// Parameters of the @ref GAPM_USE_ENC_BLOCK_CMD message
1194 /*@TRACE*/
1195 struct gapm_use_enc_block_cmd
1196 {
1197     /// Command Operation Code (shall be GAPM_USE_ENC_BLOCK)
1198     uint8_t operation;
1199     /// Operand 1
1200     uint8_t operand_1[GAP_KEY_LEN];
1201     /// Operand 2
1202     uint8_t operand_2[GAP_KEY_LEN];
1203 };
1204 
1205 /// Parameters of the @ref GAPM_USE_ENC_BLOCK_IND message
1206 /*@TRACE*/
1207 struct gapm_use_enc_block_ind
1208 {
1209     /// Result (16 bytes)
1210     uint8_t result[GAP_KEY_LEN];
1211 };
1212 
1213 /// Parameters of the @ref GAPM_GEN_DH_KEY_CMD message
1214 /*@TRACE*/
1215 struct gapm_gen_dh_key_cmd
1216 {
1217     /// Command Operation Code (shall be GAPM_GEN_DH_KEY)
1218     uint8_t operation;
1219     /// X coordinate
1220     uint8_t operand_1[GAP_P256_KEY_LEN];
1221     /// Y coordinate
1222     uint8_t operand_2[GAP_P256_KEY_LEN];
1223 };
1224 
1225 /// Parameters of the @ref GAPM_GEN_DH_KEY_IND message
1226 /*@TRACE*/
1227 struct gapm_gen_dh_key_ind
1228 {
1229     /// Result (32 bytes)
1230     uint8_t result[GAP_P256_KEY_LEN];
1231 };
1232 
1233 /// Parameters of the @ref GAPM_GET_PUB_KEY_CMD message
1234 /*@TRACE*/
1235 struct gapm_get_pub_key_cmd
1236 {
1237     /// Command Operation Code (shall be GAPM_GET_PUB_KEY)
1238     uint8_t operation;
1239 };
1240 
1241 /// Parameters of the @ref GAPM_PUB_KEY_IND message
1242 /*@TRACE*/
1243 struct gapm_pub_key_ind
1244 {
1245     /// X coordinate
1246     uint8_t pub_key_x[GAP_P256_KEY_LEN];
1247     /// Y coordinate
1248     uint8_t pub_key_y[GAP_P256_KEY_LEN];
1249 };
1250 
1251 /// Parameters of the @ref GAPM_GEN_RAND_NB_CMD message
1252 /*@TRACE*/
1253 struct gapm_gen_rand_nb_cmd
1254 {
1255     /// Command Operation Code (shall be GAPM_GEN_RAND_NB)
1256     uint8_t operation;
1257 };
1258 
1259 /// Parameters of the @ref GAPM_GEN_RAND_NB_IND message
1260 /*@TRACE*/
1261 struct gapm_gen_rand_nb_ind
1262 {
1263     /// Generation Random Number (8 bytes)
1264     rand_nb_t randnb;
1265 };
1266 
1267 /// Create new task for specific profile
1268 /*@TRACE*/
1269 struct gapm_profile_task_add_cmd
1270 {
1271     /// GAPM requested operation:
1272     ///  - GAPM_PROFILE_TASK_ADD: Add new profile task
1273     uint8_t  operation;
1274     /// Security Level :
1275     ///  7    6    5    4    3    2    1    0
1276     /// +----+----+----+----+----+----+----+----+
1277     /// |   Reserved   |DIS |  AUTH   |EKS | MI |
1278     /// +----+----+----+----+----+----+----+----+
1279     ///
1280     /// - MI: 1 - Application task is a Multi-Instantiated task, 0 - Mono-Instantiated
1281     /// Only applies for service - Ignored by collectors:
1282     /// - EKS: Service needs a 16 bytes encryption key
1283     /// - AUTH: 0 - Disable, 1 - Enable, 2 - Unauth, 3 - Auth
1284     /// - DIS: Disable the service
1285     uint8_t  sec_lvl;
1286     /// Profile task identifier
1287     uint16_t prf_task_id;
1288     /// Application task number
1289     uint16_t app_task;
1290     /// Service start handle
1291     /// Only applies for services - Ignored by collectors
1292     /// 0: dynamically allocated in Attribute database
1293     uint16_t start_hdl;
1294     /// 32 bits value that contains value to initialize profile (database parameters, etc...)
1295     uint32_t param[__ARRAY_EMPTY];
1296 };
1297 
1298 /// Inform that profile task has been added.
1299 /*@TRACE*/
1300 struct gapm_profile_added_ind
1301 {
1302     /// Profile task identifier
1303     uint16_t prf_task_id;
1304     /// Profile task number allocated
1305     uint16_t prf_task_nb;
1306     /// Service start handle
1307     /// Only applies for services - Ignored by collectors
1308     uint16_t start_hdl;
1309 };
1310 
1311 /// Indicate that a message has been received on an unknown task
1312 /*@TRACE*/
1313 struct gapm_unknown_task_ind
1314 {
1315     /// Message identifier
1316     uint16_t msg_id;
1317     /// Task identifier
1318     uint16_t task_id;
1319 };
1320 
1321 /// Indicates suggested default data length
1322 /*@TRACE*/
1323 struct gapm_sugg_dflt_data_len_ind
1324 {
1325     ///Host's suggested value for the Controller's maximum transmitted number of payload octets
1326     uint16_t suggted_max_tx_octets;
1327     ///Host's suggested value for the Controller's maximum packet transmission time
1328     uint16_t suggted_max_tx_time;
1329 };
1330 
1331 /// Indicates maximum data length
1332 /*@TRACE*/
1333 struct gapm_max_data_len_ind
1334 {
1335     ///Maximum number of payload octets that the local Controller supports for transmission
1336     uint16_t suppted_max_tx_octets;
1337     ///Maximum time, in microseconds, that the local Controller supports for transmission
1338     uint16_t suppted_max_tx_time;
1339     ///Maximum number of payload octets that the local Controller supports for reception
1340     uint16_t suppted_max_rx_octets;
1341     ///Maximum time, in microseconds, that the local Controller supports for reception
1342     uint16_t suppted_max_rx_time;
1343 };
1344 
1345 /// Register a LE Protocol/Service Multiplexer command
1346 /*@TRACE*/
1347 struct gapm_lepsm_register_cmd
1348 {
1349     /// GAPM requested operation:
1350     ///  - GAPM_LEPSM_REG: Register a LE Protocol/Service Multiplexer
1351     uint8_t  operation;
1352     /// LE Protocol/Service Multiplexer
1353     uint16_t le_psm;
1354     /// Application task number
1355     uint16_t app_task;
1356     /// Security level
1357     ///   7   6   5   4   3   2   1   0
1358     /// +---+---+---+---+---+---+---+---+
1359     /// |MI |      RFU      |EKS|SEC_LVL|
1360     /// +---+---+---+---+---+---+---+---+
1361     /// bit[0-1]: Security level requirement (0=NO_AUTH, 1=UNAUTH, 2=AUTH, 3=SEC_CON)
1362     /// bit[2]  : Encryption Key Size length must have 16 bytes
1363     /// bit[7]  : Does the application task is multi-instantiated or not
1364     uint8_t sec_lvl;
1365 };
1366 
1367 /// Unregister a LE Protocol/Service Multiplexer command
1368 /*@TRACE*/
1369 struct gapm_lepsm_unregister_cmd
1370 {
1371     /// GAPM requested operation:
1372     ///  - GAPM_LEPSM_UNREG: Unregister a LE Protocol/Service Multiplexer
1373     uint8_t  operation;
1374     /// LE Protocol/Service Multiplexer
1375     uint16_t le_psm;
1376 };
1377 
1378 /// Control LE Test Mode command
1379 struct gapm_le_test_mode_ctrl_cmd
1380 {
1381     /// GAPM requested operation:
1382     ///  - GAPM_LE_TEST_STOP: Unregister a LE Protocol/Service Multiplexer
1383     ///  - GAPM_LE_TEST_RX_START: Start RX Test Mode
1384     ///  - GAPM_LE_TEST_TX_START: Start TX Test Mode
1385     uint8_t operation;
1386     /// Tx or Rx Channel (Range 0x00 to 0x27)
1387     uint8_t channel;
1388     /// Length in bytes of payload data in each packet (only valid for TX mode, range 0x00-0xFF)
1389     uint8_t tx_data_length;
1390     /// Packet Payload type (only valid for TX mode @see enum gap_pkt_pld_type)
1391     uint8_t tx_pkt_payload;
1392     /// Test PHY rate (@see enum gap_test_phy)
1393     uint8_t phy;
1394     /// Modulation Index (only valid for RX mode @see enum gap_modulation_idx)
1395     uint8_t modulation_idx;
1396 };
1397 
1398 /// Indicate end of test mode event
1399 struct gapm_le_test_end_ind
1400 {
1401     /// Number of received packets
1402     uint16_t nb_packet_received;
1403 };
1404 
1405 /// Provide statistic information about ISO exchange
1406 struct gapm_iso_stat_ind
1407 {
1408     /// ISO Handle of the isochronous channel (Range 0x0000-0x0EFF)
1409     uint16_t iso_hdl;
1410 
1411     /// Statistics - Number of transmission attempts
1412     uint32_t nb_tx;
1413     /// Statistics - Number of transmission attempts that succeed
1414     uint32_t nb_tx_ok;
1415     /// Statistics - Number of Not granted packet packets
1416     uint32_t nb_tx_not_granted;
1417 
1418     /// Statistics - Number of reception attempt
1419     uint32_t nb_rx;
1420     /// Statistics - Number of reception attempts that succeed
1421     uint32_t nb_rx_ok;
1422     /// Statistics - Number of Not granted packet packets
1423     uint32_t nb_rx_not_granted;
1424     /// Statistics - Number of wrongly received packet (invalid data)
1425     uint32_t nb_rx_data_err;
1426     /// Statistics - Number of CRC Errors
1427     uint32_t nb_rx_crc_err;
1428     /// Statistics - Number of SYNC Errors
1429     uint32_t nb_rx_sync_err;
1430     /// Statistics - Number of received empty packets
1431     uint32_t nb_rx_empty;
1432 };
1433 
1434 /// Create an advertising, a scanning, an initiating, a periodic synchonization activity command (common)
1435 /*@TRACE*/
1436 struct gapm_activity_create_cmd
1437 {
1438     /// GAPM request operation:
1439     ///  - GAPM_CREATE_ADV_ACTIVITY: Create advertising activity
1440     ///  - GAPM_CREATE_SCAN_ACTIVITY: Create scanning activity
1441     ///  - GAPM_CREATE_INIT_ACTIVITY: Create initiating activity
1442     ///  - GAPM_CREATE_PERIOD_SYNC_ACTIVITY: Create periodic synchronization activity
1443     uint8_t operation;
1444     /// Own address type (@see enum gapm_own_addr)
1445     uint8_t own_addr_type;
1446 };
1447 
1448 /// Create an advertising activity command
1449 struct gapm_activity_create_adv_cmd
1450 {
1451     /// GAPM request operation:
1452     ///  - GAPM_CREATE_ADV_ACTIVITY: Create advertising activity
1453     uint8_t operation;
1454     /// Own address type (@see enum gapm_own_addr)
1455     uint8_t own_addr_type;
1456     /// Advertising parameters (optional, shall be present only if operation is GAPM_CREATE_ADV_ACTIVITY)
1457     /// For prop parameter, @see enum gapm_leg_adv_prop, @see enum gapm_ext_adv_prop and @see enum gapm_per_adv_prop for help
1458     struct gapm_adv_create_param adv_param;
1459 };
1460 
1461 /// Activity parameters
1462 /*@TRACE
1463  @trc_ref gapm_actv_type
1464  */
1465 union gapm_u_param
1466 {
1467     /// Additional advertising parameters (for advertising activity)
1468     //@trc_union @activity_map[$parent.actv_idx] == GAPM_ACTV_TYPE_ADV
1469     struct gapm_adv_param adv_add_param;
1470     /// Scan parameters (for scanning activity)
1471     //@trc_union @activity_map[$parent.actv_idx] == GAPM_ACTV_TYPE_SCAN
1472     struct gapm_scan_param scan_param;
1473     /// Initiating parameters (for initiating activity)
1474     //@trc_union @activity_map[$parent.actv_idx] == GAPM_ACTV_TYPE_INIT
1475     struct gapm_init_param init_param;
1476     /// Periodic synchronization parameters (for periodic synchronization activity)
1477     //@trc_union @activity_map[$parent.actv_idx] == GAPM_ACTV_TYPE_PER_SYNC
1478     struct gapm_per_sync_param per_sync_param;
1479 };
1480 
1481 /// Start a given activity command
1482 /*@TRACE*/
1483 struct gapm_activity_start_cmd
1484 {
1485     /// GAPM request operation:
1486     ///  - GAPM_START_ACTIVITY: Start a given activity
1487     uint8_t operation;
1488     /// Activity identifier
1489     uint8_t actv_idx;
1490     /// Activity parameters
1491     union gapm_u_param u_param;
1492 };
1493 
1494 /// Stop one or all activity(ies) command
1495 /*@TRACE*/
1496 struct gapm_activity_stop_cmd
1497 {
1498     /// GAPM request operation:
1499     ///  - GAPM_STOP_ACTIVITY: Stop a given activity
1500     ///  - GAPM_STOP_ALL_ACTIVITIES: Stop all existing activities
1501     uint8_t operation;
1502     /// Activity identifier - used only if operation is GAPM_STOP_ACTIVITY
1503     uint8_t actv_idx;
1504 };
1505 
1506 /// Delete one or all activity(ies) command
1507 /*@TRACE*/
1508 struct gapm_activity_delete_cmd
1509 {
1510     /// GAPM request operation:
1511     ///  - GAPM_DELETE_ACTIVITY: Delete a given activity
1512     ///  - GAPM_DELETE_ALL_ACTIVITIES: Delete all existing activities
1513     uint8_t operation;
1514     /// Activity identifier - used only if operation is GAPM_STOP_ACTIVITY
1515     uint8_t actv_idx;
1516 };
1517 
1518 /// Indicate creation of an activity
1519 /*@TRACE
1520  @trc_exec activity_map[$actv_idx] = $actv_type
1521  activity_map = {}*/
1522 struct gapm_activity_created_ind
1523 {
1524     /// Activity identifier
1525     uint8_t actv_idx;
1526     /// Activity type (@see enum gapm_actv_type)
1527     uint8_t actv_type;
1528     /// Selected TX power for advertising activity
1529     int8_t  tx_pwr;
1530 };
1531 
1532 /// Indicate that an activity has been stopped
1533 /*@TRACE*/
1534 struct gapm_activity_stopped_ind
1535 {
1536     /// Activity identifier
1537     uint8_t actv_idx;
1538     /// Activity type (@see enum gapm_actv_type)
1539     uint8_t actv_type;
1540     /// Activity stop reason
1541     uint8_t reason;
1542     /// In case of periodic advertising, indicate if periodic advertising has been stopped
1543     uint8_t per_adv_stop;
1544 };
1545 
1546 /// Set advertising, scan response or periodic advertising data command
1547 /*@TRACE*/
1548 struct gapm_set_adv_data_cmd
1549 {
1550     /// GAPM request operation:
1551     ///  - GAPM_SET_ADV_DATA: Set advertising data
1552     ///  - GAPM_SET_SCAN_RSP_DATA: Set scan response data
1553     ///  - GAPM_SET_PERIOD_ADV_DATA: Set periodic advertising data
1554     uint8_t operation;
1555     /// Activity identifier
1556     uint8_t actv_idx;
1557     /// Data length
1558     uint16_t length;
1559     /// Data
1560     uint8_t data[__ARRAY_EMPTY];
1561 };
1562 
1563 /// Indicate reception of scan request
1564 /*@TRACE*/
1565 struct gapm_scan_request_ind
1566 {
1567     /// Activity identifier
1568     uint8_t actv_idx;
1569     /// Transmitter device address
1570     struct gap_bdaddr trans_addr;
1571 };
1572 
1573 /// Indicate reception of advertising, scan response or periodic advertising data
1574 /*@TRACE*/
1575 struct gapm_ext_adv_report_ind
1576 {
1577     /// Activity identifier
1578     uint8_t actv_idx;
1579     /// Bit field providing information about the received report (@see enum gapm_adv_report_info)
1580     uint8_t info;
1581     /// Transmitter device address
1582     struct gap_bdaddr trans_addr;
1583     /// Target address (in case of a directed advertising report)
1584     struct gap_bdaddr target_addr;
1585     /// TX power (in dBm)
1586     int8_t tx_pwr;
1587     /// RSSI (between -127 and +20 dBm)
1588     int8_t rssi;
1589     /// Primary PHY on which advertising report has been received
1590     uint8_t phy_prim;
1591     /// Secondary PHY on which advertising report has been received
1592     uint8_t phy_second;
1593     /// Advertising SID
1594     /// Valid only for periodic advertising report
1595     uint8_t adv_sid;
1596     /// Periodic advertising interval (in unit of 1.25ms, min is 7.5ms)
1597     /// Valid only for periodic advertising report
1598     uint16_t period_adv_intv;
1599     /// Report length
1600     uint16_t length;
1601     /// Report
1602     uint8_t data[__ARRAY_EMPTY];
1603 };
1604 
1605 /// Indicate that synchronization has been established with a periodic advertiser
1606 /*@TRACE*/
1607 struct gapm_sync_established_ind
1608 {
1609     /// Activity identifier
1610     uint8_t actv_idx;
1611     /// PHY on which synchronization has been established (@see gap_phy_type)
1612     uint8_t phy;
1613     /// Periodic advertising interval (in unit of 1.25ms, min is 7.5ms)
1614     uint16_t intv;
1615     /// Advertising SID
1616     uint8_t adv_sid;
1617     /// Advertiser clock accuracy (@see enum gapm_clk_acc)
1618     uint8_t clk_acc;
1619     /// Advertiser address
1620     struct gap_bdaddr addr;
1621 };
1622 
1623 /// Read local or peer address
1624 /*@TRACE*/
1625 struct gapm_get_ral_addr_cmd
1626 {
1627     /// GAPM request operation:
1628     ///  - GAPM_GET_RAL_LOC_ADDR: Get resolving local address
1629     ///  - GAPM_GET_RAL_PEER_ADDR: Get resolving peer address
1630     uint8_t operation;
1631     /// Peer device identity
1632     struct gap_bdaddr peer_identity;
1633 };
1634 
1635 /// Set content of either white list or resolving list or periodic advertiser list command (common part)
1636 struct gapm_list_set_cmd
1637 {
1638     /// GAPM request operation:
1639     ///  - GAPM_SET_WHITE_LIST: Set white list content
1640     ///  - GAPM_SET_RAL: Set resolving list content
1641     ///  - GAPM_SET_PAL: Set periodic advertiser list content
1642     uint8_t operation;
1643     /// Number of entries to be added in the list. 0 means that list content has to be cleared
1644     uint8_t size;
1645 };
1646 
1647 /// Set content of white list
1648 /*@TRACE*/
1649 struct gapm_list_set_wl_cmd
1650 {
1651     /// GAPM request operation:
1652     ///  - GAPM_SET_WHITE_LIST: Set white list content
1653     uint8_t operation;
1654     /// Number of entries to be added in the list. 0 means that list content has to be cleared
1655     uint8_t size;
1656     /// List of entries to be added in the list
1657     struct gap_bdaddr wl_info[__ARRAY_EMPTY];
1658 };
1659 
1660 /// Set content of resolving list command
1661 /*@TRACE*/
1662 struct gapm_list_set_ral_cmd
1663 {
1664     /// GAPM request operation:
1665     ///  - GAPM_SET_RAL: Set resolving list content
1666     uint8_t operation;
1667     /// Number of entries to be added in the list. 0 means that list content has to be cleared
1668     uint8_t size;
1669     /// List of entries to be added in the list
1670     struct gap_ral_dev_info ral_info[__ARRAY_EMPTY];
1671 };
1672 
1673 /// Set content of periodic advertiser list command
1674 /*@TRACE*/
1675 struct gapm_list_set_pal_cmd
1676 {
1677     /// GAPM request operation:
1678     ///  - GAPM_SET_PAL: Set periodic advertiser list content
1679     uint8_t operation;
1680     /// Number of entries to be added in the list. 0 means that list content has to be cleared
1681     uint8_t size;
1682     /// List of entries to be added in the list
1683     struct gapm_period_adv_addr_cfg pal_info[__ARRAY_EMPTY];
1684 };
1685 
1686 /*@TRACE
1687  @trc_ref gapm_operation
1688  gapm_list_set_cmd = gapm_u_list_set
1689 */
1690 union gapm_u_list_set
1691 {
1692     uint8_t operation;
1693 
1694     //@trc_union operation == GAPM_SET_WL
1695     struct gapm_list_set_wl_cmd list_set_wl_cmd;
1696     //@trc_union operation == GAPM_SET_RAL
1697     struct gapm_list_set_ral_cmd list_set_ral_cmd;
1698     //@trc_union operation == GAPM_SET_PAL
1699     struct gapm_list_set_pal_cmd list_set_pal_cmd;
1700 };
1701 
1702 /// List Size indication event
1703 /*@TRACE*/
1704 struct gapm_list_size_ind
1705 {
1706     /// Operation code, indicate list for which size has been read
1707     ///     - GAPM_SET_WHITE_LIST
1708     ///     - GAPM_SET_RAL
1709     ///     - GAPM_SET_PAL
1710     uint8_t operation;
1711     /// List size
1712     uint8_t size;
1713 };
1714 
1715 /// Maximum advertising data length indication event
1716 /*@TRACE*/
1717 struct gapm_max_adv_data_len_ind
1718 {
1719     /// Maximum advertising data length supported by controller
1720     uint16_t length;
1721 };
1722 
1723 /// Number of available advertising sets indication event
1724 /*@TRACE*/
1725 struct gapm_nb_adv_sets_ind
1726 {
1727     /// Number of available advertising sets
1728     uint8_t nb_adv_sets;
1729 };
1730 
1731 /// Indicate the transmit powers supported by the controller
1732 /*@TRACE*/
1733 struct gapm_dev_tx_pwr_ind
1734 {
1735     /// Minimum TX power
1736     int8_t min_tx_pwr;
1737     /// Maximum TX power
1738     int8_t max_tx_pwr;
1739 };
1740 
1741 /// Indicate the RF path compensation values
1742 /*@TRACE*/
1743 struct gapm_dev_rf_path_comp_ind
1744 {
1745     /// RF TX path compensation
1746     uint16_t tx_path_comp;
1747     /// RF RX path compensation
1748     uint16_t rx_path_comp;
1749 };
1750 
1751 /// Request to renew all currently used random private addresses (non-resolvable or resolvable)
1752 /// For internal use only
1753 /*@TRACE*/
1754 struct gapm_addr_renew_cmd
1755 {
1756     /// GAPM request operation:
1757     ///  - GAPM_RENEW_ADDR: Renew random private addresses
1758     uint8_t operation;
1759     /// Activity index, used by GAPM ADDR state machine in order to remind for which activity
1760     /// a new address has been generated
1761     uint8_t actv_idx;
1762     /// Index of first created initiating/scanning for which address has been renewed,
1763     /// any initiating/scanning met after shall use the same address if it uses a random
1764     /// address
1765     uint8_t init_scan_actv_idx;
1766 };
1767 
1768 /// Indicate that an unknown message has been received
1769 /*@TRACE*/
1770 struct gapm_unknown_msg_ind
1771 {
1772     /// Unknown message id
1773     ke_msg_id_t unknown_msg_id;
1774 };
1775 
1776 /*
1777  * MACROS
1778  ****************************************************************************************
1779  */
1780 
1781 /*
1782  * GLOBAL VARIABLE DECLARATIONS
1783  ****************************************************************************************
1784  */
1785 
1786 /*
1787  * FUNCTION DECLARATIONS
1788  ****************************************************************************************
1789  */
1790 
1791 #endif // _HAL_GAPM_TASK_H
1792