diff options
Diffstat (limited to 'halext/drivers/gdispVMT')
-rw-r--r-- | halext/drivers/gdispVMT/gdisp_lld.c | 249 | ||||
-rw-r--r-- | halext/drivers/gdispVMT/gdisp_lld.mk | 7 | ||||
-rw-r--r-- | halext/drivers/gdispVMT/gdisp_lld_config.h | 67 | ||||
-rw-r--r-- | halext/drivers/gdispVMT/gdisp_lld_driver1.c | 51 | ||||
-rw-r--r-- | halext/drivers/gdispVMT/gdisp_lld_driver2.c | 51 | ||||
-rw-r--r-- | halext/drivers/gdispVMT/readme.txt | 23 |
6 files changed, 448 insertions, 0 deletions
diff --git a/halext/drivers/gdispVMT/gdisp_lld.c b/halext/drivers/gdispVMT/gdisp_lld.c new file mode 100644 index 00000000..1528f470 --- /dev/null +++ b/halext/drivers/gdispVMT/gdisp_lld.c @@ -0,0 +1,249 @@ +/*
+ ChibiOS/RT - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS-LCD-Driver.
+
+ ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS-LCD-Driver is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file gdispVMT/gdisp_lld.c
+ * @brief GDISP Graphics Driver subsystem low level driver source for VMT.
+ *
+ * @addtogroup GDISP
+ * @{
+ */
+
+#include "ch.h"
+#include "hal.h"
+#include "gdisp.h"
+
+#if HAL_USE_GDISP || defined(__DOXYGEN__)
+
+#define GDISP_LLD_NO_STRUCT
+
+/* Include the emulation code for things we don't support */
+#include "gdisp_emulation.c"
+
+/*===========================================================================*/
+/* Driver local definitions. */
+/*===========================================================================*/
+
+#define GDISP_LLD1(x) GDISP_VMT_NAME1(gdisp_lld_##x##_)
+#define GDISP_LLD2(x) GDISP_VMT_NAME2(gdisp_lld_##x##_)
+
+/* Prototypes for lld driver functions */
+bool_t GDISP_LLD1(init)(void);
+void GDISP_LLD1(clear)(color_t color);
+void GDISP_LLD1(drawpixel)(coord_t x, coord_t y, color_t color);
+void GDISP_LLD1(fillarea)(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color);
+void GDISP_LLD1(blitarea)(coord_t x, coord_t y, coord_t cx, coord_t cy, const pixel_t *buffer);
+void GDISP_LLD1(drawline)(coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color);
+#if GDISP_NEED_CIRCLE
+ void GDISP_LLD1(drawcircle)(coord_t x, coord_t y, coord_t radius, color_t color);
+ void GDISP_LLD1(fillcircle)(coord_t x, coord_t y, coord_t radius, color_t color);
+#endif
+#if GDISP_NEED_ELLIPSE
+ void GDISP_LLD1(drawellipse)(coord_t x, coord_t y, coord_t a, coord_t b, color_t color);
+ void GDISP_LLD1(fillellipse)(coord_t x, coord_t y, coord_t a, coord_t b, color_t color);
+#endif
+#if GDISP_NEED_TEXT
+ void GDISP_LLD1(drawchar)(coord_t x, coord_t y, char c, font_t font, color_t color);
+ void GDISP_LLD1(fillchar)(coord_t x, coord_t y, char c, font_t font, color_t color, color_t bgcolor);
+#endif
+#if GDISP_NEED_PIXELREAD
+ color_t GDISP_LLD1(getpixelcolor)(coord_t x, coord_t y);
+#endif
+#if GDISP_NEED_SCROLL
+ void GDISP_LLD1(verticalscroll)(coord_t x, coord_t y, coord_t cx, coord_t cy, int lines, color_t bgcolor);
+#endif
+#if GDISP_NEED_CONTROL
+ void GDISP_LLD1(control)(unsigned what, void *value);
+#endif
+#if GDISP_NEED_QUERY
+ void *GDISP_LLD1(query)(unsigned what);
+#endif
+
+bool_t GDISP_LLD2(init)(void);
+void GDISP_LLD2(clear)(color_t color);
+void GDISP_LLD2(drawpixel)(coord_t x, coord_t y, color_t color);
+void GDISP_LLD2(fillarea)(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color);
+void GDISP_LLD2(blitarea)(coord_t x, coord_t y, coord_t cx, coord_t cy, const pixel_t *buffer);
+void GDISP_LLD2(drawline)(coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color);
+#if GDISP_NEED_CIRCLE
+ void GDISP_LLD2(drawcircle)(coord_t x, coord_t y, coord_t radius, color_t color);
+ void GDISP_LLD2(fillcircle)(coord_t x, coord_t y, coord_t radius, color_t color);
+#endif
+#if GDISP_NEED_ELLIPSE
+ void GDISP_LLD2(drawellipse)(coord_t x, coord_t y, coord_t a, coord_t b, color_t color);
+ void GDISP_LLD2(fillellipse)(coord_t x, coord_t y, coord_t a, coord_t b, color_t color);
+#endif
+#if GDISP_NEED_TEXT
+ void GDISP_LLD2(drawchar)(coord_t x, coord_t y, char c, font_t font, color_t color);
+ void GDISP_LLD2(fillchar)(coord_t x, coord_t y, char c, font_t font, color_t color, color_t bgcolor);
+#endif
+#if GDISP_NEED_PIXELREAD
+ color_t GDISP_LLD2(getpixelcolor)(coord_t x, coord_t y);
+#endif
+#if GDISP_NEED_SCROLL
+ void GDISP_LLD2(verticalscroll)(coord_t x, coord_t y, coord_t cx, coord_t cy, int lines, color_t bgcolor);
+#endif
+#if GDISP_NEED_CONTROL
+ void GDISP_LLD2(control)(unsigned what, void *value);
+#endif
+#if GDISP_NEED_QUERY
+ void *GDISP_LLD2(query)(unsigned what);
+#endif
+
+/*===========================================================================*/
+/* Driver exported variables. */
+/*===========================================================================*/
+
+/* Our VMT table variables */
+void GDISP_LLD_VMT(clear)(color_t color);
+void GDISP_LLD_VMT(drawpixel)(coord_t x, coord_t y, color_t color);
+void GDISP_LLD_VMT(fillarea)(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color);
+void GDISP_LLD_VMT(blitarea)(coord_t x, coord_t y, coord_t cx, coord_t cy, const pixel_t *buffer);
+void GDISP_LLD_VMT(drawline)(coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color);
+
+#if GDISP_NEED_CIRCLE
+void GDISP_LLD_VMT(drawcircle)(coord_t x, coord_t y, coord_t radius, color_t color);
+void GDISP_LLD_VMT(fillcircle)(coord_t x, coord_t y, coord_t radius, color_t color);
+#endif
+
+#if GDISP_NEED_ELLIPSE
+void GDISP_LLD_VMT(drawellipse)(coord_t x, coord_t y, coord_t a, coord_t b, color_t color);
+void GDISP_LLD_VMT(fillellipse)(coord_t x, coord_t y, coord_t a, coord_t b, color_t color);
+#endif
+
+/* Text Rendering Functions */
+#if GDISP_NEED_TEXT
+void GDISP_LLD_VMT(drawchar)(coord_t x, coord_t y, char c, font_t font, color_t color);
+void GDISP_LLD_VMT(fillchar)(coord_t x, coord_t y, char c, font_t font, color_t color, color_t bgcolor);
+#endif
+
+/* Pixel readback */
+#if GDISP_NEED_PIXELREAD
+color_t GDISP_LLD_VMT(getpixelcolor)(coord_t x, coord_t y);
+#endif
+
+/* Scrolling Function - clears the area scrolled out */
+#if GDISP_NEED_SCROLL
+void GDISP_LLD_VMT(verticalscroll)(coord_t x, coord_t y, coord_t cx, coord_t cy, int lines, color_t bgcolor);
+#endif
+
+/* Set driver specific control */
+#if GDISP_NEED_CONTROL
+void GDISP_LLD_VMT(control)(unsigned what, void *value);
+#endif
+/* Set driver specific control */
+#if GDISP_NEED_QUERY
+void *GDISP_LLD_VMT(query)(unsigned what);
+#endif
+
+
+/*===========================================================================*/
+/* Driver local variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local functions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver interrupt handlers. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported functions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported functions. */
+/*===========================================================================*/
+
+bool_t gdisp_lld_init_VMT(void) {
+ if (GDISP_VMT_NAME1(gdisp_lld_init_)()) {
+ gdisp_lld_clear_VMT = GDISP_VMT_NAME1(gdisp_lld_clear_);
+ gdisp_lld_drawpixel_VMT = GDISP_VMT_NAME1(gdisp_lld_drawpixel_);
+ gdisp_lld_fillarea_VMT = GDISP_VMT_NAME1(gdisp_lld_fillarea_);
+ gdisp_lld_blitarea_VMT = GDISP_VMT_NAME1(gdisp_lld_blitarea_);
+ gdisp_lld_drawline_VMT = GDISP_VMT_NAME1(gdisp_lld_drawline_);
+ #if GDISP_NEED_CIRCLE
+ gdisp_lld_drawcircle_VMT = GDISP_VMT_NAME1(gdisp_lld_drawcircle_);
+ gdisp_lld_fillcircle_VMT = GDISP_VMT_NAME1(gdisp_lld_fillcircle_);
+ #endif
+ #if GDISP_NEED_ELLIPSE
+ gdisp_lld_drawellipse_VMT = GDISP_VMT_NAME1(gdisp_lld_drawellipse_);
+ gdisp_lld_fillellipse_VMT = GDISP_VMT_NAME1(gdisp_lld_fillellipse_);
+ #endif
+ #if GDISP_NEED_TEXT
+ gdisp_lld_drawchar_VMT = GDISP_VMT_NAME1(gdisp_lld_drawchar_);
+ gdisp_lld_fillchar_VMT = GDISP_VMT_NAME1(gdisp_lld_fillchar_);
+ #endif
+ #if GDISP_NEED_PIXELREAD
+ gdisp_lld_getpixelcolor_VMT = GDISP_VMT_NAME1(gdisp_lld_pixelread_);
+ #endif
+ #if GDISP_NEED_SCROLL
+ gdisp_lld_verticalscroll_VMT = GDISP_VMT_NAME1(gdisp_lld_scroll_);
+ #endif
+ #if GDISP_NEED_CONTROL
+ gdisp_lld_control_VMT = GDISP_VMT_NAME1(gdisp_lld_control_);
+ #endif
+ #if GDISP_NEED_QUERY
+ gdisp_lld_query_VMT = GDISP_VMT_NAME1(gdisp_lld_query_);
+ #endif
+
+ return TRUE;
+ }
+
+ if (GDISP_VMT_NAME2(gdisp_lld_init_)()) {
+ gdisp_lld_clear_VMT = GDISP_VMT_NAME2(gdisp_lld_clear_);
+ gdisp_lld_drawpixel_VMT = GDISP_VMT_NAME2(gdisp_lld_drawpixel_);
+ gdisp_lld_fillarea_VMT = GDISP_VMT_NAME2(gdisp_lld_fillarea_);
+ gdisp_lld_blitarea_VMT = GDISP_VMT_NAME2(gdisp_lld_blitarea_);
+ gdisp_lld_drawline_VMT = GDISP_VMT_NAME2(gdisp_lld_drawline_);
+ #if GDISP_NEED_CIRCLE
+ gdisp_lld_drawcircle_VMT = GDISP_VMT_NAME2(gdisp_lld_drawcircle_);
+ gdisp_lld_fillcircle_VMT = GDISP_VMT_NAME2(gdisp_lld_fillcircle_);
+ #endif
+ #if GDISP_NEED_ELLIPSE
+ gdisp_lld_drawellipse_VMT = GDISP_VMT_NAME2(gdisp_lld_drawellipse_);
+ gdisp_lld_fillellipse_VMT = GDISP_VMT_NAME2(gdisp_lld_fillellipse_);
+ #endif
+ #if GDISP_NEED_TEXT
+ gdisp_lld_drawchar_VMT = GDISP_VMT_NAME2(gdisp_lld_drawchar_);
+ gdisp_lld_fillchar_VMT = GDISP_VMT_NAME2(gdisp_lld_fillchar_);
+ #endif
+ #if GDISP_NEED_PIXELREAD
+ gdisp_lld_getpixelcolor_VMT = GDISP_VMT_NAME2(gdisp_lld_pixelread_);
+ #endif
+ #if GDISP_NEED_SCROLL
+ gdisp_lld_verticalscroll_VMT = GDISP_VMT_NAME2(gdisp_lld_scroll_);
+ #endif
+ #if GDISP_NEED_CONTROL
+ gdisp_lld_control_VMT = GDISP_VMT_NAME2(gdisp_lld_control_);
+ #endif
+ #if GDISP_NEED_QUERY
+ gdisp_lld_query_VMT = GDISP_VMT_NAME2(gdisp_lld_query_);
+ #endif
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+#endif /* HAL_USE_GDISP */
+/** @} */
diff --git a/halext/drivers/gdispVMT/gdisp_lld.mk b/halext/drivers/gdispVMT/gdisp_lld.mk new file mode 100644 index 00000000..ab935370 --- /dev/null +++ b/halext/drivers/gdispVMT/gdisp_lld.mk @@ -0,0 +1,7 @@ +# List the required driver.
+HALSRC += ${CHIBIOS}/os/halext/drivers/gdispVMT/gdisp_lld.c \
+ ${CHIBIOS}/os/halext/drivers/gdispVMT/gdisp_lld_driver1.c \
+ ${CHIBIOS}/os/halext/drivers/gdispVMT/gdisp_lld_driver2.c
+
+# Required include directories
+HALINC += ${CHIBIOS}/os/halext/drivers/gdispVMT
diff --git a/halext/drivers/gdispVMT/gdisp_lld_config.h b/halext/drivers/gdispVMT/gdisp_lld_config.h new file mode 100644 index 00000000..6c6f7c80 --- /dev/null +++ b/halext/drivers/gdispVMT/gdisp_lld_config.h @@ -0,0 +1,67 @@ +/*
+ ChibiOS/RT - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS-LCD-Driver.
+
+ ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS-LCD-Driver is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file gdispVMT/gdisp_lld_config.h
+ * @brief GDISP Graphic Driver subsystem low level driver header template.
+ *
+ * @addtogroup GDISP
+ * @{
+ */
+
+#ifndef _GDISP_LLD_CONFIG_H
+#define _GDISP_LLD_CONFIG_H
+
+#if HAL_USE_GDISP
+
+/*===========================================================================*/
+/* Driver hardware support. */
+/*===========================================================================*/
+
+#define GDISP_DRIVER_NAME "VMT"
+#define GDISP_LLD(x) gdisp_lld_##x##_VMT
+#define GDISP_LLD_VMT(x) (*GDISP_LLD(x))
+
+#define GDISP_HARDWARE_LINES TRUE
+#define GDISP_HARDWARE_CLEARS TRUE
+#define GDISP_HARDWARE_FILLS TRUE
+#define GDISP_HARDWARE_BITFILLS TRUE
+#define GDISP_HARDWARE_CIRCLES TRUE
+#define GDISP_HARDWARE_CIRCLEFILLS TRUE
+#define GDISP_HARDWARE_ELLIPSES TRUE
+#define GDISP_HARDWARE_ELLIPSEFILLS TRUE
+#define GDISP_HARDWARE_TEXT TRUE
+#define GDISP_HARDWARE_TEXTFILLS TRUE
+#define GDISP_HARDWARE_SCROLL TRUE
+#define GDISP_HARDWARE_PIXELREAD TRUE
+#define GDISP_HARDWARE_CONTROL TRUE
+#define GDISP_HARDWARE_QUERY TRUE
+
+#define GDISP_SOFTWARE_TEXTFILLDRAW FALSE
+#define GDISP_SOFTWARE_TEXTBLITCOLUMN FALSE
+
+#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB565
+#define GDISP_PACKED_PIXELS FALSE
+#define GDISP_PACKED_LINES FALSE
+
+#endif /* HAL_USE_GDISP */
+
+#endif /* _GDISP_LLD_CONFIG_H */
+/** @} */
diff --git a/halext/drivers/gdispVMT/gdisp_lld_driver1.c b/halext/drivers/gdispVMT/gdisp_lld_driver1.c new file mode 100644 index 00000000..f088623e --- /dev/null +++ b/halext/drivers/gdispVMT/gdisp_lld_driver1.c @@ -0,0 +1,51 @@ +/*
+ ChibiOS/RT - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS-LCD-Driver.
+
+ ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS-LCD-Driver is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file gdispVMT/gdisp_lld.c
+ * @brief GDISP Graphics Driver subsystem low level driver source for VMT.
+ *
+ * @addtogroup GDISP
+ * @{
+ */
+
+#include "ch.h"
+#include "hal.h"
+
+#if HAL_USE_GDISP || defined(__DOXYGEN__)
+
+#define CONFIGFILE() <../GDISP_VMT_NAME1(gdisp)/gdisp_lld_config.h>
+#define DRIVERFILE() <../GDISP_VMT_NAME1(gdisp)/gdisp_lld.c>
+
+/* We don't need these in our VMT referenced driver */
+#undef GDISP_NEED_MSGAPI
+#define GDISP_NEED_MSGAPI FALSE
+
+/* Include the specific config file we want */
+#include CONFIGFILE()
+
+/* Bring in our API */
+#include "gdisp.h"
+
+/* Add the low level driver */
+#include DRIVERFILE()
+
+#endif /* HAL_USE_GDISP */
+/** @} */
diff --git a/halext/drivers/gdispVMT/gdisp_lld_driver2.c b/halext/drivers/gdispVMT/gdisp_lld_driver2.c new file mode 100644 index 00000000..325a53e6 --- /dev/null +++ b/halext/drivers/gdispVMT/gdisp_lld_driver2.c @@ -0,0 +1,51 @@ +/*
+ ChibiOS/RT - Copyright (C) 2012
+ Joel Bodenmann aka Tectu <joel@unormal.org>
+
+ This file is part of ChibiOS-LCD-Driver.
+
+ ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ChibiOS-LCD-Driver is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file gdispVMT/gdisp_lld.c
+ * @brief GDISP Graphics Driver subsystem low level driver source for VMT.
+ *
+ * @addtogroup GDISP
+ * @{
+ */
+
+#include "ch.h"
+#include "hal.h"
+
+#if HAL_USE_GDISP || defined(__DOXYGEN__)
+
+#define CONFIGFILE() <../GDISP_VMT_NAME2(gdisp)/gdisp_lld_config.h>
+#define DRIVERFILE() <../GDISP_VMT_NAME2(gdisp)/gdisp_lld.c>
+
+/* We don't need these in our VMT referenced driver */
+#undef GDISP_NEED_MSGAPI
+#define GDISP_NEED_MSGAPI FALSE
+
+/* Include the specific config file we want */
+#include CONFIGFILE()
+
+/* Bring in our API */
+#include "gdisp.h"
+
+/* Add the low level driver */
+#include DRIVERFILE()
+
+#endif /* HAL_USE_GDISP */
+/** @} */
diff --git a/halext/drivers/gdispVMT/readme.txt b/halext/drivers/gdispVMT/readme.txt new file mode 100644 index 00000000..91d3f58c --- /dev/null +++ b/halext/drivers/gdispVMT/readme.txt @@ -0,0 +1,23 @@ +This driver enables you to have two underlying drivers handling different hardware.
+A choice is made at run-time of which driver to call based on which driver succeeds
+to initialise first (init returns TRUE).
+
+To use this driver:
+
+1. Add in your halconf.h:
+ a) #define HAL_USE_GDISP TRUE
+ b) Any optional high level driver defines (see gdisp.h) eg: GDISP_NEED_MULTITHREAD
+ c) Define these:
+ #define GDISP_VMT_NAME1(x) x##YourDriver1
+ #define GDISP_VMT_NAME2(x) x##YourDriver2
+ Note YourDriver1 & 2 are the basenames of the directories containing the driver.
+ Note that both drivers must be the same pixel format which is
+ GDISP_PIXELFORMAT_RGB565 by default. Alter gdispVMT/gdisp_lld_config.h if your
+ pixel format is different on both drivers.
+ d) Any driver specific defines. If both drivers use the same defines then they must
+ accept the same values for the define.
+
+2. To your makefile add the following lines:
+ include $(CHIBIOS)/os/halext/halext.mk
+ include $(CHIBIOS)/os/halext/drivers/gdispVMT/gdisp_lld.mk
+
\ No newline at end of file |