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

Function rt_pic_detach_irq

components/drivers/pic/pic.c:419–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417}
418
419rt_err_t rt_pic_detach_irq(int irq, void *uid)
420{
421 rt_err_t err = -RT_EINVAL;
422 struct rt_pic_irq *pirq = irq2pirq(irq);
423
424 if (pirq)
425 {
426 rt_bool_t will_free = RT_FALSE;
427 struct rt_pic_isr *isr = RT_NULL;
428 rt_ubase_t level = rt_spin_lock_irqsave(&pirq->rw_lock);
429
430 isr = &pirq->isr;
431
432 if (isr->action.param == uid)
433 {
434 if (rt_list_isempty(&isr->list))
435 {
436 isr->action.handler = RT_NULL;
437 isr->action.param = RT_NULL;
438 }
439 else
440 {
441 struct rt_pic_isr *next_isr = rt_list_first_entry(&isr->list, struct rt_pic_isr, list);
442
443 rt_list_remove(&next_isr->list);
444
445 isr->action.handler = next_isr->action.handler;
446 isr->action.param = next_isr->action.param;
447 #ifdef RT_USING_INTERRUPT_INFO
448 isr->action.counter = next_isr->action.counter;
449 rt_strncpy(isr->action.name, next_isr->action.name, RT_NAME_MAX);
450 #ifdef RT_USING_SMP
451 rt_memcpy(isr->action.cpu_counter, next_isr->action.cpu_counter, sizeof(next_isr->action.cpu_counter));
452 #endif
453 #endif
454
455 isr = next_isr;
456 will_free = RT_TRUE;
457 }
458
459 err = RT_EOK;
460 }
461 else
462 {
463 rt_list_for_each_entry(isr, &pirq->isr.list, list)
464 {
465 if (isr->action.param == uid)
466 {
467 err = RT_EOK;
468
469 will_free = RT_TRUE;
470 rt_list_remove(&isr->list);
471 break;
472 }
473 }
474 }
475
476 rt_spin_unlock_irqrestore(&pirq->rw_lock, level);

Callers 10

dw_wdt_removeFunction · 0.85
dw_pcie_free_msiFunction · 0.85
nvme_remove_io_queuesFunction · 0.85
nvme_remove_admin_queuesFunction · 0.85
rt_ahci_host_registerFunction · 0.85
rt_ahci_host_unregisterFunction · 0.85
pic_mbox_removeFunction · 0.85
pl011_removeFunction · 0.85
serial8250_removeFunction · 0.85

Calls 8

irq2pirqFunction · 0.85
rt_list_isemptyFunction · 0.85
rt_list_removeFunction · 0.85
rt_strncpyFunction · 0.85
rt_memcpyFunction · 0.85
rt_freeFunction · 0.85
rt_spin_lock_irqsaveFunction · 0.50

Tested by

no test coverage detected