summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorJennifer Averett <Jennifer.Averett@OARcorp.com>2005-05-17 14:55:45 +0000
committerJennifer Averett <Jennifer.Averett@OARcorp.com>2005-05-17 14:55:45 +0000
commit838c82bdddb787cff599aa38129c6c9b12724ec9 (patch)
treef4befecdc18a73fee74f395185a2e44a12028934 /c
parent2005-05-17 Jennifer Averett <jennifer.averett@oarcorp.com> (diff)
downloadrtems-838c82bdddb787cff599aa38129c6c9b12724ec9.tar.bz2
2005-05-17 Jennifer Averett <jennifer.averett@oarcorp.com>
* irq/irq.c, irq/irq.h: Modified to include rtems/irq.h.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/i386/shared/irq/irq.c8
-rw-r--r--c/src/lib/libbsp/i386/shared/irq/irq.h190
2 files changed, 20 insertions, 178 deletions
diff --git a/c/src/lib/libbsp/i386/shared/irq/irq.c b/c/src/lib/libbsp/i386/shared/irq/irq.c
index 93eb7b0927..a8d57442f9 100644
--- a/c/src/lib/libbsp/i386/shared/irq/irq.c
+++ b/c/src/lib/libbsp/i386/shared/irq/irq.c
@@ -54,7 +54,7 @@ rtems_i8259_masks i8259s_cache = 0xFFFB;
| Arguments: vector_offset - number of IRQ line to mask.
| Returns: Nothing.
+--------------------------------------------------------------------------*/
-int BSP_irq_disable_at_i8259s (const rtems_irq_symbolic_name irqLine)
+int BSP_irq_disable_at_i8259s (const rtems_irq_number irqLine)
{
unsigned short mask;
unsigned int level;
@@ -89,7 +89,7 @@ int BSP_irq_disable_at_i8259s (const rtems_irq_symbolic_name irqLine)
| Arguments: irqLine - number of IRQ line to mask.
| Returns: Nothing.
+--------------------------------------------------------------------------*/
-int BSP_irq_enable_at_i8259s (const rtems_irq_symbolic_name irqLine)
+int BSP_irq_enable_at_i8259s (const rtems_irq_number irqLine)
{
unsigned short mask;
unsigned int level;
@@ -117,7 +117,7 @@ int BSP_irq_enable_at_i8259s (const rtems_irq_symbolic_name irqLine)
return 0;
} /* mask_irq */
-int BSP_irq_enabled_at_i8259s (const rtems_irq_symbolic_name irqLine)
+int BSP_irq_enabled_at_i8259s (const rtems_irq_number irqLine)
{
unsigned short mask;
@@ -137,7 +137,7 @@ int BSP_irq_enabled_at_i8259s (const rtems_irq_symbolic_name irqLine)
| Arguments: irqLine - number of IRQ line to acknowledge.
| Returns: Nothing.
+--------------------------------------------------------------------------*/
-int BSP_irq_ack_at_i8259s (const rtems_irq_symbolic_name irqLine)
+int BSP_irq_ack_at_i8259s (const rtems_irq_number irqLine)
{
if ( ((int)irqLine < BSP_LOWEST_OFFSET) ||
((int)irqLine > BSP_MAX_OFFSET )
diff --git a/c/src/lib/libbsp/i386/shared/irq/irq.h b/c/src/lib/libbsp/i386/shared/irq/irq.h
index 833e3157c4..7cef8516b9 100644
--- a/c/src/lib/libbsp/i386/shared/irq/irq.h
+++ b/c/src/lib/libbsp/i386/shared/irq/irq.h
@@ -31,117 +31,37 @@ extern "C" {
#include <bsp/irq_asm.h>
#include <rtems.h>
+#include <rtems/irq.h>
+
/*-------------------------------------------------------------------------+
| Constants
+--------------------------------------------------------------------------*/
-typedef enum {
/* Base vector for our IRQ handlers. */
- BSP_IRQ_VECTOR_BASE = BSP_ASM_IRQ_VECTOR_BASE,
- BSP_IRQ_LINES_NUMBER = 16,
- BSP_LOWEST_OFFSET = 0,
- BSP_MAX_OFFSET = BSP_IRQ_LINES_NUMBER - 1,
+#define BSP_IRQ_VECTOR_BASE BSP_ASM_IRQ_VECTOR_BASE
+#define BSP_IRQ_LINES_NUMBER 16
+#define BSP_LOWEST_OFFSET 0
+#define BSP_MAX_OFFSET (BSP_IRQ_LINES_NUMBER - 1)
/*
* Interrupt offset in comparison to BSP_ASM_IRQ_VECTOR_BASE
* NB : 1) Interrupt vector number in IDT = offset + BSP_ASM_IRQ_VECTOR_BASE
* 2) The same name should be defined on all architecture
* so that handler connexion can be unchanged.
*/
- BSP_PERIODIC_TIMER = 0,
-
- BSP_KEYBOARD = 1,
-
- BSP_UART_COM2_IRQ = 3,
-
- BSP_UART_COM1_IRQ = 4,
-
- BSP_RT_TIMER1 = 8,
-
- BSP_RT_TIMER3 = 10
-} rtems_irq_symbolic_name;
+#define BSP_PERIODIC_TIMER 0
+#define BSP_KEYBOARD 1
+#define BSP_UART_COM2_IRQ 3
+#define BSP_UART_COM1_IRQ 4
+#define BSP_RT_TIMER1 8
+#define BSP_RT_TIMER3 10
/*
* Type definition for RTEMS managed interrupts
*/
-typedef unsigned char rtems_irq_prio;
typedef unsigned short rtems_i8259_masks;
extern rtems_i8259_masks i8259s_cache;
-struct __rtems_irq_connect_data__; /* forward declaratiuon */
-
-typedef void *rtems_irq_hdl_param;
-typedef void (*rtems_irq_hdl) (rtems_irq_hdl_param);
-typedef void (*rtems_irq_enable) (const struct __rtems_irq_connect_data__*);
-typedef void (*rtems_irq_disable) (const struct __rtems_irq_connect_data__*);
-typedef int (*rtems_irq_is_enabled) (const struct __rtems_irq_connect_data__*);
-
-typedef struct __rtems_irq_connect_data__ {
- /*
- * IRQ line
- */
- rtems_irq_symbolic_name name;
- /*
- * handler. See comment on handler properties below in function prototype.
- */
- rtems_irq_hdl hdl;
- /*
- * Handler handle to store private data
- */
- rtems_irq_hdl_param handle;
- /*
- * function for enabling interrupts at device level (ONLY!).
- * The BSP code will automatically enable it at i8259s level.
- * RATIONALE : anyway such code has to exist in current driver code.
- * It is usually called immediately AFTER connecting the interrupt handler.
- * RTEMS may well need such a function when restoring normal interrupt
- * processing after a debug session.
- *
- */
- rtems_irq_enable on;
- /*
- * function for disabling interrupts at device level (ONLY!).
- * The code will disable it at i8259s level. RATIONALE : anyway
- * such code has to exist for clean shutdown. It is usually called
- * BEFORE disconnecting the interrupt. RTEMS may well need such
- * a function when disabling normal interrupt processing for
- * a debug session. May well be a NOP function.
- */
- rtems_irq_disable off;
- /*
- * function enabling to know what interrupt may currently occur
- * if someone manipulates the i8259s interrupt mask without care...
- */
- rtems_irq_is_enabled isOn;
-} rtems_irq_connect_data;
-
-typedef struct {
- /*
- * size of all the table fields (*Tbl) described below.
- */
- unsigned int irqNb;
- /*
- * Default handler used when disconnecting interrupts.
- */
- rtems_irq_connect_data defaultEntry;
- /*
- * Table containing initials/current value.
- */
- rtems_irq_connect_data* irqHdlTbl;
- /*
- * actual value of BSP_IRQ_VECTOR_BASE...
- */
- rtems_irq_symbolic_name irqBase;
- /*
- * software priorities associated with interrupts.
- * if irqPrio [i] > intrPrio [j] it means that
- * interrupt handler hdl connected for interrupt name i
- * will not be interrupted by the handler connected for interrupt j
- * The interrupt source will be physically masked at i8259 level.
- */
- rtems_irq_prio* irqPrioTbl;
-}rtems_irq_global_settings;
-
/*-------------------------------------------------------------------------+
| Function Prototypes.
+--------------------------------------------------------------------------*/
@@ -154,13 +74,13 @@ typedef struct {
* this function, even if the device asserts the interrupt line it will
* not be propagated further to the processor
*/
-int BSP_irq_disable_at_i8259s (const rtems_irq_symbolic_name irqLine);
+int BSP_irq_disable_at_i8259s (const rtems_irq_number irqLine);
/*
* function to enable a particular irq at 8259 level. After calling
* this function, if the device asserts the interrupt line it will
* be propagated further to the processor
*/
-int BSP_irq_enable_at_i8259s (const rtems_irq_symbolic_name irqLine);
+int BSP_irq_enable_at_i8259s (const rtems_irq_number irqLine);
/*
* function to acknoledge a particular irq at 8259 level. After calling
* this function, if a device asserts an enabled interrupt line it will
@@ -168,89 +88,11 @@ int BSP_irq_enable_at_i8259s (const rtems_irq_symbolic_name irqLine);
* writting raw handlers as this is automagically done for rtems managed
* handlers.
*/
-int BSP_irq_ack_at_i8259s (const rtems_irq_symbolic_name irqLine);
+int BSP_irq_ack_at_i8259s (const rtems_irq_number irqLine);
/*
* function to check if a particular irq is enabled at 8259 level. After calling
*/
-int BSP_irq_enabled_at_i8259s (const rtems_irq_symbolic_name irqLine);
-/*
- * ------------------------ RTEMS Single Irq Handler Mngt Routines ----------------
- */
-/*
- * function to connect a particular irq handler. This hanlder will NOT be called
- * directly as the result of the corresponding interrupt. Instead, a RTEMS
- * irq prologue will be called that will :
- *
- * 1) save the C scratch registers,
- * 2) switch to a interrupt stack if the interrupt is not nested,
- * 3) store the current i8259s' interrupt masks
- * 4) modify them to disable the current interrupt at 8259 level (and may
- * be others depending on software priorities)
- * 5) aknowledge the i8259s',
- * 6) demask the processor,
- * 7) call the application handler
- *
- * As a result the hdl function provided
- *
- * a) can perfectly be written is C,
- * b) may also well directly call the part of the RTEMS API that can be used
- * from interrupt level,
- * c) It only responsible for handling the jobs that need to be done at
- * the device level including (aknowledging/re-enabling the interrupt at device,
- * level, getting the data,...)
- *
- * When returning from the function, the following will be performed by
- * the RTEMS irq epilogue :
- *
- * 1) masks the interrupts again,
- * 2) restore the original i8259s' interrupt masks
- * 3) switch back on the orinal stack if needed,
- * 4) perform rescheduling when necessary,
- * 5) restore the C scratch registers...
- * 6) restore initial execution flow
- *
- */
-int BSP_install_rtems_irq_handler (const rtems_irq_connect_data*);
-/*
- * function to get the current RTEMS irq handler for ptr->name. It enables to
- * define hanlder chain...
- */
-int BSP_get_current_rtems_irq_handler (rtems_irq_connect_data* ptr);
-/*
- * function to get disconnect the RTEMS irq handler for ptr->name.
- * This function checks that the value given is the current one for safety reason.
- * The user can use the previous function to get it.
- */
-int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data*);
-
-/*
- * ------------------------ RTEMS Global Irq Handler Mngt Routines ----------------
- */
-/*
- * (Re) Initialize the RTEMS interrupt management.
- *
- * The result of calling this function will be the same as if each individual
- * handler (config->irqHdlTbl[i].hdl) different from "config->defaultEntry.hdl"
- * has been individualy connected via
- * BSP_install_rtems_irq_handler(&config->irqHdlTbl[i])
- * And each handler currently equal to config->defaultEntry.hdl
- * has been previously disconnected via
- * BSP_remove_rtems_irq_handler (&config->irqHdlTbl[i])
- *
- * This is to say that all information given will be used and not just
- * only the space.
- *
- * CAUTION : the various table address contained in config will be used
- * directly by the interrupt mangement code in order to save
- * data size so they must stay valid after the call => they should
- * not be modified or declared on a stack.
- */
-
-int BSP_rtems_irq_mngt_set(rtems_irq_global_settings* config);
-/*
- * (Re) get info on current RTEMS interrupt management.
- */
-int BSP_rtems_irq_mngt_get(rtems_irq_global_settings**);
+int BSP_irq_enabled_at_i8259s (const rtems_irq_number irqLine);
#ifdef __cplusplus
}