usb_ethernet.h
Defines
-
USB_CDC_MAX_RETRIES
-
ETHERNET_MTU
-
INTERRUPT_RX_MAX
-
NCM_RX_NTB_MAX_SIZE
-
USB_ECM_SUBCLASS
-
USB_NCM_SUBCLASS
-
USB_CS_INTERFACE_DESCRIPTOR
-
USB_UNION_FUNCTIONAL_DESCRIPTOR
-
USB_ETHERNET_FUNCTIONAL_DESCRIPTOR
-
USB_NCM_FUNCTIONAL_DESCRIPTOR
Typedefs
-
typedef struct _eth_device_t eth_device_t
Enums
-
enum _cdc_request_codes
Values:
-
enumerator REQUEST_SEND_ENCAPSULATED_COMMAND
-
enumerator REQUEST_GET_ENCAPSULATED_RESPONSE
-
enumerator REQUEST_SET_ETHERNET_MULTICAST_FILTERS
-
enumerator REQUEST_SET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER
-
enumerator REQUEST_GET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER
-
enumerator REQUEST_SET_ETHERNET_PACKET_FILTER
-
enumerator REQUEST_GET_ETHERNET_STATISTIC
-
enumerator REQUEST_GET_NTB_PARAMETERS
-
enumerator REQUEST_GET_NET_ADDRESS
-
enumerator REQUEST_SET_NET_ADDRESS
-
enumerator REQUEST_GET_NTB_FORMAT
-
enumerator REQUEST_SET_NTB_FORMAT
-
enumerator REQUEST_GET_NTB_INPUT_SIZE
-
enumerator REQUEST_SET_NTB_INPUT_SIZE
-
enumerator REQUEST_GET_MAX_DATAGRAM_SIZE
-
enumerator REQUEST_SET_MAX_DATAGRAM_SIZE
-
enumerator REQUEST_GET_CRC_MODE
-
enumerator REQUEST_SET_CRC_MODE
-
enumerator REQUEST_SEND_ENCAPSULATED_COMMAND
Functions
-
usb_error_t eth_usb_event_callback(usb_event_t event, void *event_data, usb_callback_data_t *callback_data)
Callback function to be passed to usb_Init to enable Ethernet driver for lwIP.
-
uint8_t eth_get_interfaces(void)
Timestamp (sys_now() ms) of the last frame received from the wire.
Polls for the registration status of interfaces.
Note
Example: a return value of 0b00001101 indicates that en0, en2, and en3 currently exist.
Note
The ifnum assignment system seeks to the next free ifnum.
Note
Up to 8 simultaneous interfaces allowed. Any more causes device init to fail.
- Returns:
ms value, or 0 if no frame has ever been received. Used by the connection layer as an inactivity watchdog: a connect/handshake is only timed out when this stops advancing (the line went quiet), never while inbound packets keep arriving.
- Returns:
A bitmap indicating what NETIFs are registered (netif->num)
-
bool netif_is_link_error(const struct netif *netif)
Reports whether an ethernet netif has been brought down by an unrecoverable link/device error (endpoint retry exhaustion or RX-drain invariant failure).
- Parameters:
netif – The interface to query. May be NULL or a non-ethernet netif, in which case the result is false.
- Returns:
true if the interface was aborted with an error and disabled; false otherwise (including healthy, or simply down via the normal admin path).
Variables
-
eth_device_t eth
-
struct usb_cs_interface_descriptor_t
- #include <usb_ethernet.h>
-
struct usb_union_functional_descriptor_t
- #include <usb_ethernet.h>
-
struct usb_ethernet_functional_descriptor_t
- #include <usb_ethernet.h>
-
struct usb_ncm_functional_descriptor_t
- #include <usb_ethernet.h>
-
struct _ntb_params
- #include <usb_ethernet.h>
Public Members
-
uint16_t wLength
-
uint16_t bmNtbFormatsSupported
-
uint32_t dwNtbInMaxSize
-
uint16_t wNdpInDivisor
-
uint16_t wNdpInPayloadRemainder
-
uint16_t wNdpInAlignment
-
uint16_t reserved
-
uint32_t dwNtbOutMaxSize
-
uint16_t wNdpOutDivisor
-
uint16_t wNdpOutPayloadRemainder
-
uint16_t wNdpOutAlignment
-
uint16_t wNtbOutMaxDatagrams
-
uint16_t wLength
-
struct _ncm
- #include <usb_ethernet.h>
-
struct _eth_device_t
- #include <usb_ethernet.h>
Public Members
-
usb_device_t device
-
uint8_t type
-
uint8_t hwaddr[6]
-
bool rx_transfer_active
-
uint8_t rx_retries
-
uint8_t tx_retries
-
uint8_t int_retries
-
uint8_t rx_drain_errors
-
bool rx_drain_timer_armed
-
bool disabled_with_error
-
bool shutting_down
-
bool dhcp_auto_started
-
bool dead
-
uint16_t pending_transfers
-
struct _eth_device_t *dead_next
-
struct mem_buffer *rx_ring
-
usb_endpoint_t endpoint
-
usb_error_t (*callback)(usb_endpoint_t endpoint, usb_transfer_status_t status, size_t transferred, usb_transfer_data_t *data)
-
uint8_t buf[NCM_RX_NTB_MAX_SIZE]
-
struct _eth_device_t rx
-
struct _eth_device_t tx
-
struct _eth_device_t interrupt
-
union _eth_device_t class
-
usb_device_t device
-
struct usb_configurator
- #include <usb_ethernet.h>
Public Members
-
usb_error_t (*reset_device)(usb_device_t device)
-
usb_error_t (*disable_device)(usb_device_t device)
-
usb_device_t (*ref_device)(usb_device_t device)
-
usb_device_t (*unref_device)(usb_device_t device)
-
void (*set_device_data)(usb_device_t device, usb_device_data_t *data)
-
usb_device_data_t *(*get_device_data)(usb_device_t device)
-
usb_role_t (*get_role)(void)
-
usb_device_flags_t (*get_device_flags)(usb_device_t device)
-
usb_error_t (*schedule_transfer)(usb_endpoint_t endpoint, void *buffer, size_t length, usb_transfer_callback_t handler, usb_transfer_data_t *data)
-
usb_error_t (*control_transfer)(usb_endpoint_t device, const usb_control_setup_t *setup, void *buffer, unsigned retries, size_t *transferred)
-
size_t (*get_config_descriptor_len)(usb_device_t device, uint8_t index)
-
usb_error_t (*get_descriptor)(usb_device_t device, usb_descriptor_type_t type, uint8_t index, void *descriptor, size_t length, size_t *transferred)
-
usb_error_t (*get_string_descriptor)(usb_device_t device, uint8_t index, uint16_t langid, usb_string_descriptor_t *descriptor, size_t length, size_t *transferred)
-
usb_error_t (*set_configuration)(usb_device_t device, const usb_configuration_descriptor_t *descriptor, size_t length)
-
usb_error_t (*set_interface)(usb_device_t device, const usb_interface_descriptor_t *descriptor, size_t length)
-
usb_endpoint_t (*get_device_endpoint)(usb_device_t device, uint8_t address)
-
void (*set_endpoint_data)(usb_endpoint_t endpoint, usb_endpoint_data_t *data)
-
usb_endpoint_data_t *(*get_endpoint_data)(usb_endpoint_t endpoint)
-
void (*set_endpoint_flags)(usb_endpoint_t endpoint, usb_endpoint_flags_t flags)
-
usb_error_t (*set_endpoint_halt)(usb_endpoint_t endpoint)
-
usb_error_t (*init)(usb_event_callback_t handler, usb_callback_data_t *data, const usb_standard_descriptors_t *device_descriptors, usb_init_flags_t flags)
-
usb_error_t (*handle_events)(void)
-
void (*cleanup)(void)
-
usb_error_t (*reset_device)(usb_device_t device)