/* This function will not return until the block has been erased. */
long FlashClear(unsigned long ulAddress)
/* This function will not return until the block has been erased. */
long FlashClear(unsigned long ulAddress)
{
    ASSERT(!(ulAddress & (FLASH_ERASE_SIZE - 1)));
    HWREG(FLASH_FCMISC) = FLASH_FCMISC_AMISC;
    HWREG(FLASH_FMA) = ulAddress;
    HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_ERASE;
    while(HWREG(FLASH_FMC) & FLASH_FMC_ERASE)
    {
    }
    if(HWREG(FLASH_FCRIS) & FLASH_FCRIS_ARIS)
    {
        return(-1);
    }
    return(0);
}