AIROC™ BTSDK v4.9 - Documentation | ||||
Defines the transport utilities for configuring the transport, send data and receive data. More...
Macros | |
#define | wiced_transport_set_detect_on(a) WICED_SUCCESS |
Typedefs | |
typedef struct _wiced_trans_buffer_pool_t | wiced_transport_buffer_pool_t |
wiced transport buffer pool | |
typedef void(* | wiced_transport_status_handler_t )(wiced_transport_type_t type) |
Wiced transport status handler. | |
typedef uint32_t(* | wiced_tranport_data_handler_t )(uint8_t *p_data, uint32_t data_len) |
Wiced transport data handler Call back registered by the application to receive data. More... | |
typedef void(* | wiced_transport_tx_complete_t )(wiced_transport_buffer_pool_t *p_pool) |
Wiced transport tx complete indication. More... | |
struct { | |
wiced_transport_uart_mode_t mode | |
UART mode, HCI or Raw. | |
uint32_t baud_rate | |
UART baud rate. | |
} | wiced_uart_transport_cfg_t |
UART transport config. | |
union { | |
wiced_uart_transport_cfg_t uart_cfg | |
} | wiced_transport_interface_cfg_t |
Wiced transport interface config. | |
struct { | |
uint32_t buffer_size | |
uint32_t buffer_count | |
} | wiced_transport_rx_buff_pool_cfg_t |
Wiced receive buffer pool configuration. More... | |
struct { | |
wiced_transport_type_t type | |
Wiced transport type. More... | |
wiced_transport_interface_cfg_t cfg | |
Wiced transport interface config. More... | |
wiced_transport_rx_buff_pool_cfg_t rx_buff_pool_cfg | |
Wiced rx buffer pool config. More... | |
wiced_transport_status_handler_t p_status_handler | |
Wiced transport status handler. More... | |
wiced_tranport_data_handler_t p_data_handler | |
Wiced transport receive data handler. More... | |
wiced_transport_tx_complete_t p_tx_complete_cback | |
Wiced transport tx complete callback. More... | |
} | wiced_transport_cfg_t |
Wiced transport config. | |
Enumerations | |
enum | wiced_transport_type_t { WICED_TRANSPORT_UART, WICED_TRANSPORT_UNDEFINED } |
Wiced transport types. | |
enum | wiced_transport_uart_mode_t { WICED_TRANSPORT_UART_HCI_MODE, WICED_TRANSPORT_UART_RAW_MODE } |
Wiced uart transport mode. | |
Functions | |
wiced_result_t | wiced_transport_init (const wiced_transport_cfg_t *p_cfg) |
Function wiced_transport_init. More... | |
wiced_transport_buffer_pool_t * | wiced_transport_create_buffer_pool (uint32_t buffer_size, uint32_t buffer_count) |
Function wiced_transport_create_buffer_pool. More... | |
void * | wiced_transport_allocate_buffer (wiced_transport_buffer_pool_t *p_pool) |
Function wiced_transport_allocate_buffer. More... | |
uint32_t | wiced_transport_get_buffer_size (wiced_transport_buffer_pool_t *p_pool) |
Function wiced_transport_get_buffer_size. More... | |
uint32_t | wiced_transport_get_buffer_count (wiced_transport_buffer_pool_t *p_pool) |
Function wiced_transport_get_buffer_count. More... | |
wiced_result_t | wiced_transport_send_buffer (uint16_t code, uint8_t *p_buf, uint16_t length) |
Function wiced_transport_send_buffer. More... | |
void | wiced_transport_free_buffer (void *p_buf) |
Function wiced_transport_free_buffer. More... | |
wiced_result_t | wiced_transport_send_data (uint16_t code, uint8_t *p_data, uint16_t length) |
Function wiced_transport_send_data. More... | |
wiced_result_t | wiced_transport_send_hci_trace (wiced_transport_buffer_pool_t *hci_trans_pool, wiced_bt_hci_trace_type_t type, uint16_t length, uint8_t *p_data) |
Function wiced_transport_send_hci_trace. More... | |
void | wiced_hci_change_tx_drive_mode (wiced_bool_t enable) |
Function to drive UART TX Drive mode. More... | |
void | wiced_hci_change_rts_drive_mode (wiced_bool_t enable) |
Function to drive UART RTS mode. More... | |
void | wiced_transport_uart_pause (void) |
Function wiced_transport_uart_pause. More... | |
void | wiced_transport_uart_resume (void) |
Function wiced_transport_uart_resume. More... | |
Defines the transport utilities for configuring the transport, send data and receive data.
This supports UART transport in HCI Mode
Wiced Transport uses the generic pool available for receiving and sending packet over the transport. Following are the configurations of the generic pool 1: buffer size - 8 bytes, buffer count - 128 2: buffer size - 32 bytes, buffer count - 48 3: buffer size - 96 bytes, buffer count - 50 4: buffer size - 268 bytes, buffer count - 12
Using above generic pools the max payload size supportable is 252.(16 bytes for internal headers) If the application wants to send packet of size more than the max size of the buffer available in the generic pool, application can do so by creating a transport buffer pool of the desired size. (Refer APIs wiced_transport_create_buffer_pool, wiced_transport_allocate_buffer,wiced_transport_send_buffer)
If the application wants to receive packet of size more than the max size of the buffer available in the generic pool, application can do so by configuring a receive buffer pool of the desired size when doing transport init.
Wiced Transport in RAW UART mode uses a single circular buffer to receive the data Application should specify the size of this receive buffer when doing transport init
typedef uint32_t(* wiced_tranport_data_handler_t)(uint8_t *p_data, uint32_t data_len) |
Wiced transport data handler Call back registered by the application to receive data.
Application has to free the buffer in which data is received. Use the API wiced_transport_free_buffer to free the rx buffer
[in] | p_data | : Pointer to the received data buffer. |
[in] | data_len | : length of the data pointed to by p_data in bytes. |
the status in case of UART in HCI mode
typedef { ... } wiced_transport_rx_buff_pool_cfg_t |
Wiced receive buffer pool configuration.
Application shall use this to receive packet of size( i.e if payload size > 252 ) > 268 bytes
typedef void(* wiced_transport_tx_complete_t)(wiced_transport_buffer_pool_t *p_pool) |
Wiced transport tx complete indication.
Indicates the application that a packet is sent using a buffer in the indicated pool.
[in] | p_pool | : Pool pointer, buffer is used from this pool for sending the packet |
void wiced_hci_change_rts_drive_mode | ( | wiced_bool_t | enable | ) |
Function to drive UART RTS mode.
[in] | enable | enable 0 - tristate rts / 1 - enable rts pin |
void wiced_hci_change_tx_drive_mode | ( | wiced_bool_t | enable | ) |
Function to drive UART TX Drive mode.
[in] | enable | 0 - tristate tx / 1 - enable tx pin |
void* wiced_transport_allocate_buffer | ( | wiced_transport_buffer_pool_t * | p_pool | ) |
Function wiced_transport_allocate_buffer.
Allocates a buffer from the pool
[in] | p_pool | : Pointer to buffer pool returned from wiced_transport_create_buffer_pool |
wiced_transport_buffer_pool_t* wiced_transport_create_buffer_pool | ( | uint32_t | buffer_size, |
uint32_t | buffer_count | ||
) |
Function wiced_transport_create_buffer_pool.
Creates a buffer pool for transport usage. Application shall create the buffer pool if it has to send packet of size > 268 bytes. Application shall specify the payload length as the buffer size. Transport will take care of creating a pool of desired size considering the transport header requirements and the application specified payload size
[in] | buffer_size | : Size of each buffer in pool. Application shall specify the payload length as the buffer size |
[in] | buffer_count | : Number of buffers in the pool |
void wiced_transport_free_buffer | ( | void * | p_buf | ) |
Function wiced_transport_free_buffer.
Frees the transport buffer.
Note: When receiving a packet, application should take care of freeing the rx buffers. When sending a packet, transport will take care of freeing the buffer after the packet is sent.
[in] | p_buf | :Pointer to the buffer to be freed |
uint32_t wiced_transport_get_buffer_count | ( | wiced_transport_buffer_pool_t * | p_pool | ) |
Function wiced_transport_get_buffer_count.
To get the number of buffers available in the pool
[in] | p_pool | : Pointer to buffer pool created using wiced_transport_create_buffer_pool |
uint32_t wiced_transport_get_buffer_size | ( | wiced_transport_buffer_pool_t * | p_pool | ) |
Function wiced_transport_get_buffer_size.
Returns the size of buffer in the pool
[in] | p_pool | : Pointer to buffer pool returned from wiced_trans_create_buffer_pool |
wiced_result_t wiced_transport_init | ( | const wiced_transport_cfg_t * | p_cfg | ) |
Function wiced_transport_init.
Initializes and configures the transport and also registers the handlers to be invoked on transport detection and on receiving the data
[in] | p_cfg | :wiced transport config |
wiced_result_t wiced_transport_send_buffer | ( | uint16_t | code, |
uint8_t * | p_buf, | ||
uint16_t | length | ||
) |
Function wiced_transport_send_buffer.
Send the packet to the host over the transport using the buffer allocated by the application. This function takes care of preparing the header and sending the data. The buffer will be freed by the transport after sending the packet.
Note: Application has to allocate buffer from transport pool using wiced_transport_allocate_buffer and copy the payload to this buffer and send the payload pointer. This allows the application to use custom size buffers and avoid overrun of generic buffers, which is shared across firmware code.
[in] | code | :Group code and command code |
[in] | p_buf | :Pointer to the payload |
[in] | length | :Payload length |
wiced_result_t wiced_transport_send_data | ( | uint16_t | code, |
uint8_t * | p_data, | ||
uint16_t | length | ||
) |
Function wiced_transport_send_data.
Send the packet to the host over the transport. This function allocates a buffer internally and prepare the header, copy the payload and then sends the packet over the transport. Maximum size of the buffer that can be allocated is 268 bytes
Transport internally uses a buffer from the pool which is available for all general purposes Following are the configuration of the internal pool 1: buffer size - 8 bytes, buffer count - 128 2: buffer size - 32 bytes, buffer count - 48 3: buffer size - 96 bytes, buffer count - 50 4: buffer size - 268 bytes, buffer count - 12
Note: Using above generic pools max supportable payload size = 252(16 bytes for internal headers).
[in] | code | :Group code and command code |
[in] | p_data | :Pointer to the payload |
[in] | length | :Payload length |
wiced_result_t wiced_transport_send_hci_trace | ( | wiced_transport_buffer_pool_t * | hci_trans_pool, |
wiced_bt_hci_trace_type_t | type, | ||
uint16_t | length, | ||
uint8_t * | p_data | ||
) |
Function wiced_transport_send_hci_trace.
Send the hci trace data over the transport.
[in] | hci_trans_pool | :Pass the pointer to the pool created by the application incase application has created a dedicated trans pool for communicating to host. Pass NULL if the application wants the stack to take care of allocating the buffer for sending the data to host. Application should be able to use transport buffer pool that it allocates and trace the whole HCI packets. In case of stack allocation, the size of trace compromised according to buffer availability. |
[in] | type | :HCI trace type |
[in] | p_data | :Pointer to the data payload |
[in] | length | :Data payload length |
void wiced_transport_uart_pause | ( | void | ) |
Function wiced_transport_uart_pause.
Pause / Disable the HCI UART
void wiced_transport_uart_resume | ( | void | ) |
Function wiced_transport_uart_resume.
Resume / Enable the HCI UART
Wiced transport interface config.
wiced_tranport_data_handler_t p_data_handler |
Wiced transport receive data handler.
wiced_transport_status_handler_t p_status_handler |
Wiced transport status handler.
wiced_transport_tx_complete_t p_tx_complete_cback |
Wiced transport tx complete callback.
wiced_transport_rx_buff_pool_cfg_t rx_buff_pool_cfg |
Wiced rx buffer pool config.
Wiced transport type.