Ignore:
Timestamp:
Jul 21, 2009, 8:38:04 AM (10 years ago)
Author:
Thomas Doerfler <Thomas.Doerfler@…>
Branches:
4.10, 4.11, master
Children:
68799a2a
Parents:
115971c
Message:

Update for MPC55XX changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c

    r115971c rd374492  
    2222
    2323#include <libcpu/raw_exception.h>
     24#include <libcpu/powerpc-utility.h>
    2425
    2526#include <bsp/irq.h>
     
    3233
    3334/**
    34  * @brief Returns the priority @a p of IRQ @a i from the INTC.
     35 * @brief Returns the priority @a priority of IRQ @a vector from the INTC.
    3536 */
    36 rtems_status_code mpc55xx_intc_get_priority( int i, int *p)
     37rtems_status_code mpc55xx_intc_get_priority( rtems_vector_number vector, unsigned *priority)
    3738{
    38         if (MPC55XX_IRQ_IS_VALID( i)) {
    39                 *p = INTC.PSR [i].B.PRI;
     39        if (MPC55XX_IRQ_IS_VALID( vector)) {
     40                *priority = INTC.PSR [vector].B.PRI;
    4041                return RTEMS_SUCCESSFUL;
    4142        } else {
    42                 *p = MPC55XX_INTC_INVALID_PRIORITY;
     43                *priority = MPC55XX_INTC_INVALID_PRIORITY;
    4344                return RTEMS_INVALID_NUMBER;
    4445        }             
     
    4647
    4748/**
    48  * @brief Sets the priority of IRQ @a i to @a p at the INTC.
     49 * @brief Sets the priority of IRQ @a vector to @a priority at the INTC.
    4950 */
    50 rtems_status_code mpc55xx_intc_set_priority( int i, int p)
     51rtems_status_code mpc55xx_intc_set_priority( rtems_vector_number vector, unsigned priority)
    5152{
    52         if (MPC55XX_IRQ_IS_VALID( i) && MPC55XX_INTC_IS_VALID_PRIORITY( p)) {
    53                 INTC.PSR [i].B.PRI = p;
    54                 if (INTC.PSR [i].B.PRI == p) {
     53        if (MPC55XX_IRQ_IS_VALID( vector) && MPC55XX_INTC_IS_VALID_PRIORITY( priority)) {
     54                INTC.PSR [vector].B.PRI = priority;
     55                if (INTC.PSR [vector].B.PRI == priority) {
    5556                        return RTEMS_SUCCESSFUL;
    5657                } else {
     
    6364
    6465/**
    65  * @brief Raises the software IRQ with number @a i.
     66 * @brief Raises the software IRQ with number @a vector.
    6667 */
    67 rtems_status_code mpc55xx_intc_raise_software_irq( int i)
     68rtems_status_code mpc55xx_intc_raise_software_irq( rtems_vector_number vector)
    6869{
    69         if (MPC55XX_IRQ_IS_SOFTWARE( i)) {
    70                 INTC.SSCIR [i].B.SET = 1;
     70        if (MPC55XX_IRQ_IS_SOFTWARE( vector)) {
     71                INTC.SSCIR [vector].B.SET = 1;
    7172                return RTEMS_SUCCESSFUL;
    7273        } else {
     
    7677
    7778/**
    78  * @brief Clears the software IRQ with number @a i.
     79 * @brief Clears the software IRQ with number @a vector.
    7980 */
    80 rtems_status_code mpc55xx_intc_clear_software_irq( int i)
     81rtems_status_code mpc55xx_intc_clear_software_irq( rtems_vector_number vector)
    8182{
    82         if (MPC55XX_IRQ_IS_SOFTWARE( i)) {
    83                 INTC.SSCIR [i].B.CLR = 1;
     83        if (MPC55XX_IRQ_IS_SOFTWARE( vector)) {
     84                INTC.SSCIR [vector].B.CLR = 1;
    8485                return RTEMS_SUCCESSFUL;
    8586        } else {
     
    9394rtems_status_code mpc55xx_interrupt_handler_install(
    9495        rtems_vector_number vector,
    95         int priority,
    9696        const char *info,
    9797        rtems_option options,
     98        unsigned priority,
    9899        rtems_interrupt_handler handler,
    99100        void *arg
    100101)
    101102{
    102         rtems_status_code sc = RTEMS_SUCCESSFUL;
     103        if (MPC55XX_IRQ_IS_VALID( vector) && MPC55XX_INTC_IS_VALID_PRIORITY( priority)) {
     104                rtems_status_code sc = RTEMS_SUCCESSFUL;
    103105
    104         if (MPC55XX_IRQ_IS_VALID( vector) && MPC55XX_INTC_IS_VALID_PRIORITY( priority)) {
    105106                sc = rtems_interrupt_handler_install( vector, info, options, handler, arg);
    106107                RTEMS_CHECK_SC( sc, "Install interrupt handler");
     108
    107109                return mpc55xx_intc_set_priority( vector, priority);
    108110        } else {
     
    117119{
    118120        /* Acknowlege interrupt request */
    119         rtems_vector_number vector_number = INTC.IACKR.B.INTVEC;
     121        rtems_vector_number vector = INTC.IACKR.B.INTVEC;
    120122
    121         /* Save current interrupt level */
    122         uint32_t level = _ISR_Get_level();
    123 
    124         /* Enable all interrupts */
    125         _ISR_Set_level( 0);
     123        /* Save machine state and enable external exceptions */
     124        uint32_t msr = ppc_external_exceptions_enable();
    126125
    127126        /* Dispatch interrupt handlers */
    128         bsp_interrupt_handler_dispatch( vector_number);
     127        bsp_interrupt_handler_dispatch( vector);
    129128
    130         /* Restore interrupt level */
    131         _ISR_Set_level( level);
     129        /* Restore machine state */
     130        ppc_external_exceptions_disable( msr);
    132131
    133132        /* End of interrupt */
Note: See TracChangeset for help on using the changeset viewer.