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

📄 sdk7a400_cpld_int_router.c

📁 Sharp LH7A400 BSP平台无关部分的代码,有很高的参考价值,尤其是系统架构设计上,设计成移植度很高的BSP.
💻 C
字号:
/***********************************************************************
 * $Workfile:   sdk7a400_cpld_int_router.c  $
 * $Revision:   1.1  $
 * $Author:   WellsK  $
 * $Date:   Mar 12 2004 15:38:00  $
 *
 * Project: SDK7A400 CPLD interrupt router
 *
 * Description:
 *     This file contains the interrupt router and handler for the
 *     CPLD on the SDK7A400. The CPLD routes multiple interrupts
 *     into a single LH7A400 SOC interrupt.
 *
 *      Revision History:
 * $Log:   //smaicnt2/pvcs/VM/sharpmcu/archives/sharpmcu/software/csps/lh7a400/bsps/sdk7a400/source/sdk7a400_cpld_int_router.c-arc  $
 * 
 *    Rev 1.1   Mar 12 2004 15:38:00   WellsK
 * Added support for card engines that use the CPLD interrupt
 * on PF3 or PF7.
 * 
 *    Rev 1.0   Dec 03 2003 13:52:14   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 "lh7a400_gpio_driver.h"
#include "lh7a400_int_driver.h"
#include "sdk7a400_board.h"
#include "sdk7a400_cpld_driver.h"
#include "sdk7a400_ts_driver.h"
#include "sdk7a400_cpld_int_router.h"

/***********************************************************************
 * CPLD driver public functions
 **********************************************************************/

/***********************************************************************
 *
 * Function: cpld_int_router_init
 *
 * Purpose: Initialize the CPLD interrupt interface
 *
 * Processing:
 *     Configure GPIO port PF7/3 as an active, level sensitive
 *     interrupt and install the CPLD router interrupt handler in the
 *     interrupt driver.
 *
 * Parameters: None
 *
 * Outputs: None
 *
 * Returns: Nothing
 *
 * Notes: None
 *
 **********************************************************************/
void cpld_int_router_init(void)
{
#if CEVERSION==1
    /* Configure GPIO port F7 as an active low, level sensitive
       interrupt input */
    gpio_ext_int_config(GPIO_INT_F7, FALSE, FALSE);

    /* Install this handler of interrupt PF7 */
    int_install_irq_handler(INT_GPIO7INTR, cpld_int_router_isr);

    /* Enable GPIO F7 as interrupt input */
    gpio_ext_int_enable(GPIO_INT_F7, TRUE);

#else
    /* Configure GPIO port F3 as an active low, level sensitive
       interrupt input */
    gpio_ext_int_config(GPIO_INT_F3, FALSE, FALSE);

    /* Install this handler of interrupt PF3 */
    int_install_irq_handler(INT_GPIO3INTR, cpld_int_router_isr);

    /* Enable GPIO F3 as interrupt input */
    gpio_ext_int_enable(GPIO_INT_F3, TRUE);
#endif
}

/***********************************************************************
 *
 * Function: cpld_int_router_enable
 *
 * Purpose: Enable or disable CPLD router interrupt
 *
 * Processing:
 *     If enable is TRUE, enable the GPIO PF7/3 interrupt. Otherwise,
 *     disable it.
 *
 * Parameters:
 *     enable: TRUE to enable the router interrupt, FALSE to disable
 *
 * Outputs: None
 *
 * Returns: Nothing
 *
 * Notes: None
 *
 **********************************************************************/
void cpld_int_router_enable(BOOL_32 enable)
{
#if CEVERSION==1
    if (enable == TRUE)
    {
        int_enable(INT_GPIO7INTR);
    }
    else
    {
        int_disable(INT_GPIO7INTR);
    }

#else
    if (enable == TRUE)
    {
        int_enable(INT_GPIO3INTR);
    }
    else
    {
        int_disable(INT_GPIO3INTR);
    }
#endif
}

/***********************************************************************
 *
 * Function: cpld_int_router_isr
 *
 * Purpose: CPLD interrupt router
 *
 * Processing:
 *     If the ethernet interrupt is pending, call the ethernet
 *     interrupt. If the touchscreen interrupt is pending, call the
 *     touchscreen interrupt. Clear the PF7/3 interrupt.
 *
 * Parameters: None
 *
 * Outputs: None
 *
 * Returns: Nothing
 *
 * Notes: None
 *
 **********************************************************************/
void cpld_int_router_isr(void)
{
    if (cpld_lan_int_pending() == TRUE)
    {
        /* Call ethernet handler */
        ;
    }

    if (cpld_ts_int_pending() == TRUE)
    {
        /* Call touchscreen handler */
        ts_isr();
    }

#if CEVERSION==1
    /* Clear interrupt (on GPIO PF7) */
    gpio_clear_int(GPIO_INT_F7);

#else
    /* Clear interrupt (on GPIO PF3) */
    gpio_clear_int(GPIO_INT_F3);
#endif
}

⌨️ 快捷键说明

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