@@ -21,19 +21,55 @@ use crate::svd::{
2121#[ cfg_attr( feature = "serde" , derive( serde:: Deserialize , serde:: Serialize ) ) ]
2222#[ derive( Clone , Debug ) ]
2323pub struct Peripheral {
24+ /// The string identifies the peripheral. Peripheral names are required to be unique for a device
2425 pub name : String ,
26+
27+ /// Lowest address reserved or used by the peripheral
28+ pub base_address : u32 ,
29+
30+ /// The string specifies the version of this peripheral description
31+ #[ cfg_attr( feature = "serde" , serde( default ) ) ]
32+ #[ cfg_attr( feature = "serde" , serde( skip_serializing_if = "Option::is_none" ) ) ]
2533 pub version : Option < String > ,
34+
35+ #[ cfg_attr( feature = "serde" , serde( default ) ) ]
36+ #[ cfg_attr( feature = "serde" , serde( skip_serializing_if = "Option::is_none" ) ) ]
2637 pub display_name : Option < String > ,
38+
39+ #[ cfg_attr( feature = "serde" , serde( default ) ) ]
40+ #[ cfg_attr( feature = "serde" , serde( skip_serializing_if = "Option::is_none" ) ) ]
2741 pub group_name : Option < String > ,
42+
43+ /// The string provides an overview of the purpose and functionality of the peripheral
44+ #[ cfg_attr( feature = "serde" , serde( default ) ) ]
45+ #[ cfg_attr( feature = "serde" , serde( skip_serializing_if = "Option::is_none" ) ) ]
2846 pub description : Option < String > ,
29- pub base_address : u32 ,
47+
48+ /// Specify an address range uniquely mapped to this peripheral
49+ #[ cfg_attr( feature = "serde" , serde( default ) ) ]
50+ #[ cfg_attr( feature = "serde" , serde( skip_serializing_if = "Option::is_none" ) ) ]
3051 pub address_block : Option < AddressBlock > ,
52+
53+ /// A peripheral can have multiple associated interrupts
54+ #[ cfg_attr( feature = "serde" , serde( default ) ) ]
55+ #[ cfg_attr( feature = "serde" , serde( skip_serializing_if = "Vec::is_empty" ) ) ]
3156 pub interrupt : Vec < Interrupt > ,
57+
3258 pub default_register_properties : RegisterProperties ,
59+
60+ /// Group to enclose register definitions.
3361 /// `None` indicates that the `<registers>` node is not present
62+ #[ cfg_attr( feature = "serde" , serde( default ) ) ]
63+ #[ cfg_attr( feature = "serde" , serde( skip_serializing_if = "Option::is_none" ) ) ]
3464 pub registers : Option < Vec < RegisterCluster > > ,
65+
66+ /// Specify the peripheral name from which to inherit data. Elements specified subsequently override inherited values
67+ #[ cfg_attr( feature = "serde" , serde( default ) ) ]
68+ #[ cfg_attr( feature = "serde" , serde( skip_serializing_if = "Option::is_none" ) ) ]
3569 pub derived_from : Option < String > ,
70+
3671 // Reserve the right to add more fields to this struct
72+ #[ cfg_attr( feature = "serde" , serde( skip) ) ]
3773 _extensible : ( ) ,
3874}
3975
0 commit comments