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

Function if

components/drivers/serial/dev_serial.c:694–720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

692 }
693#ifdef RT_SERIAL_USING_DMA
694 else if (oflag & RT_DEVICE_FLAG_DMA_RX)
695 {
696 if (serial->config.bufsz == 0) {
697 struct rt_serial_rx_dma* rx_dma;
698
699 rx_dma = (struct rt_serial_rx_dma*) rt_malloc (sizeof(struct rt_serial_rx_dma));
700 RT_ASSERT(rx_dma != RT_NULL);
701 rx_dma->activated = RT_FALSE;
702
703 serial->serial_rx = rx_dma;
704 } else {
705 struct rt_serial_rx_fifo* rx_fifo;
706
707 rx_fifo = (struct rt_serial_rx_fifo*) rt_malloc (sizeof(struct rt_serial_rx_fifo) +
708 serial->config.bufsz);
709 RT_ASSERT(rx_fifo != RT_NULL);
710 rx_fifo->buffer = (rt_uint8_t*) (rx_fifo + 1);
711 rt_memset(rx_fifo->buffer, 0, serial->config.bufsz);
712 rx_fifo->put_index = 0;
713 rx_fifo->get_index = 0;
714 rx_fifo->is_full = RT_FALSE;
715 serial->serial_rx = rx_fifo;
716 /* configure fifo address and length to low level device */
717 serial->ops->control(serial, RT_DEVICE_CTRL_CONFIG, (void *) RT_DEVICE_FLAG_DMA_RX);
718 }
719 dev->open_flag |= RT_DEVICE_FLAG_DMA_RX;
720 }
721#endif /* RT_SERIAL_USING_DMA */
722 else
723 {

Callers 1

usb_fsdev_reg.hFile · 0.50

Calls 7

rt_mallocFunction · 0.85
rt_memsetFunction · 0.85
rt_data_queue_initFunction · 0.85
rt_freeFunction · 0.85
rt_data_queue_deinitFunction · 0.85
_serial_dma_rxFunction · 0.85
_serial_dma_txFunction · 0.85

Tested by

no test coverage detected