This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM6437 UART发射端ready的问题



在UART通信的一个例程中,使用UART向外部发送若干字节数据。对其中判断UART发射端是否准备好的函数:

EVMDM6437_UART_xmtReady()这个函数,直接使用没有问题。但是我跟踪找到源代码后,自己包装一个函数后就一直不能返回正确的值:

Int16 UART_xmtReady( UART_Handle uart_handle )
{
Uint8 iir_status = ( uart_handle->regs->IIR >> 1 ) & 0x0E;

if ( iir_status == 0 ) // Check for No Interrupts
return 0;
else if ( iir_status == 1 ) // Check for Current TX emptying
return 1;
else // Everything else
return 2;
}

这是为什么呢?是不是程序运行时实际跑的并不是这个源代码呢?