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

📄 ext_irq.c

📁 ARM入门的好帮手.包含了从简单到相对较复杂的程序.
💻 C
字号:
//*----------------------------------------------------------------------------
//*      ATMEL Microcontroller Software Support  -  ROUSSET  -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name           : ext_irq.c
//* Object              : External interrupt handler for irq this file must be
//*                       compiled in ARM mode (32 bits)
//*
//* 1.0 24/10/00 JPP    : Creation
//*----------------------------------------------------------------------------


#include    "parts/r40807/reg_r40807.h"
#include    "parts/r40807/lib_r40807.h"
#include    "targets/eb40/eb40.h"

extern int timer_close ( void );

//*----------------------------------------------------------------------------
//* Function Name       : at91_IRQ0_handler
//* Object              : Irq Handler called by the IRQ0 interrupt with AT91
//*    					  compatibility
//* Input Parameters    : none
//* Output Parameters   : none
//* Functions called    : at91_pio_read, at91_pio_write
//*----------------------------------------------------------------------------
void at91_IRQ0_handler(void)
{
    //* read the ouput state
    if ( (at91_pio_read ( &PIO_DESC) & LED2 ) == LED2 )
    {
        at91_pio_write ( &PIO_DESC, LED2, PIO_CLEAR_OUT );
    }
    else
    {
         at91_pio_write ( &PIO_DESC, LED2, PIO_SET_OUT );
    }
	timer_close();
}

//*----------------------------------------------------------------------------
//* Function Name       : FIQ_handler
//* Object              : Irq Handler called by the FIQ interrupt with AT91
//*    					  compatibility
//* Input Parameters    : none
//* Output Parameters   : none
//* Functions called    : at91_pio_read, at91_pio_write
//*----------------------------------------------------------------------------
void FIQ_handler(void)
{

    //* read the ouput state
    if ( (at91_pio_read ( &PIO_DESC) & LED2 ) == LED2 )
    {
        at91_pio_write ( &PIO_DESC, LED2, PIO_CLEAR_OUT );
    }
    else
    {
         at91_pio_write ( &PIO_DESC, LED2, PIO_SET_OUT );
    }
}

//*----------------------------------------------------------------------------
//* Function Name       : ext_FIQ_handler
//* Object              : FIQ Handler called by the FIQ interrupt
//*                       don't use this function for interrupt management
//*                       you can test but is not AIC compatible
//* Input Parameters    : none
//* Output Parameters   : none
//* Functions called    : at91_pio_read, at91_pio_write
//*----------------------------------------------------------------------------
#ifdef TEST_ARM
__irq void ext_FIQ_handler(void)
{

    //* read the ouput state
    if ( (at91_pio_read ( &PIO_DESC) & LED2 ) == LED2 )
    {
        at91_pio_write ( &PIO_DESC, LED2, PIO_CLEAR_OUT );
    }
    else
    {
         at91_pio_write ( &PIO_DESC, LED2, PIO_SET_OUT );
    }
    //* Mark the End of Interrupt on the AIC
    AIC_EOICR = 0;
}

//*----------------------------------------------------------------------------
//* Function Name       : ext_IRQ0_handler
//* Object              : Irq Handler called by the IRQ0 interrupt
//*                       don't use this function for interrupt management
//*                       you can test but is not AIC compatible
//* Input Parameters    : none
//* Output Parameters   : none
//* Functions called    : at91_pio_read, at91_pio_write
//*----------------------------------------------------------------------------
__irq void ext_IRQ0_handler(void)
{

    //* read the ouput state
    if ( (at91_pio_read ( &PIO_DESC) & LED2 ) == LED2 )
    {
        at91_pio_write ( &PIO_DESC, LED2, PIO_CLEAR_OUT );
    }
    else
    {
         at91_pio_write ( &PIO_DESC, LED2, PIO_SET_OUT );
    }
    //* Mark the End of Interrupt on the AIC
    AIC_EOICR = 0;
}
#endif   //* TEST_ARM

⌨️ 快捷键说明

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