/* Determines the index into the flashLayout array of the flash sector that the specified address is in.  */
static blt_int8u FlashGetSectorIdx(blt_addr address)
/* Determines the index into the flashLayout array of the flash sector that the specified address is in.  */
static blt_int8u FlashGetSectorIdx(blt_addr address)
{
  blt_int8u result = FLASH_INVALID_SECTOR_IDX;
  blt_int8u sectorIdx;
  for (sectorIdx = 0; sectorIdx < FLASH_TOTAL_SECTORS; sectorIdx++)
  {
    CopService();
    if ((address >= flashLayout[sectorIdx].sector_start) && \
        (address < (flashLayout[sectorIdx].sector_start + \
                    flashLayout[sectorIdx].sector_size)))
    {
      result = sectorIdx;
      break;
    }
  }
  return result;
}