From e5d69abf020920c31cc721547cf5f0fb9ff9975c Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 17 Dec 2014 10:49:09 +1000 Subject: [PATCH] Update SSD1289 and SSD2119 drivers to support using CCM memory for stack when using DMA. Use GDISP_NO_DMA_FROM_STACK. --- drivers/gdisp/SSD1289/board_SSD1289_template.h | 9 +++++++-- drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c | 16 +++++++++++++--- drivers/gdisp/SSD1289/gdisp_lld_config.h | 2 +- drivers/gdisp/SSD2119/board_SSD2119_template.h | 9 +++++++-- drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c | 16 +++++++++++++--- drivers/gdisp/SSD2119/gdisp_lld_config.h | 2 +- 6 files changed, 42 insertions(+), 12 deletions(-) diff --git a/drivers/gdisp/SSD1289/board_SSD1289_template.h b/drivers/gdisp/SSD1289/board_SSD1289_template.h index b86d9579..346519c4 100644 --- a/drivers/gdisp/SSD1289/board_SSD1289_template.h +++ b/drivers/gdisp/SSD1289/board_SSD1289_template.h @@ -57,8 +57,13 @@ static inline uint16_t read_data(GDisplay *g) { return 0; } -#if defined(GDISP_USE_DMA) || defined(__DOXYGEN__) - //#error "GDISP - SSD1289: This interface does not support DMA" +//Optional define if your board interface supports it +//#define GDISP_USE_DMA TRUE + +// Optional define - valid only when GDISP_USE_DMA is TRUE +//#define GDISP_NO_DMA_FROM_STACK FALSE + +#if defined(GDISP_USE_DMA) && GDISP_USE_DMA static inline void dma_with_noinc(GDisplay *g, color_t *buffer, int area) { (void) g; diff --git a/drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c b/drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c index d49e5268..0af1339e 100644 --- a/drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c +++ b/drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c @@ -31,6 +31,12 @@ #ifndef GDISP_INITIAL_BACKLIGHT #define GDISP_INITIAL_BACKLIGHT 100 #endif +#ifndef GDISP_USE_DMA + #define GDISP_USE_DMA FALSE +#endif +#ifndef GDISP_NO_DMA_FROM_STACK + #define GDISP_NO_DMA_FROM_STACK FALSE +#endif /*===========================================================================*/ /* Driver local functions. */ @@ -229,9 +235,13 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { } #endif -#if GDISP_HARDWARE_FILLS && defined(GDISP_USE_DMA) +#if GDISP_HARDWARE_FILLS && GDISP_USE_DMA LLDSPEC void gdisp_lld_fill_area(GDisplay *g) { - uint16_t c; + #if GDISP_NO_DMA_FROM_STACK + static LLDCOLOR_TYPE c; + #else + LLDCOLOR_TYPE c; + #endif c = gdispColor2Native(g->p.color); acquire_bus(g); @@ -242,7 +252,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { } #endif -#if GDISP_HARDWARE_BITFILLS && defined(GDISP_USE_DMA) +#if GDISP_HARDWARE_BITFILLS && GDISP_USE_DMA #if GDISP_PIXELFORMAT != GDISP_LLD_PIXELFORMAT #error "GDISP: SSD1289: BitBlit is only available in RGB565 pixel format" #endif diff --git a/drivers/gdisp/SSD1289/gdisp_lld_config.h b/drivers/gdisp/SSD1289/gdisp_lld_config.h index 8d327bf9..4b882df1 100644 --- a/drivers/gdisp/SSD1289/gdisp_lld_config.h +++ b/drivers/gdisp/SSD1289/gdisp_lld_config.h @@ -19,7 +19,7 @@ #define GDISP_HARDWARE_STREAM_POS TRUE #define GDISP_HARDWARE_CONTROL TRUE -#if defined(GDISP_USE_DMA) +#if defined(GDISP_USE_DMA) && GDISP_USE_DMA #define GDISP_HARDWARE_FILLS TRUE #if !defined(GDISP_PIXELFORMAT) || GDISP_PIXELFORMAT == 0x2565 // Hardware BitBlts are only supported in native pixel format on this controller diff --git a/drivers/gdisp/SSD2119/board_SSD2119_template.h b/drivers/gdisp/SSD2119/board_SSD2119_template.h index 61c54774..346519c4 100644 --- a/drivers/gdisp/SSD2119/board_SSD2119_template.h +++ b/drivers/gdisp/SSD2119/board_SSD2119_template.h @@ -57,8 +57,13 @@ static inline uint16_t read_data(GDisplay *g) { return 0; } -#if defined(GDISP_USE_DMA) || defined(__DOXYGEN__) - //#error "GDISP - SSD2119: This interface does not support DMA" +//Optional define if your board interface supports it +//#define GDISP_USE_DMA TRUE + +// Optional define - valid only when GDISP_USE_DMA is TRUE +//#define GDISP_NO_DMA_FROM_STACK FALSE + +#if defined(GDISP_USE_DMA) && GDISP_USE_DMA static inline void dma_with_noinc(GDisplay *g, color_t *buffer, int area) { (void) g; diff --git a/drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c b/drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c index 36deeb90..5a789548 100644 --- a/drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c +++ b/drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c @@ -31,6 +31,12 @@ #ifndef GDISP_INITIAL_BACKLIGHT #define GDISP_INITIAL_BACKLIGHT 100 #endif +#ifndef GDISP_USE_DMA + #define GDISP_USE_DMA FALSE +#endif +#ifndef GDISP_NO_DMA_FROM_STACK + #define GDISP_NO_DMA_FROM_STACK FALSE +#endif #include "drivers/gdisp/SSD2119/ssd2119.h" @@ -265,9 +271,13 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay* g) { } #endif -#if GDISP_HARDWARE_FILLS && defined(GDISP_USE_DMA) +#if GDISP_HARDWARE_FILLS && GDISP_USE_DMA LLDSPEC void gdisp_lld_fill_area(GDisplay* g) { - LLDCOLOR_TYPE c; + #if GDISP_NO_DMA_FROM_STACK + static LLDCOLOR_TYPE c; + #else + LLDCOLOR_TYPE c; + #endif c = gdispColor2Native(g->p.color); acquire_bus(g); @@ -278,7 +288,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay* g) { } #endif -#if GDISP_HARDWARE_BITFILLS && defined(GDISP_USE_DMA) +#if GDISP_HARDWARE_BITFILLS && GDISP_USE_DMA #if GDISP_PIXELFORMAT != GDISP_LLD_PIXELFORMAT #error "GDISP: SSD2119: BitBlit is only available in RGB565 pixel format" #endif diff --git a/drivers/gdisp/SSD2119/gdisp_lld_config.h b/drivers/gdisp/SSD2119/gdisp_lld_config.h index 17983807..671c7f79 100644 --- a/drivers/gdisp/SSD2119/gdisp_lld_config.h +++ b/drivers/gdisp/SSD2119/gdisp_lld_config.h @@ -19,7 +19,7 @@ #define GDISP_HARDWARE_STREAM_POS TRUE #define GDISP_HARDWARE_CONTROL TRUE -#if defined(GDISP_USE_DMA) +#if defined(GDISP_USE_DMA) && GDISP_USE_DMA #define GDISP_HARDWARE_FILLS TRUE #if !defined(GDISP_PIXELFORMAT) || GDISP_PIXELFORMAT == 0x2565 // Hardware BitBlts are only supported in native pixel format on this controller