engine_control/source/os/release/include/driver.h

41 lines
965 B
C
Raw Permalink Normal View History

2016-07-29 04:51:20 +00:00
/*
* 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_
2016-08-29 14:54:33 +00:00
#define IOCTL_PWM_SET_DUTY_CYCLE 0
#define IOCTL_PWM_GET_PERIOD_NS 1
#define IOCTL_PWM_GET_PULSE_WIDTH_NS 2
2016-08-10 11:16:10 +00:00
2016-07-29 04:51:20 +00:00
enum driver_type {
DRIVER_TYPE_ADC,
DRIVER_TYPE_GPIO,
DRIVER_TYPE_I2C,
2016-08-10 11:16:10 +00:00
DRIVER_TYPE_PWM,
2016-08-30 15:27:46 +00:00
DRIVER_TYPE_RNG,
2016-07-29 04:51:20 +00:00
DRIVER_TYPE_RTC,
DRIVER_TYPE_SPI,
DRIVER_TYPE_UART
};
2016-08-18 12:25:30 +00:00
#pragma pack(push)
#pragma pack(1)
2016-07-29 04:51:20 +00:00
struct driver {
enum driver_type driver_type;
const void *device_driver;
};
2016-08-18 12:25:30 +00:00
#pragma pack(pop)
2016-07-29 04:51:20 +00:00
2016-08-18 12:25:30 +00:00
int drv_open(const struct driver *driver);
int drv_close(const struct driver *driver);
int drv_read(const struct driver *driver, char *buffer, int len);
int drv_write(const struct driver *driver, const char *buffer, int len);
int drv_ioctl(const struct driver *driver, unsigned int cmd, const void *data);
2016-07-29 04:51:20 +00:00
#endif /* SOURCE_FIRMWARE_KERNEL_DRIVER_INCLUDE_DRIVER_H_ */