//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void InitHostSystem(BYTE fPowerUpBoot) { BYTE ee_mode; //check EEPROM ee_mode = CheckEEPROM(); if(ee_mode==1) { //---------- if FW version is not matched, initialize EEPROM data ----------- InitHostWithNTSC(); DebugLevel = 3; #ifdef USE_SFLASH_EEPROM EE_Format(); EE_FindCurrInfo(); #endif InputMain = 0xff; // start with saved input InitializeEE(); //save all default EE values. DebugLevel = 0; SaveDebugLevelEE(DebugLevel); ee_mode = 0; } //read debug level DebugLevel = GetDebugLevelEE(); if((DebugLevel==0) && (fPowerUpBoot)) Printf("\n===> Debugging was OFF (%02bx)", DebugLevel); else ePrintf("\n===> Debugging is ON (%02bx)", DebugLevel); ePrintf("\nInitHostSystem(%bd)",fPowerUpBoot); //Init HW with default InitHostWithNTSC(); FP_Host_GpioDefault(); SSPLL_Host_PowerUp(ON); PrintSystemClockMsg("SSPLL_Host_PowerUp"); WriteHostPage(0); WriteHost(REG008, 0x89); //Output enable #if 0 //TODO: current method does not working. // try it with stable SSPLL code. See the ... //McuSpiClkSelect(MCUSPI_CLK_PCLK); WriteHostPage(PAGE4_CLOCK); WriteHost(REG4E1, 0x20 | (ReadHost(REG4E1) & 0x0F)); #endif //dump clock DumpClock(1); Printf("\nNow, enable the slave system...."); }
void SpiFlashHostDmaDestType(BYTE dest, BYTE access_mode) { BYTE dat; dat = ReadHost(REG4C3) & 0x0F; dat |= (dest << 6); dat |= (access_mode << 4); WriteHost(REG4C3, dat); }
//--------------------------------------------------------------------------- BOOL TConfDlg::LoadConfig(const AnsiString &File) { HANDLE file; DWORD type, fileversion; HostData *actData; char PlgName[30]="NONE",*N = PlgName; int i; bool ignoreContext=false; file = CreateFileA(File.c_str(),GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN,0); if(file == INVALID_HANDLE_VALUE) { Application->MessageBox("Cannot open file!","Error",MB_OK|MB_ICONERROR); return FALSE; } type = ReadType(file); if(type != MAGIC) { CloseHandle(file); Application->MessageBox("Invalid file format!", "Error",MB_OK|MB_ICONERROR); return FALSE; } fileversion = ReadType(file); if(fileversion != FILE_VERSION) { i = Application->MessageBox("Wrong file version! Try anyway?","Error",MB_YESNO|MB_ICONERROR); if (i == ID_NO) { CloseHandle(file); return FALSE; } } // This should not happen... while(SelectedBox->Items->Count) { RemoveSelHost(0,true); } for(i=0;i<LastList->Count;++i) { delete LastList->Objects[i]; LastList->Objects[i] = 0; } LastList->Clear(); actData = &GlobalConfig; FreeProcData(actData); SetHostAccount(actData,0); do { type = ReadType(file); switch(type) { case TYPE_CONFIG: ReadConfigData(file,actData,fileversion); if(ignoreContext) FreeContext(actData); break; case TYPE_ACCOUNT: ReadAccount(file,actData); break; case TYPE_ACCOUNT_ENCRYPTED: ReadAccountEncrypted(file,actData); break; case TYPE_HOST: actData = 0; ReadHost(file,&actData); if(actData) { CopyStateData(actData,(*Servers)[actData->Name]); LastList->AddObject(actData->Name,new CHostRef(actData)); } break; case TYPE_PLUGIN: ReadString(file,&N); if(!PluginManager.SetActualPlugin(PlgName)) ignoreContext = true; break; case TYPE_VERSION: case TYPE_GLOBAL: case TYPE_NONE: default: break; } } while(type != TYPE_NONE); CloseHandle(file); return TRUE; }
void SpiFlashHostSetCmdLength(BYTE len) { WriteHost(REG4C3, (ReadHost(REG4C3) & 0xF0) | len); }