1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
//! i.MX RT 1020 chip family features.
//!
//! Use this module to customize features for the
//! 1020 chips.
pub use imxrt_iomuxc::imxrt1020 as pads;
#[path = "ccm"]
pub(crate) mod ccm {
pub mod arm_divider;
#[path = "pre_periph_clk_pll6.rs"]
pub mod pre_periph_clk;
mod periph_clk2_podf;
mod periph_clk2_sel;
/// Peripheral clock 2.
pub mod periph_clk2 {
pub use super::periph_clk2_podf::*;
pub use super::periph_clk2_sel::*;
}
pub(crate) mod analog {
#[path = "pll6_500mhz.rs"]
pub mod pll6;
}
/// Re-exported by the common clock_gate module.
pub(crate) mod clock_gate {
use crate::chip::ccm::clock_gate;
/// All clock gates downstream of the PERCLK root clock.
pub const PERCLK_CLOCK_GATES: &[clock_gate::Locator] = &[
clock_gate::pit(),
clock_gate::gpt_bus::<1>(),
clock_gate::gpt_bus::<2>(),
clock_gate::gpt_serial::<1>(),
clock_gate::gpt_serial::<2>(),
];
/// All clock gates downstream of the UART root clock.
pub const UART_CLOCK_GATES: &[clock_gate::Locator] = &[
clock_gate::lpuart::<1>(),
clock_gate::lpuart::<2>(),
clock_gate::lpuart::<3>(),
clock_gate::lpuart::<4>(),
clock_gate::lpuart::<5>(),
clock_gate::lpuart::<6>(),
clock_gate::lpuart::<7>(),
clock_gate::lpuart::<8>(),
];
/// All clock gates downstream of the LPSPI root clock.
pub const LPSPI_CLOCK_GATES: &[clock_gate::Locator] = &[
clock_gate::lpspi::<1>(),
clock_gate::lpspi::<2>(),
clock_gate::lpspi::<3>(),
clock_gate::lpspi::<4>(),
];
/// All clock gates downstream of the LPI2C root clock.
pub const LPI2C_CLOCK_GATES: &[clock_gate::Locator] = &[
clock_gate::lpi2c::<1>(),
clock_gate::lpi2c::<2>(),
clock_gate::lpi2c::<3>(),
clock_gate::lpi2c::<4>(),
];
/// All clock gates downstream of the IPG root clock.
pub const IPG_CLOCK_GATES: &[clock_gate::Locator] = &[
clock_gate::adc::<1>(),
clock_gate::adc::<2>(),
clock_gate::dma(),
clock_gate::flexpwm::<1>(),
clock_gate::flexpwm::<2>(),
// GPIOs assume that we're not "fast," since the fast
// GPIOs run directly off the ARM / AHB clock. This
// is safe for now, since we don't currently support fast
// GPIOs.
clock_gate::gpio::<1>(),
clock_gate::gpio::<2>(),
clock_gate::gpio::<3>(),
clock_gate::gpio::<5>(),
clock_gate::trng(),
clock_gate::snvs_lp(),
clock_gate::snvs_hp(),
clock_gate::usb(),
];
}
pub(crate) mod clko {
/// CLKO1 output clock selections.
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Clko1Selection {
/// PLL3 divided by 2.
Pll3SwClkDiv2 = 0b0000,
/// PLL2 divided by 2.
Pll2Div2 = 0b0001,
/// ENET PLL divided by 2.
EnetPllDiv2 = 0b0010,
/// SEMC clock root.
SemcClk = 0b0101,
/// AHB clock root.
AhbClk = 0b1011,
/// IPG clock root.
IpgClk = 0b1100,
/// PERCLK clock root.
Perclk = 0b1101,
/// PLL4 main clock root.
Pll4MainClk = 0b1111,
}
/// CLKO2 output clock selections.
#[repr(u32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Clko2Selection {
/// USDHC1 clock root.
Usdhc1Clk = 0b00011,
/// LPI2C clock root.
Lpi2cClk = 0b00110,
/// Oscillator clock root.
OscClk = 0b01110,
/// LPSPI clock root.
LpspiClk = 0b10000,
/// USDHC2 clock root.
Usdhc2Clk = 0b10001,
/// SAI1 clock root.
Sai1Clk = 0b10010,
/// SAI2 clock root.
Sai2Clk = 0b10011,
/// SAI3 clock root.
Sai3Clk = 0b10100,
/// Trace clock root.
TraceClk = 0b10110,
/// CAN clock root.
CanClk = 0b10111,
/// FlexSPI clock root.
FlexspiClk = 0b11011,
/// UART clock root.
UartClk = 0b11100,
/// SPDIF0 clock root.
Spdif0Clk = 0b11101,
}
}
ccm_flexio!(
flexio1_clk, "FLEXIO1",
divider: (CS1CDR, FLEXIO1_CLK_PODF),
predivider: (CS1CDR, FLEXIO1_CLK_PRED),
selection: (CSCMR2, FLEXIO1_CLK_SEL),
);
}
pub(crate) const DMA_CHANNEL_COUNT: usize = 32;