此帖出自WindowsCE论坛
最新回复
最近杂事太多,效率也低,问题现在还没完全解决
独立出一个串口,复制了一份原来的驱动和注册表
因为COM2得TxD和RxD连在了一起,与外部设备通信时,就得发送时屏蔽接收,接收时屏蔽发送,所以我做了如下修改:
void CPdd2440Uart::XmitInterruptHandler(PUCHAR pTxBuffer, ULONG *pBuffLen)
{
PREFAST_DEBUGCHK(pBuffLen!=NULL);
m_HardwareLock.Lock();
if (*pBuffLen == 0)
{
EnableXmitInterrupt(FALSE);
}
else
{
DEBUGCHK(pTxBuffer);
PulseEvent(m_XmitFlushDone);
DWORD dwDataAvaiable = *pBuffLen;
*pBuffLen = 0;
Rx_Pause(TRUE);
if((m_DCB.fOutxCtsFlow &&IsCTSOff())||(m_DCB.fOutxDsrFlow && IsDSROff()))
{ // We are in flow off
DEBUGMSG(ZONE_THREAD|ZONE_WRITE,(TEXT("CPdd16550::XmitInterruptHandler!
Flow Off, Data Discard.\r\n")));
EnableXmitInterrupt(FALSE);
}
else
{
DWORD dwWriteSize = GetWriteableSize();
DEBUGMSG(ZONE_THREAD|ZONE_WRITE,(TEXT("CPdd16550::XmitInterruptHandler!
WriteableSize=%x to FIFO,dwDataAvaiable=%x\r\n"),
dwWriteSize,dwDataAvaiable));
[color=#FF0000]
g_ps3c2440IOPRegs->GPHCON &= 0x3ff3ff; // Close RxD1
g_ps3c2440IOPRegs->GPHCON &= 0x3ffcff; // Open TxD1
g_ps3c2440IOPRegs->GPHCON |= 0x000200;
g_ps3c2440IOPRegs->GPHUP &= 0xfef;
[/color]
for (DWORD dwByteWrite=0; dwByteWriteWrite_UTXH(*pTxBuffer);
CardTraBuffer[CardTraBuffIndex++] = *pTxBuffer;
pTxBuffer ++;
dwDataAvaiable--;
}
RETAILMSG(1, (TEXT("dwByteWrite = %d\r\n"), dwByteWrite));
DEBUGMSG(ZONE_THREAD|ZONE_WRITE,(TEXT("CPdd16550::XmitInterruptHandler! Write %d byte to FIFO\r\n"),dwByteWrite));
*pBuffLen = dwByteWrite;
EnableXmitInterrupt(TRUE);
}
ClearInterrupt(S2440UART_INT_TXD);
[color=#FF0000]
RETAILMSG(1, (TEXT("ClearInterrupt(S2440UART_INT_TXD)\r\n")));
g_ps3c2440IOPRegs->GPHCON &= 0x3ffcff; // Close TxD1
g_ps3c2440IOPRegs->GPHCON &= 0x3ff3ff; // Open RxD1
g_ps3c2440IOPRegs->GPHCON |= 0x000800;
g_ps3c2440IOPRegs->GPHUP &= 0xfdf;
[/color]
if (m_pReg2440Uart->Read_ULCON() & (0x1> 0x8 ) & 0x3f );
Rx_Pause(FALSE);
}
m_HardwareLock.Unlock();
}
复制代码
增加了红色部分的内容,数据发送正常,但是发现接收时数据有时能收到有时收不到,请大侠们指教指教。
详情
回复
发表于 2009-8-13 01:49
| ||
|
||
此帖出自WindowsCE论坛
| ||
|
||
此帖出自WindowsCE论坛
| ||
|
||
| |
|
|
| |
|
|
此帖出自WindowsCE论坛
| ||
|
||
此帖出自WindowsCE论坛
| ||
|
||
| |
|
|
| |
|
|
| |
|
|
| |
|
|
此帖出自WindowsCE论坛
| ||
|
||
| |
|
|
| |
|
|
| |
|
|
此帖出自WindowsCE论坛
| ||
|
||
此帖出自WindowsCE论坛
| ||
|
||
EEWorld Datasheet 技术支持