diff options
Diffstat (limited to 'include/drivers/io_driver.h')
-rw-r--r-- | include/drivers/io_driver.h | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/include/drivers/io_driver.h b/include/drivers/io_driver.h index 5e3d1327e..cade5e706 100644 --- a/include/drivers/io_driver.h +++ b/include/drivers/io_driver.h @@ -36,58 +36,58 @@ /* Generic IO entity structure,representing an accessible IO construct on the * device, such as a file */ -struct io_entity { +typedef struct io_entity { io_dev_handle dev_handle; uintptr_t info; -}; +} io_entity_t; /* Device info structure, providing device-specific functions and a means of * adding driver-specific state */ -struct io_dev_info { +typedef struct io_dev_info { struct io_dev_funcs *funcs; uintptr_t info; -}; +} io_dev_info_t; /* Structure used to create a connection to a type of device */ -struct io_dev_connector { +typedef struct io_dev_connector { /* dev_open opens a connection to a particular device driver */ - int (*dev_open)(void *spec, struct io_dev_info **dev_info); -}; + int (*dev_open)(void *spec, io_dev_info_t **dev_info); +} io_dev_connector_t; /* Structure to hold device driver function pointers */ -struct io_dev_funcs { - io_type (*type)(void); - int (*open)(struct io_dev_info *dev_info, const void *spec, - struct io_entity *entity); - int (*seek)(struct io_entity *entity, int mode, ssize_t offset); - int (*size)(struct io_entity *entity, size_t *length); - int (*read)(struct io_entity *entity, void *buffer, size_t length, +typedef struct io_dev_funcs { + io_type_t (*type)(void); + int (*open)(io_dev_info_t *dev_info, const void *spec, + io_entity_t *entity); + int (*seek)(io_entity_t *entity, int mode, ssize_t offset); + int (*size)(io_entity_t *entity, size_t *length); + int (*read)(io_entity_t *entity, void *buffer, size_t length, size_t *length_read); - int (*write)(struct io_entity *entity, const void *buffer, + int (*write)(io_entity_t *entity, const void *buffer, size_t length, size_t *length_written); - int (*close)(struct io_entity *entity); - int (*dev_init)(struct io_dev_info *dev_info, const void *init_params); - int (*dev_close)(struct io_dev_info *dev_info); -}; + int (*close)(io_entity_t *entity); + int (*dev_init)(io_dev_info_t *dev_info, const void *init_params); + int (*dev_close)(io_dev_info_t *dev_info); +} io_dev_funcs_t; /* IO platform data - used to track devices registered for a specific * platform */ -struct io_plat_data { - struct io_dev_info *devices[MAX_IO_DEVICES]; +typedef struct io_plat_data { + io_dev_info_t *devices[MAX_IO_DEVICES]; unsigned int dev_count; -}; +} io_plat_data_t; /* Operations intended to be performed during platform initialisation */ /* Initialise the IO layer */ -void io_init(struct io_plat_data *data); +void io_init(io_plat_data_t *data); /* Register a device driver */ -int io_register_device(struct io_dev_info *dev_info); +int io_register_device(io_dev_info_t *dev_info); #endif /* __IO_DRIVER_H__ */ |