Hdlc#

group drv_hdlc

High-Level Data Link Control protocol library.

Author

Alexandre Abadie alexandre.abadie@inria.fr

Copyright

Inria, 2022

Enums

enum db_hdlc_state_t#

Internal state of the HDLC decoder.

Values:

enumerator DB_HDLC_STATE_IDLE#

Waiting for incoming HDLC frames.

enumerator DB_HDLC_STATE_RECEIVING#

An HDLC frame is being received.

enumerator DB_HDLC_STATE_READY#

An HDLC frame is ready to be decoded.

enumerator DB_HDLC_STATE_ERROR#

The FCS value is invalid.

Functions

db_hdlc_state_t db_hdlc_rx_byte(uint8_t byte)#

Handle a byte received in HDLC internal state.

Parameters:
  • byte[in] The received byte

size_t db_hdlc_decode(uint8_t *payload)#

Decode an HDLC frame.

Parameters:
  • payload[out] Decoded payload contained in the input buffer

Returns:

the number of bytes decoded

size_t db_hdlc_encode(const uint8_t *input, size_t input_len, uint8_t *frame)#

Encode a buffer in an HDLC frame.

Parameters:
  • input[in] Input buffer to encode in the HDLC frame

  • input_len[in] Number of bytes of the input buffer

  • frame[out] Buffer containing the output HDLC frame

Returns:

the size of the HDLC frame