예제 #1
0
/*
 * High level IRQ handler called from shared_raw_irq_code_entry
 */
int C_dispatch_irq_handler(
  BSP_Exception_frame *frame,
  unsigned int excNum
)
{
  register unsigned int irq;
#if (HAS_PMC_PSC8)
  uint16_t              check_irq;
  uint16_t              status_word;
#endif

  if (excNum == ASM_DEC_VECTOR) {
    bsp_irq_dispatch_list(rtems_hdl_tbl, BSP_DECREMENTER, dflt_entry.hdl);
    return 0;
  }

  irq = read_and_clear_irq();

#if (HAS_PMC_PSC8)
   if (irq ==  SCORE603E_PCI_IRQ_0) {
     status_word = read_and_clear_PMC_irq( irq );
     for (check_irq=SCORE603E_IRQ16; check_irq<=SCORE603E_IRQ19; check_irq++) {
       if ( Is_PMC_IRQ( check_irq, status_word )) {
         bsp_irq_dispatch_list_base(rtems_hdl_tbl, check_irq, dflt_entry.hdl);
       }
     }
   } else
#endif
   {
    bsp_irq_dispatch_list_base(rtems_hdl_tbl, irq, dflt_entry.hdl);
   }

  return 0;
}
예제 #2
0
/*
 * High level IRQ handler called from shared_raw_irq_code_entry
 */
int C_dispatch_irq_handler (BSP_Exception_frame *frame, unsigned int excNum)
{
  register unsigned int irq;
#if BSP_ISA_IRQ_NUMBER > 0
  register unsigned isaIntr;                  /* boolean */
  register unsigned oldMask = 0;	      /* old isa pic masks */
  register unsigned newMask;                  /* new isa pic masks */
#endif

  if (excNum == ASM_DEC_VECTOR) {

  	bsp_irq_dispatch_list(rtems_hdl_tbl, BSP_DECREMENTER, default_rtems_entry.hdl);

    return 0;

  }

#if BSP_PCI_IRQ_NUMBER > 0
  if ( OpenPIC ) {
    irq = openpic_irq(0);
    if (irq == OPENPIC_VEC_SPURIOUS) {
      ++BSP_spuriousIntr;
      return 0;
    }

    /* some BSPs might want to use a different numbering... */
    irq = irq - OPENPIC_VEC_SOURCE + BSP_PCI_IRQ_LOWEST_OFFSET;
  } else {
#if BSP_ISA_IRQ_NUMBER > 0
#ifdef BSP_PCI_ISA_BRIDGE_IRQ
	irq = BSP_PCI_ISA_BRIDGE_IRQ;
#else
#error "Configuration Error -- BSP with ISA + PCI IRQs MUST define BSP_PCI_ISA_BRIDGE_IRQ"
#endif
#else
	BSP_panic("MUST have an OpenPIC if BSP has PCI IRQs but no ISA IRQs");
	/* BSP_panic() never returns but the 'return' statement silences
	 * a compiler warning about 'irq' possibly being used w/o initialization.
	 */
	return -1;
#endif
  }
#endif

#if BSP_ISA_IRQ_NUMBER > 0
#ifdef BSP_PCI_ISA_BRIDGE_IRQ
#if 0 == BSP_PCI_IRQ_NUMBER 
#error "Configuration Error -- BSP w/o PCI IRQs MUST NOT define BSP_PCI_ISA_BRIDGE_IRQ"
#endif
  isaIntr = (irq == BSP_PCI_ISA_BRIDGE_IRQ);
#else
  isaIntr = 1;
#endif
  if (isaIntr)  {
    /*
     * Acknowledge and read 8259 vector
     */
    irq = (unsigned int) (*(unsigned char *) RAVEN_INTR_ACK_REG);
    /*
     * store current PIC mask
     */
    oldMask = i8259s_cache;
    newMask = oldMask | irq_mask_or_tbl [irq];
    i8259s_cache = newMask;
    outport_byte(PIC_MASTER_IMR_IO_PORT, i8259s_cache & 0xff);
    outport_byte(PIC_SLAVE_IMR_IO_PORT, ((i8259s_cache & 0xff00) >> 8));
    BSP_irq_ack_at_i8259s (irq);
#if BSP_PCI_IRQ_NUMBER > 0
	if ( OpenPIC )
      openpic_eoi(0);
#endif
  }
#endif

  /* dispatch handlers */
  bsp_irq_dispatch_list(rtems_hdl_tbl, irq, default_rtems_entry.hdl);

#if BSP_ISA_IRQ_NUMBER > 0
  if (isaIntr)  {
    i8259s_cache = oldMask;
    outport_byte(PIC_MASTER_IMR_IO_PORT, i8259s_cache & 0xff);
    outport_byte(PIC_SLAVE_IMR_IO_PORT, ((i8259s_cache & 0xff00) >> 8));
  }
  else
#endif
  {
#if BSP_PCI_IRQ_NUMBER > 0
#ifdef BSP_PCI_VME_DRIVER_DOES_EOI
	/* leave it to the VME bridge driver to do EOI, so
     * it can re-enable the openpic while handling
     * VME interrupts (-> VME priorities in software)
	 */
	if (_BSP_vme_bridge_irq != irq && OpenPIC)