📄 ext_irq.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
//* : Use LED5 & LED6 for status interrupt
//* 1.0 24/Jun/04 JPP : Creation
//*----------------------------------------------------------------------------
// Include Standard LIB files
#include "Board.h"
#include "dbgu.h"
#include "spi.h"
#include "CAN.h"
int status_irq0 = 0 ;
int status_irq1 = 0 ;
extern unsigned char mdlc, mextF, mrtr;
extern unsigned long mID;
extern void blink(unsigned int vLED);
//*----------------------------------------------------------------------------
//* Function Name : at91_IRQ0_handler
//* Object : Irq Handler called by the IRQ0 interrupt with AT91
//* compatibility
//*----------------------------------------------------------------------------
void at91_IRQ0_handler(void)
{
unsigned char data[8],i;
if (status_irq0 == 0) status_irq0 = 1;
else status_irq0 = 0 ;
blink(LED1);
if(canRead(&mID,data,&mdlc,&mextF,&mrtr, SPI_0)==0)
{
AT91F_DBGU_Printk("\n\rSPI_0 DATA:");
for(i=0;i<mdlc;i++)
uprintf(" %d",data[i]);
uprintf(" dlc=%d",mdlc);
uprintf(" id=%d",mID);
}
//* while AT91C_PA20_IRQ0 is push loop
while ( (AT91F_PIO_GetInput(AT91C_BASE_PIOA) & AT91C_PA20_IRQ0 ) != AT91C_PA20_IRQ0 );
}
//*----------------------------------------------------------------------------
//* Function Name : at91_IRQ0_handler
//* Object : Irq Handler called by the IRQ0 interrupt with AT91
//* compatibility
//*----------------------------------------------------------------------------
void at91_IRQ1_handler(void)
{
unsigned char data[8],i;
if (status_irq1 == 0) status_irq1 = 1;
else status_irq1 = 0 ;
blink(LED2);
if(canRead(&mID,data,&mdlc,&mextF,&mrtr, SPI_1)==0)
{
AT91F_DBGU_Printk("\n\rSPI_1 DATA:");
for(i=0;i<mdlc;i++)
uprintf(" %d",data[i]);
uprintf(" dlc=%d",mdlc);
uprintf(" id=%d",mID);
}
//* while AT91C_PA30_IRQ1 is push loop
while ( (AT91F_PIO_GetInput(AT91C_BASE_PIOA) & AT91C_PA30_IRQ1 ) != AT91C_PA30_IRQ1 );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -