Exemplo n.º 1
0
void test_i2c_init()
{
    i2cConfig.i2cAddressMode = I2C_ADDRESS_MODE_7_BIT;
    i2cConfig.i2cClockMode = I2C_SCK_100KHZ;
    i2cConfig.i2cModule = I2C1_MODULE;
    TEST_ASSERT_TRUE(ERR_NONE == i2cInitialize(4000000ULL, &i2cConfig, &i2cConfigReal));
}
Exemplo n.º 2
0
void test_i2c_speed()
{
    i2cConfig.i2cAddressMode = I2C_ADDRESS_MODE_7_BIT;
    i2cConfig.i2cClockMode = I2C_SCK_100KHZ;
    i2cConfig.i2cModule = I2C1_MODULE;

    i2cInitialize(4000000ULL, &i2cConfig, &i2cConfigReal);
    u32 actualSpeed = 4000000ULL/(I2C1BRG + 1 + (4000000ULL/10000000));
    if(actualSpeed != 100000)
        printf("%ld instead of %ld\n",actualSpeed,100000);
    TEST_ASSERT_FLOAT_WITHIN(0.2,1.0,100000/actualSpeed);
}
Exemplo n.º 3
0
HRESULT mainInitialize(void)
{
	HRESULT		hResult = NO_ERROR;
    
#ifdef _CLI
	hResult = cliSIOInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_CLI

#if 1 //LM???
	//Setting WWUID for this device
	lalSetWWUID(DEFAULT_DEVICE_ID_HIGH, DEFAULT_DEVICE_ID_LOW);
#endif

#ifdef _SYSDEBUG
	//sysDebugSetEnabled(SYSDEBUG_TRACE_SPS | SYSDEBUG_TRACE_FIS);
#endif //_SYSDEBUG

	TCTaskingInitialize(); // Init kernel

	hResult = mainInitializeTasks();
	if (hResult != NO_ERROR) return hResult;

#ifdef _FIS
	{
		fisInitialize();  //Initialize fis early to be able to get environment settings
		hResult = envInitialize("setup"); //Initialize environment, assume settings image named "setup"
		if (hResult != NO_ERROR)
		{
			sysDebugPrintf("Could not initialize environment - will use default values\n");      
		}
		envGetEenvironmentLongDefault	("SERIAL_NO", &serialNo, MAX_PRODUCT_SERIAL);
		lalSetWWUID (GET_WWUID_HIGH, GET_WWUID_LOW(serialNo));
		//ML:171106, per default JET uses PHY clock due to ADAT pulse width on DICE JR/Mini.
		//envGetEenvironmentLongDefault	("HPLL_CLK", &hpllClk, HPLL_CLK_HZ);
		//hpllSetClock(hpllClk);
	}
#endif //_FIS
	
#ifdef _CLI
	hResult = cliInitialize();
	if (hResult != NO_ERROR) return hResult;

	hResult = cliBuiltInToolSetSplashCB(SplashCB);
	if (hResult != NO_ERROR) return hResult;

	hResult = cliBuiltInToolSetResetCB(StartBoot);
	if (hResult != NO_ERROR) return hResult;
	
#ifdef _FIS
	hResult = envCliInstallTools();
	if (hResult != NO_ERROR) return hResult;
#endif //_FIS
#endif //_CLI

#ifdef _1394CORE
	hResult = lalInitialize1394();			// create the basic 1394 protocol (lal layer and below)
	if (hResult != NO_ERROR) return hResult;
#endif //_1394CORE

#ifdef _AVS
	hResult = avsInitialize();
	if (hResult != NO_ERROR) return hResult;

//#ifdef _CLI
//	hResult = avsTestCliInstallTools();
//	if (hResult != NO_ERROR) return hResult;
//#endif // _CLI

#endif //_AVS

#ifdef _CRB
	crbInitialize();
#endif

#ifdef _IRM
	hResult = irmInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_IRM

#ifdef _CMP
	hResult = cmpInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_CMP

#ifdef _FCP
	hResult = fcpInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_FCP

#ifdef _AVC
	hResult = avcInitialize();
	if (hResult != NO_ERROR) return hResult;
#if 1 //LM???
	hResult = avcPanelInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif
#endif //_AVC

#ifdef _EDS
	hResult = edsInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_EDS

#ifdef _DRD
	hResult = drdInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_DRD

#if defined (_AVC) && defined (_EDS) && defined (_DRD)
	hResult = avcAudioInitialize();
	if (hResult != NO_ERROR) return hResult;

	hResult = avcMusicInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_AVC &&  _EDS && _DRD

#ifdef _DTCP
	hResult = dtcpInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_DTCP

#ifdef _PIONEERDVD
	hResult = pioneerDVDInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_PIONEERDVD

#ifdef _REMOTEDVD
	hResult = remoteDVDInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_REMOTEDVD

#ifdef _CLI_CB
	// How do we get rid of this, ML????
	hResult = cliCBInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_CLI

#ifdef _MLAN
	hResult = mLANInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_MLAN

#ifdef _DICE_DRIVER
	hResult = diceDriverInitialize();
	if (hResult != NO_ERROR) return hResult;	
#endif //_DICE_DRIVER

#if defined (_AVC) && defined (_EDS) && defined (_DRD)
	hResult = avcDriverInitialize();
	if (hResult != NO_ERROR) return hResult;	
#endif // (_AVC) && defined (_EDS) && defined (_DRD)

#ifdef _FRMWLOAD
	hResult = frmwLoadInitialize();
	if (hResult != NO_ERROR) return hResult;	
	frmwLoadSetResetCB(StartBoot);
	if (hResult != NO_ERROR) return hResult;	
#endif //_FRMWLOAD

#ifdef _DALREMOTE
	hResult = RDALInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_DALREMOTE

#ifdef _DICEJR
	hResult = diceInitialize();
	if (hResult != NO_ERROR) return hResult;
	hResult = dalInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_DICE2

#ifdef _MEMTEST
	hResult = memTestInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_MEMTEST

#ifdef _DSP
#ifdef _CLI
	hResult = dspCliInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif // _CLI
#endif //_DSP

#ifdef _GRAY
//	hResult = grayInitialize();	//LM??? grayInitialize called from cli command
#ifdef _CLI
	hResult = grayCliInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif // _CLI
#endif //_GRAY

#ifdef _CLI
	hResult = TCKernelCliInitialize();
	if (hResult != NO_ERROR) return hResult;
#endif //_CLI

#ifdef _I2C
	i2cInitialize();
#endif //I2C


#ifdef _DICE_TIMER2
	diceTimer2Initialize();
#endif //_DICE_TIMER2

#ifdef _AML
	amlInitialize();
#endif //_DICE_TIMER2

#ifdef _SPI
	spiInitialize();
#endif

	hResult = myAppInitialize();
	if (hResult != NO_ERROR) return hResult;

	TCTaskingStart();

	return hResult;
}