PHY layer for serialization. More...
Data Structures | |
struct | ser_phy_evt_rx_buf_request_params_t |
A struct containing parameters of event of type SER_PHY_EVT_RX_BUF_REQUEST. More... | |
struct | ser_phy_evt_rx_pkt_received_params_t |
A struct containing parameters of event of type SER_PHY_EVT_RX_PKT_RECEIVED. More... | |
struct | ser_phy_evt_hw_error_params_t |
A struct containing parameters of event of type SER_PHY_EVT_HW_ERROR. More... | |
struct | ser_phy_evt_t |
A struct containing events from a Serialization PHY module. More... | |
Typedefs | |
typedef void(* | ser_phy_events_handler_t )(ser_phy_evt_t event) |
A type of generic callback function handler to be used by all PHY module events. More... | |
Enumerations | |
enum | ser_phy_evt_type_t { SER_PHY_EVT_TX_PKT_SENT = 0, SER_PHY_EVT_RX_BUF_REQUEST, SER_PHY_EVT_RX_PKT_RECEIVED, SER_PHY_EVT_RX_PKT_DROPPED, SER_PHY_EVT_RX_OVERFLOW_ERROR, SER_PHY_EVT_TX_OVERREAD_ERROR, SER_PHY_EVT_HW_ERROR, SER_PHY_EVT_TYPE_MAX } |
Serialization PHY module event types. More... | |
Functions | |
uint32_t | ser_phy_open (ser_phy_events_handler_t events_handler) |
Function for opening and initializing the PHY module. More... | |
uint32_t | ser_phy_tx_pkt_send (const uint8_t *p_buffer, uint16_t num_of_bytes) |
Function for transmitting a packet. More... | |
uint32_t | ser_phy_rx_buf_set (uint8_t *p_buffer) |
Function for setting an RX buffer and enabling reception of data (the PHY flow). More... | |
void | ser_phy_close (void) |
Function for closing the PHY module. More... | |
void | ser_phy_interrupts_enable (void) |
Function for enabling the PHY module interrupts. More... | |
void | ser_phy_interrupts_disable (void) |
Function for disabling the PHY module interrupts. More... | |
PHY layer for serialization.
The Serialization PHY library declares functions and definitions of data structures and identifiers (typedef enum) that are used as API of the serialization PHY layer.
typedef void(* ser_phy_events_handler_t)(ser_phy_evt_t event) |
A type of generic callback function handler to be used by all PHY module events.
[in] | event | Serialization PHY module event. |
enum ser_phy_evt_type_t |
Serialization PHY module event types.
Enumerator | |
---|---|
SER_PHY_EVT_TX_PKT_SENT |
Obligatory to implement. An event indicating that a TX packet has been transmitted. |
SER_PHY_EVT_RX_BUF_REQUEST |
Obligatory to implement. An event indicating that the PHY layer needs a buffer for an RX packet. The PHY flow should be blocked until the ser_phy_rx_buf_set function is called. |
SER_PHY_EVT_RX_PKT_RECEIVED |
Obligatory to implement. An event indicating that an RX packet has been successfully received. |
SER_PHY_EVT_RX_PKT_DROPPED |
Obligatory to implement. An event indicating that the RX packet receiving has been finished but the packet was discarded because it was longer than available the buffer. |
SER_PHY_EVT_RX_OVERFLOW_ERROR |
Optional to implement. An event indicating that more information has been transmitted than the PHY module could handle. |
SER_PHY_EVT_TX_OVERREAD_ERROR |
Optional to implement. An event indicating that the PHY module was forced to transmit more information than possessed. |
SER_PHY_EVT_HW_ERROR |
Optional to implement. An event indicating a hardware error in the PHY module. |
SER_PHY_EVT_TYPE_MAX |
Enumeration upper bound. |
void ser_phy_close | ( | void | ) |
Function for closing the PHY module.
void ser_phy_interrupts_disable | ( | void | ) |
Function for disabling the PHY module interrupts.
void ser_phy_interrupts_enable | ( | void | ) |
Function for enabling the PHY module interrupts.
uint32_t ser_phy_open | ( | ser_phy_events_handler_t | events_handler | ) |
Function for opening and initializing the PHY module.
[in] | events_handler | Generic callback function handler to be used by all PHY module events. |
NRF_SUCCESS | Operation success. |
NRF_ERROR_INVALID_STATE | Operation failure. The function has been already called. To call it again, the function ser_phy_close has to be called first. |
NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
NRF_ERROR_INVALID_PARAM | Operation failure. Hardware initialization parameters are not supported. |
uint32_t ser_phy_rx_buf_set | ( | uint8_t * | p_buffer | ) |
Function for setting an RX buffer and enabling reception of data (the PHY flow).
[in] | p_buffer | Pointer to an RX buffer in which to receive. |
NRF_SUCCESS | Operation success. |
NRF_ERROR_INVALID_STATE | Operation failure. A buffer was set without request. |
uint32_t ser_phy_tx_pkt_send | ( | const uint8_t * | p_buffer, |
uint16_t | num_of_bytes | ||
) |
Function for transmitting a packet.
[in] | p_buffer | Pointer to a 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 and event will be send upon transmission completion. |
NRF_ERROR_NULL | Operation failure. NULL pointer supplied. |
NRF_ERROR_INVALID_PARAM | Operation failure. The num_of_bytes parameter equal to 0. |
NRF_ERROR_BUSY | Operation failure. Transmitting of a packet in progress. |