2018-02-26 13:06:10 +00:00
|
|
|
/*
|
2019-06-17 18:27:55 +00:00
|
|
|
* This file is part of the Trezor project, https://trezor.io/
|
2018-02-26 13:06:10 +00:00
|
|
|
*
|
|
|
|
* Copyright (c) SatoshiLabs
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2025-01-31 16:11:40 +00:00
|
|
|
#pragma once
|
2017-12-17 00:09:45 +00:00
|
|
|
|
2024-11-01 11:55:31 +00:00
|
|
|
#include <trezor_types.h>
|
|
|
|
|
2024-11-15 09:07:01 +00:00
|
|
|
#include <util/image.h>
|
2022-05-05 11:47:19 +00:00
|
|
|
|
2025-01-31 16:11:40 +00:00
|
|
|
// todo: use bindgen to tie this to rust
|
2022-05-05 11:47:19 +00:00
|
|
|
typedef enum {
|
2025-01-31 16:11:40 +00:00
|
|
|
UI_RESULT_CANCEL = 1,
|
|
|
|
UI_RESULT_CONFIRM = 2,
|
|
|
|
} ui_result_t;
|
|
|
|
|
|
|
|
// todo: use bindgen to tie this to rust
|
|
|
|
typedef enum {
|
|
|
|
MENU_EXIT = 0xAABBCCDD,
|
|
|
|
MENU_REBOOT = 0x11223344,
|
|
|
|
MENU_WIPE = 0x55667788,
|
|
|
|
} menu_result_t;
|
|
|
|
|
|
|
|
// todo: use bindgen to tie this to rust
|
|
|
|
typedef enum {
|
|
|
|
INTRO_MENU = 1,
|
|
|
|
INTRO_HOST = 2,
|
|
|
|
} intro_result_t;
|
|
|
|
|
|
|
|
// Displays a warning screen before jumping to the untrusted firmware
|
2024-05-15 09:26:27 +00:00
|
|
|
//
|
|
|
|
// Shows vendor image, vendor string and firmware version
|
|
|
|
// and optional message to the user (see `wait` argument)
|
|
|
|
//
|
|
|
|
// `wait` argument specifies a message to the user
|
|
|
|
// 0 do not show any message
|
|
|
|
// > 0 show a message like "starting in %d s"
|
|
|
|
// < 0 show a message like "press button to continue"
|
2019-03-29 15:26:02 +00:00
|
|
|
void ui_screen_boot(const vendor_header* const vhdr,
|
2024-05-15 09:26:27 +00:00
|
|
|
const image_header* const hdr, int wait);
|
|
|
|
|
|
|
|
// Waits until the user confirms the untrusted firmware
|
|
|
|
//
|
|
|
|
// Implementation is device specific - it wait's until
|
|
|
|
// the user presses a button, touches the display
|
2023-03-29 14:21:43 +00:00
|
|
|
void ui_click(void);
|
2017-12-17 00:09:45 +00:00
|
|
|
|
2022-05-05 11:47:19 +00:00
|
|
|
void ui_screen_welcome(void);
|
|
|
|
|
|
|
|
uint32_t ui_screen_intro(const vendor_header* const vhdr,
|
2023-06-30 20:57:04 +00:00
|
|
|
const image_header* const hdr, bool fw_ok);
|
2018-01-25 13:16:21 +00:00
|
|
|
|
2023-06-30 20:57:04 +00:00
|
|
|
uint32_t ui_screen_menu(secbool firmware_present);
|
2017-12-17 00:09:45 +00:00
|
|
|
|
2025-01-31 16:11:40 +00:00
|
|
|
void ui_screen_connect(void);
|
|
|
|
|
|
|
|
ui_result_t ui_screen_install_confirm(const vendor_header* const vhdr,
|
|
|
|
const image_header* const hdr,
|
|
|
|
secbool shold_keep_seed,
|
|
|
|
secbool is_newvendor,
|
|
|
|
secbool is_newinstall, int version_cmp);
|
2022-05-05 11:47:19 +00:00
|
|
|
void ui_screen_install_start();
|
2017-12-17 00:09:45 +00:00
|
|
|
void ui_screen_install_progress_erase(int pos, int len);
|
|
|
|
void ui_screen_install_progress_upload(int pos);
|
|
|
|
|
2025-01-31 16:11:40 +00:00
|
|
|
ui_result_t ui_screen_wipe_confirm(void);
|
2017-12-17 00:09:45 +00:00
|
|
|
void ui_screen_wipe(void);
|
|
|
|
void ui_screen_wipe_progress(int pos, int len);
|
|
|
|
|
2023-03-23 14:42:21 +00:00
|
|
|
void ui_screen_done(uint8_t restart_seconds, secbool full_redraw);
|
2017-12-17 00:09:45 +00:00
|
|
|
|
|
|
|
void ui_screen_fail(void);
|
|
|
|
|
|
|
|
void ui_fadein(void);
|
|
|
|
void ui_fadeout(void);
|
2022-05-05 11:47:19 +00:00
|
|
|
void ui_set_initial_setup(bool initial);
|
|
|
|
|
2024-04-10 12:56:34 +00:00
|
|
|
void ui_screen_boot_stage_1(bool fading);
|
2017-12-17 00:09:45 +00:00
|
|
|
|
2023-07-20 11:20:50 +00:00
|
|
|
#ifdef USE_OPTIGA
|
|
|
|
uint32_t ui_screen_unlock_bootloader_confirm(void);
|
|
|
|
#endif
|
2025-03-05 13:04:40 +00:00
|
|
|
|
|
|
|
#ifdef USE_BLE
|
|
|
|
uint32_t ui_screen_confirm_pairing(const char* code);
|
|
|
|
#endif
|