Changeset d168079 in rtems


Ignore:
Timestamp:
Jul 9, 2013, 2:38:03 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
0a697dd9
Parents:
296b60d7
git-author:
Sebastian Huber <sebastian.huber@…> (07/09/13 14:38:03)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/09/13 14:42:00)
Message:

bsp/virtex: Use ppc_count_leading_zeros()

Use ppc_count_leading_zeros() to optimize interrupt processing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/virtex/irq/irq_init.c

    r296b60d7 rd168079  
    3838#include <bsp/irq-generic.h>
    3939#include <bsp/vectors.h>
     40
     41#include <libcpu/powerpc-utility.h>
    4042
    4143/*
     
    8789  ipr = get_ipr();
    8890
    89   /* Acknowledge all pending interrupts now and service them afterwards */
    90   set_iar(ipr);
     91  if (ipr != 0) {
     92    /* Acknowledge all pending interrupts now and service them afterwards */
     93    set_iar(ipr);
    9194
    92   for (i = 0;
    93        (i < BSP_OPBINTC_PER_IRQ_NUMBER)
    94          && (ipr != 0);
    95        i++) {
    96     c = (1 << i);
     95    do {
     96      /* Get highest priority pending interrupt */
     97      uint32_t i = 31 - ppc_count_leading_zeros(ipr);
    9798
    98     if ((ipr & c) != 0) {
    99       /* interrupt is asserted */
    100       ipr &= ~c;
     99      ipr &= ~(1U << i);
    101100
    102101      bsp_interrupt_handler_dispatch(i+BSP_OPBINTC_IRQ_LOWEST_OFFSET);
    103     }
     102    } while (ipr != 0);
    104103  }
    105104}
Note: See TracChangeset for help on using the changeset viewer.