Lines Matching refs:uart0_cb

72 } uart0_cb;  variable
238 while (uart0_cb.tx_buffer) { in uart_nrfx_poll_out()
250 lock = &uart0_cb.tx_buffer_length; in uart_nrfx_poll_out()
396 if (uart0_cb.callback) { in user_callback()
397 uart0_cb.callback(dev, event, uart0_cb.user_data); in user_callback()
405 uart0_cb.callback = callback; in uart_nrfx_callback_set()
406 uart0_cb.user_data = user_data; in uart_nrfx_callback_set()
420 if (atomic_cas((atomic_t *) &uart0_cb.tx_buffer_length, in uart_nrfx_tx()
426 uart0_cb.tx_buffer = buf; in uart_nrfx_tx()
428 uart0_cb.tx_timeout = timeout; in uart_nrfx_tx()
434 uint8_t txd = uart0_cb.tx_buffer[uart0_cb.tx_counter]; in uart_nrfx_tx()
443 if (uart0_cb.tx_buffer_length == 0) { in uart_nrfx_tx_abort()
447 if (uart0_cb.tx_timeout != SYS_FOREVER_US) { in uart_nrfx_tx_abort()
448 k_timer_stop(&uart0_cb.tx_timeout_timer); in uart_nrfx_tx_abort()
455 .data.tx.buf = uart0_cb.tx_buffer, in uart_nrfx_tx_abort()
456 .data.tx.len = uart0_cb.tx_counter in uart_nrfx_tx_abort()
459 uart0_cb.tx_buffer_length = 0; in uart_nrfx_tx_abort()
460 uart0_cb.tx_counter = 0; in uart_nrfx_tx_abort()
476 if (uart0_cb.rx_buffer_length != 0) { in uart_nrfx_rx_enable()
480 uart0_cb.rx_enabled = 1; in uart_nrfx_rx_enable()
481 uart0_cb.rx_buffer = buf; in uart_nrfx_rx_enable()
482 uart0_cb.rx_buffer_length = len; in uart_nrfx_rx_enable()
483 uart0_cb.rx_counter = 0; in uart_nrfx_rx_enable()
484 uart0_cb.rx_secondary_buffer_length = 0; in uart_nrfx_rx_enable()
485 uart0_cb.rx_timeout = timeout; in uart_nrfx_rx_enable()
504 if (!uart0_cb.rx_enabled) { in uart_nrfx_rx_buf_rsp()
506 } else if (uart0_cb.rx_secondary_buffer_length != 0) { in uart_nrfx_rx_buf_rsp()
509 uart0_cb.rx_secondary_buffer = buf; in uart_nrfx_rx_buf_rsp()
510 uart0_cb.rx_secondary_buffer_length = len; in uart_nrfx_rx_buf_rsp()
521 if (uart0_cb.rx_buffer_length == 0) { in uart_nrfx_rx_disable()
525 uart0_cb.rx_enabled = 0; in uart_nrfx_rx_disable()
526 if (uart0_cb.rx_timeout != SYS_FOREVER_US) { in uart_nrfx_rx_disable()
527 k_timer_stop(&uart0_cb.rx_timeout_timer); in uart_nrfx_rx_disable()
537 size_t rx_cnt = uart0_cb.rx_counter; in rx_rdy_evt()
540 event.data.rx.buf = uart0_cb.rx_buffer; in rx_rdy_evt()
541 event.data.rx.len = rx_cnt - uart0_cb.rx_offset; in rx_rdy_evt()
542 event.data.rx.offset = uart0_cb.rx_offset; in rx_rdy_evt()
544 uart0_cb.rx_offset = rx_cnt; in rx_rdy_evt()
553 .data.rx_buf.buf = uart0_cb.rx_buffer in buf_released_evt()
572 uart0_cb.rx_buffer_length = 0; in rx_reset_state()
573 uart0_cb.rx_enabled = 0; in rx_reset_state()
574 uart0_cb.rx_counter = 0; in rx_reset_state()
575 uart0_cb.rx_offset = 0; in rx_reset_state()
576 uart0_cb.rx_secondary_buffer_length = 0; in rx_reset_state()
585 if (!uart0_cb.rx_buffer_length || !uart0_cb.rx_enabled) { in rx_isr()
589 if (uart0_cb.rx_counter == 0 && in rx_isr()
590 uart0_cb.rx_secondary_buffer_length == 0) { in rx_isr()
594 uart0_cb.rx_buffer[uart0_cb.rx_counter] = in rx_isr()
596 uart0_cb.rx_counter++; in rx_isr()
597 if (uart0_cb.rx_timeout == 0) { in rx_isr()
599 } else if (uart0_cb.rx_timeout != SYS_FOREVER_US) { in rx_isr()
600 k_timer_start(&uart0_cb.rx_timeout_timer, in rx_isr()
601 K_USEC(uart0_cb.rx_timeout), in rx_isr()
606 if (uart0_cb.rx_buffer_length == uart0_cb.rx_counter) { in rx_isr()
607 if (uart0_cb.rx_timeout != SYS_FOREVER_US) { in rx_isr()
608 k_timer_stop(&uart0_cb.rx_timeout_timer); in rx_isr()
614 if (uart0_cb.rx_secondary_buffer_length == 0) { in rx_isr()
615 uart0_cb.rx_enabled = 0; in rx_isr()
619 if (uart0_cb.rx_secondary_buffer_length) { in rx_isr()
622 uart0_cb.rx_buffer_length = in rx_isr()
623 uart0_cb.rx_secondary_buffer_length; in rx_isr()
624 uart0_cb.rx_buffer = uart0_cb.rx_secondary_buffer; in rx_isr()
625 uart0_cb.rx_secondary_buffer_length = 0; in rx_isr()
626 uart0_cb.rx_counter = 0; in rx_isr()
627 uart0_cb.rx_offset = 0; in rx_isr()
639 uart0_cb.tx_counter++; in tx_isr()
640 if (uart0_cb.tx_counter < uart0_cb.tx_buffer_length && in tx_isr()
641 !uart0_cb.tx_abort) { in tx_isr()
643 if (uart0_cb.tx_timeout != SYS_FOREVER_US) { in tx_isr()
644 k_timer_start(&uart0_cb.tx_timeout_timer, in tx_isr()
645 K_USEC(uart0_cb.tx_timeout), in tx_isr()
651 uint8_t txd = uart0_cb.tx_buffer[uart0_cb.tx_counter]; in tx_isr()
657 if (uart0_cb.tx_timeout != SYS_FOREVER_US) { in tx_isr()
658 k_timer_stop(&uart0_cb.tx_timeout_timer); in tx_isr()
664 .data.tx.buf = uart0_cb.tx_buffer, in tx_isr()
665 .data.tx.len = uart0_cb.tx_counter in tx_isr()
668 uart0_cb.tx_buffer_length = 0; in tx_isr()
669 uart0_cb.tx_counter = 0; in tx_isr()
670 uart0_cb.tx_buffer = NULL; in tx_isr()
686 if (uart0_cb.rx_timeout != SYS_FOREVER_US) { in error_isr()
687 k_timer_stop(&uart0_cb.rx_timeout_timer); in error_isr()
691 if (!uart0_cb.rx_enabled) { in error_isr()
699 .data.rx_stop.data.len = uart0_cb.rx_counter in error_isr()
700 - uart0_cb.rx_offset, in error_isr()
701 .data.rx_stop.data.offset = uart0_cb.rx_offset, in error_isr()
702 .data.rx_stop.data.buf = uart0_cb.rx_buffer in error_isr()
720 if (uart0_cb.rx_counter - uart0_cb.rx_offset) { in rxto_isr()
725 if (uart0_cb.rx_secondary_buffer_length) { in rxto_isr()
726 uart0_cb.rx_buffer = uart0_cb.rx_secondary_buffer; in rxto_isr()
766 if (uart0_cb.tx_timeout != SYS_FOREVER_US) { in tx_timeout()
767 k_timer_stop(&uart0_cb.tx_timeout_timer); in tx_timeout()
771 evt.data.tx.buf = uart0_cb.tx_buffer; in tx_timeout()
772 evt.data.tx.len = uart0_cb.tx_buffer_length; in tx_timeout()
773 uart0_cb.tx_buffer_length = 0; in tx_timeout()
774 uart0_cb.tx_counter = 0; in tx_timeout()
934 uart0_cb.callback = NULL; in uart_nrfx_irq_callback_set()
935 uart0_cb.user_data = NULL; in uart_nrfx_irq_callback_set()
1036 k_timer_init(&uart0_cb.rx_timeout_timer, rx_timeout, NULL); in uart_nrfx_init()
1038 k_timer_init(&uart0_cb.tx_timeout_timer, tx_timeout, NULL); in uart_nrfx_init()