Exemplo n.º 1
0
bool EraseFingerprint() {
  // First, read the fingerprint. Avoid a Flash cycle if already erased.
  BYTE fp[FINGERPRINT_SIZE];
  ReadFingerprintToBuffer(fp);
  if (IsFingerprintErased(fp)) return true;

  // We actually need to erase. Backup OscTun, erase, rewrite OscTun.
  BYTE tun = ReadOscTun();
  return FlashErasePage(BOOTLOADER_CONFIG_PAGE)
      && WriteOscTun(tun);
}
Exemplo n.º 2
0
/***    void justInTimeFlashErase(uint32 addrLow, uint32 addrHigh)
**
**    Synopsis:   
**      Erases all pages that have not been erased in the address range
**
**    Parameters:
**      addrLow:    low virtual address of where the page needs erased
**        addrHigh    1 + the last high byte to be erased.
**
**    Return Values:
**      None
**
**    Errors:
**      None
**
**  Notes:
**
**      The address do not need to be page aligned.
**
*/
static void JustInTimeFlashErase(uint32_t addrLow, uint32_t addrHigh)
{
    uint32_t addrCurPage    = StartOfFlashPage(addrLow);
    uint32_t addrLastPage   = NextFlashPage(addrHigh - 1);

    while(addrCurPage < addrLastPage)
    {
        // if this has never been erased, erase it.
        if(!WasPageErased(addrCurPage))
        {
            FlashErasePage(addrCurPage);
            SetPageAsErased(addrCurPage);
        }

        addrCurPage += BYTE_PAGE_SIZE;
    }
}
Exemplo n.º 3
0
int16_t G8_UpgradeErase(uint8_t* cmdData, uint16_t sizeOfCmdData, uint16_t start, uint16_t end) {
    int16_t status;
    
    uint32_t minAddress = G8_SpareMemStart();
    uint32_t maxAddress = G8_SpareMemEnd();
    
    if (start == 0 && end == 4) {
        uint32_t address = *(uint32_t*)cmdData;
        
        address &= ~(FLASH_PAGE_SIZE-1); //truncate down to page size
        
        if (address >= minAddress && address < maxAddress ) {
            status = FlashErasePage(address, FLASH_PASSWORD);
        } else {
            status =  G8_UPGRADE_ERRNO_FLASH_ADDRESS_OUT_OF_SPARE;
        }
    } else {
        status =  G8_UPGRADE_ERRNO_BAD_PARAM;
    }
    return status;
}
Exemplo n.º 4
0
bool EraseConfig() {
  return FlashErasePage(BOOTLOADER_CONFIG_PAGE);
}
Exemplo n.º 5
0
Arquivo: main.c Projeto: Aym3nTN/ioio
BOOL EraseFingerprint() {
  return FlashErasePage(BOOTLOADER_FINGERPRINT_PAGE);
}