2017-02-19 20:45:15 +00:00
|
|
|
#ifndef _DEVICE_H_
|
|
|
|
#define _DEVICE_H_
|
|
|
|
|
2017-02-20 11:31:26 +00:00
|
|
|
typedef struct device_t {
|
|
|
|
const char *name;
|
2017-02-19 20:45:15 +00:00
|
|
|
|
|
|
|
uint16_t size;
|
|
|
|
|
2017-02-20 11:31:26 +00:00
|
|
|
uint8_t (*read_1)(void *, uint16_t doff);
|
|
|
|
void (*write_1)(void *, uint16_t, uint8_t val);
|
2017-02-19 20:45:15 +00:00
|
|
|
|
2017-02-20 11:31:26 +00:00
|
|
|
void *config;
|
|
|
|
void *aux; /* any dev space-specific data */
|
|
|
|
} device_t;
|
2017-02-19 20:45:15 +00:00
|
|
|
|
2017-02-20 11:31:26 +00:00
|
|
|
typedef struct device_mapping_t {
|
|
|
|
device_t *dev;
|
|
|
|
uint16_t addr;
|
2017-02-19 20:45:15 +00:00
|
|
|
|
2017-02-20 11:31:26 +00:00
|
|
|
struct device_mapping_t *next;
|
|
|
|
} device_mapping_t;
|
2017-02-19 20:45:15 +00:00
|
|
|
|
|
|
|
#endif /* _DEVICE_H_ */
|
|
|
|
|