📄 uart.c
字号:
#include <stdio.h>
#include <std.h>
#include <sys.h>
#include <csl.h>
#include <csl_edma.h>
#include <csl_gpio.h>
#include "evmdm642.h"
#include "evmdm642_uart.h"
#define ICETEKDM642PCI_UART_BAUD115200 10
#define ICETEKDM642PCI_UART_BAUD57600 20
#define ICETEKDM642PCI_UART_BAUD38400 30
#define ICETEKDM642PCI_UART_BAUD19200 60
#define ICETEKDM642PCI_UART_BAUD9600 120
#define ICETEKDM642PCI_UART_BAUD4800 240
#define ICETEKDM642PCI_UART_BAUD2400 480
#define ICETEKDM642PCI_UART_BAUD1200 960
/* Flag to make sure POST only runs once after power cycle */
Uint32 testflag;
Int16 TEST_uartA()
{
EVMDM642_UART_Handle hUart;
EVMDM642_UART_Config uartcfg = {
0x00, // IER
0x57, // FCR - FIFO Mode, 16 character trigger level
0x03, // LCR - 8 bits, no parity, 1 stop
0x00 // MCR
};
/* Open UART */
hUart = EVMDM642_UART_open(EVMDM642_UARTA, ICETEKDM642PCI_UART_BAUD9600, &uartcfg);
while ( 1 )
{
EVMDM642_UART_putChar(hUart, EVMDM642_UART_getChar(hUart));
}
return 0;
}
main()
{
/* Call BSL init */
EVMDM642_init();
/* Run the tests sequentially */
TEST_uartA();
/* Disable interrupts */
IRQ_globalDisable();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -