Driver for the ethernet-over-serial module.
More...
Driver for the ethernet-over-serial module.
|
file | ethos_params.h |
| Default configuration for the ethos device driver.
|
|
file | ethos.h |
| Interface definition for the ethernet-over-serial module.
|
|
|
enum | line_state_t { WAIT_FRAMESTART
, IN_FRAME
, IN_ESCAPE
} |
| Enum describing line state. More...
|
|
|
void | ethos_setup (ethos_t *dev, const ethos_params_t *params, uint8_t index, void *inbuf, size_t inbuf_size) |
| Setup an ethos based device state.
|
|
void | ethos_send_frame (ethos_t *dev, const uint8_t *data, size_t len, unsigned frame_type) |
| Send frame over serial port using ethos' framing.
|
|
◆ ETHOS_ESC_CHAR
#define ETHOS_ESC_CHAR (0x7D) |
◆ ETHOS_FRAME_DELIMITER
#define ETHOS_FRAME_DELIMITER (0x7E) |
◆ ETHOS_FRAME_TYPE_DATA
#define ETHOS_FRAME_TYPE_DATA (0x0) |
◆ ETHOS_FRAME_TYPE_HELLO
#define ETHOS_FRAME_TYPE_HELLO (0x2) |
◆ ETHOS_FRAME_TYPE_HELLO_REPLY
#define ETHOS_FRAME_TYPE_HELLO_REPLY (0x3) |
◆ ETHOS_FRAME_TYPE_TEXT
#define ETHOS_FRAME_TYPE_TEXT (0x1) |
◆ line_state_t
Enum describing line state.
Definition at line 101 of file ethos.h.
◆ ethos_send_frame()
void ethos_send_frame |
( |
ethos_t * |
dev, |
|
|
const uint8_t * |
data, |
|
|
size_t |
len, |
|
|
unsigned |
frame_type |
|
) |
| |
Send frame over serial port using ethos' framing.
This is used by e.g., stdio over ethos to send text frames.
- Note
- Uses mutexes to synchronize sending multiple frames so it should not be called from ISR.
- Parameters
-
[in] | dev | handle of the device to initialize |
[in] | data | ptr to data to be sent |
[in] | len | nr of bytes to send |
[in] | frame_type | frame type to use |
◆ ethos_setup()
void ethos_setup |
( |
ethos_t * |
dev, |
|
|
const ethos_params_t * |
params, |
|
|
uint8_t |
index, |
|
|
void * |
inbuf, |
|
|
size_t |
inbuf_size |
|
) |
| |
Setup an ethos based device state.
The supplied buffer must have a power-of-two size, and it must be large enough for the largest expected packet + enough buffer space to buffer bytes that arrive while one packet is being handled.
E.g., if 1536b ethernet frames are expected, 2048 is probably a good size for buf
.
- Parameters
-
[out] | dev | handle of the device to initialize |
[in] | params | parameters for device initialization |
[in] | index | Index of params in a global parameter struct array. If initialized manually, pass a unique identifier instead. |
[in] | inbuf | buffer to store a received frame in |
[in] | inbuf_size | size of the receive buffer |