diff options
author | inmarket <andrewh@inmarket.com.au> | 2014-09-26 16:29:52 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2014-09-26 16:35:34 +1000 |
commit | b42a2098ebec7ece6ba075ee55f5c29061526a24 (patch) | |
tree | 737878c09fae9a78ef5de0ec5a84e25e0e1d1441 /src/gdriver | |
parent | ff28a0aa37fb0400e0cd7e504f6af7cdcd01aa48 (diff) | |
download | uGFX-b42a2098ebec7ece6ba075ee55f5c29061526a24.tar.gz uGFX-b42a2098ebec7ece6ba075ee55f5c29061526a24.tar.bz2 uGFX-b42a2098ebec7ece6ba075ee55f5c29061526a24.zip |
Change to GDriver to support an initialisation parameter
Diffstat (limited to 'src/gdriver')
-rw-r--r-- | src/gdriver/gdriver_gdriver.c | 4 | ||||
-rw-r--r-- | src/gdriver/sys_defs.h | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/gdriver/gdriver_gdriver.c b/src/gdriver/gdriver_gdriver.c index 3c17fca0..d44d6f3c 100644 --- a/src/gdriver/gdriver_gdriver.c +++ b/src/gdriver/gdriver_gdriver.c @@ -27,7 +27,7 @@ void _gdriverDeinit(void) { } -GDriver *gdriverRegister(const GDriverVMT *vmt) { +GDriver *gdriverRegister(const GDriverVMT *vmt, void *param) { GDriver * pd; GDriver * dtail; unsigned dinstance, sinstance; @@ -47,7 +47,7 @@ GDriver *gdriverRegister(const GDriverVMT *vmt) { return 0; memset(pd, 0, vmt->objsize); pd->vmt = vmt; - if (vmt->init && !vmt->init(pd, dinstance, sinstance)) { + if (vmt->init && !vmt->init(pd, param, dinstance, sinstance)) { gfxFree(pd); return 0; } diff --git a/src/gdriver/sys_defs.h b/src/gdriver/sys_defs.h index d8de25fc..f7bf622e 100644 --- a/src/gdriver/sys_defs.h +++ b/src/gdriver/sys_defs.h @@ -67,7 +67,7 @@ typedef struct GDriverVMT { uint16_t type; // @< What type of driver this is uint16_t flags; // @< Flags for the driver. Meaning is specific to each driver type. uint32_t objsize; // @< How big the runtime driver structure is - bool_t (*init)(GDriver *driver, unsigned driverinstance, unsigned systeminstance); // @< Initialise the driver. Returns TRUE if OK. + bool_t (*init)(GDriver *driver, void *param, unsigned driverinstance, unsigned systeminstance); // @< Initialise the driver. Returns TRUE if OK. // driverinstance is the instance 0..n of this driver. // systeminstance is the instance 0..n of this type of device. // The memory allocated is cleared before this call. @@ -102,8 +102,9 @@ extern "C" { * @return The runtime driver structure or NULL if it fails. * * @param[in] vmt The driver's vmt + * @param[in] param An arbitrary paramater passed to the driver init routine. */ - GDriver *gdriverRegister(const GDriverVMT *vmt); + GDriver *gdriverRegister(const GDriverVMT *vmt, void *param); /** * @brief UnRegister a driver instance. |