void LOGUARTClass::end( void ) { // clear any received data _rx_buffer->_iHead = _rx_buffer->_iTail ; log_uart_free(&log_uart_obj); }
void serial_free(serial_t *obj) { PHAL_RUART_ADAPTER pHalRuartAdapter; #ifdef CONFIG_GDMA_EN u8 uart_idx; PUART_DMA_CONFIG pHalRuartDmaCfg; #endif #ifdef CONFIG_MBED_ENABLED if (obj->index == UART_3) { log_uart_free(&stdio_uart_log); return; } #endif pHalRuartAdapter = &(obj->hal_uart_adp); HalRuartDeInit(pHalRuartAdapter); #ifdef CONFIG_GDMA_EN uart_idx = pHalRuartAdapter->UartIndex; pHalRuartDmaCfg = &obj->uart_gdma_cfg; if (serial_dma_en[uart_idx] & SERIAL_RX_DMA_EN) { HalRuartRxGdmaDeInit(pHalRuartDmaCfg); serial_dma_en[uart_idx] &= ~SERIAL_RX_DMA_EN; } if (serial_dma_en[uart_idx] & SERIAL_TX_DMA_EN) { HalRuartTxGdmaDeInit(pHalRuartDmaCfg); serial_dma_en[uart_idx] &= ~SERIAL_TX_DMA_EN; } #endif }