Nordic stack and drivers for the mbed BLE API Modified for HRM1017 for library 0.1.0
Fork of nRF51822 by
SLIP module
SLIP layer for supporting packet framing in HCI transport. More...
Data Structures | |
struct | hci_slip_evt_t |
Structure containing an event from the SLIP layer. More... | |
Typedefs | |
typedef void(* | hci_slip_event_handler_t )(hci_slip_evt_t event) |
Function for the SLIP layer event callback. | |
Enumerations | |
enum | hci_slip_evt_type_t { HCI_SLIP_RX_RDY, HCI_SLIP_TX_DONE, HCI_SLIP_RX_OVERFLOW, HCI_SLIP_ERROR, HCI_SLIP_EVT_TYPE_MAX } |
Event types from the SLIP Layer. More... | |
Functions | |
uint32_t | hci_slip_evt_handler_register (hci_slip_event_handler_t event_handler) |
Function for registering the event handler provided as parameter and this event handler will be used by SLIP layer to send events described in hci_slip_evt_type_t. | |
uint32_t | hci_slip_open (void) |
Function for opening the SLIP layer. | |
uint32_t | hci_slip_close (void) |
Function for closing the SLIP layer. | |
uint32_t | hci_slip_write (const uint8_t *p_buffer, uint32_t length) |
Function for writing a packet with SLIP encoding. | |
uint32_t | hci_slip_rx_buffer_register (uint8_t *p_buffer, uint32_t length) |
Function for registering a receive buffer. |
Detailed Description
SLIP layer for supporting packet framing in HCI transport.
This module implements SLIP packet framing as described in the Bluetooth Core Specification 4.0, Volume 4, Part D, Chapter 3 SLIP Layer.
SLIP framing ensures that all packets sent on the UART are framed as: <0xC0> SLIP packet 1 <0xC0> <0xC0> SLIP packet 2 <0xC0>.
The SLIP layer uses events to notify the upper layer when data transmission is complete and when a SLIP packet is received.
Typedef Documentation
typedef void(* hci_slip_event_handler_t)(hci_slip_evt_t event) |
Function for the SLIP layer event callback.
Definition at line 57 of file hci_slip.h.
Enumeration Type Documentation
enum hci_slip_evt_type_t |
Event types from the SLIP Layer.
- Enumerator:
HCI_SLIP_RX_RDY An event indicating that an RX packet is ready to be read.
HCI_SLIP_TX_DONE An event indicating write completion of the TX packet provided in the function call hci_slip_write .
HCI_SLIP_RX_OVERFLOW An event indicating that RX data has been discarded due to lack of free RX memory.
HCI_SLIP_ERROR An event indicating that an unrecoverable error has occurred.
HCI_SLIP_EVT_TYPE_MAX Enumeration upper bound.
Definition at line 37 of file hci_slip.h.
Function Documentation
uint32_t hci_slip_close | ( | void | ) |
Function for closing the SLIP layer.
After this function is called no data can be transmitted or received in this layer.
- Note:
- This function can be called multiple times and also for an unopened channel.
- Return values:
-
NRF_SUCCESS Operation success.
uint32_t hci_slip_evt_handler_register | ( | hci_slip_event_handler_t | event_handler ) |
Function for registering the event handler provided as parameter and this event handler will be used by SLIP layer to send events described in hci_slip_evt_type_t.
- Note:
- Multiple registration requests will overwrite any existing registration.
- Parameters:
-
[in] event_handler This function is called by the SLIP layer upon an event.
- Return values:
-
NRF_SUCCESS Operation success.
uint32_t hci_slip_open | ( | void | ) |
Function for opening the SLIP layer.
This function must be called before hci_slip_write and before any data can be received.
- Note:
- Can be called multiple times.
- Return values:
-
NRF_SUCCESS Operation success.
The SLIP layer module will propagate errors from underlying sub-modules. This implementation is using UART module as a physical transmission layer, and hci_slip_open executes app_uart_init . For an extended error list, please refer to app_uart_init .
uint32_t hci_slip_rx_buffer_register | ( | uint8_t * | p_buffer, |
uint32_t | length | ||
) |
Function for registering a receive buffer.
The receive buffer will be used for storage of received and SLIP decoded data. No data can be received by the SLIP layer until a receive buffer has been registered.
- Note:
- The lifetime of the buffer must be valid during complete reception of data. A static buffer is recommended.
- Warning:
- Multiple registration requests will overwrite any existing registration.
- Parameters:
-
[in] p_buffer Pointer to receive buffer. The received and SLIP decoded packet will be placed in this buffer. [in] length Buffer length, in bytes.
- Return values:
-
NRF_SUCCESS Operation success.
uint32_t hci_slip_write | ( | const uint8_t * | p_buffer, |
uint32_t | length | ||
) |
Function for writing a packet with SLIP encoding.
Packet transmission is confirmed when the HCI_SLIP_TX_DONE event is received by the function caller.
- Parameters:
-
[in] p_buffer Pointer to the packet to transmit. [in] length Packet length, in bytes.
- Return values:
-
NRF_SUCCESS Operation success. Packet was encoded and added to the transmission queue and an event will be sent upon transmission completion. NRF_ERROR_NO_MEM Operation failure. Transmission queue is full and packet was not added to the transmission queue. Application shall wait for the HCI_SLIP_TX_DONE event. After HCI_SLIP_TX_DONE this function can be executed for transmission of next packet. NRF_ERROR_INVALID_ADDR If a NULL pointer is provided. NRF_ERROR_INVALID_STATE Operation failure. Module is not open.
Generated on Tue Jul 12 2022 14:11:58 by 1.7.2