code re-organized
This commit is contained in:
8
include/board.h
Normal file
8
include/board.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef __INCLUDE_BOARD_H__
|
||||
#define __INCLUDE_BOARD_H__
|
||||
|
||||
#ifdef PLATFORM_posix
|
||||
#include "platform/posix/board.h"
|
||||
#endif
|
||||
|
||||
#endif
|
34
include/driver.h
Normal file
34
include/driver.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef __DRIVER_H__
|
||||
#define __DRIVER_H__
|
||||
|
||||
#include <stdarg.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);
|
||||
typedef int (*fp_ioctl_t)(const struct driver *, unsigned int, unsigned int argc, va_list);
|
||||
|
||||
struct driver_fp {
|
||||
fp_open_t open;
|
||||
fp_close_t close;
|
||||
fp_read_t read;
|
||||
fp_write_t write;
|
||||
fp_ioctl_t ioctl;
|
||||
};
|
||||
|
||||
struct driver {
|
||||
const char *name;
|
||||
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);
|
||||
int drv_ioctl(const struct driver *drv, unsigned int cmd, unsigned int argc, ...);
|
||||
|
||||
#endif
|
@@ -1,8 +1,8 @@
|
||||
#ifndef __BOARD_H__
|
||||
#define __BOARD_H__
|
||||
#ifndef __INCLUDE_PLATFORM_POSIX_BOARD_H__
|
||||
#define __INCLUDE_PLATFORM_POSIX_BOARD_H__
|
||||
|
||||
#include "driver.h"
|
||||
#include "posix/i2c.h"
|
||||
#include "i2c.h"
|
||||
#include "ssd1306.h"
|
||||
#include "st7789.h"
|
||||
#include "gpio.h"
|
Reference in New Issue
Block a user