File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -259,4 +259,5 @@ transforms!(
259259 modify_byte_offset:: ModifyByteOffset ,
260260 fix_register_bit_sizes:: FixRegisterBitSizes ,
261261 rename_interrupts:: RenameInterrupts ,
262+ rename_peripherals:: RenamePeripherals ,
262263) ;
Original file line number Diff line number Diff line change 1+ use serde:: { Deserialize , Serialize } ;
2+
3+ use super :: common:: * ;
4+ use crate :: ir:: * ;
5+
6+ #[ derive( Debug , Serialize , Deserialize ) ]
7+ pub struct RenamePeripherals {
8+ pub from : RegexSet ,
9+ pub to : String ,
10+ }
11+
12+ impl RenamePeripherals {
13+ pub fn run ( & self , ir : & mut IR ) -> anyhow:: Result < ( ) > {
14+ for d in ir. devices . values_mut ( ) {
15+ for p in & mut d. peripherals {
16+ if let Some ( name) = match_expand ( & p. name , & self . from , & self . to ) {
17+ p. name = name;
18+ }
19+ }
20+ }
21+ Ok ( ( ) )
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments