Ethernet-over-serial driver

Driver for the ethernet-over-serial module.

ETHOS_FRAME_DELIMITER
1
(0x7E)
ETHOS_ESC_CHAR
1
(0x7D)
ETHOS_FRAME_TYPE_DATA
1
(0x0)
ETHOS_FRAME_TYPE_TEXT
1
(0x1)
ETHOS_FRAME_TYPE_HELLO
1
(0x2)
ETHOS_FRAME_TYPE_HELLO_REPLY
1
(0x3)
enum line_state_t
WAIT_FRAMESTART
IN_FRAME
IN_ESCAPE
void ethos_setup(ethos_t * dev, const ethos_params_t * params)

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

dev:handle of the device to initialize
params:parameters for device initialization

void ethos_send_frame(ethos_t * dev, const uint8_t * data, msp430_types.h::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.

Parameters

dev:handle of the device to initialize
data:ptr to data to be sent
len:nr of bytes to send
frame_type:frame type to use

struct ethos_t

ethos netdev device

netdev.h::netdev_t netdev

extended netdev structure

uart.h::uart_t uart

UART device the to use.

uint8_t mac_addr()

this device’s MAC address

uint8_t remote_mac_addr()

this device’s MAC address

tsrb.h::tsrb_t inbuf

ringbuffer for incoming data

ethos.h::line_state_t state

Line status variable.

msp430_types.h::size_t framesize

size of currently incoming frame

unsigned frametype

type of currently incoming frame

msp430_types.h::size_t last_framesize

size of last completed frame

mutex_t out_mutex

mutex used for locking concurrent sends

bool accept_new

incoming frame can be stored or not

struct ethos_params_t

Struct containing the needed configuration.

uart.h::uart_t uart

UART device to use.

uint32_t baudrate

baudrate to UART device

uint8_t * buf

buffer for incoming packets

msp430_types.h::size_t bufsize

size of ethos.h::ethos_params_t::buf