File: hal.c

package info (click to toggle)
ndiswrapper 1.28-1%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 956 kB
  • ctags: 5,764
  • sloc: ansic: 21,342; perl: 743; makefile: 384; asm: 159; sh: 134
file content (166 lines) | stat: -rw-r--r-- 3,247 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*
 *  Copyright (C) 2003-2005 Pontus Fuchs, Giridhar Pemmasani
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 */

#include <linux/version.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/wireless.h>
#include <linux/delay.h>
#include <linux/usb.h>

#include "ntoskernel.h"

wstdcall void WIN_FUNC(WRITE_PORT_ULONG,2)
	(ULONG_PTR port, ULONG value)
{
	outl(value, port);
}

wstdcall ULONG WIN_FUNC(READ_PORT_ULONG,1)
	(ULONG_PTR port)
{
	return inl(port);
}

wstdcall void WIN_FUNC(WRITE_PORT_USHORT,2)
	(ULONG_PTR port, USHORT value)
{
	outw(value, port);
}

wstdcall USHORT WIN_FUNC(READ_PORT_USHORT,1)
	(ULONG_PTR port)
{
	return inw(port);
}

wstdcall void WIN_FUNC(WRITE_PORT_UCHAR,2)
	(ULONG_PTR port, UCHAR value)
{
	outb(value, port);
}

wstdcall UCHAR WIN_FUNC(READ_PORT_UCHAR,1)
	(ULONG_PTR port)
{
	return inb(port);
}

wstdcall void WIN_FUNC(WRITE_PORT_BUFFER_USHORT,3)
	(ULONG_PTR port, USHORT *buf, ULONG count)
{
	outsw(port, buf, count);
}

wstdcall void WIN_FUNC(READ_PORT_BUFFER_USHORT,3)
	(ULONG_PTR port, USHORT *buf, ULONG count)
{
	insw(port, buf, count);
}

wstdcall void WIN_FUNC(WRITE_PORT_BUFFER_ULONG,3)
	(ULONG_PTR port, ULONG *buf, ULONG count)
{
	outsl(port, buf, count);
}

wstdcall void WIN_FUNC(READ_PORT_BUFFER_ULONG,3)
	(ULONG_PTR port, ULONG *buf, ULONG count)
{
	insl(port, buf, count);
}

wstdcall USHORT WIN_FUNC(READ_REGISTER_USHORT,1)
	(void *reg)
{
	return readw(reg);
}

wstdcall void WIN_FUNC(WRITE_REGISTER_ULONG,2)
	(void *reg, UINT val)
{
	writel(val, reg);
}

wstdcall void WIN_FUNC(WRITE_REGISTER_USHORT,2)
	(void *reg, USHORT val)
{
	writew(val, reg);
}

wstdcall void WIN_FUNC(WRITE_REGISTER_UCHAR,2)
	(void *reg, UCHAR val)
{
	writeb(val, reg);
}

wstdcall void WIN_FUNC(KeStallExecutionProcessor,1)
	(ULONG usecs)
{
	udelay(usecs);
}

wstdcall KIRQL WIN_FUNC(KeGetCurrentIrql,0)
	(void)
{
	return current_irql();
}

wfastcall KIRQL WIN_FUNC(KfRaiseIrql,1)
	(KIRQL newirql)
{
	return raise_irql(newirql);
}

wfastcall void WIN_FUNC(KfLowerIrql,1)
	(KIRQL oldirql)
{
	lower_irql(oldirql);
}

wfastcall KIRQL WIN_FUNC(KfAcquireSpinLock,1)
	(NT_SPIN_LOCK *lock)
{
	return nt_spin_lock_irql(lock, DISPATCH_LEVEL);
}

wfastcall void WIN_FUNC(KfReleaseSpinLock,2)
	(NT_SPIN_LOCK *lock, KIRQL oldirql)
{
	nt_spin_unlock_irql(lock, oldirql);
}

wfastcall void WIN_FUNC(KefAcquireSpinLockAtDpcLevel,1)
	(NT_SPIN_LOCK *lock)
{
#ifdef DEBUG_IRQL
	if (current_irql() != DISPATCH_LEVEL)
		ERROR("irql != DISPATCH_LEVEL");
#endif
	nt_spin_lock(lock);
}

wfastcall void WIN_FUNC(KefReleaseSpinLockFromDpcLevel,1)
	(NT_SPIN_LOCK *lock)
{
#ifdef DEBUG_IRQL
	if (current_irql() != DISPATCH_LEVEL)
		ERROR("irql != DISPATCH_LEVEL");
#endif
	nt_spin_unlock(lock);
}

#include "hal_exports.h"