Bluetooth Stack Platform Interface¶
-
group
wiced_bt_platform_group
Interface between Stack and platform.
Typedefs
-
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.
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.
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.
- Returns
WICED_BT_SUCCESS : on success; WICED_BT_ERROR : if an error occurred
-
wiced_result_t
wiced_bt_stack_platform_deinit
(void)¶ DeInitialize the platform interfaces and free the memory allocated by wiced_bt_stack_platform_initialize API.
note
: After calling this API, DON'T call any BT API without calling wiced_bt_stack_platform_initialize again.
- Returns
WICED_BT_SUCCESS : on success; WICED_BT_ERROR : if an error occurred
-
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
pData – [in] : Pointer to the ACL data to be processed
length – [in] : Length of the ACL data buffer
- Returns
void
-
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
pData – [in] : Pointer to the HCI Events to be processed
length – [in] : Length of the event buffer
- Returns
void
-
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
pData – [in] : Pointer to the SCO data to be processed
length – [in] : Length of the SCO data buffer
- Returns
void
-
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
pData – [in] : Pointer to the ISOC data to be processed
length – [in] : Length of the ISOC data buffer
- Returns
void
-
void
wiced_bt_process_timer
(void)¶ Called by the porting layer on expiry of the timer to process pending timers.
- Returns
void
-
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
-
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
-
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
p_bt_new_cfg_settings – [in] : 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.
-
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
mgmt_cback – [in] : Application BT Management callback
post_stack_cb – [in] : Internal post stack init callback
evt_handler_cb – [in] : Internal stack event handler
- Returns
Dynamic memory size requirements of the stack for the configuration
-
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
-
struct
wiced_bt_stack_platform_t
¶ - #include <>
Wiced BT Stack Platform.
Public Members
-
pf_wiced_exception
pf_exception
¶ Exception callback.
-
void *(*
pf_os_malloc
)(uint32_t size)¶ Platform function to allocate memory.
Called by stack code to allocate memory from the OS/Platform. Implementing function is expected to return memory allocated from the OS/Platform
- Parameters
size – [in] : Size of memory to be allocated
- Returns
: Pointer to allocated memory
-
void (*
pf_os_free
)(void *p_mem)¶ Platform memory free.
Called by stack code to free memory back to the OS/Platform. Implementing function is expected to free the memory allocated using pf_os_malloc (refer pf_os_malloc ) call from the OS/Platform
- Parameters
p_mem – [in] : Ptr to memory to be freed
- Returns
: None
-
uint64_t (*
pf_get_tick_count_64
)(void)¶ Platform function to get tick count.
Called by stack timer code to get the free running 64 bit tick count
- Parameters
None – [in]
- Returns
: 64 bit current tick count
-
void (*
pf_set_next_timeout
)(uint64_t abs_tick_count)¶ Platform function to set the next timeout.
Called by stack timer code set the next timeout
- Parameters
abs_tick_count – [in] : 64 bit tick count instant at which the timeout has to occur
- Returns
: void
-
wiced_bt_lock_t
stack_lock
¶ Stack lock.
-
uint8_t *(*
pf_get_acl_to_lower_buffer
)(wiced_bt_transport_t transport, uint32_t size)¶ Platform function to get ACL buffer to send to lower.
Called by stack to get a buffer to fill in the data to be sent to ‘transport’ (BLE or BR/EDR) of ‘size’
- Parameters
transport – [in] : Transport on which the buffer is to be sent
size – [in] : Size of the buffer
- Returns
: Pointer to buffer which will be filled with data
-
wiced_result_t (*
pf_write_acl_to_lower
)(wiced_bt_transport_t transport, uint8_t *p_data, uint16_t len)¶ Platform function to write ACL buffer to lower.
Called by stack to send the buffer allocated using pf_get_acl_to_lower_buffer after filling it with the data to send.
- Parameters
transport – [in] : Transport on which the buffer is to be sent
p_data – [in] : Pointer received using pf_get_acl_to_lower_buffer
len – [in] : Length of data at p_data
- Returns
: wiced_result_t
-
wiced_result_t (*
pf_write_iso_to_lower
)(wiced_bt_transport_t transport, uint8_t *p_data, uint16_t len)¶ Platform function to write ISO buffer to lower.
Called by stack to send the buffer allocated using pf_get_acl_to_lower_buffer after filling it with the data to send.
- Parameters
transport – [in] : Transport on which the buffer is to be sent
p_data – [in] : Pointer received using pf_get_acl_to_lower_buffer
len – [in] : Length of data at p_data
- Returns
: wiced_result_t
-
wiced_result_t (*
pf_write_cmd_to_lower
)(uint8_t *p_cmd, uint16_t cmd_len)¶ Platform function to write CMD buffer to lower.
Called by stack to send HCI CMD buffer to lower
- Parameters
p_cmd – [in] : Pointer to HCI CMD data
cmd_len – [in] : Length of data at p_cmd
- Returns
: wiced_result_t
-
uint8_t *(*
pf_get_sco_to_lower_buffer
)(uint32_t size)¶ Platform function to get SCO buffer to send to lower.
Called by stack to get a SCO buffer to fill in the data to be sent to HCI of ‘size’
- Parameters
size – [in] : Size of the buffer
- Returns
: Pointer to buffer which will be filled with data
-
wiced_result_t (*
pf_write_sco_to_lower
)(uint8_t *p_sco_data, uint8_t len)¶ Platform function to write SCO buffer to lower.
Called to send SCO CMD buffer to lower
- Parameters
p_sco_data – [in] : Pointer to SCO data
len – [in] : Length of data at p_data
- Returns
: wiced_result_t
-
void (*
pf_hci_trace_cback_t
)(wiced_bt_hci_trace_type_t type, uint16_t len, uint8_t *p_data)¶ Callback function to trace HCI messages.
Called by stack to allow application to trace the HCI messages. Application/Porting code is expected to treat received data as read only, and make a copy of the data to reference it outside of the callback
- Parameters
type – [in] : HCI event data type
len – [in] : Length of data at p_data
p_data – [in] : Pointer to data
- Returns
: void
-
void (*
pf_debug_trace
)(char *p_trace_buf, int trace_buf_len, wiced_bt_trace_type_t trace_type)¶ Callback function to dump out trace messages This interface function can be NULL if no debug tracing is supported.
Called by stack to allow application to write debug trace messages
- Parameters
p_trace_buf – [in] : Pointer to the trace buffer
trace_buf_len – [in] : Length of the trace buffer
trace_type – [in] : Type of trace message
- Returns
: void
-
int
trace_buffer_len
¶ trace_buffer_len : Trace buffer len
-
char *
trace_buffer
¶ trace_buffer : Pointer to the trace buffer Applications can set this to NULL to disable traces
-
void (*
pf_patch_download
)(void)¶ Used for additional controller initialization by the porting layer to be performed after the HCI reset.
Can be set to NULL if no additional initialization required
-
pf_wiced_exception
-
typedef void (*