/* genpvec.c * * These routines handle the external exception. Multiple ISRs occur off * of this one interrupt. This method will allow multiple ISRs to be * called using the same IRQ index. However, removing the ISR routines is * presently not supported. * * The external exception vector numbers begin with DMV170_IRQ_FIRST. * DMV170_IRQ_FIRST is defined to be one greater than the last processor * interrupt. * * COPYRIGHT (c) 1989-1999. * 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.OARcorp.com/rtems/license.html. * * $Id$ */ #include #include #include #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]; rtems_unsigned16 Nodes_Used; Chain_Control ISR_Array [NUM_LIRQ]; /*PAGE * * external_exception_ISR * * This interrupt service routine is called for an External Exception. * * Input parameters: * vector - vector number representing the external exception vector. * * Output parameters: NONE * * Return values: */ rtems_isr external_exception_ISR ( rtems_vector_number vector /* IN */ ) { rtems_unsigned16 index; rtems_boolean is_active=FALSE; rtems_unsigned32 scv64_status; Chain_Node *node; EE_ISR_Type *ee_isr; /* * Get all active interrupts. */ scv64_status = SCV64_Get_Interrupt(); scv64_status &= SCV64_Get_Interrupt_Enable(); /* * Process any set interrupts. */ for (index = 0; index <= 5; index++) { switch(index) { case 0: is_active = SCV64_Is_IRQ0( scv64_status ); break; case 1: is_active = SCV64_Is_IRQ1( scv64_status ); break; case 2: is_active = SCV64_Is_IRQ2( scv64_status ); break; case 3: is_active = SCV64_Is_IRQ3( scv64_status ); break; case 4: is_active = SCV64_Is_IRQ4( scv64_status ); break; case 5: is_active = SCV64_Is_IRQ5( scv64_status ); break; } if (is_active) { /* * Read vector. */ node = ISR_Array[ index ].first; while ( !_Chain_Is_tail( &ISR_Array[ index ], node ) ) { ee_isr = (EE_ISR_Type *) node; (*ee_isr->handler)( ee_isr->vector ); node = node->next; } } } } /*PAGE * * initialize_external_exception_vector * * This routine initializes the external exception vector * * Input parameters: NONE * * Output parameters: NONE * * Return values: NONE */ void initialize_external_exception_vector () { int i; rtems_isr_entry previous_isr; rtems_status_code status; extern void SCV64_Initialize( void ); Nodes_Used = 0; /* * Initialize the SCV64 chip */ SCV64_Initialize(); for (i=0; i