31 lines
668 B
C
31 lines
668 B
C
/*
|
|
* driver.h
|
|
*
|
|
* Created on: Jul 27, 2016
|
|
* Author: tkl
|
|
*/
|
|
|
|
#ifndef SOURCE_FIRMWARE_KERNEL_DRIVER_INCLUDE_DRIVER_H_
|
|
#define SOURCE_FIRMWARE_KERNEL_DRIVER_INCLUDE_DRIVER_H_
|
|
|
|
enum driver_type {
|
|
DRIVER_TYPE_ADC,
|
|
DRIVER_TYPE_GPIO,
|
|
DRIVER_TYPE_I2C,
|
|
DRIVER_TYPE_RTC,
|
|
DRIVER_TYPE_SPI,
|
|
DRIVER_TYPE_UART
|
|
};
|
|
|
|
struct driver {
|
|
enum driver_type driver_type;
|
|
const void *device_driver;
|
|
};
|
|
|
|
int open(const struct driver *driver);
|
|
int close(const struct driver *driver);
|
|
int read(const struct driver *driver, char *buffer, int len);
|
|
int write(const struct driver *driver, const char *buffer, int len);
|
|
|
|
#endif /* SOURCE_FIRMWARE_KERNEL_DRIVER_INCLUDE_DRIVER_H_ */
|