Changeset 7e195e66 in rtems


Ignore:
Timestamp:
Sep 28, 2017, 7:29:38 AM (19 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
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.

Location:
c/src/lib/libbsp
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/imx/console/console-config.c

    r4cfce5c r7e195e66  
    8585
    8686#ifdef CONSOLE_USE_INTERRUPTS
    87   val = fdt_getprop(fdt, node, "interrupts", &len);
    88   if (val != NULL && len >= 8) {
    89     uint32_t cpu_val[2];
    90     cpu_val[1] = fdt32_to_cpu(val[1]);
    91     ctx->irq = bsp_fdt_map_intr(cpu_val, 2);
    92   }
     87  ctx->irq = imx_get_irq_of_node(fdt, node, 0);
    9388#endif
    9489}
  • c/src/lib/libbsp/arm/imx/include/bsp.h

    r4cfce5c r7e195e66  
    4242void arm_generic_timer_get_config(uint32_t *frequency, uint32_t *irq);
    4343
     44rtems_vector_number imx_get_irq_of_node(
     45  const void *fdt,
     46  int node,
     47  size_t index
     48);
     49
    4450#ifdef __cplusplus
    4551}
  • 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
  • c/src/lib/libbsp/shared/include/fatal.h

    r4cfce5c r7e195e66  
    138138
    139139  /* i.MX fatal codes */
    140   IMX_FATAL_GENERIC_TIMER_FREQUENCY = BSP_FATAL_CODE_BLOCK(12),
    141   IMX_FATAL_GENERIC_TIMER_IRQ
     140  IMX_FATAL_GENERIC_TIMER_FREQUENCY = BSP_FATAL_CODE_BLOCK(12)
    142141} bsp_fatal_code;
    143142
Note: See TracChangeset for help on using the changeset viewer.