Changeset 838c82b in rtems


Ignore:
Timestamp:
May 17, 2005, 2:55:45 PM (15 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
41a4657
Parents:
6d03c94
Message:

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

  • irq/irq.c, irq/irq.h: Modified to include rtems/irq.h.
Location:
c/src/lib/libbsp/i386/shared/irq
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/shared/irq/irq.c

    r6d03c94 r838c82b  
    5555|          Returns: Nothing.
    5656+--------------------------------------------------------------------------*/
    57 int BSP_irq_disable_at_i8259s    (const rtems_irq_symbolic_name irqLine)
     57int BSP_irq_disable_at_i8259s    (const rtems_irq_number irqLine)
    5858{
    5959  unsigned short mask;
     
    9090|          Returns: Nothing.
    9191+--------------------------------------------------------------------------*/
    92 int BSP_irq_enable_at_i8259s    (const rtems_irq_symbolic_name irqLine)
     92int BSP_irq_enable_at_i8259s    (const rtems_irq_number irqLine)
    9393{
    9494  unsigned short mask;
     
    118118} /* mask_irq */
    119119
    120 int BSP_irq_enabled_at_i8259s           (const rtems_irq_symbolic_name irqLine)
     120int BSP_irq_enabled_at_i8259s           (const rtems_irq_number irqLine)
    121121{
    122122  unsigned short mask;
     
    138138|          Returns: Nothing.
    139139+--------------------------------------------------------------------------*/
    140 int BSP_irq_ack_at_i8259s       (const rtems_irq_symbolic_name irqLine)
     140int BSP_irq_ack_at_i8259s       (const rtems_irq_number irqLine)
    141141{
    142142  if ( ((int)irqLine < BSP_LOWEST_OFFSET) ||
  • c/src/lib/libbsp/i386/shared/irq/irq.h

    r6d03c94 r838c82b  
    3232#include <bsp/irq_asm.h>
    3333#include <rtems.h>
     34#include <rtems/irq.h>
     35
    3436/*-------------------------------------------------------------------------+
    3537| Constants
    3638+--------------------------------------------------------------------------*/
    3739
    38 typedef enum {
    3940    /* Base vector for our IRQ handlers. */
    40   BSP_IRQ_VECTOR_BASE           =       BSP_ASM_IRQ_VECTOR_BASE,
    41   BSP_IRQ_LINES_NUMBER          =       16,
    42   BSP_LOWEST_OFFSET             =       0,
    43   BSP_MAX_OFFSET                =       BSP_IRQ_LINES_NUMBER - 1,
     41#define BSP_IRQ_VECTOR_BASE             BSP_ASM_IRQ_VECTOR_BASE
     42#define BSP_IRQ_LINES_NUMBER            16
     43#define BSP_LOWEST_OFFSET               0
     44#define BSP_MAX_OFFSET                  (BSP_IRQ_LINES_NUMBER - 1)
    4445    /*
    4546     * Interrupt offset in comparison to BSP_ASM_IRQ_VECTOR_BASE
     
    4849     *         so that handler connexion can be unchanged.
    4950     */
    50   BSP_PERIODIC_TIMER            =       0,
    51 
    52   BSP_KEYBOARD                  =       1,
    53 
    54   BSP_UART_COM2_IRQ             =       3,
    55 
    56   BSP_UART_COM1_IRQ             =       4,
    57 
    58   BSP_RT_TIMER1         =       8,
    59 
    60   BSP_RT_TIMER3         =       10
    61 } rtems_irq_symbolic_name;
     51#define BSP_PERIODIC_TIMER      0
     52#define BSP_KEYBOARD            1
     53#define BSP_UART_COM2_IRQ       3
     54#define BSP_UART_COM1_IRQ       4
     55#define BSP_RT_TIMER1           8
     56#define BSP_RT_TIMER3           10
    6257
    6358/*
    6459 * Type definition for RTEMS managed interrupts
    6560 */
    66 typedef unsigned char  rtems_irq_prio;
    6761typedef unsigned short rtems_i8259_masks;
    6862
    6963extern  rtems_i8259_masks i8259s_cache;
    70 
    71 struct  __rtems_irq_connect_data__;     /* forward declaratiuon */
    72 
    73 typedef void *rtems_irq_hdl_param;
    74 typedef void (*rtems_irq_hdl)           (rtems_irq_hdl_param);
    75 typedef void (*rtems_irq_enable)        (const struct __rtems_irq_connect_data__*);
    76 typedef void (*rtems_irq_disable)       (const struct __rtems_irq_connect_data__*);
    77 typedef int  (*rtems_irq_is_enabled)    (const struct __rtems_irq_connect_data__*);
    78 
    79 typedef struct __rtems_irq_connect_data__ {
    80   /*
    81    * IRQ line
    82    */
    83   rtems_irq_symbolic_name       name;
    84   /*
    85    * handler. See comment on handler properties below in function prototype.
    86    */
    87   rtems_irq_hdl                 hdl;
    88   /*
    89    * Handler handle to store private data
    90    */
    91   rtems_irq_hdl_param         handle;
    92   /*
    93    * function for enabling interrupts at device level (ONLY!).
    94    * The BSP code will automatically enable it at i8259s level.
    95    * RATIONALE : anyway such code has to exist in current driver code.
    96    * It is usually called immediately AFTER connecting the interrupt handler.
    97    * RTEMS may well need such a function when restoring normal interrupt
    98    * processing after a debug session.
    99    *
    100    */
    101     rtems_irq_enable            on;
    102   /*
    103    * function for disabling interrupts at device level (ONLY!).
    104    * The code will disable it at i8259s level. RATIONALE : anyway
    105    * such code has to exist for clean shutdown. It is usually called
    106    * BEFORE disconnecting the interrupt. RTEMS may well need such
    107    * a function when disabling normal interrupt processing for
    108    * a debug session. May well be a NOP function.
    109    */
    110   rtems_irq_disable             off;
    111   /*
    112    * function enabling to know what interrupt may currently occur
    113    * if someone manipulates the i8259s interrupt mask without care...
    114    */
    115     rtems_irq_is_enabled        isOn;
    116 } rtems_irq_connect_data;
    117 
    118 typedef struct {
    119   /*
    120    * size of all the table fields (*Tbl) described below.
    121    */
    122   unsigned int                  irqNb;
    123   /*
    124    * Default handler used when disconnecting interrupts.
    125    */
    126   rtems_irq_connect_data        defaultEntry;
    127   /*
    128    * Table containing initials/current value.
    129    */
    130   rtems_irq_connect_data*       irqHdlTbl;
    131   /*
    132    * actual value of BSP_IRQ_VECTOR_BASE...
    133    */
    134   rtems_irq_symbolic_name       irqBase;
    135   /*
    136    * software priorities associated with interrupts.
    137    * if irqPrio  [i]  >  intrPrio  [j]  it  means  that
    138    * interrupt handler hdl connected for interrupt name i
    139    * will  not be interrupted by the handler connected for interrupt j
    140    * The interrupt source  will be physically masked at i8259 level.
    141    */
    142     rtems_irq_prio*             irqPrioTbl;
    143 }rtems_irq_global_settings;
    14464
    14565/*-------------------------------------------------------------------------+
     
    15575 * not be propagated further to the processor
    15676 */
    157 int BSP_irq_disable_at_i8259s        (const rtems_irq_symbolic_name irqLine);
     77int BSP_irq_disable_at_i8259s        (const rtems_irq_number irqLine);
    15878/*
    15979 * function to enable a particular irq at 8259 level. After calling
     
    16181 * be propagated further to the processor
    16282 */
    163 int BSP_irq_enable_at_i8259s            (const rtems_irq_symbolic_name irqLine);
     83int BSP_irq_enable_at_i8259s            (const rtems_irq_number irqLine);
    16484/*
    16585 * function to acknoledge a particular irq at 8259 level. After calling
     
    16989 * handlers.
    17090 */
    171 int BSP_irq_ack_at_i8259s               (const rtems_irq_symbolic_name irqLine);
     91int BSP_irq_ack_at_i8259s               (const rtems_irq_number irqLine);
    17292/*
    17393 * function to check if a particular irq is enabled at 8259 level. After calling
    17494 */
    175 int BSP_irq_enabled_at_i8259s           (const rtems_irq_symbolic_name irqLine);
    176 /*
    177  * ------------------------ RTEMS Single Irq Handler Mngt Routines ----------------
    178  */
    179 /*
    180  * function to connect a particular irq handler. This hanlder will NOT be called
    181  * directly as the result of the corresponding interrupt. Instead, a RTEMS
    182  * irq prologue will be called that will :
    183  *
    184  *      1) save the C scratch registers,
    185  *      2) switch to a interrupt stack if the interrupt is not nested,
    186  *      3) store the current i8259s' interrupt masks
    187  *      4) modify them to disable the current interrupt at 8259 level (and may
    188  *      be others depending on software priorities)
    189  *      5) aknowledge the i8259s',
    190  *      6) demask the processor,
    191  *      7) call the application handler
    192  *
    193  * As a result the hdl function provided
    194  *
    195  *      a) can perfectly be written is C,
    196  *      b) may also well directly call the part of the RTEMS API that can be used
    197  *      from interrupt level,
    198  *      c) It only responsible for handling the jobs that need to be done at
    199  *      the device level including (aknowledging/re-enabling the interrupt at device,
    200  *      level, getting the data,...)
    201  *
    202  *      When returning from the function, the following will be performed by
    203  *      the RTEMS irq epilogue :
    204  *
    205  *      1) masks the interrupts again,
    206  *      2) restore the original i8259s' interrupt masks
    207  *      3) switch back on the orinal stack if needed,
    208  *      4) perform rescheduling when necessary,
    209  *      5) restore the C scratch registers...
    210  *      6) restore initial execution flow
    211  *
    212  */
    213 int BSP_install_rtems_irq_handler       (const rtems_irq_connect_data*);
    214 /*
    215  * function to get the current RTEMS irq handler for ptr->name. It enables to
    216  * define hanlder chain...
    217  */
    218 int BSP_get_current_rtems_irq_handler   (rtems_irq_connect_data* ptr);
    219 /*
    220  * function to get disconnect the RTEMS irq handler for ptr->name.
    221  * This function checks that the value given is the current one for safety reason.
    222  * The user can use the previous function to get it.
    223  */
    224 int BSP_remove_rtems_irq_handler        (const rtems_irq_connect_data*);
    225 
    226 /*
    227  * ------------------------ RTEMS Global Irq Handler Mngt Routines ----------------
    228  */
    229 /*
    230  * (Re) Initialize the RTEMS interrupt management.
    231  *
    232  * The result of calling this function will be the same as if each individual
    233  * handler (config->irqHdlTbl[i].hdl)  different from "config->defaultEntry.hdl"
    234  * has been individualy connected via
    235  *      BSP_install_rtems_irq_handler(&config->irqHdlTbl[i])
    236  * And each handler currently equal to config->defaultEntry.hdl
    237  * has been previously disconnected via
    238  *       BSP_remove_rtems_irq_handler (&config->irqHdlTbl[i])
    239  *
    240  * This is to say that all information given will be used and not just
    241  * only the space.
    242  *
    243  * CAUTION : the various table address contained in config will be used
    244  *           directly by the interrupt mangement code in order to save
    245  *           data size so they must stay valid after the call => they should
    246  *           not be modified or declared on a stack.
    247  */
    248 
    249 int BSP_rtems_irq_mngt_set(rtems_irq_global_settings* config);
    250 /*
    251  * (Re) get info on current RTEMS interrupt management.
    252  */
    253 int BSP_rtems_irq_mngt_get(rtems_irq_global_settings**);
     95int BSP_irq_enabled_at_i8259s           (const rtems_irq_number irqLine);
    25496
    25597#ifdef __cplusplus
Note: See TracChangeset for help on using the changeset viewer.