Ignore:
File:
1 edited

Legend:

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

    r9cdac5a r98000fb  
    3636#define KERN_IRQ_H_
    3737
    38 #ifdef KERNEL
    39 
    40 #include <typedefs.h>
    41 #include <adt/list.h>
    42 #include <adt/hash_table.h>
    43 #include <synch/spinlock.h>
    44 #include <proc/task.h>
    45 #include <ipc/ipc.h>
    46 
    47 #endif /* KERNEL */
    48 
    4938typedef enum {
    50         /** Read 1 byte from the I/O space. */
    5139        CMD_PIO_READ_8 = 1,
    52         /** Read 2 bytes from the I/O space. */
    5340        CMD_PIO_READ_16,
    54         /** Read 4 bytes from the I/O space. */
    5541        CMD_PIO_READ_32,
    56        
    57         /** Write 1 byte to the I/O space. */
    5842        CMD_PIO_WRITE_8,
    59         /** Write 2 bytes to the I/O space. */
    6043        CMD_PIO_WRITE_16,
    61         /** Write 4 bytes to the I/O space. */
    6244        CMD_PIO_WRITE_32,
    63        
    64         /**
    65          * Write 1 byte from the source argument
    66          * to the I/O space.
    67          */
    68         CMD_PIO_WRITE_A_8,
    69         /**
    70          * Write 2 bytes from the source argument
    71          * to the I/O space.
    72          */
    73         CMD_PIO_WRITE_A_16,
    74         /**
    75          * Write 4 bytes from the source argument
    76          * to the I/O space.
    77          */
    78         CMD_PIO_WRITE_A_32,
    79        
    80         /**
    81          * Perform a bit masking on the source argument
    82          * and store the result into the destination argument.
    83          */
    8445        CMD_BTEST,
    85        
    86         /**
    87          * Predicate the execution of the following
    88          * N commands by the boolean value of the source
    89          * argument.
    90          */
    9146        CMD_PREDICATE,
    92        
    93         /** Accept the interrupt. */
    9447        CMD_ACCEPT,
    95        
    96         /** Decline the interrupt. */
    9748        CMD_DECLINE,
    9849        CMD_LAST
     
    10253        irq_cmd_type cmd;
    10354        void *addr;
    104         uint32_t value;
    105         uintptr_t srcarg;
    106         uintptr_t dstarg;
     55        unsigned long long value;
     56        unsigned int srcarg;
     57        unsigned int dstarg;
    10758} irq_cmd_t;
    10859
    10960typedef struct {
    110         size_t cmdcount;
     61        unsigned int cmdcount;
    11162        irq_cmd_t *cmds;
    11263} irq_code_t;
     
    11465#ifdef KERNEL
    11566
     67#include <arch/types.h>
     68#include <adt/list.h>
     69#include <adt/hash_table.h>
     70#include <synch/spinlock.h>
     71#include <proc/task.h>
     72#include <ipc/ipc.h>
     73
    11674typedef enum {
    117         IRQ_DECLINE,  /**< Decline to service. */
    118         IRQ_ACCEPT    /**< Accept to service. */
     75        IRQ_DECLINE,            /**< Decline to service. */
     76        IRQ_ACCEPT              /**< Accept to service. */
    11977} irq_ownership_t;
    12078
     
    13492 * Primarily, this structure is encapsulated in the irq_t structure.
    13593 * It is protected by irq_t::lock.
    136  *
    13794 */
    13895typedef struct {
     
    14198        /** Answerbox for notifications. */
    14299        answerbox_t *answerbox;
    143         /** Interface and method to be used for the notification. */
    144         sysarg_t imethod;
     100        /** Method to be used for the notification. */
     101        unative_t method;
    145102        /** Arguments that will be sent if the IRQ is claimed. */
    146         uint32_t scratch[IPC_CALL_LEN];
     103        unative_t scratch[IPC_CALL_LEN];
    147104        /** Top-half pseudocode. */
    148105        irq_code_t *code;
    149106        /** Counter. */
    150107        size_t counter;
    151        
    152108        /**
    153109         * Link between IRQs that are notifying the same answerbox. The list is
     
    161117 * If one device has multiple interrupts, there will be multiple irq_t
    162118 * instantions with the same devno.
    163  *
    164119 */
    165120typedef struct irq {
    166121        /** Hash table link. */
    167122        link_t link;
    168        
     123
    169124        /** Lock protecting everything in this structure
    170125         *  except the link member. When both the IRQ
     
    172127         *  this lock must not be taken first.
    173128         */
    174         IRQ_SPINLOCK_DECLARE(lock);
     129        SPINLOCK_DECLARE(lock);
    175130       
    176131        /** Send EOI before processing the interrupt.
     
    181136         */
    182137        bool preack;
    183        
     138
    184139        /** Unique device number. -1 if not yet assigned. */
    185140        devno_t devno;
    186        
     141
    187142        /** Actual IRQ number. -1 if not yet assigned. */
    188143        inr_t inr;
     
    195150        /** Instance argument for the handler and the claim function. */
    196151        void *instance;
    197        
     152
    198153        /** Clear interrupt routine. */
    199154        cir_t cir;
    200155        /** First argument to the clear interrupt routine. */
    201156        void *cir_arg;
    202        
     157
    203158        /** Notification configuration structure. */
    204159        ipc_notif_cfg_t notif_cfg;
    205160} irq_t;
    206161
    207 IRQ_SPINLOCK_EXTERN(irq_uspace_hash_table_lock);
     162SPINLOCK_EXTERN(irq_uspace_hash_table_lock);
    208163extern hash_table_t irq_uspace_hash_table;
    209 
    210 extern inr_t last_inr;
    211164
    212165extern void irq_init(size_t, size_t);
     
    215168extern irq_t *irq_dispatch_and_lock(inr_t);
    216169
    217 #endif /* KERNEL */
     170#endif
    218171
    219172#endif
Note: See TracChangeset for help on using the changeset viewer.