22#ifndef USB_USBUS_CDC_ECM_H
23#define USB_USBUS_CDC_ECM_H
47#ifndef CONFIG_USBUS_CDC_ECM_CONFIG_SPEED
48#define CONFIG_USBUS_CDC_ECM_CONFIG_SPEED 1000000
54#ifndef CONFIG_USBUS_CDC_ECM_CONFIG_SPEED_DOWNSTREAM
55#define CONFIG_USBUS_CDC_ECM_CONFIG_SPEED_DOWNSTREAM CONFIG_USBUS_CDC_ECM_CONFIG_SPEED
61#ifndef CONFIG_USBUS_CDC_ECM_CONFIG_SPEED_UPSTREAM
62#define CONFIG_USBUS_CDC_ECM_CONFIG_SPEED_UPSTREAM CONFIG_USBUS_CDC_ECM_CONFIG_SPEED
72#define USBUS_CDCECM_EP_CTRL_SIZE 16
79#ifndef MODULE_PERIPH_USBDEV_HS
80#define USBUS_CDCECM_EP_DATA_SIZE 64
82#define USBUS_CDCECM_EP_DATA_SIZE 512
88#define USBUS_ETHERNET_FRAME_BUF MATH_ALIGN(ETHERNET_FRAME_LEN, USBUS_CDCECM_EP_DATA_SIZE)
93#define USBUS_CDC_ECM_EP_IN_REQUIRED_NUMOF 2
98#define USBUS_CDC_ECM_EP_OUT_REQUIRED_NUMOF 1
USBUS control endpoint module.
Definitions for USB protocol messages.
Definitions low-level network driver interface.
Definitions for Ethernet.
#define usbdev_ep_buf_t
Instantiation type for usbdev endpoint buffers.
#define ETHERNET_ADDR_LEN
Length of an Ethernet address.
#define USBUS_CDCECM_EP_CTRL_SIZE
CDC ECM interrupt endpoint size.
#define USBUS_CDCECM_EP_DATA_SIZE
CDC ECM bulk data endpoint size.
usbus_cdcecm_notif_t
notification state, used to track which information must be send to the host
#define USBUS_ETHERNET_FRAME_BUF
Full ethernet frame rounded up to a whole number of transfers.
void usbus_cdcecm_init(usbus_t *usbus, usbus_cdcecm_device_t *handler)
CDC ECM initialization function.
struct usbus_cdcecm_device usbus_cdcecm_device_t
USBUS CDC ECM device interface context.
@ USBUS_CDCECM_NOTIF_NONE
Nothing notified so far.
@ USBUS_CDCECM_NOTIF_LINK_UP
Link status is notified.
@ USBUS_CDCECM_NOTIF_SPEED
Link speed is notified.
Mutex for thread synchronization.
Ethernet header definitions.
Structure to hold driver state.
USBUS CDC ECM device interface context.
usbus_cdcecm_notif_t notif
Startup message notification tracker.
usbdev_ep_buf_t control_in[USBUS_CDCECM_EP_CTRL_SIZE]
Host out device in control buffer.
usbdev_ep_buf_t data_in[USBUS_CDCECM_EP_DATA_SIZE]
Host in device out data buffer.
usbus_interface_t iface_data
Data interface.
usbdev_ep_buf_t data_out[USBUS_ETHERNET_FRAME_BUF]
Buffer for received frames from the host.
usbus_endpoint_t * ep_ctrl
Control endpoint.
netdev_t netdev
Netdev context struct.
usbus_descr_gen_t ecm_descr
ECM descriptor generator.
event_t tx_xmit
Transmit ready event.
usbus_interface_t iface_ctrl
Control interface.
unsigned active_iface
Current active data interface.
size_t tx_len
Length of the current tx frame.
usbus_handler_t handler_ctrl
Control interface handler.
usbus_endpoint_t * ep_out
Data endpoint out.
char mac_host[13]
host side's MAC address as string
mutex_t out_lock
mutex used for locking netif/USBUS send
usbus_endpoint_t * ep_in
Data endpoint in.
usbus_urb_t out_urb
Host out device in reception URB.
event_t rx_flush
Receive flush event.
uint8_t mac_netdev[ETHERNET_ADDR_LEN]
this device's MAC address
usbus_interface_alt_t iface_data_alt
Data alternative (active) interface.
usbus_t * usbus
Ptr to the USBUS context.
usbus_string_t mac_str
String context for the host side mac address.
USBUS descriptor generator.
USBUS interface alternative setting.
USBUS USB request/response block.