Files
cdba/device.h
Bjorn Andersson 2fc13cec3f device: Introduce ops for control operations
In order to support multiple control boards make all operations follow
indirections in the device context.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-03-12 17:44:29 -07:00

42 lines
1.0 KiB
C

#ifndef __DEVICE_H__
#define __DEVICE_H__
struct cdb_assist;
struct fastboot;
struct fastboot_ops;
struct device {
char *board;
char *cdb_serial;
char *name;
char *serial;
unsigned voltage;
bool tickle_mmc;
bool pshold_shutdown;
struct fastboot *fastboot;
void (*boot)(struct device *);
void *(*open)(struct device *dev);
int (*power_on)(struct device *dev);
int (*power_off)(struct device *dev);
void (*print_status)(struct device *dev);
void (*vbus)(struct device *dev, bool on);
int (*write)(struct device *dev, const void *buf, size_t len);
bool set_active;
void *cdb;
};
struct device *device_open(const char *board, struct fastboot_ops *fastboot_ops);
int device_power_on(struct device *device);
int device_power_off(struct device *device);
void device_print_status(struct device *device);
void device_vbus(struct device *device, bool enable);
int device_write(struct device *device, const void *buf, size_t len);
void device_boot(struct device *device, const void *data, size_t len);
#endif