Lines Matching refs:pair
90 gdma_pair_t *pair; // which pair the channel belongs to member
111 static void gdma_release_pair_handle(gdma_pair_t *pair);
113 static void gdma_uninstall_pair(gdma_pair_t *pair);
116 static esp_err_t gdma_install_interrupt(gdma_pair_t *pair);
130 gdma_pair_t *pair = NULL; in gdma_new_channel() local
148 pair = config->sibling_chan->pair; in gdma_new_channel()
149 DMA_CHECK(pair, "invalid sibling channel", err, ESP_ERR_INVALID_ARG); in gdma_new_channel()
152 group = pair->group; in gdma_new_channel()
154 group->pair_ref_counts[pair->pair_id]++; // channel obtains a reference to pair in gdma_new_channel()
162 pair = gdma_acquire_pair_handle(group, j); in gdma_new_channel()
163 if (pair) { in gdma_new_channel()
164 portENTER_CRITICAL(&pair->spinlock); in gdma_new_channel()
165 … if (!(search_code & pair->occupy_code)) { // pair has suitable position for acquired channel(s) in gdma_new_channel()
166 pair->occupy_code |= search_code; in gdma_new_channel()
169 portEXIT_CRITICAL(&pair->spinlock); in gdma_new_channel()
176 gdma_release_pair_handle(pair); in gdma_new_channel()
185 pair->tx_chan = alloc_tx_channel; in gdma_new_channel()
186 alloc_tx_channel->base.pair = pair; in gdma_new_channel()
195 pair->rx_chan = alloc_rx_channel; in gdma_new_channel()
196 alloc_rx_channel->base.pair = pair; in gdma_new_channel()
204 group->group_id, pair->pair_id, *ret_chan); in gdma_new_channel()
231 gdma_pair_t *pair = NULL; in gdma_get_channel_id() local
233 pair = dma_chan->pair; in gdma_get_channel_id()
234 *channel_id = pair->pair_id; in gdma_get_channel_id()
242 gdma_pair_t *pair = NULL; in gdma_connect() local
246 pair = dma_chan->pair; in gdma_connect()
247 group = pair->group; in gdma_connect()
251 …gdma_ll_enable_m2m_mode(group->hal.dev, pair->pair_id, trig_periph.periph == GDMA_TRIG_PERIPH_M2M); in gdma_connect()
254 gdma_ll_tx_reset_channel(group->hal.dev, pair->pair_id); // reset channel in gdma_connect()
256 gdma_ll_tx_connect_to_periph(group->hal.dev, pair->pair_id, trig_periph.instance_id); in gdma_connect()
259 gdma_ll_rx_reset_channel(group->hal.dev, pair->pair_id); // reset channel in gdma_connect()
261 gdma_ll_rx_connect_to_periph(group->hal.dev, pair->pair_id, trig_periph.instance_id); in gdma_connect()
272 gdma_pair_t *pair = NULL; in gdma_disconnect() local
276 pair = dma_chan->pair; in gdma_disconnect()
277 group = pair->group; in gdma_disconnect()
281 gdma_ll_tx_connect_to_periph(group->hal.dev, pair->pair_id, GDMA_INVALID_PERIPH_TRIG); in gdma_disconnect()
283 gdma_ll_rx_connect_to_periph(group->hal.dev, pair->pair_id, GDMA_INVALID_PERIPH_TRIG); in gdma_disconnect()
293 gdma_pair_t *pair = NULL; in gdma_apply_strategy() local
296 pair = dma_chan->pair; in gdma_apply_strategy()
297 group = pair->group; in gdma_apply_strategy()
300 gdma_ll_tx_enable_owner_check(group->hal.dev, pair->pair_id, config->owner_check); in gdma_apply_strategy()
301 gdma_ll_tx_enable_auto_write_back(group->hal.dev, pair->pair_id, config->auto_update_desc); in gdma_apply_strategy()
303 gdma_ll_rx_enable_owner_check(group->hal.dev, pair->pair_id, config->owner_check); in gdma_apply_strategy()
313 gdma_pair_t *pair = NULL; in gdma_register_tx_event_callbacks() local
316 pair = dma_chan->pair; in gdma_register_tx_event_callbacks()
317 group = pair->group; in gdma_register_tx_event_callbacks()
321 …DMA_CHECK(gdma_install_interrupt(pair) == ESP_OK, "install interrupt service failed", err, ESP_FAI… in gdma_register_tx_event_callbacks()
324 portENTER_CRITICAL(&pair->spinlock); in gdma_register_tx_event_callbacks()
325 …gdma_ll_enable_interrupt(group->hal.dev, pair->pair_id, GDMA_LL_EVENT_TX_EOF, cbs->on_trans_eof !=… in gdma_register_tx_event_callbacks()
326 portEXIT_CRITICAL(&pair->spinlock); in gdma_register_tx_event_callbacks()
331 DMA_CHECK(esp_intr_enable(pair->intr) == ESP_OK, "enable interrupt failed", err, ESP_FAIL); in gdma_register_tx_event_callbacks()
340 gdma_pair_t *pair = NULL; in gdma_register_rx_event_callbacks() local
343 pair = dma_chan->pair; in gdma_register_rx_event_callbacks()
344 group = pair->group; in gdma_register_rx_event_callbacks()
348 …DMA_CHECK(gdma_install_interrupt(pair) == ESP_OK, "install interrupt service failed", err, ESP_FAI… in gdma_register_rx_event_callbacks()
351 portENTER_CRITICAL(&pair->spinlock); in gdma_register_rx_event_callbacks()
352 …gdma_ll_enable_interrupt(group->hal.dev, pair->pair_id, GDMA_LL_EVENT_RX_SUC_EOF, cbs->on_recv_eof… in gdma_register_rx_event_callbacks()
353 portEXIT_CRITICAL(&pair->spinlock); in gdma_register_rx_event_callbacks()
358 DMA_CHECK(esp_intr_enable(pair->intr) == ESP_OK, "enable interrupt failed", err, ESP_FAIL); in gdma_register_rx_event_callbacks()
367 gdma_pair_t *pair = NULL; in gdma_start() local
370 pair = dma_chan->pair; in gdma_start()
371 group = pair->group; in gdma_start()
374 gdma_ll_rx_set_desc_addr(group->hal.dev, pair->pair_id, desc_base_addr); in gdma_start()
375 gdma_ll_rx_start(group->hal.dev, pair->pair_id); in gdma_start()
377 gdma_ll_tx_set_desc_addr(group->hal.dev, pair->pair_id, desc_base_addr); in gdma_start()
378 gdma_ll_tx_start(group->hal.dev, pair->pair_id); in gdma_start()
388 gdma_pair_t *pair = NULL; in gdma_stop() local
391 pair = dma_chan->pair; in gdma_stop()
392 group = pair->group; in gdma_stop()
395 gdma_ll_rx_stop(group->hal.dev, pair->pair_id); in gdma_stop()
397 gdma_ll_tx_stop(group->hal.dev, pair->pair_id); in gdma_stop()
407 gdma_pair_t *pair = NULL; in gdma_append() local
410 pair = dma_chan->pair; in gdma_append()
411 group = pair->group; in gdma_append()
414 gdma_ll_rx_restart(group->hal.dev, pair->pair_id); in gdma_append()
416 gdma_ll_tx_restart(group->hal.dev, pair->pair_id); in gdma_append()
486 static void gdma_uninstall_pair(gdma_pair_t *pair) in gdma_uninstall_pair() argument
488 gdma_group_t *group = pair->group; in gdma_uninstall_pair()
489 int pair_id = pair->pair_id; in gdma_uninstall_pair()
498 if (pair->intr) { in gdma_uninstall_pair()
500 esp_intr_disable(pair->intr); in gdma_uninstall_pair()
501 …gdma_ll_enable_interrupt(group->hal.dev, pair->pair_id, UINT32_MAX, false); // disable all interup… in gdma_uninstall_pair()
502 …gdma_ll_clear_interrupt_status(group->hal.dev, pair->pair_id, UINT32_MAX); // clear all pending e… in gdma_uninstall_pair()
508 if (pair->intr) { in gdma_uninstall_pair()
509 esp_intr_free(pair->intr); // free interrupt resource in gdma_uninstall_pair()
512 free(pair); in gdma_uninstall_pair()
522 gdma_pair_t *pair = NULL; in gdma_acquire_pair_handle() local
530 pair = pre_alloc_pair; in gdma_acquire_pair_handle()
531 group->pairs[pair_id] = pair; // register to group in gdma_acquire_pair_handle()
532 pair->group = group; in gdma_acquire_pair_handle()
533 pair->pair_id = pair_id; in gdma_acquire_pair_handle()
534 pair->spinlock = (portMUX_TYPE)portMUX_INITIALIZER_UNLOCKED; in gdma_acquire_pair_handle()
536 pair = group->pairs[pair_id]; in gdma_acquire_pair_handle()
546 ESP_LOGD(TAG, "new pair (%d,%d) at %p", group->group_id, pair->pair_id, pair); in gdma_acquire_pair_handle()
551 return pair; in gdma_acquire_pair_handle()
554 static void gdma_release_pair_handle(gdma_pair_t *pair) in gdma_release_pair_handle() argument
556 if (pair) { in gdma_release_pair_handle()
557 gdma_uninstall_pair(pair); in gdma_release_pair_handle()
563 gdma_pair_t *pair = dma_channel->pair; in gdma_del_tx_channel() local
564 gdma_group_t *group = pair->group; in gdma_del_tx_channel()
566 portENTER_CRITICAL(&pair->spinlock); in gdma_del_tx_channel()
567 pair->tx_chan = NULL; in gdma_del_tx_channel()
568 pair->occupy_code &= ~SEARCH_REQUEST_TX_CHANNEL; in gdma_del_tx_channel()
569 portEXIT_CRITICAL(&pair->spinlock); in gdma_del_tx_channel()
571 ESP_LOGD(TAG, "del tx channel (%d,%d)", group->group_id, pair->pair_id); in gdma_del_tx_channel()
573 gdma_uninstall_pair(pair); in gdma_del_tx_channel()
579 gdma_pair_t *pair = dma_channel->pair; in gdma_del_rx_channel() local
580 gdma_group_t *group = pair->group; in gdma_del_rx_channel()
582 portENTER_CRITICAL(&pair->spinlock); in gdma_del_rx_channel()
583 pair->rx_chan = NULL; in gdma_del_rx_channel()
584 pair->occupy_code &= ~SEARCH_REQUEST_RX_CHANNEL; in gdma_del_rx_channel()
585 portEXIT_CRITICAL(&pair->spinlock); in gdma_del_rx_channel()
587 ESP_LOGD(TAG, "del rx channel (%d,%d)", group->group_id, pair->pair_id); in gdma_del_rx_channel()
589 gdma_uninstall_pair(pair); in gdma_del_rx_channel()
595 gdma_pair_t *pair = (gdma_pair_t *)args; in gdma_default_isr() local
596 gdma_group_t *group = pair->group; in gdma_default_isr()
597 gdma_rx_channel_t *rx_chan = pair->rx_chan; in gdma_default_isr()
598 gdma_tx_channel_t *tx_chan = pair->tx_chan; in gdma_default_isr()
601 uint32_t intr_status = gdma_ll_get_interrupt_status(group->hal.dev, pair->pair_id); in gdma_default_isr()
602 gdma_ll_clear_interrupt_status(group->hal.dev, pair->pair_id, intr_status); in gdma_default_isr()
606 uint32_t eof_addr = gdma_ll_rx_get_success_eof_desc_addr(group->hal.dev, pair->pair_id); in gdma_default_isr()
618 uint32_t eof_addr = gdma_ll_tx_get_eof_desc_addr(group->hal.dev, pair->pair_id); in gdma_default_isr()
633 static esp_err_t gdma_install_interrupt(gdma_pair_t *pair) in gdma_install_interrupt() argument
636 gdma_group_t *group = pair->group; in gdma_install_interrupt()
642 …ma_periph_signals.groups[group->group_id].pairs[pair->pair_id].irq_id, isr_flags, gdma_default_isr… in gdma_install_interrupt()
645 if (!pair->intr) { in gdma_install_interrupt()
646 portENTER_CRITICAL(&pair->spinlock); in gdma_install_interrupt()
647 if (!pair->intr) { in gdma_install_interrupt()
649 pair->intr = intr; in gdma_install_interrupt()
650 …gdma_ll_enable_interrupt(group->hal.dev, pair->pair_id, UINT32_MAX, false); // disable all interup… in gdma_install_interrupt()
651 …gdma_ll_clear_interrupt_status(group->hal.dev, pair->pair_id, UINT32_MAX); // clear all pending e… in gdma_install_interrupt()
653 portEXIT_CRITICAL(&pair->spinlock); in gdma_install_interrupt()
656 ESP_LOGD(TAG, "install interrupt service for pair (%d,%d)", group->group_id, pair->pair_id); in gdma_install_interrupt()