Merge branch 'master' into feature/sdl2_threaded
This commit is contained in:
commit
91eeff7457
29 changed files with 449 additions and 292 deletions
|
@ -1773,7 +1773,7 @@ COMPACT_LATEX = NO
|
|||
# The default value is: a4.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
PAPER_TYPE = a4wide
|
||||
PAPER_TYPE = a4
|
||||
|
||||
# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
|
||||
# that should be included in the LaTeX output. The package can be specified just
|
||||
|
|
|
@ -23,8 +23,6 @@ static const SPIConfig spi_cfg = {
|
|||
((1 << 3) & SPI_CR1_BR) | SPI_CR1_SSM | SPI_CR1_SSI | SPI_CR1_MSTR
|
||||
};
|
||||
|
||||
#define ALLOW_2ND_LAYER GFXON
|
||||
|
||||
static const ltdcConfig driverCfg = {
|
||||
240, 320,
|
||||
10, 2,
|
||||
|
@ -47,7 +45,7 @@ static const ltdcConfig driverCfg = {
|
|||
0xFF, // alpha
|
||||
LTDC_LEF_ENABLE // flags
|
||||
},
|
||||
#if ALLOW_2ND_LAYER
|
||||
#if STM32LTDC_USE_LAYER2 || STM32LTDC_USE_DOUBLEBUFFERING
|
||||
{ // Foreground layer config (if turned on)
|
||||
(LLDCOLOR_TYPE *)(SDRAM_BANK_ADDR+(240 * 320 * LTDC_PIXELBYTES)), // Frame buffer address
|
||||
240, 320, // width, height
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
#include "stm32f4xx_hal.h"
|
||||
#include "stm324x9i_eval_sdram.h"
|
||||
|
||||
#define ALLOW_2ND_LAYER GFXON
|
||||
|
||||
// Panel parameters
|
||||
// This panel is a AMPIRE640480 panel.
|
||||
|
||||
|
@ -48,7 +46,7 @@ static const ltdcConfig driverCfg = {
|
|||
LTDC_LEF_ENABLE // Layer configuration flags
|
||||
},
|
||||
|
||||
#if ALLOW_2ND_LAYER
|
||||
#if STM32LTDC_USE_LAYER2 || STM32LTDC_USE_DOUBLEBUFFERING
|
||||
{ // Foreground layer config (if turned on)
|
||||
(LLDCOLOR_TYPE *)(SDRAM_DEVICE_ADDR+(640 * 480 * LTDC_PIXELBYTES)), // Frame buffer address
|
||||
640, 480, // Width, Height (pixels)
|
||||
|
|
|
@ -36,8 +36,6 @@
|
|||
#define AFRH AFR[1]
|
||||
#endif
|
||||
|
||||
#define ALLOW_2ND_LAYER GFXON
|
||||
|
||||
static const ltdcConfig driverCfg = {
|
||||
480, 272, // Width, Height (pixels)
|
||||
41, 10, // Horizontal, Vertical sync (pixels)
|
||||
|
@ -62,7 +60,7 @@ static const ltdcConfig driverCfg = {
|
|||
LTDC_LEF_ENABLE // Layer configuration flags
|
||||
},
|
||||
|
||||
#if ALLOW_2ND_LAYER
|
||||
#if STM32LTDC_USE_LAYER2 || STM32LTDC_USE_DOUBLEBUFFERING
|
||||
{ // Foreground layer config (if turned on)
|
||||
(LLDCOLOR_TYPE *)(SDRAM_DEVICE_ADDR+(480 * 272 * LTDC_PIXELBYTES)), // Frame buffer address
|
||||
480, 272, // Width, Height (pixels)
|
||||
|
@ -393,6 +391,27 @@ static void configureLcdPins(void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
static GFXINLINE void init_ltdc_clock(void)
|
||||
{
|
||||
// Reset the LTDC peripheral
|
||||
RCC->APB2RSTR |= RCC_APB2RSTR_LTDCRST;
|
||||
RCC->APB2RSTR = 0;
|
||||
|
||||
// Enable the LTDC clock
|
||||
RCC->DCKCFGR1 = (RCC->DCKCFGR1 & ~RCC_DCKCFGR1_PLLSAIDIVR) | (1 << 16);
|
||||
|
||||
// Enable the peripheral
|
||||
RCC->APB2ENR |= RCC_APB2ENR_LTDCEN;
|
||||
}
|
||||
|
||||
#if STM32LTDC_USE_DMA2D
|
||||
static GFXINLINE void init_dma2d_clock(void)
|
||||
{
|
||||
// Enable DMA2D clock
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2DEN;
|
||||
}
|
||||
#endif
|
||||
|
||||
static GFXINLINE void init_board(GDisplay *g) {
|
||||
(void) g;
|
||||
|
||||
|
|
|
@ -66,11 +66,11 @@
|
|||
#include "stm32f7xx.h"
|
||||
|
||||
#if !defined (HSE_VALUE)
|
||||
#define HSE_VALUE ((gU32)25000000) /*!< Default value of the External oscillator in Hz */
|
||||
#define HSE_VALUE ((uint32_t)25000000) /*!< Default value of the External oscillator in Hz */
|
||||
#endif /* HSE_VALUE */
|
||||
|
||||
#if !defined (HSI_VALUE)
|
||||
#define HSI_VALUE ((gU32)16000000) /*!< Value of the Internal oscillator in Hz*/
|
||||
#define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
|
||||
#endif /* HSI_VALUE */
|
||||
|
||||
/**
|
||||
|
@ -125,9 +125,9 @@
|
|||
is no need to call the 2 first functions listed above, since SystemCoreClock
|
||||
variable is updated automatically.
|
||||
*/
|
||||
gU32 SystemCoreClock = 16000000;
|
||||
const gU8 AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
||||
const gU8 APBPrescTable[8] = {0, 0, 0, 0, 1, 2, 3, 4};
|
||||
uint32_t SystemCoreClock = 16000000;
|
||||
const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
|
||||
const uint8_t APBPrescTable[8] = {0, 0, 0, 0, 1, 2, 3, 4};
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -163,19 +163,19 @@ void SystemInit(void)
|
|||
#endif
|
||||
/* Reset the RCC clock configuration to the default reset state ------------*/
|
||||
/* Set HSION bit */
|
||||
RCC->CR |= (gU32)0x00000001;
|
||||
RCC->CR |= (uint32_t)0x00000001;
|
||||
|
||||
/* Reset CFGR register */
|
||||
RCC->CFGR = 0x00000000;
|
||||
|
||||
/* Reset HSEON, CSSON and PLLON bits */
|
||||
RCC->CR &= (gU32)0xFEF6FFFF;
|
||||
RCC->CR &= (uint32_t)0xFEF6FFFF;
|
||||
|
||||
/* Reset PLLCFGR register */
|
||||
RCC->PLLCFGR = 0x24003010;
|
||||
|
||||
/* Reset HSEBYP bit */
|
||||
RCC->CR &= (gU32)0xFFFBFFFF;
|
||||
RCC->CR &= (uint32_t)0xFFFBFFFF;
|
||||
|
||||
/* Disable all interrupts */
|
||||
RCC->CIR = 0x00000000;
|
||||
|
@ -230,7 +230,7 @@ void SystemInit(void)
|
|||
*/
|
||||
void SystemCoreClockUpdate(void)
|
||||
{
|
||||
gU32 tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2;
|
||||
uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2;
|
||||
|
||||
/* Get SYSCLK source -------------------------------------------------------*/
|
||||
tmp = RCC->CFGR & RCC_CFGR_SWS;
|
||||
|
@ -287,8 +287,8 @@ void SystemCoreClockUpdate(void)
|
|||
*/
|
||||
void SystemInit_ExtMemCtl(void)
|
||||
{
|
||||
register gU32 tmpreg = 0, timeout = 0xFFFF;
|
||||
register __IO gU32 index;
|
||||
register uint32_t tmpreg = 0, timeout = 0xFFFF;
|
||||
register __IO uint32_t index;
|
||||
|
||||
/* Enable GPIOC, GPIOD, GPIOE, GPIOF, GPIOG and GPIOH interface
|
||||
clock */
|
||||
|
|
|
@ -6,6 +6,18 @@
|
|||
CHANGE: Added type gImage to replace V2.x gdispImage
|
||||
FIX: Fixed GWIN console widget scroll
|
||||
FIX: A warning and adjusted is made if GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE is less than 40 bytes.
|
||||
FIX: Prevent compiler warnings on duplicate const specifiers.
|
||||
FEATURE: Added support for ChibiOS 6.x kernel.
|
||||
CHANGE: STM32LTDC driver: Refactor to outsource clock setup for LTDC & DMA2D peripherals to the board file.
|
||||
CHANGE: STM32LTDC driver: Remove obsolete LTDC_NO_CLOCK_INIT macro as this clock setup is now outsourced to the board file.
|
||||
CHANGE: STM32LTDC driver: Automatically enable DMA cache flushing on STM32H7 platforms.
|
||||
CHANGE: STM32LTDC driver: Rename LTDC_USE_DMA2D to STM32LTDC_USE_DMA2D.
|
||||
CHANGE: STM32LTDC driver: Rename ALLOW_2ND_LAYER to STM32LTDC_USE_LAYER2.
|
||||
CHANGE: STM32LTDC driver: Rename LTDC_DMA_CACHE_FLUSH to STM32LTDC_DMA_CACHE_FLUSH.
|
||||
CHANGE: STM32LTDC driver: Rename GDISP_LTDC_USE_RGB565 to STM32LTDC_USE_RGB565.
|
||||
FEATURE: STM32LTDC driver: Support double buffering. This introduces STM32LTDC_USE_DOUBLEBUFFERING.
|
||||
FIX: STM32LTDC driver: Fix bug in gdisp_lld_blit_area() which affected blits with source coordinates other than (0, 0).
|
||||
FIX: Improve /demos/benchmarks/rectangles
|
||||
|
||||
|
||||
*** Release 2.9 ***
|
||||
|
|
|
@ -48,5 +48,10 @@
|
|||
/* Builtin Fonts */
|
||||
#define GDISP_INCLUDE_FONT_UI2 GFXON
|
||||
|
||||
/* GFILE */
|
||||
#define GFX_USE_GFILE GFXON
|
||||
#define GFILE_NEED_PRINTG GFXON
|
||||
#define GFILE_NEED_STRINGS GFXON
|
||||
|
||||
#endif /* _GFXCONF_H */
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu <joel@unormal.org>
|
||||
* Copyright (c) 2012, 2013, Andrew Hannam aka inmarket
|
||||
* Copyright (c) 2012 - 2021, Joel Bodenmann aka Tectu <joel@ugfx.io>
|
||||
* Copyright (c) 2012 - 2021, Andrew Hannam aka inmarket <inmarket@ugfx.io>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -31,87 +31,33 @@
|
|||
#include "string.h"
|
||||
#include "gfx.h"
|
||||
|
||||
#define SCB_DEMCR (*(volatile unsigned *)0xE000EDFC)
|
||||
#define CPU_RESET_CYCLECOUNTER do { SCB_DEMCR = SCB_DEMCR | 0x01000000; \
|
||||
DWT_CYCCNT = 0; \
|
||||
DWT_CTRL = DWT_CTRL | 1 ; } while(0)
|
||||
#define RESULT_STR_LENGTH 32
|
||||
|
||||
static int uitoa(unsigned int value, char * buf, int max) {
|
||||
int n = 0;
|
||||
int i = 0;
|
||||
unsigned int tmp = 0;
|
||||
|
||||
if (!buf)
|
||||
return -3;
|
||||
|
||||
if (2 > max)
|
||||
return -4;
|
||||
|
||||
i=1;
|
||||
tmp = value;
|
||||
if (0 > tmp) {
|
||||
tmp *= -1;
|
||||
i++;
|
||||
}
|
||||
for (;;) {
|
||||
tmp /= 10;
|
||||
if (0 >= tmp)
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
if (i >= max) {
|
||||
buf[0] = '?';
|
||||
buf[1] = 0x0;
|
||||
return 2;
|
||||
}
|
||||
|
||||
n = i;
|
||||
tmp = value;
|
||||
if (0 > tmp) {
|
||||
tmp *= -1;
|
||||
}
|
||||
buf[i--] = 0x0;
|
||||
for (;;) {
|
||||
buf[i--] = (tmp % 10) + '0';
|
||||
tmp /= 10;
|
||||
if (0 >= tmp) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (-1 != i) {
|
||||
buf[i--] = '-';
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
void benchmark(void) {
|
||||
gU32 i, pixels, ms, pps;
|
||||
char pps_str[25];
|
||||
void benchmark(void)
|
||||
{
|
||||
gCoord height, width, rx, ry, rcx, rcy;
|
||||
gColor random_color;
|
||||
gCoord fontHeight;
|
||||
gFont font;
|
||||
|
||||
gdispSetOrientation(gOrientation90);
|
||||
|
||||
// Prepare resources
|
||||
width = gdispGetWidth();
|
||||
height = gdispGetHeight();
|
||||
font = gdispOpenFont("UI2 Double");
|
||||
font = gdispOpenFont("*");
|
||||
fontHeight = gdispGetFontMetric(font, gFontHeight);
|
||||
|
||||
gdispDrawStringBox(0, 0, width, 30, "ChibiOS/GFX - Benchmark", font, GFX_WHITE, gJustifyCenter);
|
||||
|
||||
font = gdispOpenFont("UI2");
|
||||
// Show intro message
|
||||
gdispDrawStringBox(0, 0, width, 30, "uGFX - Benchmark", font, GFX_WHITE, gJustifyCenter);
|
||||
gdispDrawStringBox(0, height/2, width, 30, "5000 random rectangles", font, GFX_WHITE, gJustifyCenter);
|
||||
|
||||
gfxSleepMilliseconds(3000);
|
||||
|
||||
/* seed for the rand() */
|
||||
srand(DWT_CYCCNT);
|
||||
pixels = 0;
|
||||
// Seed RNG
|
||||
srand(0);
|
||||
|
||||
CPU_RESET_CYCLECOUNTER;
|
||||
|
||||
for (i = 0; i < 5000; i++) {
|
||||
// Render rectangles and count ticks & pixels
|
||||
gU64 pixels = 0;
|
||||
const gTicks ticksStart = gfxSystemTicks();
|
||||
for (gU32 i = 0; i < 5000; i++) {
|
||||
random_color = (rand() % 65535);
|
||||
rx = (rand() % (width-10));
|
||||
ry = (rand() % (height-10));
|
||||
|
@ -121,19 +67,33 @@ void benchmark(void) {
|
|||
gdispFillArea(rx, ry, rcx, rcy, random_color);
|
||||
pixels += (rcx+1)*(rcy+1);
|
||||
}
|
||||
const gTicks ticksEnd = gfxSystemTicks();
|
||||
|
||||
ms = DWT_CYCCNT / 168000;
|
||||
pps = (float)pixels/((float)ms/1000.0f);
|
||||
// Calculate result
|
||||
char str_ticks[RESULT_STR_LENGTH];
|
||||
char str_seconds[RESULT_STR_LENGTH];
|
||||
char str_pps[RESULT_STR_LENGTH];
|
||||
{
|
||||
// Figure out how many ticks are 1 second
|
||||
const gTicks ticksPerSecond = gfxMillisecondsToTicks(1000);
|
||||
|
||||
memset (pps_str, 0, sizeof(pps_str));
|
||||
uitoa(pps, pps_str, sizeof(pps_str));
|
||||
strcat(pps_str, " Pixels/s");
|
||||
const gTicks ticksElapsed = ticksEnd - ticksStart;
|
||||
const float secondsElapsed = (float)ticksElapsed / (float)ticksPerSecond;
|
||||
gU32 pps = (float)pixels / secondsElapsed;
|
||||
|
||||
font = gdispOpenFont("UI2 Double");
|
||||
// Produce strings
|
||||
memset(str_ticks, 0, RESULT_STR_LENGTH);
|
||||
memset(str_seconds, 0, RESULT_STR_LENGTH);
|
||||
memset(str_pps, 0, RESULT_STR_LENGTH);
|
||||
snprintg(str_ticks, RESULT_STR_LENGTH, "%d ticks", ticksElapsed);
|
||||
snprintg(str_pps, RESULT_STR_LENGTH, "%d pixels/s", pps);
|
||||
}
|
||||
|
||||
// Show result
|
||||
gdispClear(GFX_BLACK);
|
||||
gdispDrawStringBox(0, 0, width, 30, "ChibiOS/GFX - Benchmark", font, GFX_WHITE, gJustifyCenter);
|
||||
gdispDrawStringBox(0, height/2, width, 30, pps_str, font, GFX_WHITE, gJustifyCenter);
|
||||
//gdispDrawString(20, height/2, pps_str, font, GFX_WHITE);
|
||||
gdispDrawStringBox(0, 0, width, 30, "uGFX - Benchmark", font, GFX_WHITE, gJustifyCenter);
|
||||
gdispDrawStringBox(0, height/2+0*(fontHeight+10), width, 30, str_ticks, font, GFX_WHITE, gJustifyCenter);
|
||||
gdispDrawStringBox(0, height/2+1*(fontHeight+10), width, 30, str_pps, font, GFX_WHITE, gJustifyCenter);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
|
@ -141,9 +101,8 @@ int main(void) {
|
|||
|
||||
benchmark();
|
||||
|
||||
while(1) {
|
||||
while (gTrue)
|
||||
gfxSleepMilliseconds(500);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -42,7 +42,6 @@
|
|||
#define GDISP_NEED_VALIDATION GFXON
|
||||
#define GDISP_NEED_CLIP GFXON
|
||||
#define GDISP_NEED_TEXT GFXON
|
||||
#define GDISP_NEED_ANTIALIAS GFXON
|
||||
#define GDISP_NEED_UTF8 GFXON
|
||||
#define GDISP_NEED_TEXT_KERNING GFXON
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ static const char* FrenchStrings[] = {
|
|||
};
|
||||
static const transTable FrenchTranslation = { sizeof(FrenchStrings)/sizeof(FrenchStrings[0]), FrenchStrings };
|
||||
|
||||
void updateText()
|
||||
void updateText(void)
|
||||
{
|
||||
gCoord width = 400;
|
||||
gCoord height = 30;
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#ifndef _GDISP_LLD_BOARD_H
|
||||
#define _GDISP_LLD_BOARD_H
|
||||
|
||||
#define ALLOW_2ND_LAYER GFXON
|
||||
|
||||
static const ltdcConfig driverCfg = {
|
||||
480, 272, // Width, Height (pixels)
|
||||
41, 10, // Horizontal, Vertical sync (pixels)
|
||||
|
@ -34,7 +32,7 @@ static const ltdcConfig driverCfg = {
|
|||
LTDC_LEF_ENABLE // Layer configuration flags
|
||||
},
|
||||
|
||||
#if ALLOW_2ND_LAYER
|
||||
#if STM32LTDC_USE_LAYER2 || STM32LTDC_USE_DOUBLEBUFFERING
|
||||
{ // Foreground layer config (if turned on)
|
||||
(LLDCOLOR_TYPE *)(SDRAM_DEVICE_ADDR+(480 * 272 * LTDC_PIXELBYTES)), // Frame buffer address
|
||||
480, 272, // Width, Height (pixels)
|
||||
|
@ -55,7 +53,20 @@ static const ltdcConfig driverCfg = {
|
|||
#endif
|
||||
};
|
||||
|
||||
static GFXINLINE void init_board(GDisplay* g) {
|
||||
static GFXINLINE void init_ltdc_clock(void)
|
||||
{
|
||||
// Setup LTDC clock and enable the peripheral
|
||||
}
|
||||
|
||||
#if STM32LTDC_USE_DMA2D
|
||||
static GFXINLINE void init_dma2d_clock(void)
|
||||
{
|
||||
// Setup DMA2D clock and enable the peripheral
|
||||
}
|
||||
#endif
|
||||
|
||||
static GFXINLINE void init_board(GDisplay* g)
|
||||
{
|
||||
// This is function only called once with the display for the background layer.
|
||||
(void)g;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
#define GDISP_DRIVER_VMT GDISPVMT_STM32LTDC
|
||||
#include "gdisp_lld_config.h"
|
||||
#include "../../../src/gdisp/gdisp_driver.h"
|
||||
#include "stm32_ltdc.h"
|
||||
#if STM32LTDC_USE_DMA2D
|
||||
#include "stm32_dma2d.h"
|
||||
#endif
|
||||
|
||||
#if defined(GDISP_SCREEN_HEIGHT) || defined(GDISP_SCREEN_HEIGHT)
|
||||
#if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
|
||||
|
@ -23,28 +27,38 @@
|
|||
#undef GDISP_SCREEN_HEIGHT
|
||||
#endif
|
||||
|
||||
#ifndef LTDC_USE_DMA2D
|
||||
#define LTDC_USE_DMA2D GFXOFF
|
||||
#ifndef STM32LTDC_DMA_CACHE_FLUSH
|
||||
#define STM32LTDC_DMA_CACHE_FLUSH GFXOFF
|
||||
#endif
|
||||
#ifndef LTDC_NO_CLOCK_INIT
|
||||
#define LTDC_NO_CLOCK_INIT GFXOFF
|
||||
#ifndef STM32LTDC_USE_DMA2D
|
||||
#define STM32LTDC_USE_DMA2D GFXOFF
|
||||
#endif
|
||||
#ifndef LTDC_DMA_CACHE_FLUSH
|
||||
#define LTDC_DMA_CACHE_FLUSH GFXOFF
|
||||
#ifndef STM32LTDC_USE_LAYER2
|
||||
#define STM32LTDC_USE_LAYER2 GFXOFF
|
||||
#endif
|
||||
#ifndef STM32LTDC_USE_RGB565
|
||||
#define STM32LTDC_USE_RGB565 GFXOFF
|
||||
#endif
|
||||
|
||||
#include "stm32_ltdc.h"
|
||||
// Prevent usage of 2nd layer and double buffering at the same time.
|
||||
// See readme.md for more inforamtion.
|
||||
#if STM32LTDC_USE_LAYER2 && STM32LTDC_USE_DOUBLEBUFFERING
|
||||
#error "GDISP - STM32LTDC: Cannot use 2nd LTDC layer and double buffering at the same time. See the driver's readme.md for more information."
|
||||
#endif
|
||||
|
||||
#if LTDC_USE_DMA2D
|
||||
#include "stm32_dma2d.h"
|
||||
// Double buffering requires GDISP_NEED_CONTROL for the buffer swap command
|
||||
#if STM32LTDC_USE_DOUBLEBUFFERING && !GDISP_NEED_CONTROL
|
||||
#error "GDISP - STM32LTDC: Double buffering requires GDISP_NEED_CONTROL."
|
||||
#endif
|
||||
|
||||
#if defined(STM32F7) || defined(STM32F746xx)
|
||||
#undef LTDC_DMA_CACHE_FLUSH
|
||||
#define LTDC_DMA_CACHE_FLUSH GFXON
|
||||
// Force DMA cache flushing on certain platforms/systems.
|
||||
#if STM32LTDC_USE_DMA2D
|
||||
#if defined(STM32F7) || defined(STM32H7) || defined(STM32F746xx)
|
||||
#undef STM32LTDC_DMA_CACHE_FLUSH
|
||||
#define STM32LTDC_DMA_CACHE_FLUSH GFXON
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct ltdcLayerConfig {
|
||||
// Frame
|
||||
LLDCOLOR_TYPE* frame; // Frame buffer address
|
||||
|
@ -108,7 +122,7 @@ typedef struct ltdcConfig {
|
|||
/* Driver local routines. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#define PIXIL_POS(g, x, y) ((y) * ((ltdcLayerConfig *)g->priv)->pitch + (x) * LTDC_PIXELBYTES)
|
||||
#define PIXEL_POS(g, x, y) ((y) * ((ltdcLayerConfig *)g->priv)->pitch + (x) * LTDC_PIXELBYTES)
|
||||
#define PIXEL_ADDR(g, pos) ((LLDCOLOR_TYPE *)((gU8 *)((ltdcLayerConfig *)g->priv)->frame+pos))
|
||||
|
||||
/*===========================================================================*/
|
||||
|
@ -166,25 +180,8 @@ static void _ltdc_init(void) {
|
|||
// Set up the display scanning
|
||||
gU32 hacc, vacc;
|
||||
|
||||
// Reset the LTDC peripheral
|
||||
RCC->APB2RSTR |= RCC_APB2RSTR_LTDCRST;
|
||||
RCC->APB2RSTR = 0;
|
||||
|
||||
// Enable the LTDC clock
|
||||
#if !LTDC_NO_CLOCK_INIT
|
||||
#if defined(STM32F469xx)
|
||||
RCC->DCKCFGR = (RCC->DCKCFGR & ~RCC_DCKCFGR_PLLSAIDIVR);
|
||||
#elif defined(STM32F4) || defined(STM32F429_439xx) || defined(STM32F429xx)
|
||||
RCC->DCKCFGR = (RCC->DCKCFGR & ~RCC_DCKCFGR_PLLSAIDIVR) | (1 << 16);
|
||||
#elif defined(STM32F7) || defined(STM32F746xx)
|
||||
RCC->DCKCFGR1 = (RCC->DCKCFGR1 & ~RCC_DCKCFGR1_PLLSAIDIVR) | (1 << 16);
|
||||
#else
|
||||
#error STM32LTDC driver not implemented for your platform
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Enable the peripheral
|
||||
RCC->APB2ENR |= RCC_APB2ENR_LTDCEN;
|
||||
// Let the board handle LTDC clock setups
|
||||
init_ltdc_clock();
|
||||
|
||||
// Turn off the controller and its interrupts
|
||||
LTDC->GCR = 0;
|
||||
|
@ -239,7 +236,8 @@ LLDSPEC gBool gdisp_lld_init(GDisplay* g) {
|
|||
g->board = 0;
|
||||
|
||||
switch(g->controllerdisplay) {
|
||||
case 0: // Display 0 is the background layer
|
||||
// Display 0 is the background layer
|
||||
case 0:
|
||||
// Init the board
|
||||
init_board(g);
|
||||
|
||||
|
@ -247,7 +245,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay* g) {
|
|||
_ltdc_init();
|
||||
|
||||
// Initialise DMA2D
|
||||
#if LTDC_USE_DMA2D
|
||||
#if STM32LTDC_USE_DMA2D
|
||||
dma2d_init();
|
||||
#endif
|
||||
|
||||
|
@ -264,8 +262,11 @@ LLDSPEC gBool gdisp_lld_init(GDisplay* g) {
|
|||
|
||||
break;
|
||||
|
||||
case 1: // Display 1 is the foreground layer
|
||||
// Display 1 is the foreground layer or the 2nd buffer for double buffering
|
||||
case 1:
|
||||
g->priv = (void *)&driverCfg.fglayer;
|
||||
|
||||
#if STM32LTDC_USE_LAYER2
|
||||
if (!(driverCfg.fglayer.layerflags & LTDC_LEF_ENABLE))
|
||||
return gFalse;
|
||||
|
||||
|
@ -273,14 +274,14 @@ LLDSPEC gBool gdisp_lld_init(GDisplay* g) {
|
|||
_ltdc_layer_init(LTDC_Layer2, &driverCfg.fglayer);
|
||||
_ltdc_reload();
|
||||
|
||||
g->priv = (void *)&driverCfg.fglayer;
|
||||
|
||||
// Finish Init the board
|
||||
post_init_board(g);
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
||||
default: // There is only 1 LTDC in the CPU and only the 2 layers in the LTDC.
|
||||
// There is only 1 LTDC in the CPU and only the 2 layers in the LTDC.
|
||||
default:
|
||||
return gFalse;
|
||||
}
|
||||
|
||||
|
@ -300,25 +301,27 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay* g) {
|
|||
|
||||
#if GDISP_NEED_CONTROL
|
||||
switch(g->g.Orientation) {
|
||||
case gOrientationPortrait:
|
||||
case gOrientationLandscape:
|
||||
case gOrientation0:
|
||||
default:
|
||||
pos = PIXIL_POS(g, g->p.x, g->p.y);
|
||||
pos = PIXEL_POS(g, g->p.x, g->p.y);
|
||||
break;
|
||||
case gOrientation90:
|
||||
pos = PIXIL_POS(g, g->p.y, g->g.Width-g->p.x-1);
|
||||
pos = PIXEL_POS(g, g->p.y, g->g.Width-g->p.x-1);
|
||||
break;
|
||||
case gOrientation180:
|
||||
pos = PIXIL_POS(g, g->g.Width-g->p.x-1, g->g.Height-g->p.y-1);
|
||||
pos = PIXEL_POS(g, g->g.Width-g->p.x-1, g->g.Height-g->p.y-1);
|
||||
break;
|
||||
case gOrientation270:
|
||||
pos = PIXIL_POS(g, g->g.Height-g->p.y-1, g->p.x);
|
||||
pos = PIXEL_POS(g, g->g.Height-g->p.y-1, g->p.x);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
pos = PIXIL_POS(g, g->p.x, g->p.y);
|
||||
pos = PIXEL_POS(g, g->p.x, g->p.y);
|
||||
#endif
|
||||
|
||||
#if LTDC_USE_DMA2D
|
||||
#if STM32LTDC_USE_DMA2D
|
||||
while(DMA2D->CR & DMA2D_CR_START);
|
||||
#endif
|
||||
|
||||
|
@ -338,25 +341,27 @@ LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay* g) {
|
|||
|
||||
#if GDISP_NEED_CONTROL
|
||||
switch(g->g.Orientation) {
|
||||
case gOrientationPortrait:
|
||||
case gOrientationLandscape:
|
||||
case gOrientation0:
|
||||
default:
|
||||
pos = PIXIL_POS(g, g->p.x, g->p.y);
|
||||
pos = PIXEL_POS(g, g->p.x, g->p.y);
|
||||
break;
|
||||
case gOrientation90:
|
||||
pos = PIXIL_POS(g, g->p.y, g->g.Width-g->p.x-1);
|
||||
pos = PIXEL_POS(g, g->p.y, g->g.Width-g->p.x-1);
|
||||
break;
|
||||
case gOrientation180:
|
||||
pos = PIXIL_POS(g, g->g.Width-g->p.x-1, g->g.Height-g->p.y-1);
|
||||
pos = PIXEL_POS(g, g->g.Width-g->p.x-1, g->g.Height-g->p.y-1);
|
||||
break;
|
||||
case gOrientation270:
|
||||
pos = PIXIL_POS(g, g->g.Height-g->p.y-1, g->p.x);
|
||||
pos = PIXEL_POS(g, g->g.Height-g->p.y-1, g->p.x);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
pos = PIXIL_POS(g, g->p.x, g->p.y);
|
||||
pos = PIXEL_POS(g, g->p.x, g->p.y);
|
||||
#endif
|
||||
|
||||
#if LTDC_USE_DMA2D
|
||||
#if STM32LTDC_USE_DMA2D
|
||||
while(DMA2D->CR & DMA2D_CR_START);
|
||||
#endif
|
||||
|
||||
|
@ -399,6 +404,8 @@ LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay* g) {
|
|||
g->g.Height = tmp;
|
||||
}
|
||||
break;
|
||||
case gOrientationPortrait:
|
||||
case gOrientationLandscape:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -410,12 +417,33 @@ LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay* g) {
|
|||
set_backlight(g, (unsigned)g->p.ptr);
|
||||
g->g.Backlight = (unsigned)g->p.ptr;
|
||||
return;
|
||||
|
||||
#if STM32LTDC_USE_DOUBLEBUFFERING
|
||||
case STM32LTDC_CONTROL_SHOW_BUFFER:
|
||||
{
|
||||
// Wait for end-of-line interrupt
|
||||
// We use simple polling here as end-of-line interrupts are very frequent and usually happen in sub-millisecond intervals.
|
||||
while (LTDC->ISR & LTDC_ISR_LIF);
|
||||
|
||||
// Update framebuffer address in LTDC register
|
||||
// As we currently only support one layer when doublebuffering is enabled, this change happens only to layer 1.
|
||||
LTDC_Layer1->CFBAR = (gU32)(((ltdcLayerConfig*)g->priv)->frame) & LTDC_LxCFBAR_CFBADD;
|
||||
|
||||
// Reload after LTDC config register modifications
|
||||
_ltdc_reload();
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LTDC_USE_DMA2D
|
||||
#if LTDC_DMA_CACHE_FLUSH
|
||||
#if STM32LTDC_USE_DMA2D
|
||||
#if STM32LTDC_DMA_CACHE_FLUSH
|
||||
#if defined(__CC_ARM)
|
||||
#define __ugfxDSB() __dsb(0xF)
|
||||
#else // GCC like
|
||||
|
@ -425,8 +453,8 @@ LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay* g) {
|
|||
|
||||
|
||||
static void dma2d_init(void) {
|
||||
// Enable DMA2D clock
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2DEN;
|
||||
// Let the board handle the clock setup
|
||||
init_dma2d_clock();
|
||||
|
||||
// Output color format
|
||||
#if GDISP_LLD_PIXELFORMAT == GDISP_PIXELFORMAT_RGB565
|
||||
|
@ -452,35 +480,37 @@ LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay* g) {
|
|||
|
||||
#if GDISP_NEED_CONTROL
|
||||
switch(g->g.Orientation) {
|
||||
case gOrientationPortrait:
|
||||
case gOrientationLandscape:
|
||||
case gOrientation0:
|
||||
default:
|
||||
pos = PIXIL_POS(g, g->p.x, g->p.y);
|
||||
pos = PIXEL_POS(g, g->p.x, g->p.y);
|
||||
lineadd = g->g.Width - g->p.cx;
|
||||
shape = (g->p.cx << 16) | (g->p.cy);
|
||||
break;
|
||||
case gOrientation90:
|
||||
pos = PIXIL_POS(g, g->p.y, g->g.Width-g->p.x-g->p.cx);
|
||||
pos = PIXEL_POS(g, g->p.y, g->g.Width-g->p.x-g->p.cx);
|
||||
lineadd = g->g.Height - g->p.cy;
|
||||
shape = (g->p.cy << 16) | (g->p.cx);
|
||||
break;
|
||||
case gOrientation180:
|
||||
pos = PIXIL_POS(g, g->g.Width-g->p.x-g->p.cx, g->g.Height-g->p.y-g->p.cy);
|
||||
pos = PIXEL_POS(g, g->g.Width-g->p.x-g->p.cx, g->g.Height-g->p.y-g->p.cy);
|
||||
lineadd = g->g.Width - g->p.cx;
|
||||
shape = (g->p.cx << 16) | (g->p.cy);
|
||||
break;
|
||||
case gOrientation270:
|
||||
pos = PIXIL_POS(g, g->g.Height-g->p.y-g->p.cy, g->p.x);
|
||||
pos = PIXEL_POS(g, g->g.Height-g->p.y-g->p.cy, g->p.x);
|
||||
lineadd = g->g.Height - g->p.cy;
|
||||
shape = (g->p.cy << 16) | (g->p.cx);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
pos = PIXIL_POS(g, g->p.x, g->p.y);
|
||||
pos = PIXEL_POS(g, g->p.x, g->p.y);
|
||||
lineadd = g->g.Width - g->p.cx;
|
||||
shape = (g->p.cx << 16) | (g->p.cy);
|
||||
#endif
|
||||
|
||||
#if LTDC_DMA_CACHE_FLUSH
|
||||
#if STM32LTDC_DMA_CACHE_FLUSH
|
||||
{
|
||||
// This is slightly less than optimal as we flush the whole line in the source and destination image
|
||||
// instead of just the cx portion but this saves us having to iterate over each line.
|
||||
|
@ -542,10 +572,10 @@ LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay* g) {
|
|||
LLDSPEC void gdisp_lld_blit_area(GDisplay* g) {
|
||||
gU32 srcstart, dststart;
|
||||
|
||||
srcstart = LTDC_PIXELBYTES * ((gU32)g->p.x2 * g->p.y1 * + g->p.x1) + (gU32)g->p.ptr;
|
||||
dststart = (gU32)PIXEL_ADDR(g, PIXIL_POS(g, g->p.x, g->p.y));
|
||||
srcstart = LTDC_PIXELBYTES * ((gU32)g->p.x2 * g->p.y1 + g->p.x1) + (gU32)g->p.ptr;
|
||||
dststart = (gU32)PIXEL_ADDR(g, PIXEL_POS(g, g->p.x, g->p.y));
|
||||
|
||||
#if LTDC_DMA_CACHE_FLUSH
|
||||
#if STM32LTDC_DMA_CACHE_FLUSH
|
||||
{
|
||||
// This is slightly less than optimal as we flush the whole line in the source and destination image
|
||||
// instead of just the cx portion but this saves us having to iterate over each line.
|
||||
|
@ -588,6 +618,6 @@ LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay* g) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* LTDC_USE_DMA2D */
|
||||
#endif /* STM32LTDC_USE_DMA2D */
|
||||
|
||||
#endif /* GFX_USE_GDISP */
|
||||
|
|
|
@ -14,29 +14,32 @@
|
|||
/* Driver hardware support. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#define LTDC_USE_DMA2D GFXON
|
||||
#define GDISP_HARDWARE_DRAWPIXEL GFXON
|
||||
#define GDISP_HARDWARE_PIXELREAD GFXON
|
||||
#define GDISP_HARDWARE_CONTROL GFXON
|
||||
|
||||
// Both these pixel formats are supported - pick one.
|
||||
// RGB565 obviously is faster and uses less RAM but with lower color resolution than RGB888
|
||||
|
||||
#if defined(GDISP_LTDC_USE_RGB565) && GDISP_LTDC_USE_RGB565
|
||||
#if defined(STM32LTDC_USE_RGB565) && STM32LTDC_USE_RGB565
|
||||
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_RGB565
|
||||
#if GDISP_TOTAL_DISPLAYS > 1
|
||||
#error "LTDC: You must use RGB888 pixel format with LTDC when using dual layers as only RGB888 currently supports using alpha"
|
||||
#if defined(STM32LTDC_USE_LAYER2) && STM32LTDC_USE_LAYER2
|
||||
#error "GDISP - STM32LTDC: You must use RGB888 pixel format with LTDC when using both layers as only RGB888 currently supports using alpha."
|
||||
#endif
|
||||
#else
|
||||
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
|
||||
#endif
|
||||
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Don't change stuff below this line. Please. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if LTDC_USE_DMA2D
|
||||
// LLD command to swap buffers if double buffering is enabled.
|
||||
#if STM32LTDC_USE_DOUBLEBUFFERING
|
||||
#define STM32LTDC_CONTROL_SHOW_BUFFER (GDISP_CONTROL_LLD+0)
|
||||
#endif
|
||||
|
||||
// Adjust driver config if DMA2D is enabled.
|
||||
#if STM32LTDC_USE_DMA2D
|
||||
// DMA2D supports accelerated fills
|
||||
#define GDISP_HARDWARE_FILLS GFXON
|
||||
|
||||
|
|
92
drivers/gdisp/STM32LTDC/readme.md
Normal file
92
drivers/gdisp/STM32LTDC/readme.md
Normal file
|
@ -0,0 +1,92 @@
|
|||
# Usage
|
||||
To use this driver:
|
||||
|
||||
1. Add in your `gfxconf.h`:
|
||||
a) `#define GFX_USE_GDISP GFXON`
|
||||
|
||||
2. To your makefile add the following lines:
|
||||
```
|
||||
include $(GFXLIB)/gfx.mk
|
||||
include $(GFXLIB)/drivers/gdisp/STM32LTDC/driver.mk
|
||||
```
|
||||
|
||||
3. Add a `board_STM32LTDC.h` to you project directory (or board directory)
|
||||
based on one of the templates.
|
||||
|
||||
# Limitations
|
||||
Currently, both `gOrientationPortrait` and `gOrientationLandscape` are not supported by this driver.
|
||||
|
||||
|
||||
# Configuration
|
||||
Configuration options available in `gfxconf.h`:
|
||||
|
||||
| Option | Default | Description |
|
||||
| --- | --- | --- |
|
||||
| `STM32LTDC_DMA_CACHE_FLUSH` | `GFXOFF` | Whether to flush the DMA cache on DMA2D operations. This will be turned on automatically on certian platforms/systems. |
|
||||
| `STM32LTDC_USE_DMA2D` | `GFXON` | Whether to use the DMA2D peripheral for hardware acceleration. |
|
||||
| `STM32LTDC_USE_LAYER2` | `GFXOFF` | Whether to use the 2nd LTDC layer. See the corresponding section below. |
|
||||
| `STM32LTDC_USE_DOUBLEBUFFERING` | `GFXOFF` | Whether to use double buffering. See the corresponding section below. |
|
||||
| `STM32LTDC_USE_RGB565` | `GFXOFF` | Whether to use RGB565 instead of RGB888. |
|
||||
|
||||
# 2nd layer
|
||||
To use the 2nd LTDC layer:
|
||||
- set `STM32LTDC_USE_LAYER2` to `GFXON` in `gfxconf.h`.
|
||||
- set `GDISP_TOTAL_DISPLAYS` to `2` in `gfxconf.h`.
|
||||
|
||||
The 2nd layer is exposed as a separate display. Use `gdispGetDisplay()` to retrieve the individual layers.
|
||||
|
||||
For more information, see:
|
||||
- https://wiki.ugfx.io/index.php/Multiple_displays#Example_-_Same_controller
|
||||
- https://wiki.ugfx.io/index.php/Multiple_displays#Access_the_displays
|
||||
|
||||
# Double buffering
|
||||
To use double buffering:
|
||||
- set `STM32LTDC_USE_DOUBLEBUFFERING` to `GFXON` in `gfxconf.h`.
|
||||
- set `GDISP_TOTAL_DISPLAYS` to `2` in `gfxconf.h`.
|
||||
|
||||
When double buffering is enabled, the 2nd LTDC layer cannot be used. While this limitation is easy to remove from a software perspective, there is little benefit in doing so. Double buffering requires, as the name implies, twice the memory. If the 2nd layer would be used together with double buffering strategy, a total of four full framebuffers would be required. Years of real-world experience shows that there's practically never enough memory bandwidth available to do this.
|
||||
|
||||
To use double buffering in an application, retrieve the two buffers via `gdispGetDisplay()`.
|
||||
Whenever a buffer swap is necessary, use `gdispGControl(g, STM32LTDC_CONTROL_SHOW_BUFFER, NULL);` where `g` is the buffer to be shown.
|
||||
|
||||
Simple example:
|
||||
```c
|
||||
#include "gfx.h"
|
||||
|
||||
static GDisplay* _display1;
|
||||
static GDisplay* _display2;
|
||||
|
||||
// Requests a buffer swap on the driver level
|
||||
static void _setActiveBuffer(GDisplay* g)
|
||||
{
|
||||
gdispGControl(g, STM32LTDC_CONTROL_SHOW_BUFFER, NULL);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialize uGFX library
|
||||
gfxInit();
|
||||
|
||||
// Get the two buffers
|
||||
_display1 = gdispGetDisplay(0);
|
||||
if (!_display1)
|
||||
gfxHalt("could not get display 1");
|
||||
_display2 = gdispGetDisplay(1);
|
||||
if (!_display2)
|
||||
gfxHalt("could not get display 2");
|
||||
|
||||
// Render to each buffer
|
||||
gdispGClear(_display1, GFX_BLUE);
|
||||
gdispGClear(_display2, GFX_RED);
|
||||
|
||||
// Switch between buffers
|
||||
while (gTrue) {
|
||||
gfxSleepMilliseconds(800);
|
||||
_setActiveBuffer(_display1);
|
||||
gfxSleepMilliseconds(800);
|
||||
_setActiveBuffer(_display2);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
|
@ -1,11 +0,0 @@
|
|||
To use this driver:
|
||||
|
||||
1. Add in your gfxconf.h:
|
||||
a) #define GFX_USE_GDISP GFXON
|
||||
|
||||
2. To your makefile add the following lines:
|
||||
include $(GFXLIB)/gfx.mk
|
||||
include $(GFXLIB)/drivers/gdisp/STM32LTDC/driver.mk
|
||||
|
||||
3. Add a board_STM32LTDC.h to you project directory (or board directory)
|
||||
based on one of the templates.
|
|
@ -99,7 +99,11 @@
|
|||
static gBool Win32MouseInit(GMouse *m, unsigned driverinstance);
|
||||
static gBool Win32MouseRead(GMouse *m, GMouseReading *prd);
|
||||
|
||||
const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{
|
||||
/**
|
||||
* This should be: const GMouseVMT const GMOUSE_DRIVER_VMT[1] = {{
|
||||
* However, some major compilers complain about the duplicate const specifier even though this is perfectly valid standard C.
|
||||
*/
|
||||
const GMouseVMT GMOUSE_DRIVER_VMT[1] = {{
|
||||
{
|
||||
GDRIVER_TYPE_MOUSE,
|
||||
GMOUSE_VFLG_NOPOLL|GMOUSE_VFLG_DYNAMICONLY,
|
||||
|
@ -885,7 +889,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
|
|||
// Create the associated mouse
|
||||
#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
|
||||
priv->mouseenabled = hWndParent ? gFalse : gTrue;
|
||||
priv->mouse = (GMouse *)gdriverRegister((const GDriverVMT const *)GMOUSE_DRIVER_VMT, g);
|
||||
priv->mouse = (GMouse *)gdriverRegister((const GDriverVMT*)GMOUSE_DRIVER_VMT, g);
|
||||
#endif
|
||||
|
||||
sprintf(buf, APP_NAME " - %u", g->systemdisplay+1);
|
||||
|
|
|
@ -555,6 +555,14 @@ static void line_clip(GDisplay *g) {
|
|||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
// Gather GDISP VMT(S)
|
||||
// These are only needed in _gdispInit(). However, we want to prevent generating nested-externs compiler warnings.
|
||||
#if defined(GDISP_DRIVER_LIST)
|
||||
extern GDISPVMTLIST GDISP_DRIVER_LIST;
|
||||
#else
|
||||
extern const GDISPVMT GDISPVMT_OnlyOne[1];
|
||||
#endif
|
||||
|
||||
void _gdispInit(void)
|
||||
{
|
||||
// GDISP_DRIVER_LIST is defined - create each driver instance
|
||||
|
@ -563,7 +571,6 @@ void _gdispInit(void)
|
|||
unsigned i;
|
||||
typedef const GDISPVMT const GDISPVMTLIST[1];
|
||||
|
||||
extern GDISPVMTLIST GDISP_DRIVER_LIST;
|
||||
static const GDISPVMT * const dclist[] = {GDISP_DRIVER_LIST};
|
||||
|
||||
for(i = 0; i < sizeof(dclist)/sizeof(dclist[0]); i++) {
|
||||
|
@ -574,7 +581,6 @@ void _gdispInit(void)
|
|||
#elif GDISP_TOTAL_DISPLAYS > 1
|
||||
{
|
||||
unsigned i;
|
||||
extern const GDISPVMT const GDISPVMT_OnlyOne[1];
|
||||
|
||||
if (!(GDISPVMT_OnlyOne->d.flags & GDISP_VFLG_DYNAMICONLY)) {
|
||||
for(i = 0; i < GDISP_TOTAL_DISPLAYS; i++)
|
||||
|
@ -583,8 +589,6 @@ void _gdispInit(void)
|
|||
}
|
||||
#else
|
||||
{
|
||||
extern const GDISPVMT const GDISPVMT_OnlyOne[1];
|
||||
|
||||
if (!(GDISPVMT_OnlyOne->d.flags & GDISP_VFLG_DYNAMICONLY))
|
||||
gdriverRegister(&GDISPVMT_OnlyOne->d, 0);
|
||||
}
|
||||
|
@ -2881,6 +2885,10 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
|
|||
case gOrientationPortrait:
|
||||
g->p.ptr = g->g.Width >= g->g.Height ? (void *)gOrientation90 : (void *)gOrientation0;
|
||||
break;
|
||||
case gOrientation0:
|
||||
case gOrientation90:
|
||||
case gOrientation180:
|
||||
case gOrientation270:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -732,7 +732,11 @@ typedef struct GDISPVMT {
|
|||
#endif
|
||||
|
||||
// Build the VMT
|
||||
const GDISPVMT const GDISP_DRIVER_VMT[1] = {{
|
||||
/*
|
||||
* This should read: const GDISPVMT const GDISP_DRIVER_VMT[1] = {{
|
||||
* However, some major C compilers complain about duplicate const specifiers although this is perfectly valid standard C.
|
||||
*/
|
||||
const GDISPVMT GDISP_DRIVER_VMT[1] = {{
|
||||
{ GDRIVER_TYPE_DISPLAY, 0, sizeof(GDisplay), _gdispInitDriver, _gdispPostInitDriver, _gdispDeInitDriver },
|
||||
gdisp_lld_init,
|
||||
#if GDISP_HARDWARE_DEINIT
|
||||
|
|
|
@ -86,8 +86,16 @@ typedef struct GDriverVMT {
|
|||
* const GDriverVMT const * mylist = { DRIVER_LIST };
|
||||
* </code>
|
||||
*
|
||||
* @note This could be one single typedef. However, some major compilers complain about duplicate const specifiers even though this is perfectly
|
||||
* valid standard C. As this problem has become worse over time we opt for splitting this into two separate typedefs to prevent these
|
||||
* compilers from throwing warnings.
|
||||
* The single typedef would look like this:
|
||||
* <code>
|
||||
* typedef const struct GDriverVMT const GDriverVMTList[1];
|
||||
* </code>
|
||||
*/
|
||||
typedef const struct GDriverVMT const GDriverVMTList[1];
|
||||
typedef const struct GDriverVMT ConstGDriverVMT;
|
||||
typedef ConstGDriverVMT const GDriverVMTList[1];
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
|
|
|
@ -36,8 +36,11 @@
|
|||
/**
|
||||
* The order of the file-systems below determines the order
|
||||
* that they are searched to find a file.
|
||||
*
|
||||
* This should read: static const GFILEVMT const * FsArray[] = {
|
||||
* However, some major C compilers complain about duplicate const specifiers although this is perfectly valid standard C.
|
||||
*/
|
||||
static const GFILEVMT const * FsArray[] = {
|
||||
static const GFILEVMT* FsArray[] = {
|
||||
#if GFILE_NEED_USERFS
|
||||
&FsUSERVMT,
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,12 @@ typedef struct ROMFS_DIRENTRY {
|
|||
|
||||
#define ROMFS_DIRENTRY_HEAD 0
|
||||
#include "romfs_files.h"
|
||||
static const ROMFS_DIRENTRY const *FsROMHead = ROMFS_DIRENTRY_HEAD;
|
||||
|
||||
/*
|
||||
* This should be: static const ROMFS_DIRENTRY const *FsROMHead = ROMFS_DIRENTRY_HEAD;
|
||||
* However, some major compilers complain about the duplicate const specifier even though this is perfectly valid standard C.
|
||||
*/
|
||||
static const ROMFS_DIRENTRY *FsROMHead = ROMFS_DIRENTRY_HEAD;
|
||||
|
||||
typedef struct ROMFileList {
|
||||
gfileList fl;
|
||||
|
|
|
@ -663,7 +663,11 @@ void _gmouseInit(void) {
|
|||
// One and only one mouse
|
||||
#else
|
||||
{
|
||||
extern const GMouseVMT const GMOUSEVMT_OnlyOne[1];
|
||||
/*
|
||||
* This should be: extern const GMouseVMT const GMOUSEVMT_OnlyOne[1];
|
||||
* However, some major compilers complain about the duplicate const specifier even though this is perfectly valid standard C.
|
||||
*/
|
||||
extern const GMouseVMT GMOUSEVMT_OnlyOne[1];
|
||||
|
||||
if (!(GMOUSEVMT_OnlyOne->d.flags & GMOUSE_VFLG_DYNAMICONLY))
|
||||
gdriverRegister(&GMOUSEVMT_OnlyOne->d, GDISP);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#if CH_KERNEL_MAJOR < 2 || CH_KERNEL_MAJOR > 5
|
||||
#if CH_KERNEL_MAJOR < 2 || CH_KERNEL_MAJOR > 6
|
||||
#error "GOS: Unsupported version of ChibiOS"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -35,7 +35,11 @@
|
|||
#endif
|
||||
typedef systime_t gTicks;
|
||||
typedef cnt_t gSemcount;
|
||||
typedef msg_t gThreadreturn;
|
||||
#if CH_KERNEL_MAJOR >= 6
|
||||
typedef void gThreadreturn;
|
||||
#else
|
||||
typedef msg_t gThreadreturn;
|
||||
#endif
|
||||
typedef tprio_t gThreadpriority;
|
||||
|
||||
#define gSemMaxCount ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file src/gos/gos_zepyhr.h
|
||||
* @file src/gos/gos_zephyr.h
|
||||
* @brief GOS - Operating System Support header file for Zephyr RTOS.
|
||||
* Zephyr SDK 0.9.1
|
||||
*/
|
||||
|
|
|
@ -51,7 +51,7 @@ const char* gtransString(const char* string)
|
|||
return _languageCurrent->strings[i];
|
||||
}
|
||||
|
||||
const char* gtransIndex(unsigned index)
|
||||
const char* gtransIndex(gU32 index)
|
||||
{
|
||||
if (!_languageCurrent) {
|
||||
return 0;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* @brief A table containing translated strings.
|
||||
*/
|
||||
typedef struct transTable {
|
||||
unsigned numEntries; /**< The number of strings that this table contains */
|
||||
gU32 numEntries; /**< The number of strings that this table contains */
|
||||
const char** strings; /**< The translated strings */
|
||||
} transTable;
|
||||
|
||||
|
@ -59,7 +59,7 @@ const char* gtransString(const char* string);
|
|||
*
|
||||
* @return The string at the given index of the current language or 0 if it doesn't exist.
|
||||
*/
|
||||
const char* gtransIndex(unsigned index);
|
||||
const char* gtransIndex(gU32 index);
|
||||
|
||||
/**
|
||||
* @brief Set the base language.
|
||||
|
|
|
@ -202,6 +202,8 @@ void gwinContainerDraw_Std(GWidgetObject *gw, void *param) {
|
|||
}
|
||||
#endif /* GDISP_NEED_IMAGE */
|
||||
|
||||
#endif /* GFX_USE_GWIN && GWIN_NEED_CONTAINERS */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @} */
|
||||
#endif /* GFX_USE_GWIN && GWIN_NEED_CONTAINERS */
|
||||
|
|
Loading…
Add table
Reference in a new issue