Lines Matching full:usart

133 	USART_TypeDef *usart = config->usart;  in uart_stm32_set_baudrate()  local
156 if (IS_LPUART_INSTANCE(usart)) { in uart_stm32_set_baudrate()
176 LL_LPUART_SetPrescaler(usart, presc_val); in uart_stm32_set_baudrate()
184 LL_LPUART_SetBaudRate(usart, in uart_stm32_set_baudrate()
191 __ASSERT(LL_LPUART_ReadReg(usart, BRR) >= 0x300U, in uart_stm32_set_baudrate()
195 __ASSERT(LL_LPUART_ReadReg(usart, BRR) < 0x000FFFFFU, in uart_stm32_set_baudrate()
200 LL_USART_SetOverSampling(usart, in uart_stm32_set_baudrate()
203 LL_USART_SetBaudRate(usart, in uart_stm32_set_baudrate()
213 __ASSERT(LL_USART_ReadReg(usart, BRR) >= 16, in uart_stm32_set_baudrate()
226 LL_USART_SetParity(config->usart, parity); in uart_stm32_set_parity()
233 return LL_USART_GetParity(config->usart); in uart_stm32_get_parity()
241 LL_USART_SetStopBitsLength(config->usart, stopbits); in uart_stm32_set_stopbits()
248 return LL_USART_GetStopBitsLength(config->usart); in uart_stm32_get_stopbits()
256 LL_USART_SetDataWidth(config->usart, databits); in uart_stm32_set_databits()
263 return LL_USART_GetDataWidth(config->usart); in uart_stm32_get_databits()
271 LL_USART_SetHWFlowCtrl(config->usart, hwctrl); in uart_stm32_set_hwctrl()
278 return LL_USART_GetHWFlowCtrl(config->usart); in uart_stm32_get_hwctrl()
288 LL_USART_EnableDEMode(config->usart); in uart_stm32_set_driver_enable()
290 LL_USART_DisableDEMode(config->usart); in uart_stm32_set_driver_enable()
298 return LL_USART_IsEnabledDEMode(config->usart); in uart_stm32_get_driver_enable()
336 if (IS_LPUART_INSTANCE(config->usart)) { in uart_stm32_cfg2ll_stopbits()
349 if (IS_LPUART_INSTANCE(config->usart)) { in uart_stm32_cfg2ll_stopbits()
499 LL_USART_ConfigCharacter(config->usart, in uart_stm32_parameters_set()
541 USART_TypeDef *usart = config->usart; in uart_stm32_configure() local
578 IS_UART_HWFLOW_INSTANCE(usart)) in uart_stm32_configure()
581 IS_UART_DRIVER_ENABLE_INSTANCE(usart)) in uart_stm32_configure()
587 LL_USART_Disable(usart); in uart_stm32_configure()
592 LL_USART_Enable(usart); in uart_stm32_configure()
628 USART_TypeDef *usart,
634 USART_TypeDef *usart = config->usart; in uart_stm32_poll_in_visitor() local
637 if (LL_USART_IsActiveFlag_ORE(usart)) { in uart_stm32_poll_in_visitor()
638 LL_USART_ClearFlag_ORE(usart); in uart_stm32_poll_in_visitor()
645 if (!LL_USART_IsActiveFlag_RXNE(usart)) { in uart_stm32_poll_in_visitor()
649 get_fn(usart, in); in uart_stm32_poll_in_visitor()
655 USART_TypeDef *usart, uint16_t out);
660 USART_TypeDef *usart = config->usart; in uart_stm32_poll_out_visitor() local
667 * When TXE flag is raised, we lock interrupts to prevent interrupts (notably that of usart) in uart_stm32_poll_out_visitor()
672 if (LL_USART_IsActiveFlag_TXE(usart)) { in uart_stm32_poll_out_visitor()
674 if (LL_USART_IsActiveFlag_TXE(usart)) { in uart_stm32_poll_out_visitor()
697 LL_USART_EnableIT_TC(usart); in uart_stm32_poll_out_visitor()
701 set_fn(usart, out); in uart_stm32_poll_out_visitor()
705 static void poll_in_u8(USART_TypeDef *usart, void *in) in poll_in_u8() argument
707 *((unsigned char *)in) = (unsigned char)LL_USART_ReceiveData8(usart); in poll_in_u8()
710 static void poll_out_u8(USART_TypeDef *usart, uint16_t out) in poll_out_u8() argument
712 LL_USART_TransmitData8(usart, (uint8_t)out); in poll_out_u8()
727 static void poll_out_u9(USART_TypeDef *usart, uint16_t out) in poll_out_u9() argument
729 LL_USART_TransmitData9(usart, out); in poll_out_u9()
732 static void poll_in_u9(USART_TypeDef *usart, void *in) in poll_in_u9() argument
734 *((uint16_t *)in) = LL_USART_ReceiveData9(usart); in poll_in_u9()
752 USART_TypeDef *usart = config->usart; in uart_stm32_err_check() local
758 * The stm32 F4X, F1X, and F2X also reads the usart DR when clearing Errors in uart_stm32_err_check()
760 if (LL_USART_IsActiveFlag_ORE(usart)) { in uart_stm32_err_check()
764 if (LL_USART_IsActiveFlag_PE(usart)) { in uart_stm32_err_check()
768 if (LL_USART_IsActiveFlag_FE(usart)) { in uart_stm32_err_check()
772 if (LL_USART_IsActiveFlag_NE(usart)) { in uart_stm32_err_check()
777 if (LL_USART_IsActiveFlag_LBD(usart)) { in uart_stm32_err_check()
782 LL_USART_ClearFlag_LBD(usart); in uart_stm32_err_check()
786 * the stm32 F4X, F1X, and F2X sw sequence is reading the usart SR in uart_stm32_err_check()
787 * then the usart DR to clear the Error flags ORE, PE, FE, NE in uart_stm32_err_check()
791 LL_USART_ClearFlag_ORE(usart); in uart_stm32_err_check()
795 LL_USART_ClearFlag_PE(usart); in uart_stm32_err_check()
799 LL_USART_ClearFlag_FE(usart); in uart_stm32_err_check()
803 LL_USART_ClearFlag_NE(usart); in uart_stm32_err_check()
819 typedef void (*fifo_fill_fn)(USART_TypeDef *usart, const void *tx_data, const int offset);
825 USART_TypeDef *usart = config->usart; in uart_stm32_fifo_fill_visitor() local
829 if (!LL_USART_IsActiveFlag_TXE(usart)) { in uart_stm32_fifo_fill_visitor()
836 while ((size - num_tx > 0) && LL_USART_IsActiveFlag_TXE(usart)) { in uart_stm32_fifo_fill_visitor()
840 fill_fn(usart, tx_data, num_tx); in uart_stm32_fifo_fill_visitor()
849 static void fifo_fill_with_u8(USART_TypeDef *usart, const void *tx_data, const int offset) in fifo_fill_with_u8() argument
853 LL_USART_TransmitData8(usart, data[offset]); in fifo_fill_with_u8()
866 typedef void (*fifo_read_fn)(USART_TypeDef *usart, void *rx_data, const int offset);
872 USART_TypeDef *usart = config->usart; in uart_stm32_fifo_read_visitor() local
875 while ((size - num_rx > 0) && LL_USART_IsActiveFlag_RXNE(usart)) { in uart_stm32_fifo_read_visitor()
878 read_fn(usart, rx_data, num_rx); in uart_stm32_fifo_read_visitor()
882 if (LL_USART_IsActiveFlag_ORE(usart)) { in uart_stm32_fifo_read_visitor()
883 LL_USART_ClearFlag_ORE(usart); in uart_stm32_fifo_read_visitor()
894 static void fifo_read_with_u8(USART_TypeDef *usart, void *rx_data, const int offset) in fifo_read_with_u8() argument
898 data[offset] = LL_USART_ReceiveData8(usart); in fifo_read_with_u8()
913 static void fifo_fill_with_u16(USART_TypeDef *usart, const void *tx_data, const int offset) in fifo_fill_with_u16() argument
918 LL_USART_TransmitData9(usart, data[offset]); in fifo_fill_with_u16()
931 static void fifo_read_with_u16(USART_TypeDef *usart, void *rx_data, const int offset) in fifo_read_with_u16() argument
935 data[offset] = LL_USART_ReceiveData9(usart); in fifo_read_with_u16()
964 LL_USART_EnableIT_TC(config->usart); in uart_stm32_irq_tx_enable()
981 LL_USART_DisableIT_TC(config->usart); in uart_stm32_irq_tx_disable()
997 return LL_USART_IsActiveFlag_TXE(config->usart) && in uart_stm32_irq_tx_ready()
998 LL_USART_IsEnabledIT_TC(config->usart); in uart_stm32_irq_tx_ready()
1005 return LL_USART_IsActiveFlag_TC(config->usart); in uart_stm32_irq_tx_complete()
1012 LL_USART_EnableIT_RXNE(config->usart); in uart_stm32_irq_rx_enable()
1019 LL_USART_DisableIT_RXNE(config->usart); in uart_stm32_irq_rx_disable()
1029 return LL_USART_IsActiveFlag_RXNE(config->usart); in uart_stm32_irq_rx_ready()
1035 USART_TypeDef *usart = config->usart; in uart_stm32_irq_err_enable() local
1038 LL_USART_EnableIT_ERROR(usart); in uart_stm32_irq_err_enable()
1041 if (IS_UART_LIN_INSTANCE(usart)) { in uart_stm32_irq_err_enable()
1042 LL_USART_EnableIT_LBD(usart); in uart_stm32_irq_err_enable()
1046 LL_USART_EnableIT_PE(usart); in uart_stm32_irq_err_enable()
1052 USART_TypeDef *usart = config->usart; in uart_stm32_irq_err_disable() local
1055 LL_USART_DisableIT_ERROR(usart); in uart_stm32_irq_err_disable()
1058 if (IS_UART_LIN_INSTANCE(usart)) { in uart_stm32_irq_err_disable()
1059 LL_USART_DisableIT_LBD(usart); in uart_stm32_irq_err_disable()
1063 LL_USART_DisableIT_PE(usart); in uart_stm32_irq_err_disable()
1069 USART_TypeDef *usart = config->usart; in uart_stm32_irq_is_pending() local
1071 return ((LL_USART_IsActiveFlag_RXNE(usart) && in uart_stm32_irq_is_pending()
1072 LL_USART_IsEnabledIT_RXNE(usart)) || in uart_stm32_irq_is_pending()
1073 (LL_USART_IsActiveFlag_TC(usart) && in uart_stm32_irq_is_pending()
1074 LL_USART_IsEnabledIT_TC(usart))); in uart_stm32_irq_is_pending()
1235 USART_TypeDef *usart = config->usart; in uart_stm32_isr() local
1239 if (LL_USART_IsEnabledIT_TC(usart) && in uart_stm32_isr()
1240 LL_USART_IsActiveFlag_TC(usart)) { in uart_stm32_isr()
1246 LL_USART_DisableIT_TC(usart); in uart_stm32_isr()
1264 if (LL_USART_IsEnabledIT_IDLE(usart) && in uart_stm32_isr()
1265 LL_USART_IsActiveFlag_IDLE(usart)) { in uart_stm32_isr()
1267 LL_USART_ClearFlag_IDLE(usart); in uart_stm32_isr()
1278 } else if (LL_USART_IsEnabledIT_TC(usart) && in uart_stm32_isr()
1279 LL_USART_IsActiveFlag_TC(usart)) { in uart_stm32_isr()
1281 LL_USART_DisableIT_TC(usart); in uart_stm32_isr()
1288 } else if (LL_USART_IsEnabledIT_RXNE(usart) && in uart_stm32_isr()
1289 LL_USART_IsActiveFlag_RXNE(usart)) { in uart_stm32_isr()
1292 LL_USART_ClearFlag_RXNE(usart); in uart_stm32_isr()
1295 LL_USART_RequestRxDataFlush(usart); in uart_stm32_isr()
1305 if (LL_USART_IsEnabledIT_WKUP(usart) && in uart_stm32_isr()
1306 LL_USART_IsActiveFlag_WKUP(usart)) { in uart_stm32_isr()
1308 LL_USART_ClearFlag_WKUP(usart); in uart_stm32_isr()
1310 while (LL_USART_IsActiveFlag_REACK(usart) == 0) { in uart_stm32_isr()
1367 LL_USART_EnableDMAReq_TX(config->usart); in uart_stm32_dma_tx_enable()
1377 * USART does not generate DMA requests after setting/clearing DMAT bit in uart_stm32_dma_tx_disable()
1383 LL_USART_DisableDMAReq_TX(config->usart); in uart_stm32_dma_tx_disable()
1392 LL_USART_EnableDMAReq_RX(config->usart); in uart_stm32_dma_rx_enable()
1407 USART_TypeDef *usart = config->usart; in uart_stm32_async_rx_disable() local
1418 LL_USART_DisableIT_IDLE(usart); in uart_stm32_async_rx_disable()
1442 LL_USART_EnableIT_RXNE(usart); in uart_stm32_async_rx_disable()
1478 USART_TypeDef *usart = config->usart; in uart_stm32_dma_replace_buffer() local
1501 LL_USART_ClearFlag_IDLE(usart); in uart_stm32_dma_replace_buffer()
1548 USART_TypeDef *usart = config->usart; in uart_stm32_async_tx() local
1574 LL_USART_ClearFlag_TC(usart); in uart_stm32_async_tx()
1577 LL_USART_EnableIT_TC(usart); in uart_stm32_async_tx()
1615 USART_TypeDef *usart = config->usart; in uart_stm32_async_rx_enable() local
1642 LL_USART_DisableIT_RXNE(usart); in uart_stm32_async_rx_enable()
1662 LL_USART_ClearFlag_RXNE(usart); in uart_stm32_async_rx_enable()
1664 LL_USART_RequestRxDataFlush(usart); in uart_stm32_async_rx_enable()
1673 LL_USART_ClearFlag_IDLE(usart); in uart_stm32_async_rx_enable()
1674 LL_USART_EnableIT_IDLE(usart); in uart_stm32_async_rx_enable()
1676 LL_USART_EnableIT_ERROR(usart); in uart_stm32_async_rx_enable()
1777 USART_TypeDef *usart = config->usart; in uart_stm32_async_init() local
1811 LL_USART_DMA_GetRegAddr(usart); in uart_stm32_async_init()
1814 LL_USART_DMA_GetRegAddr(usart, in uart_stm32_async_init()
1850 LL_USART_DMA_GetRegAddr(usart); in uart_stm32_async_init()
1853 LL_USART_DMA_GetRegAddr(usart, in uart_stm32_async_init()
1985 USART_TypeDef *usart = config->usart; in uart_stm32_registers_configure() local
1989 LL_USART_Disable(usart); in uart_stm32_registers_configure()
2000 LL_USART_SetTransferDirection(usart, LL_USART_DIRECTION_TX_RX); in uart_stm32_registers_configure()
2007 LL_USART_EnableHalfDuplex(usart); in uart_stm32_registers_configure()
2012 LL_USART_SetTXRXSwap(usart, LL_USART_TXRX_SWAPPED); in uart_stm32_registers_configure()
2018 LL_USART_SetRXPinLevel(usart, LL_USART_RXPIN_LEVEL_INVERTED); in uart_stm32_registers_configure()
2024 LL_USART_SetTXPinLevel(usart, LL_USART_TXPIN_LEVEL_INVERTED); in uart_stm32_registers_configure()
2030 if (!IS_UART_DRIVER_ENABLE_INSTANCE(usart)) { in uart_stm32_registers_configure()
2036 LL_USART_SetDEAssertionTime(usart, config->de_assert_time); in uart_stm32_registers_configure()
2037 LL_USART_SetDEDeassertionTime(usart, config->de_deassert_time); in uart_stm32_registers_configure()
2040 LL_USART_SetDESignalPolarity(usart, LL_USART_DE_POLARITY_LOW); in uart_stm32_registers_configure()
2047 LL_USART_EnableFIFO(usart); in uart_stm32_registers_configure()
2059 LL_USART_SetWKUPType(usart, LL_USART_WAKEUP_ON_RXNE); in uart_stm32_registers_configure()
2060 LL_USART_EnableIT_WKUP(usart); in uart_stm32_registers_configure()
2061 LL_USART_ClearFlag_WKUP(usart); in uart_stm32_registers_configure()
2063 LL_USART_EnableInStopMode(usart); in uart_stm32_registers_configure()
2072 LL_USART_Enable(usart); in uart_stm32_registers_configure()
2076 while (!(LL_USART_IsActiveFlag_TEACK(usart))) { in uart_stm32_registers_configure()
2082 while (!(LL_USART_IsActiveFlag_REACK(usart))) { in uart_stm32_registers_configure()
2137 USART_TypeDef *usart = config->usart; in uart_stm32_suspend_setup() local
2140 /* Make sure that no USART transfer is on-going */ in uart_stm32_suspend_setup()
2141 while (LL_USART_IsActiveFlag_BUSY(usart) == 1) { in uart_stm32_suspend_setup()
2144 while (LL_USART_IsActiveFlag_TC(usart) == 0) { in uart_stm32_suspend_setup()
2147 /* Make sure that USART is ready for reception */ in uart_stm32_suspend_setup()
2148 while (LL_USART_IsActiveFlag_REACK(usart) == 0) { in uart_stm32_suspend_setup()
2152 LL_USART_ClearFlag_ORE(usart); in uart_stm32_suspend_setup()
2180 (!LL_USART_IsEnabled(config->usart))) { in uart_stm32_pm_action()
2425 .usart = (USART_TypeDef *)DT_INST_REG_ADDR(index), \