/* Execute FMC_ISPCMD_BLOCK_ERASE command to erase a flash block. The block size is 4 pages.  */
int32_t FMC_Erase_Block(uint32_t u32BlockAddr)
/* Execute FMC_ISPCMD_BLOCK_ERASE command to erase a flash block. The block size is 4 pages.  */
int32_t FMC_Erase_Block(uint32_t u32BlockAddr)
{
    int32_t  ret = 0;
    FMC->ISPCMD = FMC_ISPCMD_BLOCK_ERASE;
    FMC->ISPADDR = u32BlockAddr;
    FMC->ISPTRG = FMC_ISPTRG_ISPGO_Msk;
    while (FMC->ISPTRG & FMC_ISPTRG_ISPGO_Msk) { }
    if (FMC->ISPCTL & FMC_ISPCTL_ISPFF_Msk)
    {
        FMC->ISPCTL |= FMC_ISPCTL_ISPFF_Msk;
        ret = -1;
    }
    return ret;
}