Lines Matching refs:p_cb
150 uart_control_block_t const * p_cb = &m_cb[p_instance->drv_inst_idx]; in pins_to_default() local
163 if (!p_cb->skip_psel_cfg) in pins_to_default()
169 if (!p_cb->skip_gpio_cfg) in pins_to_default()
195 uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; in nrfx_uart_init() local
198 if (p_cb->state != NRFX_DRV_STATE_UNINITIALIZED) in nrfx_uart_init()
221 p_cb->handler = event_handler; in nrfx_uart_init()
225 p_cb->p_context = p_config->p_context; in nrfx_uart_init()
226 p_cb->skip_gpio_cfg = p_config->skip_gpio_cfg; in nrfx_uart_init()
227 p_cb->skip_psel_cfg = p_config->skip_psel_cfg; in nrfx_uart_init()
232 p_cb->rx_buffer_length = 0; in nrfx_uart_init()
233 p_cb->rx_secondary_buffer_length = 0; in nrfx_uart_init()
234 p_cb->rx_enabled = false; in nrfx_uart_init()
235 p_cb->tx_buffer_length = 0; in nrfx_uart_init()
236 p_cb->state = NRFX_DRV_STATE_INITIALIZED; in nrfx_uart_init()
247 uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; in nrfx_uart_reconfigure() local
249 if (p_cb->state == NRFX_DRV_STATE_UNINITIALIZED) in nrfx_uart_reconfigure()
258 if (p_cb->handler) in nrfx_uart_reconfigure()
260 p_cb->p_context = p_config->p_context; in nrfx_uart_reconfigure()
269 uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; in nrfx_uart_uninit() local
273 if (p_cb->handler) in nrfx_uart_uninit()
284 p_cb->state = NRFX_DRV_STATE_UNINITIALIZED; in nrfx_uart_uninit()
285 p_cb->handler = NULL; in nrfx_uart_uninit()
289 static void tx_byte(NRF_UART_Type * p_uart, uart_control_block_t * p_cb) in tx_byte() argument
292 uint8_t txd = p_cb->p_tx_buffer[p_cb->tx_counter]; in tx_byte()
293 p_cb->tx_counter++; in tx_byte()
297 static bool tx_blocking(NRF_UART_Type * p_uart, uart_control_block_t * p_cb) in tx_blocking() argument
301 size_t const tx_buffer_length = p_cb->tx_buffer_length; in tx_blocking()
302 while (p_cb->tx_counter < tx_buffer_length) in tx_blocking()
308 if (p_cb->tx_abort) in tx_blocking()
314 tx_byte(p_uart, p_cb); in tx_blocking()
324 uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; in nrfx_uart_tx() local
325 NRFX_ASSERT(p_cb->state == NRFX_DRV_STATE_INITIALIZED); in nrfx_uart_tx()
339 p_cb->tx_buffer_length = length; in nrfx_uart_tx()
340 p_cb->p_tx_buffer = p_data; in nrfx_uart_tx()
341 p_cb->tx_counter = 0; in nrfx_uart_tx()
342 p_cb->tx_abort = false; in nrfx_uart_tx()
344 NRFX_LOG_INFO("Transfer tx_len: %d.", p_cb->tx_buffer_length); in nrfx_uart_tx()
346 NRFX_LOG_HEXDUMP_DEBUG(p_cb->p_tx_buffer, in nrfx_uart_tx()
347 p_cb->tx_buffer_length * sizeof(p_cb->p_tx_buffer[0])); in nrfx_uart_tx()
354 tx_byte(p_instance->p_reg, p_cb); in nrfx_uart_tx()
356 if (p_cb->handler == NULL) in nrfx_uart_tx()
358 if (!tx_blocking(p_instance->p_reg, p_cb)) in nrfx_uart_tx()
370 p_cb->tx_buffer_length = 0; in nrfx_uart_tx()
388 static void rx_byte(NRF_UART_Type * p_uart, uart_control_block_t * p_cb) in rx_byte() argument
390 if (!p_cb->rx_buffer_length) in rx_byte()
398 p_cb->p_rx_buffer[p_cb->rx_counter] = nrf_uart_rxd_get(p_uart); in rx_byte()
399 p_cb->rx_counter++; in rx_byte()
406 uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; in nrfx_uart_rx() local
416 if (p_cb->handler) in nrfx_uart_rx()
421 if (p_cb->rx_buffer_length != 0) in nrfx_uart_rx()
423 if (p_cb->rx_secondary_buffer_length != 0) in nrfx_uart_rx()
425 if (p_cb->handler) in nrfx_uart_rx()
441 p_cb->rx_buffer_length = length; in nrfx_uart_rx()
442 p_cb->p_rx_buffer = p_data; in nrfx_uart_rx()
443 p_cb->rx_counter = 0; in nrfx_uart_rx()
444 p_cb->rx_secondary_buffer_length = 0; in nrfx_uart_rx()
448 p_cb->p_rx_secondary_buffer = p_data; in nrfx_uart_rx()
449 p_cb->rx_secondary_buffer_length = length; in nrfx_uart_rx()
454 if ((!p_cb->rx_enabled) && (!second_buffer)) in nrfx_uart_rx()
459 if (p_cb->handler == NULL) in nrfx_uart_rx()
479 rx_byte(p_instance->p_reg, p_cb); in nrfx_uart_rx()
480 } while (p_cb->rx_buffer_length > p_cb->rx_counter); in nrfx_uart_rx()
482 p_cb->rx_buffer_length = 0; in nrfx_uart_rx()
501 if (p_cb->rx_enabled) in nrfx_uart_rx()
547 static void rx_done_event(uart_control_block_t * p_cb, in rx_done_event() argument
557 p_cb->handler(&event, p_cb->p_context); in rx_done_event()
560 static void tx_done_event(uart_control_block_t * p_cb, in tx_done_event() argument
567 event.data.rxtx.p_data = (uint8_t *)p_cb->p_tx_buffer; in tx_done_event()
569 p_cb->tx_buffer_length = 0; in tx_done_event()
571 p_cb->handler(&event, p_cb->p_context); in tx_done_event()
576 uart_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx]; in nrfx_uart_tx_abort() local
578 p_cb->tx_abort = true; in nrfx_uart_tx_abort()
580 if (p_cb->handler) in nrfx_uart_tx_abort()
582 tx_done_event(p_cb, p_cb->tx_counter); in nrfx_uart_tx_abort()
597 static void irq_handler(NRF_UART_Type * p_uart, uart_control_block_t * p_cb) in irq_handler() argument
607 if (!p_cb->rx_enabled) in irq_handler()
613 event.data.error.rxtx.bytes = p_cb->rx_buffer_length; in irq_handler()
614 event.data.error.rxtx.p_data = p_cb->p_rx_buffer; in irq_handler()
617 p_cb->rx_buffer_length = 0; in irq_handler()
618 p_cb->rx_secondary_buffer_length = 0; in irq_handler()
620 p_cb->handler(&event,p_cb->p_context); in irq_handler()
625 rx_byte(p_uart, p_cb); in irq_handler()
626 if (p_cb->rx_buffer_length == p_cb->rx_counter) in irq_handler()
628 if (p_cb->rx_secondary_buffer_length) in irq_handler()
630 uint8_t * p_data = p_cb->p_rx_buffer; in irq_handler()
631 size_t rx_counter = p_cb->rx_counter; in irq_handler()
634 p_cb->rx_buffer_length = p_cb->rx_secondary_buffer_length; in irq_handler()
635 p_cb->p_rx_buffer = p_cb->p_rx_secondary_buffer; in irq_handler()
636 p_cb->rx_secondary_buffer_length = 0; in irq_handler()
637 p_cb->rx_counter = 0; in irq_handler()
638 rx_done_event(p_cb, rx_counter, p_data); in irq_handler()
642 if (!p_cb->rx_enabled) in irq_handler()
648 p_cb->rx_buffer_length = 0; in irq_handler()
649 rx_done_event(p_cb, p_cb->rx_counter, p_cb->p_rx_buffer); in irq_handler()
658 size_t const tx_buffer_length = p_cb->tx_buffer_length; in irq_handler()
659 if (p_cb->tx_counter < tx_buffer_length && !p_cb->tx_abort) in irq_handler()
661 tx_byte(p_uart, p_cb); in irq_handler()
666 if (p_cb->tx_buffer_length) in irq_handler()
668 tx_done_event(p_cb, p_cb->tx_buffer_length); in irq_handler()
678 if (p_cb->rx_enabled) in irq_handler()
682 if (p_cb->rx_buffer_length) in irq_handler()
684 p_cb->rx_buffer_length = 0; in irq_handler()
685 rx_done_event(p_cb, p_cb->rx_counter, p_cb->p_rx_buffer); in irq_handler()