APP下:
配置BD文件:
#define PADS_TCON_CONFIG Unknown_pad_mux#define PADS_UART2_MODE Unknown_pad_mux#define PADS_UART3_MODE Unknown_pad_mux#define PADS_UART4_MODE UART4_MODE(1)#define PADS_FAST_UART_MODE Unknown_pad_mux#define PADS_3DLR_MODE Unknown_pad_mux#define PADS_TTL_MODE Unknown_pad_mux#define PADS_USBDRVVBUS Unknown_pad_mux
SW_Config.h 文件 ENABLE_UART2
#ifndef ENABLE_FAVORITE_NETWORK #if ENABLE_RIKS_TV #define ENABLE_FAVORITE_NETWORK ENABLE#else #define ENABLE_FAVORITE_NETWORK DISABLE #endif#endif#ifndef ENABLE_UART2 #define ENABLE_UART2 ENABLE#endif#ifndef ENABLE_ARC_CHANGE_SPDIF#define ENABLE_ARC_CHANGE_SPDIF DISABLE#endif#ifndef ENABLE_SUPPORT_MM_PHOTO_4K_2K #define ENABLE_SUPPORT_MM_PHOTO_4K_2K DISABLE#endif
drvUartDebug.c
void MDrv_UART2_DebugInit(void){ PrintfUart2(printf("MDrv_UART2_DebugInit()\n")); // reset Uart variables MS_U16 u16Res = 0x00; g_Uart2Command.Index = 0; g_Uart2CheckTick = 0; uart2_debug = mdrv_uart_open(E_UART_PIU_UART0); PrintfUart2(printf("[UART2Init]mdrv_uart_open()>>%u\n", uart2_debug)); u16Res = mdrv_uart_connect(E_UART_PORT3, E_UART_PIU_UART0); PrintfUart2(printf("[UART2Init]mdrv_uart_connect()>>%u\n", u16Res));...}
测试:
drvUartDebug.c
void MDrv_UART_ExecTestCommand(void){ switch( g_UartCommand.Buffer[_UART_CMD_INDEX1_] ) { case 0x60: MDrv_UART_ExecUserDefinedCommand(); break; #if(ENABLE_UART2) #if(ENABLE_UART2_TEST) case 0x4B: printf("[4B]UART2_TXD >> 12345678\n"); MDrv_UART2_TestTXD(); break; #endif #endif}
UART1发送测试命令:
UART2接收如下:
PM下:
drvGlobal.h
#define UART_SRC_NONE 0#define UART_SRC_AEONR2 1#define UART_SRC_PIUUART0 2#define UART_SRC_PIUUART1 3#define USE_1ST_UART UART_SRC_AEONR2//UART_SRC_PIUUART0//UART_SRC_PIUUART1#define USE_2ND_UART UART_SRC_PIUUART0 //the 2nd uart#define USE_3RD_UART UART_SRC_NONE //the 3rd uart#define USE_1ST_UART_PORT E_UART_PORT0#define USE_2ND_UART_PORT E_UART_PORT2#define USE_3RD_UART_PORT E_UART_PORT_INVALID#define USE_UART_BAUDRATE 115200//38400
测试:
uartdebug.c
void MDrv_UART_ExecTestCommand(void){ U8 ucPara1; U8 ucPara2; U8 ucPara3; ucPara1 = g_UartCommand.Buffer[_UART_CMD_INDEX2_]; ucPara2 = g_UartCommand.Buffer[_UART_CMD_INDEX3_]; ucPara3 = g_UartCommand.Buffer[_UART_CMD_INDEX4_];// printf(">> MDrv_UART_DecodeExtCommand(%x) \r\n", g_UartCommand.Buffer[_UART_CMD_INDEX1_]); switch ( g_UartCommand.Buffer[_UART_CMD_INDEX1_] ) { case 0x4B: { MS_U8 u8TXDList[8] = { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}; mdrv_uart_write(uart2_debug, u8TXDList, 8); printf("222\r\n"); } break; }}