1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-20 05:18:08 +00:00

fix(core): fix dma2d includes and initialization with respect to new rendering

[no changelog]
This commit is contained in:
tychovrahe 2024-08-05 17:13:54 +02:00 committed by TychoVrahe
parent 171961829a
commit c42c268e05
12 changed files with 49 additions and 13 deletions

View File

@ -158,7 +158,6 @@ SOURCE_TREZORHAL = [
if NEW_RENDERING: if NEW_RENDERING:
SOURCE_TREZORHAL += [ SOURCE_TREZORHAL += [
'embed/trezorhal/unix/display_driver.c', 'embed/trezorhal/unix/display_driver.c',
'embed/trezorhal/unix/dma2d_bitblt.c',
'embed/trezorhal/xdisplay_legacy.c', 'embed/trezorhal/xdisplay_legacy.c',
] ]
else: else:

View File

@ -44,6 +44,14 @@
#include "hash_processor.h" #include "hash_processor.h"
#endif #endif
#ifdef USE_DMA2D
#ifdef NEW_RENDERING
#include "dma2d_bitblt.h"
#else
#include "dma2d.h"
#endif
#endif
#include "lowlevel.h" #include "lowlevel.h"
#include "model.h" #include "model.h"
#include "version.h" #include "version.h"
@ -281,6 +289,10 @@ int main(void) {
hash_processor_init(); hash_processor_init();
#endif #endif
#ifdef USE_DMA2D
dma2d_init();
#endif
display_init(); display_init();
display_clear(); display_clear();
display_refresh(); display_refresh();

View File

@ -35,8 +35,12 @@
#include "secret.h" #include "secret.h"
#ifdef USE_DMA2D #ifdef USE_DMA2D
#ifdef NEW_RENDERING
#include "dma2d_bitblt.h"
#else
#include "dma2d.h" #include "dma2d.h"
#endif #endif
#endif
#ifdef USE_I2C #ifdef USE_I2C
#include "i2c.h" #include "i2c.h"
#endif #endif

View File

@ -60,8 +60,13 @@
#include "consumption_mask.h" #include "consumption_mask.h"
#endif #endif
#ifdef USE_DMA2D #ifdef USE_DMA2D
#ifdef NEW_RENDERING
#include "dma2d_bitblt.h"
#else
#include "dma2d.h" #include "dma2d.h"
#endif #endif
#endif
#ifdef USE_BUTTON #ifdef USE_BUTTON
#include "button.h" #include "button.h"
#endif #endif

View File

@ -22,6 +22,9 @@
#include "gfx_bitblt.h" #include "gfx_bitblt.h"
// Initializes DMA2D peripheral
void dma2d_init(void);
// Waits until any pending DMA2D operation is finished // Waits until any pending DMA2D operation is finished
void dma2d_wait(void); void dma2d_wait(void);

View File

@ -40,6 +40,8 @@ static inline bool dma2d_accessible(const void* ptr) {
#endif #endif
} }
void dma2d_init(void) { __HAL_RCC_DMA2D_CLK_ENABLE(); }
void dma2d_wait(void) { void dma2d_wait(void) {
while (HAL_DMA2D_PollForTransfer(&dma2d_handle, 10) != HAL_OK) while (HAL_DMA2D_PollForTransfer(&dma2d_handle, 10) != HAL_OK)
; ;

View File

@ -19,4 +19,6 @@
#include "dma2d_bitblt.h" #include "dma2d_bitblt.h"
void dma2d_init(void) {}
void dma2d_wait(void) {} void dma2d_wait(void) {}

View File

@ -48,8 +48,11 @@ def configure(
sources += [f"embed/trezorhal/stm32f4/displays/{display}"] sources += [f"embed/trezorhal/stm32f4/displays/{display}"]
sources += ["embed/trezorhal/stm32f4/displays/ili9341_spi.c"] sources += ["embed/trezorhal/stm32f4/displays/ili9341_spi.c"]
sources += ["embed/trezorhal/stm32f4/dma2d.c"] if "new_rendering" in features_wanted:
sources += ["embed/trezorhal/stm32f4/dma2d_bitblt.c"] sources += ["embed/trezorhal/stm32u5/dma2d_bitblt.c"]
else:
sources += ["embed/trezorhal/stm32u5/dma2d.c"]
sources += [ sources += [
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c" "vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c"
] ]

View File

@ -92,10 +92,10 @@ def configure(
features_available.append("usb") features_available.append("usb")
defines += ["USE_DMA2D", "FRAMEBUFFER", "FRAMEBUFFER32BIT", "UI_COLOR_32BIT"] defines += ["USE_DMA2D", "FRAMEBUFFER", "FRAMEBUFFER32BIT", "UI_COLOR_32BIT"]
sources += [ if "new_rendering" in features_wanted:
"embed/trezorhal/stm32u5/dma2d.c", sources += ["embed/trezorhal/stm32u5/dma2d_bitblt.c"]
"embed/trezorhal/stm32u5/dma2d_bitblt.c", else:
] sources += ["embed/trezorhal/stm32u5/dma2d.c"]
features_available.append("dma2d") features_available.append("dma2d")
features_available.append("framebuffer") features_available.append("framebuffer")
features_available.append("framebuffer32bit") features_available.append("framebuffer32bit")

View File

@ -113,8 +113,10 @@ def configure(
if "dma2d" in features_wanted: if "dma2d" in features_wanted:
defines += ["USE_DMA2D"] defines += ["USE_DMA2D"]
sources += ["embed/trezorhal/stm32f4/dma2d.c"] if "new_rendering" in features_wanted:
sources += ["embed/trezorhal/stm32f4/dma2d_bitblt.c"] sources += ["embed/trezorhal/stm32u5/dma2d_bitblt.c"]
else:
sources += ["embed/trezorhal/stm32u5/dma2d.c"]
sources += [ sources += [
"vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c" "vendor/micropython/lib/stm32lib/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c"
] ]

View File

@ -114,8 +114,10 @@ def configure(
if "dma2d" in features_wanted: if "dma2d" in features_wanted:
defines += ["USE_DMA2D"] defines += ["USE_DMA2D"]
sources += ["embed/trezorhal/stm32u5/dma2d.c"] if "new_rendering" in features_wanted:
sources += ["embed/trezorhal/stm32u5/dma2d_bitblt.c"] sources += ["embed/trezorhal/stm32u5/dma2d_bitblt.c"]
else:
sources += ["embed/trezorhal/stm32u5/dma2d.c"]
features_available.append("dma2d") features_available.append("dma2d")
if "optiga" in features_wanted: if "optiga" in features_wanted:

View File

@ -115,8 +115,10 @@ def configure(
if "dma2d" in features_wanted: if "dma2d" in features_wanted:
defines += ["USE_DMA2D"] defines += ["USE_DMA2D"]
sources += ["embed/trezorhal/stm32u5/dma2d.c"] if "new_rendering" in features_wanted:
sources += ["embed/trezorhal/stm32u5/dma2d_bitblt.c"] sources += ["embed/trezorhal/stm32u5/dma2d_bitblt.c"]
else:
sources += ["embed/trezorhal/stm32u5/dma2d.c"]
features_available.append("dma2d") features_available.append("dma2d")
if "optiga" in features_wanted: if "optiga" in features_wanted: