Changeset da1bafb in mainline for kernel/generic/include/ddi/irq.h


Ignore:
Timestamp:
2010-05-24T18:57:31Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0095368
Parents:
666f492
Message:

major code revision

  • replace spinlocks taken with interrupts disabled with irq_spinlocks
  • change spacing (not indendation) to be tab-size independent
  • use unsigned integer types where appropriate (especially bit flags)
  • visual separation
  • remove argument names in function prototypes
  • string changes
  • correct some formating directives
  • replace various cryptic single-character variables (t, a, m, c, b, etc.) with proper identifiers (thread, task, timeout, as, itm, itc, etc.)
  • unify some assembler constructs
  • unused page table levels are now optimized out in compile time
  • replace several ints (with boolean semantics) with bools
  • use specifically sized types instead of generic types where appropriate (size_t, uint32_t, btree_key_t)
  • improve comments
  • split asserts with conjuction into multiple independent asserts
File:
1 edited

Legend:

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

    r666f492 rda1bafb  
    3535#ifndef KERN_IRQ_H_
    3636#define KERN_IRQ_H_
     37
     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 */
    3748
    3849typedef enum {
     
    4960        /** Write 4 bytes to the I/O space. */
    5061        CMD_PIO_WRITE_32,
     62       
    5163        /**
    5264         * Perform a bit test on the source argument and store the result into
     
    5466         */
    5567        CMD_BTEST,
     68       
    5669        /**
    5770         * Predicate the execution of the following N commands by the boolean
     
    5972         */
    6073        CMD_PREDICATE,
     74       
    6175        /** Accept the interrupt. */
    6276        CMD_ACCEPT,
     
    6983        irq_cmd_type cmd;
    7084        void *addr;
    71         unsigned long long value;
    72         unsigned int srcarg;
    73         unsigned int dstarg;
     85        uint32_t value;
     86        uintptr_t srcarg;
     87        uintptr_t dstarg;
    7488} irq_cmd_t;
    7589
    7690typedef struct {
    77         unsigned int cmdcount;
     91        size_t cmdcount;
    7892        irq_cmd_t *cmds;
    7993} irq_code_t;
     
    8195#ifdef KERNEL
    8296
    83 #include <typedefs.h>
    84 #include <adt/list.h>
    85 #include <adt/hash_table.h>
    86 #include <synch/spinlock.h>
    87 #include <proc/task.h>
    88 #include <ipc/ipc.h>
    89 
    9097typedef enum {
    91         IRQ_DECLINE,            /**< Decline to service. */
    92         IRQ_ACCEPT              /**< Accept to service. */
     98        IRQ_DECLINE,  /**< Decline to service. */
     99        IRQ_ACCEPT    /**< Accept to service. */
    93100} irq_ownership_t;
    94101
     
    108115 * Primarily, this structure is encapsulated in the irq_t structure.
    109116 * It is protected by irq_t::lock.
     117 *
    110118 */
    111119typedef struct {
     
    117125        unative_t method;
    118126        /** Arguments that will be sent if the IRQ is claimed. */
    119         unative_t scratch[IPC_CALL_LEN];
     127        uint32_t scratch[IPC_CALL_LEN];
    120128        /** Top-half pseudocode. */
    121129        irq_code_t *code;
    122130        /** Counter. */
    123131        size_t counter;
     132       
    124133        /**
    125134         * Link between IRQs that are notifying the same answerbox. The list is
     
    133142 * If one device has multiple interrupts, there will be multiple irq_t
    134143 * instantions with the same devno.
     144 *
    135145 */
    136146typedef struct irq {
    137147        /** Hash table link. */
    138148        link_t link;
    139 
     149       
    140150        /** Lock protecting everything in this structure
    141151         *  except the link member. When both the IRQ
     
    143153         *  this lock must not be taken first.
    144154         */
    145         SPINLOCK_DECLARE(lock);
     155        IRQ_SPINLOCK_DECLARE(lock);
    146156       
    147157        /** Send EOI before processing the interrupt.
     
    152162         */
    153163        bool preack;
    154 
     164       
    155165        /** Unique device number. -1 if not yet assigned. */
    156166        devno_t devno;
    157 
     167       
    158168        /** Actual IRQ number. -1 if not yet assigned. */
    159169        inr_t inr;
     
    166176        /** Instance argument for the handler and the claim function. */
    167177        void *instance;
    168 
     178       
    169179        /** Clear interrupt routine. */
    170180        cir_t cir;
    171181        /** First argument to the clear interrupt routine. */
    172182        void *cir_arg;
    173 
     183       
    174184        /** Notification configuration structure. */
    175185        ipc_notif_cfg_t notif_cfg;
    176186} irq_t;
    177187
    178 SPINLOCK_EXTERN(irq_uspace_hash_table_lock);
     188IRQ_SPINLOCK_EXTERN(irq_uspace_hash_table_lock);
    179189extern hash_table_t irq_uspace_hash_table;
    180190
     
    184194extern irq_t *irq_dispatch_and_lock(inr_t);
    185195
     196#endif /* KERNEL */
     197
    186198#endif
    187199
    188 #endif
    189 
    190200/** @}
    191201 */
Note: See TracChangeset for help on using the changeset viewer.