OSStatus internalFlashErase(uint32_t StartAddress, uint32_t EndAddress) { platform_log_trace(); OSStatus err = kNoErr; uint32_t StartSector, EndSector, i = 0, j = 0; /* Get the sector where start the user flash area */ StartSector = _GetSector(StartAddress); EndSector = _GetSector(EndAddress); for(i = StartSector; i <= EndSector; i += 8) { /* Device voltage range supposed to be [2.7V to 3.6V], the operation will be done by word */ _GetAddress(i, &StartAddress, &EndAddress); for(j=StartAddress; j<=EndAddress; j+=8){ if( (*(uint32_t *)(j))!=0xFFFFFFFF ) break; } if( j>EndAddress ) continue; require_action(FLASH_EraseSector(i, VoltageRange_3) == FLASH_COMPLETE, exit, err = kWriteErr); } exit: return err; }
void P2PUserInfo::GetLocation(std::wstring &location) { if(user_offline == state) { location = L"离线"; return; } else { pAddr myAddr = _GetAddress(ip.c_str()); if(myAddr) { location = V6Util::AnsiToUnicode(myAddr->Country) + V6Util::AnsiToUnicode(myAddr->Local); } else location = L"离线"; } }