发 帖  
原厂入驻New
[问答] 请问在哪里可以找到UARTStdioConfig的函数说明?
2020-8-27 17:05:09  105 UARTStdioConfig
分享
如题,UARTStdioConfig 这个函数可以再哪里可以找到。

这个函数是UART的标准输入输出的配置么?
0
2020-8-27 17:05:09   评论 分享淘帖
4 个讨论
这个函数不是库函数中的函数,应该是自己写的配置函数。标准的配置函数应该是这个
UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
2020-8-27 17:15:14 评论

举报

ROM_UARTConfigSetExpClk(), C API 在"\\driverlib\uart.c
UARTStdioConfig(), C API 在 "\\utils\uartstdio.c"
                                                                         Holly
2020-8-27 17:30:42 评论

举报

ctx1129 发表于 2020-8-27 19:31
ROM_UARTConfigSetExpClk(), C API 在"\\driverlib%uart.c" 
UARTStdioConfig(), C API 在 "\%utils%uartstdio.c"
                                                                         Holly

果然是第三方库的函数,我说么怎么在外设库中找不到。
2020-8-27 17:43:08 评论

举报

这个函数是在utils\uartstdio.c中实现的。
//*****************************************************************************
//
//! Configures the UART console.
//!
//! \param ui32PortNum is the number of UART port to use for the serial console
//! (0-2)
//! \param ui32Baud is the bit rate that the UART is to be configured to use.
//! \param ui32SrcClock is the frequency of the source clock for the UART
//! module.
//!
//! This function will configure the specified serial port to be used as a
//! serial console. The serial parameters are set to the baud rate
//! specified by the \e ui32Baud parameter and use 8 bit, no parity, and 1 stop
//! bit.
//!
//! This function must be called prior to using any of the other UART console
//! functions: UARTprintf() or UARTgets(). This function assumes that the
//! caller has previously configured the relevant UART pins for operation as a
//! UART rather than as GPIOs.
//!
//! \return None.
//
//*****************************************************************************
void
UARTStdioConfig(uint32_t ui32PortNum, uint32_t ui32Baud, uint32_t ui32SrcClock)
[
//
// Check the arguments.
//
ASSERT((ui32PortNum == 0) || (ui32PortNum == 1) ||
(ui32PortNum == 2));
#ifdef UART_BUFFERED
//
// In buffered mode, we only allow a single instance to be opened.
//
ASSERT(g_ui32Base == 0);
#endif
//
// Check to make sure the UART peripheral is present.
//
if(!MAP_SysCtlPeripheralPresent(g_ui32UARTPeriph[ui32PortNum]))
[
return;
]
//
// Select the base address of the UART.
//
g_ui32Base = g_ui32UARTBase[ui32PortNum];
//
// Enable the UART peripheral for use.
//
MAP_SysCtlPeripheralEnable(g_ui32UARTPeriph[ui32PortNum]);
//
// Configure the UART for 115200, n, 8, 1
//
MAP_UARTConfigSetExpClk(g_ui32Base, ui32SrcClock, ui32Baud,
(UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE |
UART_CONFIG_WLEN_8));
#ifdef UART_BUFFERED
//
// Set the UART to interrupt whenever the TX FIFO is almost empty or
// when any character is received.
//
MAP_UARTFIFOLevelSet(g_ui32Base, UART_FIFO_TX1_8, UART_FIFO_RX1_8);
//
// Flush both the buffers.
//
UARTFlushRx();
UARTFlushTx(true);
//
// Remember which interrupt we are dealing with.
//
g_ui32PortNum = ui32PortNum;
//
// We are configured for buffered output so enable the master interrupt
// for this UART and the receive interrupts. We don't actually enable the
// transmit interrupt in the UART itself until some data has been placed
// in the transmit buffer.
//
MAP_UARTIntDisable(g_ui32Base, 0xFFFFFFFF);
MAP_UARTIntEnable(g_ui32Base, UART_INT_RX | UART_INT_RT);
MAP_IntEnable(g_ui32UARTInt[ui32PortNum]);
#endif
//
// Enable the UART operation.
//
MAP_UARTEnable(g_ui32Base);
]
2020-8-27 17:55:39 评论

举报

只有小组成员才能发言,加入小组>>

1450个成员聚集在这个小组

加入小组

创建小组步骤

关闭

站长推荐 上一条 /7 下一条

快速回复 返回顶部 返回列表