Beispiel #1
0
void InitHostCore(BYTE fPowerUpBoot)
{
	if(fPowerUpBoot) {
		//check port 1.5. if high, it is a skip(NoInit) mode.
		SysNoInitMode = SYS_MODE_NORMAL;
#ifdef MODEL_TW8836FPGA
		if(1)	
#else
		if(PORT_NOINIT_MODE == 1)	
#endif
		{
			SysNoInitMode = SYS_MODE_NOINIT;
			//turn on the SKIP_MODE.
			access = 0;
					
			McuSpiClkSelect(MCUSPI_CLK_27M);
			return;
		}
	}

	Puts("\nInitHostCore");	
	//----- Set SPI mode
	SpiFlashVendor = SPIHost_QUADInit();
	SPIHost_SetReadModeByRegister(SPI_READ_MODE);		// Match DMA READ mode with SPI-read

	//----- Enable Chip Interrupt

	WriteHostPage(PAGE0_GENERAL );
	WriteHost(REG002, 0xFF );	// Clear Pending Interrupts
	WriteHost(REG003, 0xFE );	// enable SW. disable all other interrupts

	//enable remocon interrupt.
	EnableRemoInt();
}
Beispiel #2
0
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
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....");
}
Beispiel #3
0
void SpiFlashHostDmaDestType(BYTE dest, BYTE access_mode)
{
	BYTE dat;
	dat = ReadHost(REG4C3) & 0x0F;
	dat |= (dest << 6);
	dat |= (access_mode << 4);
	WriteHost(REG4C3, dat);
}
Beispiel #4
0
void SpiFlashHostDmaStart(BYTE fWrite, BYTE fBusy)
{
	BYTE dat;
  
	dat = 0x01;					//start
	if(fWrite) 	dat |= 0x02;	//write
	if(fBusy)	dat |= 0x04;	//busy
	WriteHost(REG4C4, dat);
}
Beispiel #5
0
void TConfDlg::SaveConfig(const AnsiString &File) {

	HANDLE file;
    DWORD type,Written;
    int i;
    CHostRef *host;
    AnsiString FailedName="NONE";
    file = CreateFileA(File.c_str(),GENERIC_WRITE,0,0,CREATE_ALWAYS,
                     FILE_FLAG_SEQUENTIAL_SCAN,0);
    if(file == INVALID_HANDLE_VALUE) {
  	    Application->MessageBox("Cannot create file!","Error",MB_OK|MB_ICONERROR);
	    return;
    }

    // Remove the configuration from hosts
    // That do not have an individual configuration
    for(i =0;i<LastList->Count;++i) {
    	host = (CHostRef*)(LastList->Objects[i]);
        if(host) host->RemoveConfigRefs();
    }

    FailedName="MAGIC";
    type = MAGIC;
    if(!WriteFile(file,&type,sizeof(DWORD),&Written,0)) goto Remove;
    FailedName="FILE_VERSION";
    type = FILE_VERSION;
    if(!WriteFile(file,&type,sizeof(DWORD),&Written,0))  goto Remove;
    FailedName="Plugin";
    if(!WritePlugin(file,PluginManager.GetActualPlugin())) goto Remove;
    FailedName = "WriteConfigData";
    if(!WriteConfigData(file,&GlobalConfig)) goto Remove;
    FailedName="WriteHost";
	for(i=0;i<LastList->Count;++i) {
    	if(!WriteHost(file,(HostData*)*(CHostRef*)LastList->Objects[i]))
        	goto Remove;
    }
    //SI: 13.06.05 Write Account at last position
    //SI: 14.06.05 save without Write Account possible
    FailedName="WriteAccount";
    //if(!WriteAccount(file,&GlobalConfig)) goto Remove;
    if(!WriteAccount(file,&GlobalConfig))
      Application->MessageBox("Could not save account information in config!","Error",MB_ICONERROR|MB_OK);;

    type = TYPE_NONE;
    WriteFile(file,&type,sizeof(DWORD),&Written,0);
   	CloseHandle(file);

    for(i=0;i<LastList->Count;++i)  {
    	host=(CHostRef*)LastList->Objects[i];
        // If the host has no individual configuration then
        // set a reference to the global config.
        host->SetConfigRef(&GlobalConfig);
    }
    return;
Remove:
	CloseHandle(file);
    DeleteFileA(File.c_str());
    FailedName = FailedName + " failed. Could not save config!";
    Application->MessageBox(FailedName.c_str(),"Error",MB_ICONERROR|MB_OK);
	return;
}
Beispiel #6
0
void SpiFlashHostSetCmdLength(BYTE len)
{
	WriteHost(REG4C3, (ReadHost(REG4C3) & 0xF0) | len);
}