Sync usage with man page.
[netbsd-mini2440.git] / sys / compat / ndis / nbcompat.h
blob4981b263a821458675d65603694b70106b125d49
1 #ifndef _NBCOMPAT_H_
2 #define _NBCOMPAT_H_
4 #include <sys/systm.h>
5 #include <sys/module.h>
6 #include <sys/cdefs.h>
7 #include <sys/queue.h>
8 #include <sys/mutex.h>
9 #ifdef _KERNEL
10 #include <sys/device.h>
11 #else
12 typedef struct device *device_t;
13 #endif
15 #define CTLFLAG_RW CTLFLAG_READWRITE
17 #define mtx kmutex
18 #define mtx_init(mtx, desc, type, opts) mutex_init(mtx, MUTEX_DEFAULT, IPL_NONE)
20 #define mtx_lock(mtx) ndis_mtx_ipl = splnet() mutex_enter(mtx)
21 #define mtx_unlock(mtx) splx(ndis_mtx_ipl) mutex_exit(mtx)
24 void mtx_lock(struct mtx *mutex);
25 void mtx_unlock(struct mtx *mutex);
27 #define mtx_destroy(mtx) mutex_destroy(mtx)
29 /* I don't think this is going to work
30 struct sysctl_ctx_entry {
31 struct ctlname *entry;
32 TAILQ_ENTRY(sysctl_ctx_entry) link;
35 TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
38 #define ETHER_ALIGN 2
39 #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF
40 #ifdef PAE
41 #define BUS_SPACE_MAXADDR 0xFFFFFFFFFULL
42 #else
43 #define BUS_SPACE_MAXADDR 0xFFFFFFFF
44 #endif
45 #define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
46 #define I386_BUS_SPACE_MEM 1
48 #define device_get_softc (struct ndis_softc *)
49 #define ticks hardclock_ticks
50 #define p_siglist p_sigctx.ps_siglist
52 #ifndef __DECONST
53 #define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
54 #endif
56 /* 4096 on x86 */
57 #ifndef PAGE_SIZE
58 #define PAGE_SIZE 4096
59 #endif
60 #define I386_BUS_SPACE_IO 0
62 #define device_get_nameunit(dev) device_xname(dev)
64 /* FreeBSD Loadable Kernel Module commands that have NetBSD counterparts */
65 #define MOD_LOAD LKM_E_LOAD
66 #define MOD_UNLOAD LKM_E_UNLOAD
68 /* ethercom/arpcom */
69 #define ac_if ec_if
71 #ifdef __NetBSD__
72 #define MAX_SYSCTL_LEN 256
73 #endif
75 /* Capabilities that interfaces can advertise. */
76 /* TODO: is this the correct mapping? */
77 #define IFCAP_TXCSUM (IFCAP_CSUM_IPv4_Tx|IFCAP_CSUM_TCPv4_Tx|IFCAP_CSUM_UDPv4_Tx|IFCAP_CSUM_TCPv6_Tx|IFCAP_CSUM_UDPv6_Tx)
78 #define IFCAP_RXCSUM (IFCAP_CSUM_IPv4_Rx|IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_UDPv4_Rx|IFCAP_CSUM_TCPv6_Rx|IFCAP_CSUM_UDPv6_Rx)
79 #define CSUM_IP M_CSUM_IPv4 /*(IFCAP_CSUM_IPv4_Rx |IFCAP_CSUM_IPv4_Tx)*/
80 #define CSUM_TCP M_CSUM_TCPv4 /*(IFCAP_CSUM_TCPv4_Rx|IFCAP_CSUM_TCPv4_Tx)*/
81 #define CSUM_UDP M_CSUM_UDPv4 /*(IFCAP_CSUM_UDPv4_Rx|IFCAP_CSUM_UDPv4_Tx)*/
83 typedef vaddr_t vm_offset_t;
84 typedef vsize_t vm_size_t;
85 typedef uint16_t linker_file_t;
87 /* Write our own versions of some FreeBSD functions */
88 struct ndis_resource;
89 #define SYS_RES_IOPORT 0
90 #define SYS_RES_MEMORY 1
91 int bus_release_resource(device_t dev, int type, int rid,
92 struct ndis_resource *r);
93 int device_is_attached(device_t dev);
95 /* This is the same thing as NetBSD's kthread_create1(), except
96 * the stack can be specified.
98 int
99 ndis_kthread_create(void (*func)(void *), void *arg,
100 struct proc **newpp, void *stack, size_t stacksize, const char *name);
102 #endif /* _NBCOMPAT_H_ */