First stax impl

This commit is contained in:
Clement Bouvet
2022-12-01 15:27:20 +01:00
parent f1c7ba8fec
commit 373f52fabe
23 changed files with 1153 additions and 19 deletions
-1
View File
@@ -9,7 +9,6 @@ void ui_display_public_eth2(void);
void ui_display_privacy_public_key(void);
void ui_display_privacy_shared_secret(void);
void ui_display_public_key(void);
void ui_display_sign(void);
void ui_sign_712_v0(void);
void ui_display_stark_public(void);
void ui_confirm_selector(void);
+6 -1
View File
@@ -65,7 +65,12 @@ void handle_swap_sign_transaction(chain_config_t* config) {
nvm_write((void*) &N_storage, (void*) &storage, sizeof(internalStorage_t));
}
UX_INIT();
#ifdef HAVE_BAGL
UX_INIT();
#endif // HAVE_BAGL
#ifdef HAVE_NBGL
nbgl_objInit();
#endif // HAVE_NBGL
USB_power(0);
USB_power(1);
// ui_idle();
+19 -8
View File
@@ -61,6 +61,8 @@ uint32_t eth2WithdrawalIndex;
#include "withdrawal_index.h"
#endif
uint16_t G_ticks;
#include "ux.h"
ux_state_t G_ux;
bolos_ux_params_t G_ux_params;
@@ -854,9 +856,11 @@ void app_main(void) {
}
// override point, but nothing more to do
#ifdef HAVE_BAGL
void io_seproxyhal_display(const bagl_element_t *element) {
io_seproxyhal_display_default((bagl_element_t *) element);
}
#endif
unsigned char io_event(__attribute__((unused)) unsigned char channel) {
// nothing done with the event, throw an error on the transport layer if
@@ -867,33 +871,35 @@ unsigned char io_event(__attribute__((unused)) unsigned char channel) {
case SEPROXYHAL_TAG_FINGER_EVENT:
UX_FINGER_EVENT(G_io_seproxyhal_spi_buffer);
break;
#ifdef HAVE_BAGL
case SEPROXYHAL_TAG_BUTTON_PUSH_EVENT:
UX_BUTTON_PUSH_EVENT(G_io_seproxyhal_spi_buffer);
break;
#endif // HAVE_BAGL
case SEPROXYHAL_TAG_STATUS_EVENT:
if (G_io_apdu_media == IO_APDU_MEDIA_USB_HID &&
!(U4BE(G_io_seproxyhal_spi_buffer, 3) &
SEPROXYHAL_TAG_STATUS_EVENT_FLAG_USB_POWERED)) {
THROW(EXCEPTION_IO_RESET);
}
// if (G_io_apdu_media == IO_APDU_MEDIA_USB_HID &&
// !(U4BE(G_io_seproxyhal_spi_buffer, 3) &
// SEPROXYHAL_TAG_STATUS_EVENT_FLAG_USB_POWERED)) {
// THROW(EXCEPTION_IO_RESET);
// }
// no break is intentional
default:
UX_DEFAULT_EVENT();
break;
case SEPROXYHAL_TAG_DISPLAY_PROCESSED_EVENT:
#ifdef HAVE_BAGL
UX_DISPLAYED_EVENT({});
#endif // HAVE_BAGL
break;
#if 0
case SEPROXYHAL_TAG_TICKER_EVENT:
G_ticks++;
UX_TICKER_EVENT(G_io_seproxyhal_spi_buffer,
{
});
break;
#endif
}
// close the event if not done previously (by a display or whatever)
@@ -935,7 +941,12 @@ void coin_main(chain_config_t *coin_config) {
tmpCtx.transactionContext.currentItemIndex = 0;
for (;;) {
#ifdef HAVE_BAGL
UX_INIT();
#endif // HAVE_BAGL
#ifdef HAVE_NBGL
nbgl_objInit();
#endif // HAVE_NBGL
BEGIN_TRY {
TRY {
+4
View File
@@ -4,6 +4,10 @@
#include "shared_context.h"
#include "ux.h"
#ifdef HAVE_NBGL
typedef int bagl_element_t;
#endif
unsigned int io_seproxyhal_touch_settings(const bagl_element_t *e);
unsigned int io_seproxyhal_touch_exit(const bagl_element_t *e);
unsigned int io_seproxyhal_touch_tx_ok(const bagl_element_t *e);