openharmony 鸿蒙 capi-ddk-api-h

2026-08-25 浏览 (1)

ddk_api.h

Overview

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

File to include: <ddk/ddk_api.h>

Library: libddk_base.z.so

System capability: SystemCapability.Driver.DDK.Extension

Since: 12

Related module: Ddk

Summary

Function

NameDescription
DDK_RetCode OH_DDK_CreateAshmem(const uint8_t *name, uint32_t size, DDK_Ashmem **ashmem)Creates an Ashmem object. To prevent resource leakage, call OH_DDK_DestroyAshmem to destroy the Ashmem object when it is no longer needed.
DDK_RetCode OH_DDK_MapAshmem(DDK_Ashmem *ashmem, const uint8_t ashmemMapType)Maps the created Ashmem object to the user space. Call OH_DDK_UnmapAshmem to unmap the Ashmem object when it is no longer needed.
DDK_RetCode OH_DDK_UnmapAshmem(DDK_Ashmem *ashmem)Unmaps an Ashmem object.
DDK_RetCode OH_DDK_DestroyAshmem(DDK_Ashmem *ashmem)Destroys an Ashmem object.

Function Description

OH_DDK_CreateAshmem()

DDK_RetCode OH_DDK_CreateAshmem(const uint8_t *name, uint32_t size, DDK_Ashmem **ashmem)

Description

Creates an Ashmem object. To prevent resource leakage, call OH_DDK_DestroyAshmem to destroy the Ashmem object when it is no longer needed.

Since: 12

Parameters

NameDescription
const uint8_t *namePointer to the name of the Ashmem object.
uint32_t sizeBuffer size of the Ashmem object.
DDK_Ashmem **ashmemPointer to the Ashmem object.

Returns

TypeDescription
DDK_RetCodeDDK_SUCCESS: The API call is successful.
DDK_INVALID_PARAMETER: The input name is a null pointer, the value of size is 0, or the input ashmem is a null pointer.
DDK_FAILURE: The attempt to create an Ashmem object or the DDK_Ashmem structure fails.

OH_DDK_MapAshmem()

DDK_RetCode OH_DDK_MapAshmem(DDK_Ashmem *ashmem, const uint8_t ashmemMapType)

Description

Maps the created Ashmem object to the user space. Call OH_DDK_UnmapAshmem to unmap the Ashmem object when it is no longer needed.

Since: 12

Parameters

NameDescription
DDK_Ashmem *ashmemPointer to the Ashmem object.
const uint8_t ashmemMapTypeMapping type for the Ashmem object.

Returns

TypeDescription
DDK_RetCodeDDK_SUCCESS: The API call is successful.
DDK_NULL_PTR: The input ashmem is a null pointer.
DDK_FAILURE: The file descriptor of the Ashmem object is invalid.
DDK_INVALID_OPERATION: The attempt to call MapAshmem fails.

OH_DDK_UnmapAshmem()

DDK_RetCode OH_DDK_UnmapAshmem(DDK_Ashmem *ashmem)

Description

Unmaps an Ashmem object.

Since: 12

Parameters

NameDescription
DDK_Ashmem *ashmemPointer to the Ashmem object.

Returns

TypeDescription
DDK_RetCodeDDK_SUCCESS: The API call is successful.
DDK_NULL_PTR: The input ashmem is a null pointer.
DDK_FAILURE: The file descriptor of the Ashmem object is invalid.

OH_DDK_DestroyAshmem()

DDK_RetCode OH_DDK_DestroyAshmem(DDK_Ashmem *ashmem)

Description

Destroys an Ashmem object.

Since: 12

Parameters

NameDescription
DDK_Ashmem *ashmemPointer to the Ashmem object.

Returns

TypeDescription
DDK_RetCodeDDK_SUCCESS: The API call is successful.
DDK_NULL_PTR: The input ashmem is a null pointer.
DDK_FAILURE: The file descriptor of the Ashmem object is invalid.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-scsiperipheralddk-scsiperipheral-request

openharmony 鸿蒙 capi-usbddk-usbconfigdescriptor

openharmony 鸿蒙 capi-hidddk

openharmony 鸿蒙 capi-usbddk

openharmony 鸿蒙 capi-hidddk-hid-absaxesarray

openharmony 鸿蒙 capi-scsiperipheralddk-scsiperipheral-response

openharmony 鸿蒙 capi-scsi-peripheral-api-h

openharmony 鸿蒙 capi-hidddk-hid-relaxesarray

openharmony 鸿蒙 js-apis-driver-deviceManager

openharmony 鸿蒙 capi-hidddk-hid-eventtypearray

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