AIROC™ BTSDK v4.9 - Documentation | ||||
Defines the transport utilities for configuring the transport, send data and receive data. More...
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. | |
struct { | |
uint32_t clock_speed | |
Clock speed (non-zero for master, zero for slave). More... | |
SPI_ENDIAN endian | |
Direction of bit data flow (MSB or LSB first) | |
SPI_SS_POLARITY polarity | |
Active high or active low for chip select line. | |
SPI_MODE mode | |
SPI mode (0-3). More... | |
} | wiced_spi_transport_cfg_t |
SPI transport config. More... | |
union { | |
wiced_uart_transport_cfg_t uart_cfg | |
wiced_spi_transport_cfg_t spi_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_SPI, 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... | |
wiced_result_t | wiced_transport_set_detect_on (UINT16 detect_on_second) |
Function wiced_transport_set_detect_on. More... | |
wiced_result_t | wiced_transport_send_raw_buffer (uint8_t *p_buf, uint16_t length) |
Function wiced_transport_send_raw_buffer. More... | |
void | wiced_transport_uart_rx_pause (void) |
Function wiced_transport_uart_rx_pause. More... | |
void | wiced_transport_uart_rx_resume (void) |
Function wiced_transport_uart_rx_resume. More... | |
void | wiced_transport_uart_interrupt_disable (void) |
Function wiced_transport_uart_interrupt_disable. More... | |
void | wiced_transport_uart_interrupt_enable (void) |
Function wiced_transport_uart_interrupt_enable. More... | |
void | wiced_set_hci_uart_cts_rts_flow_control (BOOL32 on) |
Function wiced_set_hci_uart_cts_rts_flow_control. More... | |
void | wiced_uart_raw_mode_set_max_receive_timeout (UINT32 timeout) |
Function wiced_uart_raw_mode_set_max_receive_timeout. 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.
typedef { ... } wiced_spi_transport_cfg_t |
SPI transport config.
Please not that the SPI pin selection must be done using Supermux array (wiced_platform_pin_config.c).
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_set_hci_uart_cts_rts_flow_control | ( | BOOL32 | on | ) |
Function wiced_set_hci_uart_cts_rts_flow_control.
Enable the CTS RTS Flow Control on or off
Note: If user would like to turn off HCI UART flow control, then this function must be called in APPLICATION_START()
[in] | on | - true, enable CTS RTS Flow Control false, disable CTS RTS Flow Control |
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 |
wiced_result_t wiced_transport_send_raw_buffer | ( | uint8_t * | p_buf, |
uint16_t | length | ||
) |
Function wiced_transport_send_raw_buffer.
Used when transport mode is WICED_TRANSPORT_UART_RAW_MODE. Available with the wiced_uart_raw_mode_lib. 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 must be freed by the application if return status is WICED_SUCCESS.
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] | p_buf | :Pointer to the payload |
[in] | length | :Payload length |
wiced_result_t wiced_transport_set_detect_on | ( | UINT16 | detect_on_second | ) |
Function wiced_transport_set_detect_on.
Set transport sense detect as ON within following seconds
Note: If HID off mode sleep configured, transport will be disabled. Application can use this API to let transport on within assigned duration.
[in] | detect_on_second | : user assigned duration (unit: second) to enable transport |
void wiced_transport_uart_interrupt_disable | ( | void | ) |
Function wiced_transport_uart_interrupt_disable.
Disable UART interrupt.
void wiced_transport_uart_interrupt_enable | ( | void | ) |
Function wiced_transport_uart_interrupt_enable.
Enable UART interrupt.
void wiced_transport_uart_rx_pause | ( | void | ) |
Function wiced_transport_uart_rx_pause.
Pause / Disable the HCI UART Rx.
void wiced_transport_uart_rx_resume | ( | void | ) |
Function wiced_transport_uart_rx_resume.
Resume / Enable the HCI UART Rx.
void wiced_uart_raw_mode_set_max_receive_timeout | ( | UINT32 | timeout | ) |
Function wiced_uart_raw_mode_set_max_receive_timeout.
Configure the timeout beforing calling Wiced transport receive data handler
[in] | timeout | : timeout value in ms |