Some cleaning.
Fixed and tested DMA blitarea for SSD1963.
This commit is contained in:
parent
8e89654081
commit
da83b0955f
3 changed files with 71 additions and 60 deletions
|
@ -185,19 +185,22 @@ bool_t GDISP_LLD(init)(void) {
|
||||||
|
|
||||||
#if defined(LCD_USE_FSMC)
|
#if defined(LCD_USE_FSMC)
|
||||||
|
|
||||||
|
#if defined(STM32F1XX) || defined(STM32F3XX)
|
||||||
|
/* FSMC setup for F1/F3 */
|
||||||
|
rccEnableAHB(RCC_AHBENR_FSMCEN, 0);
|
||||||
|
|
||||||
|
#if defined(LCD_USE_DMA) && defined(LCD_DMA_STREAM)
|
||||||
|
#error "DMA not implemented for F1/F3 Devices"
|
||||||
|
#endif
|
||||||
|
#elif defined(STM32F4XX) || defined(STM32F2XX)
|
||||||
|
/* STM32F2-F4 FSMC init */
|
||||||
|
rccEnableAHB3(RCC_AHB3ENR_FSMCEN, 0);
|
||||||
|
|
||||||
#if defined(LCD_USE_DMA) && defined(LCD_DMA_STREAM)
|
#if defined(LCD_USE_DMA) && defined(LCD_DMA_STREAM)
|
||||||
if (dmaStreamAllocate(LCD_DMA_STREAM, 0, NULL, NULL)) chSysHalt();
|
if (dmaStreamAllocate(LCD_DMA_STREAM, 0, NULL, NULL)) chSysHalt();
|
||||||
dmaStreamSetMemory0(LCD_DMA_STREAM, &LCD_RAM);
|
dmaStreamSetMemory0(LCD_DMA_STREAM, &LCD_RAM);
|
||||||
dmaStreamSetMode(LCD_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);
|
dmaStreamSetMode(LCD_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(STM32F1XX) || defined(STM32F3XX)
|
|
||||||
/* FSMC setup for F1/F3 */
|
|
||||||
rccEnableAHB(RCC_AHBENR_FSMCEN, 0);
|
|
||||||
|
|
||||||
#elif defined(STM32F4XX) || defined(STM32F2XX)
|
|
||||||
/* STM32F2-F4 FSMC init */
|
|
||||||
rccEnableAHB3(RCC_AHB3ENR_FSMCEN, 0);
|
|
||||||
#else
|
#else
|
||||||
#error "FSMC not implemented for this device"
|
#error "FSMC not implemented for this device"
|
||||||
#endif
|
#endif
|
||||||
|
@ -388,16 +391,19 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
GDISP_LLD(writestreamstart)();
|
GDISP_LLD(writestreamstart)();
|
||||||
|
|
||||||
#if defined(LCD_USE_FSMC) && defined(LCD_USE_DMA) && defined(LCD_DMA_STREAM)
|
#if defined(LCD_USE_FSMC) && defined(LCD_USE_DMA) && defined(LCD_DMA_STREAM)
|
||||||
uint16_t i, splitarea;
|
uint8_t i;
|
||||||
dmaStreamSetPeripheral(LCD_DMA_STREAM, &color);
|
dmaStreamSetPeripheral(LCD_DMA_STREAM, &color);
|
||||||
for (i = (area/65535)+1; i > 0; i--) {
|
dmaStreamSetMode(LCD_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);
|
||||||
if (i <= 1) splitarea = area%65535; else splitarea = 65535;
|
for (i = area/65535; i; i--) {
|
||||||
dmaStreamSetTransactionSize(LCD_DMA_STREAM, splitarea);
|
dmaStreamSetTransactionSize(LCD_DMA_STREAM, 65535);
|
||||||
dmaStreamEnable(LCD_DMA_STREAM);
|
dmaStreamEnable(LCD_DMA_STREAM);
|
||||||
dmaWaitCompletion(LCD_DMA_STREAM);
|
dmaWaitCompletion(LCD_DMA_STREAM);
|
||||||
}
|
}
|
||||||
|
dmaStreamSetTransactionSize(LCD_DMA_STREAM, area%65535);
|
||||||
|
dmaStreamEnable(LCD_DMA_STREAM);
|
||||||
|
dmaWaitCompletion(LCD_DMA_STREAM);
|
||||||
#else
|
#else
|
||||||
uint32_t index,
|
uint32_t index;
|
||||||
for(index = 0; index < area; index++)
|
for(index = 0; index < area; index++)
|
||||||
GDISP_LLD(writedata)(color);
|
GDISP_LLD(writedata)(color);
|
||||||
#endif //#ifdef LCD_USE_DMA
|
#endif //#ifdef LCD_USE_DMA
|
||||||
|
@ -435,14 +441,17 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
|
|
||||||
#if defined(LCD_USE_FSMC) && defined(LCD_USE_DMA) && defined(LCD_DMA_STREAM)
|
#if defined(LCD_USE_FSMC) && defined(LCD_USE_DMA) && defined(LCD_DMA_STREAM)
|
||||||
uint32_t area = cx*cy;
|
uint32_t area = cx*cy;
|
||||||
uint16_t i, splitarea;
|
uint8_t i;
|
||||||
dmaStreamSetPeripheral(LCD_DMA_STREAM, buffer);
|
dmaStreamSetPeripheral(LCD_DMA_STREAM, buffer);
|
||||||
for (i = (area/65535)+1; i > 0; i--) {
|
dmaStreamSetMode(LCD_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PINC | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);
|
||||||
if (i <= 1) splitarea = area%65535; else splitarea = 65535;
|
for (i = area/65535; i; i--) {
|
||||||
dmaStreamSetTransactionSize(LCD_DMA_STREAM, splitarea);
|
dmaStreamSetTransactionSize(LCD_DMA_STREAM, 65535);
|
||||||
dmaStreamEnable(LCD_DMA_STREAM);
|
dmaStreamEnable(LCD_DMA_STREAM);
|
||||||
dmaWaitCompletion(LCD_DMA_STREAM);
|
dmaWaitCompletion(LCD_DMA_STREAM);
|
||||||
}
|
}
|
||||||
|
dmaStreamSetTransactionSize(LCD_DMA_STREAM, area%65535);
|
||||||
|
dmaStreamEnable(LCD_DMA_STREAM);
|
||||||
|
dmaWaitCompletion(LCD_DMA_STREAM);
|
||||||
#else
|
#else
|
||||||
coord_t endx, endy;
|
coord_t endx, endy;
|
||||||
unsigned lg;
|
unsigned lg;
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver local variables. */
|
/* Driver local variables. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
volatile static struct cal cal = {
|
static volatile struct cal cal = {
|
||||||
1, 1, 0, 0
|
1, 1, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -168,6 +168,7 @@ uint16_t tpReadX(void) {
|
||||||
case landscapeInv:
|
case landscapeInv:
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -193,6 +194,7 @@ uint16_t tpReadY(void) {
|
||||||
case landscapeInv:
|
case landscapeInv:
|
||||||
return SCREEN_WIDTH - x;
|
return SCREEN_WIDTH - x;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tpCalibrate(void) {
|
void tpCalibrate(void) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue