1 /* 2 * SPDX-FileCopyrightText: 2016 Cesanta Software Limited 3 * 4 * SPDX-License-Identifier: GPL-2.0-or-later 5 * 6 * SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD 7 */ 8 9 #ifndef SLIP_H_ 10 #define SLIP_H_ 11 12 #include <stdint.h> 13 14 /* Send the SLIP frame begin/end delimiter. */ 15 void SLIP_send_frame_delimiter(void); 16 17 /* Send a single character of SLIP frame data, escaped as per SLIP escaping. */ 18 void SLIP_send_frame_data(char ch); 19 20 /* Send some SLIP frame data, escaped as per SLIP escaping. */ 21 void SLIP_send_frame_data_buf(const void *buf, uint32_t size); 22 23 /* Send a full SLIP frame, with specified contents. */ 24 void SLIP_send(const void *pkt, uint32_t size); 25 26 typedef enum { 27 SLIP_NO_FRAME, 28 SLIP_FRAME, 29 SLIP_FRAME_ESCAPING 30 } slip_state_t; 31 32 int16_t SLIP_recv_byte(char byte, slip_state_t *state); 33 34 #define SLIP_FINISHED_FRAME -2 35 #define SLIP_NO_BYTE -1 36 37 /* Receive a SLIP frame, with specified contents. */ 38 uint32_t SLIP_recv(void *pkt, uint32_t max_len); 39 40 #endif /* SLIP_H_ */ 41