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

📄 intctrl.c

📁 lpc2136芯片的硬件全部功能示例程序
💻 C
字号:
/*************************************************************
		WPD800 中断控制模块
		修改历史    2007-9-25  zaken create version 1.0


*************************************************************/

#include "config.h"
#include "target.h"
#include "main.h"
#include "IntCtrl.h"

#define MAX_INT_NUM  21 //中断号最大21
//设置中断
//参数1 中断号
//参数2 中断入口函数地址
//参数3 优先级0~15 0最高 分别对应slot0~15
//参数4 是否为FIQ中断
bool  Int_Setup(BYTE int_num,uint32 Int_Func,BYTE level,bool FIQ)
{
	//检查
//	if(int_num>MAX_INT_NUM || (Int_Func==0) || level>15)
	{
//		return ERROR;
	}
	if(FIQ)
		FIQEnable();
	else
		IRQEnable();
	if(FIQ)
	{
		INT_SET_FIQ(int_num);
	}
	else
	{
		INT_SET_IRQ(int_num);
	}
		switch(level)
		{
			case 0://slot 0
				VICVectCntl0 = 0x20 | int_num;			
				VICVectAddr0 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 1://slot 1
				VICVectCntl1 = 0x20 | int_num;			
				VICVectAddr1 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 2://slot 2
				VICVectCntl2 = 0x20 | int_num;			
				VICVectAddr2 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 3://slot 3
				VICVectCntl3 = 0x20 | int_num;			
				VICVectAddr3 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 4://slot 4
				VICVectCntl4 = 0x20 | int_num;			
				VICVectAddr4 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 5://slot 5
				VICVectCntl5 = 0x20 | int_num;			
				VICVectAddr5 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 6://slot 6
				VICVectCntl6 = 0x20 | int_num;			
				VICVectAddr6 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 7://slot 7
				VICVectCntl7 = 0x20 | int_num;			
				VICVectAddr7 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 8://slot 8
				VICVectCntl8 = 0x20 | int_num;			
				VICVectAddr8 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 9://slot 9
				VICVectCntl9 = 0x20 | int_num;			
				VICVectAddr9 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 10://slot 10
				VICVectCntl10 = 0x20 | int_num;			
				VICVectAddr10 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 11://slot 11
				VICVectCntl11 = 0x20 | int_num;			
				VICVectAddr11 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 12://slot 12
				VICVectCntl12 = 0x20 | int_num;			
				VICVectAddr12 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 13://slot 13
				VICVectCntl13 = 0x20 | int_num;			
				VICVectAddr13 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 14://slot 14
				VICVectCntl14 = 0x20 | int_num;			
				VICVectAddr14 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			case 15://slot 15
				VICVectCntl15 = 0x20 | int_num;			
				VICVectAddr15 = Int_Func;	
				VICIntEnable = 1 << int_num;	
			break;
			}

	
	return OK;	
			
}

⌨️ 快捷键说明

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