Cromwell <-> PCI interface (stubs now) is taken to another file. In the long run...
[reactos.git] / reactos / drivers / usb / cromwell / linux / linux_wrapper.h
1 /*
2 * linux-wrapper.h
3 *
4 * Hard coded Linux kernel replacements for x86
5 *
6 * (c) 2003 Georg Acher (georg@acher.org)
7 *
8 * Emulation of:
9 * typedefs
10 * structs
11 * macros
12 *
13 * All structs and prototypes are based on kernel source 2.5.72
14 *
15 * #include <standard-GPL-header.h>
16 */
17
18 /*------------------------------------------------------------------------*/
19 /* Typedefs */
20 /*------------------------------------------------------------------------*/
21 #include "cromwell_types.h"
22
23 typedef unsigned int __u32;
24 //typedef __u32 u32;
25 typedef unsigned short __u16;
26 //typedef __u16 u16;
27 typedef unsigned char __u8;
28 //typedef __u8 u8;
29
30 typedef short s16;
31
32 typedef u32 dma_addr_t;
33
34 typedef int spinlock_t;
35 typedef int atomic_t;
36 #ifndef STANDALONE
37 typedef int mode_t;
38 typedef int pid_t;
39 typedef int ssize_t;
40
41 #endif
42 typedef int irqreturn_t;
43 typedef unsigned long kernel_ulong_t;
44
45 typedef int wait_queue_head_t;
46 /*------------------------------------------------------------------------*/
47 /* Stuff from xbox/linux environment */
48 /*------------------------------------------------------------------------*/
49
50 #include "list.h"
51
52 #ifndef STANDALONE
53 #ifdef MODULE
54 typedef int size_t;
55 #define NULL ((void*)0)
56 extern void * memset(void *,int,unsigned int);
57 extern void * memcpy(void *,const void *,unsigned int);
58 #if 0
59 extern char * strcpy(char *,const char *);
60 #else
61 static inline char * strcpy(char * dest,const char *src)
62 {
63 int d0, d1, d2;
64 __asm__ __volatile__(
65 "1:\tlodsb\n\t"
66 "stosb\n\t"
67 "testb %%al,%%al\n\t"
68 "jne 1b"
69 : "=&S" (d0), "=&D" (d1), "=&a" (d2)
70 :"0" (src),"1" (dest) : "memory");
71 return dest;
72 }
73 #endif
74 extern size_t strlen(const char *);
75
76 extern int memcmp(const void *,const void *,unsigned int);
77
78 #else
79 #include "boot.h"
80 #include "config.h"
81 #endif
82 #else
83 #include <stdarg.h>
84 #include <stdio.h>
85 #include <stdlib.h>
86 #include "consts.h"
87 #include <string.h>
88 #endif
89
90 /*------------------------------------------------------------------------*/
91 /* General structs */
92 /*------------------------------------------------------------------------*/
93
94 struct timer_list {
95 void (*function)(unsigned long);
96 unsigned long data;
97 int expires;
98 struct list_head timer_list;
99 };
100
101 struct work_struct {
102 void (*func)(void *);
103 };
104 struct device {
105 char name[128];
106 struct bus_type *bus;
107 int dma_mask;
108 char bus_id[16];
109 struct device_driver* driver;
110 void *driver_data;
111 struct device *parent;
112 struct list_head driver_list;
113 void (*release)(struct device * dev);
114 };
115 struct class_device{int a;};
116 struct semaphore{int a;};
117
118 struct device_driver{
119 char *name;
120 struct bus_type *bus;
121 int (*probe) (struct device * dev);
122 int (*remove) (struct device * dev);
123 struct list_head devices;
124 };
125
126 struct bus_type {
127 char * name;
128 int (*match)(struct device * dev, struct device_driver * drv);
129 struct device * (*add) (struct device * parent, char * bus_id);
130 int (*hotplug) (struct device *dev, char **envp,
131 int num_envp, char *buffer, int buffer_size);
132 };
133
134 struct dummy_process
135 {
136 int flags;
137 };
138
139 struct pt_regs
140 {
141 int a;
142 };
143 struct completion {
144 unsigned int done;
145 wait_queue_head_t wait;
146 };
147
148 /* from mod_devicetable.h */
149
150 struct usb_device_id {
151 /* which fields to match against? */
152 __u16 match_flags;
153
154 /* Used for product specific matches; range is inclusive */
155 __u16 idVendor;
156 __u16 idProduct;
157 __u16 bcdDevice_lo;
158 __u16 bcdDevice_hi;
159
160 /* Used for device class matches */
161 __u8 bDeviceClass;
162 __u8 bDeviceSubClass;
163 __u8 bDeviceProtocol;
164
165 /* Used for interface class matches */
166 __u8 bInterfaceClass;
167 __u8 bInterfaceSubClass;
168 __u8 bInterfaceProtocol;
169
170 /* not matched against */
171 kernel_ulong_t driver_info;
172 };
173
174 /* Some useful macros to use to create struct usb_device_id */
175 #define USB_DEVICE_ID_MATCH_VENDOR 0x0001
176 #define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
177 #define USB_DEVICE_ID_MATCH_DEV_LO 0x0004
178 #define USB_DEVICE_ID_MATCH_DEV_HI 0x0008
179 #define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010
180 #define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020
181 #define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040
182 #define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
183 #define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
184 #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
185
186 /*------------------------------------------------------------------------*/
187 /* imported functions from top-level */
188 /*------------------------------------------------------------------------*/
189
190 //void zxprintf(char* fmt, ...);
191 //void zxsprintf(char *buffer, char* fmt, ...);
192 //int zxsnprintf(char *buffer, size_t s, char* fmt, ...);
193
194 /*------------------------------------------------------------------------*/
195 /* PCI structs (taken from linux/pci.h et al., but slightly modified) */
196 /*------------------------------------------------------------------------*/
197
198 struct pci_dev {
199 int vendor;
200 int device;
201 struct pci_bus *bus;
202 int irq;
203 char *slot_name;
204 struct device dev;
205 int base[4];
206 int flags[4];
207 void * data;
208 };
209
210 struct pci_bus {
211 unsigned char number;
212 };
213
214 struct pci_device_id {
215 __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/
216 __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
217 __u32 class, class_mask; /* (class,subclass,prog-if) triplet */
218 kernel_ulong_t driver_data; /* Data private to the driver */
219 };
220
221 struct pci_driver {
222 struct list_head node;
223 char *name;
224 const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */
225 int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
226 void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
227 int (*save_state) (struct pci_dev *dev, u32 state); /* Save Device Context */
228 int (*suspend) (struct pci_dev *dev, u32 state); /* Device suspended */
229 int (*resume) (struct pci_dev *dev); /* Device woken up */
230 int (*enable_wake) (struct pci_dev *dev, u32 state, int enable); /* Enable wake event */
231 };
232
233 struct scatterlist
234 {
235 int page;
236 int offset;
237 int length;
238 };
239
240 struct usbdevfs_hub_portinfo
241 {
242 int nports;
243 int port[8];
244 };
245
246 /*------------------------------------------------------------------------*/
247 /* constant defines */
248 /*------------------------------------------------------------------------*/
249
250 #define TASK_UNINTERRUPTIBLE 0
251 #define HZ 100 /* Don't rely on that... */
252 #define KERN_DEBUG "DBG: "
253 #define KERN_ERR "ERR: "
254 #define KERN_WARNING "WRN: "
255 #define KERN_INFO "INF: "
256 #define GFP_KERNEL 0
257 #define GFP_ATOMIC 0
258 #define GFP_NOIO 0
259 #define SLAB_ATOMIC 0
260 #define PCI_ANY_ID (~0)
261 #define SIGKILL 9
262 #define THIS_MODULE 0
263 //#define PAGE_SIZE 4096
264
265
266 #define CLONE_FS 0
267 #define CLONE_FILES 0
268 #define CLONE_SIGHAND 0
269 #define PF_FREEZE 0
270 #define PF_IOTHREAD 0
271
272
273 #define USBDEVFS_HUB_PORTINFO 1234
274 #define SA_SHIRQ 0
275
276 #undef PCI_COMMAND
277 #define PCI_COMMAND 0
278 #undef PCI_COMMAND_MASTER
279 #define PCI_COMMAND_MASTER 0
280 /*------------------------------------------------------------------------*/
281 /* Module/export macros */
282 /*------------------------------------------------------------------------*/
283
284 #define MODULE_AUTHOR(a)
285 #define MODULE_DESCRIPTION(a)
286 #define MODULE_LICENSE(a)
287 #define MODULE_DEVICE_TABLE(type,name) void* module_table_##name=&name
288
289 #define __devinit
290 #define __exit
291 #define __init
292 #define __devinitdata
293 #define module_init(x) static void module_init_##x(void){ x();}
294 #define module_exit(x) void module_exit_##x(void){ x();}
295 #define EXPORT_SYMBOL_GPL(x)
296 #define EXPORT_SYMBOL(x)
297
298 #define __setup(x,y) int setup_##y=(int)y
299 #define subsys_initcall(x) void subsys_##x(void){x();}
300
301 /*------------------------------------------------------------------------*/
302 /* Access macros */
303 /*------------------------------------------------------------------------*/
304
305 #define dev_get_drvdata(a) (a)->driver_data
306 #define dev_set_drvdata(a,b) (a)->driver_data=(b)
307
308 #define __io_virt(x) ((void *)(x))
309 #define readl(addr) (*(volatile unsigned int *) __io_virt(addr))
310 #define writel(b,addr) (*(volatile unsigned int *) __io_virt(addr) = (b))
311 #define likely(x) (x)
312 #define unlikely(x) (x)
313 #define prefetch(x) 1
314
315 /* The kernel macro for list_for_each_entry makes nonsense (have no clue
316 * why, this is just the same definition...) */
317
318 #undef list_for_each_entry
319 #define list_for_each_entry(pos, head, member) \
320 for (pos = list_entry((head)->next, typeof(*pos), member), \
321 prefetch(pos->member.next); \
322 &pos->member != (head); \
323 pos = list_entry(pos->member.next, typeof(*pos), member), \
324 prefetch(pos->member.next))
325
326 /*------------------------------------------------------------------------*/
327 /* function wrapper macros */
328 /*------------------------------------------------------------------------*/
329 #define kmalloc(x,y) ExAllocatePool(PagedPool,x)
330 #define kfree(x) ExFreePool(x)
331
332 //#define sprintf(a,b,format, arg...) zxsprintf((a),(b),format, ## arg)
333 //#define snprintf(a,b,format, arg...) zxsnprintf((a),(b),format, ##arg)
334 //#define printk(format, arg...) zxprintf(format, ## arg)
335 #define snprintf(a,b,format, arg...) _snprintf((a),(b),format, ##arg)
336 #define printk(format, arg...) DPRINT1(format, ## arg)
337 #define BUG(...) do {} while(0)
338
339 /* Locks & friends */
340
341 #define DECLARE_MUTEX(x) struct semaphore x
342 #define init_MUTEX(x)
343
344 #define SPIN_LOCK_UNLOCKED 0
345 #define spin_lock_init(a) do {} while(0)
346 #define spin_lock(a) *(int*)a=1
347 #define spin_unlock(a) do {} while(0)
348
349 #define spin_lock_irqsave(a,b) b=0
350 #define spin_unlock_irqrestore(a,b)
351
352 #if 0
353 #define local_irq_save(x) __asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (x): /* no input */ :"memory")
354 #define local_irq_restore(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory", "cc")
355 #else
356 #define local_irq_save(x) do {} while(0)
357 #define local_irq_restore(x) do {} while(0)
358 #endif
359
360 #define atomic_inc(x) *(x)+=1
361 #define atomic_dec(x) *(x)-=1
362 #define atomic_dec_and_test(x) (*(x)-=1,(*(x))==0)
363 #define atomic_set(x,a) *(x)=a
364 #define atomic_read(x) *(x)
365 #define ATOMIC_INIT(x) (x)
366
367 #define down(x) do {} while(0)
368 #define up(x) do {} while(0)
369 #define down_trylock(a) 0
370
371 #define down_read(a) do {} while(0)
372 #define up_read(a) do {} while(0)
373
374 #define DECLARE_WAIT_QUEUE_HEAD(x) int x
375
376 #define DECLARE_COMPLETION(x) struct completion x
377
378 /* driver */
379
380 #define driver_unregister(a) do {} while(0)
381 #define put_device(a) do {} while(0)
382
383
384 /* PCI */
385 #define pci_pool_create(a,b,c,d,e) (void*)1
386
387 #define pci_pool_alloc(a,b,c) my_pci_pool_alloc(a,b,c)
388
389 static void __inline__ *my_pci_pool_alloc(void* pool, size_t size,
390 dma_addr_t *dma_handle)
391 {
392 void* a;
393 a=kmalloc(size,0); //FIXME
394 #ifdef MODULE
395 *dma_handle=((u32)a)&0xfffffff;
396 #else
397 *dma_handle=(u32)a;
398 #endif
399 return a;
400 }
401
402
403 #define pci_pool_free(a,b,c) kfree(b)
404 #define pci_alloc_consistent(a,b,c) my_pci_alloc_consistent(a,b,c)
405
406 static void __inline__ *my_pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
407 dma_addr_t *dma_handle)
408 {
409 void* a;
410
411 a=kmalloc(size+256,0); //FIXME
412 a=(void*)(((int)a+255)&~255); // 256 alignment
413 *dma_handle=((u32)a)&0xfffffff;
414
415 return a;
416 }
417
418 #define pci_free_consistent(a,b,c,d) kfree(c)
419 #define pci_pool_destroy(a) do {} while(0)
420
421 #define pci_module_init(x) my_pci_module_init(x)
422 int my_pci_module_init(struct pci_driver *x);
423
424 #define pci_unregister_driver(a) do {} while(0)
425
426 #define bus_register(a) do {} while(0)
427 #define bus_unregister(a) do {} while(0)
428
429 #define dma_map_single(a,b,c,d) ((u32)(b)&0xfffffff)
430 #define dma_unmap_single(a,b,c,d) do {} while(0)
431 #define pci_unmap_single(a,b,c,d) do {} while(0)
432 #define dma_sync_single(a,b,c,d) do {} while(0)
433 #define dma_sync_sg(a,b,c,d) do {} while(0)
434 #define dma_map_sg(a,b,c,d) 0
435 #define dma_unmap_sg(a,b,c,d) do {} while(0)
436
437 #define usb_create_driverfs_dev_files(a) do {} while(0)
438 #define usb_create_driverfs_intf_files(a) do {} while(0)
439 #define sg_dma_address(x) ((u32)((x)->page*4096 + (x)->offset))
440 #define sg_dma_len(x) ((x)->length)
441
442 #define page_address(x) ((void*)(x/4096))
443
444 #define DMA_TO_DEVICE 0
445 #define DMA_FROM_DEVICE 0
446 #define PCI_DMA_TODEVICE
447 #define PCI_DMA_FROMDEVICE
448 #define PCI_DMA_TODEVICE
449
450 #define PCI_ROM_RESOURCE 0
451 #define IORESOURCE_IO 1
452
453 #define DECLARE_WAITQUEUE(a,b) wait_queue_head_t a=0
454 #define init_waitqueue_head(a) do {} while(0)
455 #define add_wait_queue(a,b) do {} while(0)
456 #define remove_wait_queue(a,b) do {} while(0)
457
458 #define wmb() __asm__ __volatile__ ("": : :"memory")
459 #define rmb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
460
461 #define in_interrupt() 0
462
463 #define init_completion(x) (x)->done=0
464 #define wait_for_completion(x) my_wait_for_completion(x)
465 void my_wait_for_completion(struct completion*);
466
467 #define IRQ_NONE 0
468 #define IRQ_HANDLED 1
469
470 #define INIT_WORK(a,b,c) (a)->func=b
471
472 #define set_current_state(a) do {} while(0)
473
474 #define might_sleep() do {} while(0)
475 #define daemonize(a) do {} while(0)
476 #define allow_signal(a) do {} while(0)
477 #define wait_event_interruptible(x,y) do {} while(0)
478 #define flush_scheduled_work() do {} while(0)
479 #define refrigerator(x) do {} while(0)
480 #define signal_pending(x) 1 // fall through threads
481 #define complete_and_exit(a,b) return 0
482
483 #define kill_proc(a,b,c) 0
484 #define yield() do {} while(0)
485 #define cpu_relax() do {} while(0)
486
487 /*------------------------------------------------------------------------*/
488 /* Kernel macros */
489 /*------------------------------------------------------------------------*/
490
491 #define LINUX_VERSION_CODE 0x020572
492 #define UTS_SYSNAME "XBOX"
493 #define UTS_RELEASE "----"
494
495 /* from linux/kernel.h */
496 #define max_t(type,x,y) \
497 ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
498
499 #define min_t(type,x,y) \
500 ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
501
502 #define container_of(ptr, type, member) ({ \
503 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
504 (type *)( (char *)__mptr - offsetof(type,member) );})
505
506 /* from linux/stddef.h */
507
508 #undef offsetof
509 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
510
511 /*------------------------------------------------------------------------*/
512 /* Conversion macros */
513 /*------------------------------------------------------------------------*/
514
515 #define __constant_cpu_to_le32(x) (x)
516 #define cpu_to_le16(x) (x)
517 #define le16_to_cpu(x) (x)
518 #define cpu_to_le32(x) (x)
519 #define cpu_to_le32p(x) (*(__u32*)(x))
520 #define le32_to_cpup(x) (*(__u32*)(x))
521 #define le32_to_cpu(x) ((u32)x)
522 #define le16_to_cpus(x) do {} while (0)
523 #define le16_to_cpup(x) (*(__u16*)(x))
524 #define cpu_to_le16p(x) (*(__u16*)(x))
525
526 /*------------------------------------------------------------------------*/
527 /* Debug output */
528 /*------------------------------------------------------------------------*/
529 #ifdef DEBUG_MODE
530 #define dev_printk(lvl,x,f,arg...) printk(f, ## arg)
531 #define dev_dbg(x,f,arg...) do {} while (0) //printk(f, ## arg)
532 #define dev_info(x,f,arg...) printk(f,## arg)
533 #define dev_warn(x,f,arg...) printk(f,## arg)
534 #define dev_err(x,f,arg...) printk(f,## arg)
535 #define pr_debug(x,f,arg...) printk(f,## arg)
536 #define usbprintk printk
537 #endif
538
539 #ifndef DEBUG_MODE
540 #define dev_printk(lvl,x,f,arg...) do {} while (0)
541 #define dev_dbg(x,f,arg...) do {} while (0) //printk(f, ## arg)
542 #define dev_info(x,f,arg...) do {} while (0)
543 #define dev_warn(x,f,arg...) do {} while (0)
544 #define dev_err(x,f,arg...) do {} while (0)
545 #define pr_debug(x,f,arg...) do {} while (0)
546 #define usbprintk
547 #endif
548
549
550
551 #define PCI_DEVFN(a,b) 0
552 #define PCI_SLOT(a) 0
553
554 /*------------------------------------------------------------------------*/
555 /* Stuff from kernel */
556 /*------------------------------------------------------------------------*/
557
558 #include "errno.h"
559 #include "bitops.h"
560 //#include "linux/pci_ids.h"
561
562 /*------------------------------------------------------------------------*/
563 /* global variables */
564 /*------------------------------------------------------------------------*/
565
566 #define jiffies my_jiffies
567 extern int my_jiffies;
568 #define current my_current
569 extern struct dummy_process *my_current;
570
571 extern struct list_head interrupt_list;
572
573 /*------------------------------------------------------------------------*/
574 /* Function prototypes */
575 /*------------------------------------------------------------------------*/
576 void STDCALL usb_hcd_pci_remove (struct pci_dev *dev);
577
578 #define my_wait_ms(x) wait_ms(x)
579
580 #define my_udelay(x) wait_ms(x)
581 #define udelay(x) my_udelay(x)
582
583 #define my_mdelay(x) wait_ms(1+x/1000);
584 #define mdelay(x) my_mdelay(x);
585
586 #define pci_find_slot(a,b) my_pci_find_slot(a,b)
587 struct pci_dev *my_pci_find_slot(int a,int b);
588
589 /*------------------------------------------------------------------------*/
590 /* Timer management */
591 /*------------------------------------------------------------------------*/
592
593 #define MAX_TIMERS 20
594 extern struct timer_list *main_timer_list[MAX_TIMERS];
595
596 static void __inline__ init_timer(struct timer_list* t)
597 {
598 INIT_LIST_HEAD(&t->timer_list);
599 t->function=NULL;
600 t->expires=0;
601 }
602
603 static void __inline__ add_timer(struct timer_list* t)
604 {
605 int n;
606 for(n=0;n<MAX_TIMERS;n++)
607 if (main_timer_list[n]==0)
608 {
609 main_timer_list[n]=t;
610 break;
611 }
612 }
613
614 static void __inline__ del_timer(struct timer_list* t)
615 {
616 int n;
617 for(n=0;n<MAX_TIMERS;n++)
618 if (main_timer_list[n]==t)
619 {
620 main_timer_list[n]=0;
621 break;
622 }
623 }
624 static void __inline__ del_timer_sync(struct timer_list* t)
625 {
626 int n;
627 for(n=0;n<MAX_TIMERS;n++)
628 if (main_timer_list[n]==t)
629 {
630 main_timer_list[n]=0;
631 break;
632 }
633
634 }
635 static void __inline__ mod_timer(struct timer_list* t, int ex)
636 {
637 del_timer(t);
638 t->expires=ex;
639 add_timer(t);
640 }
641
642 /*------------------------------------------------------------------------*/
643 /* Device driver and process related stuff */
644 /*------------------------------------------------------------------------*/
645
646 static int __inline__ usb_major_init(void){return 0;}
647 static void __inline__ usb_major_cleanup(void){}
648 static void __inline__ schedule_work(void* p){}
649
650 #define device_initialize(x) my_device_initialize(x)
651 void my_device_initialize(struct device *dev);
652
653 #define get_device(x) my_get_device(x)
654 struct device *my_get_device(struct device *dev);
655
656 #define device_add(x) my_device_add(x)
657 int my_device_add(struct device *dev);
658
659 #define driver_register(x) my_driver_register(x)
660 int my_driver_register(struct device_driver *driver);
661
662 #define device_unregister(a) my_device_unregister(a)
663 int my_device_unregister(struct device *dev);
664
665 #define DEVICE_ATTR(a,b,c,d) int xxx_##a
666 #define device_create_file(a,b) do {} while(0)
667 #define device_remove_file(a,b) do {} while(0)
668
669 #define schedule_timeout(x) my_schedule_timeout(x)
670 int my_schedule_timeout(int x);
671
672 #define wake_up(x) my_wake_up(x)
673 void my_wake_up(void*);
674
675 // cannot be mapped via macro due to collision with urb->complete
676 static void __inline__ complete(struct completion *p)
677 {
678 /* Wake up x->wait */
679 p->done++;
680 wake_up(&p->wait);
681 }
682
683 #define kernel_thread(a,b,c) my_kernel_thread(a,b,c)
684 int my_kernel_thread(int (*handler)(void*), void* parm, int flags);
685
686 /*------------------------------------------------------------------------*/
687 /* PCI, simple and inlined... */
688 /*------------------------------------------------------------------------*/
689 #include "pci_hal.c"
690
691 /*------------------------------------------------------------------------*/
692 /* IRQ handling */
693 /*------------------------------------------------------------------------*/
694
695 #define request_irq(a,b,c,d,e) my_request_irq(a,b,c,d,e)
696 int my_request_irq(unsigned int irq,
697 int (*handler)(int, void *, struct pt_regs *),
698 unsigned long mode, const char *desc, void *data);
699
700 #define free_irq(a,b) my_free_irq(a,b)
701 int free_irq(int irq, void* p);
702
703
704
705 struct my_irqs {
706 int (*handler)(int, void *, struct pt_regs *);
707 int irq;
708 void* data;
709 };
710
711 #define MAX_IRQS 8
712
713 // Exported to top level
714
715 void handle_irqs(int irq);
716 void inc_jiffies(int);
717 void init_wrapper(void);
718 void do_all_timers(void);
719
720 #define __KERNEL_DS 0x18
721
722