aboutsummaryrefslogtreecommitdiff
path: root/cyw43-pio
diff options
context:
space:
mode:
authorpennae <[email protected]>2023-07-28 18:45:57 +0200
committerpennae <[email protected]>2023-07-28 19:33:02 +0200
commitcbc8871a0bb40eb5fec82e7c27ed4c0127844c3c (patch)
tree333ab4bc2d1893d42529c6a378ea51c42f8c8d22 /cyw43-pio
parentd752a3f9808ec9be64c720d3f80f152f0b7507df (diff)
rp: relocate programs implicitly during load
this removed the RelocatedProgram construction step from pio uses. there's not all that much to be said for the extra step because the origin can be set on the input program itself, and the remaining information exposed by RelocatedProgram can be exposed from LoadedProgram instead (even though it's already available on the pio_asm programs, albeit perhaps less convenient). we do lose access to the relocated instruction iterator, but we also cannot think of anything this iterator would actually be useful for outside of program loading.
Diffstat (limited to 'cyw43-pio')
-rw-r--r--cyw43-pio/src/lib.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/cyw43-pio/src/lib.rs b/cyw43-pio/src/lib.rs
index dca30c74d..830a5b44a 100644
--- a/cyw43-pio/src/lib.rs
+++ b/cyw43-pio/src/lib.rs
@@ -8,7 +8,6 @@ use cyw43::SpiBusCyw43;
8use embassy_rp::dma::Channel; 8use embassy_rp::dma::Channel;
9use embassy_rp::gpio::{Drive, Level, Output, Pin, Pull, SlewRate}; 9use embassy_rp::gpio::{Drive, Level, Output, Pin, Pull, SlewRate};
10use embassy_rp::pio::{Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine}; 10use embassy_rp::pio::{Common, Config, Direction, Instance, Irq, PioPin, ShiftDirection, StateMachine};
11use embassy_rp::relocate::RelocatedProgram;
12use embassy_rp::{pio_instr_util, Peripheral, PeripheralRef}; 11use embassy_rp::{pio_instr_util, Peripheral, PeripheralRef};
13use fixed::FixedU32; 12use fixed::FixedU32;
14use pio_proc::pio_asm; 13use pio_proc::pio_asm;
@@ -88,8 +87,6 @@ where
88 ".wrap" 87 ".wrap"
89 ); 88 );
90 89
91 let relocated = RelocatedProgram::new(&program.program);
92
93 let mut pin_io: embassy_rp::pio::Pin<PIO> = common.make_pio_pin(dio); 90 let mut pin_io: embassy_rp::pio::Pin<PIO> = common.make_pio_pin(dio);
94 pin_io.set_pull(Pull::None); 91 pin_io.set_pull(Pull::None);
95 pin_io.set_schmitt(true); 92 pin_io.set_schmitt(true);
@@ -102,7 +99,8 @@ where
102 pin_clk.set_slew_rate(SlewRate::Fast); 99 pin_clk.set_slew_rate(SlewRate::Fast);
103 100
104 let mut cfg = Config::default(); 101 let mut cfg = Config::default();
105 cfg.use_program(&common.load_program(&relocated), &[&pin_clk]); 102 let loaded_program = common.load_program(&program.program);
103 cfg.use_program(&loaded_program, &[&pin_clk]);
106 cfg.set_out_pins(&[&pin_io]); 104 cfg.set_out_pins(&[&pin_io]);
107 cfg.set_in_pins(&[&pin_io]); 105 cfg.set_in_pins(&[&pin_io]);
108 cfg.set_set_pins(&[&pin_io]); 106 cfg.set_set_pins(&[&pin_io]);
@@ -142,7 +140,7 @@ where
142 sm, 140 sm,
143 irq, 141 irq,
144 dma: dma.into_ref(), 142 dma: dma.into_ref(),
145 wrap_target: relocated.wrap().target, 143 wrap_target: loaded_program.wrap.target,
146 } 144 }
147 } 145 }
148 146