ch32f1: Re-ordered a couple of the operation in ch32f1_probe so it plays nicer with the STM32 parts

This commit is contained in:
dragonmux 2022-06-22 16:49:32 -04:00 committed by Piotr Esden-Tempski
parent 0368b76078
commit b5b2d4dc95
1 changed files with 4 additions and 2 deletions

View File

@ -159,8 +159,10 @@ static int ch32f1_flash_lock(target *t)
*/
bool ch32f1_probe(target *t)
{
const uint32_t idcode = target_mem_read32(t, DBGMCU_IDCODE) & 0xfff;
if ((t->cpuid & CPUID_PARTNO_MASK) != CORTEX_M3 || idcode != 0x410) // only ch32f103
if ((t->cpuid & CPUID_PARTNO_MASK) != CORTEX_M3)
return false;
const uint32_t idcode = target_mem_read32(t, DBGMCU_IDCODE) & 0x00000fffU;
if (idcode != 0x410) // only ch32f103
return false;
// try to flock