Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove more namespace imports #1913

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/gimletlet/app-mgmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ task-slots = ["sys", "user_leds"]

[tasks.net]
name = "task-net"
stacksize = 3000
stacksize = 3184
priority = 3
features = ["mgmt", "h753", "use-spi-core", "spi2"]
max-sizes = {flash = 131072, ram = 16384, sram1_mac = 16384}
Expand Down
20 changes: 16 additions & 4 deletions build/lpc55pins/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,24 @@ pub fn codegen(pins: Vec<PinConfig>) -> Result<()> {
let mut file = std::fs::File::create(dest_path)?;

let mut buf = BufWriter::new(Vec::new());
if pins.iter().any(|p| p.name.is_some()) {
writeln!(
&mut file,
"fn setup_pins(task : TaskId) -> Result<(), ()> {{"
)?;
if pins
.iter()
.any(|p| p.direction.is_some() || p.name.is_some() || p.value.is_some())
{
// Each conditional branch in pins loop uses Pin.
writeln!(&mut buf, "use drv_lpc55_gpio_api::Pin;")?;
}
if pins.iter().any(|p| p.value.is_some()) {
writeln!(&mut buf, "use drv_lpc55_gpio_api::Value;")?;
}
writeln!(
&mut file,
"fn setup_pins(task : TaskId) -> Result<(), ()> {{"
"use drv_lpc55_gpio_api::{{AltFn, Digimode, Invert, Mode, Opendrain, Pin, Pins, Slew}};"
)?;
writeln!(&mut file, "use drv_lpc55_gpio_api::*;")?;
writeln!(&mut file, "let iocon = Pins::from(task);")?;
for p in pins {
writeln!(&mut file, "iocon.iocon_configure(")?;
Expand All @@ -177,7 +187,9 @@ pub fn codegen(pins: Vec<PinConfig>) -> Result<()> {
Some(d) => {
writeln!(&mut file, "iocon.set_dir(")?;
writeln!(&mut file, "{}", p.pin.to_token_stream())?;
writeln!(&mut file, "Direction::{d:?}")?;
// Note: GPIO API is used directly to avoid a duplicate import
// problem in lpc55-sprot-server.
writeln!(&mut file, "drv_lpc55_gpio_api::Direction::{d:?}")?;
writeln!(&mut file, ");")?;
}
}
Expand Down
2 changes: 1 addition & 1 deletion build/xtask/src/sizes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::path::Path;
use std::process;

use anyhow::{bail, Context, Result};
use colored::*;
use colored::Colorize;
use goblin::Object;
use indexmap::map::Entry;
use indexmap::IndexMap;
Expand Down
2 changes: 1 addition & 1 deletion drv/eeprom/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#![no_main]

use derive_idol_err::IdolError;
use drv_i2c_devices::at24csw080::*;
use drv_i2c_devices::at24csw080::{At24Csw080, Error};
use idol_runtime::{NotificationHandler, RequestError};
use userlib::{task_slot, FromPrimitive};

Expand Down
2 changes: 1 addition & 1 deletion drv/fpga-devices/src/ecp5_spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl<S: SpiServer> FpgaUserDesign for Ecp5UsingSpi<S> {

impl<S: SpiServer> Ecp5UsingSpi<S> {
pub fn configure_gpio(&self) {
use sys_api::*;
use sys_api::{OutputType, Pull, Speed};

self.sys.gpio_set(self.done);
self.sys.gpio_configure_output(
Expand Down
2 changes: 1 addition & 1 deletion drv/fpga-devices/src/ecp5_spi_mux_pca9538.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl<S: SpiServer> Driver<S> {
}

pub fn init(&self) -> Result<(), Error> {
use sys_api::*;
use sys_api::{OutputType, Pull, Speed};

self.config.sys.gpio_set(self.config.spi_mux_select);
self.config.sys.gpio_configure_output(
Expand Down
4 changes: 2 additions & 2 deletions drv/fpga-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ fn main() -> ! {
let user_design =
spi.device(drv_spi_api::devices::ECP5_FRONT_IO_USER_DESIGN);

use drv_i2c_devices::pca9538::*;
use drv_fpga_devices::ecp5_spi_mux_pca9538::*;
use drv_i2c_devices::pca9538::{PinSet, Pca9538};
use drv_fpga_devices::ecp5_spi_mux_pca9538::{Driver, DriverConfig, DevicePins};

let gpio = Pca9538::new(
i2c_config::devices::pca9538(I2C.get_task_id())[0],
Expand Down
5 changes: 4 additions & 1 deletion drv/i2c-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@

use zerocopy::{AsBytes, FromBytes};

pub use drv_i2c_types::*;
pub use drv_i2c_types::{
Controller, Mux, Op, PortIndex, ReservedAddress, ResponseCode,
ResponseCodeU8, Segment,
};
use userlib::{sys_send, FromPrimitive, Lease, TaskId};

///
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/adm1272.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
pmbus_validate, BadValidation, CurrentSensor, TempSensor, Validate,
VoltageSensor,
};
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use num_traits::float::FloatCore;
use pmbus::commands::*;
use ringbuf::*;
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/adt7420.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Driver for the ADT7420 temperature sensor

use crate::TempSensor;
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use userlib::units::*;

const ADT7420_ID: u8 = 0xcb;
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/at24csw080.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Driver for the AT24CSW080/4 I2C EEPROM

use crate::Validate;
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use userlib::{hl::sleep_for, FromPrimitive, ToPrimitive};
use zerocopy::{AsBytes, FromBytes};

Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/bmr491.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
pmbus_validate, BadValidation, CurrentSensor, TempSensor, Validate,
VoltageSensor,
};
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use pmbus::commands::*;
use userlib::units::*;

Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/ds2482.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Driver for the DS2482-100 1-wire initiator

use bitfield::bitfield;
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use drv_onewire::Identifier;
use ringbuf::*;

Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/emc2305.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use crate::Validate;
use bitfield::bitfield;
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use ringbuf::*;
use userlib::{
units::{PWMDuty, Rpm},
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/isl68224.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
pmbus_validate, BadValidation, CurrentSensor, TempSensor, Validate,
VoltageSensor,
};
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use pmbus::commands::isl68224::*;
use pmbus::commands::CommandCode;
use pmbus::*;
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/ltc4282.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use crate::{CurrentSensor, Validate, VoltageSensor};
use bitfield::bitfield;
use core::cell::Cell;
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use userlib::{
units::{Amperes, Ohms, Volts},
FromPrimitive,
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/m24c02.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Driver for the M24C02-WMN6TP EEPROM attached to a MWOCP68 power shelf

use crate::Validate;
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};

////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/max31790.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use crate::Validate;
use bitfield::bitfield;
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use ringbuf::*;
use userlib::{
units::{PWMDuty, Rpm},
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/max5970.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Driver for the MAX5970 hot swap controller

use crate::{CurrentSensor, Validate, VoltageSensor};
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use num_traits::float::FloatCore;
use userlib::{
units::{Amperes, Ohms, Volts},
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/max6634.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Driver for the MAX6634 temperature sensor

use crate::{TempSensor, Validate};
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use userlib::units::*;

#[allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/mcp9808.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Driver for the MCP9808 temperature sensor

use crate::TempSensor;
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use userlib::units::*;

pub enum Register {
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/mwocp68.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
InputVoltageSensor, Validate, VoltageSensor,
};
use core::cell::Cell;
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use pmbus::commands::mwocp68::*;
use pmbus::commands::CommandCode;
use pmbus::units::{Celsius, Rpm};
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/pca9538.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Driver for the PCA9538 GPIO expander

use crate::Validate;
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use userlib::FromPrimitive;

/// `PinSet` is a bit vector indicating on which pins/ports a given operation is
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/pca9956b.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Driver for the PCA9956B LED driver

use crate::Validate;
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use num_derive::FromPrimitive;
use num_traits::FromPrimitive;

Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/pct2075.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Driver for the PCT2075 temperature sensor

use crate::{TempSensor, Validate};
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use userlib::units::*;

#[allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/raa229618.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
pmbus_validate, BadValidation, CurrentSensor, TempSensor, Validate,
VoltageSensor,
};
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use pmbus::commands::raa229618::*;
use pmbus::commands::CommandCode;
use pmbus::*;
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/sbrmi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//! threads cannot exceed a 7-bit quantity in this processor generation).

use crate::Validate;
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use ringbuf::*;
use zerocopy::FromBytes;

Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/sbtsi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Driver for AMD SB-TSI interface

use crate::{TempSensor, Validate};
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use userlib::units::*;

#[allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/tmp117.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Driver for the TMP117 temperature sensor

use crate::{TempSensor, Validate};
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use userlib::units::*;

#[allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/tmp451.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Driver for the TMP451 temperature sensor

use crate::{TempSensor, Validate};
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use userlib::units::*;

#[allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/tps546b24a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
pmbus_validate, BadValidation, CurrentSensor, TempSensor, Validate,
VoltageSensor,
};
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use pmbus::commands::*;
use userlib::units::*;

Expand Down
2 changes: 1 addition & 1 deletion drv/i2c-devices/src/tse2004av.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! for SPD (serial presence detection) and temperature sensing on DIMMs.

use crate::TempSensor;
use drv_i2c_api::*;
use drv_i2c_api::{I2cDevice, ResponseCode};
use userlib::units::*;

#[allow(dead_code)]
Expand Down
9 changes: 7 additions & 2 deletions drv/ignition-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
#![no_std]
#![no_main]

use drv_ignition_api::*;
use drv_ignition_api::{
Counters, IgnitionError, Port, PortState, Request, SystemPowerState,
Target, TransceiverEvents, TransceiverSelect, PORT_MAX,
};
use drv_sidecar_mainboard_controller::ignition::*;
use ringbuf::*;
use userlib::{hl, sys_get_timer, sys_set_timer, task_slot, UnwrapLite};
#[cfg(feature = "sequencer")]
use userlib::hl;
use userlib::{sys_get_timer, sys_set_timer, task_slot, UnwrapLite};

task_slot!(FPGA, fpga);
#[cfg(feature = "sequencer")]
Expand Down
4 changes: 2 additions & 2 deletions drv/lpc55-gpio/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@

use lpc55_pac as device;

use drv_lpc55_gpio_api::*;
use drv_lpc55_syscon_api::*;
use drv_lpc55_gpio_api::{Direction, Pin, Value};
use drv_lpc55_syscon_api::{Peripheral, Syscon};
use idol_runtime::{NotificationHandler, RequestError};
use userlib::{task_slot, RecvMessage};

Expand Down
4 changes: 3 additions & 1 deletion drv/lpc55-i2c/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
#![no_std]
#![no_main]

use drv_lpc55_gpio_api::*;
use drv_lpc55_gpio_api::{
AltFn, Digimode, Invert, Mode, Opendrain, Pin, Pins, Slew,
};
use drv_lpc55_syscon_api::{Peripheral, Syscon};
use lpc55_pac as device;
use userlib::{hl, task_slot, FromPrimitive, LeaseAttributes};
Expand Down
13 changes: 9 additions & 4 deletions drv/lpc55-swd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ fn generate_swd_functions(config: &TaskConfig) -> Result<()> {

#(
{
use drv_lpc55_gpio_api::*;
use drv_lpc55_gpio_api::{
AltFn, Digimode, Invert, Mode, Opendrain, Pins, Slew,
};

let (pin, conf) = drv_lpc55_gpio_api::Pins::iocon_conf_val(#out_cfg);
let (pin, conf) = Pins::iocon_conf_val(#out_cfg);
let base = iocon_base + 4 * pin;
unsafe {
core::ptr::write_volatile(base as *mut u32, conf);
Expand All @@ -65,8 +67,11 @@ fn generate_swd_functions(config: &TaskConfig) -> Result<()> {

#(
{
use drv_lpc55_gpio_api::*;
let (pin, conf) = drv_lpc55_gpio_api::Pins::iocon_conf_val(#in_cfg);
use drv_lpc55_gpio_api::{
AltFn, Digimode, Invert, Mode, Opendrain, Pins, Slew,
};

let (pin, conf) = Pins::iocon_conf_val(#in_cfg);
let base = iocon_base + 4 * pin;
unsafe {
core::ptr::write_volatile(base as *mut u32, conf);
Expand Down
2 changes: 1 addition & 1 deletion drv/lpc55-swd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ impl ServerImpl {
}

fn swd_dongle_detected(&self) -> bool {
use drv_lpc55_gpio_api::*;
use drv_lpc55_gpio_api::{Pins, Value};

let gpio = Pins::from(self.gpio);
gpio.read_val(SP_TO_ROT_JTAG_DETECT_L) == Value::Zero
Expand Down
Loading