XFusion API v1.3.0
载入中...
搜索中...
未找到
xf_hal_dev.h
浏览该文件的文档.
1
12#ifndef __XF_HAL_DEV_H__
13#define __XF_HAL_DEV_H__
14
15/* ==================== [Includes] ========================================== */
16
18
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/* ==================== [Defines] =========================================== */
33
34#define XF_HAL_DEV_CMD_DEFAULT 0x0
35#define XF_HAL_DEV_CMD_ALL 0x7FFFFFFF
36
37/* ==================== [Typedefs] ========================================== */
38
40
41typedef enum _xf_hal_type_t {
43#define XF_HAL_TABLE_TYPE
44#include "../device/xf_hal_reg_table.inc"
47
48typedef xf_hal_dev_t *(*xf_hal_dev_create_t)(uint32_t id);
49
56
57typedef struct _xf_driver_ops_t {
59 xf_err_t (*ioctl)(xf_hal_dev_t *dev, uint32_t cmd, void *config);
60 int (*read)(xf_hal_dev_t *dev, void *buf, size_t count);
61 int (*write)(xf_hal_dev_t *dev, const void *buf, size_t count);
64
65typedef struct _xf_hal_dev_t {
70#if XF_HAL_LOCK_IS_ENABLE
71 void *mutex;
72#endif
74
75/* ==================== [Global Prototypes] ================================= */
76
78 const xf_driver_ops_t *driver_ops);
79
82
84xf_err_t xf_hal_driver_ioctl(xf_hal_dev_t *dev, uint32_t cmd, void *config);
85int xf_hal_driver_read(xf_hal_dev_t *dev, void *buf, size_t count);
86int xf_hal_driver_write(xf_hal_dev_t *dev, const void *buf, size_t count);
88
91
92/* ==================== [Macros] ============================================ */
93
94#ifdef __cplusplus
95} /* extern "C" */
96#endif
97
103#endif // __XF_HAL_DEV_H__
int32_t xf_err_t
整形错误类型。 错误码具体值见 xf_err_code_t.
Definition xf_err.h:69
static xf_osal_mutex_t mutex
Definition xf_main.c:35
xf_err_t(* open)(xf_hal_dev_t *dev)
Definition xf_hal_dev.h:58
int(* read)(xf_hal_dev_t *dev, void *buf, size_t count)
Definition xf_hal_dev.h:60
xf_err_t(* ioctl)(xf_hal_dev_t *dev, uint32_t cmd, void *config)
Definition xf_hal_dev.h:59
xf_err_t(* close)(xf_hal_dev_t *dev)
Definition xf_hal_dev.h:62
int(* write)(xf_hal_dev_t *dev, const void *buf, size_t count)
Definition xf_hal_dev.h:61
xf_list_t node
Definition xf_hal_dev.h:66
uint32_t id
Definition xf_hal_dev.h:68
void * platform_data
Definition xf_hal_dev.h:69
uint32_t type
Definition xf_hal_dev.h:67
双向链表结构体.
Definition xf_list.h:64
xf_err_t xf_hal_driver_close(xf_hal_dev_t *dev)
Definition xf_hal_dev.c:192
_xf_hal_type_t
Definition xf_hal_dev.h:41
@ XF_HAL_TYPE_MAX
Definition xf_hal_dev.h:45
@ XF_HAL_TYPE_NONE
Definition xf_hal_dev.h:42
int xf_hal_driver_read(xf_hal_dev_t *dev, void *buf, size_t count)
Definition xf_hal_dev.c:168
xf_err_t xf_hal_driver_ioctl(xf_hal_dev_t *dev, uint32_t cmd, void *config)
Definition xf_hal_dev.c:154
struct _xf_driver_ops_t xf_driver_ops_t
enum _xf_hal_type_t xf_hal_type_t
xf_err_t xf_hal_driver_open(xf_hal_dev_t *dev, xf_hal_type_t type, uint32_t id)
Definition xf_hal_dev.c:118
int xf_hal_driver_write(xf_hal_dev_t *dev, const void *buf, size_t count)
Definition xf_hal_dev.c:180
xf_err_t xf_hal_device_add(xf_hal_dev_t *dev)
Definition xf_hal_dev.c:216
uint32_t xf_hal_driver_get_flag(xf_hal_type_t type)
Definition xf_hal_dev.c:67
struct _xf_hal_dev_t xf_hal_dev_t
Definition xf_hal_dev.h:39
enum _xf_hal_flag_t xf_hal_flag_t
xf_hal_dev_t * xf_hal_device_find(xf_hal_type_t type, uint32_t id)
Definition xf_hal_dev.c:238
xf_err_t xf_hal_driver_register(xf_hal_type_t type, xf_hal_flag_t flag, xf_hal_dev_create_t constructor, const xf_driver_ops_t *driver_ops)
Definition xf_hal_dev.c:44
xf_hal_dev_t *(* xf_hal_dev_create_t)(uint32_t id)
Definition xf_hal_dev.h:48
_xf_hal_flag_t
Definition xf_hal_dev.h:50
@ _XF_HAL_FLAG_NOT_USE
Definition xf_hal_dev.h:51
@ XF_HAL_FLAG_ONLY_WRITE
Definition xf_hal_dev.h:53
@ XF_HAL_FLAG_READ_WRITE
Definition xf_hal_dev.h:54
@ XF_HAL_FLAG_ONLY_READ
Definition xf_hal_dev.h:52
xf_hal_dev_t * xf_hal_driver_create(xf_hal_type_t type, uint32_t id)
Definition xf_hal_dev.c:93
xf_hal 内核配置(仅 xf_hal kernel 内部使用)。