@@ -21,19 +21,55 @@ use crate::svd::{
21
21
#[ cfg_attr( feature = "serde" , derive( serde:: Deserialize , serde:: Serialize ) ) ]
22
22
#[ derive( Clone , Debug ) ]
23
23
pub struct Peripheral {
24
+ /// The string identifies the peripheral. Peripheral names are required to be unique for a device
24
25
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" ) ) ]
25
33
pub version : Option < String > ,
34
+
35
+ #[ cfg_attr( feature = "serde" , serde( default ) ) ]
36
+ #[ cfg_attr( feature = "serde" , serde( skip_serializing_if = "Option::is_none" ) ) ]
26
37
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" ) ) ]
27
41
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" ) ) ]
28
46
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" ) ) ]
30
51
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" ) ) ]
31
56
pub interrupt : Vec < Interrupt > ,
57
+
32
58
pub default_register_properties : RegisterProperties ,
59
+
60
+ /// Group to enclose register definitions.
33
61
/// `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" ) ) ]
34
64
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" ) ) ]
35
69
pub derived_from : Option < String > ,
70
+
36
71
// Reserve the right to add more fields to this struct
72
+ #[ cfg_attr( feature = "serde" , serde( skip) ) ]
37
73
_extensible : ( ) ,
38
74
}
39
75
0 commit comments