📄 sdk7a400_cpld_driver.c
字号:
/***********************************************************************
* $Workfile: sdk7a400_cpld_driver.c $
* $Revision: 1.3 $
* $Author: WellsK $
* $Date: Mar 18 2004 10:54:34 $
*
* Project: LogicPD SDK7A400 CPLD driver
*
* Description:
* This file contains driver support for the CPLD module on the
* SDK7A400 EVB.
*
* Revision History:
* $Log: //smaicnt2/pvcs/VM/sharpmcu/archives/sharpmcu/software/csps/lh7a400/bsps/sdk7a400/source/sdk7a400_cpld_driver.c-arc $
*
* Rev 1.3 Mar 18 2004 10:54:34 WellsK
* CPLD changes based on rev. B of the card engine.
*
* Rev 1.2 Aug 12 2003 15:10:52 WellsK
* Added support for the LCD VEEEN signal.
*
* Rev 1.1 Jul 02 2003 17:54:46 WellsK
* Updated GPIO direction logic based on design information.
*
* Rev 1.0 Jun 19 2003 11:05:26 WellsK
* Initial revision.
*
*
***********************************************************************
* SHARP MICROELECTRONICS OF THE AMERICAS MAKES NO REPRESENTATION
* OR WARRANTIES WITH RESPECT TO THE PERFORMANCE OF THIS SOFTWARE,
* AND SPECIFICALLY DISCLAIMS ANY RESPONSIBILITY FOR ANY DAMAGES,
* SPECIAL OR CONSEQUENTIAL, CONNECTED WITH THE USE OF THIS SOFTWARE.
*
* SHARP MICROELECTRONICS OF THE AMERICAS PROVIDES THIS SOFTWARE SOLELY
* FOR THE PURPOSE OF SOFTWARE DEVELOPMENT INCORPORATING THE USE OF A
* SHARP MICROCONTROLLER OR SYSTEM-ON-CHIP PRODUCT. USE OF THIS SOURCE
* FILE IMPLIES ACCEPTANCE OF THESE CONDITIONS.
*
* COPYRIGHT (C) 2001 SHARP MICROELECTRONICS OF THE AMERICAS, INC.
* CAMAS, WA
**********************************************************************/
#include "sdk7a400_cpld_driver.h"
/***********************************************************************
* CPLD driver public functions
**********************************************************************/
/***********************************************************************
*
* Function: cpld_init
*
* Purpose: Initializes the CPLD driver (stub function only)
*
* Processing:
* Enables the CPLD with a call to cpld_int_enable.
*
* Parameters: None
*
* Outputs: None
*
* Returns: Nothing
*
* Notes: None
*
**********************************************************************/
void cpld_init(void)
{
/* Enable the CPLD interrupt by default */
cpld_int_enable(TRUE);
}
/***********************************************************************
*
* Function: cpld_enable_lan_power
*
* Purpose: Enable or disable LAN power
*
* Processing:
* If enable is TRUE, enable the LAN device power. Otherwise,
* disable it.
*
* Parameters:
* enable: TRUE to enable LAN power, FALSE to disable it
*
* Outputs: None
*
* Returns: Nothing
*
* Notes: None
*
**********************************************************************/
void cpld_enable_lan_power(BOOL_32 enable)
{
if (enable == TRUE)
{
/* Enable LAN chip power */
* (volatile UNS_16 *) CARDE_REG_BASE &= ~CARDE_LAN_PWR_DISABLE;
}
else
{
/* Disable LAN chip power */
* (volatile UNS_16 *) CARDE_REG_BASE |= CARDE_LAN_PWR_DISABLE;
}
}
/***********************************************************************
*
* Function: cpld_enable_lcd_veeen
*
* Purpose: Enable or disable the LCD VEEEN signal
*
* Processing:
* If enable is TRUE, enable the LCD VEEEN signal. Otherwise,
* disable it.
*
* Parameters:
* enable: TRUE to the LCD VEEEN signal, FALSE to disable it
*
* Outputs: None
*
* Returns: Nothing
*
* Notes: None
*
**********************************************************************/
void cpld_enable_lcd_veeen(BOOL_32 enable)
{
if (enable == TRUE)
{
/* Disable the LCD VEEEN signal */
* (volatile UNS_16 *) CARDE_REG_BASE |= CARDE_VEEEN_ENABLE;
}
else
{
/* Enable the LCD VEEEN signal */
* (volatile UNS_16 *) CARDE_REG_BASE &= ~CARDE_VEEEN_ENABLE;
}
}
/***********************************************************************
*
* Function: cpld_lan_int_enable
*
* Purpose: Disable or enable the LAN interrupt
*
* Processing:
* If enable is TRUE, enable the LAN interrupt. Otherwise, disable
* it.
*
* Parameters:
* enable: TRUE to enable the LAN interrupt, FALSE to disable it
*
* Outputs: None
*
* Returns: Nothing
*
* Notes: None
*
**********************************************************************/
void cpld_lan_int_enable(BOOL_32 enable)
{
if (enable == TRUE)
{
/* Enable LAN interrupt */
* (volatile UNS_16 *) INTMSK_REG_BASE &= ~INTMSK_LAN_DISABLE;
}
else
{
/* Disable LAN interrupt */
* (volatile UNS_16 *) INTMSK_REG_BASE |= INTMSK_LAN_DISABLE;
}
}
/***********************************************************************
*
* Function: cpld_ts_int_enable
*
* Purpose: Disable or enable the touchscreen interrupt
*
* Processing:
* If enable is TRUE, enable the touchscreen interrupt. Otherwise,
* disable it.
*
* Parameters:
* enable: TRUE to enable the touchscreen int, FALSE to disable it
*
* Outputs: None
*
* Returns: Nothing
*
* Notes: None
*
**********************************************************************/
void cpld_ts_int_enable(BOOL_32 enable)
{
if (enable == TRUE)
{
/* Enable touchscreen interrupt */
* (volatile UNS_16 *) INTMSK_REG_BASE &= ~INTMSK_TS_DISABLE;
}
else
{
/* Disable touchscreen interrupt */
* (volatile UNS_16 *) INTMSK_REG_BASE |= INTMSK_TS_DISABLE;
}
}
/***********************************************************************
*
* Function: cpld_int_enable
*
* Purpose: Disable or enable the CPLD interrupt
*
* Processing:
* If enable is TRUE, enable the CPLD interrupt. Otherwise,
* disable it.
*
* Parameters:
* enable: TRUE to enable the CPLD int, FALSE to disable it
*
* Outputs: None
*
* Returns: Nothing
*
* Notes: None
*
**********************************************************************/
void cpld_int_enable(BOOL_32 enable)
{
if (enable == TRUE)
{
/* Enable CPLD interrupt */
* (volatile UNS_16 *) INTMSK_REG_BASE &= ~INTMSK_CPLD_ENABLE;
}
else
{
/* Disable CPLD interrupt */
* (volatile UNS_16 *) INTMSK_REG_BASE |= INTMSK_CPLD_ENABLE;
}
}
/***********************************************************************
*
* Function: cpld_usb1c_int_enable
*
* Purpose: Disable or enable the USB 1 connection interrupt
*
* Processing:
* If enable is TRUE, enable the USB 1 connection interrupt.
* Otherwise, disable it.
*
* Parameters:
* enable: TRUE to enable the USB 1 int, FALSE to disable it
*
* Outputs: None
*
* Returns: Nothing
*
* Notes: None
*
**********************************************************************/
void cpld_usb1c_int_enable(BOOL_32 enable)
{
if (enable == TRUE)
{
/* Enable USB 1 interrupt */
* (volatile UNS_16 *) CARDE_REG_BASE &= ~CARDE_USB1INT_ENABLE;
}
else
{
/* Disable USB 1 interrupt */
* (volatile UNS_16 *) CARDE_REG_BASE |= CARDE_USB1INT_ENABLE;
}
}
/***********************************************************************
*
* Function: cpld_lan_int_pending
*
* Purpose: Return LAN interrupt pending status
*
* Processing:
* If the LAN interrupt is pending (per the CPLD), return TRUE to
* the caller. Otherwise, return FALSE.
*
* Parameters: None
*
* Outputs: None
*
* Returns: TRUE if the LAN interrupt is pending, otherwise FALSE
*
* Notes: None
*
**********************************************************************/
BOOL_32 cpld_lan_int_pending(void)
{
BOOL_32 pending = FALSE;
if (((* (volatile UNS_16 *) INTMSK_REG_BASE) &
INTMSK_LAN_PENDING) == 0)
{
pending = TRUE;
}
return pending;
}
/***********************************************************************
*
* Function: cpld_ts_int_pending
*
* Purpose: Return touchscreen interrupt pending status
*
* Processing:
* If the touchscreen interrupt is pending (per the CPLD), return
* TRUE to the caller. Otherwise, return FALSE.
*
* Parameters: None
*
* Outputs: None
*
* Returns: TRUE of the touchscreen int is pending, otherwise FALSE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -