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

Function dtb_node_irq_get

components/legacy/fdt/src/dtb_base.c:480–516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

478}
479
480int dtb_node_irq_get(struct dtb_node *dev, int index)
481{
482 int rc = 0;
483 struct fdt_phandle_args out_irq;
484 struct dtb_node *p;
485 uint32_t intsize;
486 int res, i;
487
488 p = dtb_node_irq_find_parent(dev);
489 if (p == NULL)
490 return -EINVAL;
491 /* Get size of interrupt specifier */
492 if (dtb_node_read_u32_array(p, "#interrupt-cells", &intsize, 1))
493 {
494 res = -EINVAL;
495 goto out;
496 }
497
498 debug(" path:%s, parent=%pOF, intsize=%d\n", p->path,p, intsize);
499
500 /* Copy intspec into irq structure */
501 out_irq.np = p;
502 out_irq.args_count = intsize;
503 for (i = 0; i < intsize; i++)
504 {
505 res = dtb_node_read_u32_index(dev, "interrupts",
506 (index * 3 + i),
507 out_irq.args + i);
508 if (res)
509 goto out;
510 }
511 rc = out_irq.args[1];
512 out:
513 dtb_node_put(p);
514 return rc;
515
516}
517
518/**
519 * dtb_node_irq_get_byname - Decode a node's IRQ and return it as a Linux IRQ number

Callers 1

dtb_node_irq_get_bynameFunction · 0.85

Calls 4

dtb_node_irq_find_parentFunction · 0.85
dtb_node_read_u32_arrayFunction · 0.85
dtb_node_read_u32_indexFunction · 0.85
dtb_node_putFunction · 0.85

Tested by

no test coverage detected