From d6a2a773039b07d29c4b5adbfa21c99c88280598 Mon Sep 17 00:00:00 2001 From: Godzil Date: Mon, 27 Jun 2022 17:04:37 +0100 Subject: [PATCH] Add the possibility to pass parameter to device_init and add a device_type_t used to know what parameter to pass to init when needed. --- source/includes/device.h | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/source/includes/device.h b/source/includes/device.h index e68ac7f..1bdf032 100644 --- a/source/includes/device.h +++ b/source/includes/device.h @@ -10,15 +10,32 @@ #ifndef __DEVICE_H__ #define __DEVICE_H__ -typedef void (*device_init)(void); +typedef void (*device_init)(void *param); typedef void (*device_reset)(void); typedef void (*device_free)(void); +typedef enum device_type_t +{ + DT_INTERRUPT_CONTROLLER, + DT_GPU, + DT_BUTTONS, + DT_DMA, + DT_LUXOR, + DT_AUDIO, + DT_SYSTEM, + DT_RTC, + DT_RS232, + DT_EEPROM, + DT_DEBUG, +} device_type_t; + typedef struct device_t { - device_init *init; - device_reset *reset; - device_free *free; + device_init init; /***< Function called to init the device */ + device_reset reset; /***< Function called to reset the device */ + device_free free; /***< Function called to deinit the device */ + device_type_t deviceType; /***< Used to tell the type of device, could be useful to pass the + * right parameters to init */ } device_t; -#endif /* NEWOSWAN_DEVICE_H */ +#endif /* __DEVICE_H__ */