iPXE
Data Structures | Defines | Functions
cdc.h File Reference

USB Communications Device Class (CDC) More...

#include <ipxe/usb.h>

Go to the source code of this file.

Data Structures

struct  cdc_union_descriptor
 Union functional descriptor. More...
struct  cdc_connection_speed_change
 Connection speed change notification. More...

Defines

#define USB_CLASS_CDC   2
 Class code for communications devices.
#define CDC_SEND_ENCAPSULATED_COMMAND
 Send encapsulated command.
#define CDC_GET_ENCAPSULATED_RESPONSE
 Get encapsulated response.
#define CDC_SUBTYPE_UNION   6
 Union functional descriptor subtype.
#define CDC_SUBTYPE_ETHERNET   15
 Ethernet descriptor subtype.
#define CDC_RESPONSE_AVAILABLE
 Response available.
#define CDC_NETWORK_CONNECTION
 Network connection notification.
#define CDC_CONNECTION_SPEED_CHANGE
 Connection speed change notification.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
struct cdc_union_descriptorcdc_union_descriptor (struct usb_configuration_descriptor *config, struct usb_interface_descriptor *interface)
 Locate CDC union functional descriptor.
static int cdc_send_encapsulated_command (struct usb_device *usb, unsigned int interface, void *data, size_t len)
 Send encapsulated command.
static int cdc_get_encapsulated_response (struct usb_device *usb, unsigned int interface, void *data, size_t len)
 Get encapsulated response.

Detailed Description

USB Communications Device Class (CDC)

Definition in file cdc.h.


Define Documentation

#define USB_CLASS_CDC   2

Class code for communications devices.

Definition at line 15 of file cdc.h.

Referenced by usb_describe().

Value:
( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE |          \
          USB_REQUEST_TYPE ( 0x00 ) )

Send encapsulated command.

Definition at line 18 of file cdc.h.

Referenced by cdc_send_encapsulated_command().

Value:
( USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE |           \
          USB_REQUEST_TYPE ( 0x01 ) )

Get encapsulated response.

Definition at line 23 of file cdc.h.

Referenced by cdc_get_encapsulated_response().

#define CDC_SUBTYPE_UNION   6

Union functional descriptor subtype.

Definition at line 38 of file cdc.h.

Referenced by cdc_union_descriptor().

#define CDC_SUBTYPE_ETHERNET   15

Ethernet descriptor subtype.

Definition at line 41 of file cdc.h.

Referenced by ecm_ethernet_descriptor().

Value:
( USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE |           \
          USB_REQUEST_TYPE ( 0x01 ) )

Response available.

Definition at line 44 of file cdc.h.

Referenced by acm_intr_complete().

Value:
( USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE |           \
          USB_REQUEST_TYPE ( 0x00 ) )

Network connection notification.

Definition at line 49 of file cdc.h.

Referenced by ecm_intr_complete(), and ncm_intr_complete().

Value:
( USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE |           \
          USB_REQUEST_TYPE ( 0x2a ) )

Connection speed change notification.

Definition at line 54 of file cdc.h.

Referenced by ecm_intr_complete(), and ncm_intr_complete().


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
struct cdc_union_descriptor* cdc_union_descriptor ( struct usb_configuration_descriptor config,
struct usb_interface_descriptor interface 
) [read]

Locate CDC union functional descriptor.

Parameters:
configConfiguration descriptor
interfaceInterface descriptor
Return values:
descUnion functional descriptor, or NULL if not found

Definition at line 44 of file cdc.c.

References CDC_SUBTYPE_UNION, for_each_interface_descriptor, cdc_union_descriptor::header, NULL, cdc_union_descriptor::subtype, usb_descriptor_header::type, and USB_CS_INTERFACE_DESCRIPTOR.

                                                                    {
        struct cdc_union_descriptor *desc;

        for_each_interface_descriptor ( desc, config, interface ) {
                if ( ( desc->header.type == USB_CS_INTERFACE_DESCRIPTOR ) &&
                     ( desc->subtype == CDC_SUBTYPE_UNION ) )
                        return desc;
        }
        return NULL;
}
static int cdc_send_encapsulated_command ( struct usb_device usb,
unsigned int  interface,
void *  data,
size_t  len 
) [inline, static]

Send encapsulated command.

Parameters:
usbUSB device
interfaceInterface number
dataCommand
lenLength of command
Return values:
rcReturn status code

Definition at line 80 of file cdc.h.

References CDC_SEND_ENCAPSULATED_COMMAND, and usb_control().

Referenced by acm_control_transmit().

static int cdc_get_encapsulated_response ( struct usb_device usb,
unsigned int  interface,
void *  data,
size_t  len 
) [inline, static]

Get encapsulated response.

Parameters:
usbUSB device
interfaceInterface number
dataResponse buffer
lenLength of response buffer
Return values:
rcReturn status code

Definition at line 97 of file cdc.h.

References CDC_GET_ENCAPSULATED_RESPONSE, and usb_control().

Referenced by acm_control_receive().