UART3 Demo
```language
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
#include <ctype.h>
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include "osa.h"
#include "UART.h"
#include "sockets.h"
#include "ip_addr.h"
#include "netdb.h"
#include "sys.h"
#include "sdk_api.h"
#undef printf
#define printf(fmt, args...) do { fatal_printf("[sdk]"fmt, ##args); } while(0)
#define UPCASE( c ) ( ((c) >= 'a' && (c) <= 'z') ? ((c) - 0x20) : (c) )
#define sleep(x) OSATaskSleep((x) * 200)//second
extern OSMsgQRef uart3DataMsgQ;
static void uart3_thread(void);
// Device bootup hook before Phase1Inits.
// If you have some work to be init, you may implete it here.
// ex: you may start your task here. or do some initialize here.
extern void Phase1Inits_enter(void);
// Device bootup hook after Phase1Inits.
// If you have some work to be init, you may implete it here.
// ex: you may start your task here. or do some initialize here.
extern void Phase1Inits_exit(void);
// Device bootup hook before Phase2Inits.
// If you have some work to be init, you may implete it here.
// ex: you may start your task here. or do some initialize here.
extern void Phase2Inits_enter(void);
// Device bootup hook after Phase2Inits.
// If you have some work to be init, you may implete it here.
// ex: you may start your task here. or do some initialize here.
extern void Phase2Inits_exit(void);
void Phase1Inits_enter(void)
{
}
void Phase1Inits_exit(void)
{
}
void Phase2Inits_enter(void)
{
}
void Phase2Inits_exit(void)
{
OSA_STATUS status;
printf("%s[%d]: starting...\n", __FUNCTION__, __LINE__);
status = OSAMsgQCreate(&uart3DataMsgQ, "uart3DataMsgQ", sizeof(uart3DataParam), 300, OS_FIFO);
DIAG_ASSERT(status == OS_SUCCESS);
sys_thread_new("uart3_thread", uart3_thread, NULL, DEFAULT_THREAD_STACKSIZE*2, 161);
}
static void uart3_thread(void)
{
uart3DataParam uart3_temp;
OSA_STATUS status;
UART_BaudRates baud;
UART3_ENABLE(); // enable the uart3 without GPS
baud = UART3_GET_BAUD();
printf("%s: baud %d\n", __FUNCTION__, baud);
//UART3_SET_BAUD(115200);
while (1) {
memset(&uart3_temp, 0, sizeof(uart3DataParam));
status = OSAMsgQRecv(uart3DataMsgQ, (UINT8 *)&uart3_temp, sizeof(uart3DataParam), OSA_SUSPEND);//recv data from uart
if (status == OS_SUCCESS) {
if (uart3_temp.UArgs) {
printf("%s[%d]: uart3_temp len:%d, data:%s\n", __FUNCTION__, __LINE__, uart3_temp.len, (char *)(uart3_temp.UArgs));
UART3_SEND_DATA((char *)(uart3_temp.UArgs),uart3_temp.len);
free(uart3_temp.UArgs);
}
}
}
}
```