Secure screen DMA transfers (#7657)

Secure DMA write to LCD buffer
This commit is contained in:
3djc
2020-06-02 09:16:41 +02:00
committed by GitHub
parent fb61452671
commit c8b31fc904
+17
View File
@@ -41,6 +41,14 @@ uint32_t CurrentLayer = LCD_FIRST_LAYER;
#define NRST_LOW() do { LCD_GPIO_NRST->BSRRH = LCD_GPIO_PIN_NRST; } while(0)
#define NRST_HIGH() do { LCD_GPIO_NRST->BSRRL = LCD_GPIO_PIN_NRST; } while(0)
static inline bool coordsWithinScreen(coord_t x, coord_t y, coord_t w, coord_t h)
{
if (x < 0 || y < 0 || (x + w) > LCD_W || (y + h) > LCD_H)
return false;
else
return true;
}
static void LCD_AF_GPIOConfig(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
@@ -383,6 +391,9 @@ void DMAFillRect(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, ui
y = desth - (y + h);
#endif
if (dest == displayBuf && !coordsWithinScreen(x, y, w, h))
return;
DMA2D_DeInit();
DMA2D_InitTypeDef DMA2D_InitStruct;
@@ -414,6 +425,9 @@ void DMACopyBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x,
srcy = srch - (srcy + h);
#endif
if (dest == displayBuf && !coordsWithinScreen(x, y, w, h))
return;
DMA2D_DeInit();
DMA2D_InitTypeDef DMA2D_InitStruct;
@@ -454,6 +468,9 @@ void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_
srcy = srch - (srcy + h);
#endif
if (dest == displayBuf && !coordsWithinScreen(x, y, w, h))
return;
DMA2D_DeInit();
DMA2D_InitTypeDef DMA2D_InitStruct;