📄 seed_dvs_uart.c
字号:
/*
* Copyright 2006 by Spectrum Digital Incorporated.
* All rights reserved. Property of Spectrum Digital Incorporated.
*/
/*
* UART Test
*
*/
#include "seed_dvs6446_uart.h"
Uint16 tech;
/* ------------------------------------------------------------------------ *
* *
* uart_test( ) *
* Simple UART loopback test. *
* Will write then read back the byte sent to the RS232 connector. *
* *
* ------------------------------------------------------------------------ */
Int16 uart_test()
{
Int16 i, errors = 0;
UART_HANDLE uart0;
Int32 timeout = 0;
Int32 test_timeout = 0x100000;
/* Open Uart Handle */
uart0 =DVS6446_UART_open( 1, 115200 );
if ( uart0 == ( UART_HANDLE )-1 )
return 1;
/* Setup buffers */
for ( i = 0 ; i < 0x100 ; i++ )
{
tx[i] = 0;
rx[i] = 'a'+i;
}
/* UART Test */
DAVINCIEVM_GPIO_setOutput(28,0);//here added by phoenix for uart1 2007/11/01
_wait(1000);
for ( i = 0 ; i < 0x100 ; i++ )
{
timeout = test_timeout;
while( DVS6446_UART_rcvReady( uart0 ) ) // Wait for Rx ready
{
if ( timeout-- < 0 )
return -1;
}
DVS6446_UART_getChar( uart0, &tx[i] ); // Read 1 byte
}
UART1_IIR=0xC0;
for ( i = 0 ; i < 0x100 ; i++ )
{
DAVINCIEVM_GPIO_setOutput(28,1);//here added by phoenix for uart1 2007/11/01
_wait(1000);
while( DVS6446_UART_xmtReady( uart0 ) ) // Wait for TX ready
{
if ( timeout-- < 0 )
return -2;
}
DVS6446_UART_putChar( uart0, tx[i] ); // Write 1 byte
}
return errors;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -