Bluetooth Host Stack Library
Bluetooth Stack Platform Interface

General Description

Interface between Stack and platform.

Data Structures

struct  wiced_bt_stack_platform_t
 AIROC Bluetooth Stack Platform. More...
 
struct  wiced_bt_smp_adapter_t
 SMP encryption. More...
 
struct  wiced_bt_hci_version_info_t
 Version information for the local Controller. More...
 
struct  wiced_bt_ble_init_data_t
 LE configuration parameters. More...
 
struct  wiced_bt_dev_init_data_t
 device configuration parameters More...
 
struct  wiced_bt_stack_init_cmd_data_t
 BTSTACK initialization configuration parameters. More...
 

Macros

#define CYBT_STACK_BASE_EXCEPTION   0xF000
 < Stack Exception definitions More...
 
#define CYBT_STACK_BUF_CORRUPTED   CYBT_STACK_BASE_EXCEPTION + 1
 Indicates a buffer/memory corruption issue.
 
#define CYBT_STACK_NOT_BUF_OWNER   CYBT_STACK_BASE_EXCEPTION + 2
 Signifies a lack of buffer ownership by the current process.
 
#define CYBT_STACK_FREEBUF_BAD_QID   CYBT_STACK_BASE_EXCEPTION + 3
 Occurs when attempting to free a buffer with an invalid queue ID.
 
#define CYBT_STACK_FREEBUF_BUF_LINKED   CYBT_STACK_BASE_EXCEPTION + 4
 Denotes an error with a linked buffer during the free operation.
 
#define CYBT_STACK_SEND_MSG_BAD_DEST   CYBT_STACK_BASE_EXCEPTION + 5
 Indicates a bad destination for a message send operation.
 
#define CYBT_STACK_SEND_MSG_BUF_LINKED   CYBT_STACK_BASE_EXCEPTION + 6
 Represents an issue with a linked buffer during the message send operation.
 
#define CYBT_STACK_ENQUEUE_BUF_LINKED   CYBT_STACK_BASE_EXCEPTION + 7
 Indicates a linked buffer error during the enqueue operation.
 
#define CYBT_STACK_DELETE_POOL_BAD_QID   CYBT_STACK_BASE_EXCEPTION + 8
 Occurs when attempting to delete a pool with an invalid queue ID.
 
#define CYBT_STACK_BUF_SIZE_TOOBIG   CYBT_STACK_BASE_EXCEPTION + 9
 Signifies that the buffer size exceeds the maximum allowed size.
 
#define CYBT_STACK_BUF_SIZE_ZERO   CYBT_STACK_BASE_EXCEPTION + 10
 Indicates an attempt to create a buffer with zero size.
 
#define CYBT_STACK_ADDR_NOT_IN_BUF   CYBT_STACK_BASE_EXCEPTION + 11
 Denotes an address that is not within the buffer range.
 
#define CYBT_STACK_OUT_OF_BUFFERS   CYBT_STACK_BASE_EXCEPTION + 12
 Occurs when there are no available buffers.
 
#define CYBT_STACK_GETPOOLBUF_BAD_QID   CYBT_STACK_BASE_EXCEPTION + 13
 Signifies an invalid queue ID during the get pool buffer operation.
 
#define CYBT_STACK_POOLBUF_BAD_SIZE   CYBT_STACK_BASE_EXCEPTION + 14
 Indicates an error with the size of the pool buffer.
 
#define CYBT_STACK_NO_INTERFACE   CYBT_STACK_BASE_EXCEPTION + 15
 Signifies the absence of a required interface.
 
#define CYBT_STACK_BAD_TRANSPORT   CYBT_STACK_BASE_EXCEPTION + 16
 Denotes a problem with the transport assignement (BLE / BREDR)
 
#define CYBT_STACK_NO_MEMORY   CYBT_STACK_BASE_EXCEPTION + 17
 Indicates a memory allocation failure.
 
#define CYBT_STACK_NO_BUF   CYBT_STACK_BASE_EXCEPTION + 18
 Represents the absence of available buffers.
 
#define CYBT_STACK_MAX_EXCEPTION   CYBT_STACK_NO_BUF + 1
 Stack MAX exception.
 

Typedefs

typedef struct _aes_context_t aes_context
 Forward definition.
 
typedef void(* wiced_bt_internal_post_stack_init_cb) (void)
 Function prototype for the post Stack Init Callback.
 
typedef wiced_bool_t(* wiced_bt_internal_stack_evt_handler_cb) (uint8_t *p_event)
 Function prototype for the HCI event monitor function that the application may suppply. More...
 

Functions

wiced_result_t wiced_bt_stack_platform_initialize (wiced_bt_stack_platform_t *platform_interfaces)
 Initialize the platform interfaces, by providing porting functions specific to the underlying platform. More...
 
void wiced_bt_process_acl_data (uint8_t *pData, uint32_t length)
 Called by the porting layer to process the incoming ACL data received from the remote bluetooth device. More...
 
void wiced_bt_process_hci_events (uint8_t *pData, uint32_t length)
 Called by the porting layer to process the incoming HCI events from the local bluetooth controller. More...
 
void wiced_bt_process_sco_data (uint8_t *pData, uint32_t length)
 Called by the porting layer to process the incoming SCO data received from the remote bluetooth device. More...
 
void wiced_bt_process_isoc_data (uint8_t *pData, uint32_t length)
 Called by the porting layer to process the incoming ISOC data received from the remote bluetooth device. More...
 
void wiced_bt_process_timer (void)
 Called by the porting layer on expiry of the timer to process pending timers. More...
 
void wiced_bt_stack_indicate_lower_tx_complete (void)
 Called by the lower layer transport driver to restart sending ACL data to the controller Note: Porting layer API. More...
 
void wiced_bt_continue_reset (void)
 Called by the porting layer to complete/continue the reset process Typically called after downloading firmware patches to the controller. More...
 
uint32_t wiced_bt_set_stack_config (const wiced_bt_cfg_settings_t *p_bt_new_cfg_settings)
 Set the stack config. More...
 
const wiced_bt_cfg_settings_twiced_bt_get_stack_config (void)
 Get the stack config set by the application. More...
 
void wiced_bt_stack_init_internal (wiced_bt_management_cback_t mgmt_cback, wiced_bt_internal_post_stack_init_cb post_stack_cb, wiced_bt_internal_stack_evt_handler_cb evt_handler_cb)
 Internal stack init. More...
 
void wiced_bt_stack_shutdown (void)
 This function blocks until all de-initialisation procedures are complete. More...
 
wiced_result_t wiced_bt_set_stack_initial_setup_data (wiced_bt_stack_init_cmd_data_t *p_init_setup_data)
 Set the initial setup data to configure the stack. More...
 
void wiced_bt_enable_stack_default_flow (void)
 Called by the porting layer to enable the stack to send the initial setup commands(refer Version 5.4 | Vol 6, Part D 2.1 INITIAL SETUP) to the controller. More...
 
wiced_result_t wiced_bt_platform_set_smp_adapter (const wiced_bt_smp_adapter_t *p_smp_adapter)
 Called by the porting layer to set platform specific or custom SMP encryption. More...
 
wiced_result_t wiced_bt_set_default_smp_adapter (void)
 Called by the porting layer to set default SMP encryption. More...
 
wiced_result_t wiced_ble_read_local_identity_keys_from_app (wiced_bt_local_identity_keys_t *p_local_keys)
 Called by porting layer to get the stored local keys from the app. More...
 
wiced_result_t wiced_ble_create_local_identity_keys (void)
 Create new local keys to be used for device privacy The new local keys generated are returned to the application in BTM_LOCAL_IDENTITY_KEYS_UPDATE_EVT The porting layer can start, Controller based address resolution with wiced_ble_init_ctlr_private_addr_generation or Host based address resolution with wiced_ble_init_host_private_addr_generation. More...
 
wiced_result_t wiced_ble_init_host_private_addr_generation (wiced_bt_local_identity_keys_t *p_local_keys)
 API to write back saved local keys and init host based address generation. More...
 
wiced_result_t wiced_ble_init_ctlr_private_addr_generation (wiced_bt_local_identity_keys_t *p_local_keys)
 API to write back saved local keys and controller based address generation. More...
 
wiced_bool_t wiced_bt_issue_btm_enabled_evt (wiced_bt_management_cback_t p_app_management_callback)
 Helper API to issue BTM_ENABLED_EVT. More...
 
uint32_t wiced_bt_get_btm_startup_flags (void)
 Helper API to get the startup flags. More...
 

Macro Definition Documentation

◆ CYBT_STACK_BASE_EXCEPTION

#define CYBT_STACK_BASE_EXCEPTION   0xF000

< Stack Exception definitions

Stack BASE exception

Typedef Documentation

◆ wiced_bt_internal_stack_evt_handler_cb

typedef wiced_bool_t(* wiced_bt_internal_stack_evt_handler_cb) (uint8_t *p_event)

Function prototype for the HCI event monitor function that the application may suppply.

The application MUST return TRUE if the it handled the event and does not want the stack to process the event. If the application returns FALSE, the stack will process the event.

Function Documentation

◆ wiced_bt_stack_platform_initialize()

wiced_result_t wiced_bt_stack_platform_initialize ( wiced_bt_stack_platform_t platform_interfaces)

Initialize the platform interfaces, by providing porting functions specific to the underlying platform.

Returns
WICED_BT_SUCCESS : on success;
WICED_BT_ERROR : if an error occurred

◆ wiced_bt_process_acl_data()

void wiced_bt_process_acl_data ( uint8_t *  pData,
uint32_t  length 
)

Called by the porting layer to process the incoming ACL data received from the remote bluetooth device.

Parameters
[in]pData: Pointer to the ACL data to be processed
[in]length: Length of the ACL data buffer
Returns
void

◆ wiced_bt_process_hci_events()

void wiced_bt_process_hci_events ( uint8_t *  pData,
uint32_t  length 
)

Called by the porting layer to process the incoming HCI events from the local bluetooth controller.

Parameters
[in]pData: Pointer to the HCI Events to be processed
[in]length: Length of the event buffer
Returns
void

◆ wiced_bt_process_sco_data()

void wiced_bt_process_sco_data ( uint8_t *  pData,
uint32_t  length 
)

Called by the porting layer to process the incoming SCO data received from the remote bluetooth device.

Parameters
[in]pData: Pointer to the SCO data to be processed
[in]length: Length of the SCO data buffer
Returns
void

◆ wiced_bt_process_isoc_data()

void wiced_bt_process_isoc_data ( uint8_t *  pData,
uint32_t  length 
)

Called by the porting layer to process the incoming ISOC data received from the remote bluetooth device.

Parameters
[in]pData: Pointer to the ISOC data to be processed
[in]length: Length of the ISOC data buffer
Returns
void

◆ wiced_bt_process_timer()

void wiced_bt_process_timer ( void  )

Called by the porting layer on expiry of the timer to process pending timers.

Returns
void

◆ wiced_bt_stack_indicate_lower_tx_complete()

void wiced_bt_stack_indicate_lower_tx_complete ( void  )

Called by the lower layer transport driver to restart sending ACL data to the controller Note: Porting layer API.

This API is expected to be invoked by the lower layer transport driver, to restart transfers from the stack to the controller. The lower tx layer is expected to have space for atleast one complete ACL buffer Typically used in cases where the lower Tx has lesser number of buffers than allowed by controller

◆ wiced_bt_continue_reset()

void wiced_bt_continue_reset ( void  )

Called by the porting layer to complete/continue the reset process Typically called after downloading firmware patches to the controller.

Returns
void

◆ wiced_bt_set_stack_config()

uint32_t wiced_bt_set_stack_config ( const wiced_bt_cfg_settings_t p_bt_new_cfg_settings)

Set the stack config.

Invoked by the porting layer

Parameters
[in]p_bt_new_cfg_settings: Stack configuration settings
Returns
0 if there is any error in the configuration otherwise the dynamic memory size requirements of the stack for the configuration.

◆ wiced_bt_get_stack_config()

const wiced_bt_cfg_settings_t* wiced_bt_get_stack_config ( void  )

Get the stack config set by the application.

Returns
pointer to application config settings

◆ wiced_bt_stack_init_internal()

void wiced_bt_stack_init_internal ( wiced_bt_management_cback_t  mgmt_cback,
wiced_bt_internal_post_stack_init_cb  post_stack_cb,
wiced_bt_internal_stack_evt_handler_cb  evt_handler_cb 
)

Internal stack init.

Parameters
[in]mgmt_cback: Application Bluetooth Management callback
[in]post_stack_cb: Internal post stack init callback
[in]evt_handler_cb: Internal stack event handler
Returns
Dynamic memory size requirements of the stack for the configuration

◆ wiced_bt_stack_shutdown()

void wiced_bt_stack_shutdown ( void  )

This function blocks until all de-initialisation procedures are complete.

It is recommended that the application disconnect any outstanding connections prior to invoking this function.

Returns
None

◆ wiced_bt_set_stack_initial_setup_data()

wiced_result_t wiced_bt_set_stack_initial_setup_data ( wiced_bt_stack_init_cmd_data_t p_init_setup_data)

Set the initial setup data to configure the stack.

Invoked by the porting layer

Parameters
[in]p_init_setup_data: intial setup data
Note
Call this API if want to reduce the stack size. This API needs to be invoked prior to wiced_bt_stack_init_internal API. Do not call API wiced_bt_enable_stack_default_flow if calling this API.
Returns
wiced_result_t WICED_SUCCESS if Success. WICED_BADARG if called with NULL arguement.

◆ wiced_bt_enable_stack_default_flow()

void wiced_bt_enable_stack_default_flow ( void  )

Called by the porting layer to enable the stack to send the initial setup commands(refer Version 5.4 | Vol 6, Part D 2.1 INITIAL SETUP) to the controller.

Note
Call this API if required to get the intial setup information from the controller. Do not call API wiced_bt_set_stack_initial_setup_data if calling this API.
This API needs to be invoked prior to wiced_bt_stack_init_internal API.
Returns
void

◆ wiced_bt_platform_set_smp_adapter()

wiced_result_t wiced_bt_platform_set_smp_adapter ( const wiced_bt_smp_adapter_t p_smp_adapter)

Called by the porting layer to set platform specific or custom SMP encryption.

Parameters
[in]p_smp_adapter: SMP Adaptor configurations and callbacks
Returns
WICED_SUCCESS : on success;
WICED_ERROR : if an error occurred

◆ wiced_bt_set_default_smp_adapter()

wiced_result_t wiced_bt_set_default_smp_adapter ( void  )

Called by the porting layer to set default SMP encryption.

Returns
WICED_SUCCESS : on success;
WICED_ERROR : if an error occurred

◆ wiced_ble_read_local_identity_keys_from_app()

wiced_result_t wiced_ble_read_local_identity_keys_from_app ( wiced_bt_local_identity_keys_t p_local_keys)

Called by porting layer to get the stored local keys from the app.

If application returns WICED_SUCCESS, the keys are written to the stack to start Controller based address resolution with wiced_ble_init_ctlr_private_addr_generation or Host based address resolution with wiced_ble_init_host_private_addr_generation Else, wiced_ble_create_local_identity_keys call needs to be invoked

◆ wiced_ble_create_local_identity_keys()

wiced_result_t wiced_ble_create_local_identity_keys ( void  )

Create new local keys to be used for device privacy The new local keys generated are returned to the application in BTM_LOCAL_IDENTITY_KEYS_UPDATE_EVT The porting layer can start, Controller based address resolution with wiced_ble_init_ctlr_private_addr_generation or Host based address resolution with wiced_ble_init_host_private_addr_generation.

Returns
wiced_result_t

◆ wiced_ble_init_host_private_addr_generation()

wiced_result_t wiced_ble_init_host_private_addr_generation ( wiced_bt_local_identity_keys_t p_local_keys)

API to write back saved local keys and init host based address generation.

The local keys sent down in this call are used to generate the local RPA (Resolvable Private Address). The RPA generated is required to be refreshed periodically by the host based on the suggested wiced_bt_cfg_ble_t::rpa_refresh_timeout member of wiced_bt_cfg_settings_t.p_ble_cfg

Parameters
[in]p_local_keys: device local keys generated from a previous call to wiced_ble_create_local_identity_keys
Returns
wiced_result_t

◆ wiced_ble_init_ctlr_private_addr_generation()

wiced_result_t wiced_ble_init_ctlr_private_addr_generation ( wiced_bt_local_identity_keys_t p_local_keys)

API to write back saved local keys and controller based address generation.

The local keys sent down in this call are used to generate the local RPA (Resolvable Private Address). The RPA generated is required to be refreshed periodically by the controller based on the suggested wiced_bt_cfg_ble_t::rpa_refresh_timeout member of wiced_bt_cfg_settings_t.p_ble_cfg

Parameters
[in]p_local_keys: device local keys generated from a previous call to wiced_ble_create_local_identity_keys
Returns
wiced_result_t

◆ wiced_bt_issue_btm_enabled_evt()

wiced_bool_t wiced_bt_issue_btm_enabled_evt ( wiced_bt_management_cback_t  p_app_management_callback)

Helper API to issue BTM_ENABLED_EVT.

Parameters
p_app_management_callbackManagement callback set by the application

◆ wiced_bt_get_btm_startup_flags()

uint32_t wiced_bt_get_btm_startup_flags ( void  )

Helper API to get the startup flags.

Returns
uint32_t value