Tiny protocol
0.7.0
Tiny communication protocol for microcontrollers
|
Classes | |
struct | _hdlc_handle_t |
Typedefs | |
typedef struct _hdlc_handle_t | hdlc_struct_t |
typedef struct _hdlc_handle_t * | hdlc_handle_t |
Enumerations | |
enum | hdlc_crc_t { HDLC_CRC_DEFAULT = 0, HDLC_CRC_8 = 8, HDLC_CRC_16 = 16, HDLC_CRC_32 = 32, HDLC_CRC_OFF = 0xFF } |
Functions | |
hdlc_handle_t | hdlc_init (hdlc_struct_t *hdlc_info) |
int | hdlc_close (hdlc_handle_t handle) |
void | hdlc_reset (hdlc_handle_t handle) |
int | hdlc_run_rx (hdlc_handle_t handle, void *data, int len) |
int | hdlc_run_tx (hdlc_handle_t handle) |
int | hdlc_send (hdlc_handle_t handle, const void *data, int len) |
typedef struct _hdlc_handle_t hdlc_struct_t |
Structure describes configuration of lowest HDLC level Initialize this structure by 0 before passing to hdlc_init() function.
int hdlc_close | ( | hdlc_handle_t | handle | ) |
Shutdowns all hdlc activity
handle | handle to hdlc instance |
hdlc_handle_t hdlc_init | ( | hdlc_struct_t * | hdlc_info | ) |
Initializes hdlc level and returns hdlc handle or NULL in case of error.
hdlc_info | pointer to hdlc_struct_t structure, which defines user-specific configuration |
void hdlc_reset | ( | hdlc_handle_t | handle | ) |
Resets hdlc state. Use this function, if hw error happened on tx or rx line, and this requires hardware change, and cancelling current operation.
handle | handle to hdlc instance |
int hdlc_run_rx | ( | hdlc_handle_t | handle, |
void * | data, | ||
int | len | ||
) |
Processes incoming data. Implementation of reading data from hw is user responsibility. If hdlc_run_rx() returns value less than size of data passed to the function, then hdlc_run_rx() must be called later second time with the pointer to and size of not processed bytes.
handle | handle to hdlc instance |
data | pointer to incoming data to process |
len | size of received data in bytes |
int hdlc_run_tx | ( | hdlc_handle_t | handle | ) |
Runs transmission at hdlc level. If there is frame to send, or send is in progress, this function will call send_tx() callback multiple times. If send_tx() callback reports 0, that means that hw device is busy, then hdlc_run_tx() will return immediately and hdlc_run_tx() must be called later next time.
handle | handle to hdlc instance |
int hdlc_send | ( | hdlc_handle_t | handle, |
const void * | data, | ||
int | len | ||
) |
Puts next frame for sending.
handle | handle to hdlc instance |
data | pointer to new data to send |
len | size of data to send in bytes |