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 167 168 169 170
|
/*
* 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"
STDCALL void WRAP_EXPORT(WRITE_PORT_ULONG)
(ULONG_PTR port, ULONG value)
{
outl(value, port);
}
STDCALL ULONG WRAP_EXPORT(READ_PORT_ULONG)
(ULONG_PTR port)
{
return inl(port);
}
STDCALL void WRAP_EXPORT(WRITE_PORT_USHORT)
(ULONG_PTR port, USHORT value)
{
outw(value, port);
}
STDCALL USHORT WRAP_EXPORT(READ_PORT_USHORT)
(ULONG_PTR port)
{
return inw(port);
}
STDCALL void WRAP_EXPORT(WRITE_PORT_UCHAR)
(ULONG_PTR port, UCHAR value)
{
outb(value, port);
}
STDCALL UCHAR WRAP_EXPORT(READ_PORT_UCHAR)
(ULONG_PTR port)
{
return inb(port);
}
STDCALL void WRAP_EXPORT(WRITE_PORT_BUFFER_USHORT)
(ULONG_PTR port, USHORT *buf, ULONG count)
{
ULONG i;
for (i = 0 ; i < count ; i++)
outw(buf[i], port);
}
STDCALL void WRAP_EXPORT(READ_PORT_BUFFER_USHORT)
(ULONG_PTR port, USHORT *buf, ULONG count)
{
ULONG i;
for (i = 0 ; i < count; i++)
buf[i] = inw(port);
}
STDCALL void WRAP_EXPORT(WRITE_REGISTER_ULONG)
(void *reg, UINT val)
{
writel(val, reg);
}
STDCALL void WRAP_EXPORT(WRITE_REGISTER_USHORT)
(void *reg, USHORT val)
{
writew(val, reg);
}
STDCALL void WRAP_EXPORT(WRITE_REGISTER_UCHAR)
(void *reg, UCHAR val)
{
writeb(val, reg);
}
STDCALL void WRAP_EXPORT(KeStallExecutionProcessor)
(ULONG usecs)
{
udelay(usecs);
}
_FASTCALL KIRQL WRAP_EXPORT(KfRaiseIrql)
(FASTCALL_DECL_1(KIRQL newirql))
{
KIRQL irql;
TRACEENTER4("irql = %d", newirql);
irql = raise_irql(newirql);
TRACEEXIT4(return irql);
}
_FASTCALL void WRAP_EXPORT(KfLowerIrql)
(FASTCALL_DECL_1(KIRQL oldirql))
{
TRACEENTER4("irql = %d", oldirql);
lower_irql(oldirql);
TRACEEXIT4(return);
}
_FASTCALL KIRQL WRAP_EXPORT(KfAcquireSpinLock)
(FASTCALL_DECL_1(KSPIN_LOCK *lock))
{
KIRQL oldirql;
TRACEENTER4("lock = %p", lock);
oldirql = kspin_lock_irql(lock, DISPATCH_LEVEL);
TRACEEXIT4(return oldirql);
}
_FASTCALL void WRAP_EXPORT(KfReleaseSpinLock)
(FASTCALL_DECL_2(KSPIN_LOCK *lock, KIRQL newirql))
{
TRACEENTER4("lock = %p, irql = %d", lock, newirql);
kspin_unlock_irql(lock, newirql);
TRACEEXIT4(return);
}
_FASTCALL void WRAP_EXPORT(KefAcquireSpinLockAtDpcLevel)
(FASTCALL_DECL_1(KSPIN_LOCK *lock))
{
KIRQL irql;
TRACEENTER4("lock = %p", lock);
#if DEBUG_IRQL
irql = current_irql();
if (irql != DISPATCH_LEVEL)
ERROR("irql %d != DISPATCH_LEVEL", irql);
#endif
kspin_lock(lock);
TRACEEXIT4(return);
}
_FASTCALL void WRAP_EXPORT(KefReleaseSpinLockFromDpcLevel)
(FASTCALL_DECL_1(KSPIN_LOCK *lock))
{
TRACEENTER4("lock = %p", lock);
#ifdef DEBUG_IRQL
if (current_irql() != DISPATCH_LEVEL)
ERROR("irql != DISPATCH_LEVEL");
#endif
kspin_unlock(lock);
TRACEEXIT4(return);
}
#include "hal_exports.h"
|