Skip to content

Commit 67ff241

Browse files
Merge pull request #41 from riscv-rust/i2c0-g002
feature-gate I2C0 with g002
2 parents 41efcc3 + cf74649 commit 67ff241

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

e310x/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
### Changed
1111

12+
- The I2C0 code is now gated under the `g002` feature
1213
- Regenerate code with `svd2rust` 0.36.1
1314
- Use `riscv` v0.13.0 and `riscv-rt` v0.14.0
1415
- In vectored mode, align `mtvec` to 64 bytes

e310x/e310x.svd

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
<peripheral>
1717
<name>CLINT</name>
1818
<baseAddress>0x02000000</baseAddress>
19-
<groupName>CLINT</groupName>
2019
<description>Coreplex Local Interrupts</description>
2120
<registers>
2221
<register>
@@ -58,7 +57,6 @@
5857
<peripheral>
5958
<name>PLIC</name>
6059
<baseAddress>0x0C000000</baseAddress>
61-
<groupName>PLIC</groupName>
6260
<description>Platform Level Interrupt Control</description>
6361
<registers>
6462
<register>
@@ -200,7 +198,6 @@
200198
<peripheral>
201199
<name>WDOG</name>
202200
<baseAddress>0x10000000</baseAddress>
203-
<groupName>Watchdog</groupName>
204201
<description>Watchdog</description>
205202
<registers>
206203
<register>
@@ -258,7 +255,6 @@
258255
<peripheral>
259256
<name>RTC</name>
260257
<baseAddress>0x10000000</baseAddress>
261-
<groupName>Watchdog</groupName>
262258
<description>Watchdog</description>
263259
<registers>
264260
<register>
@@ -306,7 +302,6 @@
306302
<peripheral>
307303
<name>AONCLK</name>
308304
<baseAddress>0x10000000</baseAddress>
309-
<groupName>AONCLOCK</groupName>
310305
<description>Always-On Clock Configuration</description>
311306
<registers>
312307
<register>
@@ -328,7 +323,6 @@
328323
<peripheral>
329324
<name>BACKUP</name>
330325
<baseAddress>0x10000000</baseAddress>
331-
<groupName>BACKUP</groupName>
332326
<description>Backup Registers</description>
333327
<registers>
334328
<register>
@@ -346,7 +340,6 @@
346340
<peripheral>
347341
<name>PMU</name>
348342
<baseAddress>0x10000000</baseAddress>
349-
<groupName>PMU</groupName>
350343
<description>PMU</description>
351344
<registers>
352345
<register>
@@ -461,7 +454,6 @@
461454
<peripheral>
462455
<name>PRCI</name>
463456
<baseAddress>0x10008000</baseAddress>
464-
<groupName>PRCI</groupName>
465457
<description>Power Reset Clock Interrupts</description>
466458
<registers>
467459
<register>
@@ -565,7 +557,6 @@
565557
<name>OTP</name>
566558
<baseAddress>0x10010000</baseAddress>
567559

568-
<groupName>OTP</groupName>
569560
<description>One Time Programmable Memory</description>
570561

571562
<registers>
@@ -648,7 +639,6 @@
648639
<name>GPIO0</name>
649640
<baseAddress>0x10012000</baseAddress>
650641

651-
<groupName>GPIO</groupName>
652642
<description>General Purpose Input Output</description>
653643

654644
<registers>
@@ -1660,7 +1650,6 @@
16601650
<name>UART0</name>
16611651
<baseAddress>0x10013000</baseAddress>
16621652

1663-
<groupName>UART</groupName>
16641653
<description>Universal Asynchronous Receiver Transmitter</description>
16651654

16661655
<registers>
@@ -1755,7 +1744,6 @@
17551744
<name>QSPI0</name>
17561745
<baseAddress>0x10014000</baseAddress>
17571746

1758-
<groupName>QSPI</groupName>
17591747
<description>Quad Serial Peripheral Interface</description>
17601748

17611749
<registers>
@@ -2166,7 +2154,6 @@
21662154
<name>PWM0</name>
21672155
<baseAddress>0x10015000</baseAddress>
21682156

2169-
<groupName>PWM</groupName>
21702157
<description>8-bit timer with 4 cmp</description>
21712158

21722159
<registers>
@@ -2269,7 +2256,7 @@
22692256
<peripheral>
22702257
<name>I2C0</name>
22712258
<baseAddress>0x10016000</baseAddress>
2272-
<groupName>I2C</groupName>
2259+
<groupName>g002</groupName>
22732260
<description>Inter-Integrated Circuit Master Interface (FE310-G002 only)</description>
22742261
<registers>
22752262
<register>

e310x/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,16 @@ impl core::fmt::Debug for Pwm0 {
111111
#[doc = "8-bit timer with 4 cmp"]
112112
pub mod pwm0;
113113
#[doc = "Inter-Integrated Circuit Master Interface (FE310-G002 only)"]
114+
#[cfg(feature = "g002")]
114115
pub type I2c0 = crate::Periph<i2c0::RegisterBlock, 0x1001_6000>;
116+
#[cfg(feature = "g002")]
115117
impl core::fmt::Debug for I2c0 {
116118
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
117119
f.debug_struct("I2c0").finish()
118120
}
119121
}
120122
#[doc = "Inter-Integrated Circuit Master Interface (FE310-G002 only)"]
123+
#[cfg(feature = "g002")]
121124
pub mod i2c0;
122125
#[doc = "Universal Asynchronous Receiver Transmitter"]
123126
pub type Uart1 = crate::Periph<uart0::RegisterBlock, 0x1002_3000>;
@@ -192,6 +195,7 @@ pub struct Peripherals {
192195
#[doc = "PWM0"]
193196
pub pwm0: Pwm0,
194197
#[doc = "I2C0"]
198+
#[cfg(feature = "g002")]
195199
pub i2c0: I2c0,
196200
#[doc = "UART1"]
197201
pub uart1: Uart1,
@@ -236,6 +240,7 @@ impl Peripherals {
236240
uart0: Uart0::steal(),
237241
qspi0: Qspi0::steal(),
238242
pwm0: Pwm0::steal(),
243+
#[cfg(feature = "g002")]
239244
i2c0: I2c0::steal(),
240245
uart1: Uart1::steal(),
241246
qspi1: Qspi1::steal(),

e310x/update.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
set -x
33
set -e
44

5-
# used svd2rust 0.34.0
5+
# used svd2rust 0.36.1
66
rm -rf src
77
mkdir src
8-
svd2rust --target riscv --settings settings.yaml -g -i e310x.svd
8+
svd2rust --target riscv --settings settings.yaml --feature-group -g -i e310x.svd
9+
rm -f features.toml
910
mv generic.rs src/
1011
form -i lib.rs -o src/
1112
rm lib.rs

0 commit comments

Comments
 (0)