aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gdisp/SSD1963
diff options
context:
space:
mode:
authormobyfab <mobyfab@free.fr>2012-09-17 18:49:34 +0200
committermobyfab <mobyfab@free.fr>2012-09-17 18:49:34 +0200
commit9921d74243cad8b8f18cb1dc0265a502f8e3265c (patch)
tree73d6030536ac311d99cf18bfa1bc6ff0a28fabfe /drivers/gdisp/SSD1963
parent819c097750dd8a61c099b993e6e5c705156c77c7 (diff)
downloaduGFX-9921d74243cad8b8f18cb1dc0265a502f8e3265c.tar.gz
uGFX-9921d74243cad8b8f18cb1dc0265a502f8e3265c.tar.bz2
uGFX-9921d74243cad8b8f18cb1dc0265a502f8e3265c.zip
Testing DMA
Diffstat (limited to 'drivers/gdisp/SSD1963')
-rw-r--r--drivers/gdisp/SSD1963/gdisp_lld.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/drivers/gdisp/SSD1963/gdisp_lld.c b/drivers/gdisp/SSD1963/gdisp_lld.c
index 5a80f691..2b4fcaf5 100644
--- a/drivers/gdisp/SSD1963/gdisp_lld.c
+++ b/drivers/gdisp/SSD1963/gdisp_lld.c
@@ -184,6 +184,10 @@ bool_t GDISP_LLD(init)(void) {
/* Initialise the display */
#if defined(LCD_USE_FSMC)
+
+#if defined(LCD_USE_DMA)
+ dmaStreamAllocate(LCD_DMA_STREAM, 0, NULL, NULL);
+#endif //#ifdef LCD_USE_DMA
#if defined(STM32F1XX) || defined(STM32F3XX)
/* FSMC setup for F1/F3 */
@@ -380,9 +384,24 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
GDISP_LLD(setwindow)(x, y, x+cx-1, y+cy-1);
GDISP_LLD(writestreamstart)();
+#if defined(LCD_USE_DMA)
+ if (area > 1000) { // Do not use DMA for small areas
+ dmaStreamSetPeripheral(LCD_DMA_STREAM, &color);
+ dmaStreamSetMemory0(LCD_DMA_STREAM, LCD_RAM);
+ dmaStreamSetTransactionSize(LCD_DMA_STREAM, area);
+ dmaStreamSetMode(LCD_DMA_STREAM, STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M | STM32_DMA_CR_EN);
+
+ while ((LCD_DMA_STREAM)->stream->NDTR > 0) chThdSleepMilliseconds(1);
+ }
+ else {
+ for(index = 0; index < area; index++)
+ GDISP_LLD(writedata)(color);
+ }
+#else
for(index = 0; index < area; index++)
GDISP_LLD(writedata)(color);
- }
+#endif //#ifdef LCD_USE_DMA
+}
#endif
#if GDISP_HARDWARE_BITFILLS || defined(__DOXYGEN__)
@@ -418,9 +437,30 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
endy = y + cy;
lg = srccx - cx;
buffer += srcx + srcy * srccx;
+
+
+#if defined(LCD_USE_DMA)
+ uint32_t area = cx*cy;
+ if (area > 1000) { // Do not use DMA for small areas
+ dmaStreamSetPeripheral(LCD_DMA_STREAM, buffer);
+ dmaStreamSetMemory0(LCD_DMA_STREAM, LCD_RAM);
+ dmaStreamSetTransactionSize(LCD_DMA_STREAM, area);
+ dmaStreamSetMode(LCD_DMA_STREAM, STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_PINC | STM32_DMA_CR_DIR_M2M | STM32_DMA_CR_EN);
+
+ while ((LCD_DMA_STREAM)->stream->NDTR > 0) chThdSleepMilliseconds(1);
+ }
+ else {
+ for(; y < endy; y++, buffer += lg)
+ for(x=srcx; x < endx; x++)
+ GDISP_LLD(writedata)(*buffer++);
+ }
+#else
for(; y < endy; y++, buffer += lg)
for(x=srcx; x < endx; x++)
GDISP_LLD(writedata)(*buffer++);
+#endif //#ifdef LCD_USE_DMA
+
+
}
#endif