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

📄 boardcontrol.c

📁 pxa270触摸屏驱动程序
💻 C
📖 第 1 页 / 共 3 页
字号:
* INPUT PARAMETERS:
*    None.
*
* RETURNS:
*    0 - The specified bit is cleared, 1 = The specified bit is set.
*
* GLOBAL EFFECTS:
*    None.
*
* ASSUMPTIONS:
*    None.
*
* CALLS:
*    None.
*
* CALLED BY:
*    Test code or DM infrastructure.
*
* PROTOTYPE:
*    UINT ReadMiscRdRegister(VOID);
*
*******************************************************************************
*/
UINT ReadMiscRdRegister(VOID)
{
    // Return the state of the specified bit.
    return (boardCtrlRegsP->miscRd);
}

/*
*******************************************************************************
*
* FUNCTION:
*    IsDevicePresent
*
* DESCRIPTION:
*    This routine identifies if  USB Cable, USIM, MMC, Memory Stick or PCMCIA are
*    present.
*
* INPUT PARAMETERS:
*    MiscRdT device - device type
*
* RETURNS:
*    TRUE - The specified is not present, FALSE - The specified device is present.
*
* GLOBAL EFFECTS:
*    None.
*
* ASSUMPTIONS:
*    None.
*
* CALLS:
*    None.
*
* CALLED BY:
*    Test code.
*
* PROTOTYPE:
*    INT IsDevicePresent(MiscRdT device);
*
*******************************************************************************
*/
INT IsDevicePresent(MiscRdT device)
{
    INT status;
#if 0	//hzh
	if (device == USB_CBL)
	{
		// For USB Cable detection 1 - cable is inserted
    	if (ReadMiscRdRegister() & device)
      		status = TRUE;
    	else
      		status = FALSE;
	}
	else
	{
		// For rest of the devices 0 - cable is inserted
    	if (ReadMiscRdRegister() & device)
      		status = FALSE;
    	else
      		status = TRUE;
	}
#else
/*	MMC_WP      = 0x0001,       // SD/MMC Write Protect status
    BTDCD       = 0x0002,       // BTUART Data Carrier Detect
    BTRI        = 0x0004,       // BTUART Ring Indicator
    BTDSR       = 0x0008,       // BTUART Data Set Ready
    TS_BUSY     = 0x0010,       // ADI7873 Touch Screen Digitizer Busy
    USB_CBL     = 0x0020,       // USB client cable status
    nUSIM_CD    = 0x0040,       // USIM Card detection signal
    nMMC_CD     = 0x0080,       // SD/MMC Card detection signal
    nMEMSTK_CD  = 0x0100,       // Memory Stick detection signal
    nPENIRQ     = 0x0200        // ADI7873 Touch Screen Digitizer PENIRQ
*/
	P_XLLP_GPIO_T gpioReg = (P_XLLP_GPIO_T ) XS_GPIO_REGISTER_BASE;
	switch(device)
	{
	case MMC_WP:
		status = (gpioReg->GPLR3 & (1<<3)) ? FALSE : TRUE;
		break;
	case BTDCD:
		status = TRUE;
		break;
	case BTRI:
		status = FALSE;
		break;
	case BTDSR:
		status = FALSE;
		break;
	case TS_BUSY:
		status = FALSE;
		break;
	case USB_CBL:
		status = TRUE;
		break;
	case nUSIM_CD:
		status = FALSE;
		break;
	case nMMC_CD:
		status = (gpioReg->GPLR3 & (1<<2)) ? FALSE : TRUE;
		break;
	case nMEMSTK_CD:
		status = FALSE;
		break;
	default:
		status = FALSE;
	}
#endif
    // Return the status of the specified device.
    return status;
}

/*
*******************************************************************************
*
* FUNCTION:
*    ModifyBoardInterruptMaskRegister
*
* DESCRIPTION:
*    This routine masks or enables the specified bit in the Lubbock Interrupt
*    Mask register.
*
* INPUT PARAMETERS:
*    IntOperationT op - The operation to perform.
*    IntMaskEnableT bit - The interrupt mask bit to mask or enable.
*
* RETURNS:
*    The contents of the Lubbock Interrupt Mask Register.
*
* GLOBAL EFFECTS:
*    None.
*
* ASSUMPTIONS:
*    None.
*
* CALLS:
*    None.
*
* CALLED BY:
*    Test code or DM infrastructure.
*
* PROTOTYPE:
*    UINT ModifyBoardInterruptMaskRegister(IntOperationT op, IntMaskEnableT bit);
*
*******************************************************************************
*/
UINT ModifyBoardInterruptMaskRegister(IntOperationT op, IntMaskEnableT bit)
{
    switch(op)
    {
        case Int_Set_Register:
            // Enable the bit.
            boardCtrlRegsP->intMaskEnb |= bit;
            break;

        case Int_Clear_Register:
            // Mask the bit.
            boardCtrlRegsP->intMaskEnb &= ~bit;
            break;
    }

    // Always return the Interrupt Mask Register.
    return (boardCtrlRegsP->intMaskEnb);
}


/*
*******************************************************************************
*
* FUNCTION:
*    ReadBoardInterruptMaskRegister
*
* DESCRIPTION:
*    This routine masks or enables the specified bit in the Lubbock Interrupt
*    Mask register.
*
* INPUT PARAMETERS:
*    None.
*
* RETURNS:
*    The contents of the Lubbock Interrupt Mask Register.
*
* GLOBAL EFFECTS:
*    None.
*
* ASSUMPTIONS:
*    None.
*
* CALLS:
*    None.
*
* CALLED BY:
*    Test code or DM infrastructure.
*
* PROTOTYPE:
*    UINT ReadBoardInterruptMaskRegister(void);
*
*******************************************************************************
*/
UINT ReadBoardInterruptMaskRegister(void)
{
    // Return the Interrupt Mask Register.
    return (boardCtrlRegsP->intMaskEnb);
}

/*
*******************************************************************************
*
* FUNCTION:
*    ModifyBoardInterruptSetRegister
*
* DESCRIPTION:
*    This routine sets or clears the specified bit in the Lubbock Interrupt
*    register.
*
* INPUT PARAMETERS:
*    IntOperationT op - The operation to perform.
*    IntSetClearT bit - The interrupt bit to clear or set.
*
* RETURNS:
*    The contents of the Board Interrupt Register.
*
* GLOBAL EFFECTS:
*    None.
*
* ASSUMPTIONS:
*    None.
*
* CALLS:
*    None.
*
* CALLED BY:
*    Test code or DM infrastructure.
*
* PROTOTYPE:
*    UINT ModifyBoardInterruptSetRegister(IntOperationT op, IntSetClearT bit);
*
*******************************************************************************
*/
UINT ModifyBoardInterruptSetRegister(IntOperationT op, IntSetClearT bit)
{
    switch(op)
    {
        case Int_Set_Register:
            // Enable the bit.
            boardCtrlRegsP->intSetClr |= bit;
            break;

        case Int_Clear_Register:
            // Clear the bit.
            boardCtrlRegsP->intSetClr &= ~bit;
            break;
    }

    // Always return the Interrupt Register.
    return (boardCtrlRegsP->intSetClr);
}

/*
*******************************************************************************
*
* FUNCTION:
*    ReadBoardInterruptSetRegister
*
* DESCRIPTION:
*    This routine reads the contence of the Lubbock Interrupt register.
*
* INPUT PARAMETERS:
*    none.
*
* RETURNS:
*    The contents of the Lubbock Interrupt Register.
*
* GLOBAL EFFECTS:
*    None.
*
* ASSUMPTIONS:
*    None.
*
* CALLS:
*    None.
*
* CALLED BY:
*    Test code or DM infrastructure.
*
* PROTOTYPE:
*    UINT ReadBoardInterruptSetRegister(VOID);
*
*******************************************************************************
*/
UINT ReadBoardInterruptSetRegister(VOID)
{
    //  Return the contence of the Interrupt Register.
    return (boardCtrlRegsP->intSetClr);
}

/*
*******************************************************************************
*
* FUNCTION:         SelectIrOperationMode
*
* DESCRIPTION:      Selects FIR or SIR mode of operation
*
* INPUT PARAMETERS: IrOperationT operation -
*                   	selects FIR mode if set to one and
*                   	selects SIR mode if set to zero
*                   IrPowerT param - is used to select the power range
*
* RETURNS:          none.
*
* GLOBAL EFFECTS:   none.
*
* ASSUMPTIONS:      none.
*
* CALLS:			BoardMiscWriteRegister
*
* CALLED BY:
*
* PROTOTYPE:        UINT SelectIrOperationMode (IrOperationT operation, IrPowerT param);
*
*******************************************************************************
*/
UINT SelectIrOperationMode (IrOperationT operation, IrPowerT param)
{
	UINT status;

    // Select IRDA Power mode
    boardCtrlRegsP->miscWr1 = (boardCtrlRegsP->miscWr1 & MISC_WR1_IRDA_MASK) | param;

    // Select FIR or SIR mode
    if (operation == Fir_Mode)
    {
		// Enable FIR mode in IR transiver
		status = ModifyMiscWr1Register(MiscWr_Set_Bit, IrDA_FIR);
    }
    else
    {
		// Enable SIR mode in IR transiver
		status = ModifyMiscWr1Register(MiscWr_Clear_Bit, IrDA_FIR);
    }

    // Return the misc. Write Register.
    return (status);
}

/*
*******************************************************************************
*
* FUNCTION:
*    PlatformLeds
*
* DESCRIPTION:
*    This is a generic routine that can be used by common platform code to
*    display a pattern on the plaform LEDs.
*
* INPUT PARAMETERS:
*    UINT pattern - Hex value to display.
*
* RETURNS:
*    None.
*
* GLOBAL EFFECTS:
*    None.
*
* ASSUMPTIONS:
*
* CALLS:
*
* CALLED BY:
*    Common platform code.
*
* PROTOTYPE:
*
*   VOID PlatformLeds(UINT pattern);
*
*******************************************************************************
*/
VOID PlatformLeds(UINT pattern)
{
    WriteHexLeds(pattern);
}

/*
*******************************************************************************
*
* FUNCTION:
*    PlatformLedsDisplayInterrupt
*
* DESCRIPTION:
*    Display interrupt start/end on low level display. This allows detection
*    of hangs due to constant interrupts. Low level device needs to save/restore
*    the non interrupt display state.
*
* INPUT PARAMETERS:
*    INT enable - 1 - Set all LEDs on, 0 - Display major and minor codes.
*
* RETURNS:
*    None.
*
* GLOBAL EFFECTS:
*    The state of the LEDs change as specified.
*
* ASSUMPTIONS:
*    None.
*
* CALLS:
*    Lubbock_WriteHexLeds
*
* CALLED BY:
*    Common platform code.
*
* PROTOTYPE:
*    VOID PlatformLedsDisplayInterrupt(INT enable);
*
*******************************************************************************
*/
VOID PlatformLedsDisplayInterrupt(INT enable)
{
    if (enable)
    {
        WriteHexLeds(-1);
    }
    else
    {
        WriteHexLeds(((lastMajorId << 16) | lastMinorId));
    }
}

/*
*******************************************************************************
*
* FUNCTION:
*   PostDisplayProgress
*
* DESCRIPTION:
*   This is a generic routine that can be used by common platform code to
*   display a post progress on the plaform LEDs. The first three digits will
*   be used to display the device location. The next two digits will display
*   sub-location code and can be used to pinpoint the function where the code have 
*   been executed from.
*   The last three digits are always 0xFFF, indicating that the post progress is
*   displayed on the leds, rather than an eror code.
*
* INPUT PARAMETERS:
*   UINT32 deviceLoc   - an error code for the device location
*   UINT32 subLoc      - an error code for the sub-location (function)
*   UINT32 param       - parameter, that indicates exect place in the code, where the 
*                        error happened
*   
* RETURNS:
*   None.
*
* GLOBAL EFFECTS:
*   None.
*
* ASSUMPTIONS:
*
* CALLS:
*
* CALLED BY:
*   Common platform code.
*
* PROTOTYPE:
*
*   VOID PostDisplayProgress(UINT32 deviceLoc, UINT32 subLoc, UINT32 param)
*
*******************************************************************************
*/
VOID PostDisplayProgress(UINT32 deviceLoc, UINT32 subLoc, UINT32 subLoc2)
{
    WriteHexLeds(ERRORCODEX(deviceLoc, subLoc, subLoc2, ERR_T_PROGRESS));
}


UINT GetLcdPanelOrientation (VOID)
{
    //return PSPR_ORIENT(GetSCR());
    //===hzh
	switch(GetLcdPanelID())
	{
	case LCDID_TOSHIBA_VGA_16:
	case LCDID_CRT_VGA_16:
		return 1;
	default:
		return 0;
	}
	//===

⌨️ 快捷键说明

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