forked from Imagelibrary/rtems
2007-11-30 Till Straumann <strauman@slac.stanford.edu>
* shared/irq/irq.h, shared/irq/irq.c, shared/irq/irq_init.c, shared/irq/irq_supp.h (added): Removed 'is_processor_irq()' from irq.c; the BSP routines BSP_enable_irq_at_pic()/BSP_disable_irq_at_pic() are required to ignore processor irqs anyways. Removed all BSP-defined constants from irq.c. This makes irq.c (almost) binary-compatible among BSPs (ultimate goal is making 'shared' a library). Added a header (irq_supp.h) defining the interface between the generic interrupt manager (irq.c) and the routines it requires to be supplied by the BSP (eventually, these should go into rtems/irq.h).
This commit is contained in:
@@ -1,3 +1,18 @@
|
|||||||
|
2007-11-30 Till Straumann <strauman@slac.stanford.edu>
|
||||||
|
|
||||||
|
* shared/irq/irq.h, shared/irq/irq.c, shared/irq/irq_init.c,
|
||||||
|
shared/irq/irq_supp.h (added):
|
||||||
|
Removed 'is_processor_irq()' from irq.c; the BSP routines
|
||||||
|
BSP_enable_irq_at_pic()/BSP_disable_irq_at_pic() are required
|
||||||
|
to ignore processor irqs anyways. Removed
|
||||||
|
all BSP-defined constants from irq.c. This makes irq.c (almost)
|
||||||
|
binary-compatible among BSPs (ultimate goal is making 'shared'
|
||||||
|
a library).
|
||||||
|
Added a header (irq_supp.h) defining the interface between
|
||||||
|
the generic interrupt manager (irq.c) and the routines it
|
||||||
|
requires to be supplied by the BSP (eventually, these
|
||||||
|
should go into rtems/irq.h).
|
||||||
|
|
||||||
2007-11-30 Till Straumann <strauman@slac.stanford.edu>
|
2007-11-30 Till Straumann <strauman@slac.stanford.edu>
|
||||||
|
|
||||||
* shared/irq/irq.h, shared/irq/irq_init.c: Removed the definition
|
* shared/irq/irq.h, shared/irq/irq_init.c: Removed the definition
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <bsp.h>
|
#include <rtems/irq.h>
|
||||||
#include <bsp/irq.h>
|
#include <bsp/irq_supp.h>
|
||||||
#include <rtems/score/apiext.h> /* for post ISR signal processing */
|
#include <rtems/score/apiext.h> /* for post ISR signal processing */
|
||||||
#include <libcpu/raw_exception.h>
|
#include <libcpu/raw_exception.h>
|
||||||
#include <bsp/vectors.h>
|
#include <bsp/vectors.h>
|
||||||
@@ -39,17 +39,6 @@ static rtems_irq_connect_data default_rtems_entry;
|
|||||||
static rtems_irq_global_settings* internal_config;
|
static rtems_irq_global_settings* internal_config;
|
||||||
static rtems_irq_connect_data* rtems_hdl_tbl;
|
static rtems_irq_connect_data* rtems_hdl_tbl;
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if IRQ is a Processor IRQ
|
|
||||||
*/
|
|
||||||
static inline int is_processor_irq(const rtems_irq_number irqLine)
|
|
||||||
{
|
|
||||||
return (((int) irqLine <= BSP_PROCESSOR_IRQ_MAX_OFFSET) &
|
|
||||||
((int) irqLine >= BSP_PROCESSOR_IRQ_LOWEST_OFFSET)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ------------------------ RTEMS Irq helper functions ----------------
|
* ------------------------ RTEMS Irq helper functions ----------------
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +50,7 @@ static inline int is_processor_irq(const rtems_irq_number irqLine)
|
|||||||
|
|
||||||
static int isValidInterrupt(int irq)
|
static int isValidInterrupt(int irq)
|
||||||
{
|
{
|
||||||
if ( (irq < BSP_LOWEST_OFFSET) || (irq > BSP_MAX_OFFSET))
|
if ( (irq < internal_config->irqBase) || (irq >= internal_config->irqBase + internal_config->irqNb))
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -100,13 +89,13 @@ int BSP_install_rtems_shared_irq_handler (const rtems_irq_connect_data* irq)
|
|||||||
/* link chain to new topmost handler */
|
/* link chain to new topmost handler */
|
||||||
rtems_hdl_tbl[irq->name].next_handler = (void *)vchain;
|
rtems_hdl_tbl[irq->name].next_handler = (void *)vchain;
|
||||||
|
|
||||||
if (is_processor_irq(irq->name)) {
|
/*
|
||||||
/*
|
* enable_irq_at_pic is supposed to ignore
|
||||||
* Enable exception at processor level
|
* requests to disable interrupts outside
|
||||||
*/
|
* of the range handled by the PIC
|
||||||
} else {
|
*/
|
||||||
BSP_enable_irq_at_pic(irq->name);
|
BSP_enable_irq_at_pic(irq->name);
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Enable interrupt on device
|
* Enable interrupt on device
|
||||||
*/
|
*/
|
||||||
@@ -150,13 +139,13 @@ int BSP_install_rtems_irq_handler (const rtems_irq_connect_data* irq)
|
|||||||
rtems_hdl_tbl[irq->name] = *irq;
|
rtems_hdl_tbl[irq->name] = *irq;
|
||||||
rtems_hdl_tbl[irq->name].next_handler = (void *)-1;
|
rtems_hdl_tbl[irq->name].next_handler = (void *)-1;
|
||||||
|
|
||||||
if (is_processor_irq(irq->name)) {
|
/*
|
||||||
/*
|
* enable_irq_at_pic is supposed to ignore
|
||||||
* Enable exception at processor level
|
* requests to disable interrupts outside
|
||||||
*/
|
* of the range handled by the PIC
|
||||||
} else {
|
*/
|
||||||
BSP_enable_irq_at_pic(irq->name);
|
BSP_enable_irq_at_pic(irq->name);
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Enable interrupt on device
|
* Enable interrupt on device
|
||||||
*/
|
*/
|
||||||
@@ -231,13 +220,12 @@ int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data* irq)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_processor_irq(irq->name)) {
|
/*
|
||||||
/*
|
* disable_irq_at_pic is supposed to ignore
|
||||||
* disable exception at processor level
|
* requests to disable interrupts outside
|
||||||
*/
|
* of the range handled by the PIC
|
||||||
} else {
|
*/
|
||||||
BSP_disable_irq_at_pic(irq->name);
|
BSP_disable_irq_at_pic(irq->name);
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disable interrupt on device
|
* Disable interrupt on device
|
||||||
@@ -301,7 +289,7 @@ int BSP_rtems_irq_mngt_set(rtems_irq_global_settings* config)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i = BSP_LOWEST_OFFSET; i <= BSP_MAX_OFFSET; i++ ) {
|
for ( i = config->irqBase; i < config->irqBase + config->irqNb; i++ ) {
|
||||||
for( vchain = &rtems_hdl_tbl[i];
|
for( vchain = &rtems_hdl_tbl[i];
|
||||||
((int)vchain != -1 && vchain->hdl != default_rtems_entry.hdl);
|
((int)vchain != -1 && vchain->hdl != default_rtems_entry.hdl);
|
||||||
vchain = (rtems_irq_connect_data*)vchain->next_handler )
|
vchain = (rtems_irq_connect_data*)vchain->next_handler )
|
||||||
|
|||||||
@@ -181,14 +181,9 @@ int BSP_irq_enabled_at_i8259s (const rtems_irq_number irqLine);
|
|||||||
extern void BSP_rtems_irq_mng_init(unsigned cpuId);
|
extern void BSP_rtems_irq_mng_init(unsigned cpuId);
|
||||||
extern void BSP_i8259s_init(void);
|
extern void BSP_i8259s_init(void);
|
||||||
|
|
||||||
/*
|
/* Stuff in irq_supp.h should eventually go into <rtems/irq.h> */
|
||||||
* PIC-independent function to enable/disable interrupt lines at
|
#include <bsp/irq_supp.h>
|
||||||
* the pic.
|
|
||||||
*/
|
|
||||||
extern void BSP_enable_irq_at_pic (const rtems_irq_number irqLine);
|
|
||||||
extern void BSP_disable_irq_at_pic (const rtems_irq_number irqLine);
|
|
||||||
|
|
||||||
extern int BSP_setup_the_pic (rtems_irq_global_settings* config);
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <bsp/residual.h>
|
#include <bsp/residual.h>
|
||||||
#include <bsp/openpic.h>
|
#include <bsp/openpic.h>
|
||||||
#include <bsp/irq.h>
|
#include <bsp/irq.h>
|
||||||
|
#include <bsp/irq_supp.h>
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <libcpu/raw_exception.h>
|
#include <libcpu/raw_exception.h>
|
||||||
#include <bsp/motorola.h>
|
#include <bsp/motorola.h>
|
||||||
|
|||||||
42
c/src/lib/libbsp/powerpc/shared/irq/irq_supp.h
Normal file
42
c/src/lib/libbsp/powerpc/shared/irq/irq_supp.h
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#ifndef IRQ_SHARED_IRQ_C_GLUE_H
|
||||||
|
#define IRQ_SHARED_IRQ_C_GLUE_H
|
||||||
|
/*
|
||||||
|
* This header describes the routines that are needed by the shared
|
||||||
|
* version of 'irq.c' (implementing the RTEMS irq API). They
|
||||||
|
* must be provided by the BSP.
|
||||||
|
*
|
||||||
|
* The license and distribution terms for this file may be
|
||||||
|
* found in found in the file LICENSE in this distribution or at
|
||||||
|
* http://www.rtems.com/license/LICENSE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <rtems/irq.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PIC-independent functions to enable/disable interrupt lines at
|
||||||
|
* the pic.
|
||||||
|
*
|
||||||
|
* NOTE: the routines must ignore requests for enabling/disabling
|
||||||
|
* interrupts that are outside of the range handled by the
|
||||||
|
* PIC(s).
|
||||||
|
*/
|
||||||
|
extern void BSP_enable_irq_at_pic (const rtems_irq_number irqLine);
|
||||||
|
extern void BSP_disable_irq_at_pic (const rtems_irq_number irqLine);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the PIC.
|
||||||
|
* Return nonzero on success, zero on failure (which will be treated
|
||||||
|
* as fatal by the manager).
|
||||||
|
*/
|
||||||
|
extern int BSP_setup_the_pic (rtems_irq_global_settings* config);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <bsp/irq.h>
|
#include <bsp/irq.h>
|
||||||
|
#include <bsp/irq_supp.h>
|
||||||
#include <bsp/VMEConfig.h>
|
#include <bsp/VMEConfig.h>
|
||||||
#include <bsp/openpic.h>
|
#include <bsp/openpic.h>
|
||||||
#include <libcpu/raw_exception.h>
|
#include <libcpu/raw_exception.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user