Files
mkrtos-real/mkrtos_user/user/drv/lib/mk_drv/mk_drv.h
2024-11-17 10:30:06 +08:00

28 lines
662 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <u_types.h>
#include <u_slist.h>
struct mk_dev;
typedef struct mk_dev mk_dev_t;
typedef struct mk_drv_compatible
{
const char *compatible;
} mk_drv_compatible_t;
typedef struct mk_drv
{
mk_drv_compatible_t *compatilbe; /*数组以NULL结尾 */
int (*probe)(mk_dev_t *dev);
slist_head_t node;
int ref; //!< 引用计数
void *data;
} mk_drv_t;
void mk_drv_init(void);
int mk_drv_register(mk_drv_t *drv);
int mk_drv_unregister(mk_drv_t *drv);
int mk_drv_mach_dev(int (*hook_mach)(mk_drv_t *drv, const char *dev_name, void *data),
const char *compat_name, const char *dev_name, void *data);