2 Driver for USB Ethernet Control Model devices
3 Copyright (C) 2008 Michael Lotz <mmlr@mlotz.ch>
4 Distributed under the terms of the MIT license.
6 #ifndef _USB_ECM_DRIVER_H_
7 #define _USB_ECM_DRIVER_H_
10 #include <KernelExport.h>
14 #include <util/kernel_cpp.h>
16 #define DRIVER_NAME "usb_ecm"
19 /* class and subclass codes */
20 #define USB_INTERFACE_CLASS_CDC 0x02
21 #define USB_INTERFACE_SUBCLASS_ECM 0x06
22 #define USB_INTERFACE_CLASS_CDC_DATA 0x0a
23 #define USB_INTERFACE_SUBCLASS_DATA 0x00
25 /* communication device descriptor subtypes */
26 #define FUNCTIONAL_SUBTYPE_UNION 0x06
27 #define FUNCTIONAL_SUBTYPE_ETHERNET 0x0f
29 typedef struct ethernet_functional_descriptor_s
{
30 uint8 functional_descriptor_subtype
;
31 uint8 mac_address_index
;
32 uint32 ethernet_statistics
;
33 uint16 max_segment_size
;
34 uint16 num_multi_cast_filters
;
35 uint8 num_wakeup_pattern_filters
;
36 } _PACKED ethernet_functional_descriptor
;
38 /* notification definitions */
39 #define CDC_NOTIFY_NETWORK_CONNECTION 0x00
40 #define CDC_NOTIFY_CONNECTION_SPEED_CHANGE 0x2a
42 typedef struct cdc_notification_s
{
44 uint8 notification_code
;
49 } _PACKED cdc_notification
;
51 typedef struct cdc_connection_speed_s
{
52 uint32 upstream_speed
; /* in bits/s */
53 uint32 downstream_speed
; /* in bits/s */
54 } _PACKED cdc_connection_speed
;
56 extern usb_module_info
*gUSBModule
;
59 status_t
usb_ecm_device_added(usb_device device
, void **cookie
);
60 status_t
usb_ecm_device_removed(void *cookie
);
62 status_t
init_hardware();
65 const char **publish_devices();
66 device_hooks
*find_device(const char *name
);
69 #define TRACE(x...) /*dprintf(DRIVER_NAME ": " x)*/
70 #define TRACE_ALWAYS(x...) dprintf(DRIVER_NAME ": " x)
72 #endif //_USB_ECM_DRIVER_H_