Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T3T1: use internal framebuffer #3474

Merged
merged 6 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/SConscript.bootloader
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if TREZOR_MODEL in ('1', ):
)
Return()

FEATURES_WANTED = ["input", "rgb_led", "consumption_mask", "usb", "optiga"]
FEATURES_WANTED = ["input", "rgb_led", "consumption_mask", "usb", "optiga", "dma2d"]

CCFLAGS_MOD = ''
CPPPATH_MOD = []
Expand Down
1 change: 1 addition & 0 deletions core/embed/boardloader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ int main(void) {

display_init();
display_clear();
display_refresh();

#if defined USE_SD_CARD
sdcard_init();
Expand Down
1 change: 1 addition & 0 deletions core/embed/boardloader/memory_stm32u58.ld
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ SECTIONS {
__fb_start = .;
*(.fb1*);
*(.fb2*);
*(.framebuffer_select*);
__fb_end = .;
. = ALIGN(4);
} >SRAM3
Expand Down
2 changes: 1 addition & 1 deletion core/embed/bootloader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ static usb_result_t bootloader_usb_loop(const vendor_header *const vhdr,
hal_delay(1000);
usb_stop();
usb_deinit();
ui_screen_boot_empty(true);
return CONTINUE_TO_FIRMWARE;
}
break;
Expand Down Expand Up @@ -715,6 +714,7 @@ int bootloader_main(void) {
#ifdef STM32U5
firmware_jump_fn = jump_to_fw_through_reset;
#else
ui_screen_boot_empty(true);
firmware_jump_fn = real_jump_to_firmware;
#endif
break;
Expand Down
1 change: 1 addition & 0 deletions core/embed/bootloader/memory_stm32u58.ld
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ SECTIONS {
__fb_start = .;
*(.fb1*);
*(.fb2*);
*(.framebuffer_select*);
__fb_end = .;
. = ALIGN(4);
} >SRAM3
Expand Down
1 change: 1 addition & 0 deletions core/embed/firmware/memory_T3T1.ld
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ SECTIONS {
__fb_start = .;
*(.fb1*);
*(.fb2*);
*(.framebuffer_select*);
__fb_end = .;
. = ALIGN(4);
} >SRAM3
Expand Down
1 change: 1 addition & 0 deletions core/embed/lib/display_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ void display_init(void);
void display_reinit(void);
void display_sync(void);
void display_refresh(void);
void display_finish_actions(void);
const char *display_save(const char *prefix);
void display_clear_save(void);

Expand Down
1 change: 1 addition & 0 deletions core/embed/prodtest/memory_stm32u58.ld
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ SECTIONS {
__fb_start = .;
*(.fb1*);
*(.fb2*);
*(.framebuffer_select*);
__fb_end = .;
. = ALIGN(4);
} >SRAM3
Expand Down
1 change: 1 addition & 0 deletions core/embed/reflash/memory_stm32u58.ld
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ SECTIONS {
__fb_start = .;
*(.fb1*);
*(.fb2*);
*(.framebuffer_select*);
__fb_end = .;
. = ALIGN(4);
} >SRAM3
Expand Down
13 changes: 10 additions & 3 deletions core/embed/rust/src/trezorhal/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ pub fn text_baseline(font: i32) -> i16 {
}

#[inline(always)]
#[cfg(all(feature = "disp_i8080_16bit_dw", not(feature = "disp_i8080_8bit_dw")))]
#[cfg(all(
not(feature = "framebuffer"),
feature = "disp_i8080_16bit_dw",
not(feature = "disp_i8080_8bit_dw")
))]
pub fn pixeldata(c: u16) {
unsafe {
ffi::DISPLAY_DATA_ADDRESS.write_volatile(c);
Expand All @@ -93,7 +97,7 @@ pub fn get_fb_addr() -> FrameBuffer {
}

#[inline(always)]
#[cfg(feature = "disp_i8080_8bit_dw")]
#[cfg(all(not(feature = "framebuffer"), feature = "disp_i8080_8bit_dw"))]
pub fn pixeldata(c: u16) {
unsafe {
ffi::DISPLAY_DATA_ADDRESS.write_volatile((c & 0xff) as u8);
Expand Down Expand Up @@ -126,7 +130,10 @@ pub fn pixel(fb: FrameBuffer, x: i16, y: i16, c: u32) {
}

#[inline(always)]
#[cfg(not(any(feature = "disp_i8080_16bit_dw", feature = "disp_i8080_8bit_dw")))]
#[cfg(any(
feature = "framebuffer",
not(any(feature = "disp_i8080_16bit_dw", feature = "disp_i8080_8bit_dw"))
))]
pub fn pixeldata(c: u16) {
unsafe {
ffi::display_pixeldata(c);
Expand Down
3 changes: 1 addition & 2 deletions core/embed/rust/src/ui/model_tt/bootloader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,10 @@ fn screen_progress(
bg_color,
);
display::loader(progress, -20, fg_color, bg_color, icon);
display::refresh();
if initialize {
fadein();
}

display::refresh();
}

#[no_mangle]
Expand Down
25 changes: 25 additions & 0 deletions core/embed/trezorhal/bg_copy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

#ifndef TREZORHAL_BG_COPY_H
#define TREZORHAL_BG_COPY_H

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

/**
* Wait for the data transfer completion
*/
void bg_copy_wait(void);

/**
* Performs data copy from src to dst in the background. The destination is
* constant, meaning the address is not incremented. Ensure the transfer
* completion by calling bg_copy_wait
*
* @param src source data address
* @param dst destination data address
* @param size size of data to be transferred in bytes
*/
void bg_copy_start_const_out_8(const uint8_t *src, uint8_t *dst, size_t size);

#endif
4 changes: 4 additions & 0 deletions core/embed/trezorhal/boards/trezor_t3t1_v4.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#define DISPLAY_IDENTIFY 1
#define DISPLAY_TE_PORT GPIOD
#define DISPLAY_TE_PIN GPIO_PIN_12
#define DISPLAY_TE_INTERRUPT_HANDLER EXTI12_IRQHandler
#define DISPLAY_TE_INTERRUPT_NUM EXTI12_IRQn
#define DISPLAY_TE_INTERRUPT_GPIOSEL EXTI_GPIOD
#define DISPLAY_TE_INTERRUPT_EXTI_LINE EXTI_LINE_12

#define DISPLAY_PANEL_INIT_SEQ lx154a2422_init_seq
#define DISPLAY_PANEL_ROTATE lx154a2422_rotate
Expand Down
2 changes: 2 additions & 0 deletions core/embed/trezorhal/stm32f4/backlight_pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ int backlight_pwm_set(int val) {
return BACKLIGHT;
}

int backlight_pwm_get(void) { return BACKLIGHT; }

void backlight_pwm_init(void) {
// init peripherals
BACKLIGHT_PWM_PORT_CLK_EN();
Expand Down
1 change: 1 addition & 0 deletions core/embed/trezorhal/stm32f4/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ void collect_hw_entropy(void) {
// which might be incompatible with the other layers older versions,
// where this setting might be unknown
void ensure_compatible_settings(void) {
display_finish_actions();
#ifdef TREZOR_MODEL_T
display_set_big_endian();
display_orientation(0);
Expand Down
2 changes: 2 additions & 0 deletions core/embed/trezorhal/stm32f4/displays/ltdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,5 @@ void display_shift_window(uint16_t pixels) {
uint16_t display_get_window_offset(void) {
return MAX_DISPLAY_RESX - display_get_window_width();
}

void display_finish_actions(void) {}
Loading
Loading