目录

BASE DDK

Overview

Provides APIs for creating, mapping, unmapping, and destroying an Ashmem object.

System capability: SystemCapability.Driver.DDK.Extension

Since

12

Summary

[h2]File

Name Description
ddk_api.h

Declares the HID DDK functions for accessing an input device from the host.

File to include: <base/ddk_api.h>

Library: libddk_base.z.so

ddk_types.h

Defines the enum variables and structs used in the HID DDK.

File to include: <base/ddk_types.h>

Library: libddk_base.z.so

[h2]Structs

Name Description
DDK_Ashmem Shared memory.

[h2]Enums

Name Description
DDK_RetCode BASE DDK error code definitions.

[h2]Functions

Name Description
OH_DDK_CreateAshmem (const uint8_t *name, DDK_Ashmem **ashmem) Creates an Ashmem object.
OH_DDK_MapAshmem (DDK_Ashmem *ashmem, const uint8_t ashmemMapType) Maps an Ashmem object.
OH_DDK_UnmapAshmem (DDK_Ashmem *ashmem) Unmaps an Ashmem object.
OH_DDK_DestoryAshmem (DDK_Ashmem *ashmem) Destroys an Ashmem object.

Enum Description

[h2]DDK_RetCode

enum DDK_RetCode

Description

BASE DDK error code definitions.

Value Description
DDK_SUCCESS The operation is successful.
DDK_FAILED Operation failed.
DDK_INVALID_PARAMETER Invalid parameter.
DDK_INVALID_OPERATION Invalid operation.
DDK_NULL_PTR Null pointer.

Function Description

[h2]OH_DDK_CreateAshmem()

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

Description

Creates an Ashmem object.

Parameters

Name Description
name Name of the Ashmem object.
size Buffer size of the Ashmem object.
ashmem Pointer to the Ashmem object.

Returns

[h2]OH_DDK_MapAshmem()

DDK_RetCode OH_DDK_MapAshmem(DDK_Ashmem *ashmem, const uint8_t ashmemMapType);

Description

Maps an Ashmem object.

Parameters

Name Description
ashmem Pointer to the Ashmem object.
ashmemMapType Mapping type for the Ashmem object.

Returns

[h2]OH_DDK_UnmapAshmem()

DDK_RetCode OH_DDK_UnmapAshmem(DDK_Ashmem *ashmem);

Description

Unmaps an Ashmem object.

Parameters

Name Description
ashmem Pointer to the Ashmem object.

Returns

[h2]OH_DDK_DestoryAshmem()

DDK_RetCode OH_DDK_DestroyAshmem(DDK_Ashmem *ashmem);

Description

Destroys the created shared memory.

Parameters

Name Description
ashmem Pointer to the Ashmem object.

Returns