@@ -5,8 +5,9 @@ use std::collections::HashMap;
55use std:: fmt;
66use std:: mem:: take;
77use svd_rs:: {
8- array:: names, cluster, field, peripheral, register, BitRange , Cluster , ClusterInfo , DeriveFrom ,
9- Device , EnumeratedValues , Field , Peripheral , Register , RegisterCluster , RegisterProperties ,
8+ array:: { descriptions, names} ,
9+ cluster, field, peripheral, register, BitRange , Cluster , ClusterInfo , DeriveFrom , Device ,
10+ EnumeratedValues , Field , Peripheral , Register , RegisterCluster , RegisterProperties ,
1011} ;
1112
1213/// Path to `peripheral` or `cluster` element
@@ -320,10 +321,12 @@ fn expand_cluster_array(
320321 Cluster :: Single ( c) => expand_cluster ( regs, c) ,
321322 Cluster :: Array ( info, dim) => {
322323 for c in names ( & info, & dim)
324+ . zip ( descriptions ( & info, & dim) )
323325 . zip ( cluster:: address_offsets ( & info, & dim) )
324- . map ( |( name, address_offset) | {
326+ . map ( |( ( name, description ) , address_offset) | {
325327 let mut info = info. clone ( ) ;
326328 info. name = name;
329+ info. description = description;
327330 info. address_offset = address_offset;
328331 info
329332 } )
@@ -435,7 +438,7 @@ fn expand_cluster(regs: &mut Vec<RegisterCluster>, c: ClusterInfo) {
435438 RegisterCluster :: Register ( mut r) => {
436439 r. name = format ! ( "{}_{}" , c. name, r. name) ;
437440 r. address_offset += c. address_offset ;
438- regs. push ( RegisterCluster :: Register ( r ) ) ;
441+ regs. push ( r . into ( ) ) ;
439442 }
440443 }
441444 }
@@ -462,19 +465,21 @@ fn expand_register_array(
462465
463466 match r {
464467 Register :: Single ( _) => {
465- regs. push ( RegisterCluster :: Register ( r ) ) ;
468+ regs. push ( r . into ( ) ) ;
466469 }
467470 Register :: Array ( info, dim) => {
468471 for rx in names ( & info, & dim)
472+ . zip ( descriptions ( & info, & dim) )
469473 . zip ( register:: address_offsets ( & info, & dim) )
470- . map ( |( name, address_offset) | {
474+ . map ( |( ( name, description ) , address_offset) | {
471475 let mut info = info. clone ( ) ;
472476 info. name = name;
477+ info. description = description;
473478 info. address_offset = address_offset;
474- Register :: Single ( info)
479+ info. single ( )
475480 } )
476481 {
477- regs. push ( RegisterCluster :: Register ( rx ) ) ;
482+ regs. push ( rx . into ( ) ) ;
478483 }
479484 }
480485 }
@@ -506,15 +511,16 @@ fn expand_field(
506511 fields. push ( f) ;
507512 }
508513 Field :: Array ( info, dim) => {
509- for fx in
510- names ( & info, & dim)
511- . zip ( field:: bit_offsets ( & info, & dim) )
512- . map ( |( name, bit_offset) | {
513- let mut info = info. clone ( ) ;
514- info. name = name;
515- info. bit_range = BitRange :: from_offset_width ( bit_offset, info. bit_width ( ) ) ;
516- Field :: Single ( info)
517- } )
514+ for fx in names ( & info, & dim)
515+ . zip ( descriptions ( & info, & dim) )
516+ . zip ( field:: bit_offsets ( & info, & dim) )
517+ . map ( |( ( name, description) , bit_offset) | {
518+ let mut info = info. clone ( ) ;
519+ info. name = name;
520+ info. description = description;
521+ info. bit_range = BitRange :: from_offset_width ( bit_offset, info. bit_width ( ) ) ;
522+ Field :: Single ( info)
523+ } )
518524 {
519525 fields. push ( fx) ;
520526 }
@@ -631,10 +637,12 @@ pub fn expand(indevice: &Device) -> Result<Device> {
631637 }
632638 Peripheral :: Array ( info, dim) => {
633639 for px in names ( & info, & dim)
640+ . zip ( descriptions ( & info, & dim) )
634641 . zip ( peripheral:: base_addresses ( & info, & dim) )
635- . map ( |( name, base_address) | {
642+ . map ( |( ( name, description ) , base_address) | {
636643 let mut info = info. clone ( ) ;
637644 info. name = name;
645+ info. description = description;
638646 info. base_address = base_address;
639647 Peripheral :: Single ( info)
640648 } )
0 commit comments