/* genpvec.c * * These routines handle the external exception. Multiple ISRs occur off * of this one interrupt. * * COPYRIGHT (c) 1989-1997. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may in * the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. * * $Id$ */ #include #include #include #include /* for sprintf */ /* * Proto types for this file */ rtems_isr external_exception_ISR ( rtems_vector_number vector /* IN */ ); #define NUM_LIRQ_HANDLERS 20 #define NUM_LIRQ ( MAX_BOARD_IRQS - PPC_IRQ_LAST ) /* * Structure to for one of possible multiple interrupt handlers for * a given interrupt. */ typedef struct { Chain_Node Node; rtems_isr_entry handler; /* isr routine */ rtems_vector_number vector; /* vector number */ } EE_ISR_Type; /* Note: The following will not work if we add a method to remove * handlers at a later time. */ EE_ISR_Type ISR_Nodes [NUM_LIRQ_HANDLERS]; uint16_t Nodes_Used; Chain_Control ISR_Array [NUM_LIRQ]; /* XXX */ void init_irq_data_register(); void initialize_external_exception_vector () { int i; rtems_isr_entry previous_isr; rtems_status_code status; Nodes_Used = 0; /* * Mask out all interupts until they have a handler installed. */ for (i=0; i = NUM_LIRQ ) { sprintf( err_msg, "ERROR:: Invalid interrupt number (%02x)\n", index ); DEBUG_puts( err_msg ); return; } #if (HAS_PMC_PSC8) PMC_irq = SCORE603E_PCI_IRQ_0 - SCORE603E_IRQ00; if (index == PMC_irq) { status_word = read_and_clear_PMC_irq( index ); for (check_irq=SCORE603E_IRQ16; check_irq<=SCORE603E_IRQ19; check_irq++) { if ( Is_PMC_IRQ( check_irq, status_word )) { index = check_irq - SCORE603E_IRQ00; node = (EE_ISR_Type *)(ISR_Array[ index ].first); if ( _Chain_Is_tail( &ISR_Array[ index ], (void *)node ) ) { sprintf(err_msg,"ERROR:: check %d interrupt %02d has no isr\n", check_irq, index); DEBUG_puts( err_msg); value = get_irq_mask(); sprintf(err_msg," Mask = %02x\n", value); DEBUG_puts( err_msg); } while ( !_Chain_Is_tail( &ISR_Array[ index ], (void *)node ) ) { (*node->handler)( node->vector ); node = (EE_ISR_Type *) node->Node.next; } } } } else #endif { node = (EE_ISR_Type *)(ISR_Array[ index ].first); if ( _Chain_Is_tail( &ISR_Array[ index ], (void *)node ) ) { sprintf(err_msg,"ERROR:: interrupt %02x has no isr\n", index); DEBUG_puts( err_msg); value = get_irq_mask(); sprintf(err_msg," Mask = %02x\n", value); DEBUG_puts( err_msg); return; } while ( !_Chain_Is_tail( &ISR_Array[ index ], (void *)node ) ) { (*node->handler)( node->vector ); node = (EE_ISR_Type *) node->Node.next; } } }