From 3a520359a0bba575eff83e8013b705eacb93aeb4 Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 17 Sep 2014 09:34:08 +1000 Subject: [PATCH] GDISP updates to match previous GDRIVER and multiple display updates --- src/gdisp/driver.h | 4 ++-- src/gdisp/gdisp_gdisp.c | 15 ++++++++++++--- src/gdisp/sys_defs.h | 4 ++-- src/gdisp/sys_rules.h | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/gdisp/driver.h b/src/gdisp/driver.h index 288f9a65..f8d66f4b 100644 --- a/src/gdisp/driver.h +++ b/src/gdisp/driver.h @@ -287,7 +287,7 @@ struct GDisplay { }; typedef struct GDISPVMT { - GDriverVMT vmtdriver; + GDriverVMT d; bool_t (*init)(GDisplay *g); void (*deinit)(GDisplay *g); void (*writestart)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy @@ -617,7 +617,7 @@ typedef struct GDISPVMT { #endif // Routines needed by the general driver VMT - bool_t _gdispInitDriver(GDriver *g, int driverinstance, int systeminstance); + bool_t _gdispInitDriver(GDriver *g, unsigned driverinstance, unsigned systeminstance); void _gdispPostInitDriver(GDriver *g); void _gdispDeInitDriver(GDriver *g); diff --git a/src/gdisp/gdisp_gdisp.c b/src/gdisp/gdisp_gdisp.c index 0e5cacb5..4a149faa 100644 --- a/src/gdisp/gdisp_gdisp.c +++ b/src/gdisp/gdisp_gdisp.c @@ -569,7 +569,7 @@ void _gdispInit(void) // GDISP_DRIVER_LIST is defined - create each driver instance #if defined(GDISP_DRIVER_LIST) { - int i; + unsigned i; extern GDriverVMTList GDISP_DRIVER_LIST; static const struct GDriverVMT const * dclist[] = {GDISP_DRIVER_LIST}; @@ -579,7 +579,8 @@ void _gdispInit(void) } #elif GDISP_TOTAL_DISPLAYS > 1 { - int i; + unsigned i; + extern GDriverVMTList GDISPVMT_OnlyOne; for(i = 0; i < GDISP_TOTAL_DISPLAYS; i++) gdriverRegister(GDISPVMT_OnlyOne); @@ -622,7 +623,7 @@ void _gdispDeinit(void) /* ToDo */ } -bool_t _gdispInitDriver(GDriver *g, int driverinstance, int systeminstance) { +bool_t _gdispInitDriver(GDriver *g, unsigned driverinstance, unsigned systeminstance) { #define gd ((GDisplay *)g) bool_t ret; @@ -694,10 +695,18 @@ void _gdispDeInitDriver(GDriver *g) { #undef gd } +GDisplay *gdispGetDisplay(unsigned display) { + return (GDisplay *)gdriverGetInstance(GDRIVER_TYPE_DISPLAY, display); +} + void gdispSetDisplay(GDisplay *g) { if (g) GDISP = g; } +unsigned gdispGetDisplayCount(void) { + return gdriverInstanceCount(GDRIVER_TYPE_DISPLAY); +} + coord_t gdispGGetWidth(GDisplay *g) { return g->g.Width; } coord_t gdispGGetHeight(GDisplay *g) { return g->g.Height; } powermode_t gdispGGetPowerMode(GDisplay *g) { return g->g.Powermode; } diff --git a/src/gdisp/sys_defs.h b/src/gdisp/sys_defs.h index 0d51d639..35844e2d 100644 --- a/src/gdisp/sys_defs.h +++ b/src/gdisp/sys_defs.h @@ -219,7 +219,7 @@ color_t gdispContrastColor(color_t color); * * @api */ -#define gdispGetDisplay(display) ((GDisplay *)gdriverGetInstance(GDRIVER_TYPE_DISPLAY, display)) +GDisplay *gdispGetDisplay(unsigned display); /** * @brief Set the current default display to the specified display @@ -241,7 +241,7 @@ void gdispSetDisplay(GDisplay *g); * * @note Displays are numbered from 0 to @p gdispGetDisplayCount() - 1 */ -#define gdispGetDisplayCount() gdriverInstanceCount(GDRIVER_TYPE_DISPLAY) +unsigned gdispGetDisplayCount(void); /* Property Functions */ diff --git a/src/gdisp/sys_rules.h b/src/gdisp/sys_rules.h index 90b07138..79df2d88 100644 --- a/src/gdisp/sys_rules.h +++ b/src/gdisp/sys_rules.h @@ -26,7 +26,7 @@ #endif #if defined(GDISP_DRIVER_LIST) #if GDISP_TOTAL_DISPLAYS != 1 - #error "GDISP Multiple Drivers: You can't specify both GDISP_TOTAL_DISPLAYS and GDISP_DRIVER_LIST + #error "GDISP Multiple Drivers: You can't specify both GDISP_TOTAL_DISPLAYS and GDISP_DRIVER_LIST" #endif #ifndef GDISP_PIXELFORMAT #error "GDISP Multiple Drivers: You must specify a value for GDISP_PIXELFORMAT when using GDISP_DRIVER_LIST"