copy论坛程序,简化目的希望每次中断后打印数据,验证中断的触发。代码如下:
/*includes*/
#include "vxworks.h"
#include "ioLib.h"
#include "stdio.h"
#include "selectLib.h"
#include "errnoLib.h"
#include "intLib.h"
#include "taskLib.h"
#include "logLib.h"
#include "string.h"
#include "arch/i86/ivI86.h"
#include "semLib.h"
#include "sysLib.h"
/*function status*/
void interruptHandler();
/* globals */
#define INT_NUM_IRQ0 0x20
#define COM2_INT_LVL 0x03
#define INT_NUM_COM2 (INT_NUM_IRQ0 + COM2_INT_LVL)
#define STACK_SIZE 1024*40
#define BUF_SIZE 1024
/*main function*/
int serialmain( )
{
/*open COM2*/
int SerialDevFd=open("/tyCo/1",O_RDWR,0644);
if(ERROR==SerialDevFd)
{
logMsg("open_com:Unable to open/tyCo/0",0,0,0,0,0,0);
return 0;
}
if(ERROR==ioctl(SerialDevFd,FIOSETOPTIONS,OPT_RAW))
{
logMsg("can not set tty options!\n",0,0,0,0,0,0);
return 0;
}
/*Set baudrate*/
if(ERROR==ioctl(SerialDevFd,FIOBAUDRATE,9600))
{
logMsg("can not set BAUDRATE!\n",0,0,0,0,0,0);
return 0;
}
/*flush the buffer*/
if(ERROR==ioctl(SerialDevFd,FIOFLUSH,0))
{
logMsg("can not flush the buffer!\n",0,0,0,0,0,0);
return 0;
}
sysIntDisablePIC(COM2_INT_LVL);
intConnect(INUM_TO_IVEC(INT_NUM_COM2),(VOIDFUNCPTR)interruptHandler,0);
sysIntEnablePIC(COM2_INT_LVL);
return 1;
}
/*interrupt service routine*/
void interruptHandler( )
{
int level=intLock();
logMsg("give Recv sem OK!\n",0,0,0,0,0,0);
intUnlock(level);
return;
}
结果只打印一次数据,即中断之响应一次。再次执行时,无响应。请问高手串口中断接受怎样处理!
在中断中添加sysOutByte(0xa0,0x20), sysOutByte(0x20,0x20),仍就响应一次.似乎串口仍旧没有释放
[align=right][color=#000066][此贴子已经被作者于2005-10-26 13:22:26编辑过][/color][/align]