Changeset c10dc13 in rtems


Ignore:
Timestamp:
Dec 2, 2007, 9:49:07 PM (13 years ago)
Author:
Till Straumann <strauman@…>
Branches:
4.10, 4.11, 4.9, master
Children:
d62e807
Parents:
daccc4a
Message:

2007-12-02 Till Straumann <strauman@…>

  • shared/irq/i8259.c, shared/irq/irq.h, shared/irq/irq_supp.h, shared/irq/openpic_i8259_irq.c: BSP_disable_irq_at_pic(), openpic_disable_irq(), BSP_irq_disable_at_i8259s() now return 0/1 if irq was disabled/enabled prior to disabling. irq_supp.h now exports a inline helper routine for scanning a list of shared handlers; to be used by PIC drivers.
Location:
c/src/lib/libbsp/powerpc
Files:
5 edited

Legend:

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

    rdaccc4a rc10dc13  
     12007-12-02      Till Straumann <strauman@slac.stanford.edu>
     2
     3        * shared/irq/i8259.c, shared/irq/irq.h, shared/irq/irq_supp.h,
     4        shared/irq/openpic_i8259_irq.c: BSP_disable_irq_at_pic(),
     5        openpic_disable_irq(), BSP_irq_disable_at_i8259s() now return
     6        0/1 if irq was disabled/enabled prior to disabling.
     7        irq_supp.h now exports a inline helper routine for scanning
     8        a list of shared handlers; to be used by PIC drivers.
     9
    1102007-12-02      Till Straumann <strauman@slac.stanford.edu>
    211
  • c/src/lib/libbsp/powerpc/shared/irq/i8259.c

    rdaccc4a rc10dc13  
    3030| Global Variables: i8259s_cache
    3131|        Arguments: vector_offset - number of IRQ line to mask.
    32 |          Returns: Nothing.
     32|          Returns: original state or -1 on error.
    3333+--------------------------------------------------------------------------*/
    3434int BSP_irq_disable_at_i8259s    (const rtems_irq_number irqLine)
     
    3636  unsigned short        mask;
    3737  rtems_interrupt_level level;
     38  int                   rval;
    3839
    3940  if ( ((int)irqLine < BSP_ISA_IRQ_LOWEST_OFFSET) ||
    4041       ((int)irqLine > BSP_ISA_IRQ_MAX_OFFSET)
    4142       )
    42     return 1;
     43    return -1;
    4344
    4445  rtems_interrupt_disable(level);
    4546
    4647  mask = 1 << irqLine;
     48  rval = i8259s_cache & mask ? 0 : 1;
    4749  i8259s_cache |= mask;
    4850
     
    5759  rtems_interrupt_enable(level);
    5860
    59   return 0;
     61  return rval;
    6062}
    6163
  • c/src/lib/libbsp/powerpc/shared/irq/irq.h

    rdaccc4a rc10dc13  
    158158 * this function, even if the device asserts the interrupt line it will
    159159 * not be propagated further to the processor
     160 *
     161 * RETURNS: 1/0 if the interrupt was enabled/disabled originally or
     162 *          a value < 0 on error.
    160163 */
    161164int BSP_irq_disable_at_i8259s        (const rtems_irq_number irqLine);
  • c/src/lib/libbsp/powerpc/shared/irq/irq_supp.h

    rdaccc4a rc10dc13  
    3131 */
    3232extern void BSP_enable_irq_at_pic               (const rtems_irq_number irqLine);
    33 extern void BSP_disable_irq_at_pic              (const rtems_irq_number irqLine);
     33/*
     34 * RETURNS: nonzero (> 0 ) if irq was enabled originally, zero if irq
     35 *          was off and negative value if there was an error.
     36 */
     37extern int  BSP_disable_irq_at_pic              (const rtems_irq_number irqLine);
    3438
    3539/*
     
    4953void C_dispatch_irq_handler (struct _BSP_Exception_frame *frame, unsigned int excNum);
    5054
     55/*
     56 * Snippet to be used by PIC drivers;
     57 * enables interrupts, traverses list of
     58 * shared handlers for a given interrupt
     59 * and restores original irq level
     60 */
     61
     62static inline void
     63bsp_irq_dispatch_list(rtems_irq_connect_data *tbl, unsigned irq, rtems_irq_hdl sentinel)
     64{
     65register uint32_t       l_orig;
     66
     67        l_orig = _ISR_Get_level();
     68
     69        /* Enable all interrupts */
     70        _ISR_Set_level(0);
     71
     72  /* rtems_hdl_tbl[irq].hdl(rtems_hdl_tbl[irq].handle); */
     73  {
     74     rtems_irq_connect_data* vchain;
     75     for( vchain = &tbl[irq];
     76          ((int)vchain != -1 && vchain->hdl != sentinel);
     77          vchain = (rtems_irq_connect_data*)vchain->next_handler )
     78     {
     79        vchain->hdl(vchain->handle);
     80     }
     81  }
     82
     83  /* Restore original level */
     84  _ISR_Set_level(l_orig);
     85}
     86
    5187#ifdef __cplusplus
    5288}
  • c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c

    rdaccc4a rc10dc13  
    119119}
    120120
    121 void
     121int
    122122BSP_disable_irq_at_pic(const rtems_irq_number name)
    123123{
     
    127127       * disable interrupt at PIC level
    128128       */
    129       BSP_irq_disable_at_i8259s ((int) name - BSP_ISA_IRQ_LOWEST_OFFSET);
     129      return BSP_irq_disable_at_i8259s ((int) name - BSP_ISA_IRQ_LOWEST_OFFSET);
    130130    }
    131131#endif
     
    134134       * disable interrupt at OPENPIC level
    135135       */
    136       openpic_disable_irq ((int) name - BSP_PCI_IRQ_LOWEST_OFFSET);
    137     }
     136      return openpic_disable_irq ((int) name - BSP_PCI_IRQ_LOWEST_OFFSET);
     137    }
     138        return -1;
    138139}
    139140
     
    210211unsigned BSP_spuriousIntr = 0;
    211212
    212 static inline void
    213 dispatch_list(unsigned int irq)
    214 {
    215 register uint32_t       l_orig;
    216 
    217         l_orig = _ISR_Get_level();
    218 
    219         /* Enable all interrupts */
    220         _ISR_Set_level(0);
    221 
    222   /* rtems_hdl_tbl[irq].hdl(rtems_hdl_tbl[irq].handle); */
    223   {
    224      rtems_irq_connect_data* vchain;
    225      for( vchain = &rtems_hdl_tbl[irq];
    226           ((int)vchain != -1 && vchain->hdl != default_rtems_entry.hdl);
    227           vchain = (rtems_irq_connect_data*)vchain->next_handler )
    228      {
    229         vchain->hdl(vchain->handle);
    230      }
    231   }
    232 
    233   /* Restore original level */
    234   _ISR_Set_level(l_orig);
    235 }
    236213/*
    237214 * High level IRQ handler called from shared_raw_irq_code_entry
     
    248225  if (excNum == ASM_DEC_VECTOR) {
    249226
    250         dispatch_list(BSP_DECREMENTER);
     227        bsp_irq_dispatch_list(rtems_hdl_tbl, BSP_DECREMENTER, default_rtems_entry.hdl);
    251228
    252229    return;
     
    283260
    284261  /* dispatch handlers */
    285   dispatch_list(irq);
     262  bsp_irq_dispatch_list(rtems_hdl_tbl, irq, default_rtems_entry.hdl);
    286263
    287264#ifdef BSP_PCI_ISA_BRIDGE_IRQ
Note: See TracChangeset for help on using the changeset viewer.