Changeset 124bc22 in mainline for kernel/arch/mips32/src/interrupt.c


Ignore:
Timestamp:
2019-04-04T18:08:51Z (5 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5d97627
Parents:
e064102
Message:

Reorganize interrupt and IRQ handling on mips32

This allows msim to use MIPS CPU interrupt numbers as IRQ numbers and
Malta to use ISA IRQ numbers as IRQ numbers. Common code can still
register MIPS CPU interrupts by their respective numbers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/src/interrupt.c

    re064102 r124bc22  
    4141#include <ipc/sysipc.h>
    4242
    43 #define IRQ_COUNT   8
    44 #define TIMER_IRQ   7
    45 
    46 function virtual_timer_fnc = NULL;
    47 static irq_t timer_irq;
    48 
    4943// TODO: This is SMP unsafe!!!
    5044
     
    5246static unsigned long nextcount;
    5347static unsigned long lastcount;
     48
     49/** Table of interrupt handlers. */
     50int_handler_t int_handler[INTERRUPTS] = {};
    5451
    5552/** Disable interrupts.
     
    113110}
    114111
    115 static irq_ownership_t timer_claim(irq_t *irq)
    116 {
    117         return IRQ_ACCEPT;
    118 }
    119 
    120 static void timer_irq_handler(irq_t *irq)
     112static void timer_interrupt_handler(unsigned int intr)
    121113{
    122114        if (cp0_count_read() < lastcount)
     
    135127        cp0_compare_write(nextcount);
    136128
    137         /*
    138          * We are holding a lock which prevents preemption.
    139          * Release the lock, call clock() and reacquire the lock again.
    140          */
    141         irq_spinlock_unlock(&irq->lock, false);
    142129        clock();
    143         irq_spinlock_lock(&irq->lock, false);
    144 
    145         if (virtual_timer_fnc != NULL)
    146                 virtual_timer_fnc();
    147130}
    148131
     
    150133void interrupt_init(void)
    151134{
    152         irq_init(IRQ_COUNT, IRQ_COUNT);
    153 
    154         irq_initialize(&timer_irq);
    155         timer_irq.inr = TIMER_IRQ;
    156         timer_irq.claim = timer_claim;
    157         timer_irq.handler = timer_irq_handler;
    158         irq_register(&timer_irq);
     135        int_handler[INT_TIMER] = timer_interrupt_handler;
    159136
    160137        timer_start();
    161         cp0_unmask_int(TIMER_IRQ);
     138        cp0_unmask_int(INT_TIMER);
    162139}
    163140
Note: See TracChangeset for help on using the changeset viewer.