harmony 鸿蒙usb_ddk_types.h

2025-06-12 浏览 (1)

usb_ddk_types.h

Overview

Provides the enumerated variables, structures, and macros used in USB DDK APIs.

Since

10

Related Modules

USB DDK

Summary

Structs

NameDescription
UsbControlRequestSetupSetup data for control transfer, corresponding to Setup Data in the USB protocol.
UsbDeviceDescriptorStandard device descriptor, corresponding to Standard Device Descriptor in the USB protocol.
UsbConfigDescriptorStandard configuration descriptor, corresponding to Standard Configuration Descriptor in the USB protocol.
UsbInterfaceDescriptorStandard interface descriptor, corresponding to Standard Interface Descriptor in the USB protocol.
UsbEndpointDescriptorStandard endpoint descriptor, corresponding to Standard Endpoint Descriptor in the USB protocol.
UsbDdkEndpointDescriptorEndpoint descriptor.
UsbDdkInterfaceDescriptorInterface descriptor.
UsbDdkInterfaceUSB DDK interface, which is a collection of alternate settings for a particular USB interface.
UsbDdkConfigDescriptorConfiguration descriptor.
UsbRequestPipeRequest pipe.
UsbDeviceMemMapDevice memory map created by calling OH_Usb_CreateDeviceMemMap(). A buffer using the device memory map can provide better performance.
Usb_DeviceArrayDefines the device ID list, which is used to store the device IDs and device quantity obtained using OH_Usb_GetDevices().

Types

NameDescription
typedef struct UsbDdkEndpointDescriptor UsbDdkEndpointDescriptorEndpoint descriptor.
typedef struct UsbDdkInterfaceDescriptor UsbDdkInterfaceDescriptorInterface descriptor.
typedef struct UsbDdkInterface UsbDdkInterfaceUSB interface.
typedef struct UsbDdkConfigDescriptor UsbDdkConfigDescriptorConfiguration descriptor.
typedef struct UsbDeviceMemMap UsbDeviceMemMapDevice memory map created by calling OH_Usb_CreateDeviceMemMap(). A buffer using the device memory map can provide better performance.
typedef struct Usb_DeviceArray Usb_DeviceArrayDefines the device ID list, which is used to store the device IDs and device quantity obtained using OH_Usb_GetDevices().

Enums

NameDescription
UsbDdkErrCode {
USB_DDK_SUCCESS = 0, USB_DDK_FAILED = -1, USB_DDK_INVALID_PARAMETER = -2, USB_DDK_MEMORY_ERROR = -3,
USB_DDK_INVALID_OPERATION = -4, USB_DDK_NULL_PTR = -5, USB_DDK_DEVICE_BUSY = -6, USB_DDK_TIMEOUT = -7
}
USB DDK error code definition.

Variables

NameDescription
bmRequestTypeRequest type.
bRequestSpecific request.
wValueValue corresponding to wValue in the USB protocol. Its meaning varies according to the request.
wIndexIndex corresponding to wIndex in the USB protocol. It is usually used to transfer the index or offset. Its meaning varies according to the request.
wLengthData length corresponding to wLength in the USB protocol. If data is transferred, this field indicates the number of transferred bytes.
bLengthSize of the descriptor, in bytes.
bDescriptorTypeDescriptor type.
bcdUSBUSB protocol release number.
bDeviceClassInterface class code allocated by the USB-IF.
bDeviceSubClassDevice subclass code allocated by USB-IF. The value is limited by that of bDeviceClass.
bDeviceProtocolProtocol code allocated by USB-IF. The value is limited by that of bDeviceClass and bDeviceSubClass.
bMaxPacketSize0Maximum packet size of endpoint 0. Only values 8, 16, 32, and 64 are valid.
idVendorVendor ID allocated by USB-IF.
idProductProduct ID allocated by the vendor.
bcdDeviceDevice release number.
iManufacturerIndex of the string descriptor that describes the vendor.
iProductIndex of the string descriptor that describes the product.
iSerialNumberIndex of the string descriptor that describes the device SN.
bNumConfigurationsConfiguration quantity.
wTotalLengthTotal length of the configuration descriptor, including the configuration, interface, endpoint, and class- or vendor-specific descriptors.
bNumInterfacesNumber of interfaces supported by the configuration.
bConfigurationValueConfiguration index, which is used to select the configuration.
iConfigurationIndex of the string descriptor that describes the configuration.
bmAttributesConfiguration attributes, including the power mode and remote wakeup.
bMaxPowerMaximum power consumption of the bus-powered USB device, in 2 mA.
bInterfaceNumberInterface ID.
bAlternateSettingValue used to select the alternate setting of the interface.
bNumEndpointsNumber of endpoints (excluding endpoint 0) used by the interface.
bInterfaceClassInterface class code allocated by the USB-IF.
bInterfaceSubClassDevice subclass code allocated by USB-IF. The value is limited by that of bInterfaceClass.
bInterfaceProtocolProtocol code allocated by USB-IF. The value is limited by that of bInterfaceClass and bInterfaceSubClass.
iInterfaceIndex of the string descriptor that describes the interface.
bEndpointAddressEndpoint address, including the endpoint number and endpoint direction.
bmAttributesEndpoint attributes, including the transfer type, synchronization type, and usage type.
wMaxPacketSizeMaximum packet size supported by an endpoint.
bIntervalInterval for polling endpoints for data transfer.
bRefreshRefresh rate for audio devices.
bSynchAddressEndpoint synchronization address for audio devices.
interfaceHandleInterface operation handle.
endpointEndpoint address.
timeoutTimeout duration, in milliseconds.
deviceIdsStart address of the device ID array.
numDevice quantity.

Variable Description

bAlternateSetting

uint8_t bAlternateSetting

Description

Value used to select the alternate setting of the interface.

bcdDevice

uint16_t bcdDevice

Description

Device release number.

bcdUSB

uint16_t bcdUSB

Description

USB protocol release number.

bConfigurationValue

uint8_t bConfigurationValue

Description

Configuration index, which is used to select the configuration.

bDescriptorType

uint8_t bDescriptorType

Description

Descriptor type.

bDeviceClass

uint8_t bDeviceClass

Description

Interface class code allocated by the USB-IF.

bDeviceProtocol

uint8_t bDeviceProtocol

Description

Protocol code allocated by USB-IF. The value is limited by that of bDeviceClass and bDeviceSubClass.

bDeviceSubClass

uint8_t bDeviceSubClass

Description

Device subclass code allocated by USB-IF. The value is limited by that of bDeviceClass.

bEndpointAddress

uint8_t bEndpointAddress

Description

Endpoint address, including the endpoint number and endpoint direction.

bmAttributes

uint8_t bmAttributes

Description

Endpoint attributes, including the transfer type, synchronization type, and usage type.

bInterfaceClass

uint8_t bInterfaceClass

Description

Interface class code allocated by the USB-IF.

bInterfaceNumber

uint8_t bInterfaceNumber

Description

Interface ID.

bInterfaceProtocol

uint8_t bInterfaceProtocol

Description

Protocol code allocated by USB-IF. The value is limited by that of bInterfaceClass and bInterfaceSubClass.

bInterfaceSubClass

uint8_t bInterfaceSubClass

Description

Device subclass code allocated by USB-IF. The value is limited by that of bInterfaceClass.

bInterval

uint8_t bInterval

Description

Interval for polling endpoints for data transfer.

bLength

uint8_t bLength

Description

Size of the descriptor, in bytes.

bmAttributes

uint8_t bmAttributes

Description

Configuration attributes, including the power mode and remote wakeup.

bMaxPacketSize0

uint8_t bMaxPacketSize0

Description

Maximum packet size of endpoint 0. Only values 8, 16, 32, and 64 are valid.

bMaxPower

uint8_t bMaxPower

Description

Maximum power consumption of the bus-powered USB device, in 2 mA.

bNumConfigurations

uint8_t bNumConfigurations

Description

Configuration quantity.

bNumEndpoints

uint8_t bNumEndpoints

Description

Number of endpoints (excluding endpoint 0) used by the interface.

bNumInterfaces

uint8_t bNumInterfaces

Description

Number of interfaces supported by the configuration.

bRefresh

uint8_t bRefresh

Description

Refresh rate for audio devices.

bSynchAddress

uint8_t bSynchAddress

Description

Endpoint synchronization address for audio devices.

endpoint

uint8_t endpoint

Description

Endpoint address.

iConfiguration

uint8_t iConfiguration

Description

Index of the string descriptor that describes the configuration.

idProduct

uint16_t idProduct

Description

Product ID allocated by the vendor.

idVendor

uint16_t idVendor

Description

Vendor ID allocated by USB-IF.

iInterface

uint8_t iInterface

Description

Index of the string descriptor that describes the interface.

iManufacturer

uint8_t iManufacturer

Description

Index of the string descriptor that describes the vendor.

wIndex

uint16_t wIndex

Description

Index corresponding to wIndex in the USB protocol. It is usually used to transfer the index or offset. Its meaning varies according to the request.

interfaceHandle

uint64_t interfaceHandle

Description

Interface operation handle.

iProduct

uint8_t iProduct

Description

Index of the string descriptor that describes the product.

iSerialNumber

uint8_t iSerialNumber

Description

Index of the string descriptor that describes the device SN.

wLength

uint16_t wLength

Description

Data length corresponding to wLength in the USB protocol. If data is transferred, this field indicates the number of transferred bytes.

bRequest

uint8_t bRequest

Description

Specific request.

bmRequestType

uint8_t bmRequestType

Description

Request type.

timeout

uint32_t timeout

Description

Timeout duration, in milliseconds.

wValue

uint16_t wValue

Description

Value corresponding to wValue in the USB protocol. Its meaning varies according to the request.

wMaxPacketSize

uint16_t wMaxPacketSize

Description

Maximum packet size supported by an endpoint.

wTotalLength

uint16_t wTotalLength

Description

Total length of the configuration descriptor, including the configuration, interface, endpoint, and class- or vendor-specific descriptors.

deviceIds

uint64_t* deviceIds

Description

Defines the start address of the device ID array. The number of device IDs cannot exceed 128.

num

uint32_t num

Description

Defines the device quantity. Device IDs are obtained by traversing deviceIds based on the value of this parameter. If the value is 0, there is no USB device.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Driver Development Kit

harmony 鸿蒙Base DDK

harmony 鸿蒙DDK_Ashmem

harmony 鸿蒙Hid_AbsAxesArray

harmony 鸿蒙Hid_Device

harmony 鸿蒙Hid_EmitItem

harmony 鸿蒙Hid_EventProperties

harmony 鸿蒙Hid_EventTypeArray

harmony 鸿蒙Hid_KeyCodeArray

harmony 鸿蒙Hid_MscEventArray

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/4dtW2M