![]() |
nRF5 SDK
v16.0.0
|
| Choose documentation: | nRF5 SDK | S112 SoftDevice API | S113 SoftDevice API | S132 SoftDevice API | S140 SoftDevice API | S212 SoftDevice API | S312 SoftDevice API | S332 SoftDevice API | S340 SoftDevice API |
HAL Transport layer for serialization. More...
Data Structures | |
| struct | ser_hal_transport_evt_rx_pkt_received_params_t |
| Struct containing parameters of event of type SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED. More... | |
| struct | ser_hal_transport_evt_phy_error_params_t |
| Struct containing parameters of event of type SER_HAL_TRANSP_EVT_PHY_ERROR. More... | |
| struct | ser_hal_transport_evt_t |
| Struct containing events from the Serialization HAL Transport layer. More... | |
Typedefs | |
| typedef void(* | ser_hal_transport_events_handler_t )(ser_hal_transport_evt_t event) |
| Generic callback function type to be used by all Serialization HAL Transport layer events. More... | |
Enumerations | |
| enum | ser_hal_transport_evt_type_t { SER_HAL_TRANSP_EVT_TX_PKT_SENT = 0, SER_HAL_TRANSP_EVT_RX_PKT_RECEIVING, SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED, SER_HAL_TRANSP_EVT_RX_PKT_DROPPED, SER_HAL_TRANSP_EVT_PHY_ERROR, SER_HAL_TRANSP_EVT_TYPE_MAX } |
| Serialization HAL Transport layer event types. More... | |
| enum | ser_hal_transport_phy_error_type_t { SER_HAL_TRANSP_PHY_ERROR_RX_OVERFLOW = 0, SER_HAL_TRANSP_PHY_ERROR_TX_OVERREAD, SER_HAL_TRANSP_PHY_ERROR_HW_ERROR, SER_HAL_TRANSP_PHY_ERROR_TYPE_MAX } |
| Serialization PHY layer error types. More... | |
Functions | |
| uint32_t | ser_hal_transport_open (ser_hal_transport_events_handler_t events_handler) |
| Function for opening and initializing the Serialization HAL Transport layer. More... | |
| void | ser_hal_transport_reset (void) |
| Function for reseting ser_hal_transport. | |
| void | ser_hal_transport_close (void) |
| Function for closing a transport channel. More... | |
| uint32_t | ser_hal_transport_rx_pkt_free (uint8_t *p_buffer) |
| Function for freeing memory allocated for an RX packet. More... | |
| uint32_t | ser_hal_transport_tx_pkt_alloc (uint8_t **pp_memory, uint16_t *p_num_of_bytes) |
| Function for allocating memory for a TX packet. More... | |
| uint32_t | ser_hal_transport_tx_pkt_send (const uint8_t *p_buffer, uint16_t num_of_bytes) |
| Function for transmitting a packet. More... | |
| uint32_t | ser_hal_transport_tx_pkt_free (uint8_t *p_buffer) |
| Function for freeing memory allocated for a TX packet. More... | |
HAL Transport layer for serialization.
The Serialization HAL Transport declares functions and typedefs used as API of the HAL transport layer for serialization. This layer is fully hardware-independent. Currently, the HAL transport layer is responsible for controlling the PHY layer and memory management. In the future, more features might be added to it, such as CRC or retransmission.
| typedef void(* ser_hal_transport_events_handler_t)(ser_hal_transport_evt_t event) |
Generic callback function type to be used by all Serialization HAL Transport layer events.
| [in] | event | Serialization HAL Transport layer event. |
Serialization HAL Transport layer event types.
Serialization PHY layer error types.
| void ser_hal_transport_close | ( | void | ) |
Function for closing a transport channel.
| uint32_t ser_hal_transport_open | ( | ser_hal_transport_events_handler_t | events_handler | ) |
Function for opening and initializing the Serialization HAL Transport layer.
| [in] | events_handler | Generic callback function to be used by all Serialization HAL Transport layer events. |
| NRF_SUCCESS | Operation success. |
| NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
| NRF_ERROR_INVALID_PARAM | Operation failure. Hardware initialization parameters taken from the configuration file are wrong. |
| NRF_ERROR_INVALID_STATE | Operation failure. The function has been already called. To call it again the function ser_hal_transport_close has to be called first. |
| NRF_ERROR_INTERNAL | Operation failure. Internal error ocurred. |
| uint32_t ser_hal_transport_rx_pkt_free | ( | uint8_t * | p_buffer | ) |
Function for freeing memory allocated for an RX packet.
| [in] | p_buffer | A pointer to the beginning of the buffer that has been processed (has to be the same address as provided in the event of type SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED). |
| NRF_SUCCESS | Operation success. |
| NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
| NRF_ERROR_INVALID_ADDR | Operation failure. Not a valid pointer (provided address is not the starting address of a buffer managed by HAL Transport layer). |
| NRF_ERROR_INVALID_STATE | Operation failure. The function should be called as a response to an event of type SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED. |
| NRF_ERROR_INTERNAL | Operation failure. Internal error ocurred. |
| uint32_t ser_hal_transport_tx_pkt_alloc | ( | uint8_t ** | pp_memory, |
| uint16_t * | p_num_of_bytes | ||
| ) |
Function for allocating memory for a TX packet.
| [out] | pp_memory | A pointer to pointer to which an address of the beginning of the allocated buffer is written. |
| [out] | p_num_of_bytes | A pointer to a variable to which size in octets of the allocated buffer is written. |
| NRF_SUCCESS | Operation success. Memory was allocated. |
| NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
| NRF_ERROR_NO_MEM | Operation failure. No memory available. |
| NRF_ERROR_INVALID_STATE | Operation failure. The function was called before calling ser_hal_transport_open function. |
| uint32_t ser_hal_transport_tx_pkt_free | ( | uint8_t * | p_buffer | ) |
Function for freeing memory allocated for a TX packet.
| [in] | p_buffer | Pointer to the beginning of a buffer that has been allocated by ser_hal_transport_tx_pkt_alloc function. |
| NRF_SUCCESS | Operation success. Memory was freed. |
| NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
| NRF_ERROR_INVALID_ADDR | Operation failure. Not a valid pointer (provided address is not the starting address of a buffer managed by HAL Transport layer). |
| NRF_ERROR_INVALID_STATE | Operation failure. Freeing a TX buffer is possible only if the buffer was allocated by ser_hal_transport_tx_pkt_alloc function and transmittion is not in progress. |
| uint32_t ser_hal_transport_tx_pkt_send | ( | const uint8_t * | p_buffer, |
| uint16_t | num_of_bytes | ||
| ) |
Function for transmitting a packet.
| [in] | p_buffer | Pointer to the buffer to transmit. |
| [in] | num_of_bytes | Number of octets to transmit. Must be more than 0. |
| NRF_SUCCESS | Operation success. Packet was added to the transmission queue. |
| NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
| NRF_ERROR_INVALID_PARAM | Operation failure. num_of_bytes is equal to 0. |
| NRF_ERROR_INVALID_ADDR | Operation failure. Not a valid pointer (provided address is not the starting address of a buffer managed by HAL Transport layer). |
| NRF_ERROR_DATA_SIZE | Operation failure. Packet size exceeds limit. |
| NRF_ERROR_BUSY | Operation failure. Transmission queue is full so packet was not added to the transmission queue. |
| NRF_ERROR_INVALID_STATE | Operation failure. Transmittion channel was not opened by ser_hal_transport_open function or provided buffer was not allocated by ser_hal_transport_tx_pkt_alloc function. |
| NRF_ERROR_INTERNAL | Operation failure. Internal error ocurred. |