Ignore:
File:
1 edited

Legend:

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

    r98000fb r9cdac5a  
    3636#define KERN_IRQ_H_
    3737
    38 typedef enum {
    39         CMD_PIO_READ_8 = 1,
    40         CMD_PIO_READ_16,
    41         CMD_PIO_READ_32,
    42         CMD_PIO_WRITE_8,
    43         CMD_PIO_WRITE_16,
    44         CMD_PIO_WRITE_32,
    45         CMD_BTEST,
    46         CMD_PREDICATE,
    47         CMD_ACCEPT,
    48         CMD_DECLINE,
    49         CMD_LAST
    50 } irq_cmd_type;
    51 
    52 typedef struct {
    53         irq_cmd_type cmd;
    54         void *addr;
    55         unsigned long long value;
    56         unsigned int srcarg;
    57         unsigned int dstarg;
    58 } irq_cmd_t;
    59 
    60 typedef struct {
    61         unsigned int cmdcount;
    62         irq_cmd_t *cmds;
    63 } irq_code_t;
    64 
    6538#ifdef KERNEL
    6639
    67 #include <arch/types.h>
     40#include <typedefs.h>
    6841#include <adt/list.h>
    6942#include <adt/hash_table.h>
     
    7245#include <ipc/ipc.h>
    7346
     47#endif /* KERNEL */
     48
    7449typedef enum {
    75         IRQ_DECLINE,            /**< Decline to service. */
    76         IRQ_ACCEPT              /**< Accept to service. */
     50        /** Read 1 byte from the I/O space. */
     51        CMD_PIO_READ_8 = 1,
     52        /** Read 2 bytes from the I/O space. */
     53        CMD_PIO_READ_16,
     54        /** Read 4 bytes from the I/O space. */
     55        CMD_PIO_READ_32,
     56       
     57        /** Write 1 byte to the I/O space. */
     58        CMD_PIO_WRITE_8,
     59        /** Write 2 bytes to the I/O space. */
     60        CMD_PIO_WRITE_16,
     61        /** Write 4 bytes to the I/O space. */
     62        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         */
     84        CMD_BTEST,
     85       
     86        /**
     87         * Predicate the execution of the following
     88         * N commands by the boolean value of the source
     89         * argument.
     90         */
     91        CMD_PREDICATE,
     92       
     93        /** Accept the interrupt. */
     94        CMD_ACCEPT,
     95       
     96        /** Decline the interrupt. */
     97        CMD_DECLINE,
     98        CMD_LAST
     99} irq_cmd_type;
     100
     101typedef struct {
     102        irq_cmd_type cmd;
     103        void *addr;
     104        uint32_t value;
     105        uintptr_t srcarg;
     106        uintptr_t dstarg;
     107} irq_cmd_t;
     108
     109typedef struct {
     110        size_t cmdcount;
     111        irq_cmd_t *cmds;
     112} irq_code_t;
     113
     114#ifdef KERNEL
     115
     116typedef enum {
     117        IRQ_DECLINE,  /**< Decline to service. */
     118        IRQ_ACCEPT    /**< Accept to service. */
    77119} irq_ownership_t;
    78120
     
    92134 * Primarily, this structure is encapsulated in the irq_t structure.
    93135 * It is protected by irq_t::lock.
     136 *
    94137 */
    95138typedef struct {
     
    98141        /** Answerbox for notifications. */
    99142        answerbox_t *answerbox;
    100         /** Method to be used for the notification. */
    101         unative_t method;
     143        /** Interface and method to be used for the notification. */
     144        sysarg_t imethod;
    102145        /** Arguments that will be sent if the IRQ is claimed. */
    103         unative_t scratch[IPC_CALL_LEN];
     146        uint32_t scratch[IPC_CALL_LEN];
    104147        /** Top-half pseudocode. */
    105148        irq_code_t *code;
    106149        /** Counter. */
    107150        size_t counter;
     151       
    108152        /**
    109153         * Link between IRQs that are notifying the same answerbox. The list is
     
    117161 * If one device has multiple interrupts, there will be multiple irq_t
    118162 * instantions with the same devno.
     163 *
    119164 */
    120165typedef struct irq {
    121166        /** Hash table link. */
    122167        link_t link;
    123 
     168       
    124169        /** Lock protecting everything in this structure
    125170         *  except the link member. When both the IRQ
     
    127172         *  this lock must not be taken first.
    128173         */
    129         SPINLOCK_DECLARE(lock);
     174        IRQ_SPINLOCK_DECLARE(lock);
    130175       
    131176        /** Send EOI before processing the interrupt.
     
    136181         */
    137182        bool preack;
    138 
     183       
    139184        /** Unique device number. -1 if not yet assigned. */
    140185        devno_t devno;
    141 
     186       
    142187        /** Actual IRQ number. -1 if not yet assigned. */
    143188        inr_t inr;
     
    150195        /** Instance argument for the handler and the claim function. */
    151196        void *instance;
    152 
     197       
    153198        /** Clear interrupt routine. */
    154199        cir_t cir;
    155200        /** First argument to the clear interrupt routine. */
    156201        void *cir_arg;
    157 
     202       
    158203        /** Notification configuration structure. */
    159204        ipc_notif_cfg_t notif_cfg;
    160205} irq_t;
    161206
    162 SPINLOCK_EXTERN(irq_uspace_hash_table_lock);
     207IRQ_SPINLOCK_EXTERN(irq_uspace_hash_table_lock);
    163208extern hash_table_t irq_uspace_hash_table;
     209
     210extern inr_t last_inr;
    164211
    165212extern void irq_init(size_t, size_t);
     
    168215extern irq_t *irq_dispatch_and_lock(inr_t);
    169216
     217#endif /* KERNEL */
     218
    170219#endif
    171220
    172 #endif
    173 
    174221/** @}
    175222 */
Note: See TracChangeset for help on using the changeset viewer.