ether2ser 0.1.0
Ethernet <-> synchronous V.24 bridge firmware for RP2040 + W5500
Loading...
Searching...
No Matches
hdlc_encoder.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "hdlc_common.h"
Include dependency graph for hdlc_encoder.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool hdlc_encode (const uint8_t *payload, const size_t payload_length, HDLC_FRAME_T *frame, bool lsb_first)
 Encode payload into an HDLC bit-stuffed frame.
 
bool hdlc_encode_byte (const uint8_t *payload, const size_t payload_length, HDLC_FRAME_T *frame)
 Encode payload using byte-escaping HDLC compatibility path.
 

Function Documentation

◆ hdlc_encode()

bool hdlc_encode ( const uint8_t *  payload,
const size_t  payload_length,
HDLC_FRAME_T frame,
bool  lsb_first 
)

Encode payload into an HDLC bit-stuffed frame.

Parameters
payloadInput payload bytes.
payload_lengthNumber of payload bytes.
frameOutput frame descriptor and storage.
lsb_firstBit order selector for bit-wise encoding.
Returns
true on success, false on invalid args or capacity overflow.

Definition at line 171 of file hdlc_encoder.c.

References HDLC_FRAME_T::capacity, ENCODER_ZERO_PAD_AND_DRAIN, hdlc_crc16(), HDLC_FLAG_BYTE, hdlc_put_byte(), HDLC_TRY_PUT_BYTE, HDLC_FRAME_T::length, LOG_DEBUG, hdlc_encoder_t::out_byte, and HDLC_FRAME_T::payload.

Referenced by tx_queue_enqueue_udp_frame().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hdlc_encode_byte()

bool hdlc_encode_byte ( const uint8_t *  payload,
const size_t  payload_length,
HDLC_FRAME_T frame 
)

Encode payload using byte-escaping HDLC compatibility path.

Parameters
payloadInput payload bytes.
payload_lengthNumber of payload bytes.
frameOutput frame descriptor and storage.
Returns
true on success, false on invalid args or capacity overflow.

Definition at line 57 of file hdlc_encoder.c.

References HDLC_FRAME_T::capacity, hdlc_crc16(), hdlc_escape_if_needed(), HDLC_FLAG_BYTE, HDLC_TRY_PUT_BYTE, HDLC_FRAME_T::length, LOG_DEBUG, and HDLC_FRAME_T::payload.

Here is the call graph for this function: