|
1 | 1 | use anyhow::{anyhow, Context}; |
2 | 2 | use svd_parser::svd::{ |
3 | 3 | self, Cluster, ClusterInfo, DimElement, Interrupt, Peripheral, Register, RegisterCluster, |
4 | | - RegisterInfo, WriteConstraint, WriteConstraintRange, |
| 4 | + RegisterInfo, |
5 | 5 | }; |
6 | 6 | use yaml_rust::{yaml::Hash, Yaml}; |
7 | 7 |
|
@@ -417,30 +417,6 @@ impl RegisterBlockExt for Peripheral { |
417 | 417 | let dim = make_dim_element(rmod)?; |
418 | 418 | for rtag in rtags { |
419 | 419 | modify_dim_element(rtag, &dim)?; |
420 | | - if let Some(value) = rmod |
421 | | - .get(&"_write_constraint".to_yaml()) |
422 | | - .or_else(|| rmod.get(&"writeConstraint".to_yaml())) |
423 | | - { |
424 | | - let wc = match value { |
425 | | - Yaml::String(s) if s == "none" => { |
426 | | - // Completely remove the existing writeConstraint |
427 | | - None |
428 | | - } |
429 | | - Yaml::String(s) if s == "enum" => { |
430 | | - // Only allow enumerated values |
431 | | - Some(WriteConstraint::UseEnumeratedValues(true)) |
432 | | - } |
433 | | - Yaml::Array(a) => { |
434 | | - // Allow a certain range |
435 | | - Some(WriteConstraint::Range(WriteConstraintRange { |
436 | | - min: a[0].i64()? as u64, |
437 | | - max: a[1].i64()? as u64, |
438 | | - })) |
439 | | - } |
440 | | - _ => return Err(anyhow!("Unknown writeConstraint type {value:?}")), |
441 | | - }; |
442 | | - rtag.write_constraint = wc; |
443 | | - } |
444 | 420 | rtag.modify_from(register_builder.clone(), VAL_LVL)?; |
445 | 421 | if let Some("") = rmod.get_str("access")? { |
446 | 422 | rtag.properties.access = None; |
@@ -905,30 +881,6 @@ impl RegisterBlockExt for Cluster { |
905 | 881 | let dim = make_dim_element(rmod)?; |
906 | 882 | for rtag in rtags { |
907 | 883 | modify_dim_element(rtag, &dim)?; |
908 | | - if let Some(value) = rmod |
909 | | - .get(&"_write_constraint".to_yaml()) |
910 | | - .or_else(|| rmod.get(&"writeConstraint".to_yaml())) |
911 | | - { |
912 | | - let wc = match value { |
913 | | - Yaml::String(s) if s == "none" => { |
914 | | - // Completely remove the existing writeConstraint |
915 | | - None |
916 | | - } |
917 | | - Yaml::String(s) if s == "enum" => { |
918 | | - // Only allow enumerated values |
919 | | - Some(WriteConstraint::UseEnumeratedValues(true)) |
920 | | - } |
921 | | - Yaml::Array(a) => { |
922 | | - // Allow a certain range |
923 | | - Some(WriteConstraint::Range(WriteConstraintRange { |
924 | | - min: a[0].i64()? as u64, |
925 | | - max: a[1].i64()? as u64, |
926 | | - })) |
927 | | - } |
928 | | - _ => return Err(anyhow!("Unknown writeConstraint type {value:?}")), |
929 | | - }; |
930 | | - rtag.write_constraint = wc; |
931 | | - } |
932 | 884 | rtag.modify_from(register_builder.clone(), VAL_LVL)?; |
933 | 885 | if let Some("") = rmod.get_str("access")? { |
934 | 886 | rtag.properties.access = None; |
|
0 commit comments