📄 intr.c
字号:
if (IntPendVal <= IRQ_ADC) {
// Use interrupt mask register
mask = 1<<IntPendVal;
OUTREG32(&g_pIntrRegs->SRCPND, mask);
CLRREG32(&g_pIntrRegs->INTMSK, mask);
/*if(IntPendVal==IRQ_ADC)
{
g_pIntrRegs->SRCPND = (BIT_ADC);
g_pIntrRegs->INTMSK &= ~(BIT_ADC);
g_pIntrRegs->INTSUBMSK &= ~(BIT_SUB_TC);
RETAILMSG(DBG_ON,(TEXT("OEMInterruptDone:TOUCH \n\r\n")));
}
else*/ if(IntPendVal <= IRQ_EINT3)
{
g_pPortRegs->EINTPEND |= (1<<IntPendVal); // for clear EINTMASK, EINTPEND
g_pPortRegs->EINTMASK &= ~(1<<IntPendVal); // for clear EINTMASK, EINTPEND
}
else if(IntPendVal==IRQ_EINT1)
{
// org
// OUTREG32(&g_pPortRegs->EINTPEND, BIT_EINT1);
// CLRREG32(&g_pPortRegs->EINTMASK, BIT_EINT1);
g_pPortRegs->EINTPEND |= (BIT_EINT1);
g_pPortRegs->EINTMASK &= ~( BIT_EINT1);
g_pIntrRegs->SRCPND = (BIT_EINT1);
g_pIntrRegs->INTMSK &= ~(BIT_EINT1);
RETAILMSG(0,(TEXT("OEMInterruptDone:EINT1 \r\n")));
//RETAILMSG(DBG_ON,(TEXT("OEMInterruptDone:EINT1 \r\n")));
RETAILMSG(0, (TEXT("OALIntrDoneIrqs !! SRCPND : %x, INTMSK : %x, EINTPEND : %x, EINTMASK : %x\r\n"),
g_pIntrRegs->SRCPND, g_pIntrRegs->INTMSK, g_pPortRegs->EINTPEND, g_pPortRegs->EINTMASK));
}
}
else if (IntPendVal <= IRQ_EINT23) {
// Use external mask register
mask = 1<<(IntPendVal - IRQ_EINT4 + 4);
OUTREG32(&g_pPortRegs->EINTPEND, mask);
CLRREG32(&g_pPortRegs->EINTMASK, mask);
}
}
OALMSG(OAL_INTR&&OAL_VERBOSE, (L"-OALIntrDoneIrqs\r\n"));
}
//------------------------------------------------------------------------------
//
// Function: OEMInterruptHandler
//
ULONG OEMInterruptHandler(ULONG ra)
{
UINT32 sysIntr = SYSINTR_NOP;
UINT32 IntPendVal, IntPendVal2, mask, SubIntPendVal;
#ifdef DVS_EN
#if (DVS_METHOD == 1 || DVS_METHOD == 3)
unsigned int clkval_calc;
unsigned int i;
#endif //(DVS_METHOD == 1 || DVS_METHOD == 3)
#endif //DVS_EN
static DWORD HeartBeatCnt, HeartBeatStat; //LED4 is used for heart beat
volatile static unsigned int cnt=0;
volatile S3C2413_IOPORT_REG *s2413IOPORT = (S3C2413_IOPORT_REG *)OALPAtoVA(S3C2413_BASE_REG_PA_IOPORT, FALSE);
TOUCH_GLOBALS *odo_tsb; //Sample buffer stuff
// for this, You MUST modify bsp/inc/drv_glob.h.. check drv_glob.h_jylee TBD
odo_tsb = &((DRIVER_GLOBALS *)DRIVER_GLOBALS_PHYSICAL_MEMORY_START)->tch;
// Get pending interrupt(s)
IntPendVal = INREG32(&g_pIntrRegs->INTOFFSET);
SubIntPendVal = INREG32(&g_pIntrRegs->SUBSRCPND);
#ifdef DVS_EN
#if (DVS_METHOD == 2)
// if ( GetCurrentVoltage() != HIGHVOLTAGE )
// {
// ChangeVoltage(HIGHVOLTAGE);
// for(i=0;i<VOLTAGEDELAY;i++)
// {
// INREG32(&g_pPortRegs->GPFDAT); // for loop operation, just read.
// }
// DVS_OFF();
// g_oalIoCtlClockSpeed = S3C2413_FCLK;
// }
// if ( GetCurrentVoltage() != HIGHVOLTAGE )
// {
// ChangeVoltage(HIGHVOLTAGE);
// for(i=0;i<VOLTAGEDELAY;i++)
// {
// INREG32(&g_pPortRegs->GPFDAT); // for loop operation, just read.
// }
// DVS_OFF();
// g_oalIoCtlClockSpeed = S3C2413_FCLK;
//
// switch ( HCLKDIV )
// {
// case 4:
// CLKDIV124();
// break;
// case 6:
// CLKDIV136();
// break;
// case 8:
// CLKDIV148();
// break;
// }
// }
// }
#endif //(DVS_METHOD == 3)
#endif //DEV_EN
// System timer interrupt?
if (IntPendVal == IRQ_TIMER4)
{
// To see the Timer interrupt is occurred every 1ms...
/*
g_pPortRegs->GPFCON = (g_pPortRegs->GPFCON & ~(3<<8)) | (1<<8); // GPF4 Output
if(cnt++%2)
g_pPortRegs->GPFDAT = (s2413IOPORT->GPFDAT & ~(1<<4)); // LED[4] ON.
else
g_pPortRegs->GPFDAT = (s2413IOPORT->GPFDAT | (1 << 4)); // LED[4] OFF.
*/
// For Led Blink(Heart Beat).
if (++HeartBeatCnt > 100)
{
HeartBeatCnt = 0;
HeartBeatStat ^= 1;
g_pPortRegs->GPFCON = (g_pPortRegs->GPFCON & ~(3<<8)) | (1<<8); // GPF4 Output
if (HeartBeatStat)
{
g_pPortRegs->GPFDAT &= ~(1<<4); // LED 4 On
}
else
{
g_pPortRegs->GPFDAT |= (1<<4); // LED 4 Off
}
}
// Rest is on timer interrupt handler
sysIntr = OALTimerIntrHandler();
}
// Profiling timer interrupt?
else if (IntPendVal == IRQ_TIMER2)
{
// Mask and Clear the interrupt.
mask = 1<<IntPendVal;
SETREG32(&g_pIntrRegs->INTMSK, mask);
OUTREG32(&g_pIntrRegs->SRCPND, mask);
OUTREG32(&g_pIntrRegs->INTPND, mask);
// The rest is up to the profiling interrupt handler (if profiling
// is enabled).
//
if (g_pProfilerISR)
{
sysIntr = g_pProfilerISR(ra);
}
}
/*
else if (IntPendVal == IRQ_ADC) // INTSRC_ADC
{
// Touch Panel Int
SubIntPendVal = g_pIntrRegs->SUBSRCPND;
if (SubIntPendVal & (BIT_SUB_ADC))
{
RETAILMSG(DBG_TCH,(_T("+INTSUB_ADC\r\n")));
g_pIntrRegs->INTSUBMSK |= BIT_SUB_ADC;
g_pIntrRegs->SUBSRCPND = BIT_SUB_ADC;
g_pIntrRegs->INTMSK |= BIT_ADC;
g_pIntrRegs->SRCPND = BIT_ADC;
if (g_pIntrRegs->INTPND & BIT_ADC) g_pIntrRegs->INTPND = BIT_ADC;
g_pIntrRegs->INTMSK &= ~(BIT_ADC);
RETAILMSG(DBG_TCH, (TEXT("IntrHandler:BIT_SUB_ADC\r\n")));
sysIntr = SYSINTR_NOP;
}
else if (SubIntPendVal & (BIT_SUB_TC)) // Not IRQ_SUB_TC
{
RETAILMSG(DBG_TCH,(_T("+INTSUB_TC\r\n")));
g_pIntrRegs->INTSUBMSK |= (BIT_SUB_TC);
g_pIntrRegs->SUBSRCPND = BIT_SUB_TC;
g_pIntrRegs->INTMSK |= BIT_ADC;
g_pIntrRegs->SRCPND = BIT_ADC;
if (g_pIntrRegs->INTPND & BIT_ADC) g_pIntrRegs->INTPND = BIT_ADC;
if(g_pADCRegs->ADCDAT0&(1<<15)) {
RETAILMSG(DBG_TCH, (TEXT("IntrHandler:BIT_SUB_TC-PENUP\r\n")));
odo_tsb->status = TOUCH_PEN_UP;
} else {
RETAILMSG(DBG_TCH, (TEXT("IntrHandler:BIT_SUB_TC-PENDOWN\r\n")));
odo_tsb->status = TOUCH_PEN_DOWN;
}
sysIntr = OALIntrTranslateIrq(IRQ_ADC);
}
else
sysIntr = SYSINTR_NOP;
}
*/
/*
else if (IntPendVal == IRQ_TIMER1) // INTSRC_TIMER3
{
// Timer 1 interrupt to get touch point
g_pIntrRegs->INTMSK |= BIT_TIMER1;
g_pIntrRegs->SRCPND = BIT_TIMER1;
if (g_pIntrRegs->INTPND & BIT_TIMER1)
g_pIntrRegs->INTPND = BIT_TIMER1;
RETAILMSG(DBG_ON, (TEXT("IntrHandler:IRQ_TIMER1\r\n")));
if( (g_pADCRegs->ADCDAT0 & (1<<15)) || (g_pADCRegs->ADCDAT1 & (1<<15)) ){
RETAILMSG(DBG_ON,(TEXT("IntrHandler:TOUCH-PENUP\r\n")));
odo_tsb->status = TOUCH_PEN_UP;
sysIntr = OALIntrTranslateIrq(IRQ_ADC);
}
if(odo_tsb->status == TOUCH_PEN_UP)
{
odo_tsb->status = TOUCH_PEN_UP;
sysIntr = OALIntrTranslateIrq(IRQ_ADC);
RETAILMSG(DBG_ON,(TEXT("IntrHandler:TOUCH-PEN_UP\r\n")));
}
else
{
unsigned int TmpTCON;
odo_tsb->status = TOUCH_PEN_SAMPLE;
TmpTCON = g_pPWMRegs->TCON; // get TCON value to temp TCON register
g_pPWMRegs->TCON = (TmpTCON & ~(0xf<<8)) | (0x2<<8); // stop, one-shot, inverter off, TCNTB3 update
g_pPWMRegs->TCON = (TmpTCON & ~(0xf<8)) | (0x1<<8); // start
RETAILMSG(DBG_ON,(TEXT("IntrHandler:TOUCH-PENSAMPLE\r\n")));
sysIntr = OALIntrTranslateIrq(IRQ_TIMER1);
}
}*/
else if(IntPendVal == IRQ_USBH)
{
g_pIntrRegs->INTMSK |= (BIT_USBH);
g_pIntrRegs->SRCPND = (BIT_USBH);
if (g_pIntrRegs->INTPND & (BIT_USBH))
g_pIntrRegs->INTPND = (BIT_USBH);
sysIntr= OALIntrTranslateIrq(IRQ_USBH);
RETAILMSG(DBG_ON,(TEXT("IntrHandler:IRQ_USBH\r\n")));
}
else if(IntPendVal == IRQ_USBD)
{
g_pIntrRegs->INTMSK |= (BIT_USBD);
g_pIntrRegs->SRCPND = (BIT_USBD);
if (g_pIntrRegs->INTPND & (BIT_USBD))
g_pIntrRegs->INTPND = (BIT_USBD);
sysIntr= OALIntrTranslateIrq(IRQ_USBD);
//RETAILMSG(1,(TEXT("+++ IntrHandler:IRQ_USBD\r\n")));
}
else if(IntPendVal == IRQ_SDI)
{
g_pIntrRegs->INTMSK |= (BIT_SDI);
g_pIntrRegs->SRCPND = (BIT_SDI);
if (g_pIntrRegs->INTPND & (BIT_SDI))
g_pIntrRegs->INTPND = (BIT_SDI);
sysIntr= OALIntrTranslateIrq(IRQ_SDI);
RETAILMSG(DBG_ON,(TEXT("IntrHandler:IRQ_SDI\r\n")));
}
else if(IntPendVal == IRQ_DMA0)
{
g_pIntrRegs->INTMSK |= (BIT_DMA0);
g_pIntrRegs->SRCPND = (BIT_DMA0);
if (g_pIntrRegs->INTPND & (BIT_DMA0))
g_pIntrRegs->INTPND = (BIT_DMA0);
sysIntr= OALIntrTranslateIrq(IRQ_DMA0);
RETAILMSG(DBG_ON, (TEXT("IntrHandler:ITQ_DMA0\r\n")));
}
else if(IntPendVal == IRQ_DMA1)
{
g_pIntrRegs->INTMSK |= (BIT_DMA1);
g_pIntrRegs->SRCPND = (BIT_DMA1);
if (g_pIntrRegs->INTPND & (BIT_DMA1))
g_pIntrRegs->INTPND = (BIT_DMA1);
sysIntr= OALIntrTranslateIrq(IRQ_DMA1);
RETAILMSG(DBG_ON, (TEXT("IntrHandler:IRQ_DMA1\r\n")));
}
/*
else if(IntPendVal == IRQ_DMA2)
{
g_pIntrRegs->INTMSK |= (BIT_DMA2);
g_pIntrRegs->SRCPND = (BIT_DMA2);
if (g_pIntrRegs->INTPND & (BIT_DMA2))
g_pIntrRegs->INTPND = (BIT_DMA2);
sysIntr= OALIntrTranslateIrq(IRQ_DMA2);
RETAILMSG(DBG_ON, (TEXT("IntrHandler:IRQ_DMA2\r\n")));
}
*/
else if(IntPendVal == IRQ_DMA3)
{
g_pIntrRegs->INTMSK |= (BIT_DMA3);
g_pIntrRegs->SRCPND = (BIT_DMA3);
if (g_pIntrRegs->INTPND & (BIT_DMA3))
g_pIntrRegs->INTPND = (BIT_DMA3);
sysIntr= OALIntrTranslateIrq(IRQ_DMA3);
RETAILMSG(DBG_ON, (TEXT("IntrHandler:IRQ_DMA3\r\n")));
}
else if(IntPendVal == IRQ_IIC)
{
// Mask and clear interrupt
g_pIntrRegs->INTMSK |= (BIT_IIC);
g_pIntrRegs->SRCPND = (BIT_IIC);
if (g_pIntrRegs->INTPND & (BIT_IIC))
g_pIntrRegs->INTPND = (BIT_IIC);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -