MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / USART_Reset

Function USART_Reset

bsp/efm32/Libraries/emlib/src/em_usart.c:782–813  ·  view source on GitHub ↗

/ * @brief * Reset USART/UART to same state as after a HW reset. * * @param[in] usart * Pointer to USART/UART peripheral register block. ******************************************************************************/

Source from the content-addressed store, hash-verified

780 * Pointer to USART/UART peripheral register block.
781 ******************************************************************************/
782void USART_Reset(USART_TypeDef *usart)
783{
784 /* Make sure the module exists on the selected chip */
785 EFM_ASSERT(USART_REF_VALID(usart)||UART_REF_VALID(usart));
786
787 /* Make sure disabled first, before resetting other registers */
788 usart->CMD = USART_CMD_RXDIS | USART_CMD_TXDIS | USART_CMD_MASTERDIS |
789 USART_CMD_RXBLOCKDIS | USART_CMD_TXTRIDIS | USART_CMD_CLEARTX | USART_CMD_CLEARRX;
790 usart->CTRL = _USART_CTRL_RESETVALUE;
791 usart->FRAME = _USART_FRAME_RESETVALUE;
792 usart->TRIGCTRL = _USART_TRIGCTRL_RESETVALUE;
793 usart->CLKDIV = _USART_CLKDIV_RESETVALUE;
794 usart->IEN = _USART_IEN_RESETVALUE;
795 usart->IFC = _USART_IFC_MASK;
796 usart->ROUTE = _USART_ROUTE_RESETVALUE;
797
798 if (USART_IRDA_VALID(usart))
799 {
800 usart->IRCTRL = _USART_IRCTRL_RESETVALUE;
801 }
802
803#if defined(_EFM32_GIANT_FAMILY) || defined(_EFM32_TINY_FAMILY)
804 usart->INPUT = _USART_INPUT_RESETVALUE;
805
806 if (USART_I2S_VALID(usart))
807 {
808 usart->I2SCTRL = _USART_I2SCTRL_RESETVALUE;
809 }
810#endif
811
812 /* Do not reset route register, setting should be done independently */
813}
814
815
816/***************************************************************************//**

Callers 5

USART_InitAsyncFunction · 0.70
USART_InitSyncFunction · 0.70
DVK_spiControlFunction · 0.50
SPI_BC_DisableFunction · 0.50
spiDisableFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected