这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » 请教s3c4510外中断问题

共3条 1/1 1 跳转至

请教s3c4510外中断问题

菜鸟
2006-02-13 18:25:58     打赏

请问各位大虾们,我用的三星原版4510的评估版编了一个外中断测试程序,可怎么也进不了中断,请大虾们指点

/* ISR_test.c */
#include "vxWorks.h"
#include "intLib.h"
#include "taskLib.h"
#include "iv.h"
#include "logLib.h"

/*function prototype*/
void interruptHandler(int);
void interruptCatcher(void);

/*globals */
#define INTERRUPT_NUM 2
#define INTERRUPT_LEVEL 65
#define ITER1 40
#define LONG_TIME 1000000
#define PRIORITY 100
#define ONE_SENCOND 100

#define INT_LVL_EXTINT0 0 /* External Interrupt0 */
#define INT_VEC_EXTINT0 IVEC_TO_INUM(INT_LVL_EXTINT0) /* External Interrupt0*/
void IsrTest(void)
{
int i,j,taskId,priority;
STATUS taskAlive;
if((taskId=taskSpawn("interruptCatcher",PRIORITY,0x100,20000,(FUNCPTR)interruptCatcher,0,0,0,0,0,0,0,0,0,0))==ERROR)
logMsg("taskSpawn interCatcher failed\n",0,0,0,0,0,0);

for(i=0;i<ITER1;i++)
{
taskDelay(ONE_SENCOND);
if((taskAlive=taskIdVerify(taskId))==OK)
{
logMsg("++++++++interrupt generated\n",0,0,0,0,0,0);
/*if(sysBusIntGen(INTERRUPT_NUM,INTERRUPT_LEVEL)==ERROR)
logMsg("interrupt not generated\n",0,0,0,0,0,0);*/
}
else
break;
}
logMsg("\n*****************interruptGenerator exited **********\n\n\n\n",0,0,0,0,0,0);
}

void interruptCatcher(void)
{
int i,j;
STATUS connected;

if((connected=intConnect ( ( VOIDFUNCPTR * )INUM_TO_IVEC(INT_LVL_EXTINT0), (VOIDFUNCPTR)interruptHandler, i ) )==ERROR)
logMsg("intConnect failed\n",0,0,0,0,0,0);
/*使能这中断 */
if(intEnable (INT_LVL_EXTINT0)==ERROR)
logMsg("intEnable fail \n",0,0,0,0,0,0);
INTMASK=0x0;
for(i=0;i<ITER1;i++)
{
for(j=0;j<LONG_TIME;j++);
logMsg("Normal processing in interruptCatcher\n",0,0,0,0,0,0);
}

logMsg("\n++++++++++++interruptCatcher exited +++++\n",0,0,0,0,0,0);
}
void interruptHandler(int arg)
{
int i;

logMsg("--------------interrupt caught\n",0,0,0,0,0,0);
for(i=0;i<5;i++)
logMsg("interrupt processing\n",0,0,0,0,0,0);
}




关键词: 请教     s3c4510     中断     问题     logMsg    

菜鸟
2006-02-14 16:18:00     打赏
2楼

问题解决了,i/o寄存器需要设置一下

IOPCON|=0x0b5ad6; /*4个外中断均打开 */


菜鸟
2006-03-12 07:28:00     打赏
3楼

不知楼主用的外部中断源的频率是多少?

如直接用固定频率的方波作为中断源,能达到多大频率,可以将答应信息去掉,因为打印信息会影响中断函数的处理速度.


共3条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]