Changeset 63530c62 in mainline for kernel/generic


Ignore:
Timestamp:
2006-10-14T19:31:03Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e3890b3f
Parents:
7dcf22a
Message:

Changes in ns16550 and z8530 drivers.
Add some stuff for IRQ notifications to irq_t.

Location:
kernel/generic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ddi/irq.h

    r7dcf22a r63530c62  
    3838#include <arch/types.h>
    3939#include <adt/list.h>
     40#include <ipc/ipc.h>
     41#include <ipc/irq.h>
     42#include <atomic.h>
     43#include <synch/spinlock.h>
    4044
    4145typedef enum {
     
    6367        link_t link;
    6468
     69        /** Lock protecting everything in this structure
     70         *  except the link member. When both the IRQ
     71         *  hash table lock and this lock are to be acquired,
     72         *  this lock must not be taken first.
     73         */
     74        SPINLOCK_DECLARE(lock);
     75
    6576        /** Unique device number. -1 if not yet assigned. */
    6677        devno_t devno;
     
    6879        /** Actual IRQ number. -1 if not yet assigned. */
    6980        inr_t inr;
    70         /** Task ID of the task to be notified about the IRQ or 0. */
    71         task_id_t notif;
    7281        /** Trigger level of the IRQ.*/
    7382        irq_trigger_t trigger;
     
    7887        /** Argument for the handler. */
    7988        void *arg;
     89
     90        /** Answerbox of the task that wanted to be notified. */
     91        answerbox_t *notif_answerbox;
     92        /** Pseudo-code to be performed by the top-half
     93         *  before a notification is sent. */
     94        irq_code_t *code;
     95        /** Counter of IRQ notifications. */
     96        atomic_t counter;
    8097};
    8198
  • kernel/generic/src/ddi/irq.c

    r7dcf22a r63530c62  
    6464#include <typedefs.h>
    6565#include <synch/spinlock.h>
     66#include <atomic.h>
    6667#include <arch.h>
    6768
     
    128129{
    129130        link_initialize(&irq->link);
     131        spinlock_initialize(&irq->lock, "irq.lock");
    130132        irq->inr = -1;
    131133        irq->devno = -1;
    132         irq->notif = 0;
    133134        irq->trigger = 0;
    134135        irq->claim = NULL;
    135136        irq->handler = NULL;
    136137        irq->arg = NULL;
     138        irq->notif_answerbox = NULL;
     139        irq->code = NULL;
     140        atomic_set(&irq->counter, 0);
    137141}
    138142
     
    221225        irq_t *irq = hash_table_get_instance(item, irq_t, link);
    222226        inr_t *inr = (inr_t *) key;
    223        
    224         return ((irq->inr == *inr) && (irq->claim() == IRQ_ACCEPT));
     227        bool rv;
     228       
     229        spinlock_lock(&irq->lock);
     230        rv = ((irq->inr == *inr) && (irq->claim() == IRQ_ACCEPT));
     231        spinlock_unlock(&irq->lock);
     232
     233        return rv;
    225234}
    226235
     
    260269{
    261270        irq_t *irq = list_get_instance(item, irq_t, link);
    262        
    263         return (irq->claim() == IRQ_ACCEPT);
     271        bool rv;
     272       
     273        spinlock_lock(&irq->lock);
     274        rv = (irq->claim() == IRQ_ACCEPT);
     275        spinlock_unlock(&irq->lock);
     276       
     277        return rv;
    264278}
    265279
Note: See TracChangeset for help on using the changeset viewer.