@@ -45,15 +45,41 @@ pub struct PeripheralInfo {
4545 ) ]
4646 pub description : Option < String > ,
4747
48- // alternatePeripheral
48+ /// Specifies peripheral assigned to the same address blocks
49+ #[ cfg_attr(
50+ feature = "serde" ,
51+ serde( default , skip_serializing_if = "Option::is_none" )
52+ ) ]
53+ pub alternate_peripheral : Option < String > ,
54+
4955 /// Assigns this peripheral to a group of peripherals. This is only used bye the System View
5056 #[ cfg_attr(
5157 feature = "serde" ,
5258 serde( default , skip_serializing_if = "Option::is_none" )
5359 ) ]
5460 pub group_name : Option < String > ,
5561
56- // headerStructName
62+ /// Define a string as prefix. All register names of this peripheral get this prefix
63+ #[ cfg_attr(
64+ feature = "serde" ,
65+ serde( default , skip_serializing_if = "Option::is_none" )
66+ ) ]
67+ pub prepend_to_name : Option < String > ,
68+
69+ /// Define a string as suffix. All register names of this peripheral get this suffix
70+ #[ cfg_attr(
71+ feature = "serde" ,
72+ serde( default , skip_serializing_if = "Option::is_none" )
73+ ) ]
74+ pub append_to_name : Option < String > ,
75+
76+ /// Specify the struct type name created in the device header file
77+ #[ cfg_attr(
78+ feature = "serde" ,
79+ serde( default , skip_serializing_if = "Option::is_none" )
80+ ) ]
81+ pub header_struct_name : Option < String > ,
82+
5783 /// Lowest address reserved or used by the peripheral
5884 pub base_address : u64 ,
5985
@@ -98,7 +124,11 @@ pub struct PeripheralInfoBuilder {
98124 display_name : Option < String > ,
99125 version : Option < String > ,
100126 description : Option < String > ,
127+ alternate_peripheral : Option < String > ,
101128 group_name : Option < String > ,
129+ prepend_to_name : Option < String > ,
130+ append_to_name : Option < String > ,
131+ header_struct_name : Option < String > ,
102132 base_address : Option < u64 > ,
103133 default_register_properties : RegisterProperties ,
104134 address_block : Option < Vec < AddressBlock > > ,
@@ -114,7 +144,11 @@ impl From<PeripheralInfo> for PeripheralInfoBuilder {
114144 display_name : p. display_name ,
115145 version : p. version ,
116146 description : p. description ,
147+ alternate_peripheral : p. alternate_peripheral ,
117148 group_name : p. group_name ,
149+ prepend_to_name : p. prepend_to_name ,
150+ append_to_name : p. append_to_name ,
151+ header_struct_name : p. header_struct_name ,
118152 base_address : Some ( p. base_address ) ,
119153 default_register_properties : p. default_register_properties ,
120154 address_block : p. address_block ,
@@ -146,11 +180,31 @@ impl PeripheralInfoBuilder {
146180 self . description = value;
147181 self
148182 }
183+ /// Set the alternate peripheral
184+ pub fn alternate_peripheral ( mut self , value : Option < String > ) -> Self {
185+ self . alternate_peripheral = value;
186+ self
187+ }
149188 /// Set the group name of the peripheral
150189 pub fn group_name ( mut self , value : Option < String > ) -> Self {
151190 self . group_name = value;
152191 self
153192 }
193+ /// Set the prefix for names of all registers of the peripheral
194+ pub fn prepend_to_name ( mut self , value : Option < String > ) -> Self {
195+ self . prepend_to_name = value;
196+ self
197+ }
198+ /// Set the suffix for names of all registers of the peripheral
199+ pub fn append_to_name ( mut self , value : Option < String > ) -> Self {
200+ self . append_to_name = value;
201+ self
202+ }
203+ /// Set the header struct name of the peripheral
204+ pub fn header_struct_name ( mut self , value : Option < String > ) -> Self {
205+ self . header_struct_name = value;
206+ self
207+ }
154208 /// Set the base address of the peripheral
155209 pub fn base_address ( mut self , value : u64 ) -> Self {
156210 self . base_address = Some ( value) ;
@@ -190,7 +244,11 @@ impl PeripheralInfoBuilder {
190244 display_name : self . display_name . empty_to_none ( ) ,
191245 version : self . version . empty_to_none ( ) ,
192246 description : self . description . empty_to_none ( ) ,
247+ alternate_peripheral : self . alternate_peripheral . empty_to_none ( ) ,
193248 group_name : self . group_name . empty_to_none ( ) ,
249+ prepend_to_name : self . prepend_to_name . empty_to_none ( ) ,
250+ append_to_name : self . append_to_name . empty_to_none ( ) ,
251+ header_struct_name : self . header_struct_name . empty_to_none ( ) ,
194252 base_address : self
195253 . base_address
196254 . ok_or_else ( || BuildError :: Uninitialized ( "base_address" . to_string ( ) ) ) ?,
@@ -238,9 +296,21 @@ impl PeripheralInfo {
238296 if builder. description . is_some ( ) {
239297 self . description = builder. description . empty_to_none ( ) ;
240298 }
299+ if builder. alternate_peripheral . is_some ( ) {
300+ self . alternate_peripheral = builder. alternate_peripheral . empty_to_none ( ) ;
301+ }
241302 if builder. group_name . is_some ( ) {
242303 self . group_name = builder. group_name . empty_to_none ( ) ;
243304 }
305+ if builder. prepend_to_name . is_some ( ) {
306+ self . prepend_to_name = builder. prepend_to_name . empty_to_none ( ) ;
307+ }
308+ if builder. append_to_name . is_some ( ) {
309+ self . append_to_name = builder. append_to_name . empty_to_none ( ) ;
310+ }
311+ if builder. header_struct_name . is_some ( ) {
312+ self . header_struct_name = builder. header_struct_name . empty_to_none ( ) ;
313+ }
244314 if let Some ( base_address) = builder. base_address {
245315 self . base_address = base_address;
246316 }
0 commit comments