Changeset c167b56 in rtems


Ignore:
Timestamp:
Apr 5, 2012, 3:23:17 PM (8 years ago)
Author:
Daniel Hellstrom <daniel@…>
Children:
ca1ce3c
Parents:
72f80652
git-author:
Daniel Hellstrom <daniel@…> (04/05/12 15:23:17)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/10/12 06:45:03)
Message:

GRETH: use shared-irq service instead of BSP specific set_vec()

The ISR code is updated to use argument instead of global greth
structure, now that the greth private is available in the ISR.

The shared-irq routines will unmask the IRQ, so the forced LEON3
BSP unmask/clear IRQ is removed.

Signed-off-by: Daniel Hellstrom <daniel@…>

Location:
c/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/leon3/leon_greth/leon_greth.c

    r72f80652 rc167b56  
    4949    *(volatile int *) base_addr = 0;
    5050    leon_greth_configuration.base_address = base_addr;
    51     leon_greth_configuration.vector = eth_irq + 0x10;
     51    leon_greth_configuration.vector = eth_irq; /* on LEON vector is IRQ no. */
    5252    leon_greth_configuration.txd_count = TDA_COUNT;
    5353    leon_greth_configuration.rxd_count = RDA_COUNT;
    54     if (rtems_greth_driver_attach( config, &leon_greth_configuration )) {
    55       LEON_Clear_interrupt(eth_irq);
    56       LEON_Unmask_interrupt(eth_irq);
    57     }
     54    rtems_greth_driver_attach(config, &leon_greth_configuration);
    5855  }
    5956  return 0;
  • c/src/libchip/network/greth.c

    r72f80652 rc167b56  
    4242#undef free
    4343#endif
    44 
    45 #if defined(__m68k__)
    46 extern m68k_isr_entry set_vector( rtems_isr_entry, rtems_vector_number, int );
    47 #elif defined(__lm32__)
    48 extern lm32_isr_entry set_vector( rtems_isr_entry, rtems_vector_number, int );
    49 #else
    50 extern rtems_isr_entry set_vector( rtems_isr_entry, rtems_vector_number, int );
    51 #endif
    52 
    5344
    5445/* #define GRETH_DEBUG */
     
    190181/* GRETH interrupt handler */
    191182
    192 rtems_isr
    193 greth_interrupt_handler (rtems_vector_number v)
     183void greth_interrupt_handler (void *arg)
    194184{
    195185        uint32_t status;
    196186        uint32_t ctrl;
    197187        rtems_event_set events = 0;
     188        struct greth_softc *greth = arg;
    198189
    199190        /* read and clear interrupt cause */
    200         status = greth.regs->status;
    201         greth.regs->status = status;
    202         ctrl = greth.regs->ctrl;
     191        status = greth->regs->status;
     192        greth->regs->status = status;
     193        ctrl = greth->regs->ctrl;
    203194
    204195        /* Frame received? */
    205196        if ((ctrl & GRETH_CTRL_RXIRQ) && (status & (GRETH_STATUS_RXERR | GRETH_STATUS_RXIRQ)))
    206197        {
    207                 greth.rxInterrupts++;
     198                greth->rxInterrupts++;
    208199                /* Stop RX-Error and RX-Packet interrupts */
    209200                ctrl &= ~GRETH_CTRL_RXIRQ;
     
    213204        if ( (ctrl & GRETH_CTRL_TXIRQ) && (status & (GRETH_STATUS_TXERR | GRETH_STATUS_TXIRQ)) )
    214205        {
    215                 greth.txInterrupts++;
     206                greth->txInterrupts++;
    216207                ctrl &= ~GRETH_CTRL_TXIRQ;
    217208                events |= GRETH_TX_WAIT_EVENT;
    218209        }
    219        
     210
    220211        /* Clear interrupt sources */
    221         greth.regs->ctrl = ctrl;
    222        
     212        greth->regs->ctrl = ctrl;
     213
    223214        /* Send the event(s) */
    224215        if ( events )
    225             rtems_event_send (greth.daemonTid, events);
     216                rtems_event_send (greth->daemonTid, events);
    226217}
    227218
     
    486477    regs->status = 0xffffffff;
    487478   
    488     /* install interrupt vector */
    489     set_vector(greth_interrupt_handler, sc->vector, 1);
     479    /* install interrupt handler */
     480    rtems_interrupt_handler_install(sc->vector, "greth", RTEMS_INTERRUPT_SHARED,
     481                                    greth_interrupt_handler, sc);
    490482
    491483    regs->ctrl |= GRETH_CTRL_RXEN | (sc->fd << 4) | GRETH_CTRL_RXIRQ | (sc->sp << 7) | (sc->gb << 8);
  • c/src/libchip/network/greth.h

    r72f80652 rc167b56  
    1919typedef struct {
    2020  void                 *base_address;
    21   uint32_t              vector;
     21  rtems_vector_number   vector;
    2222  uint32_t              txd_count;
    2323  uint32_t              rxd_count;
Note: See TracChangeset for help on using the changeset viewer.