Ignore:
Timestamp:
09/28/17 07:29:38 (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
ce28d601
Parents:
4cfce5c
git-author:
Sebastian Huber <sebastian.huber@…> (09/28/17 07:29:38)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/02/17 11:40:56)
Message:

bsp/imx: Add imx_get_irq_of_node()

Update #3090.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/imx/startup/bspstart.c

    r4cfce5c r7e195e66  
    2222#include <libfdt.h>
    2323
     24#define MAGIC_IRQ_OFFSET 32
     25
     26rtems_vector_number imx_get_irq_of_node(
     27  const void *fdt,
     28  int node,
     29  size_t index
     30)
     31{
     32  int len;
     33  const uint32_t *val;
     34
     35  val = fdt_getprop(fdt, node, "interrupts", &len);
     36  if (val == NULL || len < (int) ((index + 1) * 12)) {
     37    return UINT32_MAX;
     38  }
     39
     40  return fdt32_to_cpu(val[index * 3 + 1]) + MAGIC_IRQ_OFFSET;
     41}
     42
    2443uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells)
    2544{
    26   return intr[1] + 32;
     45  return intr[1] + MAGIC_IRQ_OFFSET;
    2746}
    2847
     
    4766  }
    4867
    49   val = fdt_getprop(fdt, node, "interrupts", &len);
    50   if (val != NULL && len >= 8) {
    51     /* FIXME: Figure out how Linux gets a proper IRQ number */
    52     *irq = 16 + fdt32_to_cpu(val[1]);
    53   } else {
    54     bsp_fatal(IMX_FATAL_GENERIC_TIMER_IRQ);
    55   }
     68  /* FIXME: Figure out how Linux gets a proper IRQ number */
     69  *irq = imx_get_irq_of_node(fdt, node, 0) - 16;
    5670}
    5771
Note: See TracChangeset for help on using the changeset viewer.