在Windows2000下用多线程实现1394串行总线通信
sp; file://开中断
WD_IntWait(hWD,&Intrp); file://等待中断
…… file://判断中断类型,复位中断寄存器
if(RxDta) file://接收中断
{ Data = QuadletReadLLC(GRFStatusReg); file://读GRF状态寄存器
WriteCount = (BYTE)Data & 0xff; file://获得接收数据包的大小
pt = (PLISTBLOCK)malloc(sizeof(LISTBLOCK)); file://申请节点pt存放数据包
pd = (DWORD*)malloc(WriteCount*sizeof(DWORD));
pt->pdata = pd;
pt->next = NULL;
for(i=0;i<=WriteCount;i++,pd++) &n
*pd = QuadletReadLLC(GRFReg);
ps = &rBuf; file://给链表rBuf尾插入数据节点pt
while(ps->next!=NULL) ps=ps->next;
ps->next = pt;
SendMessage(hWnd,WM_MY_MESSAGE,0,0); file://发送接收到数据包的消息
}
if(TxRdy) file://发送中断
{ m_cs.Lock(); file://锁定临界资源
p = &sBuf;
if(p->next!=NULL) file://sBuf不为空
&nbs 《在Windows2000下用多线程实现1394串行总线通信(第3页)》
本文链接地址:http://www.oyaya.net/fanwen/view/176731.html
WD_IntWait(hWD,&Intrp); file://等待中断
…… file://判断中断类型,复位中断寄存器
if(RxDta) file://接收中断
{ Data = QuadletReadLLC(GRFStatusReg); file://读GRF状态寄存器
WriteCount = (BYTE)Data & 0xff; file://获得接收数据包的大小
pt = (PLISTBLOCK)malloc(sizeof(LISTBLOCK)); file://申请节点pt存放数据包
pd = (DWORD*)malloc(WriteCount*sizeof(DWORD));
pt->pdata = pd;
pt->next = NULL;
for(i=0;i<=WriteCount;i++,pd++) &n
bsp; file://读GRF的数据
*pd = QuadletReadLLC(GRFReg);
ps = &rBuf; file://给链表rBuf尾插入数据节点pt
while(ps->next!=NULL) ps=ps->next;
ps->next = pt;
SendMessage(hWnd,WM_MY_MESSAGE,0,0); file://发送接收到数据包的消息
}
if(TxRdy) file://发送中断
{ m_cs.Lock(); file://锁定临界资源
p = &sBuf;
if(p->next!=NULL) file://sBuf不为空
&nbs 《在Windows2000下用多线程实现1394串行总线通信(第3页)》