+proc psoc4_get_family_id {} {
+ set err [catch {set romtable_pid [read_memory 0xF0000FE0 32 3]}]
+ if { $err } {
+ return 0
+ }
+ if { [expr {[lindex $romtable_pid 0] & 0xffffff00 }]
+ || [expr {[lindex $romtable_pid 1] & 0xffffff00 }]
+ || [expr {[lindex $romtable_pid 2] & 0xffffff00 }] } {
+ echo "Unexpected data in ROMTABLE"
+ return 0
+ }
+ set designer_id [expr {(( [lindex $romtable_pid 1] & 0xf0 ) >> 4) | (( [lindex $romtable_pid 2] & 0xf ) << 4 ) }]
+ if { $designer_id != 0xb4 } {
+ echo [format "ROMTABLE Designer ID 0x%02x is not Cypress" $designer_id]
+ return 0
+ }
+ set family_id [expr {( [lindex $romtable_pid 0] & 0xff ) | (( [lindex $romtable_pid 1] & 0xf ) << 8 ) }]
+ return $family_id
+}
+