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);
|
uint32_t pid = samd_read_pid(target);
|
||||||
|
|
||||||
/* Check the ARM Coresight Component and Perhiperal IDs */
|
/* Check the ARM Coresight Component and Perhiperal IDs */
|
||||||
if (cid == SAMD_CID_VALUE &&
|
if ((cid != SAMD_CID_VALUE) ||
|
||||||
(pid & SAMD_PID_MASK) == SAMD_PID_CONST_VALUE) {
|
((pid & SAMD_PID_MASK) != SAMD_PID_CONST_VALUE))
|
||||||
|
return false;
|
||||||
|
|
||||||
/* Read the Device ID */
|
/* Read the Device ID */
|
||||||
uint32_t did = target_mem_read32(target, SAMD_DSU_DID);
|
uint32_t did = target_mem_read32(target, SAMD_DSU_DID);
|
||||||
|
|
||||||
/* If the Device ID matches */
|
/* 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,
|
uint32_t ctrlstat = target_mem_read32(target,
|
||||||
SAMD_DSU_CTRLSTAT);
|
SAMD_DSU_CTRLSTAT);
|
||||||
struct samd_descr samd = samd_parse_device_id(did);
|
struct samd_descr samd = samd_parse_device_id(did);
|
||||||
|
|
||||||
/* Protected? */
|
/* Protected? */
|
||||||
int protected = (ctrlstat & SAMD_STATUSB_PROT);
|
bool protected = (ctrlstat & SAMD_STATUSB_PROT);
|
||||||
|
|
||||||
/* Part String */
|
/* Part String */
|
||||||
if (protected) {
|
if (protected) {
|
||||||
|
@ -446,10 +448,6 @@ bool samd_probe(struct target_s *target)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue