nRF51 SDK - S210 SoftDevice
|
HCI transport module implementation. More...
Modules | |
CRC compute | |
This module implements the CRC-16 calculation in the blocks. | |
Data Structures | |
struct | hci_transport_evt_t |
Struct containing events from the Transport layer. More... | |
Macros | |
#define | HCI_TRANSPORT_PKT_HEADER_SIZE (2) |
Typedefs | |
typedef void(* | hci_transport_event_handler_t )(hci_transport_evt_t event) |
Transport layer generic event callback function type. More... | |
typedef void(* | hci_transport_tx_done_handler_t )(hci_transport_tx_done_result_t result) |
Transport layer TX done event callback function type. More... | |
typedef void(* | hci_transport_event_handler_t )(hci_transport_evt_t event) |
Transport layer generic event callback function type. More... | |
typedef void(* | hci_transport_tx_done_handler_t )(hci_transport_tx_done_result_t result) |
Transport layer TX done event callback function type. More... | |
Enumerations | |
enum | hci_transport_evt_type_t { HCI_TRANSPORT_RX_RDY, HCI_TRANSPORT_EVT_TYPE_MAX, HCI_TRANSPORT_RX_RDY, HCI_TRANSPORT_EVT_TYPE_MAX } |
Generic event callback function events. More... | |
enum | hci_transport_tx_done_result_t { HCI_TRANSPORT_TX_DONE_SUCCESS, HCI_TRANSPORT_TX_DONE_FAILURE, HCI_TRANSPORT_TX_DONE_SUCCESS, HCI_TRANSPORT_TX_DONE_FAILURE } |
TX done event callback function result codes. More... | |
enum | hci_transport_evt_type_t { HCI_TRANSPORT_RX_RDY, HCI_TRANSPORT_EVT_TYPE_MAX, HCI_TRANSPORT_RX_RDY, HCI_TRANSPORT_EVT_TYPE_MAX } |
Generic event callback function events. More... | |
enum | hci_transport_tx_done_result_t { HCI_TRANSPORT_TX_DONE_SUCCESS, HCI_TRANSPORT_TX_DONE_FAILURE, HCI_TRANSPORT_TX_DONE_SUCCESS, HCI_TRANSPORT_TX_DONE_FAILURE } |
TX done event callback function result codes. More... | |
Functions | |
uint32_t | hci_transport_evt_handler_reg (hci_transport_event_handler_t event_handler) |
Function for registering a generic event handler. More... | |
uint32_t | hci_transport_tx_done_register (hci_transport_tx_done_handler_t event_handler) |
Function for registering a handler for TX done event. More... | |
uint32_t | hci_transport_open (void) |
Function for opening the transport channel and initializing the transport layer. More... | |
uint32_t | hci_transport_close (void) |
Function for closing the transport channel. More... | |
uint32_t | hci_transport_tx_alloc (uint8_t **pp_memory) |
Function for allocating tx packet memory. More... | |
uint32_t | hci_transport_tx_free (void) |
Function for freeing tx packet memory. More... | |
uint32_t | hci_transport_pkt_write (const uint8_t *p_buffer, uint16_t length) |
Function for writing a packet. More... | |
uint32_t | hci_transport_rx_pkt_extract (uint8_t **pp_buffer, uint16_t *p_length) |
Function for extracting received packet. More... | |
uint32_t | hci_transport_rx_pkt_consume (uint8_t *p_buffer) |
Function for consuming extracted packet described by p_buffer. More... | |
uint32_t | hci_transport_pkt_write (const uint8_t *p_buffer, uint32_t length) |
Function for writing a packet. More... | |
uint32_t | hci_transport_rx_pkt_extract (uint8_t **pp_buffer, uint32_t *p_length) |
Function for extracting received packet. More... | |
HCI transport module implementation.
This module implements certain specific features from the three-wire UART transport layer, defined by the Bluetooth specification version 4.0 [Vol 4] part D.
The application TX packet processing flow is illustrated by the statemachine below.
The following compile time configuration options are available, and used to configure the application TX packet retransmission interval, in order to suite various application specific implementations:
The following compile time configuration option is available to configure module specific behaviour:
#define HCI_TRANSPORT_PKT_HEADER_SIZE (2) |
Size of transport packet header
typedef void(* hci_transport_event_handler_t)(hci_transport_evt_t event) |
Transport layer generic event callback function type.
[in] | event | Transport layer event. |
typedef void(* hci_transport_event_handler_t)(hci_transport_evt_t event) |
Transport layer generic event callback function type.
[in] | event | Transport layer event. |
typedef void(* hci_transport_tx_done_handler_t)(hci_transport_tx_done_result_t result) |
Transport layer TX done event callback function type.
[in] | result | TX done event result code. |
typedef void(* hci_transport_tx_done_handler_t)(hci_transport_tx_done_result_t result) |
Transport layer TX done event callback function type.
[in] | result | TX done event result code. |
Generic event callback function events.
Generic event callback function events.
TX done event callback function result codes.
TX done event callback function result codes.
uint32_t hci_transport_close | ( | void | ) |
Function for closing the transport channel.
NRF_SUCCESS | Operation success. |
uint32_t hci_transport_evt_handler_reg | ( | hci_transport_event_handler_t | event_handler | ) |
Function for registering a generic event handler.
[in] | event_handler | The function to be called by the transport layer upon an event. |
NRF_SUCCESS | Operation success. |
NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
uint32_t hci_transport_open | ( | void | ) |
Function for opening the transport channel and initializing the transport layer.
NRF_SUCCESS | Operation success. |
NRF_ERROR_INTERNAL | Operation failure. Internal error ocurred. |
uint32_t hci_transport_pkt_write | ( | const uint8_t * | p_buffer, |
uint32_t | length | ||
) |
Function for writing a packet.
NRF_SUCCESS | Operation success. Packet was added to the transmission queue and an event will be send upon transmission completion. |
NRF_ERROR_NO_MEM | Operation failure. Transmission queue is full and packet was not added to the transmission queue. User should wait for a appropriate event prior issuing this operation again. |
NRF_ERROR_DATA_SIZE | Operation failure. Packet size exceeds limit. |
NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
NRF_ERROR_INVALID_STATE | Operation failure. Channel is not open. |
uint32_t hci_transport_pkt_write | ( | const uint8_t * | p_buffer, |
uint16_t | length | ||
) |
Function for writing a packet.
NRF_SUCCESS | Operation success. Packet was added to the transmission queue and an event will be send upon transmission completion. |
NRF_ERROR_NO_MEM | Operation failure. Transmission queue is full and packet was not added to the transmission queue. User should wait for a appropriate event prior issuing this operation again. |
NRF_ERROR_DATA_SIZE | Operation failure. Packet size exceeds limit. |
NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
NRF_ERROR_INVALID_STATE | Operation failure. Channel is not open. |
NRF_ERROR_INVALID_ADDR | Operation failure. Buffer provided is not allocated through hci_transport_tx_alloc function. |
uint32_t hci_transport_rx_pkt_consume | ( | uint8_t * | p_buffer | ) |
Function for consuming extracted packet described by p_buffer.
RX memory pointed to by p_buffer is freed and can be reused by the underlying transport layer.
[in] | p_buffer | Pointer to the buffer that has been consumed. |
NRF_SUCCESS | Operation success. |
NRF_ERROR_NO_MEM | Operation failure. No packet available to consume. |
NRF_ERROR_INVALID_ADDR | Operation failure. Not a valid pointer. |
uint32_t hci_transport_rx_pkt_extract | ( | uint8_t ** | pp_buffer, |
uint32_t * | p_length | ||
) |
Function for extracting received packet.
[out] | pp_buffer | Pointer to the packet data. |
[out] | p_length | Length of packet data in bytes. |
NRF_SUCCESS | Operation success. Packet was extracted. |
NRF_ERROR_NO_MEM | Operation failure. No packet available to extract. |
NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
uint32_t hci_transport_rx_pkt_extract | ( | uint8_t ** | pp_buffer, |
uint16_t * | p_length | ||
) |
Function for extracting received packet.
[out] | pp_buffer | Pointer to the packet data. |
[out] | p_length | Length of packet data in bytes. |
NRF_SUCCESS | Operation success. Packet was extracted. |
NRF_ERROR_NO_MEM | Operation failure. No packet available to extract. |
NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
uint32_t hci_transport_tx_alloc | ( | uint8_t ** | pp_memory | ) |
Function for allocating tx packet memory.
[out] | pp_memory | Pointer to the packet data. |
NRF_SUCCESS | Operation success. Memory was allocated. |
NRF_ERROR_NO_MEM | Operation failure. No memory available. |
NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
uint32_t hci_transport_tx_done_register | ( | hci_transport_tx_done_handler_t | event_handler | ) |
Function for registering a handler for TX done event.
[in] | event_handler | The function to be called by the transport layer upon TX done event. |
NRF_SUCCESS | Operation success. |
NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
uint32_t hci_transport_tx_free | ( | void | ) |
Function for freeing tx packet memory.
NRF_SUCCESS | Operation success. Memory was freed. |