Ethernet-over-serial driver

Driver for the ethernet-over-serial module. More...

Detailed Description

Driver for the ethernet-over-serial module.


 Ethernet-over-serial driver driver compile configuration


file  ethos_params.h
 Default configuration for the ethos device driver.
file  ethos.h
 Interface definition for the ethernet-over-serial module.

Data Structures

struct  ethos_t
 ethos netdev device More...
struct  ethos_params_t
 Struct containing the needed configuration. More...


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. More...
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. More...

Escape char definitions

#define ETHOS_ESC_CHAR   (0x7D)
#define ETHOS_FRAME_TYPE_DATA   (0x0)
#define ETHOS_FRAME_TYPE_TEXT   (0x1)
#define ETHOS_FRAME_TYPE_HELLO   (0x2)

Macro Definition Documentation


#define ETHOS_ESC_CHAR   (0x7D)

Definition at line 91 of file ethos.h.



Definition at line 90 of file ethos.h.


#define ETHOS_FRAME_TYPE_DATA   (0x0)

Definition at line 92 of file ethos.h.


#define ETHOS_FRAME_TYPE_HELLO   (0x2)

Definition at line 94 of file ethos.h.



Definition at line 95 of file ethos.h.


#define ETHOS_FRAME_TYPE_TEXT   (0x1)

Definition at line 93 of file ethos.h.

Enumeration Type Documentation

◆ line_state_t

Enum describing line state.

Definition at line 101 of file ethos.h.

Function Documentation

◆ 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.

Uses mutexes to synchronize sending multiple frames so it should not be called from ISR.
[in]devhandle of the device to initialize
[in]dataptr to data to be sent
[in]lennr of bytes to send
[in]frame_typeframe 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.

[out]devhandle of the device to initialize
[in]paramsparameters for device initialization
[in]indexIndex of params in a global parameter struct array. If initialized manually, pass a unique identifier instead.
[in]inbufbuffer to store a received frame in
[in]inbuf_sizesize of the receive buffer