Chinaunix首页 | 论坛 | 博客
  • 博客访问: 203525
  • 博文数量: 93
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 978
  • 用 户 组: 普通用户
  • 注册时间: 2014-11-10 15:46
个人简介

青春无悔

文章分类

全部博文(93)

文章存档

2015年(16)

2014年(77)

我的朋友

分类: 嵌入式

2014-11-10 16:41:16

1.方法1:
#include


EX_INTERRUPT_HANDLER(IVG14_ISR)
{
    static volatile u32 count;
    count++;
    if (count % 100 == 0)
        AIO_printf("\r\n>>EX_INTERRUPT_HANDLER %d", count);
}

static void SFInterrupt_Init(void)
{
    ex_handler_fn result;

    result = register_handler(ik_ivg14, IVG14_ISR);
    if (EX_INT_IGNORE == result)
    {
        AIO_printf("\r\n>>EX_INT_IGNORE");
    }
    else if (EX_INT_DEFAULT == result)
    {
        AIO_printf("\r\n>>EX_INT_DEFAULT");
    }
    else
    {
        AIO_printf("\r\n>>Addr = 0X%X OK",result);
    }
}

static void SFInterrupt_Raise(void)
{
    raise(SIGIVG14);
}

2.方法2:
#include

static void UserInterruptFunc(int val)
{
    static volatile u32 count;
    count++;
    if (count % 100 == 0)
        AIO_printf("\r\n>>UserInterruptFunc %d", count);
}

#define SIG_NAME      SIGIVG14//SIGUSR2 
static void SFInterrupt_Init(void)
{
    unsigned short imask = *pIMASK;
    imask |= (1 << 14);
    *pIMASK = imask;
    interrupt (SIG_NAME, UserInterruptFunc);
}

static void SFInterrupt_Raise(void)
{
    raise(SIG_NAME);
}
阅读(338) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~