Flatten samd_probe.
This commit is contained in:
parent
5c337c9aa7
commit
1de685198c
14
src/samd.c
14
src/samd.c
@ -374,21 +374,23 @@ bool samd_probe(struct target_s *target)
|
||||
uint32_t pid = samd_read_pid(target);
|
||||
|
||||
/* Check the ARM Coresight Component and Perhiperal IDs */
|
||||
if (cid == SAMD_CID_VALUE &&
|
||||
(pid & SAMD_PID_MASK) == SAMD_PID_CONST_VALUE) {
|
||||
if ((cid != SAMD_CID_VALUE) ||
|
||||
((pid & SAMD_PID_MASK) != SAMD_PID_CONST_VALUE))
|
||||
return false;
|
||||
|
||||
/* Read the Device ID */
|
||||
uint32_t did = target_mem_read32(target, SAMD_DSU_DID);
|
||||
|
||||
/* If the Device ID matches */
|
||||
if ((did & SAMD_DID_MASK) == SAMD_DID_CONST_VALUE) {
|
||||
if ((did & SAMD_DID_MASK) != SAMD_DID_CONST_VALUE)
|
||||
return false;
|
||||
|
||||
uint32_t ctrlstat = target_mem_read32(target,
|
||||
SAMD_DSU_CTRLSTAT);
|
||||
struct samd_descr samd = samd_parse_device_id(did);
|
||||
|
||||
/* Protected? */
|
||||
int protected = (ctrlstat & SAMD_STATUSB_PROT);
|
||||
bool protected = (ctrlstat & SAMD_STATUSB_PROT);
|
||||
|
||||
/* Part String */
|
||||
if (protected) {
|
||||
@ -446,10 +448,6 @@ bool samd_probe(struct target_s *target)
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user