21#if defined(MBED_CONF_RTOS_PRESENT) || defined(DOXYGEN_ONLY)
22#include "USBDescriptor.h"
24#include "ByteBuffer.h"
25#include "rtos/Mutex.h"
26#include "EventFlags.h"
27#include "events/EventQueue.h"
28#include "rtos/Thread.h"
31#define MAX_PACKET_SIZE_INT (64)
32#define MAX_PACKET_SIZE_BULK (64)
33#define MAX_PACKET_SIZE_EP0 (64)
34#define DEFAULT_CONFIGURATION (1)
36#define PACKET_TYPE_PROMISCUOUS (1<<0)
37#define PACKET_TYPE_ALL_MULTICAST (1<<1)
38#define PACKET_TYPE_DIRECTED (1<<2)
39#define PACKET_TYPE_BROADCAST (1<<3)
40#define PACKET_TYPE_MULTICAST (1<<4)
65 USBCDC_ECM(
bool connect_blocking =
true, uint16_t vendor_id = 0x0700, uint16_t product_id = 0x0101, uint16_t product_release = 0x0001);
83 USBCDC_ECM(
USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release);
114 bool send(uint8_t *buffer, uint32_t size);
123 void receive_nb(uint8_t *buffer, uint32_t size, uint32_t *actual);
179 virtual void callback_set_configuration(uint8_t configuration);
192 virtual void callback_set_interface(uint16_t interface, uint8_t alternate);
199 virtual const uint8_t *device_desc();
206 virtual const uint8_t *string_iproduct_desc();
213 virtual const uint8_t *string_iconfiguration_desc();
220 virtual const uint8_t *string_iserial_desc();
227 virtual const uint8_t *configuration_desc(uint8_t index);
245 uint8_t device_descriptor[18];
253 uint8_t _config_descriptor[80];
254 uint8_t _string_imac_addr[26];
256 uint8_t _bulk_buf[MAX_PACKET_SIZE_BULK];
257 uint16_t _packet_filter;
269 void _int_callback();
270 void _bulk_in_callback();
271 void _bulk_out_callback();
272 bool _notify_network_connection(uint8_t value);
273 bool _notify_connection_speed_change(uint32_t up, uint32_t down);
274 bool _write_bulk(uint8_t *buffer, uint32_t size);
275 void _notify_connect();
virtual void callback_request(const setup_packet_t *setup)
Called by USBDevice on Endpoint0 request.
bool send(uint8_t *buffer, uint32_t size)
Send a buffer.
USBCDC_ECM(bool connect_blocking=true, uint16_t vendor_id=0x0700, uint16_t product_id=0x0101, uint16_t product_release=0x0001)
Basic constructor.
virtual void callback_request_xfer_done(const setup_packet_t *setup, bool aborted)
Called by USBDevice on data stage completion.
virtual void callback_state_change(DeviceState new_state)
Called when USB changes state.
virtual void callback_reset()
Called by USBDevice layer on bus reset.
USBCDC_ECM(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release)
Fully featured constructor.
uint16_t read_packet_filter()
Return ethernet packet filter bitmap.
void receive_nb(uint8_t *buffer, uint32_t size, uint32_t *actual)
Read from the receive buffer.
virtual ~USBCDC_ECM()
Destroy this object.
bool ready()
Check if this class is ready.
void attach_rx(mbed::Callback< void()> cb)
Attach a callback for when an ethernet packet is received.
void attach_filter(mbed::Callback< void()> cb)
Attach a callback for when a request to configure device ethernet packet filter is received.
void wait_ready()
Block until this device is configured.
Abstract interface to physical USB hardware.
Callback class based on template specialization.
The EventFlags class is used to control event flags or wait for event flags other threads control.
The Mutex class is used to synchronize the execution of threads.
The Thread class allow defining, creating, and controlling thread functions in the system.