iPXE
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...

Macros

#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)
 FILE_SECBOOT (PERMITTED)
struct cdc_union_descriptor * cdc_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.

Macro Definition Documentation

◆ USB_CLASS_CDC

#define USB_CLASS_CDC   2

Class code for communications devices.

Definition at line 16 of file cdc.h.

Referenced by usb_describe().

◆ CDC_SEND_ENCAPSULATED_COMMAND

#define CDC_SEND_ENCAPSULATED_COMMAND
Value:
USB_REQUEST_TYPE ( 0x00 ) )
#define USB_DIR_OUT
Data transfer is from host to device.
Definition usb.h:95
#define USB_TYPE_CLASS
Class-specific request type.
Definition usb.h:104
#define USB_RECIP_INTERFACE
Request recipient is an interface.
Definition usb.h:116

Send encapsulated command.

Definition at line 19 of file cdc.h.

19#define CDC_SEND_ENCAPSULATED_COMMAND \
20 ( USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE | \
21 USB_REQUEST_TYPE ( 0x00 ) )

Referenced by cdc_send_encapsulated_command().

◆ CDC_GET_ENCAPSULATED_RESPONSE

#define CDC_GET_ENCAPSULATED_RESPONSE
Value:
USB_REQUEST_TYPE ( 0x01 ) )
#define USB_DIR_IN
Data transfer is from device to host.
Definition usb.h:98

Get encapsulated response.

Definition at line 24 of file cdc.h.

24#define CDC_GET_ENCAPSULATED_RESPONSE \
25 ( USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE | \
26 USB_REQUEST_TYPE ( 0x01 ) )

Referenced by cdc_get_encapsulated_response().

◆ CDC_SUBTYPE_UNION

#define CDC_SUBTYPE_UNION   6

Union functional descriptor subtype.

Definition at line 39 of file cdc.h.

Referenced by cdc_union_descriptor().

◆ CDC_SUBTYPE_ETHERNET

#define CDC_SUBTYPE_ETHERNET   15

Ethernet descriptor subtype.

Definition at line 42 of file cdc.h.

Referenced by ecm_ethernet_descriptor().

◆ CDC_RESPONSE_AVAILABLE

#define CDC_RESPONSE_AVAILABLE
Value:
USB_REQUEST_TYPE ( 0x01 ) )

Response available.

Definition at line 45 of file cdc.h.

45#define CDC_RESPONSE_AVAILABLE \
46 ( USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE | \
47 USB_REQUEST_TYPE ( 0x01 ) )

Referenced by acm_intr_complete().

◆ CDC_NETWORK_CONNECTION

#define CDC_NETWORK_CONNECTION
Value:
USB_REQUEST_TYPE ( 0x00 ) )

Network connection notification.

Definition at line 50 of file cdc.h.

50#define CDC_NETWORK_CONNECTION \
51 ( USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE | \
52 USB_REQUEST_TYPE ( 0x00 ) )

Referenced by ecm_intr_complete(), and ncm_intr_complete().

◆ CDC_CONNECTION_SPEED_CHANGE

#define CDC_CONNECTION_SPEED_CHANGE
Value:
USB_REQUEST_TYPE ( 0x2a ) )

Connection speed change notification.

Definition at line 55 of file cdc.h.

55#define CDC_CONNECTION_SPEED_CHANGE \
56 ( USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE | \
57 USB_REQUEST_TYPE ( 0x2a ) )

Referenced by ecm_intr_complete(), and ncm_intr_complete().

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ cdc_union_descriptor()

struct cdc_union_descriptor * cdc_union_descriptor ( struct usb_configuration_descriptor * config,
struct usb_interface_descriptor * interface )
extern

Locate CDC union functional descriptor.

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

Definition at line 45 of file cdc.c.

46 {
48
50 if ( ( desc->header.type == USB_CS_INTERFACE_DESCRIPTOR ) &&
51 ( desc->subtype == CDC_SUBTYPE_UNION ) )
52 return desc;
53 }
54 return NULL;
55}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
#define CDC_SUBTYPE_UNION
Union functional descriptor subtype.
Definition cdc.h:39
struct ena_llq_option desc
Descriptor counts.
Definition ena.h:9
#define for_each_interface_descriptor(desc, config, interface)
Iterate over all configuration descriptors within an interface descriptor.
Definition usb.h:394
#define USB_CS_INTERFACE_DESCRIPTOR
A class-specific interface descriptor.
Definition usb.h:346
Union functional descriptor.
Definition cdc.h:29
An object interface.
Definition interface.h:125

References CDC_SUBTYPE_UNION, desc, for_each_interface_descriptor, NULL, and USB_CS_INTERFACE_DESCRIPTOR.

◆ cdc_send_encapsulated_command()

int cdc_send_encapsulated_command ( struct usb_device * usb,
unsigned int interface,
void * data,
size_t len )
inlinestatic

Send encapsulated command.

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

Definition at line 81 of file cdc.h.

82 {
83
85 data, len );
86}
#define CDC_SEND_ENCAPSULATED_COMMAND
Send encapsulated command.
Definition cdc.h:19
ring len
Length.
Definition dwmac.h:226
uint8_t data[48]
Additional event data.
Definition ena.h:11
int usb_control(struct usb_device *usb, unsigned int request, unsigned int value, unsigned int index, void *data, size_t len)
Issue USB control transaction.
Definition usb.c:784

References CDC_SEND_ENCAPSULATED_COMMAND, data, len, and usb_control().

Referenced by acm_control_transmit().

◆ cdc_get_encapsulated_response()

int cdc_get_encapsulated_response ( struct usb_device * usb,
unsigned int interface,
void * data,
size_t len )
inlinestatic

Get encapsulated response.

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

Definition at line 98 of file cdc.h.

99 {
100
102 data, len );
103}
#define CDC_GET_ENCAPSULATED_RESPONSE
Get encapsulated response.
Definition cdc.h:24

References CDC_GET_ENCAPSULATED_RESPONSE, data, len, and usb_control().

Referenced by acm_control_receive().