阅读:1287回复:3
pci驱动,向io写数据时死机。
NTSTATUS PCIADLINKDevice::CAN0_0_Handler(KIrp I)
{ NTSTATUS status=STATUS_SUCCESS; ULONG dwtotalsize=I.IoctlInputBufferSize(CURRENT); //bytes t << "CAN0_0:********************" << EOL; if(dwtotalsize>0) { if(I.IoctlBuffer()== NULL) { I.Information() = 0; return STATUS_UNSUCCESSFUL; } else { PUCHAR pbuffer=(PUCHAR)I.IoctlBuffer(); t<<"CAN0_0_Send:********************"<<pbuffer[0]<<EOL; t<<"CAN0_0_SendNUM:*****************"<<dwtotalsize<<EOL; m_IoPortRange1.outb(0,pbuffer,dwtotalsize); return STATUS_SUCCESS; } } else { UCHAR m_CON=m_IoPortRange1.inb(0); if(I.IoctlOutputBufferSize()>=sizeof(UCHAR)) { t<<"CAN0_0:RECEIVE:********************"<<m_CON<<EOL; *(UCHAR*)I.IoctlBuffer()=m_CON; I.Information()=sizeof(UCHAR); return STATUS_SUCCESS; } else { I.Information() = 0; return STATUS_BUFFER_TOO_SMALL; } } } NTSTATUS PCIADLINKDevice::CAN0_1_Handler(KIrp I) { NTSTATUS status=STATUS_SUCCESS; ULONG dwtotalsize=I.IoctlInputBufferSize(CURRENT); //bytes t << "CAN0_1:********************" << EOL; if(dwtotalsize>0) { if(I.IoctlBuffer()== NULL) { I.Information() = 0; return STATUS_UNSUCCESSFUL; } else { PUCHAR pbuffer=(PUCHAR)I.IoctlBuffer(); t<<"CAN0_1:Send:********************"<<pbuffer[0]<<EOL; m_IoPortRange1.outb(1,pbuffer,dwtotalsize); return STATUS_SUCCESS; } } else { UCHAR m_CON=m_IoPortRange1.inb(1); if(I.IoctlOutputBufferSize()>=sizeof(UCHAR)) { t<<"CAN0_1:RECEIVE:********************"<<m_CON<<EOL; *(UCHAR*)I.IoctlBuffer()=m_CON; I.Information()=sizeof(UCHAR); return STATUS_SUCCESS; } else { I.Information() = 0; return STATUS_BUFFER_TOO_SMALL; } } } 读数据没有什么问题,写数据时,如果向CAN0_1写了数据,在向CAN0_0写数据,就会死机。 请教时什么原因?谢谢! [编辑 - 8/10/04 by mapofl] |
|
沙发#
发布于:2004-08-09 09:39
METHOD_BUFFERED方式
|
|
板凳#
发布于:2004-08-11 08:36
读都没有问题,单独一个一个写也没有问题,但是如果连续向这几个IO写数据就
会死机。 兰屏,并且出现: *** Hardware Malfunction Call your hardware vendor for support NMI:Parity check /Memory Parity Error NMI:Channel check /IOCHK *** The system has halted *** 请教可能使什么原因?谢谢! [编辑 - 8/11/04 by mapofl] |
|
地板#
发布于:2004-08-19 20:19
你这是CAN卡吗?如果是的话,要注意你的软件,如果软件编写有误,可能导致死机。
|
|