1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-19 05:58:09 +00:00

chore(core): remove SBU interface from python

[no changelog]
This commit is contained in:
tychovrahe 2024-09-25 12:02:20 +02:00 committed by TychoVrahe
parent 10eaa15427
commit d361c23224
5 changed files with 8 additions and 88 deletions

View File

@ -1,66 +0,0 @@
/*
* This file is part of the Trezor project, https://trezor.io/
*
* 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/>.
*/
#include "sbu.h"
/// package: trezorio.__init__
/// class SBU:
/// """
/// """
typedef struct _mp_obj_SBU_t {
mp_obj_base_t base;
} mp_obj_SBU_t;
/// def __init__(self) -> None:
/// """
/// """
STATIC mp_obj_t mod_trezorio_SBU_make_new(const mp_obj_type_t *type,
size_t n_args, size_t n_kw,
const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 0, 0, false);
mp_obj_SBU_t *o = mp_obj_malloc(mp_obj_SBU_t, type);
sbu_init();
return MP_OBJ_FROM_PTR(o);
}
/// def set(self, sbu1: bool, sbu2: bool) -> None:
/// """
/// Sets SBU wires to sbu1 and sbu2 values respectively
/// """
STATIC mp_obj_t mod_trezorio_SBU_set(mp_obj_t self, mp_obj_t sbu1,
mp_obj_t sbu2) {
sbu_set(sectrue * mp_obj_is_true(sbu1), sectrue * mp_obj_is_true(sbu2));
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(mod_trezorio_SBU_set_obj,
mod_trezorio_SBU_set);
STATIC const mp_rom_map_elem_t mod_trezorio_SBU_locals_dict_table[] = {
{MP_ROM_QSTR(MP_QSTR_set), MP_ROM_PTR(&mod_trezorio_SBU_set_obj)},
};
STATIC MP_DEFINE_CONST_DICT(mod_trezorio_SBU_locals_dict,
mod_trezorio_SBU_locals_dict_table);
STATIC const mp_obj_type_t mod_trezorio_SBU_type = {
{&mp_type_type},
.name = MP_QSTR_SBU,
.make_new = mod_trezorio_SBU_make_new,
.locals_dict = (void *)&mod_trezorio_SBU_locals_dict,
};

View File

@ -49,9 +49,6 @@ uint32_t last_touch_sample_time = 0;
#include "modtrezorio-webusb.h" #include "modtrezorio-webusb.h"
#include "modtrezorio-usb.h" #include "modtrezorio-usb.h"
// clang-format on // clang-format on
#ifdef USE_SBU
#include "modtrezorio-sbu.h"
#endif
#ifdef USE_SD_CARD #ifdef USE_SD_CARD
#include "modtrezorio-fatfs.h" #include "modtrezorio-fatfs.h"
#include "modtrezorio-sdcard.h" #include "modtrezorio-sdcard.h"
@ -84,10 +81,6 @@ uint32_t last_touch_sample_time = 0;
STATIC const mp_rom_map_elem_t mp_module_trezorio_globals_table[] = { STATIC const mp_rom_map_elem_t mp_module_trezorio_globals_table[] = {
{MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_trezorio)}, {MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_trezorio)},
#ifdef USE_SBU
{MP_ROM_QSTR(MP_QSTR_SBU), MP_ROM_PTR(&mod_trezorio_SBU_type)},
#endif
#ifdef USE_SD_CARD #ifdef USE_SD_CARD
{MP_ROM_QSTR(MP_QSTR_fatfs), MP_ROM_PTR(&mod_trezorio_fatfs_module)}, {MP_ROM_QSTR(MP_QSTR_fatfs), MP_ROM_PTR(&mod_trezorio_fatfs_module)},
{MP_ROM_QSTR(MP_QSTR_sdcard), MP_ROM_PTR(&mod_trezorio_sdcard_module)}, {MP_ROM_QSTR(MP_QSTR_sdcard), MP_ROM_PTR(&mod_trezorio_sdcard_module)},

View File

@ -22,7 +22,11 @@
#include "secbool.h" #include "secbool.h"
#if KERNEL_MODE
void sbu_init(void); void sbu_init(void);
void sbu_set(secbool sbu1, secbool sbu2); void sbu_set(secbool sbu1, secbool sbu2);
#endif #endif
#endif

View File

@ -21,6 +21,8 @@
#include "sbu.h" #include "sbu.h"
#if KERNEL_MODE
void sbu_init(void) { void sbu_init(void) {
GPIO_InitTypeDef GPIO_InitStructure = {0}; GPIO_InitTypeDef GPIO_InitStructure = {0};
@ -41,3 +43,5 @@ void sbu_set(secbool sbu1, secbool sbu2) {
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3,
sbu2 == sectrue ? GPIO_PIN_SET : GPIO_PIN_RESET); sbu2 == sectrue ? GPIO_PIN_SET : GPIO_PIN_RESET);
} }
#endif

View File

@ -56,21 +56,6 @@ def poll(ifaces: Iterable[int], list_ref: list, timeout_ms: int) -> bool:
""" """
# extmod/modtrezorio/modtrezorio-sbu.h
class SBU:
"""
"""
def __init__(self) -> None:
"""
"""
def set(self, sbu1: bool, sbu2: bool) -> None:
"""
Sets SBU wires to sbu1 and sbu2 values respectively
"""
# extmod/modtrezorio/modtrezorio-usb.h # extmod/modtrezorio/modtrezorio-usb.h
class USB: class USB:
""" """