Skip to content

Commit 7553832

Browse files
committed
apex_p target support in SDK crates
1 parent c4651f3 commit 7553832

File tree

11 files changed

+29
-29
lines changed

11 files changed

+29
-29
lines changed

ledger_device_sdk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ default = [ "heap" ]
3434

3535
[lints.rust.unexpected_cfgs]
3636
level = "warn"
37-
check-cfg = ['cfg(target_os, values("stax", "flex", "nanox", "nanosplus"))']
37+
check-cfg = ['cfg(target_os, values("apex_p", "stax", "flex", "nanox", "nanosplus"))']

ledger_device_sdk/src/io.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
#[cfg(not(any(target_os = "stax", target_os = "flex")))]
1+
#[cfg(not(any(target_os = "stax", target_os = "flex", target_os = "apex_p")))]
22
use ledger_secure_sdk_sys::buttons::{get_button_event, ButtonEvent, ButtonsState};
33
use ledger_secure_sdk_sys::seph as sys_seph;
44
use ledger_secure_sdk_sys::*;
55

66
use crate::seph;
77

8-
#[cfg(any(target_os = "nanox", target_os = "stax", target_os = "flex"))]
8+
#[cfg(any(target_os = "nanox", target_os = "stax", target_os = "flex", target_os = "apex_p"))]
99
use crate::seph::ItcUxEvent;
1010

1111
use core::convert::{Infallible, TryFrom};
1212
use core::ops::{Index, IndexMut};
1313

14-
#[cfg(any(target_os = "nanox", target_os = "stax", target_os = "flex"))]
14+
#[cfg(any(target_os = "nanox", target_os = "stax", target_os = "flex", target_os = "apex_p"))]
1515
unsafe extern "C" {
1616
pub unsafe static mut G_ux_params: bolos_ux_params_t;
1717
}
@@ -96,9 +96,9 @@ pub enum Event<T> {
9696
/// APDU event
9797
Command(T),
9898
/// Button press or release event
99-
#[cfg(not(any(target_os = "stax", target_os = "flex")))]
99+
#[cfg(not(any(target_os = "stax", target_os = "flex", target_os = "apex_p")))]
100100
Button(ButtonEvent),
101-
#[cfg(any(target_os = "stax", target_os = "flex"))]
101+
#[cfg(any(target_os = "stax", target_os = "flex", target_os = "apex_p"))]
102102
TouchEvent,
103103
/// Ticker
104104
Ticker,
@@ -111,7 +111,7 @@ pub struct Comm {
111111
pub rx: usize,
112112
pub tx: usize,
113113
pub event_pending: bool,
114-
#[cfg(not(any(target_os = "stax", target_os = "flex")))]
114+
#[cfg(not(any(target_os = "stax", target_os = "flex", target_os = "apex_p")))]
115115
buttons: ButtonsState,
116116
/// Expected value for the APDU CLA byte.
117117
/// If defined, [`Comm`] will automatically reply with [`StatusWords::BadCla`] when an APDU
@@ -152,7 +152,7 @@ impl Comm {
152152
rx: 0,
153153
tx: 0,
154154
event_pending: false,
155-
#[cfg(not(any(target_os = "stax", target_os = "flex")))]
155+
#[cfg(not(any(target_os = "stax", target_os = "flex", target_os = "apex_p")))]
156156
buttons: ButtonsState::new(),
157157
expected_cla: None,
158158
apdu_type: seph::PacketTypes::PacketTypeNone as u8,
@@ -185,7 +185,7 @@ impl Comm {
185185
// This is private. Users should call reply to set the satus word and
186186
// transmit the response.
187187
fn apdu_send(&mut self) {
188-
#[cfg(any(target_os = "stax", target_os = "flex", feature = "nano_nbgl"))]
188+
#[cfg(any(target_os = "stax", target_os = "flex", target_os = "apex_p", feature = "nano_nbgl"))]
189189
{
190190
let mut buffer: [u8; 273] = [0; 273];
191191
let status = sys_seph::io_rx(&mut buffer, false);
@@ -343,7 +343,7 @@ impl Comm {
343343

344344
match seph::Events::from(tag) {
345345
// BUTTON PUSH EVENT
346-
#[cfg(not(any(target_os = "stax", target_os = "flex")))]
346+
#[cfg(not(any(target_os = "stax", target_os = "flex", target_os = "apex_p")))]
347347
seph::Events::ButtonPushEvent => {
348348
#[cfg(feature = "nano_nbgl")]
349349
unsafe {
@@ -356,15 +356,15 @@ impl Comm {
356356
}
357357

358358
// SCREEN TOUCH EVENT
359-
#[cfg(any(target_os = "stax", target_os = "flex"))]
359+
#[cfg(any(target_os = "stax", target_os = "flex", target_os = "apex_p"))]
360360
seph::Events::ScreenTouchEvent => unsafe {
361361
ux_process_finger_event(seph_buffer.as_mut_ptr());
362362
return Some(Event::TouchEvent);
363363
},
364364

365365
// TICKER EVENT
366366
seph::Events::TickerEvent => {
367-
#[cfg(any(target_os = "stax", target_os = "flex", feature = "nano_nbgl"))]
367+
#[cfg(any(target_os = "stax", target_os = "flex", target_os = "apex_p", feature = "nano_nbgl"))]
368368
unsafe {
369369
ux_process_ticker_event();
370370
}
@@ -373,7 +373,7 @@ impl Comm {
373373

374374
// ITC EVENT
375375
seph::Events::ItcEvent => {
376-
#[cfg(any(target_os = "nanox", target_os = "stax", target_os = "flex"))]
376+
#[cfg(any(target_os = "nanox", target_os = "stax", target_os = "flex", target_os = "apex_p"))]
377377
match ItcUxEvent::from(seph_buffer[3]) {
378378
seph::ItcUxEvent::AskBlePairing => unsafe {
379379
G_ux_params.ux_id = BOLOS_UX_ASYNCHMODAL_PAIRING_REQUEST;
@@ -397,7 +397,7 @@ impl Comm {
397397
},
398398

399399
seph::ItcUxEvent::Redisplay => {
400-
#[cfg(any(target_os = "stax", target_os = "flex", feature = "nano_nbgl"))]
400+
#[cfg(any(target_os = "stax", target_os = "flex", target_os = "apex_p", feature = "nano_nbgl"))]
401401
unsafe {
402402
nbgl_objAllowDrawing(true);
403403
nbgl_screenRedraw();
@@ -412,7 +412,7 @@ impl Comm {
412412

413413
// DEFAULT EVENT
414414
_ => {
415-
#[cfg(any(target_os = "stax", target_os = "flex", feature = "nano_nbgl"))]
415+
#[cfg(any(target_os = "stax", target_os = "flex", target_os = "apex_p", feature = "nano_nbgl"))]
416416
unsafe {
417417
ux_process_default_event();
418418
}

ledger_device_sdk/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ pub mod seph;
1919

2020
pub mod testing;
2121

22-
#[cfg(any(target_os = "stax", target_os = "flex", feature = "nano_nbgl"))]
22+
#[cfg(any(target_os = "stax", target_os = "flex", target_os = "apex_p", feature = "nano_nbgl"))]
2323
pub mod nbgl;
24-
#[cfg(not(any(target_os = "stax", target_os = "flex", feature = "nano_nbgl")))]
24+
#[cfg(not(any(target_os = "stax", target_os = "flex", target_os = "apex_p", feature = "nano_nbgl")))]
2525
pub mod ui;
2626

2727
pub mod uxapp;

ledger_device_sdk/src/libcall/swap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[cfg(any(target_os = "stax", target_os = "flex"))]
1+
#[cfg(any(target_os = "stax", target_os = "flex", target_os = "apex_p", feature = "nano_nbgl"))]
22
use crate::nbgl::NbglSpinner;
33
use crate::testing::debug_print;
44
use ledger_secure_sdk_sys::{
@@ -298,7 +298,7 @@ pub fn sign_tx_params<const COIN_CONFIG_BUF_SIZE: usize, const ADDRESS_BUF_SIZE:
298298
c_boot_std();
299299
}
300300

301-
#[cfg(any(target_os = "stax", target_os = "flex"))]
301+
#[cfg(any(target_os = "stax", target_os = "flex", target_os = "apex_p", feature = "nano_nbgl"))]
302302
NbglSpinner::new().show("Signing");
303303

304304
create_tx_params

ledger_device_sdk/src/nbgl.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use ledger_secure_sdk_sys::*;
1010

1111
pub mod nbgl_address_review;
1212
pub mod nbgl_choice;
13-
#[cfg(any(target_os = "stax", target_os = "flex"))]
13+
#[cfg(any(target_os = "stax", target_os = "flex", target_os = "apex_p"))]
1414
pub mod nbgl_generic_review;
1515
pub mod nbgl_home_and_settings;
1616
pub mod nbgl_review;
@@ -21,7 +21,7 @@ pub mod nbgl_streaming_review;
2121

2222
pub use nbgl_address_review::*;
2323
pub use nbgl_choice::*;
24-
#[cfg(any(target_os = "stax", target_os = "flex"))]
24+
#[cfg(any(target_os = "stax", target_os = "flex", target_os = "apex_p"))]
2525
pub use nbgl_generic_review::*;
2626
pub use nbgl_home_and_settings::*;
2727
pub use nbgl_review::*;
@@ -107,7 +107,7 @@ unsafe extern "C" fn quit_callback() {
107107
G_ENDED = true;
108108
}
109109

110-
#[cfg(any(target_os = "stax", target_os = "flex"))]
110+
#[cfg(any(target_os = "stax", target_os = "flex", target_os = "apex_p"))]
111111
unsafe extern "C" fn rejected_callback() {
112112
G_RET = SyncNbgl::UxSyncRetRejected.into();
113113
G_ENDED = true;

ledger_device_sdk/src/nbgl/nbgl_home_and_settings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl<'a> NbglHomeAndSettings {
182182
};
183183
SWITCH_ARRAY[i].initState = state;
184184
SWITCH_ARRAY[i].token = (FIRST_USER_TOKEN + i as u32) as u8;
185-
#[cfg(any(target_os = "stax", target_os = "flex"))]
185+
#[cfg(any(target_os = "stax", target_os = "flex", target_os = "apex_p"))]
186186
{
187187
SWITCH_ARRAY[i].tuneId = TuneIndex::TapCasual as u8;
188188
}
@@ -275,7 +275,7 @@ impl<'a> NbglHomeAndSettings {
275275
};
276276
SWITCH_ARRAY[i].initState = state;
277277
SWITCH_ARRAY[i].token = (FIRST_USER_TOKEN + i as u32) as u8;
278-
#[cfg(any(target_os = "stax", target_os = "flex"))]
278+
#[cfg(any(target_os = "stax", target_os = "flex", target_os = "apex_p"))]
279279
{
280280
SWITCH_ARRAY[i].tuneId = TuneIndex::TapCasual as u8;
281281
}

ledger_device_sdk/src/nvm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ macro_rules! atomic_storage {
186186

187187
#[cfg(target_os = "nanox")]
188188
atomic_storage!(256);
189-
#[cfg(any(target_os = "nanosplus", target_os = "stax", target_os = "flex"))]
189+
#[cfg(any(target_os = "nanosplus", target_os = "stax", target_os = "flex", target_os = "apex_p"))]
190190
atomic_storage!(512);
191191

192192
pub enum AtomicStorageElem {

ledger_device_sdk/src/seph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub fn handle_event(_apdu_buffer: &mut [u8], spi_buffer: &[u8]) {
9393
let _len = u16::from_be_bytes([spi_buffer[1], spi_buffer[2]]);
9494
match Events::from(spi_buffer[0]) {
9595
Events::TickerEvent => {
96-
#[cfg(any(target_os = "stax", target_os = "flex", feature = "nano_nbgl"))]
96+
#[cfg(any(target_os = "apex_p", target_os = "stax", target_os = "flex", feature = "nano_nbgl"))]
9797
unsafe {
9898
ux_process_ticker_event();
9999
}

ledger_device_sdk/src/uxapp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl UxEvent {
4242
Self::ValidatePIN as u8
4343
}
4444
Self::DelayLock => {
45-
#[cfg(any(target_os = "stax", target_os = "flex", feature = "nano_nbgl"))]
45+
#[cfg(any(target_os = "apex_p", target_os = "stax", target_os = "flex", feature = "nano_nbgl"))]
4646
{
4747
G_ux_params.u.lock_delay.delay_ms = 10000;
4848
}

ledger_secure_sdk_sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ debug_csdk = []
2323

2424
[lints.rust.unexpected_cfgs]
2525
level = "warn"
26-
check-cfg = ['cfg(target_os, values("stax", "flex", "nanox", "nanosplus"))']
26+
check-cfg = ['cfg(target_os, values("apex_p", "stax", "flex", "nanox", "nanosplus"))']

0 commit comments

Comments
 (0)