/* Checks if the flash sector is already completely erased.  */
static blt_bool FlashEmptyCheckSector(blt_int8u sector_idx)
/* Checks if the flash sector is already completely erased.  */
static blt_bool FlashEmptyCheckSector(blt_int8u sector_idx)
{
  blt_bool   result = BLT_TRUE;
  blt_addr   sectorAddr;
  blt_int32u sectorSize;
  blt_int32u wordCnt;
  blt_int32u volatile const * wordPtr;
  sectorAddr = flashLayout[sector_idx].sector_start;
  sectorSize = flashLayout[sector_idx].sector_size;
  ASSERT_RT(((sectorAddr % sizeof(blt_int32u)) == 0) &&
            ((sectorSize % sizeof(blt_int32u)) == 0));
  wordPtr = (blt_int32u volatile const *)sectorAddr;
  for (wordCnt = 0; wordCnt < (sectorSize/sizeof(blt_int32u)); wordCnt++)
  {
    if ((wordCnt % 256) == 0)
    {
      CopService();
    }
    if (*wordPtr != 0xFFFFFFFFu)
    {
      result = BLT_FALSE;
      break;
    }
    wordPtr++;
  }
  return result;
}