29 lines
740 B
C
29 lines
740 B
C
|
#ifndef __DRIVER_H__
|
||
|
#define __DRIVER_H__
|
||
|
|
||
|
struct driver;
|
||
|
|
||
|
typedef int (*fp_open_t)(const struct driver *);
|
||
|
typedef int (*fp_close_t)(const struct driver *);
|
||
|
typedef int (*fp_read_t)(const struct driver *, char *, unsigned int);
|
||
|
typedef int (*fp_write_t)(const struct driver *, const char *, unsigned int);
|
||
|
|
||
|
struct driver_fp {
|
||
|
fp_open_t open;
|
||
|
fp_close_t close;
|
||
|
fp_read_t read;
|
||
|
fp_write_t write;
|
||
|
};
|
||
|
|
||
|
struct driver {
|
||
|
const struct driver_fp *fp;
|
||
|
const void *dev;
|
||
|
};
|
||
|
|
||
|
int drv_open(const struct driver *drv);
|
||
|
int drv_close(const struct driver *drv);
|
||
|
int drv_read(const struct driver *drv, char *buffer, unsigned int length);
|
||
|
int drv_write(const struct driver *drv, const char *buffer, unsigned int length);
|
||
|
|
||
|
#endif
|