diff options
author | Till Straumann <strauman@slac.stanford.edu> | 2007-11-30 21:40:12 +0000 |
---|---|---|
committer | Till Straumann <strauman@slac.stanford.edu> | 2007-11-30 21:40:12 +0000 |
commit | 2eb9e3995c6ff0a76cf857d1032c79cf08ebbd30 (patch) | |
tree | fde1f1479f6358f78f4cd6524a4da25cf92bb919 /c/src/lib/libbsp/powerpc/shared/irq | |
parent | 2007-11-30 Till Straumann <strauman@slac.stanford.edu> (diff) | |
download | rtems-2eb9e3995c6ff0a76cf857d1032c79cf08ebbd30.tar.bz2 |
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).
Diffstat (limited to 'c/src/lib/libbsp/powerpc/shared/irq')
-rw-r--r-- | c/src/lib/libbsp/powerpc/shared/irq/irq.c | 60 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/shared/irq/irq.h | 9 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/shared/irq/irq_init.c | 1 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/shared/irq/irq_supp.h | 42 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c | 1 |
5 files changed, 70 insertions, 43 deletions
diff --git a/c/src/lib/libbsp/powerpc/shared/irq/irq.c b/c/src/lib/libbsp/powerpc/shared/irq/irq.c index 02646175fc..b5d1332658 100644 --- a/c/src/lib/libbsp/powerpc/shared/irq/irq.c +++ b/c/src/lib/libbsp/powerpc/shared/irq/irq.c @@ -13,8 +13,8 @@ #include <stdlib.h> -#include <bsp.h> -#include <bsp/irq.h> +#include <rtems/irq.h> +#include <bsp/irq_supp.h> #include <rtems/score/apiext.h> /* for post ISR signal processing */ #include <libcpu/raw_exception.h> #include <bsp/vectors.h> @@ -40,17 +40,6 @@ static rtems_irq_global_settings* internal_config; 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 ---------------- */ @@ -61,7 +50,7 @@ static inline int is_processor_irq(const rtems_irq_number irqLine) 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 1; } @@ -100,13 +89,13 @@ int BSP_install_rtems_shared_irq_handler (const rtems_irq_connect_data* irq) /* link chain to new topmost handler */ rtems_hdl_tbl[irq->name].next_handler = (void *)vchain; - if (is_processor_irq(irq->name)) { - /* - * Enable exception at processor level - */ - } else { - BSP_enable_irq_at_pic(irq->name); - } + /* + * enable_irq_at_pic is supposed to ignore + * requests to disable interrupts outside + * of the range handled by the PIC + */ + BSP_enable_irq_at_pic(irq->name); + /* * 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].next_handler = (void *)-1; - if (is_processor_irq(irq->name)) { - /* - * Enable exception at processor level - */ - } else { - BSP_enable_irq_at_pic(irq->name); - } + /* + * enable_irq_at_pic is supposed to ignore + * requests to disable interrupts outside + * of the range handled by the PIC + */ + BSP_enable_irq_at_pic(irq->name); + /* * 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 exception at processor level - */ - } else { - BSP_disable_irq_at_pic(irq->name); - } + /* + * disable_irq_at_pic is supposed to ignore + * requests to disable interrupts outside + * of the range handled by the PIC + */ + BSP_disable_irq_at_pic(irq->name); /* * Disable interrupt on device @@ -301,7 +289,7 @@ int BSP_rtems_irq_mngt_set(rtems_irq_global_settings* config) 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]; ((int)vchain != -1 && vchain->hdl != default_rtems_entry.hdl); vchain = (rtems_irq_connect_data*)vchain->next_handler ) diff --git a/c/src/lib/libbsp/powerpc/shared/irq/irq.h b/c/src/lib/libbsp/powerpc/shared/irq/irq.h index b1f3d26047..78ac3b7def 100644 --- a/c/src/lib/libbsp/powerpc/shared/irq/irq.h +++ b/c/src/lib/libbsp/powerpc/shared/irq/irq.h @@ -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_i8259s_init(void); -/* - * PIC-independent function to enable/disable interrupt lines at - * 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); +/* Stuff in irq_supp.h should eventually go into <rtems/irq.h> */ +#include <bsp/irq_supp.h> -extern int BSP_setup_the_pic (rtems_irq_global_settings* config); #ifdef __cplusplus }; #endif diff --git a/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c b/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c index 559ee68012..4ba7d6bf2f 100644 --- a/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c +++ b/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c @@ -24,6 +24,7 @@ #include <bsp/residual.h> #include <bsp/openpic.h> #include <bsp/irq.h> +#include <bsp/irq_supp.h> #include <bsp.h> #include <libcpu/raw_exception.h> #include <bsp/motorola.h> diff --git a/c/src/lib/libbsp/powerpc/shared/irq/irq_supp.h b/c/src/lib/libbsp/powerpc/shared/irq/irq_supp.h new file mode 100644 index 0000000000..3359869920 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/shared/irq/irq_supp.h @@ -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 diff --git a/c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c b/c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c index 5f8941df55..041c404066 100644 --- a/c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c +++ b/c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c @@ -15,6 +15,7 @@ #include <bsp.h> #include <bsp/irq.h> +#include <bsp/irq_supp.h> #include <bsp/VMEConfig.h> #include <bsp/openpic.h> #include <libcpu/raw_exception.h> |