| 539 | } |
| 540 | |
| 541 | rt_err_t rt_pic_handle_isr(struct rt_pic_irq *pirq) |
| 542 | { |
| 543 | rt_err_t err = -RT_EEMPTY; |
| 544 | rt_list_t *handler_nodes; |
| 545 | struct rt_irq_desc *action; |
| 546 | #ifdef RT_USING_PIC_STATISTICS |
| 547 | struct timespec ts; |
| 548 | rt_ubase_t irq_time_ns; |
| 549 | rt_ubase_t current_irq_begin; |
| 550 | #endif |
| 551 | |
| 552 | RT_ASSERT(pirq != RT_NULL); |
| 553 | RT_ASSERT(pirq->pic != RT_NULL); |
| 554 | |
| 555 | #ifdef RT_USING_PIC_STATISTICS |
| 556 | rt_ktime_boottime_get_ns(&ts); |
| 557 | current_irq_begin = ts.tv_sec * (1000UL * 1000 * 1000) + ts.tv_nsec; |
| 558 | #endif |
| 559 | |
| 560 | handler_nodes = &pirq->isr.list; |
| 561 | action = &pirq->isr.action; |
| 562 | |
| 563 | if (!rt_list_isempty(&pirq->children_nodes)) |
| 564 | { |
| 565 | struct rt_pic_irq *child; |
| 566 | |
| 567 | rt_list_for_each_entry(child, &pirq->children_nodes, list) |
| 568 | { |
| 569 | if (child->pic->ops->irq_ack) |
| 570 | { |
| 571 | child->pic->ops->irq_ack(child); |
| 572 | } |
| 573 | |
| 574 | err = rt_pic_handle_isr(child); |
| 575 | |
| 576 | if (child->pic->ops->irq_eoi) |
| 577 | { |
| 578 | child->pic->ops->irq_eoi(child); |
| 579 | } |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | if (action->handler) |
| 584 | { |
| 585 | action->handler(pirq->irq, action->param); |
| 586 | #ifdef RT_USING_INTERRUPT_INFO |
| 587 | action->counter++; |
| 588 | #ifdef RT_USING_SMP |
| 589 | action->cpu_counter[rt_hw_cpu_id()]++; |
| 590 | #endif |
| 591 | #endif |
| 592 | |
| 593 | if (!rt_list_isempty(handler_nodes)) |
| 594 | { |
| 595 | struct rt_pic_isr *isr; |
| 596 | |
| 597 | rt_list_for_each_entry(isr, handler_nodes, list) |
| 598 | { |
no test coverage detected