Changeset d8999b7 in rtems


Ignore:
Timestamp:
May 17, 2005, 3:06:22 PM (15 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
2c24794
Parents:
7068d7ac
Message:

2005-05-17 Jennifer Averett <jennifer.averett@…>

  • clock/p_clock.c, irq/i8259.c, irq/irq.c, irq/irq.h: Modified to use rtems/irq.h.
Location:
c/src/lib/libbsp/powerpc/shared
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/shared/ChangeLog

    r7068d7ac rd8999b7  
     12005-05-17      Jennifer Averett <jennifer.averett@oarcorp.com>
     2
     3        * clock/p_clock.c, irq/i8259.c, irq/irq.c, irq/irq.h: Modified to use
     4        rtems/irq.h.
     5
    162005-05-10      Jennifer Averett <jennifer.averett@oarcorp.com>
    27
  • c/src/lib/libbsp/powerpc/shared/clock/p_clock.c

    r7068d7ac rd8999b7  
    1919#include <libcpu/c_clock.h>
    2020
    21 static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER,
     21static rtems_irq_connect_data clockIrqData;
     22/*
     23 = {BSP_DECREMENTER,
    2224                                              clockIsr,
    2325                                              NULL,
     
    2527                                              (rtems_irq_disable)clockOff,
    2628                                              (rtems_irq_is_enabled) clockIsOn};
    27 
     29*/
    2830int BSP_disconnect_clock_handler (void)
    2931{
  • c/src/lib/libbsp/powerpc/shared/irq/i8259.c

    r7068d7ac rd8999b7  
    3232|          Returns: Nothing.
    3333+--------------------------------------------------------------------------*/
    34 int BSP_irq_disable_at_i8259s    (const rtems_irq_symbolic_name irqLine)
     34int BSP_irq_disable_at_i8259s    (const rtems_irq_number irqLine)
    3535{
    3636  unsigned short mask;
     
    6767|          Returns: Nothing.
    6868+--------------------------------------------------------------------------*/
    69 int BSP_irq_enable_at_i8259s    (const rtems_irq_symbolic_name irqLine)
     69int BSP_irq_enable_at_i8259s    (const rtems_irq_number irqLine)
    7070{
    7171  unsigned short mask;
     
    9595} /* mask_irq */
    9696
    97 int BSP_irq_enabled_at_i8259s           (const rtems_irq_symbolic_name irqLine)
     97int BSP_irq_enabled_at_i8259s           (const rtems_irq_number irqLine)
    9898{
    9999  unsigned short mask;
     
    115115|          Returns: Nothing.
    116116+--------------------------------------------------------------------------*/
    117 int BSP_irq_ack_at_i8259s       (const rtems_irq_symbolic_name irqLine)
     117int BSP_irq_ack_at_i8259s       (const rtems_irq_number irqLine)
    118118{
    119119  if (irqLine >= 8) {
  • c/src/lib/libbsp/powerpc/shared/irq/irq.c

    r7068d7ac rd8999b7  
    5151 * Check if IRQ is an ISA IRQ
    5252 */
    53 static inline int is_isa_irq(const rtems_irq_symbolic_name irqLine)
     53static inline int is_isa_irq(const rtems_irq_number irqLine)
    5454{
    5555  return (((int) irqLine <= BSP_ISA_IRQ_MAX_OFFSET) &
     
    6161 * Check if IRQ is an OPENPIC IRQ
    6262 */
    63 static inline int is_pci_irq(const rtems_irq_symbolic_name irqLine)
     63static inline int is_pci_irq(const rtems_irq_number irqLine)
    6464{
    6565  return (((int) irqLine <= BSP_PCI_IRQ_MAX_OFFSET) &
     
    7171 * Check if IRQ is a Processor IRQ
    7272 */
    73 static inline int is_processor_irq(const rtems_irq_symbolic_name irqLine)
     73static inline int is_processor_irq(const rtems_irq_number irqLine)
    7474{
    7575  return (((int) irqLine <= BSP_PROCESSOR_IRQ_MAX_OFFSET) &
  • c/src/lib/libbsp/powerpc/shared/irq/irq.h

    r7068d7ac rd8999b7  
    1919 */
    2020
    21 #ifndef LIBBSP_POWERPC_MCP750_IRQ_IRQ_H
    22 #define LIBBSP_POWERPC_MCP750_IRQ_IRQ_H
     21#ifndef BSP_POWERPC_IRQ_H
     22#define BSP_POWERPC_IRQ_H
     23
     24#define BSP_SHARED_HANDLER_SUPPORT      1
     25#include <rtems/irq.h>
    2326
    2427/*
     
    6467
    6568/*
    66  * Symbolic IRQ names and related definitions
     69 * rtems_irq_number Definitions
    6770 */
    6871
    69 typedef enum {
    70   /* Base vector for our ISA IRQ handlers. */
    71   BSP_ISA_IRQ_VECTOR_BASE       = BSP_ASM_IRQ_VECTOR_BASE,
    72   /*
    73    * ISA IRQ handler related definitions
    74    */
    75   BSP_ISA_IRQ_NUMBER            = 16,
    76   BSP_ISA_IRQ_LOWEST_OFFSET     = 0,
    77   BSP_ISA_IRQ_MAX_OFFSET        = BSP_ISA_IRQ_LOWEST_OFFSET + BSP_ISA_IRQ_NUMBER - 1,
    78   /*
    79    * PCI IRQ handlers related definitions
    80    * CAUTION : BSP_PCI_IRQ_LOWEST_OFFSET should be equal to OPENPIC_VEC_SOURCE
    81    */
    82   BSP_PCI_IRQ_NUMBER            = 16,
    83   BSP_PCI_IRQ_LOWEST_OFFSET     = BSP_ISA_IRQ_NUMBER,
    84   BSP_PCI_IRQ_MAX_OFFSET        = BSP_PCI_IRQ_LOWEST_OFFSET + BSP_PCI_IRQ_NUMBER - 1,
    85   /*
    86    * PowerPC exceptions handled as interrupt where an RTEMS managed interrupt
    87    * handler might be connected
    88    */
    89   BSP_PROCESSOR_IRQ_NUMBER      = 1,
    90   BSP_PROCESSOR_IRQ_LOWEST_OFFSET = BSP_PCI_IRQ_MAX_OFFSET + 1,
    91   BSP_PROCESSOR_IRQ_MAX_OFFSET  = BSP_PROCESSOR_IRQ_LOWEST_OFFSET + BSP_PROCESSOR_IRQ_NUMBER - 1,
    92   /* Misc vectors for OPENPIC irqs (IPI, timers)
    93    */
    94   BSP_MISC_IRQ_NUMBER           = 8,
    95   BSP_MISC_IRQ_LOWEST_OFFSET    = BSP_PROCESSOR_IRQ_MAX_OFFSET + 1,
    96   BSP_MISC_IRQ_MAX_OFFSET       = BSP_MISC_IRQ_LOWEST_OFFSET + BSP_MISC_IRQ_NUMBER - 1,
    97   /*
    98    * Summary
    99    */
    100   BSP_IRQ_NUMBER                = BSP_MISC_IRQ_MAX_OFFSET + 1,
    101   BSP_LOWEST_OFFSET             = BSP_ISA_IRQ_LOWEST_OFFSET,
    102   BSP_MAX_OFFSET                = BSP_MISC_IRQ_MAX_OFFSET,
    103     /*
    104      * Some ISA IRQ symbolic name definition
    105      */
    106   BSP_ISA_PERIODIC_TIMER        = 0,
    107   BSP_ISA_KEYBOARD              = 1,
    108   BSP_ISA_UART_COM2_IRQ         = 3,
    109   BSP_ISA_UART_COM1_IRQ         = 4,
    110   BSP_ISA_RT_TIMER1             = 8,
    111   BSP_ISA_RT_TIMER3             = 10,
    112     /*
    113      * Some PCI IRQ symbolic name definition
    114      */
    115   BSP_PCI_IRQ0                  = BSP_PCI_IRQ_LOWEST_OFFSET,
    116   BSP_PCI_ISA_BRIDGE_IRQ        = BSP_PCI_IRQ0,
     72/* Base vector for our ISA IRQ handlers. */
     73#define  BSP_ISA_IRQ_VECTOR_BASE        (BSP_ASM_IRQ_VECTOR_BASE)
     74/*
     75 * ISA IRQ handler related definitions
     76 */
     77#define BSP_ISA_IRQ_NUMBER              (16)
     78#define BSP_ISA_IRQ_LOWEST_OFFSET       (0)
     79#define BSP_ISA_IRQ_MAX_OFFSET          (BSP_ISA_IRQ_LOWEST_OFFSET + BSP_ISA_IRQ_NUMBER - 1)
     80/*
     81 * PCI IRQ handlers related definitions
     82 * CAUTION : BSP_PCI_IRQ_LOWEST_OFFSET should be equal to OPENPIC_VEC_SOURCE
     83 */
     84#define BSP_PCI_IRQ_NUMBER              (16)
     85#define BSP_PCI_IRQ_LOWEST_OFFSET       (BSP_ISA_IRQ_NUMBER)
     86#define BSP_PCI_IRQ_MAX_OFFSET          (BSP_PCI_IRQ_LOWEST_OFFSET + BSP_PCI_IRQ_NUMBER - 1)
     87/*
     88 * PowerPC exceptions handled as interrupt where an RTEMS managed interrupt
     89 * handler might be connected
     90 */
     91#define BSP_PROCESSOR_IRQ_NUMBER        (1)
     92#define BSP_PROCESSOR_IRQ_LOWEST_OFFSET (BSP_PCI_IRQ_MAX_OFFSET + 1)
     93#define BSP_PROCESSOR_IRQ_MAX_OFFSET    (BSP_PROCESSOR_IRQ_LOWEST_OFFSET + BSP_PROCESSOR_IRQ_NUMBER - 1)
     94/* Misc vectors for OPENPIC irqs (IPI, timers)
     95 */
     96#define BSP_MISC_IRQ_NUMBER             (8)
     97#define BSP_MISC_IRQ_LOWEST_OFFSET      (BSP_PROCESSOR_IRQ_MAX_OFFSET + 1)
     98#define BSP_MISC_IRQ_MAX_OFFSET         (BSP_MISC_IRQ_LOWEST_OFFSET + BSP_MISC_IRQ_NUMBER - 1)
     99/*
     100 * Summary
     101 */
     102#define BSP_IRQ_NUMBER                  (BSP_MISC_IRQ_MAX_OFFSET + 1)
     103#define BSP_LOWEST_OFFSET               (BSP_ISA_IRQ_LOWEST_OFFSET)
     104#define BSP_MAX_OFFSET                  (BSP_MISC_IRQ_MAX_OFFSET)
     105/*
     106 * Some ISA IRQ symbolic name definition
     107 */
     108#define BSP_ISA_PERIODIC_TIMER          (0)
     109#define BSP_ISA_KEYBOARD                (1)
     110#define BSP_ISA_UART_COM2_IRQ           (3)
     111#define BSP_ISA_UART_COM1_IRQ           (4)
     112#define BSP_ISA_RT_TIMER1               (8)
     113#define BSP_ISA_RT_TIMER3               (10)
     114/*
     115 * Some PCI IRQ symbolic name definition
     116 */
     117#define BSP_PCI_IRQ0                    (BSP_PCI_IRQ_LOWEST_OFFSET)
     118#define BSP_PCI_ISA_BRIDGE_IRQ          (BSP_PCI_IRQ0)
    117119
    118120#if defined(mvme2100)
    119   BSP_DEC21143_IRQ                = BSP_PCI_IRQ_LOWEST_OFFSET + 1,
    120   BSP_PMC_PCMIP_TYPE1_SLOT0_IRQ   = BSP_PCI_IRQ_LOWEST_OFFSET + 2,
    121   BSP_PCMIP_TYPE1_SLOT1_IRQ       = BSP_PCI_IRQ_LOWEST_OFFSET + 3,
    122   BSP_PCMIP_TYPE2_SLOT0_IRQ       = BSP_PCI_IRQ_LOWEST_OFFSET + 4,
    123   BSP_PCMIP_TYPE2_SLOT1_IRQ       = BSP_PCI_IRQ_LOWEST_OFFSET + 5,
    124   BSP_PCI_INTA_UNIVERSE_LINT0_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 7,
    125   BSP_PCI_INTB_UNIVERSE_LINT1_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 8,
    126   BSP_PCI_INTC_UNIVERSE_LINT2_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 9,
    127   BSP_PCI_INTD_UNIVERSE_LINT3_IRQ = BSP_PCI_IRQ_LOWEST_OFFSET + 10,
    128   BSP_UART_COM1_IRQ               = BSP_PCI_IRQ_LOWEST_OFFSET + 13,
    129   BSP_FRONT_PANEL_ABORT_IRQ       = BSP_PCI_IRQ_LOWEST_OFFSET + 14,
    130   BSP_RTC_IRQ                     = BSP_PCI_IRQ_LOWEST_OFFSET + 15,
     121#define BSP_DEC21143_IRQ                (BSP_PCI_IRQ_LOWEST_OFFSET + 1)
     122#define BSP_PMC_PCMIP_TYPE1_SLOT0_IRQ   (BSP_PCI_IRQ_LOWEST_OFFSET + 2)
     123#define BSP_PCMIP_TYPE1_SLOT1_IRQ       (BSP_PCI_IRQ_LOWEST_OFFSET + 3)
     124#define BSP_PCMIP_TYPE2_SLOT0_IRQ       (BSP_PCI_IRQ_LOWEST_OFFSET + 4)
     125#define BSP_PCMIP_TYPE2_SLOT1_IRQ       (BSP_PCI_IRQ_LOWEST_OFFSET + 5)
     126#define BSP_PCI_INTA_UNIVERSE_LINT0_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 7)
     127#define BSP_PCI_INTB_UNIVERSE_LINT1_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 8)
     128#define BSP_PCI_INTC_UNIVERSE_LINT2_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 9)
     129#define BSP_PCI_INTD_UNIVERSE_LINT3_IRQ (BSP_PCI_IRQ_LOWEST_OFFSET + 10)
     130#define BSP_UART_COM1_IRQ               (BSP_PCI_IRQ_LOWEST_OFFSET + 13)
     131#define BSP_FRONT_PANEL_ABORT_IRQ       (BSP_PCI_IRQ_LOWEST_OFFSET + 14)
     132#define BSP_RTC_IRQ                     (BSP_PCI_IRQ_LOWEST_OFFSET + 15)
    131133#endif
    132134
    133     /*
    134      * Some Processor execption handled as RTEMS IRQ symbolic name definition
    135      */
    136   BSP_DECREMENTER               = BSP_PROCESSOR_IRQ_LOWEST_OFFSET
     135/*
     136 * Some Processor execption handled as RTEMS IRQ symbolic name definition
     137 */
     138#define BSP_DECREMENTER                 (BSP_PROCESSOR_IRQ_LOWEST_OFFSET)
    137139
    138 } rtems_irq_symbolic_name;
    139140
    140141/*
    141142 * Type definition for RTEMS managed interrupts
    142143 */
    143 typedef unsigned char  rtems_irq_prio;
    144144typedef unsigned short rtems_i8259_masks;
    145145
    146146extern  volatile rtems_i8259_masks i8259s_cache;
    147 
    148 struct  __rtems_irq_connect_data__;     /* forward declaratiuon */
    149 
    150 typedef void *rtems_irq_hdl_param;
    151 typedef void (*rtems_irq_hdl)           (rtems_irq_hdl_param);
    152 typedef void (*rtems_irq_enable)        (const struct __rtems_irq_connect_data__*);
    153 typedef void (*rtems_irq_disable)       (const struct __rtems_irq_connect_data__*);
    154 typedef int  (*rtems_irq_is_enabled)    (const struct __rtems_irq_connect_data__*);
    155 
    156 typedef struct __rtems_irq_connect_data__ {
    157       /*
    158        * IRQ line
    159        */
    160       rtems_irq_symbolic_name   name;
    161       /*
    162        * handler. See comment on handler properties below in function prototype.
    163        */
    164       rtems_irq_hdl                     hdl;
    165      /*
    166       * Handler handle to store private data
    167       */
    168       rtems_irq_hdl_param               handle;
    169       /*
    170        * function for enabling interrupts at device level (ONLY!).
    171        * The BSP code will automatically enable it at i8259s level and openpic level.
    172        * RATIONALE : anyway such code has to exist in current driver code.
    173        * It is usually called immediately AFTER connecting the interrupt handler.
    174        * RTEMS may well need such a function when restoring normal interrupt
    175        * processing after a debug session.
    176        *
    177        */
    178       rtems_irq_enable          on;
    179       /*
    180        * function for disabling interrupts at device level (ONLY!).
    181        * The code will disable it at i8259s level. RATIONALE : anyway
    182        * such code has to exist for clean shutdown. It is usually called
    183        * BEFORE disconnecting the interrupt. RTEMS may well need such
    184        * a function when disabling normal interrupt processing for
    185        * a debug session. May well be a NOP function.
    186        */
    187       rtems_irq_disable         off;
    188       /*
    189        * function enabling to know what interrupt may currently occur
    190        * if someone manipulates the i8259s interrupt mask without care...
    191        */
    192       rtems_irq_is_enabled      isOn;
    193       /*
    194        *  Set to -1 for vectors forced to have only 1 handler
    195        */
    196       void *next_handler;
    197 
    198 }rtems_irq_connect_data;
    199 
    200 typedef struct {
    201   /*
    202    * size of all the table fields (*Tbl) described below.
    203    */
    204   unsigned int                  irqNb;
    205   /*
    206    * Default handler used when disconnecting interrupts.
    207    */
    208   rtems_irq_connect_data        defaultEntry;
    209   /*
    210    * Table containing initials/current value.
    211    */
    212   rtems_irq_connect_data*       irqHdlTbl;
    213   /*
    214    * actual value of BSP_ISA_IRQ_VECTOR_BASE...
    215    */
    216   rtems_irq_symbolic_name       irqBase;
    217   /*
    218    * software priorities associated with interrupts.
    219    * if (*irqPrio  [i]  >  intrPrio  [j]  it  means  that
    220    * interrupt handler hdl connected for interrupt name i
    221    * will  not be interrupted by the handler connected for interrupt j
    222    * The interrupt source  will be physically masked at i8259 level.
    223    */
    224     rtems_irq_prio*             irqPrioTbl;
    225 }rtems_irq_global_settings;
    226147
    227148/*-------------------------------------------------------------------------+
     
    237158 * not be propagated further to the processor
    238159 */
    239 int BSP_irq_disable_at_i8259s        (const rtems_irq_symbolic_name irqLine);
     160int BSP_irq_disable_at_i8259s        (const rtems_irq_number irqLine);
    240161/*
    241162 * function to enable a particular irq at 8259 level. After calling
     
    243164 * be propagated further to the processor
    244165 */
    245 int BSP_irq_enable_at_i8259s            (const rtems_irq_symbolic_name irqLine);
     166int BSP_irq_enable_at_i8259s            (const rtems_irq_number irqLine);
    246167/*
    247168 * function to acknowledge a particular irq at 8259 level. After calling
     
    251172 * handlers.
    252173 */
    253 int BSP_irq_ack_at_i8259s               (const rtems_irq_symbolic_name irqLine);
     174int BSP_irq_ack_at_i8259s               (const rtems_irq_number irqLine);
    254175/*
    255176 * function to check if a particular irq is enabled at 8259 level. After calling
    256177 */
    257 int BSP_irq_enabled_at_i8259s           (const rtems_irq_symbolic_name irqLine);
    258 /*
    259  * ------------------------ RTEMS Single Irq Handler Mngt Routines ----------------
    260  */
    261 /*
    262  * function to connect a particular irq handler. This hanlder will NOT be called
    263  * directly as the result of the corresponding interrupt. Instead, a RTEMS
    264  * irq prologue will be called that will :
    265  *
    266  *      1) save the C scratch registers,
    267  *      2) switch to a interrupt stack if the interrupt is not nested,
    268  *      3) store the current i8259s' interrupt masks
    269  *      4) modify them to disable the current interrupt at 8259 level (and may
    270  *      be others depending on software priorities)
    271  *      5) acknowledge the i8259s',
    272  *      6) demask the processor,
    273  *      7) call the application handler
    274  *
    275  * As a result the hdl function provided
    276  *
    277  *      a) can perfectly be written is C,
    278  *      b) may also well directly call the part of the RTEMS API that can be
    279  *      used from interrupt level,
    280  *      c) It only responsible for handling the jobs that need to be done at
    281  *      the device level including (aknowledging/re-enabling the interrupt
    282  *      at device, level, getting the data,...)
    283  *
    284  *      When returning from the function, the following will be performed by
    285  *      the RTEMS irq epilogue:
    286  *
    287  *      1) masks the interrupts again,
    288  *      2) restore the original i8259s' interrupt masks
    289  *      3) switch back on the orinal stack if needed,
    290  *      4) perform rescheduling when necessary,
    291  *      5) restore the C scratch registers...
    292  *      6) restore initial execution flow
    293  */
    294 int BSP_install_rtems_irq_handler       (const rtems_irq_connect_data*);
    295 int BSP_install_rtems_shared_irq_handler  (const rtems_irq_connect_data*);
    296 
    297 #define BSP_SHARED_HANDLER_SUPPORT      1
    298 
    299 /*
    300  * function to get the current RTEMS irq handler for ptr->name. It enables to
    301  * define hanlder chain...
    302  */
    303 int BSP_get_current_rtems_irq_handler   (rtems_irq_connect_data* ptr);
    304 /*
    305  * function to get disconnect the RTEMS irq handler for ptr->name.
    306  * This function checks that the value given is the current one for safety
    307  * reasons.
    308  * The user can use the previous function to get it.
    309  */
    310 int BSP_remove_rtems_irq_handler        (const rtems_irq_connect_data*);
    311 
    312 /*
    313  * ------------------------ RTEMS Global Irq Handler Mngt Routines ----------------
    314  */
    315 /*
    316  * (Re) Initialize the RTEMS interrupt management.
    317  *
    318  * The result of calling this function will be the same as if each individual
    319  * handler (config->irqHdlTbl[i].hdl)  different from "config->defaultEntry.hdl"
    320  * has been individualy connected via
    321  *      BSP_install_rtems_irq_handler(&config->irqHdlTbl[i])
    322  * And each handler currently equal to config->defaultEntry.hdl
    323  * has been previously disconnected via
    324  *       BSP_remove_rtems_irq_handler (&config->irqHdlTbl[i])
    325  *
    326  * This is to say that all information given will be used and not just
    327  * only the space.
    328  *
    329  * CAUTION : the various table address contained in config will be used
    330  *           directly by the interrupt mangement code in order to save
    331  *           data size so they must stay valid after the call => they should
    332  *           not be modified or declared on a stack.
    333  */
    334 
    335 int BSP_rtems_irq_mngt_set(rtems_irq_global_settings* config);
    336 /*
    337  * (Re) get info on current RTEMS interrupt management.
    338  */
    339 int BSP_rtems_irq_mngt_get(rtems_irq_global_settings**);
     178int BSP_irq_enabled_at_i8259s           (const rtems_irq_number irqLine);
    340179
    341180extern void BSP_rtems_irq_mng_init(unsigned cpuId);
     
    347186
    348187#endif
    349 
    350188#endif
Note: See TracChangeset for help on using the changeset viewer.