mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-09 06:50:58 +00:00
feat(core): add support for SBU on T3W1
[no changelog]
This commit is contained in:
parent
40c5426717
commit
c5b3dd72b9
@ -28,7 +28,7 @@ FEATURE_FLAGS = {
|
||||
"AES_GCM": BENCHMARK or THP,
|
||||
}
|
||||
|
||||
FEATURES_WANTED = ["input", "sbu", "sd_card", "rgb_led", "dma2d", "consumption_mask", "usb" ,"optiga", "haptic"]
|
||||
FEATURES_WANTED = ["input", "sd_card", "rgb_led", "dma2d", "consumption_mask", "usb" ,"optiga", "haptic"]
|
||||
if DISABLE_OPTIGA and PYOPT == '0':
|
||||
FEATURES_WANTED.remove("optiga")
|
||||
|
||||
|
@ -23,7 +23,7 @@ FEATURE_FLAGS = {
|
||||
"AES_GCM": False,
|
||||
}
|
||||
|
||||
FEATURES_WANTED = ["input", "sbu", "sd_card", "rgb_led", "dma2d", "consumption_mask", "usb" ,"optiga", "haptic"]
|
||||
FEATURES_WANTED = ["input", "sd_card", "rgb_led", "dma2d", "consumption_mask", "usb" ,"optiga", "haptic"]
|
||||
if DISABLE_OPTIGA and PYOPT == '0':
|
||||
FEATURES_WANTED.remove("optiga")
|
||||
|
||||
|
@ -20,7 +20,7 @@ if BENCHMARK and PYOPT != '0':
|
||||
print("BENCHMARK=1 works only with PYOPT=0.")
|
||||
exit(1)
|
||||
|
||||
FEATURES_WANTED = ["input", "sd_card", "dma2d", "optiga", "sbu"]
|
||||
FEATURES_WANTED = ["input", "sd_card", "dma2d", "optiga"]
|
||||
|
||||
if not models.has_emulator(TREZOR_MODEL):
|
||||
# skip unix build
|
||||
|
@ -24,23 +24,27 @@
|
||||
#if KERNEL_MODE
|
||||
|
||||
void sbu_init(void) {
|
||||
GPIO_InitTypeDef GPIO_InitStructure = {0};
|
||||
SBU_1_CLK_ENA();
|
||||
SBU_2_CLK_ENA();
|
||||
|
||||
// SBU1/PA2 SBU2/PA3
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_2 | GPIO_PIN_3;
|
||||
HAL_GPIO_WritePin(SBU_1_PORT, SBU_1_PIN, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(SBU_2_PORT, SBU_2_PIN, GPIO_PIN_RESET);
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure = {0};
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStructure.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_2, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, GPIO_PIN_RESET);
|
||||
GPIO_InitStructure.Pin = SBU_1_PIN;
|
||||
HAL_GPIO_Init(SBU_1_PORT, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.Pin = SBU_2_PIN;
|
||||
HAL_GPIO_Init(SBU_2_PORT, &GPIO_InitStructure);
|
||||
}
|
||||
|
||||
void sbu_set(secbool sbu1, secbool sbu2) {
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_2,
|
||||
HAL_GPIO_WritePin(SBU_1_PORT, SBU_1_PIN,
|
||||
sbu1 == sectrue ? GPIO_PIN_SET : GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3,
|
||||
HAL_GPIO_WritePin(SBU_2_PORT, SBU_2_PIN,
|
||||
sbu2 == sectrue ? GPIO_PIN_SET : GPIO_PIN_RESET);
|
||||
}
|
||||
|
||||
|
@ -52,4 +52,11 @@
|
||||
#define OPTIGA_RST_PIN GPIO_PIN_9
|
||||
#define OPTIGA_RST_CLK_EN __HAL_RCC_GPIOD_CLK_ENABLE
|
||||
|
||||
#define SBU_1_PIN GPIO_PIN_2
|
||||
#define SBU_1_PORT GPIOA
|
||||
#define SBU_1_CLK_ENA __HAL_RCC_GPIOA_CLK_ENABLE
|
||||
#define SBU_2_PIN GPIO_PIN_3
|
||||
#define SBU_2_PORT GPIOA
|
||||
#define SBU_2_CLK_ENA __HAL_RCC_GPIOA_CLK_ENABLE
|
||||
|
||||
#endif //_TREZOR_R_V10_H
|
||||
|
@ -52,4 +52,11 @@
|
||||
#define SD_ENABLE_PORT GPIOC
|
||||
#define SD_ENABLE_PIN GPIO_PIN_0
|
||||
|
||||
#define SBU_1_PIN GPIO_PIN_2
|
||||
#define SBU_1_PORT GPIOA
|
||||
#define SBU_1_CLK_ENA __HAL_RCC_GPIOA_CLK_ENABLE
|
||||
#define SBU_2_PIN GPIO_PIN_3
|
||||
#define SBU_2_PORT GPIOA
|
||||
#define SBU_2_CLK_ENA __HAL_RCC_GPIOA_CLK_ENABLE
|
||||
|
||||
#endif //_TREZOR_T_H
|
||||
|
@ -54,4 +54,11 @@
|
||||
#define OPTIGA_RST_PIN GPIO_PIN_13
|
||||
#define OPTIGA_RST_CLK_EN __HAL_RCC_GPIOE_CLK_ENABLE
|
||||
|
||||
#define SBU_1_PIN GPIO_PIN_2
|
||||
#define SBU_1_PORT GPIOA
|
||||
#define SBU_1_CLK_ENA __HAL_RCC_GPIOA_CLK_ENABLE
|
||||
#define SBU_2_PIN GPIO_PIN_3
|
||||
#define SBU_2_PORT GPIOA
|
||||
#define SBU_2_CLK_ENA __HAL_RCC_GPIOA_CLK_ENABLE
|
||||
|
||||
#endif //_TREZOR_T3B1_H
|
||||
|
@ -104,4 +104,11 @@
|
||||
#define SD_ENABLE_PORT GPIOC
|
||||
#define SD_ENABLE_PIN GPIO_PIN_3
|
||||
|
||||
#define SBU_1_PIN GPIO_PIN_2
|
||||
#define SBU_1_PORT GPIOA
|
||||
#define SBU_1_CLK_ENA __HAL_RCC_GPIOA_CLK_ENABLE
|
||||
#define SBU_2_PIN GPIO_PIN_3
|
||||
#define SBU_2_PORT GPIOA
|
||||
#define SBU_2_CLK_ENA __HAL_RCC_GPIOA_CLK_ENABLE
|
||||
|
||||
#endif //_TREZOR_T_H
|
||||
|
@ -101,4 +101,11 @@
|
||||
#define TOUCH_INT_PORT GPIOC
|
||||
#define TOUCH_INT_PIN GPIO_PIN_3
|
||||
|
||||
#define SBU_1_PIN GPIO_PIN_8
|
||||
#define SBU_1_PORT GPIOC
|
||||
#define SBU_1_CLK_ENA __HAL_RCC_GPIOC_CLK_ENABLE
|
||||
#define SBU_2_PIN GPIO_PIN_9
|
||||
#define SBU_2_PORT GPIOC
|
||||
#define SBU_2_CLK_ENA __HAL_RCC_GPIOC_CLK_ENABLE
|
||||
|
||||
#endif // TREZOR_T3W1_REVA_H_
|
||||
|
Loading…
Reference in New Issue
Block a user