Whitespace.
This commit is contained in:
parent
1366c32f89
commit
5c337c9aa7
22
src/samd.c
22
src/samd.c
|
@ -489,7 +489,7 @@ static int samd_flash_erase(struct target_s *target, uint32_t addr, size_t len)
|
||||||
SAMD_CTRLA_CMD_KEY | SAMD_CTRLA_CMD_ERASEROW);
|
SAMD_CTRLA_CMD_KEY | SAMD_CTRLA_CMD_ERASEROW);
|
||||||
/* Poll for NVM Ready */
|
/* Poll for NVM Ready */
|
||||||
while ((target_mem_read32(target, SAMD_NVMC_INTFLAG) & SAMD_NVMC_READY) == 0)
|
while ((target_mem_read32(target, SAMD_NVMC_INTFLAG) & SAMD_NVMC_READY) == 0)
|
||||||
if(target_check_error(target))
|
if (target_check_error(target))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Lock */
|
/* Lock */
|
||||||
|
@ -549,7 +549,7 @@ static int samd_flash_write(struct target_s *target, uint32_t dest,
|
||||||
|
|
||||||
/* Poll for NVM Ready */
|
/* Poll for NVM Ready */
|
||||||
while ((target_mem_read32(target, SAMD_NVMC_INTFLAG) & SAMD_NVMC_READY) == 0)
|
while ((target_mem_read32(target, SAMD_NVMC_INTFLAG) & SAMD_NVMC_READY) == 0)
|
||||||
if(target_check_error(target))
|
if (target_check_error(target))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Lock */
|
/* Lock */
|
||||||
|
@ -566,7 +566,8 @@ static bool samd_cmd_erase_all(target *t)
|
||||||
{
|
{
|
||||||
/* Clear the DSU status bits */
|
/* Clear the DSU status bits */
|
||||||
target_mem_write32(t, SAMD_DSU_CTRLSTAT,
|
target_mem_write32(t, SAMD_DSU_CTRLSTAT,
|
||||||
(SAMD_STATUSA_DONE | SAMD_STATUSA_PERR | SAMD_STATUSA_FAIL));
|
SAMD_STATUSA_DONE | SAMD_STATUSA_PERR |
|
||||||
|
SAMD_STATUSA_FAIL);
|
||||||
|
|
||||||
/* Erase all */
|
/* Erase all */
|
||||||
target_mem_write32(t, SAMD_DSU_CTRLSTAT, SAMD_CTRL_CHIP_ERASE);
|
target_mem_write32(t, SAMD_DSU_CTRLSTAT, SAMD_CTRL_CHIP_ERASE);
|
||||||
|
@ -575,7 +576,7 @@ static bool samd_cmd_erase_all(target *t)
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
while (((status = target_mem_read32(t, SAMD_DSU_CTRLSTAT)) &
|
while (((status = target_mem_read32(t, SAMD_DSU_CTRLSTAT)) &
|
||||||
(SAMD_STATUSA_DONE | SAMD_STATUSA_PERR | SAMD_STATUSA_FAIL)) == 0)
|
(SAMD_STATUSA_DONE | SAMD_STATUSA_PERR | SAMD_STATUSA_FAIL)) == 0)
|
||||||
if(target_check_error(t))
|
if (target_check_error(t))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Test the protection error bit in Status A */
|
/* Test the protection error bit in Status A */
|
||||||
|
@ -617,7 +618,7 @@ static bool samd_set_flashlock(target *t, uint16_t value)
|
||||||
|
|
||||||
/* Poll for NVM Ready */
|
/* Poll for NVM Ready */
|
||||||
while ((target_mem_read32(t, SAMD_NVMC_INTFLAG) & SAMD_NVMC_READY) == 0)
|
while ((target_mem_read32(t, SAMD_NVMC_INTFLAG) & SAMD_NVMC_READY) == 0)
|
||||||
if(target_check_error(t))
|
if (target_check_error(t))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Modify the high byte of the user row */
|
/* Modify the high byte of the user row */
|
||||||
|
@ -633,14 +634,17 @@ static bool samd_set_flashlock(target *t, uint16_t value)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool samd_cmd_lock_flash(target *t)
|
static bool samd_cmd_lock_flash(target *t)
|
||||||
{
|
{
|
||||||
return samd_set_flashlock(t, 0x0000);
|
return samd_set_flashlock(t, 0x0000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool samd_cmd_unlock_flash(target *t)
|
static bool samd_cmd_unlock_flash(target *t)
|
||||||
{
|
{
|
||||||
return samd_set_flashlock(t, 0xFFFF);
|
return samd_set_flashlock(t, 0xFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool samd_cmd_read_userrow(target *t)
|
static bool samd_cmd_read_userrow(target *t)
|
||||||
{
|
{
|
||||||
gdb_outf("User Row: 0x%08x%08x\n",
|
gdb_outf("User Row: 0x%08x%08x\n",
|
||||||
|
@ -649,6 +653,7 @@ static bool samd_cmd_read_userrow(target *t)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the 128-bit serial number from the NVM
|
* Reads the 128-bit serial number from the NVM
|
||||||
*/
|
*/
|
||||||
|
@ -664,6 +669,7 @@ static bool samd_cmd_serial(target *t)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the size (in bytes) of the current SAM D20's flash memory.
|
* Returns the size (in bytes) of the current SAM D20's flash memory.
|
||||||
*/
|
*/
|
||||||
|
@ -678,6 +684,7 @@ static uint32_t samd_flash_size(target *t)
|
||||||
/* Shift the maximum flash size (256KB) down as appropriate */
|
/* Shift the maximum flash size (256KB) down as appropriate */
|
||||||
return (0x40000 >> (devsel % 5));
|
return (0x40000 >> (devsel % 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the Memory Built In Self Test (MBIST)
|
* Runs the Memory Built In Self Test (MBIST)
|
||||||
*/
|
*/
|
||||||
|
@ -697,7 +704,7 @@ static bool samd_cmd_mbist(target *t)
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
while (((status = target_mem_read32(t, SAMD_DSU_CTRLSTAT)) &
|
while (((status = target_mem_read32(t, SAMD_DSU_CTRLSTAT)) &
|
||||||
(SAMD_STATUSA_DONE | SAMD_STATUSA_PERR | SAMD_STATUSA_FAIL)) == 0)
|
(SAMD_STATUSA_DONE | SAMD_STATUSA_PERR | SAMD_STATUSA_FAIL)) == 0)
|
||||||
if(target_check_error(t))
|
if (target_check_error(t))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Test the protection error bit in Status A */
|
/* Test the protection error bit in Status A */
|
||||||
|
@ -727,7 +734,7 @@ static bool samd_cmd_ssb(target *t)
|
||||||
|
|
||||||
/* Poll for NVM Ready */
|
/* Poll for NVM Ready */
|
||||||
while ((target_mem_read32(t, SAMD_NVMC_INTFLAG) & SAMD_NVMC_READY) == 0)
|
while ((target_mem_read32(t, SAMD_NVMC_INTFLAG) & SAMD_NVMC_READY) == 0)
|
||||||
if(target_check_error(t))
|
if (target_check_error(t))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
gdb_outf("Set the security bit! "
|
gdb_outf("Set the security bit! "
|
||||||
|
@ -735,3 +742,4 @@ static bool samd_cmd_ssb(target *t)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue