Make OHCI+Core drivers really working, they are basically working now. Next thing...
[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 void * dev_ext; // link to Windows DeviceExtension
209 };
210
211 struct pci_bus {
212 unsigned char number;
213 };
214
215 struct pci_device_id {
216 __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/
217 __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
218 __u32 class, class_mask; /* (class,subclass,prog-if) triplet */
219 kernel_ulong_t driver_data; /* Data private to the driver */
220 };
221
222 struct pci_driver {
223 struct list_head node;
224 char *name;
225 const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */
226 int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
227 void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
228 int (*save_state) (struct pci_dev *dev, u32 state); /* Save Device Context */
229 int (*suspend) (struct pci_dev *dev, u32 state); /* Device suspended */
230 int (*resume) (struct pci_dev *dev); /* Device woken up */
231 int (*enable_wake) (struct pci_dev *dev, u32 state, int enable); /* Enable wake event */
232 };
233
234 struct scatterlist
235 {
236 int page;
237 int offset;
238 int length;
239 };
240
241 struct usbdevfs_hub_portinfo
242 {
243 int nports;
244 int port[8];
245 };
246
247 /*------------------------------------------------------------------------*/
248 /* constant defines */
249 /*------------------------------------------------------------------------*/
250
251 #define TASK_UNINTERRUPTIBLE 0
252 #define HZ 100 /* Don't rely on that... */
253 #define KERN_DEBUG "DBG: "
254 #define KERN_ERR "ERR: "
255 #define KERN_WARNING "WRN: "
256 #define KERN_INFO "INF: "
257 #define GFP_KERNEL 0
258 #define GFP_ATOMIC 0
259 #define GFP_NOIO 0
260 #define SLAB_ATOMIC 0
261 #define PCI_ANY_ID (~0)
262 #define SIGKILL 9
263 #define THIS_MODULE 0
264 //#define PAGE_SIZE 4096
265
266
267 #define CLONE_FS 0
268 #define CLONE_FILES 0
269 #define CLONE_SIGHAND 0
270 #define PF_FREEZE 0
271 #define PF_IOTHREAD 0
272
273
274 #define USBDEVFS_HUB_PORTINFO 1234
275 #define SA_SHIRQ 0
276
277 #undef PCI_COMMAND
278 #define PCI_COMMAND 0
279 #undef PCI_COMMAND_MASTER
280 #define PCI_COMMAND_MASTER 0
281 /*------------------------------------------------------------------------*/
282 /* Module/export macros */
283 /*------------------------------------------------------------------------*/
284
285 #define MODULE_AUTHOR(a)
286 #define MODULE_DESCRIPTION(a)
287 #define MODULE_LICENSE(a)
288 #define MODULE_DEVICE_TABLE(type,name) void* module_table_##name=&name
289
290 #define __devinit
291 #define __exit
292 #define __init
293 #define __devinitdata
294 #define module_init(x) static void module_init_##x(void){ x();}
295 #define module_exit(x) void module_exit_##x(void){ x();}
296 #define EXPORT_SYMBOL_GPL(x)
297 #define EXPORT_SYMBOL(x)
298
299 #define __setup(x,y) int setup_##y=(int)y
300 #define subsys_initcall(x) void subsys_##x(void){x();}
301
302 /*------------------------------------------------------------------------*/
303 /* Access macros */
304 /*------------------------------------------------------------------------*/
305
306 #define dev_get_drvdata(a) (a)->driver_data
307 #define dev_set_drvdata(a,b) (a)->driver_data=(b)
308
309 #define __io_virt(x) ((void *)(x))
310 #define readl(addr) (*(volatile unsigned int *) __io_virt(addr))
311 #define writel(b,addr) (*(volatile unsigned int *) __io_virt(addr) = (b))
312 #define likely(x) (x)
313 #define unlikely(x) (x)
314 #define prefetch(x) 1
315
316 /* The kernel macro for list_for_each_entry makes nonsense (have no clue
317 * why, this is just the same definition...) */
318
319 #undef list_for_each_entry
320 #define list_for_each_entry(pos, head, member) \
321 for (pos = list_entry((head)->next, typeof(*pos), member), \
322 prefetch(pos->member.next); \
323 &pos->member != (head); \
324 pos = list_entry(pos->member.next, typeof(*pos), member), \
325 prefetch(pos->member.next))
326
327 /*------------------------------------------------------------------------*/
328 /* function wrapper macros */
329 /*------------------------------------------------------------------------*/
330 #define kmalloc(x,y) ExAllocatePool(PagedPool,x)
331 #define kfree(x) ExFreePool(x)
332
333 //#define sprintf(a,b,format, arg...) zxsprintf((a),(b),format, ## arg)
334 //#define snprintf(a,b,format, arg...) zxsnprintf((a),(b),format, ##arg)
335 //#define printk(format, arg...) zxprintf(format, ## arg)
336 #define snprintf(a,b,format, arg...) _snprintf((a),(b),format, ##arg)
337 #define printk(format, arg...) DPRINT1(format, ## arg)
338 #define BUG(...) do {} while(0)
339
340 /* Locks & friends */
341
342 #define DECLARE_MUTEX(x) struct semaphore x
343 #define init_MUTEX(x)
344
345 #define SPIN_LOCK_UNLOCKED 0
346 #define spin_lock_init(a) do {} while(0)
347 #define spin_lock(a) *(int*)a=1
348 #define spin_unlock(a) do {} while(0)
349
350 #define spin_lock_irqsave(a,b) b=0
351 #define spin_unlock_irqrestore(a,b)
352
353 #if 0
354 #define local_irq_save(x) __asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (x): /* no input */ :"memory")
355 #define local_irq_restore(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory", "cc")
356 #else
357 #define local_irq_save(x) do {} while(0)
358 #define local_irq_restore(x) do {} while(0)
359 #endif
360
361 #define atomic_inc(x) *(x)+=1
362 #define atomic_dec(x) *(x)-=1
363 #define atomic_dec_and_test(x) (*(x)-=1,(*(x))==0)
364 #define atomic_set(x,a) *(x)=a
365 #define atomic_read(x) *(x)
366 #define ATOMIC_INIT(x) (x)
367
368 #define down(x) do {} while(0)
369 #define up(x) do {} while(0)
370 #define down_trylock(a) 0
371
372 #define down_read(a) do {} while(0)
373 #define up_read(a) do {} while(0)
374
375 #define DECLARE_WAIT_QUEUE_HEAD(x) int x
376
377 #define DECLARE_COMPLETION(x) struct completion x
378
379 /* driver */
380
381 #define driver_unregister(a) do {} while(0)
382 #define put_device(a) do {} while(0)
383
384
385 /* PCI */
386 #define pci_pool_create(a,b,c,d,e) (void*)1
387
388 #define pci_pool_alloc(a,b,c) my_pci_pool_alloc(a,b,c)
389
390 static void __inline__ *my_pci_pool_alloc(void* pool, size_t size,
391 dma_addr_t *dma_handle)
392 {
393 void* a;
394 a=kmalloc(size,0); //FIXME
395 #ifdef MODULE
396 *dma_handle=((u32)a)&0xfffffff;
397 #else
398 *dma_handle=(u32)a;
399 #endif
400 return a;
401 }
402
403
404 #define pci_pool_free(a,b,c) kfree(b)
405 #define pci_alloc_consistent(a,b,c) my_pci_alloc_consistent(a,b,c)
406
407 static void __inline__ *my_pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
408 dma_addr_t *dma_handle)
409 {
410 void* a;
411
412 a=kmalloc(size+256,0); //FIXME
413 a=(void*)(((int)a+255)&~255); // 256 alignment
414 *dma_handle=((u32)a)&0xfffffff;
415
416 return a;
417 }
418
419 #define pci_free_consistent(a,b,c,d) kfree(c)
420 #define pci_pool_destroy(a) do {} while(0)
421
422 #define pci_module_init(x) my_pci_module_init(x)
423 int my_pci_module_init(struct pci_driver *x);
424
425 #define pci_unregister_driver(a) do {} while(0)
426
427 #define bus_register(a) do {} while(0)
428 #define bus_unregister(a) do {} while(0)
429
430 #define dma_map_single(a,b,c,d) ((u32)(b)&0xfffffff)
431 #define dma_unmap_single(a,b,c,d) do {} while(0)
432 #define pci_unmap_single(a,b,c,d) do {} while(0)
433 #define dma_sync_single(a,b,c,d) do {} while(0)
434 #define dma_sync_sg(a,b,c,d) do {} while(0)
435 #define dma_map_sg(a,b,c,d) 0
436 #define dma_unmap_sg(a,b,c,d) do {} while(0)
437
438 #define usb_create_driverfs_dev_files(a) do {} while(0)
439 #define usb_create_driverfs_intf_files(a) do {} while(0)
440 #define sg_dma_address(x) ((u32)((x)->page*4096 + (x)->offset))
441 #define sg_dma_len(x) ((x)->length)
442
443 #define page_address(x) ((void*)(x/4096))
444
445 #define DMA_TO_DEVICE 0
446 #define DMA_FROM_DEVICE 0
447 #define PCI_DMA_TODEVICE
448 #define PCI_DMA_FROMDEVICE
449 #define PCI_DMA_TODEVICE
450
451 #define PCI_ROM_RESOURCE 0
452 #define IORESOURCE_IO 1
453
454 #define DECLARE_WAITQUEUE(a,b) wait_queue_head_t a=0
455 #define init_waitqueue_head(a) do {} while(0)
456 #define add_wait_queue(a,b) do {} while(0)
457 #define remove_wait_queue(a,b) do {} while(0)
458
459 #define wmb() __asm__ __volatile__ ("": : :"memory")
460 #define rmb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
461
462 #define in_interrupt() 0
463
464 #define init_completion(x) (x)->done=0
465 #define wait_for_completion(x) my_wait_for_completion(x)
466 void my_wait_for_completion(struct completion*);
467
468 #define IRQ_NONE 0
469 #define IRQ_HANDLED 1
470
471 #define INIT_WORK(a,b,c) (a)->func=b
472
473 #define set_current_state(a) do {} while(0)
474
475 #define might_sleep() do {} while(0)
476 #define daemonize(a) do {} while(0)
477 #define allow_signal(a) do {} while(0)
478 #define wait_event_interruptible(x,y) do {} while(0)
479
480 #define interruptible_sleep_on(a) my_interruptible_sleep_on(a)
481 void my_interruptible_sleep_on(int a);
482
483 #define flush_scheduled_work() do {} while(0)
484 #define refrigerator(x) do {} while(0)
485 #define signal_pending(x) 1 // fall through threads
486 #define complete_and_exit(a,b) return 0
487
488 //#define kill_proc(a,b,c) 0
489 #define kill_proc(a,b,c) my_kill_proc(a, b, c);
490 int my_kill_proc(int pid, int signal, int unk);
491
492 #define yield() do {} while(0)
493 #define cpu_relax() do {} while(0)
494
495 /*------------------------------------------------------------------------*/
496 /* Kernel macros */
497 /*------------------------------------------------------------------------*/
498
499 #define LINUX_VERSION_CODE 0x020572
500 #define UTS_SYSNAME "XBOX"
501 #define UTS_RELEASE "----"
502
503 /* from linux/kernel.h */
504 #define max_t(type,x,y) \
505 ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
506
507 #define min_t(type,x,y) \
508 ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
509
510 #define container_of(ptr, type, member) ({ \
511 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
512 (type *)( (char *)__mptr - offsetof(type,member) );})
513
514 /* from linux/stddef.h */
515
516 #undef offsetof
517 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
518
519 /*------------------------------------------------------------------------*/
520 /* Conversion macros */
521 /*------------------------------------------------------------------------*/
522
523 #define __constant_cpu_to_le32(x) (x)
524 #define cpu_to_le16(x) (x)
525 #define le16_to_cpu(x) (x)
526 #define cpu_to_le32(x) (x)
527 #define cpu_to_le32p(x) (*(__u32*)(x))
528 #define le32_to_cpup(x) (*(__u32*)(x))
529 #define le32_to_cpu(x) ((u32)x)
530 #define le16_to_cpus(x) do {} while (0)
531 #define le16_to_cpup(x) (*(__u16*)(x))
532 #define cpu_to_le16p(x) (*(__u16*)(x))
533
534 /*------------------------------------------------------------------------*/
535 /* Debug output */
536 /*------------------------------------------------------------------------*/
537 #ifdef DEBUG_MODE
538 #define dev_printk(lvl,x,f,arg...) printk(f, ## arg)
539 #define dev_dbg(x,f,arg...) printk(f, ## arg)
540 #define dev_info(x,f,arg...) printk(f,## arg)
541 #define dev_warn(x,f,arg...) printk(f,## arg)
542 #define dev_err(x,f,arg...) printk(f,## arg)
543 #define pr_debug(x,f,arg...) printk(f,## arg)
544 #define usbprintk printk
545 #endif
546
547 #ifndef DEBUG_MODE
548 #define dev_printk(lvl,x,f,arg...) do {} while (0)
549 #define dev_dbg(x,f,arg...) do {} while (0) //printk(f, ## arg)
550 #define dev_info(x,f,arg...) do {} while (0)
551 #define dev_warn(x,f,arg...) do {} while (0)
552 #define dev_err(x,f,arg...) do {} while (0)
553 #define pr_debug(x,f,arg...) do {} while (0)
554 #define usbprintk
555 #endif
556
557
558
559 #define PCI_DEVFN(a,b) 0
560 #define PCI_SLOT(a) 0
561
562 /*------------------------------------------------------------------------*/
563 /* Stuff from kernel */
564 /*------------------------------------------------------------------------*/
565
566 #include "errno.h"
567 #include "bitops.h"
568 //#include "linux/pci_ids.h"
569
570 /*------------------------------------------------------------------------*/
571 /* global variables */
572 /*------------------------------------------------------------------------*/
573
574 #define jiffies my_jiffies
575 extern int my_jiffies;
576 #define current my_current
577 extern struct dummy_process *my_current;
578
579 extern struct list_head interrupt_list;
580
581 /*------------------------------------------------------------------------*/
582 /* Function prototypes */
583 /*------------------------------------------------------------------------*/
584 void STDCALL usb_hcd_pci_remove (struct pci_dev *dev);
585
586 #define my_wait_ms(x) wait_ms(x)
587
588 #define my_udelay(x) wait_ms(x)
589 #define udelay(x) my_udelay(x)
590
591 #define my_mdelay(x) wait_ms(1+x/1000);
592 #define mdelay(x) my_mdelay(x);
593
594 #define pci_find_slot(a,b) my_pci_find_slot(a,b)
595 struct pci_dev *my_pci_find_slot(int a,int b);
596
597 /*------------------------------------------------------------------------*/
598 /* Timer management */
599 /*------------------------------------------------------------------------*/
600
601 #define MAX_TIMERS 20
602 extern struct timer_list *main_timer_list[MAX_TIMERS];
603
604 static void __inline__ init_timer(struct timer_list* t)
605 {
606 INIT_LIST_HEAD(&t->timer_list);
607 t->function=NULL;
608 t->expires=0;
609 }
610
611 static void __inline__ add_timer(struct timer_list* t)
612 {
613 int n;
614 for(n=0;n<MAX_TIMERS;n++)
615 if (main_timer_list[n]==0)
616 {
617 main_timer_list[n]=t;
618 break;
619 }
620 }
621
622 static void __inline__ del_timer(struct timer_list* t)
623 {
624 int n;
625 for(n=0;n<MAX_TIMERS;n++)
626 if (main_timer_list[n]==t)
627 {
628 main_timer_list[n]=0;
629 break;
630 }
631 }
632 static void __inline__ del_timer_sync(struct timer_list* t)
633 {
634 int n;
635 for(n=0;n<MAX_TIMERS;n++)
636 if (main_timer_list[n]==t)
637 {
638 main_timer_list[n]=0;
639 break;
640 }
641
642 }
643 static void __inline__ mod_timer(struct timer_list* t, int ex)
644 {
645 del_timer(t);
646 t->expires=ex;
647 add_timer(t);
648 }
649
650 /*------------------------------------------------------------------------*/
651 /* Device driver and process related stuff */
652 /*------------------------------------------------------------------------*/
653
654 static int __inline__ usb_major_init(void){return 0;}
655 static void __inline__ usb_major_cleanup(void){}
656 static void __inline__ schedule_work(void* p){}
657
658 #define device_initialize(x) my_device_initialize(x)
659 void my_device_initialize(struct device *dev);
660
661 #define get_device(x) my_get_device(x)
662 struct device *my_get_device(struct device *dev);
663
664 #define device_add(x) my_device_add(x)
665 int my_device_add(struct device *dev);
666
667 #define driver_register(x) my_driver_register(x)
668 int my_driver_register(struct device_driver *driver);
669
670 #define device_unregister(a) my_device_unregister(a)
671 int my_device_unregister(struct device *dev);
672
673 #define DEVICE_ATTR(a,b,c,d) int xxx_##a
674 #define device_create_file(a,b) do {} while(0)
675 #define device_remove_file(a,b) do {} while(0)
676
677 #define schedule_timeout(x) my_schedule_timeout(x)
678 int my_schedule_timeout(int x);
679
680 #define wake_up(x) my_wake_up(x)
681 void my_wake_up(void*);
682
683 // cannot be mapped via macro due to collision with urb->complete
684 static void __inline__ complete(struct completion *p)
685 {
686 /* Wake up x->wait */
687 p->done++;
688 wake_up(&p->wait);
689 }
690
691 #define kernel_thread(a,b,c) my_kernel_thread(a,b,c)
692 int my_kernel_thread(int STDCALL (*handler)(void*), void* parm, int flags);
693
694 /*------------------------------------------------------------------------*/
695 /* PCI, simple and inlined... */
696 /*------------------------------------------------------------------------*/
697 #include "pci_hal.c"
698
699 /*------------------------------------------------------------------------*/
700 /* IRQ handling */
701 /*------------------------------------------------------------------------*/
702
703 #define request_irq(a,b,c,d,e) my_request_irq(a,b,c,d,e)
704 int my_request_irq(unsigned int irq,
705 int (*handler)(int, void *, struct pt_regs *),
706 unsigned long mode, const char *desc, void *data);
707
708 #define free_irq(a,b) my_free_irq(a,b)
709 int free_irq(int irq, void* p);
710
711
712
713 struct my_irqs {
714 int (*handler)(int, void *, struct pt_regs *);
715 int irq;
716 void* data;
717 };
718
719 #define MAX_IRQS 8
720
721 // Exported to top level
722
723 void handle_irqs(int irq);
724 void inc_jiffies(int);
725 void init_wrapper(struct pci_dev *pci_dev);
726 void do_all_timers(void);
727
728 #define __KERNEL_DS 0x18
729
730