# DriverUtils - [Overview](#section955198948165623) - [Summary](#section1440107053165623) - [Files](#files) - [Data Structures](#nested-classes) - [Macros](#define-members) - [Typedefs](#typedef-members) - [Enumerations](#enum-members) - [Functions](#func-members) - [Details](#section1185566655165623) - [Macro Definition](#section2134126864165623) - [CONTAINER\_OF](#ga818b9cca761fe7bc18e4e417da772976) - [DLIST\_FIRST\_ENTRY](#ga203de9c01fefc8bbbae746685794cfcc) - [DLIST\_FOR\_EACH\_ENTRY](#ga2b53b2bcf35b8cfb32e429cacbcc0a8d) - [DLIST\_FOR\_EACH\_ENTRY\_SAFE](#ga8e6f49c1fed85c031f29e8acce377ea0) - [DLIST\_LAST\_ENTRY](#ga25ac08cc864bd59050f7e2ca77df1f23) - [HDF\_LOGD](#gaa0411582f697619cdb045ae61ac42539) - [HDF\_LOGE](#gaacd0eb778948960a7f97af155287ce8c) - [HDF\_LOGI](#ga369d56841d17e6908fc6885fcb814b80) - [HDF\_LOGV](#ga4abebfca1aaeb8125f85800425caf304) - [HDF\_LOGW](#ga72f232dade88b85aff2d8c0e42b82df0) - [LOG\_TAG\_MARK\_EXTEND](#ga7e862bda9f0b95d1628f6f62598f1f42) - [Typedef](#section1521632851165623) - [HdfWorkFunc](#ga30665d61b03fae4a2ebc778c3d775ce5) - [Enumeration Type](#section758644115165623) - [anonymous enum](#gac205be2172292384dd687b5471a87edd) - [HDF\_STATUS](#ga7e01536ecbe9b17563dd3fe256202a67) - [Function](#section636459406165623) - [DListHeadInit\(\)](#ga0a86a18ad591f485663834799dd38dea) - [DListInsertHead\(\)](#ga60e796c868630dd403ef4fdcc60c12e8) - [DListInsertTail\(\)](#gaa1d386162f8f6401fe8ac6d70d237517) - [DListIsEmpty\(\)](#ga9b4053294ad63f0bdacb4841a14ba208) - [DListMerge\(\)](#gac4acad10a7c49cc4b2d773aedbfa1e11) - [DListRemove\(\)](#ga42d23fa1f55097bae91664c5e4a78e1e) - [HdfAddDelayedWork\(\)](#gaef781ccc1579db3070745088da47b2c5) - [HdfAddWork\(\)](#ga82cc68d656aa17317634b07d49dae160) - [HdfCancelDelayedWorkSync\(\)](#gad53e46938809200db3caafdc85decc5a) - [HdfCancelWorkSync\(\)](#gaab300487bdb9f3496bb823c657275dd3) - [HdfDelayedWorkDestroy\(\)](#gaaaced5c0365d1a1232167b738f08b5ce) - [HdfDelayedWorkInit\(\)](#ga55bf669dc6740c65e4d45a4f641db2f1) - [HdfWorkBusy\(\)](#ga37595ed36b8ce7be84c914aebfd99d00) - [HdfWorkDestroy\(\)](#gae6166caaf1b114e17834c50414b2d52e) - [HdfWorkInit\(\)](#gad171adc8eda320fd01049a2b87ea62fb) - [HdfWorkQueueDestroy\(\)](#ga04ec328639aefd71683175e4c214fb80) - [HdfWorkQueueInit\(\)](#gad7afae1dc691818c513094c873decabd) ## **Overview** **Description:** Defines common macros and interfaces of the driver module. This module provides interfaces such as log printing, doubly linked list operations, and work queues. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Files
Describes a work item and a delayed work item. This structure defines the work and delayed work items, and then calls the initialization function HdfWorkInit or HdfDelayedWorkInit to perform initialization. The HdfAddWork() function is to add a work item to a work queue immediately, and the HdfAddDelayedWork() function is to add a work item to a work queue after the configured delayed time. |
|
Indicates that the function keeps waiting to obtain a semaphore or mutex. |
|
Defines a time conversion unit, for example, the unit for converting from second to millisecond. |
|
CONTAINER_OF(ptr, type, member) (type *)((char *)(ptr) - (char *)&((type *)0)->member) |
Obtains the address of a structure variable from its member address. |
DLIST_FIRST_ENTRY(ptr, type, member) CONTAINER_OF((ptr)->next, type, member) |
|
DLIST_LAST_ENTRY(ptr, type, member) CONTAINER_OF((ptr)->prev, type, member) |
|
DLIST_FOR_EACH_ENTRY(pos, head, type, member) |
|
DLIST_FOR_EACH_ENTRY_SAFE(pos, tmp, head, type, member) |
Traverses all nodes in a doubly linked list. This function is used to delete the nodes pointed to by pos during traversal. |
LOG_TAG_MARK_EXTEND(HDF_TAG) #HDF_TAG |
|
HDF_LOGV(fmt, arg...) printf("[HDF:V/" LOG_TAG "]" fmt "\r\n", ##arg) |
|
HDF_LOGD(fmt, arg...) printf("[HDF:D/" LOG_TAG "]" fmt "\r\n", ##arg) |
|
HDF_LOGI(fmt, arg...) printf("[HDF:I/" LOG_TAG "]" fmt "\r\n", ##arg) |
|
HDF_LOGW(fmt, arg...) printf("[HDF:W/" LOG_TAG "]" fmt "\r\n", ##arg) |
|
HDF_LOGE(fmt, arg...) printf("[HDF:E/" LOG_TAG "]" fmt "\r\n", ##arg) |
HdfWorkFunc) (void *) |
HDF_STATUS { HDF_SUCCESS = 0, HDF_FAILURE = -1, HDF_ERR_NOT_SUPPORT = -2, HDF_ERR_INVALID_PARAM = -3, HDF_ERR_INVALID_OBJECT = -4, HDF_ERR_MALLOC_FAIL = -6, HDF_ERR_TIMEOUT = -7, HDF_ERR_THREAD_CREATE_FAIL = -10, HDF_ERR_QUEUE_FULL = -15, HDF_ERR_DEVICE_BUSY = -16, HDF_ERR_IO = -17, HDF_ERR_BAD_FD = -18, HDF_BSP_ERR_OP = HDF_BSP_ERR_NUM(-1), HDF_ERR_BSP_PLT_API_ERR = HDF_BSP_ERR_NUM(-2), HDF_PAL_ERR_DEV_CREATE = HDF_BSP_ERR_NUM(-3), HDF_PAL_ERR_INNER = HDF_BSP_ERR_NUM(-4), HDF_DEV_ERR_NO_MEMORY = HDF_DEV_ERR_NUM(-1), HDF_DEV_ERR_NO_DEVICE = HDF_DEV_ERR_NUM(-2), HDF_DEV_ERR_NO_DEVICE_SERVICE = HDF_DEV_ERR_NUM(-3), HDF_DEV_ERR_DEV_INIT_FAIL = HDF_DEV_ERR_NUM(-4), HDF_DEV_ERR_PUBLISH_FAIL = HDF_DEV_ERR_NUM(-5), HDF_DEV_ERR_ATTACHDEV_FAIL = HDF_DEV_ERR_NUM(-6), HDF_DEV_ERR_NODATA = HDF_DEV_ERR_NUM(-7), HDF_DEV_ERR_NORANGE = HDF_DEV_ERR_NUM(-8), HDF_DEV_ERR_OP = HDF_DEV_ERR_NUM(-10) } |
|
{ HDF_WORK_BUSY_PENDING = 1 << 0, HDF_WORK_BUSY_RUNNING = 1 << 1 } |
DListHeadInit (struct DListHead *head) |
|
DListIsEmpty (const struct DListHead *head) |
|
DListRemove (struct DListHead *entry) |
|
DListInsertHead (struct DListHead *entry, struct DListHead *head) |
|
DListInsertTail (struct DListHead *entry, struct DListHead *head) |
|
DListMerge (struct DListHead *list, struct DListHead *head) |
Merges two linked lists by adding the list specified by list to the head of the list specified by head and initializes the merged list. |
HdfWorkQueueInit (HdfWorkQueue *queue, char *name) |
|
HdfWorkInit (HdfWork *work, HdfWorkFunc func, void *arg) |
|
HdfDelayedWorkInit (HdfWork *work, HdfWorkFunc func, void *arg) |
|
HdfWorkDestroy (HdfWork *work) |
|
HdfWorkQueueDestroy (HdfWorkQueue *queue) |
|
HdfDelayedWorkDestroy (HdfWork *work) |
|
HdfAddWork (HdfWorkQueue *queue, HdfWork *work) |
|
HdfAddDelayedWork (HdfWorkQueue *queue, HdfWork *work, unsigned long ms) |
|
HdfWorkBusy (HdfWork *work) |
|
HdfCancelWorkSync (HdfWork *work) |
Cancels a work item. This function waits until the work item is complete. |
HdfCancelDelayedWorkSync (HdfWork *work) |
| ptr | Indicates the structure member address. |
| type | Indicates the structure type. |
| member | Indicates the structure member. |
| ptr | Indicates the structure member address. |
| type | Indicates the structure type. |
| member | Indicates the structure member. |
| pos | Indicates the pointer to the structure variable. |
| head | Indicates the pointer to the linked list head. |
| type | Indicates the structure type. |
| member | Indicates the member type of the structure. |
| ptr | Indicates the structure member address. |
| type | Indicates the structure type. |
| member | Indicates the structure member. |
| HDF_WORK_BUSY_PENDING | |
| HDF_WORK_BUSY_RUNNING |
| head | Indicates the pointer to the linked list DListHead. The parameter cannot be empty. |
| entry | Indicates the pointer to the node to insert. For details, see DListHead. The parameter cannot be empty. |
| head | Indicates the pointer to the linked list DListHead. The parameter cannot be empty. |
| entry | Indicates the pointer to the node to insert. For details, see DListHead. The parameter cannot be empty. |
| head | Indicates the pointer to the linked list DListHead. The parameter cannot be empty. |
| head | Indicates the pointer to the linked list DListHead. The parameter cannot be empty. |
| list | Indicates the pointer to the linked list DListHead. The parameter cannot be empty. |
| head | Indicates the pointer to the linked list DListHead. The parameter cannot be empty. |
| entry | Indicates the pointer to the node to remove. For details, see DListHead. The parameter cannot be empty. |
| queue | Indicates the pointer to the work queue HdfWorkQueue. |
| work | Indicates the pointer to the delayed work item HdfWork. |
| queue | Indicates the pointer to the work queue HdfWorkQueue. |
| work | Indicates the pointer to the work item HdfWork. |
| work | Indicates the pointer to the delayed work item HdfWork. |
| work | Indicates the pointer to the work item HdfWork. |
| work | Indicates the pointer to the delayed work item HdfWork. |
| work | Indicates the pointer to the delayed work item HdfWork. |
| func | Indicates the work execution function. |
| arg | Indicates the pointer to the argument of the work execution function. |
| work | Indicates the pointer to the work item or delayed work item HdfWork. |
| work | Indicates the pointer to the work item HdfWork. |
| work | Indicates the pointer to the work item HdfWork. |
| func | Indicates the work execution function. |
| arg | Indicates the pointer to the argument of the work execution function. |
| queue | Indicates the pointer to the work queue HdfWorkQueue. |
| queue | Indicates the pointer to the work queue OsalWorkQueue. |
| name | Indicates the pointer to the work queue name. |