60 static int nr_of_interrupt_handlers = 0;
67 static void no_interrupt_assert(
struct interrupt *i) { }
68 static void no_interrupt_deassert(
struct interrupt *i) { }
85 #ifdef INTERRUPT_DEBUG
86 printf(
"interrupt_handler_register(\"%s\")\n",
templ->
name);
90 for (i=0; i<nr_of_interrupt_handlers; i++) {
95 fatal(
"\ninterrupt_handler_register(): An interrupt handler"
96 " using the name '%s' is already registered.\n",
101 nr_of_interrupt_handlers ++;
106 interrupt_handlers[nr_of_interrupt_handlers-1].
templ = *
templ;
123 #ifdef INTERRUPT_DEBUG
124 printf(
"interrupt_handler_remove(\"%s\")\n", name);
127 for (i=0; i<nr_of_interrupt_handlers; i++) {
128 if (strcmp(name, interrupt_handlers[i].
templ.
name) != 0)
136 fatal(
"interrupt_handler_remove(): Attempt to "
137 "remove interrupt handler '%s' which has %i "
138 "exclusive and %i non-exclusive users. Aborting.\n",
144 if (i != nr_of_interrupt_handlers-1)
145 memcpy(&interrupt_handlers[i],
146 &interrupt_handlers[i + 1],
147 nr_of_interrupt_handlers - i - 1);
149 nr_of_interrupt_handlers --;
154 fatal(
"interrupt_handler_remove(): '%s' not found? Aborting.\n", name);
170 #ifdef INTERRUPT_DEBUG
171 printf(
"interrupt_handler_lookup(\"%s\")\n", name);
174 if (name[0] ==
'\0') {
181 for (i=0; i<nr_of_interrupt_handlers; i++) {
182 if (strcmp(name, interrupt_handlers[i].
templ.
name) != 0)
190 if (i >= nr_of_interrupt_handlers) {
191 printf(
"interrupt_handler_lookup(\"%s\") failed. "
192 "Aborting.\n", name);
209 #ifdef INTERRUPT_DEBUG
210 printf(
"interrupt_connect(\"%s\")\n", in->
name);
213 if (in->
name == NULL || in->
name[0] ==
'\0')
216 for (i=0; i<nr_of_interrupt_handlers; i++) {
223 fatal(
"Fatal error in interrupt_connect(): "
224 "more than 1 exclusive user. Dumping "
225 "core for backtrace.\n");
235 fatal(
"Internal error in interrupt_connect(): name '%s' not "
236 "found? Dumping core for debugging.\n", in->
name);
250 if (in->
name == NULL || in->
name[0] ==
'\0')
253 for (i=0; i<nr_of_interrupt_handlers; i++) {
260 fatal(
"Fatal error in interrupt_disconnect():"
261 "nr of exclusive users < 0?\n");
267 fatal(
"Fatal error in interrupt_disconnect():"
268 "nr of non-exclusive users < 0?\n");
276 fatal(
"Internal error in interrupt_disconnect(): name '%s' not "
277 "found?\n", in->
name);