iPXE
Data Structures | Macros | 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...
 

Macros

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

Functions

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

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.

◆ CDC_SEND_ENCAPSULATED_COMMAND

#define CDC_SEND_ENCAPSULATED_COMMAND
Value:
USB_REQUEST_TYPE ( 0x00 ) )
#define USB_RECIP_INTERFACE
Request recipient is an interface.
Definition: usb.h:116
#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

Send encapsulated command.

Definition at line 19 of file cdc.h.

◆ CDC_GET_ENCAPSULATED_RESPONSE

#define CDC_GET_ENCAPSULATED_RESPONSE
Value:
USB_REQUEST_TYPE ( 0x01 ) )
#define USB_RECIP_INTERFACE
Request recipient is an interface.
Definition: usb.h:116
#define USB_TYPE_CLASS
Class-specific request type.
Definition: usb.h:104
#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.

◆ CDC_SUBTYPE_UNION

#define CDC_SUBTYPE_UNION   6

Union functional descriptor subtype.

Definition at line 39 of file cdc.h.

◆ CDC_SUBTYPE_ETHERNET

#define CDC_SUBTYPE_ETHERNET   15

Ethernet descriptor subtype.

Definition at line 42 of file cdc.h.

◆ CDC_RESPONSE_AVAILABLE

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

Response available.

Definition at line 45 of file cdc.h.

◆ CDC_NETWORK_CONNECTION

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

Network connection notification.

Definition at line 50 of file cdc.h.

◆ CDC_CONNECTION_SPEED_CHANGE

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

Connection speed change notification.

Definition at line 55 of file cdc.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED  )

◆ cdc_union_descriptor()

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  {
47  struct cdc_union_descriptor *desc;
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 CDC_SUBTYPE_UNION
Union functional descriptor subtype.
Definition: cdc.h:39
#define for_each_interface_descriptor(desc, config, interface)
Iterate over all configuration descriptors within an interface descriptor.
Definition: usb.h:394
struct ena_llq_option desc
Descriptor counts.
Definition: ena.h:20
An object interface.
Definition: interface.h:125
Union functional descriptor.
Definition: cdc.h:29
#define USB_CS_INTERFACE_DESCRIPTOR
A class-specific interface descriptor.
Definition: usb.h:346
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

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

◆ cdc_send_encapsulated_command()

static 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 }
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
An object interface.
Definition: interface.h:125
ring len
Length.
Definition: dwmac.h:231
#define CDC_SEND_ENCAPSULATED_COMMAND
Send encapsulated command.
Definition: cdc.h:19
uint8_t data[48]
Additional event data.
Definition: ena.h:22

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

Referenced by acm_control_transmit().

◆ cdc_get_encapsulated_response()

static 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 }
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
An object interface.
Definition: interface.h:125
ring len
Length.
Definition: dwmac.h:231
uint8_t data[48]
Additional event data.
Definition: ena.h:22
#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().