Subversion Repositories shark

Rev

Rev 202 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
#include <kernel/kern.h>
202 pj 2
#include <stdlib.h>
80 pj 3
#include "ll/sys/cdefs.h"
2 pj 4
 
80 pj 5
__BEGIN_DECLS
6
 
2 pj 7
#ifndef __UNIXCOMP__
8
#define __UNIXCOMP__
9
 
202 pj 10
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
11
#define LINUX_VERSION_CODE 0x20209
2 pj 12
 
13
#define SA_NOCLDSTOP    1
14
#define SA_SHIRQ        0x04000000
15
#define SA_STACK        0x08000000
16
#define SA_RESTART      0x10000000
17
#define SA_INTERRUPT    0x20000000
18
#define SA_NOMASK       0x40000000
19
#define SA_ONESHOT      0x80000000
20
 
21
#define PAGE_SIZE 0x400
22
 
23
/* #define USE_SHARED_IRQ */
24
 
25
struct pt_regs {
26
        };              /* This have to be checked...   */
27
 
28
#define __u32 unsigned long int
29
#define u32 unsigned long int
30
#define s32 signed long int
31
//#define u_long unsigned long int
32
#define __u16 unsigned short int
33
#define u16 unsigned short int
34
//#define u_short unsigned short int
35
#define ushort unsigned short int
36
//#define u_char unsigned char
37
#define u8 unsigned char
38
#define __u8 unsigned char
202 pj 39
#define uint8_t unsigned char
40
#define uint16_t unsigned short int
41
#define uint32_t unsigned int
42
#define uint unsigned int
43
#define ulong unsigned long
2 pj 44
 
202 pj 45
#define caddr_t unsigned int
46
 
2 pj 47
#define atomic_t int
48
 
49
#ifndef NULL
50
        #define NULL 0
51
#endif
52
 
53
#define HZ 100                  /* Has to be controlled...      */
218 giacomo 54
#define jiffies (sys_gettime(NULL)*HZ/1000000)          /* Has to be controlled...      */
2 pj 55
extern long unsigned int loops_per_sec; /* ... */
56
#define EISA_bus 0              /* We do not support EISA buses...      */
57
 
58
#define NET_BH 1                /* ???? */
59
 
60
/* Linux Module stub emulation... */
61
#define MOD_INC_USE_COUNT       /* Do nothing... */
62
#define MOD_DEC_USE_COUNT       /* Do nothing... */
63
#define MOD_IN_USE      0       /* No module => never in use... */
218 giacomo 64
#define MODULE_AUTHOR(a)
65
#define MODULE_DESCRIPTION(a)
66
#define MODULE_LICENSE(a)
67
#define MODULE_PARM(a,b)
68
#define MODULE_PARM_DESC(a,b)
2 pj 69
 
70
#define GFP_KERNEL      0x03    /* Don't know what it is... */
71
#define GFP_ATOMIC      0x01    /* Don't know what it is... */
72
 
73
 
74
/*      Linux kernel call emulation     */
75
#define kmalloc(a,b) malloc(a)
19 pj 76
//#define printk cprintf I would like to use the kernel printk if possible...
2 pj 77
#define check_region(a,b) 0
78
#define request_region(a,b,c)
218 giacomo 79
#define release_region(a,b);
202 pj 80
#define release_region(a,b)
2 pj 81
 
82
/* Linux funcs emulation... */
83
#define outb_p(v,p) outp(p,v)
84
#define outb(v,p) outp(p,v)
85
#define outw(v,p) outpw(p,v)
86
#define outl(v,p) outpd(p,v)
87
#define inb_p(p) inp(p)
88
#define inb(p) inp(p)
89
#define inw(p) inpw(p)
90
#define inl(p) inpd(p)
91
 
92
#define mark_bh(NET_BH)                 /* Don't use soft int emulation... */
93
 
94
 
218 giacomo 95
#define __cli() kern_cli()
96
#define __sti() kern_sti()
2 pj 97
#define cli() kern_cli()
98
#define sti() kern_sti()
218 giacomo 99
#define __save_flags(f) f = kern_fsave()
100
#define __restore_flags(f) kern_frestore(f)
2 pj 101
#define save_flags(f) f = kern_fsave()
102
#define restore_flags(f) kern_frestore(f)
103
 
104
 
105
/* URKA Stubs */
106
 
107
extern void panic_stub(void);
108
/* #define eth_header panic_stub */
109
#define eth_rebuild_header panic_stub
110
#define eth_header_cache_bind panic_stub
111
#define eth_header_cache_update panic_stub
112
 
113
 
114
#define atomic_sub(a,b)
115
 
116
 
117
#define vremap(a,b) 0
118
 
119
 
120
extern __inline__ int suser(void)
121
{
122
  return 1;
123
}
124
 
125
 
126
// spinlocks
127
#define spinlock_t DWORD
128
#define spin_lock(x)   (void)(x)
129
#define spin_unlock(x) (void)(x)
130
 
131
#define spin_lock_irqsave(x,y) y = kern_fsave()
132
#define spin_unlock_irqrestore(x,y) kern_frestore(y)
133
#define spin_lock_init(x)
134
#define SPIN_LOCK_UNLOCKED (spinlock_t) 0
218 giacomo 135
#define spin_lock_irq(lock)     kern_cli()
136
#define spin_unlock_irq(lock)     kern_sti()
2 pj 137
 
138
extern __inline__ void panic(const char *c)
139
{
140
  cputs((char *)c);
141
  sys_end();
142
}
143
 
144
/* below tuff added for rtl8139 net driver
145
   at some point this stuff should moved in a more conevenient place.
146
*/
147
 
148
/* *** from linux-2.2.17/include/linux/compatmac.h */  
149
#define capable(x)                   suser()
150
 
218 giacomo 151
#define __devinitdata
152
#define __devinit
153
 
154
struct pci_device_id {
155
        unsigned int vendor, device;            /* Vendor and device ID or PCI_ANY_ID */
156
        unsigned int subvendor, subdevice;      /* Subsystem ID's or PCI_ANY_ID */
157
        unsigned int class, class_mask;         /* (class,subclass,prog-if) triplet */
158
        unsigned long driver_data;              /* Data private to the driver */
159
};
160
#define PCI_ANY_ID (~0)
161
#define MODULE_DEVICE_TABLE(a,b)
162
 
163
#ifdef CONFIG_HIGHMEM
164
typedef u64 dma_addr_t;
165
#else
166
typedef u32 dma_addr_t;
167
#endif
2 pj 168
/* *** from linux-2.2.17/include/linux/capability.h */
169
#define CAP_NET_ADMIN        12
170
 
171
/* *** from linux-2.2.17/include/linux/byteorder/little_endian.h */
172
#define __le16_to_cpu(x) ((__u16)(x))
173
 
174
/* *** from linux-2.2.17/include/linux/byteorder/generic.h */
175
#define le16_to_cpu __le16_to_cpu
176
 
202 pj 177
// Module.h stuffs
178
#define MODULE_AUTHOR(name)
179
#define MODULE_DESCRIPTION(desc)
180
#define MODULE_SUPPORTED_DEVICE(name)
181
#define MODULE_PARM(var,type)
182
#define MODULE_PARM_DESC(var,desc)
183
 
80 pj 184
__END_DECLS
2 pj 185
#endif