usb_ddk_api.h

Overview

Declares the USB DDK APIs used by the USB host to access USB devices.

Since

10

Related Modules

UsbDdk

Summary

Functions

Name Description
OH_Usb_Init (void) Initializes the DDK.
OH_Usb_Release (void) Releases the DDK.
OH_Usb_GetDeviceDescriptor (uint64_t deviceId, struct UsbDeviceDescriptor *desc) Obtains the device descriptor.
OH_Usb_GetConfigDescriptor (uint64_t deviceId, uint8_t configIndex, struct UsbDdkConfigDescriptor **const config) Obtains the configuration descriptor. To avoid memory leakage, use OH_Usb_FreeConfigDescriptor() to release a descriptor after use.
OH_Usb_FreeConfigDescriptor (const struct UsbDdkConfigDescriptor *const config) Releases the configuration descriptor. To avoid memory leakage, release a descriptor after use.
OH_Usb_ClaimInterface (uint64_t deviceId, uint8_t interfaceIndex, uint64_t *interfaceHandle) Declares a USB interface.
OH_Usb_ReleaseInterface (uint64_t interfaceHandle) Releases a USB interface.
OH_Usb_SelectInterfaceSetting (uint64_t interfaceHandle, uint8_t settingIndex) Activates the alternate setting of a USB interface.
OH_Usb_GetCurrentInterfaceSetting (uint64_t interfaceHandle, uint8_t *settingIndex) Obtains the activated alternate setting of a USB interface.
OH_Usb_SendControlReadRequest (uint64_t interfaceHandle, const struct UsbControlRequestSetup *setup, uint32_t timeout, uint8_t *data, uint32_t *dataLen) Sends a control read transfer request. This API works in a synchronous manner.
OH_Usb_SendControlWriteRequest (uint64_t interfaceHandle, const struct UsbControlRequestSetup *setup, uint32_t timeout, const uint8_t *data, uint32_t dataLen) Sends a control write transfer request. This API works in a synchronous manner.
OH_Usb_SendPipeRequest (const struct UsbRequestPipe *pipe, UsbDeviceMemMap *devMmap) Sends a pipe request. This API works in a synchronous manner. It applies to interrupt transfer and bulk transfer.
OH_Usb_CreateDeviceMemMap (uint64_t deviceId, size_t size, UsbDeviceMemMap **devMmap) Creates a buffer. To avoid memory leakage, use OH_Usb_DestroyDeviceMemMap() to destroy a buffer after use.
OH_Usb_DestroyDeviceMemMap (UsbDeviceMemMap *devMmap) Destroys a buffer. To avoid resource leakage, destroy a buffer in time after use.