Exemplo n.º 1
0
//------------------------------------------------------------------------------
//
//  Function:   OALCPUIdle
//
//  This Idle function implements a busy idle. It is intend to be used only
//  in development (when CPU doesn't support idle mode it is better to stub
//  OEMIdle function instead use this busy loop). The busy wait is cleared by
//  an interrupt from interrupt handler setting the g_oalLastSysIntr.
//
//
VOID OALCPUIdle()
{

#if (BSP_TYPE == BSP_SMDK2443)
    volatile S3C2450_CLKPWR_REG *s2450CLKPWR = (S3C2450_CLKPWR_REG *)OALPAtoVA(S3C2450_BASE_REG_PA_CLOCK_POWER, FALSE);
    volatile S3C2450_INTR_REG *s2450INTR = (S3C2450_INTR_REG *)OALPAtoVA(S3C2450_BASE_REG_PA_INTR, FALSE);
    volatile S3C2450_IOPORT_REG *s2450IOPORT = (S3C2450_IOPORT_REG *)OALPAtoVA(S3C2450_BASE_REG_PA_IOPORT, FALSE);

	UINT32 sysIntr;
  

	s2450IOPORT->GPFDAT |= ( 1<< 5);    // GPF5 output data, turn LED on
	s2450CLKPWR->PWRMODE |=  (1 << 17);
	
	MMU_WaitForInterrupt();


	s2450CLKPWR->PWRMODE &=  ~(1 << 17);
	s2450IOPORT->GPFDAT &= ~(1 << 5);    // GPF5 output data, turn LED off
	if(g_pIntrRegs->SRCPND & (1<< IRQ_TIMER4))
		sysIntr = OALTimerIntrHandler();

#elif (BSP_TYPE == BSP_SMDK2450)
#ifndef DVS_EN

//[david.modify] 2008-09-06 19:01
//GPC0 在开发板上用做LED灯指示
//但在我们4.3INCH PND的项目上用做了LCD_ON信号给LCD供电
// 一定要为高

#if 0
	g_pPortRegs->GPCCON &= ~(3<< 0);
	g_pPortRegs->GPCCON |= ( 1<< 0);    
	g_pPortRegs->GPCDAT |= ( 1<< 0);    
#endif
	
#endif
	g_pClkpwrRegs->PWRCFG |= (0x1<<17);  
	g_pClkpwrRegs->PWRCFG &=~(0x3<<5);

	MMU_WaitForInterrupt();

	g_pClkpwrRegs->PWRCFG &= ~(0x1<<17);  
	
	if((g_pIntrRegs->SRCPND1 & (1<<IRQFORTIMER)) != 0)
	{
		OALTimerIntrHandler();		
	}
#ifndef DVS_EN	

#if 0
	g_pPortRegs->GPCDAT &= ~(1 << 0);   
#endif


#endif
#endif
}
Exemplo n.º 2
0
void Test_MMUIdleMode(void)
{
    int i;
//    int extintMode;

    MMU_SetAsyncBusMode(); //ARM920T should be in the async. Bus mode.

    Uart_Printf("[MMU IDLE Mode Test]\n");
    Uart_Printf("This routine tests MMU registser7:Wait for interrupt function.\n");
    Uart_Printf("After 10 seconds, S3C2440 will wake up by RTC alarm interrupt.\n");
    Uart_Printf("S3C2440 will also wake up by EINT0.\n");
    Uart_TxEmpty(1);    //Wait until UART0 Tx buffer empty.

    rGPFCON=rGPFCON & ~(3<<0)|(2<<0); //PF0=EINT0
    rEXTINT0=rEXTINT0&(7<<0)|(0x2<<0); //EINT0=falling edge triggered
    
    pISR_EINT0=(U32)Eint0Int;
    pISR_RTC=(U32)AlarmInt;

    rSRCPND = BIT_EINT0|BIT_RTC; //to clear the previous pending states
    rINTPND = BIT_EINT0|BIT_RTC;
    
    rINTMSK=~(BIT_EINT0|BIT_RTC);
    //rINTMSK=~(BIT_RTC);
    //rINTMSK=BIT_ALLMSK;

    SetAlarmWakeUp();
    rRTCCON = 0x0;	// R/W disable, but interrupt will be generated.

    MMU_WaitForInterrupt();
     
    //wait until S3C2400X enters IDLE mode.	
    //wait EINT0 interrupt or RTC alarm interrupt
    for(i=0;i<10;i++);   

    Uart_Printf("Return to Normal Mode.\n");

    rINTMSK=BIT_ALLMSK;
}