diff --git a/apps/hello/src/main.rs b/apps/hello/src/main.rs index e0d565eab..ac78892fa 100644 --- a/apps/hello/src/main.rs +++ b/apps/hello/src/main.rs @@ -69,11 +69,11 @@ impl Hello { self.gam .draw_rectangle( self.content, - Rectangle::new_with_style(Point::new(0, 0), self.screensize, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }), + Rectangle::new_with_style( + Point::new(0, 0), + self.screensize, + DrawStyle { fill_color: Some(PixelColor::Light), stroke_color: None, stroke_width: 0 }, + ), ) .expect("can't clear content area"); } diff --git a/apps/hidv2/src/main.rs b/apps/hidv2/src/main.rs index 324cc3cde..81671e565 100644 --- a/apps/hidv2/src/main.rs +++ b/apps/hidv2/src/main.rs @@ -79,11 +79,11 @@ impl HIDv2Demo { self.gam .draw_rectangle( self.content, - Rectangle::new_with_style(Point::new(0, 0), self.screensize, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }), + Rectangle::new_with_style( + Point::new(0, 0), + self.screensize, + DrawStyle { fill_color: Some(PixelColor::Light), stroke_color: None, stroke_width: 0 }, + ), ) .expect("can't clear content area"); } diff --git a/apps/mtxcli/src/mtxcli.rs b/apps/mtxcli/src/mtxcli.rs index f558151f7..b6d61fe12 100644 --- a/apps/mtxcli/src/mtxcli.rs +++ b/apps/mtxcli/src/mtxcli.rs @@ -148,11 +148,11 @@ impl Mtxcli { self.gam .draw_rectangle( self.content, - Rectangle::new_with_style(Point::new(0, 0), self.screensize, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }), + Rectangle::new_with_style( + Point::new(0, 0), + self.screensize, + DrawStyle { fill_color: Some(PixelColor::Light), stroke_color: None, stroke_width: 0 }, + ), ) .expect("can't clear content area"); } diff --git a/apps/repl/src/repl.rs b/apps/repl/src/repl.rs index 6e7ea1764..e49192557 100644 --- a/apps/repl/src/repl.rs +++ b/apps/repl/src/repl.rs @@ -153,11 +153,11 @@ impl Repl { self.gam .draw_rectangle( self.content, - Rectangle::new_with_style(Point::new(0, 0), self.screensize, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }), + Rectangle::new_with_style( + Point::new(0, 0), + self.screensize, + DrawStyle { fill_color: Some(PixelColor::Light), stroke_color: None, stroke_width: 0 }, + ), ) .expect("can't clear content area"); } diff --git a/apps/transientdisk/src/main.rs b/apps/transientdisk/src/main.rs index b163d140c..2f30a8482 100644 --- a/apps/transientdisk/src/main.rs +++ b/apps/transientdisk/src/main.rs @@ -64,11 +64,11 @@ impl UI { self.gam .draw_rectangle( self.content, - Rectangle::new_with_style(Point::new(0, 0), self.screensize, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }), + Rectangle::new_with_style( + Point::new(0, 0), + self.screensize, + DrawStyle { fill_color: Some(PixelColor::Light), stroke_color: None, stroke_width: 0 }, + ), ) .expect("can't clear content area"); } diff --git a/apps/vault/src/prereqs.rs b/apps/vault/src/prereqs.rs index e6f7ff8a0..ea443c22d 100644 --- a/apps/vault/src/prereqs.rs +++ b/apps/vault/src/prereqs.rs @@ -84,11 +84,15 @@ pub(crate) fn prereqs(sid: xous::SID, time_conn: xous::CID) -> ([u32; 4], bool) if allow_redraw { gam.draw_rectangle( content, - Rectangle::new_with_style(Point::new(0, 0), screensize, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }), + Rectangle::new_with_style( + Point::new(0, 0), + screensize, + DrawStyle { + fill_color: Some(PixelColor::Light), + stroke_color: None, + stroke_width: 0, + }, + ), ) .expect("can't clear content area"); diff --git a/apps/vault/src/ux/framework.rs b/apps/vault/src/ux/framework.rs index a2fa06564..1b5db5d79 100644 --- a/apps/vault/src/ux/framework.rs +++ b/apps/vault/src/ux/framework.rs @@ -313,11 +313,15 @@ impl VaultUx { self.gam .draw_rectangle( self.content, - Rectangle::new_with_style(Point::new(0, 0), self.screensize, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }), + Rectangle::new_with_style( + Point::new(0, 0), + self.screensize, + DrawStyle { + fill_color: Some(PixelColor::Light), + stroke_color: None, + stroke_width: 0, + }, + ), ) .expect("can't clear content area"); self.title_dirty = true; // just blanked the whole area, have to redraw the title. @@ -360,11 +364,15 @@ impl VaultUx { self.gam .draw_rectangle( self.content, - Rectangle::new_with_style(tl, br, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }), + Rectangle::new_with_style( + tl, + br, + DrawStyle { + fill_color: Some(PixelColor::Light), + stroke_color: None, + stroke_width: 0, + }, + ), ) .expect("can't clear content area"); // reset the search @@ -379,11 +387,15 @@ impl VaultUx { self.gam .draw_rectangle( self.content, - Rectangle::new_with_style(tl, self.screensize, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }), + Rectangle::new_with_style( + tl, + self.screensize, + DrawStyle { + fill_color: Some(PixelColor::Light), + stroke_color: None, + stroke_width: 0, + }, + ), ) .expect("can't clear content area"); } else if dirty_tl.is_none() && dirty_br.is_none() { @@ -393,11 +405,15 @@ impl VaultUx { self.gam .draw_rectangle( self.content, - Rectangle::new_with_style(Point::new(0, insert_at + 1), self.screensize, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }), + Rectangle::new_with_style( + Point::new(0, insert_at + 1), + self.screensize, + DrawStyle { + fill_color: Some(PixelColor::Light), + stroke_color: None, + stroke_width: 0, + }, + ), ) .expect("can't clear content area"); } @@ -451,18 +467,21 @@ impl VaultUx { let width = (self.screensize.x - (self.margin.x * 2)) as i32; let delta_width = (delta * width * 100) / (30 * 100); self.gam - .draw_rectangle(self.content, Rectangle { - tl: Point::new(self.margin.x, TITLE_HEIGHT - (BAR_HEIGHT + BAR_GAP)), - br: Point::new( - self.screensize.x - self.margin.x - delta_width as i16, - TITLE_HEIGHT - BAR_GAP, - ), - style: DrawStyle { - fill_color: Some(PixelColor::Dark), - stroke_color: None, - stroke_width: 0, + .draw_rectangle( + self.content, + Rectangle { + tl: Point::new(self.margin.x, TITLE_HEIGHT - (BAR_HEIGHT + BAR_GAP)), + br: Point::new( + self.screensize.x - self.margin.x - delta_width as i16, + TITLE_HEIGHT - BAR_GAP, + ), + style: DrawStyle { + fill_color: Some(PixelColor::Dark), + stroke_color: None, + stroke_width: 0, + }, }, - }) + ) .ok(); } self.title_dirty = false; diff --git a/kernel/src/arch/arm/process.rs b/kernel/src/arch/arm/process.rs index 1826887a4..b87fec695 100644 --- a/kernel/src/arch/arm/process.rs +++ b/kernel/src/arch/arm/process.rs @@ -364,9 +364,14 @@ impl Process { if sp <= 16 { return Err(xous_kernel::Error::BadAddress); } - crate::arch::syscall::invoke(thread, pid == 1, entrypoint, (sp - 16) & !0xf, EXIT_THREAD, &[ - setup.arg1, setup.arg2, setup.arg3, setup.arg4, - ]); + crate::arch::syscall::invoke( + thread, + pid == 1, + entrypoint, + (sp - 16) & !0xf, + EXIT_THREAD, + &[setup.arg1, setup.arg2, setup.arg3, setup.arg4], + ); Ok(()) } diff --git a/kernel/src/arch/riscv/process.rs b/kernel/src/arch/riscv/process.rs index 089ab3a5e..5209b62b9 100644 --- a/kernel/src/arch/riscv/process.rs +++ b/kernel/src/arch/riscv/process.rs @@ -414,9 +414,14 @@ impl Process { *val = 0; } thread.sepc = 0; - crate::arch::syscall::invoke(thread, pid == 1, entrypoint, (sp - 16) & !0xf, EXIT_THREAD, &[ - setup.arg1, setup.arg2, setup.arg3, setup.arg4, - ]); + crate::arch::syscall::invoke( + thread, + pid == 1, + entrypoint, + (sp - 16) & !0xf, + EXIT_THREAD, + &[setup.arg1, setup.arg2, setup.arg3, setup.arg4], + ); Ok(()) } diff --git a/kernel/src/debug/gdb.rs b/kernel/src/debug/gdb.rs index 0d2878438..d050087a0 100644 --- a/kernel/src/debug/gdb.rs +++ b/kernel/src/debug/gdb.rs @@ -258,10 +258,13 @@ pub fn report_stop(_pid: xous_kernel::PID, tid: xous_kernel::TID, _pc: usize) { return; }; - let Ok(new_gdb) = inner.report_stop(&mut target, MultiThreadStopReason::SignalWithThread { - signal: Signal::EXC_BREAKPOINT, - tid: Tid::new(tid).unwrap(), - }) else { + let Ok(new_gdb) = inner.report_stop( + &mut target, + MultiThreadStopReason::SignalWithThread { + signal: Signal::EXC_BREAKPOINT, + tid: Tid::new(tid).unwrap(), + }, + ) else { println!("Unable to report stop"); return; }; diff --git a/libs/chat/src/ui.rs b/libs/chat/src/ui.rs index 75008166a..09f20b3a6 100644 --- a/libs/chat/src/ui.rs +++ b/libs/chat/src/ui.rs @@ -691,11 +691,15 @@ impl Ui { self.gam .draw_rectangle( self.vp.canvas, - Rectangle::new_with_style(Point::new(0, 0), self.vp.total_screensize, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }), + Rectangle::new_with_style( + Point::new(0, 0), + self.vp.total_screensize, + DrawStyle { + fill_color: Some(PixelColor::Light), + stroke_color: None, + stroke_width: 0, + }, + ), ) .expect("can't clear canvas area"); diff --git a/libs/cramium-hal/src/board/baosec.rs b/libs/cramium-hal/src/board/baosec.rs index 3664ac588..c226c80d3 100644 --- a/libs/cramium-hal/src/board/baosec.rs +++ b/libs/cramium-hal/src/board/baosec.rs @@ -266,11 +266,10 @@ pub fn setup_kb_pins(iox: &T) -> ([(IoxPort, u8); 3], [(Iox Some(IoxDriveStrength::Drive2mA), ); } - ([(KB_PORT, R_PINS[0]), (KB_PORT, R_PINS[1]), (KB_PORT, R_PINS[2])], [ - (KB_PORT, C_PINS[0]), - (KB_PORT, C_PINS[1]), - (KB_PORT, C_PINS[2]), - ]) + ( + [(KB_PORT, R_PINS[0]), (KB_PORT, R_PINS[1]), (KB_PORT, R_PINS[2])], + [(KB_PORT, C_PINS[0]), (KB_PORT, C_PINS[1]), (KB_PORT, C_PINS[2])], + ) } pub fn setup_pmic_irq(iox: &T, server: &str, opcode: usize) { diff --git a/services/codec/src/backend/tlv320aic3100.rs b/services/codec/src/backend/tlv320aic3100.rs index 279a26aa8..7d1955c43 100644 --- a/services/codec/src/backend/tlv320aic3100.rs +++ b/services/codec/src/backend/tlv320aic3100.rs @@ -288,10 +288,13 @@ impl Codec { let code_right = analog_volume_db_to_code(gain_db_right); self.w(0, &[1]); // select page 1 self.w(31, &[0b1_1_00011_0]); // headphones powered up - self.w(36, &[ - 0b1_000_0000 | code_left, // HPL - 0b1_000_0000 | code_right, // HPR - ]); + self.w( + 36, + &[ + 0b1_000_0000 | code_left, // HPL + 0b1_000_0000 | code_right, // HPR + ], + ); } self.i2c.i2c_mutex_release(); } @@ -405,25 +408,34 @@ impl Codec { // PLLP = 1, PLLR = 1, PLLJ = 7, PLLD = 1680, NDAC = *12*, MDAC = 7, DOSR = 128, MADC = 2 , NADC = // *42* ^^ from page 68 of datasheet, fs=48kHz/12MHz clkin line, with *bold* items multiplied // by 6 to get to 8kHz - self.w(5, &[ - 0b1001_0001, // P, R = 1, 1 and pll powered up - 7, // PLLJ = 7 - ((1680 >> 8) & 0xFF) as u8, // D MSB of 1680 - (1680 & 0xFF) as u8, // D LSB of 1680 - ]); + self.w( + 5, + &[ + 0b1001_0001, // P, R = 1, 1 and pll powered up + 7, // PLLJ = 7 + ((1680 >> 8) & 0xFF) as u8, // D MSB of 1680 + (1680 & 0xFF) as u8, // D LSB of 1680 + ], + ); - self.w(11, &[ - 0x80 | 12, // NADC = 12 (set to 2 for 48kHz) - 0x80 | 7, // MDAC = 7 - 0, // DOSR = MSB of 128 - 128, // DOSR = LSB of 128 - ]); + self.w( + 11, + &[ + 0x80 | 12, // NADC = 12 (set to 2 for 48kHz) + 0x80 | 7, // MDAC = 7 + 0, // DOSR = MSB of 128 + 128, // DOSR = LSB of 128 + ], + ); - self.w(18, &[ - 0x80 | 42, // NADC = 42 (set to 7 for 48kHz) - 0x80 | 2, // MADC = 2 - 128, // AOSR = 128 - ]); + self.w( + 18, + &[ + 0x80 | 42, // NADC = 42 (set to 7 for 48kHz) + 0x80 | 2, // MADC = 2 + 128, // AOSR = 128 + ], + ); self.i2c.i2c_mutex_release(); } @@ -437,13 +449,16 @@ impl Codec { // 32 bits/word * 2 channels * 8000 samples/s = 512_000 = BCLK // pick off of DAC_MOD_CLK = 1.024MHz - self.w(27, &[ - 0b00_00_1_1_0_1, /* I2S standard, 16 bits per sample, BCLK output, WCLK output, DOUT is - * Hi-Z when unused */ - 0b0, // no offset on left justification - 0b0000_0_1_01, // BDIV_CLKIN = DAC_MOD_CLK, BCLK active even when powered down - 0b1000_0010, // BCLK_N_VAL = 2, N divider is powered up - ]); + self.w( + 27, + &[ + 0b00_00_1_1_0_1, /* I2S standard, 16 bits per sample, BCLK output, WCLK output, DOUT is + * Hi-Z when unused */ + 0b0, // no offset on left justification + 0b0000_0_1_01, // BDIV_CLKIN = DAC_MOD_CLK, BCLK active even when powered down + 0b1000_0010, // BCLK_N_VAL = 2, N divider is powered up + ], + ); // "word width" (WCLK) timing is implied based on the DAC fs computed // at the end of the clock tree, and WCLK simply toggles every other sample, so there is no @@ -494,18 +509,24 @@ impl Codec { //self.w(35, &[0b01_0_1_01_1_0]); // internal volume control - self.w(36, &[ - 0b1_001_1110, // HPL channel control on, -15dB - 0b1_001_1110, // HPR channel control on, -15dB - 0b1_000_1100, // SPK control on, -6dB - ]); + self.w( + 36, + &[ + 0b1_001_1110, // HPL channel control on, -15dB + 0b1_001_1110, // HPR channel control on, -15dB + 0b1_000_1100, // SPK control on, -6dB + ], + ); // driver PGA control - self.w(40, &[ - 0b0_0011_111, // HPL driver PGA = 3dB, not muted, all gains applied - 0b0_0011_111, // HPR driver PGA = 3dB, not muted, all gains applied - 0b000_01_1_0_1, // SPK gain = 12 dB, driver not muted, all gains applied - ]); + self.w( + 40, + &[ + 0b0_0011_111, // HPL driver PGA = 3dB, not muted, all gains applied + 0b0_0011_111, // HPR driver PGA = 3dB, not muted, all gains applied + 0b000_01_1_0_1, // SPK gain = 12 dB, driver not muted, all gains applied + ], + ); // HP driver control -- 16us short circuit debounce, best DAC performance, HPL/HPR as headphone // drivers @@ -542,15 +563,18 @@ impl Codec { // ADC digital volume control coarse adjust self.w(83, &[0b0]); // +0.0 dB - self.w(86, &[ - 0b1_011_0000, // AGC enabled, target level = -12dB - 0b00_10101_0, // hysteresis 1dB, noise threshold = -((value-1)*2 + 30): 21 => -70dB - 100, // max gain = code/2 dB - 0b_00010_000, // attack time = 0b_acode_mul = (acode*32*mul)/Fs - 0b_01101_000, // decay time = 0b_dcode_mul = (dcode*32*mul)/Fs - 0x01, // noise debounce time = code*4 / fs - 0x01, // signal debounce time = code*4 / fs - ]); + self.w( + 86, + &[ + 0b1_011_0000, // AGC enabled, target level = -12dB + 0b00_10101_0, // hysteresis 1dB, noise threshold = -((value-1)*2 + 30): 21 => -70dB + 100, // max gain = code/2 dB + 0b_00010_000, // attack time = 0b_acode_mul = (acode*32*mul)/Fs + 0b_01101_000, // decay time = 0b_dcode_mul = (dcode*32*mul)/Fs + 0x01, // noise debounce time = code*4 / fs + 0x01, // signal debounce time = code*4 / fs + ], + ); self.i2c.i2c_mutex_release(); } diff --git a/services/cram-console/src/repl.rs b/services/cram-console/src/repl.rs index 76bee0ef2..0d3bac244 100644 --- a/services/cram-console/src/repl.rs +++ b/services/cram-console/src/repl.rs @@ -160,11 +160,11 @@ impl Repl { self.gam .draw_rectangle( self.content, - Rectangle::new_with_style(Point::new(0, 0), self.screensize, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }), + Rectangle::new_with_style( + Point::new(0, 0), + self.screensize, + DrawStyle { fill_color: Some(PixelColor::Light), stroke_color: None, stroke_width: 0 }, + ), ) .expect("can't clear content area"); } diff --git a/services/graphics-server/src/backend/minifb.rs b/services/graphics-server/src/backend/minifb.rs index 73fe4c243..38e298553 100644 --- a/services/graphics-server/src/backend/minifb.rs +++ b/services/graphics-server/src/backend/minifb.rs @@ -150,11 +150,16 @@ impl XousDisplay { impl MinifbThread { pub fn run_while(self, mut predicate: impl FnMut() -> bool) { - let mut window = Window::new("Precursor", WIDTH as usize, HEIGHT as usize, WindowOptions { - scale_mode: minifb::ScaleMode::AspectRatioStretch, - resize: true, - ..WindowOptions::default() - }) + let mut window = Window::new( + "Precursor", + WIDTH as usize, + HEIGHT as usize, + WindowOptions { + scale_mode: minifb::ScaleMode::AspectRatioStretch, + resize: true, + ..WindowOptions::default() + }, + ) .unwrap_or_else(|e| { log::error!("{e:?}"); std::process::abort(); diff --git a/services/ime-frontend/src/main.rs b/services/ime-frontend/src/main.rs index c8cb642f5..43f0c4943 100644 --- a/services/ime-frontend/src/main.rs +++ b/services/ime-frontend/src/main.rs @@ -142,22 +142,26 @@ impl InputTracker { self.gam .draw_rectangle( pc, - Rectangle::new_with_style(Point::new(0, 0), pc_bounds, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }), + Rectangle::new_with_style( + Point::new(0, 0), + pc_bounds, + DrawStyle { + fill_color: Some(PixelColor::Light), + stroke_color: None, + stroke_width: 0, + }, + ), ) .expect("can't clear prediction area"); // add the border line on top self.gam .draw_line( pc, - Line::new_with_style(Point::new(0, 0), Point::new(pc_bounds.x, 0), DrawStyle { - fill_color: None, - stroke_color: Some(PixelColor::Dark), - stroke_width: 1, - }), + Line::new_with_style( + Point::new(0, 0), + Point::new(pc_bounds.x, 0), + DrawStyle { fill_color: None, stroke_color: Some(PixelColor::Dark), stroke_width: 1 }, + ), ) .expect("can't draw prediction top border"); } @@ -167,11 +171,15 @@ impl InputTracker { self.gam .draw_rectangle( ic, - Rectangle::new_with_style(Point::new(0, 0), ic_bounds, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }), + Rectangle::new_with_style( + Point::new(0, 0), + ic_bounds, + DrawStyle { + fill_color: Some(PixelColor::Light), + stroke_color: None, + stroke_width: 0, + }, + ), ) .expect("can't clear input area"); @@ -179,11 +187,11 @@ impl InputTracker { self.gam .draw_line( ic, - Line::new_with_style(Point::new(0, 0), Point::new(ic_bounds.x, 0), DrawStyle { - fill_color: None, - stroke_color: Some(PixelColor::Dark), - stroke_width: 1, - }), + Line::new_with_style( + Point::new(0, 0), + Point::new(ic_bounds.x, 0), + DrawStyle { fill_color: None, stroke_color: Some(PixelColor::Dark), stroke_width: 1 }, + ), ) .expect("can't draw input top line border"); } @@ -676,11 +684,11 @@ impl InputTracker { } let pc_bounds: Point = self.gam.get_canvas_bounds(pc).expect("Couldn't get prediction canvas bounds"); - let pc_clip: Rectangle = Rectangle::new_with_style(Point::new(0, 1), pc_bounds, DrawStyle { - fill_color: Some(PixelColor::Light), - stroke_color: None, - stroke_width: 0, - }); + let pc_clip: Rectangle = Rectangle::new_with_style( + Point::new(0, 1), + pc_bounds, + DrawStyle { fill_color: Some(PixelColor::Light), stroke_color: None, stroke_width: 0 }, + ); if debug1 { info!("got pc_bound {:?}", pc_bounds); } diff --git a/services/llio/src/main.rs b/services/llio/src/main.rs index b4c1548c7..e1ac67c92 100644 --- a/services/llio/src/main.rs +++ b/services/llio/src/main.rs @@ -579,10 +579,12 @@ fn main() -> ! { i2c.i2c_mutex_acquire(); // set clock units to 1 second, output pulse length to ~218ms // and program the elapsed time (TIMERB_CLK is followed by TIMERB) - i2c.i2c_write(ABRTCMC_I2C_ADR, ABRTCMC_TIMERB_CLK, &[(TimerClk::CLK_1_S - | TimerClk::PULSE_218_MS) - .bits()]) - .expect("RTC access error"); + i2c.i2c_write( + ABRTCMC_I2C_ADR, + ABRTCMC_TIMERB_CLK, + &[(TimerClk::CLK_1_S | TimerClk::PULSE_218_MS).bits()], + ) + .expect("RTC access error"); // program elapsed time i2c.i2c_write(ABRTCMC_I2C_ADR, ABRTCMC_TIMERB, &[seconds]).expect("RTC access error"); // enable timerb countdown interrupt, also clears any prior interrupt flag diff --git a/services/net/src/device.rs b/services/net/src/device.rs index bfe53cd5c..f3e517794 100644 --- a/services/net/src/device.rs +++ b/services/net/src/device.rs @@ -64,13 +64,16 @@ impl phy::Device for NetPhy { .wlan_fetch_loopback_packet(&mut self.rx_buffer[..rx_len as usize]) .expect("Couldn't call wlan_fetch_packet in device adapter"); - Some((NetPhyRxToken { buf: &mut self.rx_buffer[..rx_len as usize] }, NetPhyTxToken { - buf: &mut self.tx_buffer[..], - com: &self.com, - loopback_conn: self.loopback_conn, - loopback_count: self.loopback_pending.clone(), - caps: csum_copy, - })) + Some(( + NetPhyRxToken { buf: &mut self.rx_buffer[..rx_len as usize] }, + NetPhyTxToken { + buf: &mut self.tx_buffer[..], + com: &self.com, + loopback_conn: self.loopback_conn, + loopback_count: self.loopback_pending.clone(), + caps: csum_copy, + }, + )) } else { if let Some(rx_len) = self.rx_avail.take() { log::debug!("device rx of {} bytes", rx_len); @@ -78,13 +81,16 @@ impl phy::Device for NetPhy { .wlan_fetch_packet(&mut self.rx_buffer[..rx_len as usize]) .expect("Couldn't call wlan_fetch_packet in device adapter"); - Some((NetPhyRxToken { buf: &mut self.rx_buffer[..rx_len as usize] }, NetPhyTxToken { - buf: &mut self.tx_buffer[..], - com: &self.com, - loopback_conn: self.loopback_conn, - loopback_count: self.loopback_pending.clone(), - caps: csum_copy, - })) + Some(( + NetPhyRxToken { buf: &mut self.rx_buffer[..rx_len as usize] }, + NetPhyTxToken { + buf: &mut self.tx_buffer[..], + com: &self.com, + loopback_conn: self.loopback_conn, + loopback_count: self.loopback_pending.clone(), + caps: csum_copy, + }, + )) } else { log::trace!("nothing to rx"); None diff --git a/services/net/src/std_tcplistener.rs b/services/net/src/std_tcplistener.rs index 889e3f795..c9df5cb8c 100644 --- a/services/net/src/std_tcplistener.rs +++ b/services/net/src/std_tcplistener.rs @@ -147,12 +147,15 @@ pub(crate) fn std_tcp_accept( // Adding the message to the udp_rx_waiting list prevents it from going out of scope and // thus prevents the .drop() method from being called. Since messages are returned to the sender // in the .drop() method, this keeps the caller blocked for the lifetime of the message. - insert_or_append(tcp_accept_waiting, AcceptingSocket { - env: msg, /* <-- msg is inserted into the tcp_accept_waiting vector, thus preventing the - * lend_mut from returning. */ - handle: *handle, - fd, - }); + insert_or_append( + tcp_accept_waiting, + AcceptingSocket { + env: msg, /* <-- msg is inserted into the tcp_accept_waiting vector, thus preventing the + * lend_mut from returning. */ + handle: *handle, + fd, + }, + ); } pub(crate) fn tcp_accept_success(buf: &mut [u8], fd: u16, ep: IpEndpoint) { diff --git a/services/net/src/std_udp.rs b/services/net/src/std_udp.rs index d89a33942..a5b2d5ba8 100644 --- a/services/net/src/std_udp.rs +++ b/services/net/src/std_udp.rs @@ -169,12 +169,15 @@ pub(crate) fn std_udp_rx( // Adding the message to the udp_rx_waiting list prevents it from going out of scope and // thus prevents the .drop() method from being called. Since messages are returned to the sender // in the .drop() method, this keeps the caller blocked for the lifetime of the message. - insert_or_append(udp_rx_waiting, UdpStdState { - msg, /* <-- msg is inserted into the udp_rx_waiting vector, thus preventing the lend_mut from - * returning. */ - handle: *handle, - expiry, - }); + insert_or_append( + udp_rx_waiting, + UdpStdState { + msg, /* <-- msg is inserted into the udp_rx_waiting vector, thus preventing the lend_mut from + * returning. */ + handle: *handle, + expiry, + }, + ); } pub(crate) fn std_udp_tx( diff --git a/services/pddb/src/backend/hw.rs b/services/pddb/src/backend/hw.rs index dc0f2e55b..1df677489 100644 --- a/services/pddb/src/backend/hw.rs +++ b/services/pddb/src/backend/hw.rs @@ -2503,13 +2503,16 @@ impl PddbOs { let aad_local = self.data_aad(&name); self.dna_mode = DnaMode::Migration; let aad_incoming = self.data_aad(&name); - keymap.insert(&name, MigrationCiphers { - pt_ecb, - data_gcm_siv, - aad_incoming, - aad_local, - data_key: basis_keys.data.into(), - }); + keymap.insert( + &name, + MigrationCiphers { + pt_ecb, + data_gcm_siv, + aad_incoming, + aad_local, + data_key: basis_keys.data.into(), + }, + ); modals.update_progress(index as u32 + 1).ok(); } @@ -2825,11 +2828,14 @@ impl PddbOs { self.tt.sleep_ms(SWAP_DELAY_MS).unwrap(); } // done! - if self.yes_no_approval(&modals, match self.dna_mode { - DnaMode::Normal => t!("pddb.freespace.finished", locales::LANG), - DnaMode::Migration => t!("pddb.rekey.finished", locales::LANG), - DnaMode::Churn => t!("pddb.churn.finished", locales::LANG), - }) { + if self.yes_no_approval( + &modals, + match self.dna_mode { + DnaMode::Normal => t!("pddb.freespace.finished", locales::LANG), + DnaMode::Migration => t!("pddb.rekey.finished", locales::LANG), + DnaMode::Churn => t!("pddb.churn.finished", locales::LANG), + }, + ) { Some(ret) } else { None diff --git a/services/root-keys/src/backups.rs b/services/root-keys/src/backups.rs index 6327ec64c..62b07b297 100644 --- a/services/root-keys/src/backups.rs +++ b/services/root-keys/src/backups.rs @@ -189,10 +189,10 @@ pub(crate) fn restore_backup(key: &BackupKey, backup: &BackupDataCt) -> Option Result<(), Box> { } else { ((csr_top - region.base) & !(PAGE_SIZE - 1)) + PAGE_SIZE } + PAGE_SIZE; - map.insert(region.name.to_lowercase(), tools::utils::CsrMemoryRegion { - start: region.base.try_into().unwrap(), - length: length.try_into().unwrap(), - }); + map.insert( + region.name.to_lowercase(), + tools::utils::CsrMemoryRegion { + start: region.base.try_into().unwrap(), + length: length.try_into().unwrap(), + }, + ); } else { - map.insert(region.name.to_lowercase(), tools::utils::CsrMemoryRegion { - start: region.base.try_into().unwrap(), - length: region.size.try_into().unwrap(), - }); + map.insert( + region.name.to_lowercase(), + tools::utils::CsrMemoryRegion { + start: region.base.try_into().unwrap(), + length: region.size.try_into().unwrap(), + }, + ); } } // insert additional regions from core.svd, if specified @@ -296,10 +302,13 @@ fn main() -> Result<(), Box> { break; } println!("{}: {:x}", region.name, region.base); - map.insert(region.name.to_lowercase(), tools::utils::CsrMemoryRegion { - start: region.base.try_into().unwrap(), - length: region.size.try_into().unwrap(), - }); + map.insert( + region.name.to_lowercase(), + tools::utils::CsrMemoryRegion { + start: region.base.try_into().unwrap(), + length: region.size.try_into().unwrap(), + }, + ); } } } diff --git a/tools/src/bin/make-renode-boot.rs b/tools/src/bin/make-renode-boot.rs index 9c1e63534..c22a351d3 100644 --- a/tools/src/bin/make-renode-boot.rs +++ b/tools/src/bin/make-renode-boot.rs @@ -90,15 +90,21 @@ fn create_image(init_programs: &[String]) -> std::io::Result> { } else { ((csr_top - region.base) & !(PAGE_SIZE - 1)) + PAGE_SIZE } + PAGE_SIZE; - map.insert(region.name.to_lowercase(), tools::utils::CsrMemoryRegion { - start: region.base.try_into().unwrap(), - length: length.try_into().unwrap(), - }); + map.insert( + region.name.to_lowercase(), + tools::utils::CsrMemoryRegion { + start: region.base.try_into().unwrap(), + length: length.try_into().unwrap(), + }, + ); } else { - map.insert(region.name.to_lowercase(), tools::utils::CsrMemoryRegion { - start: region.base.try_into().unwrap(), - length: region.size.try_into().unwrap(), - }); + map.insert( + region.name.to_lowercase(), + tools::utils::CsrMemoryRegion { + start: region.base.try_into().unwrap(), + length: region.size.try_into().unwrap(), + }, + ); } } csr_to_config(tools::utils::CsrConfig { regions: map }, &mut ram_config); diff --git a/tools/src/utils.rs b/tools/src/utils.rs index 829393846..03906cfa1 100644 --- a/tools/src/utils.rs +++ b/tools/src/utils.rs @@ -85,10 +85,10 @@ pub fn parse_csr_csv(filename: &str) -> Result { if region_name == "csr" { csr_base = base_addr; } else { - map.insert(region_name.to_string().to_lowercase(), CsrMemoryRegion { - start: base_addr, - length, - }); + map.insert( + region_name.to_string().to_lowercase(), + CsrMemoryRegion { start: base_addr, length }, + ); } } _ => (), diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 29af08729..05346dd1a 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -70,40 +70,46 @@ fn main() -> Result<(), Box> { ] .to_vec(); // minimal set of packages to do bare-iron graphical I/O - let gfx_base_pkgs = [&base_pkgs[..], &[ - "graphics-server", // raw (unprotected) frame buffer primitives - "early_settings", // required by keyboard - "keyboard", // required by graphics-server - "spinor", // required by keyboard - to save key mapping - "llio", // required by spinor - ]] + let gfx_base_pkgs = [ + &base_pkgs[..], + &[ + "graphics-server", // raw (unprotected) frame buffer primitives + "early_settings", // required by keyboard + "keyboard", // required by graphics-server + "spinor", // required by keyboard - to save key mapping + "llio", // required by spinor + ], + ] .concat(); // packages in the user image - most of the services at this layer have cross-dependencies - let user_pkgs = [&gfx_base_pkgs[..], &[ - // net services - "com", - "net", - "dns", - // UX abstractions - "gam", - "ime-frontend", - "ime-plugin-shell", - "codec", - "modals", - // security - "root-keys", - "trng", - "sha2", - // "engine-25519", - "jtag", - // GUI front end - "status", - "shellchat", - // filesystem - "pddb", - // usb services - "usb-device-xous", - ]] + let user_pkgs = [ + &gfx_base_pkgs[..], + &[ + // net services + "com", + "net", + "dns", + // UX abstractions + "gam", + "ime-frontend", + "ime-plugin-shell", + "codec", + "modals", + // security + "root-keys", + "trng", + "sha2", + // "engine-25519", + "jtag", + // GUI front end + "status", + "shellchat", + // filesystem + "pddb", + // usb services + "usb-device-xous", + ], + ] .concat(); // for fast testing of compilation targets of the PDDB to real hardware let pddb_dev_pkgs = [&base_pkgs[..], &["pddb", "sha2"]].concat();