diff options
author | Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> | 2009-07-21 08:38:04 +0000 |
---|---|---|
committer | Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> | 2009-07-21 08:38:04 +0000 |
commit | d374492cc69fa8bd041852d868ae379b79c59ba4 (patch) | |
tree | 14fa506e5c9564844d5fa0436ae4d2d456a74dda /c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c | |
parent | Update to binutils-2.19.51-20090721. (diff) | |
download | rtems-d374492cc69fa8bd041852d868ae379b79c59ba4.tar.bz2 |
Update for MPC55XX changes
Diffstat (limited to 'c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c')
-rw-r--r-- | c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c b/c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c index 50071eb9e7..34d5bef763 100644 --- a/c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c +++ b/c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c @@ -21,6 +21,7 @@ #include <mpc55xx/regs.h> #include <libcpu/raw_exception.h> +#include <libcpu/powerpc-utility.h> #include <bsp/irq.h> #include <bsp/irq-generic.h> @@ -31,27 +32,27 @@ #include <rtems/status-checks.h> /** - * @brief Returns the priority @a p of IRQ @a i from the INTC. + * @brief Returns the priority @a priority of IRQ @a vector from the INTC. */ -rtems_status_code mpc55xx_intc_get_priority( int i, int *p) +rtems_status_code mpc55xx_intc_get_priority( rtems_vector_number vector, unsigned *priority) { - if (MPC55XX_IRQ_IS_VALID( i)) { - *p = INTC.PSR [i].B.PRI; + if (MPC55XX_IRQ_IS_VALID( vector)) { + *priority = INTC.PSR [vector].B.PRI; return RTEMS_SUCCESSFUL; } else { - *p = MPC55XX_INTC_INVALID_PRIORITY; + *priority = MPC55XX_INTC_INVALID_PRIORITY; return RTEMS_INVALID_NUMBER; } } /** - * @brief Sets the priority of IRQ @a i to @a p at the INTC. + * @brief Sets the priority of IRQ @a vector to @a priority at the INTC. */ -rtems_status_code mpc55xx_intc_set_priority( int i, int p) +rtems_status_code mpc55xx_intc_set_priority( rtems_vector_number vector, unsigned priority) { - if (MPC55XX_IRQ_IS_VALID( i) && MPC55XX_INTC_IS_VALID_PRIORITY( p)) { - INTC.PSR [i].B.PRI = p; - if (INTC.PSR [i].B.PRI == p) { + if (MPC55XX_IRQ_IS_VALID( vector) && MPC55XX_INTC_IS_VALID_PRIORITY( priority)) { + INTC.PSR [vector].B.PRI = priority; + if (INTC.PSR [vector].B.PRI == priority) { return RTEMS_SUCCESSFUL; } else { return RTEMS_IO_ERROR; @@ -62,12 +63,12 @@ rtems_status_code mpc55xx_intc_set_priority( int i, int p) } /** - * @brief Raises the software IRQ with number @a i. + * @brief Raises the software IRQ with number @a vector. */ -rtems_status_code mpc55xx_intc_raise_software_irq( int i) +rtems_status_code mpc55xx_intc_raise_software_irq( rtems_vector_number vector) { - if (MPC55XX_IRQ_IS_SOFTWARE( i)) { - INTC.SSCIR [i].B.SET = 1; + if (MPC55XX_IRQ_IS_SOFTWARE( vector)) { + INTC.SSCIR [vector].B.SET = 1; return RTEMS_SUCCESSFUL; } else { return RTEMS_INVALID_NUMBER; @@ -75,12 +76,12 @@ rtems_status_code mpc55xx_intc_raise_software_irq( int i) } /** - * @brief Clears the software IRQ with number @a i. + * @brief Clears the software IRQ with number @a vector. */ -rtems_status_code mpc55xx_intc_clear_software_irq( int i) +rtems_status_code mpc55xx_intc_clear_software_irq( rtems_vector_number vector) { - if (MPC55XX_IRQ_IS_SOFTWARE( i)) { - INTC.SSCIR [i].B.CLR = 1; + if (MPC55XX_IRQ_IS_SOFTWARE( vector)) { + INTC.SSCIR [vector].B.CLR = 1; return RTEMS_SUCCESSFUL; } else { return RTEMS_INVALID_NUMBER; @@ -92,18 +93,19 @@ rtems_status_code mpc55xx_intc_clear_software_irq( int i) */ rtems_status_code mpc55xx_interrupt_handler_install( rtems_vector_number vector, - int priority, const char *info, rtems_option options, + unsigned priority, rtems_interrupt_handler handler, void *arg ) { - rtems_status_code sc = RTEMS_SUCCESSFUL; - if (MPC55XX_IRQ_IS_VALID( vector) && MPC55XX_INTC_IS_VALID_PRIORITY( priority)) { + rtems_status_code sc = RTEMS_SUCCESSFUL; + sc = rtems_interrupt_handler_install( vector, info, options, handler, arg); RTEMS_CHECK_SC( sc, "Install interrupt handler"); + return mpc55xx_intc_set_priority( vector, priority); } else { return RTEMS_INVALID_NUMBER; @@ -116,19 +118,16 @@ rtems_status_code mpc55xx_interrupt_handler_install( static int mpc55xx_external_exception_handler( BSP_Exception_frame *frame, unsigned exception_number) { /* Acknowlege interrupt request */ - rtems_vector_number vector_number = INTC.IACKR.B.INTVEC; - - /* Save current interrupt level */ - uint32_t level = _ISR_Get_level(); + rtems_vector_number vector = INTC.IACKR.B.INTVEC; - /* Enable all interrupts */ - _ISR_Set_level( 0); + /* Save machine state and enable external exceptions */ + uint32_t msr = ppc_external_exceptions_enable(); /* Dispatch interrupt handlers */ - bsp_interrupt_handler_dispatch( vector_number); + bsp_interrupt_handler_dispatch( vector); - /* Restore interrupt level */ - _ISR_Set_level( level); + /* Restore machine state */ + ppc_external_exceptions_disable( msr); /* End of interrupt */ INTC.EOIR.R = 1; |