USBD_CDC_Add

Description

Creates a CDC instance.

Files

usbd_cdc.h/usbd_cdc.c

Prototype

CPU_INT08U  USBD_CDC_Add(CPU_INT08U              subclass,
                         USBD_CDC_SUBCLASS_DRV  *p_subclass_drv,
                         void                   *p_subclass_arg,
                         CPU_INT08U              protocol,
                         CPU_BOOLEAN             notify_en,
                         CPU_INT16U              notify_interval,
                         USBD_ERR               *p_err);


Arguments

subclass

CDC subclass code.

Subclass codeDescription
USBD_CDC_SUBCLASS_DLCM
Direct Line Control Model
USBD_CDC_SUBCLASS_ACM
Abstract Control Model
USBD_CDC_SUBCLASS_TCM
Telephone Control Model
USBD_CDC_SUBCLASS_MCC
Multi-Channel Control Model
USBD_CDC_SUBCLASS_CAPICM
CAPI Control Model
USBD_CDC_SUBCLASS_WHCM
Wireless Handset Control Model
USBD_CDC_SUBCLASS_DEV_MGMT
Device Management
USBD_CDC_SUBCLASS_MDLM
Mobile Direct Line Model
USBD_CDC_SUBCLASS_OBEX
Obex
USBD_CDC_SUBCLASS_EEM
Ethernet Emulation Model
USBD_CDC_SUBCLASS_NCM
Network Control Model
USBD_CDC_SUBCLASS_VENDOR
Vendor specific

CDC subclass codes are defined in the Universal Serial Bus Class Definitions for Communication Devices Revision 2.1 Table 4.

p_subclass_drv

Pointer to CDC subclass driver.

p_subclass_arg

Pointer to CDC subclass driver argument.

protocol

CDC protocol code:

Protocol codeDescription
USBD_CDC_COMM_PROTOCOL_NONE
None
USBD_CDC_COMM_PROTOCOL_AT_V250
AT commands V250
USBD_CDC_COMM_PROTOCOL_AT_PCCA_101
AT commands defined by PCCA 101
USBD_CDC_COMM_PROTOCOL_AT_PCCA_101_ANNEX
AT commands defined by PCCA 101 & annex O
USBD_CDC_COMM_PROTOCOL_AT_GSM_7_07
AT commands defined by GSM 7.07
USBD_CDC_COMM_PROTOCOL_AT_3GPP_27_07
AT commands defined by 3GPP 27.007
USBD_CDC_COMM_PROTOCOL_AT_TIA_CDMA
AT commands defined by TIA for CDMA
USBD_CDC_COMM_PROTOCOL_EEM
Ethernet Emulation Model
USBD_CDC_COMM_PROTOCOL_EXT
External protocol
USBD_CDC_COMM_PROTOCOL_VENDOR
Vendor specific

CDC protocol codes are defined in the Universal Serial Bus Class Definitions for Communication Devices Revision 2.1 Table 5.

notify_en

Notification enabled.

DEF_ENABLED, CDC notifications are enabled.

DEF_DISABLED, CDC notifications are disabled.

notify_interval

Notification interval in milliseconds. It must be a power of 2.

p_err

Pointer to variable that will receive the return error code from this function.

USBD_ERR_NONE
USBD_ERR_ALLOC

Returned Value

CDC class interface number, if CDC class successfully created.

USBD_CDC_NBR_NONE, otherwise.

Callers

CDC Subclass drivers.

Notes / Warnings

  1. The CDC defines a communication class interface consisting of a management element and optionally a notification element. The notification element transports event to the host. The enable_en enable notifications in the CDC. The notification are sent to the host using an interrupt endpoint, the interval of the interrupt endpoint is specified by the notify_interval parameter.