Lines Matching refs:dma_rx

68 	struct uart_dma_stream dma_rx;  member
163 if (data->dma_rx.buffer_len) { in uart_xmc4xxx_isr()
171 async_timer_start(&data->dma_rx.timeout_work, data->dma_rx.timeout); in uart_xmc4xxx_isr()
412 if (buffer_type == CURRENT_BUFFER && !data->dma_rx.buffer) { in async_evt_rx_release_buffer()
421 event.data.rx_buf.buf = data->dma_rx.buffer; in async_evt_rx_release_buffer()
422 data->dma_rx.buffer = NULL; in async_evt_rx_release_buffer()
423 data->dma_rx.buffer_len = 0; in async_evt_rx_release_buffer()
438 if (data->dma_rx.buffer_len == 0 || data->async_cb == NULL) { in async_evt_rx_stopped()
442 rx->buf = data->dma_rx.buffer; in async_evt_rx_stopped()
443 if (dma_get_status(data->dma_rx.dma_dev, data->dma_rx.dma_channel, &stat) == 0) { in async_evt_rx_stopped()
444 data->dma_rx.counter = data->dma_rx.buffer_len - stat.pending_length; in async_evt_rx_stopped()
447 rx->len = data->dma_rx.counter - data->dma_rx.offset; in async_evt_rx_stopped()
448 rx->offset = data->dma_rx.counter; in async_evt_rx_stopped()
457 data->dma_rx.buffer = NULL; in async_evt_rx_disabled()
458 data->dma_rx.buffer_len = 0; in async_evt_rx_disabled()
459 data->dma_rx.offset = 0; in async_evt_rx_disabled()
460 data->dma_rx.counter = 0; in async_evt_rx_disabled()
470 .data.rx.buf = (uint8_t *)data->dma_rx.buffer, in async_evt_rx_rdy()
471 .data.rx.len = data->dma_rx.counter - data->dma_rx.offset, in async_evt_rx_rdy()
472 .data.rx.offset = data->dma_rx.offset}; in async_evt_rx_rdy()
474 data->dma_rx.offset = data->dma_rx.counter; in async_evt_rx_rdy()
516 struct uart_xmc4xxx_data *data = CONTAINER_OF(rx_stream, struct uart_xmc4xxx_data, dma_rx); in uart_xmc4xxx_async_rx_timeout()
520 if (data->dma_rx.buffer_len == 0) { in uart_xmc4xxx_async_rx_timeout()
525 if (dma_get_status(data->dma_rx.dma_dev, data->dma_rx.dma_channel, &stat) == 0) { in uart_xmc4xxx_async_rx_timeout()
526 size_t rx_rcv_len = data->dma_rx.buffer_len - stat.pending_length; in uart_xmc4xxx_async_rx_timeout()
528 if (rx_rcv_len > data->dma_rx.offset) { in uart_xmc4xxx_async_rx_timeout()
529 data->dma_rx.counter = rx_rcv_len; in uart_xmc4xxx_async_rx_timeout()
534 async_timer_start(&data->dma_rx.timeout_work, data->dma_rx.timeout); in uart_xmc4xxx_async_rx_timeout()
582 if (data->dma_rx.dma_dev != NULL) { in uart_xmc4xxx_async_init()
583 if (!device_is_ready(data->dma_rx.dma_dev)) { in uart_xmc4xxx_async_init()
587 k_work_init_delayable(&data->dma_rx.timeout_work, uart_xmc4xxx_async_rx_timeout); in uart_xmc4xxx_async_init()
589 data->dma_rx.blk_cfg.source_address = (uint32_t)&config->uart->OUTR; in uart_xmc4xxx_async_init()
591 data->dma_rx.blk_cfg.source_address = (uint32_t)&config->uart->RBUF; in uart_xmc4xxx_async_init()
594 data->dma_rx.blk_cfg.source_addr_adj = DMA_ADDR_ADJ_NO_CHANGE; in uart_xmc4xxx_async_init()
595 data->dma_rx.blk_cfg.dest_addr_adj = DMA_ADDR_ADJ_INCREMENT; in uart_xmc4xxx_async_init()
596 data->dma_rx.dma_cfg.head_block = &data->dma_rx.blk_cfg; in uart_xmc4xxx_async_init()
597 data->dma_rx.dma_cfg.user_data = (void *)dev; in uart_xmc4xxx_async_init()
694 if (data->dma_rx.dma_dev == NULL) { in uart_xmc4xxx_async_rx_enable()
698 if (data->dma_rx.buffer_len != 0) { in uart_xmc4xxx_async_rx_enable()
704 data->dma_rx.buffer = buf; in uart_xmc4xxx_async_rx_enable()
705 data->dma_rx.buffer_len = len; in uart_xmc4xxx_async_rx_enable()
706 data->dma_rx.timeout = timeout; in uart_xmc4xxx_async_rx_enable()
708 data->dma_rx.blk_cfg.dest_address = (uint32_t)data->dma_rx.buffer; in uart_xmc4xxx_async_rx_enable()
709 data->dma_rx.blk_cfg.block_size = data->dma_rx.buffer_len; in uart_xmc4xxx_async_rx_enable()
711 ret = dma_config(data->dma_rx.dma_dev, data->dma_rx.dma_channel, &data->dma_rx.dma_cfg); in uart_xmc4xxx_async_rx_enable()
721 return dma_start(data->dma_rx.dma_dev, data->dma_rx.dma_channel); in uart_xmc4xxx_async_rx_enable()
732 __ASSERT_NO_MSG(channel == data->dma_rx.dma_channel); in uart_xmc4xxx_dma_rx_cb()
734 k_work_cancel_delayable(&data->dma_rx.timeout_work); in uart_xmc4xxx_dma_rx_cb()
739 dma_stop(data->dma_rx.dma_dev, data->dma_rx.dma_channel); in uart_xmc4xxx_dma_rx_cb()
746 if (data->dma_rx.buffer_len == 0) { in uart_xmc4xxx_dma_rx_cb()
750 data->dma_rx.counter = data->dma_rx.buffer_len; in uart_xmc4xxx_dma_rx_cb()
757 dma_stop(data->dma_rx.dma_dev, data->dma_rx.dma_channel); in uart_xmc4xxx_dma_rx_cb()
762 data->dma_rx.buffer = data->rx_next_buffer; in uart_xmc4xxx_dma_rx_cb()
763 data->dma_rx.buffer_len = data->rx_next_buffer_len; in uart_xmc4xxx_dma_rx_cb()
764 data->dma_rx.offset = 0; in uart_xmc4xxx_dma_rx_cb()
765 data->dma_rx.counter = 0; in uart_xmc4xxx_dma_rx_cb()
769 ret = dma_reload(data->dma_rx.dma_dev, data->dma_rx.dma_channel, in uart_xmc4xxx_dma_rx_cb()
770 data->dma_rx.blk_cfg.source_address, (uint32_t)data->dma_rx.buffer, in uart_xmc4xxx_dma_rx_cb()
771 data->dma_rx.buffer_len); in uart_xmc4xxx_dma_rx_cb()
775 dma_stop(data->dma_rx.dma_dev, data->dma_rx.dma_channel); in uart_xmc4xxx_dma_rx_cb()
781 dma_start(data->dma_rx.dma_dev, data->dma_rx.dma_channel); in uart_xmc4xxx_dma_rx_cb()
784 async_timer_start(&data->dma_rx.timeout_work, data->dma_rx.timeout); in uart_xmc4xxx_dma_rx_cb()
795 k_work_cancel_delayable(&data->dma_rx.timeout_work); in uart_xmc4xxx_async_rx_disable()
799 if (data->dma_rx.buffer_len == 0) { in uart_xmc4xxx_async_rx_disable()
800 __ASSERT_NO_MSG(data->dma_rx.buffer == NULL); in uart_xmc4xxx_async_rx_disable()
805 dma_stop(data->dma_rx.dma_dev, data->dma_rx.dma_channel); in uart_xmc4xxx_async_rx_disable()
808 if (dma_get_status(data->dma_rx.dma_dev, data->dma_rx.dma_channel, &stat) == 0) { in uart_xmc4xxx_async_rx_disable()
809 size_t rx_rcv_len = data->dma_rx.buffer_len - stat.pending_length; in uart_xmc4xxx_async_rx_disable()
811 if (rx_rcv_len > data->dma_rx.offset) { in uart_xmc4xxx_async_rx_disable()
812 data->dma_rx.counter = rx_rcv_len; in uart_xmc4xxx_async_rx_disable()
866 if (data->dma_rx.buffer_len == 0U) { in uart_xmc4xxx_rx_buf_rsp()