# Core ## **Overview** Provides OpenHarmony Driver Foundation \(HDF\) APIs. The HDF implements driver framework capabilities such as driver loading, service management, and driver message model. You can develop drivers based on the HDF. **Since:** 1.0 ## **Summary** ## Files
Declares functions related to driver loading, service obtaining, and power management. |
|
Declares the structures defining driver service objects and event listeners, as well as the functions for obtaining a driver service object, dispatching a driver service call, and registering or unregistering an event listener. |
|
Declares the base object provided by the HDF for the driver. |
|
Defines functions related to a HdfSBuf. The HDF provides data serialization and deserialization capabilities for data transmission between user-mode applications and kernel-mode drivers. |
Defines the power management functions provided by the HDF for the driver. |
|
Defines a HdfSBuf. |
HDF_INIT(module) HDF_DRIVER_INIT(module) |
OnEventReceived) (void *priv, uint32_t id, struct HdfSBuf *data) |
ServicePolicy { SERVICE_POLICY_NONE = 0, SERVICE_POLICY_PUBLIC, SERVICE_POLICY_CAPACITY, SERVICE_POLICY_FRIENDLY, SERVICE_POLICY_PRIVATE, SERVICE_POLICY_INVALID } |
Enumerates policies for releasing driver services developed based on the HDF. |
DevicePreload { DEVICE_PRELOAD_ENABLE = 0, DEVICE_PRELOAD_DISABLE, DEVICE_PRELOAD_INVALID } |
DevSvcManagerClntGetService (const char *svcName) |
const struct HdfObject * Obtains the driver service object based on a driver service name. |
HdfDeviceGetServiceName (const struct HdfDeviceObject *deviceObject) |
|
HdfDeviceSubscribeService (struct HdfDeviceObject *deviceObject, const char *serviceName, struct SubscriberCallback callback) |
|
HdfDeviceSendEvent (const struct HdfDeviceObject *deviceObject, uint32_t id, const struct HdfSBuf *data) |
|
HdfDeviceSendEventToClient (const struct HdfDeviceIoClient *client, uint32_t id, const struct HdfSBuf *data) |
|
HdfIoServiceBind (const char *serviceName, mode_t permission) |
struct HdfIoService * |
HdfIoServiceRecycle (struct HdfIoService *service) |
Destroys a specified driver service object to release resources if it is no longer required. |
HdfDeviceRegisterEventListener (struct HdfIoService *target, struct HdfDevEventlistener *listener) |
Registers a custom HdfDevEventlistener for listening for events reported by a specified driver service object. |
HdfDeviceUnregisterEventListener (struct HdfIoService *target, struct HdfDevEventlistener *listener) |
Unregisters a previously registered HdfDevEventlistener to release resources if it is no longer required. |
HdfSbufWriteBuffer (struct HdfSBuf *sbuf, const void *data, uint32_t writeSize) |
|
HdfSbufWriteUint64 (struct HdfSBuf *sbuf, uint64_t value) |
|
HdfSbufWriteUint32 (struct HdfSBuf *sbuf, uint32_t value) |
|
HdfSbufWriteUint16 (struct HdfSBuf *sbuf, uint16_t value) |
|
HdfSbufWriteUint8 (struct HdfSBuf *sbuf, uint8_t value) |
|
HdfSbufWriteInt64 (struct HdfSBuf *sbuf, int64_t value) |
|
HdfSbufWriteInt32 (struct HdfSBuf *sbuf, int32_t value) |
|
HdfSbufWriteInt16 (struct HdfSBuf *sbuf, int16_t value) |
|
HdfSbufWriteInt8 (struct HdfSBuf *sbuf, int8_t value) |
|
HdfSbufWriteString (struct HdfSBuf *sbuf, const char *value) |
|
HdfSbufReadBuffer (struct HdfSBuf *sbuf, const void **data, uint32_t *readSize) |
|
HdfSbufReadUint64 (struct HdfSBuf *sbuf, uint64_t *value) |
|
HdfSbufReadUint32 (struct HdfSBuf *sbuf, uint32_t *value) |
|
HdfSbufReadUint16 (struct HdfSBuf *sbuf, uint16_t *value) |
|
HdfSbufReadUint8 (struct HdfSBuf *sbuf, uint8_t *value) |
|
HdfSbufReadInt64 (struct HdfSBuf *sbuf, int64_t *value) |
|
HdfSbufReadInt32 (struct HdfSBuf *sbuf, int32_t *value) |
|
HdfSbufReadInt16 (struct HdfSBuf *sbuf, int16_t *value) |
|
HdfSbufReadInt8 (struct HdfSBuf *sbuf, int8_t *value) |
|
HdfSbufReadString (struct HdfSBuf *sbuf) |
|
HdfSbufGetData (const struct HdfSBuf *sbuf) |
|
HdfSbufFlush (struct HdfSBuf *sbuf) |
|
HdfSbufGetCapacity (const struct HdfSBuf *sbuf) |
|
HdfSbufGetDataSize (const struct HdfSBuf *sbuf) |
|
HdfSBufObtain (size_t capacity) |
struct HdfSBuf * |
HdfSBufObtainDefaultSize (void) |
struct HdfSBuf * Obtains a SBuf instance of the default capacity (256 bytes). |
HdfSBufBind (uintptr_t base, size_t size) |
struct HdfSBuf * Creates a SBuf instance with the specified data and size. The pointer to the data stored in the SBuf is released by the caller, and the written data size should not exceed the specified value of size. |
HdfSBufRecycle (struct HdfSBuf *sbuf) |
|
HdfSBufMove (struct HdfSBuf *sbuf) |
struct HdfSBuf * Creates a SBuf instance with an original SBuf. This function moves the data stored in the original SBuf to the new one without memory copy. |
HdfSBufCopy (const struct HdfSBuf *sbuf) |
struct HdfSBuf * Creates a SBuf instance with an original SBuf. This function copies the data stored in the original SBuf to the new one. |
HdfSbufTransDataOwnership (struct HdfSBuf *sbuf) |
Transfers the data ownership to a SBuf. Once the SBuf is released, the bound data memory is also released. This function is used together with HdfSBufBind. |
module | Indicates the global variable of the HdfDriverEntry type |
priv | Indicates the pointer to the private data bound to this listener. |
id | Indicates the serial number of the driver event occurred. |
data | Indicates the pointer to the content data of the driver event. |
DEVICE_PRELOAD_ENABLE | |
DEVICE_PRELOAD_DISABLE | |
DEVICE_PRELOAD_INVALID |
serviceName | Indicates the pointer to the released driver service name. |
deviceObject | Indicates the pointer to the driver device object. |
target | Indicates the pointer to the driver service object to listen, which is obtained through the HdfIoServiceBind function. |
listener | Indicates the pointer to the listener to register. |
deviceObject | Indicates the pointer to the driver device object. |
id | Indicates the ID of the message sending event. |
data | Indicates the pointer to the message content sent by the driver. |
client | Indicates the pointer to the client object of the driver service. |
id | Indicates the ID of the message sending event. |
data | Indicates the pointer to the message content sent by the driver. |
deviceObject | Indicates the pointer to the driver device object of the subscriber. |
serviceName | Indicates the pointer to the driver service name. |
callback | Indicates the callback invoked by the HDF after the subscribed-to driver service is loaded. |
target | Indicates the pointer to the driver service object that has been listened. |
listener | Indicates the listener object registered by HdfDeviceRegisterEventListener. |
service | Indicates the pointer to the driver service object to destroy. |
base | Indicates the base of the data to use. |
size | Indicates the size of the data to use. |
sbuf | Indicates the pointer to the original SBuf. |
sbuf | Indicates the pointer to the target SBuf. |
sbuf | Indicates the pointer to the target SBuf. |
sbuf | Indicates the pointer to the target SBuf. |
sbuf | Indicates the pointer to the target SBuf. |
sbuf | Indicates the pointer to the original SBuf. |
capacity | Indicates the initial capacity of theSBuf. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the pointer to the 16-bit signed integer read, which is requested by the caller. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the pointer to the 32-bit signed integer read, which is requested by the caller. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the pointer to the 64-bit signed integer read, which is requested by the caller. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the pointer to the 8-bit signed integer read, which is requested by the caller. |
sbuf | Indicates the pointer to the target SBuf. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the pointer to the 16-bit unsigned integer read, which is requested by the caller. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the pointer to the 32-bit unsigned integer read, which is requested by the caller. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the pointer to the 64-bit unsigned integer read, which is requested by the caller. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the pointer to the 8-bit unsigned integer read, which is requested by the caller. |
sbuf | Indicates the pointer to the SBuf to release. |
sbuf | Indicates the pointer to the target SBuf. |
sbuf | Indicates the pointer to the target SBuf. |
data | Indicates the pointer to the data segment to write. |
writeSize | Indicates the size of the data segment to write. The maximum value is 512 KB. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the 16-bit signed integer to write. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the 32-bit signed integer to write. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the 64-bit signed integer to write. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the 8-bit signed integer to write. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the pointer to the string to write. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the 16-bit unsigned integer to write. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the 32-bit unsigned integer to write. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the 64-bit unsigned integer to write. |
sbuf | Indicates the pointer to the target SBuf. |
value | Indicates the 8-bit unsigned integer to write. |