Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Wiki Markup
One of the largest OS data structures is the vector table, {{g_irqvector\[]}}.  This is the table that holds the vector information when {{irq_attach()}} is called and used to dispatch interrupts by {{irq_dispatch()}}.  Recent changes have made that table even larger, for 32-bit arm the size of that table is given by:

Code Block

  nbytes = number_of_interrupts * (2 * sizeof(void *))

We will focus on the STM32 for this discussion to keep things simple. However, this discussion applies to all architectures.

...

Wiki Markup
{{irq_attach()}} would this use this index to set the g_irqvector\[].

Code Block

  g_irqvector[ndx].handler = isr;
  g_irqvector[ndx].arg     = arg;

irq_dispatch()

irq_dispatch() is called by MCU logic when an interrupt is received:

...

Wiki Markup
{{irq_initialize()}}:  simply set the {{g_irqvector\[]}} table a known state on power-up.  It would only have to distinquish the difference in sizes.

Code Block

  #ifdef CONFIG_ARCH_MINIMAL_VECTORTABLE
  #  define TAB_SIZE CONFIG_ARCH_NUSER_INTERRUPTS
  #else
  #  define TAB_SIZE NR_IRQS
  #endif
Code Block

  for (i = 0; i < TAB_SIZE; i++)

Wiki Markup
g_mapirq\[] 

An implementation of up_mapirq() might be something like:

...

Wiki Markup
{{g_irqmap\[]}} is a array of mapped irq table indices. It contains the mapped index value and is itself indexed by the physical interrupt vector number.  It provides an {{irq_mapped_t}} value in the range of 0 to {{CONFIG_ARCH_NUSER_INTERRUPTS}} that is the new, mapped index into the vector table.  Unsupported IRQs would simply map to an out of range value like {{IRQMAPPED_MAX}}.  So, for example, if {{g_irqmap\[37] 

Wiki Markup
24}}, then the hardware interrupt vector 37 will be mapped to the interrupt vector table at index 24.  if {{g_irqmap\[42]  IRQMAPPED_MAX}}, then hardware interrupt vector 42 is not used and if it occurs will result in an unexpected interrupt crash.

Hardware Vector Remapping

...