Infineon Logo AIROC BTSDK v4.2 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AIROC Transport

Defines the transport utilities for configuring the transport, send data and receive data. More...

Data Structures

struct  wiced_uart_transport_cfg_s
 UART transport config. More...
 
struct  wiced_spi_transport_cfg_s
 SPI transport config. More...
 
union  wiced_transport_interface_cfg_t
 Wiced transport interface config. More...
 
struct  wiced_transport_rx_buff_pool_cfg_s
 AIROC receive buffer pool configuration. More...
 
struct  wiced_transport_cfg_s
 AIROC transport config. More...
 

Macros

#define wiced_transport_set_detect_on(a)   WICED_TRUE
 

Typedefs

typedef struct
_wiced_trans_buffer_pool_t 
wiced_transport_buffer_pool_t
 AIROC transport buffer pool.
 
typedef void(* wiced_transport_status_handler_t )(wiced_transport_type_t type)
 AIROC transport status handler.
 
typedef uint32_t(* wiced_tranport_data_handler_t )(uint8_t *p_data, uint32_t data_len)
 AIROC 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)
 AIROC transport tx complete indication. More...
 
typedef struct
wiced_uart_transport_cfg_s 
wiced_uart_transport_cfg_t
 UART transport config.
 
typedef struct
wiced_spi_transport_cfg_s 
wiced_spi_transport_cfg_t
 SPI transport config. More...
 
typedef struct
wiced_transport_rx_buff_pool_cfg_s 
wiced_transport_rx_buff_pool_cfg_t
 AIROC receive buffer pool configuration. More...
 
typedef struct
wiced_transport_cfg_s 
wiced_transport_cfg_t
 AIROC transport config.
 

Enumerations

enum  wiced_transport_type_t { WICED_TRANSPORT_UART, WICED_TRANSPORT_SPI, WICED_TRANSPORT_UNDEFINED }
 AIROC transport types.
 
enum  wiced_transport_uart_mode_t { WICED_TRANSPORT_UART_HCI_MODE, WICED_TRANSPORT_UART_RAW_MODE }
 AIROC 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_twiced_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...
 

Detailed Description

Defines the transport utilities for configuring the transport, send data and receive data.

This supports UART transport in HCI Mode

AIROC 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 Documentation

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)

AIROC 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

Parameters
[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

AIROC 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)

AIROC transport tx complete indication.

Indicates the application that a packet is sent using a buffer in the indicated pool.

Parameters
[in]p_pool: Pool pointer, buffer is used from this pool for sending the packet
Returns
: None

Function Documentation

void* wiced_transport_allocate_buffer ( wiced_transport_buffer_pool_t p_pool)

Function wiced_transport_allocate_buffer.

Allocates a buffer from the pool

Parameters
[in]p_pool: Pointer to buffer pool returned from wiced_transport_create_buffer_pool
Returns
: Pointer to the payload on success, NULL on failure. Application shall write the payload starting from this location
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

  • Parameters
    [in]buffer_size: Size of each buffer in pool. Application shall specify the payload length as the buffer size
  • Parameters
    [in]buffer_count: Number of buffers in the pool
    Returns
    : pointer to the buffer pool on success, NULL on failure
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.

Parameters
[in]p_buf:Pointer to the buffer to be freed
Returns
None
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

Parameters
[in]p_pool: Pointer to buffer pool created using wiced_transport_create_buffer_pool
Returns
: the number of buffers available in the 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

Parameters
[in]p_pool: Pointer to buffer pool returned from wiced_trans_create_buffer_pool
Returns
: size of the buffers in the 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

  • Parameters
    [in]p_cfg: AIROC transport config
    Returns
    : wiced_result_t
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.

Parameters
[in]code:Group code and command code
[in]p_buf:Pointer to the payload
[in]length:Payload length
Returns
wiced_result_t
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).

Parameters
[in]code:Group code and command code
[in]p_data:Pointer to the payload
[in]length:Payload length
Returns
wiced_result_t
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.

Parameters
[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
Returns
wiced_result_t WICED_SUCCESS, if success, WICED_NO_MEMORY if buffers not available to send, WICED_ERROR otherwise