通过简单的流驱动发送接收,接收也没产生中断,但发送一个字节,能够读到一个字节的正确数据。有可能是芯片质量问题?放弃用中断了,准备用FIFO查询模式,有点疑问,这个函数
ReceiveInterruptHandler(PUCHAR pRxBuffer,ULONG *pBufflen)
是在
ULONG SerRxIntr(
PVOID pHead, // @parm Pointer to hardware head
PUCHAR pRxBuffer, // @parm Pointer to receive buffer
ULONG *pBufflen // @parm In = max bytes to read, out = bytes read
)
{
DEBUGMSG (ZONE_READ|ZONE_EVENTS,(TEXT("+SerRxIntr( 0x%X,0x%X,0x%X)\r\n"),
pHead,pRxBuffer,(pBufflen!=NULL?*pBufflen:0)));
DWORD dwReturn=0;
CSerialPDD * pSerialPDD = ( CSerialPDD * )pHead;
if (pSerialPDD)
dwReturn = pSerialPDD->ReceiveInterruptHandler(pRxBuffer,pBufflen);
DEBUGMSG (ZONE_READ|ZONE_EVENTS,(TEXT("-SerRxIntr( 0x%X,0x%X,0x%X) return 0x%X\r\n"),
pHead,pRxBuffer,(pBufflen!=NULL?*pBufflen:0),dwReturn));
return dwReturn;
}
里面调用的,现在没弄明白通过查询模式,我应该怎么传递PUCHAR pRxBuffer,ULONG *pBufflen这两个参数?传递到哪里去才能够正常呢?看了好久,没找到源头。
在mdd的代码里面,COM_READ pTargetBuffer的值是通过
CeSafeCopyMemory (pTargetBuffer,RxBuffRead(pSerialHead), Len);得到的。
而在serpriv.h 中定义了
#define RxBuffRead(pSH) (pSH->RxBufferInfo.RxCharBuffer+pSH->RxBufferInfo.Read)
#define RxRead(pSH) (pSH->RxBufferInfo.Read)
在COM_IOControl 中,
case IOCTL_SERIAL_PURGE : //清除制定的发送或接收缓冲内的数据
pHWIHead->RxBufferInfo.Read = pHWIHead->RxBufferInfo.Write;
RxBufferInfo.Read的值是怎么得到的呢?我看到COM_READ中,执行了
CeSafeCopyMemory (pTargetBuffer,RxBuffRead(pSerialHead), Len);
// Update Fifo info
RxRead(pSerialHead) =
(RxRead(pSerialHead)+ Len