@@ -463,8 +463,8 @@ impl Chip {
463463 std:: slice:: from_raw_parts_mut ( output. as_mut_ptr ( ) as * mut u8 , std:: mem:: size_of :: < T > ( ) )
464464 } ;
465465
466- let bit_off = bit_start as u32 ;
467- let bit_end = std:: cmp:: min ( bit_count as u32 , ( bytes. len ( ) * 8 ) as u32 ) + bit_off;
466+ let bit_off = bit_start;
467+ let bit_end = std:: cmp:: min ( bit_count, ( bytes. len ( ) * 8 ) as u32 ) + bit_off;
468468
469469 let mut last_word_off = bit_off / 32 ;
470470 let mut last_word = read_raw ( connection, block_address ( self , block) + last_word_off * 4 ) ?;
@@ -489,7 +489,7 @@ impl Chip {
489489 last_word_off = word_off;
490490 last_word = read_raw ( connection, block_address ( self , block) + last_word_off * 4 ) ?;
491491 // Append bits from a beginning of the next word:
492- word |= last_word. wrapping_shl ( ( 32 - word_bit_off) as u32 ) ;
492+ word |= last_word. wrapping_shl ( 32 - word_bit_off) ;
493493 } ;
494494
495495 if word_bit_len < 32 {
@@ -618,7 +618,8 @@ impl Chip {
618618 features. push ( "BT" ) ;
619619 }
620620
621- let disable_app_cpu = self . read_efuse_le :: < u32 > ( connection, efuse:: esp32:: DISABLE_APP_CPU ) ?;
621+ let disable_app_cpu =
622+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32:: DISABLE_APP_CPU ) ?;
622623 if disable_app_cpu == 0 {
623624 features. push ( "Dual Core" ) ;
624625 } else {
@@ -657,7 +658,8 @@ impl Chip {
657658 features. push ( "BLK3 partially reserved" ) ;
658659 }
659660
660- let coding_scheme = self . read_efuse_le :: < u32 > ( connection, efuse:: esp32:: CODING_SCHEME ) ?;
661+ let coding_scheme =
662+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32:: CODING_SCHEME ) ?;
661663 features. push ( match coding_scheme {
662664 0 => "Coding Scheme None" ,
663665 1 => "Coding Scheme 3/4" ,
@@ -751,20 +753,34 @@ impl Chip {
751753 _ => Ok ( 0 ) ,
752754 }
753755 }
754- Chip :: Esp32c2 => self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c2:: WAFER_VERSION_MAJOR ) ,
755- Chip :: Esp32c3 => self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c3:: WAFER_VERSION_MAJOR ) ,
756- Chip :: Esp32c5 => self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c5:: WAFER_VERSION_MAJOR ) ,
757- Chip :: Esp32c6 => self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c6:: WAFER_VERSION_MAJOR ) ,
758- Chip :: Esp32h2 => self . read_efuse_le :: < u32 > ( connection, efuse:: esp32h2:: WAFER_VERSION_MAJOR ) ,
756+ Chip :: Esp32c2 => {
757+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c2:: WAFER_VERSION_MAJOR )
758+ }
759+ Chip :: Esp32c3 => {
760+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c3:: WAFER_VERSION_MAJOR )
761+ }
762+ Chip :: Esp32c5 => {
763+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c5:: WAFER_VERSION_MAJOR )
764+ }
765+ Chip :: Esp32c6 => {
766+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c6:: WAFER_VERSION_MAJOR )
767+ }
768+ Chip :: Esp32h2 => {
769+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32h2:: WAFER_VERSION_MAJOR )
770+ }
759771 Chip :: Esp32p4 => {
760- let hi = self . read_efuse_le :: < u32 > ( connection, efuse:: esp32p4:: WAFER_VERSION_MAJOR_HI ) ?;
761- let lo = self . read_efuse_le :: < u32 > ( connection, efuse:: esp32p4:: WAFER_VERSION_MAJOR_LO ) ?;
772+ let hi =
773+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32p4:: WAFER_VERSION_MAJOR_HI ) ?;
774+ let lo =
775+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32p4:: WAFER_VERSION_MAJOR_LO ) ?;
762776
763777 let version = ( hi << 2 ) | lo;
764778
765779 Ok ( version)
766780 }
767- Chip :: Esp32s2 => self . read_efuse_le :: < u32 > ( connection, efuse:: esp32s2:: WAFER_VERSION_MAJOR ) ,
781+ Chip :: Esp32s2 => {
782+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32s2:: WAFER_VERSION_MAJOR )
783+ }
768784 Chip :: Esp32s3 => {
769785 if self . esp32s3_blk_version_major ( connection) ? == 1
770786 && self . esp32s3_blk_version_minor ( connection) ? == 1
@@ -782,26 +798,42 @@ impl Chip {
782798 pub fn minor_version ( & self , connection : & mut Connection ) -> Result < u32 , Error > {
783799 match self {
784800 Chip :: Esp32 => self . read_efuse_le :: < u32 > ( connection, efuse:: esp32:: WAFER_VERSION_MINOR ) ,
785- Chip :: Esp32c2 => self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c2:: WAFER_VERSION_MINOR ) ,
801+ Chip :: Esp32c2 => {
802+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c2:: WAFER_VERSION_MINOR )
803+ }
786804 Chip :: Esp32c3 => {
787- let hi = self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c3:: WAFER_VERSION_MINOR_HI ) ?;
788- let lo = self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c3:: WAFER_VERSION_MINOR_LO ) ?;
805+ let hi =
806+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c3:: WAFER_VERSION_MINOR_HI ) ?;
807+ let lo =
808+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c3:: WAFER_VERSION_MINOR_LO ) ?;
789809
790810 Ok ( ( hi << 3 ) + lo)
791811 }
792- Chip :: Esp32c5 => self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c5:: WAFER_VERSION_MINOR ) ,
793- Chip :: Esp32c6 => self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c6:: WAFER_VERSION_MINOR ) ,
794- Chip :: Esp32h2 => self . read_efuse_le :: < u32 > ( connection, efuse:: esp32h2:: WAFER_VERSION_MINOR ) ,
795- Chip :: Esp32p4 => self . read_efuse_le :: < u32 > ( connection, efuse:: esp32p4:: WAFER_VERSION_MINOR ) ,
812+ Chip :: Esp32c5 => {
813+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c5:: WAFER_VERSION_MINOR )
814+ }
815+ Chip :: Esp32c6 => {
816+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32c6:: WAFER_VERSION_MINOR )
817+ }
818+ Chip :: Esp32h2 => {
819+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32h2:: WAFER_VERSION_MINOR )
820+ }
821+ Chip :: Esp32p4 => {
822+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32p4:: WAFER_VERSION_MINOR )
823+ }
796824 Chip :: Esp32s2 => {
797- let hi = self . read_efuse_le :: < u32 > ( connection, efuse:: esp32s2:: WAFER_VERSION_MINOR_HI ) ?;
798- let lo = self . read_efuse_le :: < u32 > ( connection, efuse:: esp32s2:: WAFER_VERSION_MINOR_LO ) ?;
825+ let hi =
826+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32s2:: WAFER_VERSION_MINOR_HI ) ?;
827+ let lo =
828+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32s2:: WAFER_VERSION_MINOR_LO ) ?;
799829
800830 Ok ( ( hi << 3 ) + lo)
801831 }
802832 Chip :: Esp32s3 => {
803- let hi = self . read_efuse_le :: < u32 > ( connection, efuse:: esp32s3:: WAFER_VERSION_MINOR_HI ) ?;
804- let lo = self . read_efuse_le :: < u32 > ( connection, efuse:: esp32s3:: WAFER_VERSION_MINOR_LO ) ?;
833+ let hi =
834+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32s3:: WAFER_VERSION_MINOR_HI ) ?;
835+ let lo =
836+ self . read_efuse_le :: < u32 > ( connection, efuse:: esp32s3:: WAFER_VERSION_MINOR_LO ) ?;
805837
806838 Ok ( ( hi << 3 ) + lo)
807839 }
0 commit comments