1
+ #[ cfg( feature = "unstable-riscv" ) ]
2
+ use super :: Riscv ;
1
3
use super :: {
2
4
BuildError , Cpu , Description , EmptyToNone , Name , Peripheral , RegisterProperties , SvdError ,
3
5
ValidateLevel ,
@@ -105,6 +107,14 @@ pub struct Device {
105
107
/// Specify the compliant CMSIS-SVD schema version
106
108
#[ cfg_attr( feature = "serde" , serde( skip, default = "default_schema_version" ) ) ]
107
109
pub schema_version : String ,
110
+
111
+ /// Describe the processor included in the device
112
+ #[ cfg_attr(
113
+ feature = "serde" ,
114
+ serde( default , skip_serializing_if = "Option::is_none" )
115
+ ) ]
116
+ #[ cfg( feature = "unstable-riscv" ) ]
117
+ pub riscv : Option < Riscv > ,
108
118
}
109
119
110
120
fn default_xmlns_xs ( ) -> String {
@@ -130,6 +140,8 @@ pub struct DeviceBuilder {
130
140
version : Option < String > ,
131
141
description : Option < String > ,
132
142
license_text : Option < String > ,
143
+ #[ cfg( feature = "unstable-riscv" ) ]
144
+ riscv : Option < Riscv > ,
133
145
cpu : Option < Cpu > ,
134
146
header_system_filename : Option < String > ,
135
147
header_definitions_prefix : Option < String > ,
@@ -152,6 +164,8 @@ impl From<Device> for DeviceBuilder {
152
164
version : Some ( d. version ) ,
153
165
description : Some ( d. description ) ,
154
166
license_text : d. license_text ,
167
+ #[ cfg( feature = "unstable-riscv" ) ]
168
+ riscv : d. riscv ,
155
169
cpu : d. cpu ,
156
170
header_system_filename : d. header_system_filename ,
157
171
header_definitions_prefix : d. header_definitions_prefix ,
@@ -202,6 +216,12 @@ impl DeviceBuilder {
202
216
self . license_text = value;
203
217
self
204
218
}
219
+ /// Set the riscv of the device.
220
+ #[ cfg( feature = "unstable-riscv" ) ]
221
+ pub fn riscv ( mut self , value : Riscv ) -> Self {
222
+ self . riscv = Some ( value) ;
223
+ self
224
+ }
205
225
/// Set the cpu of the device.
206
226
pub fn cpu ( mut self , value : Option < Cpu > ) -> Self {
207
227
self . cpu = value;
@@ -283,6 +303,8 @@ impl DeviceBuilder {
283
303
} )
284
304
. ok_or_else ( || BuildError :: Uninitialized ( "description" . to_string ( ) ) ) ?,
285
305
license_text : self . license_text ,
306
+ #[ cfg( feature = "unstable-riscv" ) ]
307
+ riscv : self . riscv ,
286
308
cpu : self . cpu ,
287
309
header_system_filename : self . header_system_filename ,
288
310
header_definitions_prefix : self . header_definitions_prefix ,
@@ -341,6 +363,10 @@ impl Device {
341
363
if builder. license_text . is_some ( ) {
342
364
self . license_text = builder. license_text . empty_to_none ( ) ;
343
365
}
366
+ #[ cfg( feature = "unstable-riscv" ) ]
367
+ if builder. riscv . is_some ( ) {
368
+ self . riscv = builder. riscv ;
369
+ }
344
370
if builder. cpu . is_some ( ) {
345
371
self . cpu = builder. cpu ;
346
372
}
0 commit comments