From d8999b705a25b74a42b761619a9afa411a19cab9 Mon Sep 17 00:00:00 2001 From: Jennifer Averett Date: Tue, 17 May 2005 15:06:22 +0000 Subject: 2005-05-17 Jennifer Averett * clock/p_clock.c, irq/i8259.c, irq/irq.c, irq/irq.h: Modified to use rtems/irq.h. --- c/src/lib/libbsp/powerpc/shared/ChangeLog | 5 + c/src/lib/libbsp/powerpc/shared/clock/p_clock.c | 6 +- c/src/lib/libbsp/powerpc/shared/irq/i8259.c | 8 +- c/src/lib/libbsp/powerpc/shared/irq/irq.c | 6 +- c/src/lib/libbsp/powerpc/shared/irq/irq.h | 308 ++++++------------------ 5 files changed, 89 insertions(+), 244 deletions(-) (limited to 'c') diff --git a/c/src/lib/libbsp/powerpc/shared/ChangeLog b/c/src/lib/libbsp/powerpc/shared/ChangeLog index 7b4a5d8c78..581e891e21 100644 --- a/c/src/lib/libbsp/powerpc/shared/ChangeLog +++ b/c/src/lib/libbsp/powerpc/shared/ChangeLog @@ -1,3 +1,8 @@ +2005-05-17 Jennifer Averett + + * clock/p_clock.c, irq/i8259.c, irq/irq.c, irq/irq.h: Modified to use + rtems/irq.h. + 2005-05-10 Jennifer Averett * bootloader/bootldr.h, bootloader/em86.c, bootloader/misc.c, diff --git a/c/src/lib/libbsp/powerpc/shared/clock/p_clock.c b/c/src/lib/libbsp/powerpc/shared/clock/p_clock.c index 4d41dbd257..b52bca9497 100644 --- a/c/src/lib/libbsp/powerpc/shared/clock/p_clock.c +++ b/c/src/lib/libbsp/powerpc/shared/clock/p_clock.c @@ -18,13 +18,15 @@ #include #include -static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER, +static rtems_irq_connect_data clockIrqData; +/* + = {BSP_DECREMENTER, clockIsr, NULL, (rtems_irq_enable)clockOn, (rtems_irq_disable)clockOff, (rtems_irq_is_enabled) clockIsOn}; - +*/ int BSP_disconnect_clock_handler (void) { return BSP_remove_rtems_irq_handler (&clockIrqData); diff --git a/c/src/lib/libbsp/powerpc/shared/irq/i8259.c b/c/src/lib/libbsp/powerpc/shared/irq/i8259.c index a5090cd18f..6e28b3c73d 100644 --- a/c/src/lib/libbsp/powerpc/shared/irq/i8259.c +++ b/c/src/lib/libbsp/powerpc/shared/irq/i8259.c @@ -31,7 +31,7 @@ volatile 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; @@ -66,7 +66,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; @@ -94,7 +94,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; @@ -114,7 +114,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 (irqLine >= 8) { outport_byte(PIC_MASTER_COMMAND_IO_PORT, SLAVE_PIC_EOSI); diff --git a/c/src/lib/libbsp/powerpc/shared/irq/irq.c b/c/src/lib/libbsp/powerpc/shared/irq/irq.c index 77176b6a60..ecdc61dc34 100644 --- a/c/src/lib/libbsp/powerpc/shared/irq/irq.c +++ b/c/src/lib/libbsp/powerpc/shared/irq/irq.c @@ -50,7 +50,7 @@ static rtems_irq_connect_data* rtems_hdl_tbl; /* * Check if IRQ is an ISA IRQ */ -static inline int is_isa_irq(const rtems_irq_symbolic_name irqLine) +static inline int is_isa_irq(const rtems_irq_number irqLine) { return (((int) irqLine <= BSP_ISA_IRQ_MAX_OFFSET) & ((int) irqLine >= BSP_ISA_IRQ_LOWEST_OFFSET) @@ -60,7 +60,7 @@ static inline int is_isa_irq(const rtems_irq_symbolic_name irqLine) /* * Check if IRQ is an OPENPIC IRQ */ -static inline int is_pci_irq(const rtems_irq_symbolic_name irqLine) +static inline int is_pci_irq(const rtems_irq_number irqLine) { return (((int) irqLine <= BSP_PCI_IRQ_MAX_OFFSET) & ((int) irqLine >= BSP_PCI_IRQ_LOWEST_OFFSET) @@ -70,7 +70,7 @@ static inline int is_pci_irq(const rtems_irq_symbolic_name irqLine) /* * Check if IRQ is a Processor IRQ */ -static inline int is_processor_irq(const rtems_irq_symbolic_name irqLine) +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) diff --git a/c/src/lib/libbsp/powerpc/shared/irq/irq.h b/c/src/lib/libbsp/powerpc/shared/irq/irq.h index 93dcf9d3c4..650e831454 100644 --- a/c/src/lib/libbsp/powerpc/shared/irq/irq.h +++ b/c/src/lib/libbsp/powerpc/shared/irq/irq.h @@ -18,8 +18,11 @@ * $Id$ */ -#ifndef LIBBSP_POWERPC_MCP750_IRQ_IRQ_H -#define LIBBSP_POWERPC_MCP750_IRQ_IRQ_H +#ifndef BSP_POWERPC_IRQ_H +#define BSP_POWERPC_IRQ_H + +#define BSP_SHARED_HANDLER_SUPPORT 1 +#include /* * 8259 edge/level control definitions at VIA @@ -63,167 +66,85 @@ extern "C" { #endif /* - * Symbolic IRQ names and related definitions + * rtems_irq_number Definitions */ -typedef enum { - /* Base vector for our ISA IRQ handlers. */ - BSP_ISA_IRQ_VECTOR_BASE = BSP_ASM_IRQ_VECTOR_BASE, - /* - * ISA IRQ handler related definitions - */ - BSP_ISA_IRQ_NUMBER = 16, - BSP_ISA_IRQ_LOWEST_OFFSET = 0, - BSP_ISA_IRQ_MAX_OFFSET = BSP_ISA_IRQ_LOWEST_OFFSET + BSP_ISA_IRQ_NUMBER - 1, - /* - * PCI IRQ handlers related definitions - * CAUTION : BSP_PCI_IRQ_LOWEST_OFFSET should be equal to OPENPIC_VEC_SOURCE - */ - BSP_PCI_IRQ_NUMBER = 16, - BSP_PCI_IRQ_LOWEST_OFFSET = BSP_ISA_IRQ_NUMBER, - BSP_PCI_IRQ_MAX_OFFSET = BSP_PCI_IRQ_LOWEST_OFFSET + BSP_PCI_IRQ_NUMBER - 1, - /* - * PowerPC exceptions handled as interrupt where an RTEMS managed interrupt - * handler might be connected - */ - BSP_PROCESSOR_IRQ_NUMBER = 1, - BSP_PROCESSOR_IRQ_LOWEST_OFFSET = BSP_PCI_IRQ_MAX_OFFSET + 1, - BSP_PROCESSOR_IRQ_MAX_OFFSET = BSP_PROCESSOR_IRQ_LOWEST_OFFSET + BSP_PROCESSOR_IRQ_NUMBER - 1, - /* Misc vectors for OPENPIC irqs (IPI, timers) - */ - BSP_MISC_IRQ_NUMBER = 8, - BSP_MISC_IRQ_LOWEST_OFFSET = BSP_PROCESSOR_IRQ_MAX_OFFSET + 1, - BSP_MISC_IRQ_MAX_OFFSET = BSP_MISC_IRQ_LOWEST_OFFSET + BSP_MISC_IRQ_NUMBER - 1, - /* - * Summary - */ - BSP_IRQ_NUMBER = BSP_MISC_IRQ_MAX_OFFSET + 1, - BSP_LOWEST_OFFSET = BSP_ISA_IRQ_LOWEST_OFFSET, - BSP_MAX_OFFSET = BSP_MISC_IRQ_MAX_OFFSET, - /* - * Some ISA IRQ symbolic name definition - */ - BSP_ISA_PERIODIC_TIMER = 0, - BSP_ISA_KEYBOARD = 1, - BSP_ISA_UART_COM2_IRQ = 3, - BSP_ISA_UART_COM1_IRQ = 4, - BSP_ISA_RT_TIMER1 = 8, - BSP_ISA_RT_TIMER3 = 10, - /* - * Some PCI IRQ symbolic name definition - */ - BSP_PCI_IRQ0 = BSP_PCI_IRQ_LOWEST_OFFSET, - BSP_PCI_ISA_BRIDGE_IRQ = BSP_PCI_IRQ0, +/* Base vector for our ISA IRQ handlers. */ +#define BSP_ISA_IRQ_VECTOR_BASE (BSP_ASM_IRQ_VECTOR_BASE) +/* + * ISA IRQ handler related definitions + */ +#define BSP_ISA_IRQ_NUMBER (16) +#define BSP_ISA_IRQ_LOWEST_OFFSET (0) +#define BSP_ISA_IRQ_MAX_OFFSET (BSP_ISA_IRQ_LOWEST_OFFSET + BSP_ISA_IRQ_NUMBER - 1) +/* + * PCI IRQ handlers related definitions + * CAUTION : BSP_PCI_IRQ_LOWEST_OFFSET should be equal to OPENPIC_VEC_SOURCE + */ +#define BSP_PCI_IRQ_NUMBER (16) +#define BSP_PCI_IRQ_LOWEST_OFFSET (BSP_ISA_IRQ_NUMBER) +#define BSP_PCI_IRQ_MAX_OFFSET (BSP_PCI_IRQ_LOWEST_OFFSET + BSP_PCI_IRQ_NUMBER - 1) +/* + * PowerPC exceptions handled as interrupt where an RTEMS managed interrupt + * handler might be connected + */ +#define BSP_PROCESSOR_IRQ_NUMBER (1) +#define BSP_PROCESSOR_IRQ_LOWEST_OFFSET (BSP_PCI_IRQ_MAX_OFFSET + 1) +#define BSP_PROCESSOR_IRQ_MAX_OFFSET (BSP_PROCESSOR_IRQ_LOWEST_OFFSET + BSP_PROCESSOR_IRQ_NUMBER - 1) +/* Misc vectors for OPENPIC irqs (IPI, timers) + */ +#define BSP_MISC_IRQ_NUMBER (8) +#define BSP_MISC_IRQ_LOWEST_OFFSET (BSP_PROCESSOR_IRQ_MAX_OFFSET + 1) +#define BSP_MISC_IRQ_MAX_OFFSET (BSP_MISC_IRQ_LOWEST_OFFSET + BSP_MISC_IRQ_NUMBER - 1) +/* + * Summary + */ +#define BSP_IRQ_NUMBER (BSP_MISC_IRQ_MAX_OFFSET + 1) +#define BSP_LOWEST_OFFSET (BSP_ISA_IRQ_LOWEST_OFFSET) +#define BSP_MAX_OFFSET (BSP_MISC_IRQ_MAX_OFFSET) +/* + * Some ISA IRQ symbolic name definition + */ +#define BSP_ISA_PERIODIC_TIMER (0) +#define BSP_ISA_KEYBOARD (1) +#define BSP_ISA_UART_COM2_IRQ (3) +#define BSP_ISA_UART_COM1_IRQ (4) +#define BSP_ISA_RT_TIMER1 (8) +#define BSP_ISA_RT_TIMER3 (10) +/* + * Some PCI IRQ symbolic name definition + */ +#define BSP_PCI_IRQ0 (BSP_PCI_IRQ_LOWEST_OFFSET) +#define BSP_PCI_ISA_BRIDGE_IRQ (BSP_PCI_IRQ0) #if defined(mvme2100) - BSP_DEC21143_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 1, - BSP_PMC_PCMIP_TYPE1_SLOT0_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 2, - BSP_PCMIP_TYPE1_SLOT1_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 3, - BSP_PCMIP_TYPE2_SLOT0_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 4, - BSP_PCMIP_TYPE2_SLOT1_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 5, - BSP_PCI_INTA_UNIVERSE_LINT0_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 7, - BSP_PCI_INTB_UNIVERSE_LINT1_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 8, - BSP_PCI_INTC_UNIVERSE_LINT2_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 9, - BSP_PCI_INTD_UNIVERSE_LINT3_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 10, - BSP_UART_COM1_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 13, - BSP_FRONT_PANEL_ABORT_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 14, - BSP_RTC_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 15, +#define BSP_DEC21143_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 1) +#define BSP_PMC_PCMIP_TYPE1_SLOT0_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 2) +#define BSP_PCMIP_TYPE1_SLOT1_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 3) +#define BSP_PCMIP_TYPE2_SLOT0_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 4) +#define BSP_PCMIP_TYPE2_SLOT1_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 5) +#define BSP_PCI_INTA_UNIVERSE_LINT0_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 7) +#define BSP_PCI_INTB_UNIVERSE_LINT1_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 8) +#define BSP_PCI_INTC_UNIVERSE_LINT2_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 9) +#define BSP_PCI_INTD_UNIVERSE_LINT3_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 10) +#define BSP_UART_COM1_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 13) +#define BSP_FRONT_PANEL_ABORT_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 14) +#define BSP_RTC_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 15) #endif - /* - * Some Processor execption handled as RTEMS IRQ symbolic name definition - */ - BSP_DECREMENTER = BSP_PROCESSOR_IRQ_LOWEST_OFFSET +/* + * Some Processor execption handled as RTEMS IRQ symbolic name definition + */ +#define BSP_DECREMENTER (BSP_PROCESSOR_IRQ_LOWEST_OFFSET) -} rtems_irq_symbolic_name; /* * Type definition for RTEMS managed interrupts */ -typedef unsigned char rtems_irq_prio; typedef unsigned short rtems_i8259_masks; extern volatile 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 and openpic 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; - /* - * Set to -1 for vectors forced to have only 1 handler - */ - void *next_handler; - -}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_ISA_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. +--------------------------------------------------------------------------*/ @@ -236,13 +157,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 acknowledge a particular irq at 8259 level. After calling * this function, if a device asserts an enabled interrupt line it will @@ -250,93 +171,11 @@ int BSP_irq_enable_at_i8259s (const rtems_irq_symbolic_name irqLine); * writing 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) acknowledge 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*); -int BSP_install_rtems_shared_irq_handler (const rtems_irq_connect_data*); - -#define BSP_SHARED_HANDLER_SUPPORT 1 - -/* - * 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 - * reasons. - * 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); extern void BSP_rtems_irq_mng_init(unsigned cpuId); extern void BSP_i8259s_init(void); @@ -346,5 +185,4 @@ extern void BSP_i8259s_init(void); #endif #endif - #endif -- cgit v1.2.3