Skip to content

Commit 542e3cf

Browse files
committed
Fix formatting
1 parent df3d335 commit 542e3cf

File tree

10 files changed

+26
-149
lines changed

10 files changed

+26
-149
lines changed

esp-hal/src/clock/clocks_ll/esp32c2.rs

Lines changed: 0 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -4,132 +4,6 @@ use crate::{
44
soc::regi2c,
55
};
66

7-
const I2C_BBPLL_OC_DCHGP_LSB: u32 = 4;
8-
const I2C_BBPLL_OC_DHREF_SEL_LSB: u32 = 4;
9-
const I2C_BBPLL_OC_DLREF_SEL_LSB: u32 = 6;
10-
11-
pub(crate) fn esp32c2_rtc_bbpll_configure(xtal_freq: XtalClock, _pll_freq: PllClock) {
12-
let div_ref: u8;
13-
let div7_0: u8;
14-
let dr1: u8;
15-
let dr3: u8;
16-
let dchgp: u8;
17-
let dcur: u8;
18-
let dbias: u8;
19-
20-
// Set this register to let the digital part know 480M PLL is used
21-
SYSTEM::regs()
22-
.cpu_per_conf()
23-
.modify(|_, w| w.pll_freq_sel().set_bit());
24-
25-
I2C_ANA_MST::regs().ana_conf0().modify(|_, w| {
26-
w.bbpll_stop_force_high().clear_bit();
27-
w.bbpll_stop_force_low().set_bit()
28-
});
29-
30-
// Configure 480M PLL
31-
match xtal_freq {
32-
XtalClock::_26M => {
33-
div_ref = 12;
34-
div7_0 = 236;
35-
dr1 = 4;
36-
dr3 = 4;
37-
dchgp = 0;
38-
dcur = 0;
39-
dbias = 2;
40-
}
41-
XtalClock::_40M => {
42-
div_ref = 0;
43-
div7_0 = 8;
44-
dr1 = 0;
45-
dr3 = 0;
46-
dchgp = 5;
47-
dcur = 3;
48-
dbias = 2;
49-
}
50-
}
51-
52-
regi2c::I2C_BBPLL_REG4.write_reg(0x6b);
53-
54-
let i2c_bbpll_lref = (dchgp << I2C_BBPLL_OC_DCHGP_LSB) | div_ref;
55-
let i2c_bbpll_dcur =
56-
(1 << I2C_BBPLL_OC_DLREF_SEL_LSB) | (3 << I2C_BBPLL_OC_DHREF_SEL_LSB) | dcur;
57-
58-
regi2c::I2C_BBPLL_OC_REF.write_reg(i2c_bbpll_lref);
59-
regi2c::I2C_BBPLL_OC_DIV_REG.write_reg(div7_0);
60-
regi2c::I2C_BBPLL_OC_DR1.write_field(dr1);
61-
regi2c::I2C_BBPLL_OC_DR3.write_field(dr3);
62-
regi2c::I2C_BBPLL_REG6.write_reg(i2c_bbpll_dcur);
63-
regi2c::I2C_BBPLL_OC_VCO_DBIAS.write_field(dbias);
64-
65-
// WAIT CALIBRATION DONE
66-
while I2C_ANA_MST::regs()
67-
.ana_conf0()
68-
.read()
69-
.bbpll_cal_done()
70-
.bit_is_clear()
71-
{}
72-
73-
// workaround bbpll calibration might stop early
74-
crate::rom::ets_delay_us(10);
75-
76-
// Stop BBPLL self-calibration
77-
I2C_ANA_MST::regs().ana_conf0().modify(|_, w| {
78-
w.bbpll_stop_force_high().set_bit();
79-
w.bbpll_stop_force_low().clear_bit()
80-
});
81-
}
82-
83-
pub(crate) fn esp32c2_rtc_bbpll_enable() {
84-
LPWR::regs().options0().modify(|_, w| {
85-
w.bb_i2c_force_pd().clear_bit();
86-
w.bbpll_force_pd().clear_bit();
87-
w.bbpll_i2c_force_pd().clear_bit()
88-
});
89-
}
90-
91-
pub(crate) fn esp32c2_rtc_update_to_xtal(freq: XtalClock, div: u32) {
92-
crate::rom::ets_update_cpu_frequency_rom(freq.mhz());
93-
94-
// Set divider from XTAL to APB clock. Need to set divider to 1 (reg. value 0)
95-
// first.
96-
SYSTEM::regs().sysclk_conf().modify(|_, w| unsafe {
97-
w.pre_div_cnt().bits(0);
98-
w.pre_div_cnt().bits((div - 1) as u16)
99-
});
100-
101-
// No need to adjust the REF_TICK
102-
103-
// Switch clock source
104-
SYSTEM::regs()
105-
.sysclk_conf()
106-
.modify(|_, w| unsafe { w.soc_clk_sel().bits(0) });
107-
}
108-
109-
pub(crate) fn esp32c2_rtc_freq_to_pll_mhz(cpu_clock_speed: CpuClock) {
110-
SYSTEM::regs().sysclk_conf().modify(|_, w| unsafe {
111-
w.pre_div_cnt().bits(0);
112-
w.soc_clk_sel().bits(1)
113-
});
114-
SYSTEM::regs().cpu_per_conf().modify(|_, w| unsafe {
115-
w.cpuperiod_sel().bits(match cpu_clock_speed {
116-
CpuClock::_80MHz => 0,
117-
CpuClock::_120MHz => 1,
118-
})
119-
});
120-
121-
crate::rom::ets_update_cpu_frequency_rom(cpu_clock_speed.mhz());
122-
}
123-
124-
pub(crate) fn esp32c2_rtc_apb_freq_update(apb_freq: ApbClock) {
125-
let value = ((apb_freq.hz() >> 12) & u16::MAX as u32)
126-
| (((apb_freq.hz() >> 12) & u16::MAX as u32) << 16);
127-
128-
LPWR::regs()
129-
.store5()
130-
.modify(|_, w| unsafe { w.data().bits(value) });
131-
}
132-
1337
// Mask for clock bits used by both WIFI and Bluetooth, 0, 1, 2, 3, 7, 8, 9, 10,
1348
// 19, 20, 21, 22, 23
1359
const SYSTEM_WIFI_CLK_WIFI_BT_COMMON_M: u32 = 0x78078F;

esp-metadata-generated/src/_generated_esp32.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,8 +1348,8 @@ macro_rules! define_clock_tree_types {
13481348
/// Clock tree configuration.
13491349
///
13501350
/// The fields of this struct are optional, with the following caveats:
1351-
/// - If `XTL_CLK` is not specified, the crystal frequency will be
1352-
/// automatically detected if possible.
1351+
/// - If `XTL_CLK` is not specified, the crystal frequency will be automatically detected if
1352+
/// possible.
13531353
/// - The CPU and its upstream clock nodes will be set to a default configuration.
13541354
/// - Other unspecified clock sources will not be useable by peripherals.
13551355
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]

esp-metadata-generated/src/_generated_esp32c2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,8 +1087,8 @@ macro_rules! define_clock_tree_types {
10871087
/// Clock tree configuration.
10881088
///
10891089
/// The fields of this struct are optional, with the following caveats:
1090-
/// - If `XTL_CLK` is not specified, the crystal frequency will be
1091-
/// automatically detected if possible.
1090+
/// - If `XTL_CLK` is not specified, the crystal frequency will be automatically detected if
1091+
/// possible.
10921092
/// - The CPU and its upstream clock nodes will be set to a default configuration.
10931093
/// - Other unspecified clock sources will not be useable by peripherals.
10941094
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]

esp-metadata-generated/src/_generated_esp32c3.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ macro_rules! define_clock_tree_types {
304304
/// Clock tree configuration.
305305
///
306306
/// The fields of this struct are optional, with the following caveats:
307-
/// - If `XTL_CLK` is not specified, the crystal frequency will be
308-
/// automatically detected if possible.
307+
/// - If `XTL_CLK` is not specified, the crystal frequency will be automatically detected if
308+
/// possible.
309309
/// - The CPU and its upstream clock nodes will be set to a default configuration.
310310
/// - Other unspecified clock sources will not be useable by peripherals.
311311
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]

esp-metadata-generated/src/_generated_esp32c6.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ macro_rules! define_clock_tree_types {
310310
/// Clock tree configuration.
311311
///
312312
/// The fields of this struct are optional, with the following caveats:
313-
/// - If `XTL_CLK` is not specified, the crystal frequency will be
314-
/// automatically detected if possible.
313+
/// - If `XTL_CLK` is not specified, the crystal frequency will be automatically detected if
314+
/// possible.
315315
/// - The CPU and its upstream clock nodes will be set to a default configuration.
316316
/// - Other unspecified clock sources will not be useable by peripherals.
317317
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]

esp-metadata-generated/src/_generated_esp32h2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ macro_rules! define_clock_tree_types {
295295
/// Clock tree configuration.
296296
///
297297
/// The fields of this struct are optional, with the following caveats:
298-
/// - If `XTL_CLK` is not specified, the crystal frequency will be
299-
/// automatically detected if possible.
298+
/// - If `XTL_CLK` is not specified, the crystal frequency will be automatically detected if
299+
/// possible.
300300
/// - The CPU and its upstream clock nodes will be set to a default configuration.
301301
/// - Other unspecified clock sources will not be useable by peripherals.
302302
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]

esp-metadata-generated/src/_generated_esp32s2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ macro_rules! define_clock_tree_types {
295295
/// Clock tree configuration.
296296
///
297297
/// The fields of this struct are optional, with the following caveats:
298-
/// - If `XTL_CLK` is not specified, the crystal frequency will be
299-
/// automatically detected if possible.
298+
/// - If `XTL_CLK` is not specified, the crystal frequency will be automatically detected if
299+
/// possible.
300300
/// - The CPU and its upstream clock nodes will be set to a default configuration.
301301
/// - Other unspecified clock sources will not be useable by peripherals.
302302
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]

esp-metadata-generated/src/_generated_esp32s3.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ macro_rules! define_clock_tree_types {
298298
/// Clock tree configuration.
299299
///
300300
/// The fields of this struct are optional, with the following caveats:
301-
/// - If `XTL_CLK` is not specified, the crystal frequency will be
302-
/// automatically detected if possible.
301+
/// - If `XTL_CLK` is not specified, the crystal frequency will be automatically detected if
302+
/// possible.
303303
/// - The CPU and its upstream clock nodes will be set to a default configuration.
304304
/// - Other unspecified clock sources will not be useable by peripherals.
305305
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]

esp-metadata/src/cfg/soc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ impl SystemClocks {
270270
/// Clock tree configuration.
271271
///
272272
/// The fields of this struct are optional, with the following caveats:
273-
/// - If `XTL_CLK` is not specified, the crystal frequency will be
274-
/// automatically detected if possible.
273+
/// - If `XTL_CLK` is not specified, the crystal frequency will be automatically detected if
274+
/// possible.
275275
/// - The CPU and its upstream clock nodes will be set to a default configuration.
276276
/// - Other unspecified clock sources will not be useable by peripherals.
277277
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]

xtask/src/lib.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -824,14 +824,17 @@ fn format_package_path(
824824
}
825825

826826
cargo_args.push("--".into());
827-
if let Some(rules) = format_rules {
828-
cargo_args.push(format!("--config-path={}", rules.display()));
827+
let mut config_file_path = PathBuf::new();
828+
let config_file = if let Some(rules) = format_rules {
829+
rules
829830
} else {
830-
cargo_args.push(format!(
831-
"--config-path={}/rustfmt.toml",
832-
workspace.display()
833-
));
834-
}
831+
config_file_path = package_path.join("rustfmt.toml");
832+
if !config_file_path.exists() {
833+
config_file_path = workspace.join("rustfmt.toml");
834+
}
835+
&config_file_path
836+
};
837+
cargo_args.push(format!("--config-path={}", config_file.display()));
835838
cargo_args.extend(source_files);
836839

837840
log::debug!("{cargo_args:#?}");

0 commit comments

Comments
 (0)