# {For Open On-Chip Debugger 0.6.0-dev-00477-gf1c0133 } # { Display the stm32f4xx registers associated with PWR } # { http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/REFERENCE_MANUAL/DM00031020.pdf } source [find bitsbytes.tcl] source [find memory.tcl] puts "\n===== PWR =====" set pwr_base 0x40007000 foreach name {pwr_cr pwr_csr} offset {0 4} { set $name [memread32 [expr $pwr_base + $offset]] } proc labelled_bits {var masklabels} { foreach ml $masklabels { if {$var & [lindex $ml 0]} { puts -nonewline " [lindex $ml 1]" } } } puts -nonewline [format "CR\t0x%08x" $pwr_cr] puts -nonewline " PLS=[lindex {2.0V 2.1V 2.3V 2.5V 2.6V 2.7V 2.8V 2.9V} [expr $pwr_cr >> 5 & 7]]" labelled_bits $pwr_cr { {0x4000 VOS} {0x200 FPDS} {0x100 DBP} {0x10 PVDE} {8 CSBF} {4 CWUF} {2 PDDS} {1 LPDS} } puts "" puts -nonewline [format "CSR\t0x%08x" $pwr_csr] labelled_bits $pwr_csr { {0x4000 VOSRDY} {0x200 BRE} {0x100 EWUP} {8 BRR} {4 PVDO} {2 SBF} {1 WUF} } puts ""