X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fstmf0%2Fao_serial_stm.c;h=ef35394aab53dec6bbf9f64d816d11ab2c5b5186;hp=59cfde2ed8bc044fb9580fd4693f195dc1f9e4ee;hb=bdcb3653bd9fb97f98773ac3bc1f87a6f52b1121;hpb=e64438271e481ca9f9eeb0ce2b1f9eca071b7ad4 diff --git a/src/stmf0/ao_serial_stm.c b/src/stmf0/ao_serial_stm.c index 59cfde2e..ef35394a 100644 --- a/src/stmf0/ao_serial_stm.c +++ b/src/stmf0/ao_serial_stm.c @@ -56,14 +56,14 @@ _ao_usart_cts(struct ao_stm_usart *usart) #endif static void -_ao_usart_rx(struct ao_stm_usart *usart, int stdin) +_ao_usart_rx(struct ao_stm_usart *usart, int is_stdin) { if (usart->reg->isr & (1 << STM_USART_ISR_RXNE)) { usart->reg->icr = (1 << STM_USART_ICR_ORECF); if (!ao_fifo_full(usart->rx_fifo)) { ao_fifo_insert(usart->rx_fifo, usart->reg->rdr); ao_wakeup(&usart->rx_fifo); - if (stdin) + if (is_stdin) ao_wakeup(&ao_stdin_ready); #if HAS_SERIAL_SW_FLOW /* If the fifo is nearly full, turn off RTS and wait @@ -81,9 +81,9 @@ _ao_usart_rx(struct ao_stm_usart *usart, int stdin) } static void -ao_usart_isr(struct ao_stm_usart *usart, int stdin) +ao_usart_isr(struct ao_stm_usart *usart, int is_stdin) { - _ao_usart_rx(usart, stdin); + _ao_usart_rx(usart, is_stdin); if (!_ao_usart_tx_start(usart)) usart->reg->cr1 &= ~(1<< STM_USART_CR1_TXEIE); @@ -375,6 +375,17 @@ ao_serial_set_sw_rts_cts(struct ao_stm_usart *usart, } #endif +void +ao_serial_shutdown(void) +{ +#if HAS_SERIAL_1 + stm_rcc.apb2enr &= ~(1 << STM_RCC_APB2ENR_USART1EN); +#endif +#if HAS_SERIAL_2 + stm_rcc.apb1enr &= ~(1 << STM_RCC_APB1ENR_USART2EN); +#endif +} + void ao_serial_init(void) {