/* This function does not return until the protection has been saved. */
long FlashProtectSave(void)
/* This function does not return until the protection has been saved. */
long FlashProtectSave(void)
{
    unsigned long ulTemp, ulLimit;
    ulLimit = CLASS_IS_SANDSTORM ? 2 : 8;
    for(ulTemp = 0; ulTemp < ulLimit; ulTemp++)
    {
        HWREG(FLASH_FMA) = ulTemp;
        HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_COMT;
        while(HWREG(FLASH_FMC) & FLASH_FMC_COMT)
        {
        }
    }
    return(0);
}