我使用了如此下的配置程序配置TMS320c6747芯片的UART1口,调用程序后正确返回了句柄,uart_handle->regs的确是指向了uart1的地址。在下面的配置程序中,尽管对uart_handle->regs->FCR配置了参数,但是在ccs3.3中观察到该寄存器的值依旧没有改变,这是为什么呢???望各位不吝赐教!!!(附件中有我用的完整程序)
/* ------------------------------------------------------------------------ *
* *
* _UART_open( id, baudrate ) *
* *
* Open UART handle *
* *
* ------------------------------------------------------------------------ */
UART_Handle EVMC6747_UART_open( Uint16 id, Uint32 baudrate )
{
UART_Handle uart_handle;
Uint32 divisor;
volatile Uint16 dummy;
/*
* UART clk / baudrate
* = 24,000,000 / (115200 * 16)
*/
divisor = 24000000 / ( baudrate * 16);
switch ( id )
{
case 0:
uart_handle = ( UART_Handle )&UART_MODULE_0;
break;
case 1:
uart_handle = ( UART_Handle )&UART_MODULE_1;
break;
case 2:
uart_handle = ( UART_Handle )&UART_MODULE_2;
break;
default:
return ( UART_Handle )-1;
}
uart_handle->regs->PWREMU_MGMT = 0; // Reset UART TX & RX components
EVMC6747_wait( 100 );
uart_handle->regs->DLL = (divisor & 0xff); // Set baud rate
uart_handle->regs->DLH = (divisor >> 8);
uart_handle->regs->FCR = 0x0007; // Clear UART TX & RX FIFOs
uart_handle->regs->FCR = 0x0000; // Non-FIFO mode
uart_handle->regs->IER = 0x0007; // Enable interrupts
uart_handle->regs->LCR = 0x0003; // 8-bit words,
// 1 STOP bit generated,
// No Parity, No Stick paritiy,
// No Break control
uart_handle->regs->MCR = 0x0000; // RTS & CTS disabled,
// Loopback mode disabled,
// Autoflow disabled
uart_handle->regs->PWREMU_MGMT = 0xE001; // Enable TX & RX componenets
// Clear any pre-existing characters
dummy = uart_handle->regs->THR;
return uart_handle;
}