nrfxlib API 0.1.0
Loading...
Searching...
No Matches
sdc.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7
18#ifndef SDC_H__
19#define SDC_H__
20
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26
27#include <stdint.h>
28#include <stdbool.h>
29#include "nrf.h"
30#include "nrf_errno.h"
31
33#define SDC_DEFAULT_RESOURCE_CFG_TAG 0
34
36#define SDC_DEFAULT_ADV_COUNT 1
37
39#define SDC_DEFAULT_PERIODIC_ADV_COUNT 0
40
43#define SDC_DEFAULT_PERIODIC_SYNC_COUNT 0
44
46#define SDC_DEFAULT_PERIODIC_ADV_RSP_COUNT 0
47
49#define SDC_DEFAULT_PERIODIC_ADV_RSP_TX_BUFFER_COUNT 1
50
52#define SDC_DEFAULT_PERIODIC_ADV_RSP_MAX_TX_DATA 73
53
55#define SDC_DEFAULT_PERIODIC_ADV_RSP_RX_BUFFER_COUNT 0
56
58#define SDC_DEFAULT_PERIODIC_SYNC_RSP_TX_BUFFER_COUNT 1
59
61#define SDC_DEFAULT_PERIPHERAL_COUNT 1
62
64#define SDC_DEFAULT_CENTRAL_COUNT 1
65
67#define SDC_DEFAULT_TX_PACKET_SIZE 27
68
70#define SDC_DEFAULT_RX_PACKET_SIZE 27
71
76#define SDC_DEFAULT_TX_PACKET_COUNT 3
77
82#define SDC_DEFAULT_RX_PACKET_COUNT 2
83
85#define SDC_DEFAULT_FAL_SIZE 8
86
92#define SDC_DEFAULT_SCAN_BUFFER_COUNT 3
93
95#define SDC_DEFAULT_PERIODIC_SYNC_BUFFER_COUNT 2
96
98#define SDC_DEFAULT_ADV_BUF_SIZE 31
99
101#define SDC_DEFAULT_PERIODIC_ADV_LIST_SIZE 0
102
104#define SDC_DEFAULT_CIG_COUNT 0
105
107#define SDC_DEFAULT_CIS_COUNT 0
108
110#define SDC_DEFAULT_BIG_COUNT 0
111
113#define SDC_DEFAULT_BIS_SINK_COUNT 0
114
116#define SDC_DEFAULT_BIS_SOURCE_COUNT 0
117
119#define SDC_DEFAULT_ISO_RX_PDU_BUFFER_PER_STREAM_COUNT 0
120
122#define SDC_DEFAULT_ISO_RX_SDU_BUFFER_COUNT 0
123
125#define SDC_DEFAULT_ISO_RX_SDU_BUFFER_SIZE 251
126
128#define SDC_DEFAULT_ISO_TX_SDU_BUFFER_COUNT 0
129
131#define SDC_DEFAULT_ISO_TX_SDU_BUFFER_SIZE 247
132
134#define SDC_DEFAULT_ISO_TX_PDU_BUFFER_PER_STREAM_COUNT 0
135
137#define SDC_BUILD_REVISION_SIZE 20
138
151#define __MEM_MINIMAL_CENTRAL_LINK_SIZE 811
152#define __MEM_MINIMAL_PERIPHERAL_LINK_SIZE 915
153#define __MEM_TX_BUFFER_OVERHEAD_SIZE 14
154#define __MEM_RX_BUFFER_OVERHEAD_SIZE 14
155
156#define __MEM_ADDITIONAL_LINK_SIZE(tx_size, rx_size, tx_count, rx_count) \
157 ((tx_count) * ((tx_size) + __MEM_TX_BUFFER_OVERHEAD_SIZE) - \
158 (SDC_DEFAULT_TX_PACKET_SIZE + __MEM_TX_BUFFER_OVERHEAD_SIZE) + \
159 (rx_count) * ((rx_size) + __MEM_RX_BUFFER_OVERHEAD_SIZE) - \
160 (SDC_DEFAULT_RX_PACKET_SIZE + __MEM_RX_BUFFER_OVERHEAD_SIZE))
161
169#define SDC_MEM_PER_CENTRAL_LINK(tx_size, rx_size, tx_count, rx_count) \
170 (__MEM_MINIMAL_CENTRAL_LINK_SIZE + \
171 __MEM_ADDITIONAL_LINK_SIZE(tx_size, rx_size, tx_count, rx_count))
172
180#define SDC_MEM_PER_PERIPHERAL_LINK(tx_size, rx_size, tx_count, rx_count) \
181 (__MEM_MINIMAL_PERIPHERAL_LINK_SIZE + \
182 __MEM_ADDITIONAL_LINK_SIZE(tx_size, rx_size, tx_count, rx_count))
183
185#define SDC_MEM_CENTRAL_LINKS_SHARED 17
186
188#define SDC_MEM_PERIPHERAL_LINKS_SHARED 17
189
194#define SDC_MEM_LE_POWER_CONTROL(num_links) ((num_links) > 0 ? (13 + (num_links) * 115) : 0)
195
200#define SDC_MEM_SUBRATING(num_links) (11 + (num_links) * 19)
201
206#define SDC_MEM_SYNC_TRANSFER(num_links) ((num_links) > 0 ? (13 + (num_links) * 139) : 0)
207
209#define SDC_MEM_QOS_CHANNEL_SURVEY (40)
210
212#define SDC_MEM_SCAN(buffer_count) (345 + (buffer_count) * 98)
213
215#define SDC_MEM_SCAN_EXT(buffer_count) (345 + (buffer_count) * 320)
216
220#define SDC_MEM_INITIATOR (320)
221
223#define SDC_MEM_FAL(max_num_entries) ((max_num_entries) > 0 ? (4 + (max_num_entries) * 8) : 0)
224
226#define __MEM_PER_ADV_SET_LOW(max_adv_data) ((4912+(max_adv_data)*18)/10)
227#define __MEM_PER_ADV_SET_HIGH(max_adv_data) (679+(max_adv_data))
228#define __MEM_PER_PERIODIC_ADV_SET_LOW(max_adv_data) ((2658+(max_adv_data)*18)/10)
229#define __MEM_PER_PERIODIC_ADV_SET_HIGH(max_adv_data) (457+(max_adv_data))
230
235#define SDC_MEM_PER_ADV_SET(max_adv_data) ((max_adv_data<255)?\
236 (__MEM_PER_ADV_SET_LOW(max_adv_data)):\
237 (__MEM_PER_ADV_SET_HIGH(max_adv_data)))
238
245#define SDC_MEM_PER_PERIODIC_ADV_SET(max_adv_data) ((max_adv_data<255)?\
246 (__MEM_PER_PERIODIC_ADV_SET_LOW(max_adv_data)):\
247 (__MEM_PER_PERIODIC_ADV_SET_HIGH(max_adv_data)))
248
253#define SDC_MEM_PER_PERIODIC_SYNC(buffer_count) (218 + (buffer_count) * 279)
254
260#define SDC_MEM_PER_PERIODIC_SYNC_RSP(tx_buffer_count, rx_buffer_count) \
261 (639 + (tx_buffer_count - 1) * 254 + (rx_buffer_count) * 278)
262
267#define SDC_MEM_PERIODIC_ADV_LIST(list_size) ((list_size) * 8)
268
270#define __MEM_PER_PERIODIC_ADV_RSP_TX_BUFFER(max_tx_data_size) ((max_tx_data_size) + 5)
271#define __MEM_PER_PERIODIC_ADV_RSP_RX_BUFFER (282)
272#define __MEM_MINIMAL_PERIODIC_ADV_RSP_SET_SIZE_WITH_RX (465)
273#define __MEM_MINIMAL_PERIODIC_ADV_RSP_SET_SIZE_WITHOUT_RX (166)
274#define __MEM_FOR_PERIODIC_ADV_RSP_FAILURE_REPORTING (224)
275#define __MEM_PER_ISO_PDU_POOL(count) ((count) > 0 ? (16 + (count) * 288) : 0)
276#define __MEM_PER_ISO_TX_HCI_BUFFER(count) ((count) > 0 ? (12 + (count) * 300) : 0)
277
286#define SDC_MEM_PER_PERIODIC_ADV_RSP_SET(max_adv_data, tx_buffer_count, rx_buffer_count, max_tx_data_size, failure_reporting_enabled) \
287 (SDC_MEM_PER_PERIODIC_ADV_SET(max_adv_data) \
288 + ((rx_buffer_count) > 0 ? __MEM_MINIMAL_PERIODIC_ADV_RSP_SET_SIZE_WITH_RX : \
289 __MEM_MINIMAL_PERIODIC_ADV_RSP_SET_SIZE_WITHOUT_RX ) \
290 + (tx_buffer_count) * __MEM_PER_PERIODIC_ADV_RSP_TX_BUFFER(max_tx_data_size) \
291 + (rx_buffer_count) * __MEM_PER_PERIODIC_ADV_RSP_RX_BUFFER \
292 + ((failure_reporting_enabled) ? __MEM_FOR_PERIODIC_ADV_RSP_FAILURE_REPORTING : 0))
293
295#define SDC_MEM_PER_CIG(count) ((count) > 0 ? (13 + (count) * 123) : 0)
296
298#define SDC_MEM_PER_CIS(count) ((count) > 0 ? (13 + (count) * 548) : 0)
299
301#define SDC_MEM_PER_BIG(count) ((count) > 0 ? (13 + (count) * 284) : 0)
302
304#define SDC_MEM_PER_BIS(count) ((count) > 0 ? (13 + (count) * 268) : 0)
305
311#define SDC_MEM_ISO_RX_PDU_POOL_PER_STREAM_SIZE(rx_pdu_buffer_per_stream_count, cis_count, bis_sink_count) \
312 (__MEM_PER_ISO_PDU_POOL(rx_pdu_buffer_per_stream_count) * ((cis_count) + (bis_sink_count)))
313
317#define SDC_MEM_ISO_RX_SDU_POOL_SIZE(count, size) ((count) > 0 ? (8 + (count) * ((size) + 13)) : 0)
318
324#define SDC_MEM_ISO_TX_PDU_POOL_SIZE(tx_pdu_buffer_per_stream_count, cis_count, bis_source_count) \
325 ((tx_pdu_buffer_per_stream_count) > 0 ? \
326 __MEM_PER_ISO_PDU_POOL(tx_pdu_buffer_per_stream_count) * ((cis_count) + (bis_source_count)) : 0)
327
331#define SDC_MEM_ISO_TX_SDU_POOL_SIZE(count, size) ((count) > 0 ? (12 + (count) * ((size) + 49)) : 0)
332
344typedef void (*sdc_fault_handler_t)(const char * file, const uint32_t line);
345
346
351typedef void (*sdc_callback_t)(void);
352
353
355{
400};
401
402
404typedef struct
405{
406 uint8_t count;
408
409
411typedef struct
412{
422
423
425typedef struct
426{
427 uint8_t count;
429
430
431typedef struct
432{
440 uint16_t max_adv_data;
442
443
444typedef struct
445{
466
467
468typedef struct
469{
513
514
516typedef union
517{
553 uint16_t fal_size;
643} sdc_cfg_t;
644
645
660int32_t sdc_init(sdc_fault_handler_t fault_handler);
661
662
688int32_t sdc_cfg_set(uint8_t config_tag,
689 uint8_t config_type,
690 sdc_cfg_t const * p_resource_cfg);
691
692
710int32_t sdc_enable(sdc_callback_t callback,
711 uint8_t * p_mem);
712
713
721int32_t sdc_disable(void);
722
723
734int32_t sdc_build_revision_get(uint8_t * p_build_revision);
735
747int32_t sdc_support_adv(void);
748
762
777
793int32_t sdc_support_scan(void);
794
811
828
845
860
877
894
908
923
937
951
967
982
1000
1017
1031
1045
1059
1070
1081
1095
1109
1120
1131
1142
1153
1164
1175
1186
1197
1209
1219
1238int32_t sdc_default_tx_power_set(int8_t requested_power_level);
1239
1253
1267
1268#ifdef __cplusplus
1269}
1270#endif
1271
1274#endif /* SDC_H__ */
int32_t sdc_support_le_path_loss_monitoring(void)
Support LE Path Loss Monitoring.
int32_t sdc_support_peripheral(void)
Support Peripheral role.
int32_t sdc_support_le_conn_cte_rsp_peripheral(void)
Support LE Connection CTE response for peripheral role.
int32_t sdc_support_ext_adv(void)
Support extended advertising.
int32_t sdc_disable(void)
Disable the SoftDevice Controller.
int32_t sdc_iso_host_timestamps_ignore(bool ignore)
Configure the controller to ignore HCI ISO data timestamps from the host.
int32_t sdc_support_sca_central(void)
Support Sleep Clock Accuracy (SCA) Update procedure for central role.
int32_t sdc_support_connection_subrating_peripheral(void)
Support Connection Subrating for peripheral role.
void(* sdc_fault_handler_t)(const char *file, const uint32_t line)
Function prototype for the fault handler.
Definition: sdc.h:344
int32_t sdc_support_periodic_adv_sync_transfer_sender_peripheral(void)
Support for sending periodic advertising sync transfers as peripheral role.
int32_t sdc_support_periodic_adv_sync_transfer_receiver_peripheral(void)
Support for receiving periodic advertising sync transfers as peripheral role.
int32_t sdc_support_connection_subrating_central(void)
Support Connection Subrating for central role.
int32_t sdc_support_le_conn_cte_rsp_central(void)
Support LE Connection CTE response for central role.
int32_t sdc_cfg_set(uint8_t config_tag, uint8_t config_type, sdc_cfg_t const *p_resource_cfg)
Change or add a SoftDevice Controller configuration.
int32_t sdc_support_cis_peripheral(void)
Support Connected Isochronous streams in the peripheral role.
int32_t sdc_support_periodic_adv_sync_transfer_sender_central(void)
Support for sending periodic advertising sync transfers as central role.
int32_t sdc_support_ext_scan(void)
Support scanning for extended advertising PDUs.
int32_t sdc_enable(sdc_callback_t callback, uint8_t *p_mem)
Enable the SoftDevice Controller.
int32_t sdc_support_scan(void)
Support Scanning state.
int32_t sdc_support_le_periodic_adv(void)
Support LE Periodic Advertising in the Advertising state.
int32_t sdc_support_le_power_control_peripheral(void)
Support LE Power Control for peripheral role.
int32_t sdc_support_cis_central(void)
Support Connected Isochronous streams in the central role.
int32_t sdc_support_le_periodic_sync_with_rsp(void)
Support LE Periodic Advertising with Responses in the Synchronization state.
int32_t sdc_support_bis_source(void)
Support Broadcast Isochronous streams as a source.
int32_t sdc_support_central(void)
Support Scanner, Initiator, and Central role.
int32_t sdc_support_dle_peripheral(void)
Support Data Length Extensions for a peripheral device.
int32_t sdc_support_le_power_control_central(void)
Support LE Power Control for central role.
int32_t sdc_support_adv(void)
Support Advertising State.
int32_t sdc_support_parallel_scanning_and_initiating(void)
Support for scanning and initiating at the same time.
int32_t sdc_support_le_periodic_adv_with_rsp(void)
Support LE Periodic Advertising with Responses in the Advertising state.
int32_t sdc_init(sdc_fault_handler_t fault_handler)
Initialize the SoftDevice Controller.
int32_t sdc_support_phy_update_central(void)
Support PHY Update Procedure for central role.
int32_t sdc_support_qos_channel_survey(void)
Support for Quality of Service (QoS) channel survey module.
int32_t sdc_build_revision_get(uint8_t *p_build_revision)
Obtain build revision string.
int32_t sdc_support_phy_update_peripheral(void)
Support LE Coded PHY for peripheral role.
void(* sdc_callback_t)(void)
Function prototype for the SoftDevice Controller callback.
Definition: sdc.h:351
int32_t sdc_support_sca_peripheral(void)
Support Sleep Clock Accuracy (SCA) Update procedure for peripheral role.
int32_t sdc_support_bis_sink(void)
Support Broadcast Isochronous streams as a sink.
int32_t sdc_support_le_periodic_sync(void)
Support LE Periodic Advertising in the Synchronization state.
sdc_cfg_type
Definition: sdc.h:355
@ SDC_CFG_TYPE_PERIPHERAL_COUNT
Definition: sdc.h:361
@ SDC_CFG_TYPE_PERIODIC_ADV_COUNT
Definition: sdc.h:373
@ SDC_CFG_TYPE_PERIODIC_ADV_RSP_COUNT
Definition: sdc.h:381
@ SDC_CFG_TYPE_BIS_SINK_COUNT
Definition: sdc.h:395
@ SDC_CFG_TYPE_CIS_COUNT
Definition: sdc.h:391
@ SDC_CFG_TYPE_BIS_SOURCE_COUNT
Definition: sdc.h:397
@ SDC_CFG_TYPE_BUFFER_CFG
Definition: sdc.h:363
@ SDC_CFG_TYPE_PERIODIC_SYNC_COUNT
Definition: sdc.h:375
@ SDC_CFG_TYPE_PERIODIC_ADV_RSP_BUFFER_CFG
Definition: sdc.h:383
@ SDC_CFG_TYPE_ADV_BUFFER_CFG
Definition: sdc.h:369
@ SDC_CFG_TYPE_ISO_BUFFER_CFG
Definition: sdc.h:399
@ SDC_CFG_TYPE_ADV_COUNT
Definition: sdc.h:365
@ SDC_CFG_TYPE_BIG_COUNT
Definition: sdc.h:393
@ SDC_CFG_TYPE_CENTRAL_COUNT
Definition: sdc.h:359
@ SDC_CFG_TYPE_PERIODIC_ADV_RSP_FAILURE_REPORTING_CFG
Definition: sdc.h:385
@ SDC_CFG_TYPE_PERIODIC_SYNC_RSP_TX_BUFFER_CFG
Definition: sdc.h:387
@ SDC_CFG_TYPE_PERIODIC_ADV_LIST_SIZE
Definition: sdc.h:379
@ SDC_CFG_TYPE_CIG_COUNT
Definition: sdc.h:389
@ SDC_CFG_TYPE_PERIODIC_SYNC_BUFFER_CFG
Definition: sdc.h:377
@ SDC_CFG_TYPE_SCAN_BUFFER_CFG
Definition: sdc.h:367
@ SDC_CFG_TYPE_FAL_SIZE
Definition: sdc.h:371
@ SDC_CFG_TYPE_NONE
Definition: sdc.h:357
int32_t sdc_support_ext_central(void)
Support Extended Scanner, Extended Initiator, and Central role.
int32_t sdc_support_dle_central(void)
Support Data Length Extensions for a central device.
int32_t sdc_support_le_2m_phy(void)
Support LE 2M PHY.
int32_t sdc_support_le_coded_phy(void)
Support LE Coded PHY.
int32_t sdc_default_tx_power_set(int8_t requested_power_level)
Support for setting the default radio TX power level.
int32_t sdc_support_periodic_adv_sync_transfer_receiver_central(void)
Support for receiving periodic advertising sync transfers as central role.
uint16_t max_adv_data
Definition: sdc.h:440
Definition: sdc.h:432
uint8_t rx_packet_count
Definition: sdc.h:419
uint8_t rx_packet_size
Definition: sdc.h:415
uint8_t tx_packet_size
Definition: sdc.h:413
uint8_t tx_packet_count
Definition: sdc.h:417
Buffer configuration.
Definition: sdc.h:412
uint8_t count
Definition: sdc.h:427
Buffer count configuration.
Definition: sdc.h:426
uint8_t tx_sdu_buffer_count
Definition: sdc.h:474
uint16_t rx_sdu_buffer_size
Definition: sdc.h:511
uint8_t tx_pdu_buffer_per_stream_count
Definition: sdc.h:491
uint8_t rx_pdu_buffer_per_stream_count
Definition: sdc.h:501
uint8_t rx_sdu_buffer_count
Definition: sdc.h:506
uint16_t tx_sdu_buffer_size
Definition: sdc.h:479
Definition: sdc.h:469
uint8_t max_tx_data_size
Definition: sdc.h:456
uint8_t tx_buffer_count
Definition: sdc.h:451
uint8_t rx_buffer_count
Definition: sdc.h:464
uint8_t count
Definition: sdc.h:406
Role count.
Definition: sdc.h:405
sdc_cfg_role_count_t periodic_adv_count
Definition: sdc.h:558
uint8_t periodic_adv_list_size
Definition: sdc.h:588
sdc_cfg_role_count_t bis_source_count
Definition: sdc.h:637
sdc_cfg_role_count_t cig_count
Definition: sdc.h:617
sdc_cfg_role_count_t central_count
Definition: sdc.h:521
sdc_cfg_role_count_t periodic_sync_count
Definition: sdc.h:563
sdc_cfg_iso_buffer_cfg_t iso_buffer_cfg
Definition: sdc.h:642
sdc_cfg_adv_buffer_cfg_t adv_buffer_cfg
Definition: sdc.h:548
sdc_cfg_buffer_count_t scan_buffer_cfg
Definition: sdc.h:544
sdc_cfg_buffer_count_t periodic_sync_buffer_cfg
Definition: sdc.h:581
sdc_cfg_role_count_t cis_count
Definition: sdc.h:622
uint8_t periodic_adv_rsp_failure_reporting_cfg
Definition: sdc.h:604
sdc_cfg_role_count_t adv_count
Definition: sdc.h:534
sdc_cfg_buffer_cfg_t buffer_cfg
Definition: sdc.h:529
uint16_t fal_size
Definition: sdc.h:553
sdc_cfg_buffer_count_t periodic_sync_rsp_tx_buffer_cfg
Definition: sdc.h:612
sdc_cfg_role_count_t big_count
Definition: sdc.h:627
sdc_cfg_role_count_t bis_sink_count
Definition: sdc.h:632
sdc_cfg_periodic_adv_rsp_buffer_cfg_t periodic_adv_rsp_buffer_cfg
Definition: sdc.h:597
sdc_cfg_role_count_t periodic_adv_rsp_count
Definition: sdc.h:593
sdc_cfg_role_count_t peripheral_count
Definition: sdc.h:525
SoftDevice Controller configuration.
Definition: sdc.h:517