Skip to content

Commit ea3f817

Browse files
committed
io revamp upgrade
1 parent f6a8607 commit ea3f817

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

bolos-sys/build.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ use std::{env, path::PathBuf};
33
fn sdk_includes(target: &str) -> impl IntoIterator<Item = PathBuf> {
44
[
55
PathBuf::from("include"),
6+
PathBuf::from("io/include"),
7+
PathBuf::from("io_legacy/include"),
68
PathBuf::from("target").join(target).join("include"),
79
PathBuf::from("lib_ux").join("include"),
810
PathBuf::from("lib_cxng").join("include"),
@@ -151,7 +153,7 @@ fn main() {
151153
.map(|path| format!("-I{}", path.display())),
152154
)
153155
.clang_arg(format!("-I{}", sdk_path.display()))
154-
.clang_arg(format!("-I{}/include", sdk_path.display()))
156+
.clang_arg("-D OS_IO_SEPH_BUFFER_SIZE=272")
155157
.generate()
156158
.expect("able to generate bindings");
157159
bindings

zemu/build.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::env;
1+
use std::{env, fs, path};
22

33
#[derive(Debug, Clone, Copy)]
44
enum Device {
@@ -24,6 +24,11 @@ fn main() {
2424

2525
if let Some(v) = env::var_os("BOLOS_SDK") {
2626
if !v.is_empty() {
27+
if let Ok(contents) = fs::read_to_string(path::Path::new(&v).join("Makefile.defines")) {
28+
if contents.contains("REVAMPED_IO") {
29+
println!("cargo:rustc-cfg=revamped_io");
30+
}
31+
}
2732
match detect_device().expect("invalid or unable to retrieve TARGET_NAME") {
2833
Device::NanoS => println!("cargo:rustc-cfg=nanos"),
2934
Device::NanoX => println!("cargo:rustc-cfg=nanox"),

zemu/src/ui.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ impl Into<bindings::zxerr_t> for ViewError {
4242
}
4343

4444
pub(crate) fn apdu_buffer_mut() -> &'static mut [u8] {
45-
PIC::new(unsafe { &mut bolos_sys::raw::G_io_apdu_buffer }).into_inner()
45+
PIC::new(unsafe {
46+
cfg_if::cfg_if! {
47+
if #[cfg(revamped_io)] { &mut bolos_sys::raw::G_io_tx_buffer }
48+
else { &mut bolos_sys::raw::G_io_apdu_buffer }
49+
}
50+
})
51+
.into_inner()
4652
}
4753

4854
pub(crate) fn store_into<'buf, T: Sized>(

0 commit comments

Comments
 (0)