blob: 497cfe5afc7eeef3f5626b2f2e4624ce5fd0d466 (
plain)
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
|
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
hw.cpp
Abstract:
This module contains the functions for accessing
the hardware registers.
Environment:
kernel-mode only
Revision History:
--*/
#include "internal.h"
#include "hw.tmh"
ULONG
HWREG<ULONG>::Read(
VOID
)
{
volatile ULONG *addr = &m_Value;
ULONG v = READ_REGISTER_ULONG((PULONG)addr);
return v;
}
ULONG
HWREG<ULONG>::Write(
_In_ ULONG Value
)
{
volatile ULONG *addr = &m_Value;
WRITE_REGISTER_ULONG((PULONG)addr, Value);
return Value;
}
USHORT
HWREG<USHORT>::Read(
VOID
)
{
volatile USHORT *addr = &m_Value;
USHORT v = READ_REGISTER_USHORT((PUSHORT)addr);
return v;
}
USHORT
HWREG<USHORT>::Write(
_In_ USHORT Value
)
{
volatile USHORT *addr = &m_Value;
WRITE_REGISTER_USHORT((PUSHORT)addr, Value);
return Value;
}
UCHAR
HWREG<UCHAR>::Read(
VOID
)
{
volatile UCHAR *addr = &m_Value;
UCHAR v = READ_REGISTER_UCHAR((PUCHAR)addr);
return v;
}
UCHAR
HWREG<UCHAR>::Write(
_In_ UCHAR Value
)
{
volatile UCHAR *addr = &m_Value;
WRITE_REGISTER_UCHAR((PUCHAR)addr, Value);
return Value;
}
|