⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cfwbvd1.c

📁 Xcale270Bsp包,wince平台
💻 C
📖 第 1 页 / 共 4 页
字号:
	volatile BLR_REGS   *v_pBLReg;
	v_pBLReg = (volatile BLR_REGS *)FPGA_REGS_BASE_U_VIRTUAL;
#endif
#endif
  
	v_pGPIOReg	= (volatile XLLP_GPIO_T *) GPIO_BASE_U_VIRTUAL;
	v_pICReg = (volatile XLLP_INTC_T *) INTC_BASE_U_VIRTUAL;
    v_pOSTReg = (volatile XLLP_OST_T *)OST_BASE_U_VIRTUAL;
#ifdef IMGSHAREETH
    if (idInt == SYSINTR_VMINI)
    {
        RETAILMSG (1, (TEXT("Accepting VMini interrupt enable request.\r\n")));
        return (TRUE);
    }
#endif    

    INTERRUPTS_OFF();

    switch(idInt)
    {
	  case SYSINTR_CAMERA_INTERFACE:
		   INTC_CAPTURE_INT_EN(v_pICReg->icmr2);
		   break;
	
	  case SYSINTR_CAMERA_DMAC:
		   INTC_DMAC_INT_EN(v_pICReg->icmr);
		   break;

	  case SYSINTR_KEYPAD:
		   INTC_KEYPAD_INT_EN(v_pICReg->icmr);
		   break;
		
      case SYSINTR_BREAK:
            /* There is no halt button */
            break;

	   case SYSINTR_SDMMC:
			INTC_MMC_INT_EN(v_pICReg->icmr);
			break;

       case SYSINTR_DVM:
			// TIMER_M3_INT_CLR(v_pOSTReg->ossr);
			// INTC_M3_INT_EN(v_pICReg->icmr);     
            break;

		case SYSINTR_OHCI_MDD:
		   
//			RETAILMSG(1,(TEXT("**************OEMInterruptEnable for SYSINTR_OHCI_MDD\r\n")));

			INTC_USBOHCI_INT_EN( v_pICReg->icmr );
			break;

		case SYSINTR_OHCI_PDD:

//			RETAILMSG(1,(TEXT("**************OEMInterruptEnable for SYSINTR_OHCI_PDD\r\n")));

			
			INTC_USBNONOHCI_INT_EN( v_pICReg->icmr );
			break;



	   
	   case SYSINTR_MMCCD:
#if 0	//hzh
#ifdef BSP_MAINSTONE
			v_pBLReg->int_msk_en  |= MMCCD_MASK;
//			DEBUGMSG(1, (TEXT("**** FPGA set clear register is %x mask %x\r\n"),v_pBLReg->int_set_clr,v_pBLReg->int_msk_en));
#endif
#else
			v_pGPIOReg->GFER3 |= 1<<2;
			v_pGPIOReg->GRER3 |= 1<<2;
#endif
            break;

      case SYSINTR_TOUCH:
		//	//lpWriteDebugStringFunc(TEXT("**************OEMInterruptEnable: SYSINTR_TOUCHpanel.\r\n"));
#if 0	//hzh
#ifdef BSP_MAINSTONE
			v_pBLReg->int_msk_en  |= UCB1400_IRQ_MASK;
//			DEBUGMSG(1, (TEXT("**** FPGA set clear register is %x mask %x\r\n"),v_pBLReg->int_set_clr,v_pBLReg->int_msk_en));
#endif
#else
//RETAILMSG(1,(TEXT("Touch interrupt enable-----------\r\n")));
			v_pGPIOReg->GRER0 |= 1<<13;
#endif
            break;

        case SYSINTR_TOUCH_CHANGED:
		//	//lpWriteDebugStringFunc(TEXT("**************OEMInterruptEnable: SYSINTR_TOUCH_CHANGEDpanel.\r\n"));
#if 0	//hzh
#ifdef BSP_MAINSTONE 
			v_pBLReg->int_msk_en  |= UCB1400_IRQ_MASK;
//			DEBUGMSG(1, (TEXT("**** FPGA set clear register is %x\r\n"),v_pBLReg->int_set_clr) );
#endif
#else
			v_pGPIOReg->GRER0 |= 1<<13;
#endif
            break;

        case SYSINTR_POWER:
#if 0	//hzh
            //lpWriteDebugStringFunc(TEXT("**************OEMInterruptEnable: enable PWRbutton.\r\n"));

            //
            // The power button is a toggle so let both rising
            // and falling edges trigger the interrupt
            // 
            // Dot to no-dot transition for sleep trigger.
            //  On Mainstone (S12), that is a rising edge.
            //  No-Dot to Dot (falling edge on Mainstone) reserved for wakeup.
            POWER_OFF_RISING_EDGE (v_pGPIOReg->GRER0); 	 
            INTC_GPIO1_INT_EN (v_pICReg->icmr);
#else
			RETAILMSG(1,(TEXT("Enable GP0 Irq\r\n")));
			v_pGPIOReg->GFER0 |= 1;
			v_pICReg->icmr |= 1<<8;
#endif
            break;

        case SYSINTR_SERIAL:    
			//lpWriteDebugStringFunc(TEXT("**************OEMInterruptEnable: enable SERIAL.\r\n"));
            // FFUART interrupt enabled
		    INTC_FFUART_INT_EN(v_pICReg->icmr);
            break;
		
		case SYSINTR_SERIAL2:    
			//lpWriteDebugStringFunc(TEXT("**************OEMInterruptEnable: enable BTUART SERIAL.\r\n"));
            // BTUART interrupt enabled
		    INTC_BTUART_INT_EN(v_pICReg->icmr);
            break;

        case SYSINTR_IR:
			//lpWriteDebugStringFunc(TEXT("**************OEMInterruptEnable: enable IR.\r\n"));
            // STUART interrupt enabled
		    INTC_STUART_INT_EN(v_pICReg->icmr);
            break;

        case SYSINTR_USB_CLIENT:
            //lpWriteDebugStringFunc(TEXT("**************OEMInterruptEnable: enable USB CLIENT.\r\n"));
 
            //
            // GPIO0 used for detecting Cable Connect/Disconnect
            // So both rising and falling edges need to
            // trigger the interrupt
            // 
            //
            // Enable the UDC interrupt
            //
            INTC_USBC_INT_EN(v_pICReg->icmr); 
            break;

        case SYSINTR_AUDIO:
        case SYSINTR_DMA:
			//lpWriteDebugStringFunc(TEXT("**************OEMInterruptEnable: enable AUDIO.\r\n"));
            //INTC_DMAC_INT_EN(v_pICReg->icmr);
            break;

        case SYSINTR_ETHER: // KITL
		
#ifndef IMGNOKITL
#if 0	//hzh
			 if (v_pDriverGlobals->uninit_misc.EbootDevice == BOOT_DEVICE_SLOT0)
             {   //lpWriteDebugStringFunc(TEXT("**************OEMInterruptEnable: enable SLOT0 for KITL.\r\n"));
                 v_pBLReg->int_msk_en = (v_pBLReg->int_msk_en & ~INTMSK_SETCLR_RESERVED_BITS) | PCMCIA_S0_IRQ_MASK;        // unmask
             }
             else if (v_pDriverGlobals->uninit_misc.EbootDevice == BOOT_DEVICE_SLOT1)
             {   //lpWriteDebugStringFunc(TEXT("**************OEMInterruptEnable: enable SLOT1 for KITL.\r\n"));
                 v_pBLReg->int_msk_en = (v_pBLReg->int_msk_en & ~INTMSK_SETCLR_RESERVED_BITS) | PCMCIA_S1_IRQ_MASK;        // unmask
             }
#else
			if (v_pDriverGlobals->uninit_misc.EbootDevice == BOOT_DEVICE_SLOT0)
			{
				v_pGPIOReg->GFER2 |= 1<<17;				//nIRQ
			}
#endif
#else		//hzh
			 v_pGPIOReg->GRER0 |= 1<<14;		//GPIO14
#endif
             break;

		case SYSINTR_SMSC:
#if 0	//hzh
#ifdef BSP_MAINSTONE 
			v_pBLReg->int_msk_en  |=  ETHERNET_IRQ_MASK;
#endif
#else
			//RETAILMSG(1,(TEXT("0x%x,0x%x\r\n"), v_pGPIOReg->GAFR0_L, v_pGPIOReg->GPDR0));
			//RETAILMSG(1,(TEXT("Enable SYSINTR_SMSC\r\n")));
			v_pGPIOReg->GRER0 |= 2;
			//v_pGPIOReg->GFER0 &= ~2;
#endif
            break;

		//===hzh
		case SYSINTR_CS8900A:
            v_pGPIOReg->GRER0 |= 1<<14;		//GPIO14
			break;
		
		case SYSINTR_16550:
			//RETAILMSG(1,(TEXT("Enable SYSINTR_16550\r\n")));
			v_pGPIOReg->GPDR0 &= ~(1<<19);	//GPIO14,19 may be changed in xllp_lcd.c when initilize LCD
			v_pGPIOReg->GAFR0_U &= ~(3<<6);	//so do these again
            v_pGPIOReg->GRER0 |= 1<<19;		//GPIO19
			break;
		//===

		//If the PC Card Socket interrupt is either a CARD DETECT interrupt or a
		//STATUS CHANGE interrupt, then enable it here for both sockets
        case SYSINTR_PCMCIA_STATE:
#if 0	//hzh
			//******************** SOCKET 0 *****************************
			//Enable the STSCHG interrupt
			v_pBLReg->int_msk_en  |= PCMCIA_S0_STSCHG_MASK;
	        //Initial clearing of the interrupt
	        v_pBLReg->int_set_clr &= ~(PCMCIA_S0_STSCHG_MASK);
			
			//Enable the CD interrupt
			v_pBLReg->int_msk_en  |= PCMCIA_S0_CD_MASK;
			//Initial clearing of the interrupt
    	    v_pBLReg->int_set_clr &= ~(PCMCIA_S0_CD_MASK);

			//******************** SOCKET 1 *****************************
            //Enable the STSCHG interrupt		
			v_pBLReg->int_msk_en  |= PCMCIA_S1_STSCHG_MASK;
	        //Initial clearing of the interrupt
	        v_pBLReg->int_set_clr &= ~(PCMCIA_S1_STSCHG_MASK);
			
			//Enable the CD interrupt
			v_pBLReg->int_msk_en  |= PCMCIA_S1_CD_MASK;
			//Initial clearing of the interrupt
	        v_pBLReg->int_set_clr &= ~(PCMCIA_S1_CD_MASK);
#else
			v_pGPIOReg->GFER2 |= (1<<19)|(1<<20);	//nCD & nSTSCHG
			v_pGPIOReg->GRER2 |= 1<<19;				//nCD
			RETAILMSG(1,(TEXT("Enable SYSINTR_PCMCIA_STATE\r\n")));
#endif
            break;

		//If the PC Card Socket interrupt is an IRQ interrupt, then
		//enable it here for both sockets
        case SYSINTR_PCMCIA_LEVEL:
#if 0	//hzh
			//******************** SOCKET 0 *****************************
			//Enable the interrupt
			v_pBLReg->int_msk_en  |= PCMCIA_S0_IRQ_MASK;
			//Initial clearing of the interrupt
	        v_pBLReg->int_set_clr &= ~(PCMCIA_S0_IRQ_MASK);

			//******************** SOCKET 1 *****************************
			//Enable the interrupt
			v_pBLReg->int_msk_en  |= PCMCIA_S1_IRQ_MASK;
			//Initial clearing of the interrupt	        
	        v_pBLReg->int_set_clr &= ~(PCMCIA_S1_IRQ_MASK);
#else
			v_pGPIOReg->GFER2 |= 1<<17;				//nIRQ
#endif			
            break;

        case SYSINTR_TIMING:
            break;

        case SYSINTR_PMU:
            //
            // Currently PMU DCD does not need to do anything here.
            //
            break;

//xiexy in OEMInterruptEnable
				case SYSINTR_IDE:
						v_pGPIOReg->GRER0 |= (1<<9);
						INTC_GPIOXX_2_INT_EN(v_pICReg->icmr); 
						break;
//end xiexy
						
        default:
            //lpWriteDebugStringFunc(TEXT("OEMInterruptEnable: unknown interrupt requested.\r\n"));
            bRet = FALSE;   /* don't know about this interrupt value */
    }
    INTERRUPTS_ON();
    return bRet;
}


/* ************************************************************************* */
/*
    @func	BOOL | OEMInterruptDisable | Disable a hardware interrupt
    @rdesc	none
    @comm 	OEMInterruptDisable is called by the Kernel when a device driver
            calls <f InterruptDisable>. The system is not preemtible when this
            function is called.
    @xref <l Overview.Windows CE Kernel OEM Interface> <f InterruptDisable>
*/

void OEMInterruptDisable(
                        DWORD idInt     // @parm Interrupt ID to be disabled. See <t Interrupt ID's>
                        // for the list of possible values.
                        )
{
    volatile PDRIVER_GLOBALS v_pDriverGlobals = (volatile PDRIVER_GLOBALS)DRIVER_GLOBALS_U_VIRTUAL;	
	volatile XLLP_GPIO_T *v_pGPIOReg;
	volatile XLLP_INTC_T  *v_pICReg;
#if 0	//hzh
#ifdef BSP_MAINSTONE
    volatile BLR_REGS *v_pBLReg = (volatile BLR_REGS *) FPGA_REGS_BASE_U_VIRTUAL;
#endif
#endif

	v_pGPIOReg = (volatile XLLP_GPIO_T *)GPIO_BASE_U_VIRTUAL;
	v_pICReg = (volatile XLLP_INTC_T *) INTC_BASE_U_VIRTUAL;

   INTERRUPTS_OFF();
   switch(idInt)
   {
		case SYSINTR_CAMERA_INTERFACE:
			INTC_CAPTURE_INT_DIS(v_pICReg->icmr2);
			break;

		// not clear this is even a good thing to disable this, because it's not disabling just the camera DMA, it's 
		// disabling all DMA interrupts.  It should really just clear the appropriate bits in the DINT register.
		case SYSINTR_CAMERA_DMAC:
			INTC_DMAC_INT_DIS(v_pICReg->icmr);
			break;


	    case SYSINTR_KEYPAD:
			 INTC_KEYPAD_INT_DIS(v_pICReg->icmr);
			 break;
		
        case SYSINTR_BREAK:
            /* There is no halt button */
            break;


		case SYSINTR_OHCI_MDD:
//			RETAILMSG(1,(TEXT("**************OEMInterruptDisable for SYSINTR_OHCI_MDD\r\n")));

			
			INTC_USBOHCI_INT_DIS( v_pICReg->icmr );
			
			break;

		case SYSINTR_OHCI_PDD:
//			RETAILMSG(1,(TEXT("**************OEMInterruptDisable for SYSINTR_OHCI_PDD\r\n")));

			INTC_USBNONOHCI_INT_DIS( v_pICReg->icmr );
			

			break;

		case SYSINTR_MMCCD:	//add by hzh
			v_pGPIOReg->GFER3 &= ~(1<<2);
			v_pGPIOReg->GRER3 &= ~(1<<2);
            break;

        case SYSINTR_TOUCH:
			//lpWriteDebugStringFunc(TEXT("**************OEMInterruptDisable: SYSINTR_TOUCH.\r\n"));
#if 0	//hzh
#ifdef BSP_MAINSTONE
			v_pBLReg->int_msk_en &= ~UCB1400_IRQ_MASK;
#endif
#else
			v_pGPIOReg->GRER0 &= ~(1<<13);
#endif
            break;

        case SYSINTR_TOUCH_CHANGED:
			//lpWriteDebugStringFunc(TEXT("**************OEMInterruptDisable: SYSINTR_TOUCH_CHANGED.\r\n"));

			break;


        case SYSINTR_POWER:
#if 0	//hzh
			//lpWriteDebugStringFunc(TEXT("**************OEMInterruptDisable: SYSINTR_POWER.\r\n"));
		    INTC_GPIO1_INT_DIS (v_pICReg->icmr);
#else
			v_pICReg->icmr &= ~(1<<8);
			v_pGPIOReg->GFER0 &= ~1;
			RETAILMSG(1,(TEXT("Disable GP0 Irq\r\n")));
#endif
            break;

        case SYSINTR_SERIAL:
			//lpWriteDebugStringFunc(TEXT("**************OEMInterruptDisable: SYSINTR_SERIAL.\r\n"));
            // FFUART interrupt masked
		    INTC_FFUART_INT_DIS(v_pICReg->icmr);
            break;

		case SYSINTR_SERIAL2:    
			//lpWriteDebugStringFunc(TEXT("**************OEMInterruptDisable: SYSINTR_SERIAL2.\r\n"));
            // BTUART interrupt masked
		    INTC_BTUART_INT_DIS(v_pICReg->icmr);
            break;

        case SYSINTR_IR:
			//lpWriteDebugStringFunc(TEXT("**************OEMInterruptDisable: SYSINTR_IR.\r\n"));
            // STUART interrupt masked
		    INTC_STUART_INT_DIS(v_pICReg->icmr);
            break;

        case SYSINTR_USB_CLIENT:
            //lpWriteDebugStringFunc(TEXT("**************OEMInterruptDisable: SYSINTR_USB_CLIENT.\r\n"));
#if 0	//hzh
            //
            // Disable the USB Cable event
            //
#ifdef BSP_MAINSTONE
			v_pBLReg->int_msk_en &= ~(USBCD_MASK);
#endif
#endif
            //
            // Disable the UDC interrupt
            //
            INTC_USBC_INT_DIS(v_pICReg->icmr); 
            break;


        case SYSINTR_AUDIO:
        case SYSINTR_DMA:
            //lpWriteDebugStringFunc(TEXT("**************OEMInterruptDisable: SYSINTR_AUDIO.\r\n"));
            //INTC_DMAC_INT_DIS(v_pICReg->icmr);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -