Ejemplo n.º 1
0
/*
** Action for menu timer icon click
*/
static void ActionMenuTimer(void)
{
    pmFlag = FALSE;
    sdCardAccessFlag = FALSE;
    rtcSetFlag = FALSE;
    tmrClick = TRUE;
    tmrFlag  = FALSE;
    Timer2Start();
    pageIndex = MENU_IDX_TIMER;
    UpdateUartConsoleHelp();
}
Ejemplo n.º 2
0
/**
  Function Name	: Wave_Start_Playing
  Engineer      : Gustavo Denardin
  Date          : 16/06/2011
  
  Parameters	: Nothing
  Returns       : Nothing
  Notes         : 
*/
void Wave_Start_Playing(void)
{
	WAVE_BUFFER *WaveInfo;
	INT8U		*Buff8;
	INT16S		*Buff16;
	INT16U		size = 0;
	INT8U		first = 0;
	
	//_DAC1_Enable();
	//Sound_AudioAmplifierTurnOn();	//Turn On the Audio Amplifier
	
	OSSemPost(OpenWave);	
	
	for(;;)
	{
    	(void)OSMboxPend(SendWaveBuffer,(void **)&WaveInfo,0);
  	
    	
	#if (_VOLUME_CONTROL == 1)
    	if(SetVolumeLevel == 0)	//Mute
    	{
    		//Sound_AudioAmplifierStandby();				//Standby the Audio Amplifier
    	}
    	else
    	{
    		//Sound_AudioAmplifierTurnOn();				//Turn On the Audio Amplifier
    		//Sound_VolumeControl((INT8U)SetVolumeLevel);	//Set Volume level
    	}
	#endif
    	
    	
    	if (first == 0)
    	{
    		first = 1;
    		
    		//Set sample rate: (8kHz, 11.025kHz, 44.1kHz or 48khz)
    		Wave_SetSampleRate(WaveInfo->SampleRate);

    		//Enable timer
    		Timer2Start();
    	}
    	
    	if ((WaveInfo->Size) == 0)
    	{
    		break;
    	}
    	size = WaveInfo->Size;

    	
    	if (WaveInfo->BitRate == 16)
    	{
    		Buff16 = (INT16S*)WaveInfo->Buff;
    	}
    	
    	else if (WaveInfo->BitRate == 8)
		{
			Buff8 = (INT8U*)WaveInfo->Buff;
		} 
    	   		
    	do
    	{
			OSSemPend(Audio,0);

			if (WaveInfo->BitRate == 16)
			{
				if (vol > 0)
				{
					DAConvert(((ByteSwap(*Buff16)) >> (4 + (10 - vol))) + 2048);
				}else
				{
					DAConvert(0);
				}
				Buff16++;
				if((WaveInfo->NumChannels) == 2)
				{
					Buff16++;	//Pula o  pacote do outro canal
					size--;
				}
			}
			
			else if (WaveInfo->BitRate == 8)
Ejemplo n.º 3
0
//*****************************************************************************
//
// The main code for the application.  It sets up the peripherals, displays the
// splash screens, and then manages the interaction between the game and the
// screen saver.
//
//*****************************************************************************
int
main(void)
{
	tRectangle sRect;
#ifndef _TMS320C6X
    unsigned int index;
#endif
	
    SetupIntc();

	
	/* Configuring UART2 instance for serial communication. */
    UARTStdioInit();

#ifdef _TMS320C6X
    CacheEnableMAR((unsigned int)0xC0000000, (unsigned int)0x20000000);
    CacheEnable(L1PCFG_L1PMODE_32K | L1DCFG_L1DMODE_32K | L2CFG_L2MODE_256K);
#else
    /* Sets up 'Level 1" page table entries. 
     * The page table entry consists of the base address of the page
     * and the attributes for the page. The following operation is to
     * setup one-to-one mapping page table for DDR memeory range and set
     * the atributes for the same. The DDR memory range is from 0xC0000000
     * to 0xDFFFFFFF. Thus the base of the page table ranges from 0xC00 to 
     * 0xDFF. Cache(C bit) and Write Buffer(B bit) are enabled  only for
     * those page table entries which maps to DDR RAM and internal RAM.
     * All the pages in the DDR range are provided with R/W permissions
     */
    for(index = 0; index < (4*1024); index++)
    {
         if((index >= 0xC00 && index < 0xE00)|| (index == 0x800))
         {             
              pageTable[index] = (index << 20) | 0x00000C1E;
         }
         else
         {
              pageTable[index] = (index << 20) | 0x00000C12;
         }
    }
     
    /* Configures translation table base register
     * with pagetable base address.
     */
    CP15TtbSet((unsigned int )pageTable);

    /* Enables MMU */
    CP15MMUEnable();
   
	/* Enable Instruction Cache */
    CP15ICacheEnable();

    /* Enable Data Cache */
    CP15DCacheEnable();
#endif

    SetUpLCD();
	
	ConfigureFrameBuffer();
		
	GrOffScreen16BPPInit(&g_sSHARP480x272x16Display0, (unsigned char *)g_pucBuffer0, LCD_WIDTH, LCD_HEIGHT);
	GrOffScreen16BPPInit(&g_sSHARP480x272x16Display1, (unsigned char *)g_pucBuffer1, LCD_WIDTH, LCD_HEIGHT);
	
	// Initialize a drawing context.
	GrContextInit(&sContext0, &g_sSHARP480x272x16Display0);
	GrContextInit(&sContext1, &g_sSHARP480x272x16Display1);

    /* enable End of frame interrupt */
    RasterEndOfFrameIntEnable(SOC_LCDC_0_REGS);

    /* enable raster */
    RasterEnable(SOC_LCDC_0_REGS);

	PeripheralsSetup();
	I2C0IntRegister(4);
    AIC31Init();
    ToneLoopInit();
	/* Start playing the tone */
    ToneLoopStart();
	
    // TS init	
	TouchInit();
	
	GrContextForegroundSet(&sContext0, ClrBlack);
	GrContextForegroundSet(&sContext1, ClrBlack);
    sRect.sXMin = GAME_X - 1;
    sRect.sYMin = GAME_Y - 1;
    sRect.sXMax = GAME_X + GAME_W;
    sRect.sYMax = GAME_Y + GAME_H;
    GrRectFill(&sContext0, &sRect);
    GrRectFill(&sContext1, &sRect);

    GrImageDraw(&sContext0, g_pucTILogo128x96, GAME_X, GAME_Y);
	GrImageDraw(&sContext1, g_pucTILogo128x96, GAME_X, GAME_Y);
	
	Delay(0x5FFFFF);
	
	// Confiure and start timer2
	Timer2Config();
	Timer2Start();

    // Loop forever.
    while(1)
    {
        // Display the main screen.
        if(MainScreen())
        {
            // The button was pressed, so start the game.
            PlayGame();
        }
        else
        {
            // The button was not pressed during the timeout period, so start
            // the screen saver.
            ScreenSaver();
        }
    }
}