Changes in kernel/generic/include/ddi/irq.h [98000fb:9cdac5a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ddi/irq.h
r98000fb r9cdac5a 36 36 #define KERN_IRQ_H_ 37 37 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_LAST50 } 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 65 38 #ifdef KERNEL 66 39 67 #include < arch/types.h>40 #include <typedefs.h> 68 41 #include <adt/list.h> 69 42 #include <adt/hash_table.h> … … 72 45 #include <ipc/ipc.h> 73 46 47 #endif /* KERNEL */ 48 74 49 typedef 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 101 typedef 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 109 typedef struct { 110 size_t cmdcount; 111 irq_cmd_t *cmds; 112 } irq_code_t; 113 114 #ifdef KERNEL 115 116 typedef enum { 117 IRQ_DECLINE, /**< Decline to service. */ 118 IRQ_ACCEPT /**< Accept to service. */ 77 119 } irq_ownership_t; 78 120 … … 92 134 * Primarily, this structure is encapsulated in the irq_t structure. 93 135 * It is protected by irq_t::lock. 136 * 94 137 */ 95 138 typedef struct { … … 98 141 /** Answerbox for notifications. */ 99 142 answerbox_t *answerbox; 100 /** Method to be used for the notification. */101 unative_tmethod;143 /** Interface and method to be used for the notification. */ 144 sysarg_t imethod; 102 145 /** Arguments that will be sent if the IRQ is claimed. */ 103 u native_t scratch[IPC_CALL_LEN];146 uint32_t scratch[IPC_CALL_LEN]; 104 147 /** Top-half pseudocode. */ 105 148 irq_code_t *code; 106 149 /** Counter. */ 107 150 size_t counter; 151 108 152 /** 109 153 * Link between IRQs that are notifying the same answerbox. The list is … … 117 161 * If one device has multiple interrupts, there will be multiple irq_t 118 162 * instantions with the same devno. 163 * 119 164 */ 120 165 typedef struct irq { 121 166 /** Hash table link. */ 122 167 link_t link; 123 168 124 169 /** Lock protecting everything in this structure 125 170 * except the link member. When both the IRQ … … 127 172 * this lock must not be taken first. 128 173 */ 129 SPINLOCK_DECLARE(lock);174 IRQ_SPINLOCK_DECLARE(lock); 130 175 131 176 /** Send EOI before processing the interrupt. … … 136 181 */ 137 182 bool preack; 138 183 139 184 /** Unique device number. -1 if not yet assigned. */ 140 185 devno_t devno; 141 186 142 187 /** Actual IRQ number. -1 if not yet assigned. */ 143 188 inr_t inr; … … 150 195 /** Instance argument for the handler and the claim function. */ 151 196 void *instance; 152 197 153 198 /** Clear interrupt routine. */ 154 199 cir_t cir; 155 200 /** First argument to the clear interrupt routine. */ 156 201 void *cir_arg; 157 202 158 203 /** Notification configuration structure. */ 159 204 ipc_notif_cfg_t notif_cfg; 160 205 } irq_t; 161 206 162 SPINLOCK_EXTERN(irq_uspace_hash_table_lock);207 IRQ_SPINLOCK_EXTERN(irq_uspace_hash_table_lock); 163 208 extern hash_table_t irq_uspace_hash_table; 209 210 extern inr_t last_inr; 164 211 165 212 extern void irq_init(size_t, size_t); … … 168 215 extern irq_t *irq_dispatch_and_lock(inr_t); 169 216 217 #endif /* KERNEL */ 218 170 219 #endif 171 220 172 #endif173 174 221 /** @} 175 222 */
Note:
See TracChangeset
for help on using the changeset viewer.