/* This function does not return until the block has been erased. */
int32_t FlashErase(uint32_t ui32Address)
/* This function does not return until the block has been erased. */
int32_t FlashErase(uint32_t ui32Address)
{
    ASSERT(!(ui32Address & (FLASH_ERASE_SIZE - 1)));
    HWREG(FLASH_FCMISC) = (FLASH_FCMISC_AMISC | FLASH_FCMISC_VOLTMISC |
                           FLASH_FCMISC_ERMISC);
    HWREG(FLASH_FMA) = ui32Address;
    HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_ERASE;
    while (HWREG(FLASH_FMC) & FLASH_FMC_ERASE)
    {
    }
    if (HWREG(FLASH_FCRIS) & (FLASH_FCRIS_ARIS | FLASH_FCRIS_VOLTRIS |
                              FLASH_FCRIS_ERRIS))
    {
        return (-1);
    }
    return (0);
}