WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
Driverbase
Driverbase 的协作图:

结构体

struct  LosDeviceRegs
 
struct  LosDeviceConfig
 
struct  LosDevice
 
struct  LosPowerMgrOps
 
struct  LosDriverOps
 
struct  LosDriver
 

宏定义

#define LOS_ERRNO_DRIVER_INPUT_INVALID   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x10)
 
#define LOS_ERRNO_DRIVER_MUX_FAIL   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x11)
 
#define LOS_ERRNO_DRIVER_DRIVER_MATCH_FAIL   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x20)
 
#define LOS_ERRNO_DRIVER_DRIVER_PROBE_FAIL   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x21)
 
#define LOS_ERRNO_DRIVER_DRIVER_REGISTERED   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x22)
 
#define LOS_ERRNO_DRIVER_DRIVER_NOTFOUND   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x23)
 
#define LOS_ERRNO_DRIVER_DEVICE_BOUNDED   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x30)
 
#define LOS_ERRNO_DRIVER_DEVICE_INITIALFAIL   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x31)
 
#define LOS_ERRNO_DRIVER_DEVICE_REGISTERED   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x32)
 
#define LOS_ERRNO_DRIVER_DEVICE_BUSY   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x33)
 
#define LOS_FOREACH_DEVICE_LIST_HOOK(device, list, hook)    LOS_DL_LIST_FOR_EACH_ENTRY_HOOK(device, list, struct LosDevice, driverNode, hook)
 iterate over a device list and execute hook function.
 
#define LOS_FOREACH_DEVICE_HOOK(device, hook)    LOS_DL_LIST_FOR_EACH_ENTRY_HOOK(device, &g_deviceList, struct LosDevice, deviceItem, hook)
 iterate over g_deviceList and execute hook function.
 
#define LOS_FOREACH_DEVICE_BY_DRIVER(device, driver)    LOS_FOREACH_DEVICE_LIST_HOOK(device, &(driver)->deviceList, NULL)
 iterate over a driver's deviceList.
 
#define LOS_FOREACH_DEVICE(device)    LOS_FOREACH_DEVICE_HOOK(device, NULL)
 iterate over a device list.
 

函数

UINT32 LOS_DriverRegister (struct LosDriver *drv)
 register a new driver to the system.
 
UINT32 LOS_DriverUnregister (struct LosDriver *drv)
 unregister a driver from the system.
 
UINT32 LOS_DeviceRegister (struct LosDevice *dev)
 register a new device to the system.
 
void LOS_DeviceUnregister (struct LosDevice *dev)
 unregister a device from the system.
 
VOIDLOS_DeviceDataGet (const struct LosDevice *dev)
 get data form a device.
 
UINTPTR LOS_DeviceRegBaseGet (const struct LosDevice *dev, UINT32 index)
 get register base address form a device.
 
UINTPTR LOS_DeviceRegSizeGet (const struct LosDevice *dev, UINT32 index)
 get register size form a device.
 
UINTPTR LOS_DeviceIrqNumGet (const struct LosDevice *dev)
 get interrupt number form a device.
 
INT32 LOS_PmSuspend (VOID)
 suspend all devices in preparedList.
 
VOID LOS_PmResume (VOID)
 resume all devices in suspendedList.
 

详细描述

宏定义说明

◆ LOS_ERRNO_DRIVER_DEVICE_BOUNDED

#define LOS_ERRNO_DRIVER_DEVICE_BOUNDED   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x30)

Task error code: Device already attach to driver.

Value: 0x02004130

Solution: Check the Input.

◆ LOS_ERRNO_DRIVER_DEVICE_BUSY

#define LOS_ERRNO_DRIVER_DEVICE_BUSY   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x33)

Task error code: Device busy.

Value: 0x02004133

Solution: Check the Input.

◆ LOS_ERRNO_DRIVER_DEVICE_INITIALFAIL

#define LOS_ERRNO_DRIVER_DEVICE_INITIALFAIL   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x31)

Task error code: Invalid input.

Value: 0x02004131

Solution: Check the Input.

◆ LOS_ERRNO_DRIVER_DEVICE_REGISTERED

#define LOS_ERRNO_DRIVER_DEVICE_REGISTERED   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x32)

Task error code: Device register twice.

Value: 0x02004132

Solution: Check the Input.

◆ LOS_ERRNO_DRIVER_DRIVER_MATCH_FAIL

#define LOS_ERRNO_DRIVER_DRIVER_MATCH_FAIL   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x20)

Task error code: Do match function failed.

Value: 0x02004120

Solution: This error code is not in use temporarily.

◆ LOS_ERRNO_DRIVER_DRIVER_NOTFOUND

#define LOS_ERRNO_DRIVER_DRIVER_NOTFOUND   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x23)

Task error code: Invalid input.

Value: 0x02004123

Solution: Check the Input.

◆ LOS_ERRNO_DRIVER_DRIVER_PROBE_FAIL

#define LOS_ERRNO_DRIVER_DRIVER_PROBE_FAIL   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x21)

Task error code: Do probe function failed.

Value: 0x02004121

Solution: This error code is not in use temporarily.

◆ LOS_ERRNO_DRIVER_DRIVER_REGISTERED

#define LOS_ERRNO_DRIVER_DRIVER_REGISTERED   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x22)

Task error code: driver register twice.

Value: 0x02004122

Solution: Check the Input.

◆ LOS_ERRNO_DRIVER_INPUT_INVALID

#define LOS_ERRNO_DRIVER_INPUT_INVALID   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x10)

Task error code: Invalid input.

Value: 0x02004110

Solution: Check the Input.

◆ LOS_ERRNO_DRIVER_MUX_FAIL

#define LOS_ERRNO_DRIVER_MUX_FAIL   LOS_ERRNO_OS_ERROR(LOS_MOD_DRIVER, 0x11)

Task error code: Mutex failed.

Value: 0x02004111

Solution: Check the Input.

◆ LOS_FOREACH_DEVICE

#define LOS_FOREACH_DEVICE (   device)     LOS_FOREACH_DEVICE_HOOK(device, NULL)

iterate over a device list.

Description:
This API is used to iterate over a device list.
注意
  • None.
参数
device[IN] Pointer to the structure that contains the doubly linked list that is to be traversed.
返回值
None.
Dependency:
参见
自从
Huawei LiteOS V200R05C10

◆ LOS_FOREACH_DEVICE_BY_DRIVER

#define LOS_FOREACH_DEVICE_BY_DRIVER (   device,
  driver 
)     LOS_FOREACH_DEVICE_LIST_HOOK(device, &(driver)->deviceList, NULL)

iterate over a driver's deviceList.

Description:
This API is used to iterate over a driver's deviceList.
注意
  • None.
参数
device[IN] Pointer to the structure that contains the doubly linked list that is to be traversed.
driver[IN] Pointer to the structure that contains deviceList to be traversed.
返回值
None.
Dependency:
参见
自从
Huawei LiteOS V200R05C10

◆ LOS_FOREACH_DEVICE_HOOK

#define LOS_FOREACH_DEVICE_HOOK (   device,
  hook 
)     LOS_DL_LIST_FOR_EACH_ENTRY_HOOK(device, &g_deviceList, struct LosDevice, deviceItem, hook)

iterate over g_deviceList and execute hook function.

Description:
This API is used to iterate over g_deviceList and execute hook function.
注意
  • None.
参数
device[IN] Pointer to the structure that contains the doubly linked list that is to be traversed.
hook[IN] Hook function.
返回值
None.
Dependency:
参见
自从
Huawei LiteOS V200R05C10

◆ LOS_FOREACH_DEVICE_LIST_HOOK

#define LOS_FOREACH_DEVICE_LIST_HOOK (   device,
  list,
  hook 
)     LOS_DL_LIST_FOR_EACH_ENTRY_HOOK(device, list, struct LosDevice, driverNode, hook)

iterate over a device list and execute hook function.

Description:
This API is used to iterate over a device list and execute hook function..
注意
  • None.
参数
device[IN] Pointer to the structure that contains the doubly linked list that is to be traversed.
list[IN] Pointer to the doubly linked list to be traversed.
hook[IN] Hook function.
返回值
None.
Dependency:
参见
自从
Huawei LiteOS V200R05C10

函数说明

◆ LOS_DeviceDataGet()

VOID * LOS_DeviceDataGet ( const struct LosDevice dev)

get data form a device.

Description:
  • This API is used to get data form a device.
参数
dev[IN]A pointer to device.dev/dev->name can not be NULL.
返回值
#VOID*the data of the device.
Dependency:
自从
Huawei LiteOS V200R05C10

◆ LOS_DeviceIrqNumGet()

UINTPTR LOS_DeviceIrqNumGet ( const struct LosDevice dev)

get interrupt number form a device.

Description:
  • This API is used to get register base address form a device.
参数
dev[IN]A pointer to device.dev/dev->name can not be NULL.
返回值
UINTPTRthe interrupt number of the device.
Dependency:
自从
Huawei LiteOS V200R05C10

◆ LOS_DeviceRegBaseGet()

UINTPTR LOS_DeviceRegBaseGet ( const struct LosDevice dev,
UINT32  index 
)

get register base address form a device.

Description:
  • This API is used to get register base address form a device. The device may have multiple sets of registers, the index must be specified. If The device has only one set of register, the index should be 0.
参数
dev[IN]A pointer to device.dev/dev->name can not be NULL.
index[IN]The number of which reg base to get.
返回值
UINTPTRthe register base address of the device.
Dependency:
自从
Huawei LiteOS V200R05C10

◆ LOS_DeviceRegister()

UINT32 LOS_DeviceRegister ( struct LosDevice dev)

register a new device to the system.

Description:
  • This API is used to register a device to the system.
注意
  • The same dev node can not be registered twice.
参数
dev[IN]A pointer to device.
返回值
LOS_ERRNO_DRIVER_INPUT_INVALIDInvalid input.dev/dev->name can not be NULL.
LOS_ERRNO_DRIVER_DEVICE_REGISTEREDDevice register twice.
LOS_OKThe device register success.
Dependency:
自从
Huawei LiteOS V200R05C10

◆ LOS_DeviceRegSizeGet()

UINTPTR LOS_DeviceRegSizeGet ( const struct LosDevice dev,
UINT32  index 
)

get register size form a device.

Description:
  • This API is used to get register size form a device. The device may have multiple sets of registers, the index must be specified. If The device has only one set of register, the index should be 0.
参数
dev[IN]A pointer to device.dev/dev->name can not be NULL.
index[IN]The number of which reg size to get.
返回值
UINTPTRthe register size of the device.
Dependency:
自从
Huawei LiteOS V200R05C10

◆ LOS_DeviceUnregister()

void LOS_DeviceUnregister ( struct LosDevice dev)

unregister a device from the system.

Description:
  • This API is used to unregister a device from the system.
参数
dev[IN]A pointer to device.dev/dev->name can not be NULL.
Dependency:
自从
Huawei LiteOS V200R05C10

◆ LOS_DriverRegister()

UINT32 LOS_DriverRegister ( struct LosDriver drv)

register a new driver to the system.

Description:
  • This API is used to register a driver to the system.
注意
  • The param probe function is applied after attach the device to the driver.
  • The param remove function is used when device or driver is deleted.
参数
drv[IN]A pointer to LosDriver.
返回值
LOS_ERRNO_DRIVER_INPUT_INVALIDInvalid input.drv/drv->name can not be NULL.
LOS_ERRNO_DRIVER_DRIVER_REGISTEREDInvalid input.drv node register twice.
LOS_ERRNO_DRIVER_MUX_FAILMux create failed.
LOS_OKThe driver register success.
Dependency:
自从
Huawei LiteOS V200R05C10

◆ LOS_DriverUnregister()

UINT32 LOS_DriverUnregister ( struct LosDriver drv)

unregister a driver from the system.

Description:
  • This API is used to unregister a driver from the system.
参数
drv[IN]A pointer to device_driver.drv/drv->name can not be NULL.
返回值
LOS_ERRNO_DRIVER_INPUT_INVALIDInvalid input.drv and drv.driver->name can not be NULL.
LOS_ERRNO_DRIVER_DRIVER_NOTFOUNDDriver not found.
LOS_ERRNO_DRIVER_DEVICE_BUSYDevice busy.
LOS_OKThe driver unregister success.
Dependency:
自从
Huawei LiteOS V200R05C10

◆ LOS_PmResume()

VOID LOS_PmResume ( VOID  )

resume all devices in suspendedList.

Description:
  • This API is used to resume all prepared list device.
参数
VOID.
返回值
#VOID.
Dependency:
自从
Huawei LiteOS V200R05C10

◆ LOS_PmSuspend()

INT32 LOS_PmSuspend ( VOID  )

suspend all devices in preparedList.

Description:
  • This API is used to suspend all prepared list device.
参数
VOID.
返回值
#VOID.
Dependency:
自从
Huawei LiteOS V200R05C10