summaryrefslogtreecommitdiffstats
path: root/private/ntos/miniport/trantor/source/portmem.c
blob: 343f3f12fe364fb90d996bcc811554a92fd76718 (plain) (blame)
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
#ifdef i386
//------------------------------------------------------------------------
//
//  File: PORTMEM.C 
//
//  Contains generic memory mapped port access routines.
//
//  Revisions:
//      01-08-93 KJB First.
//      02-25-93 KJB Renamed routines from CardPort to PortMem.
//
//------------------------------------------------------------------------

#include CARDTXXX_H

//
//  PortMemSet
//
//  This routine sets a mask on a certain port.  It or's the mask with
//  the value currently at the port.  Works only for ports where all bits
//  are readable and writable.
//

VOID PortMemSet (PUCHAR baseIoAddress, UCHAR mask)
{
    UCHAR tmp;

    PortMemGet (baseIoAddress, &tmp);
    tmp = tmp | mask;
    PortMemPut (baseIoAddress, tmp);
}


//
//  PortMemClear
//
//  This routine clears a mask on a certain port.  It and's the inverse with
//  the value currently at the port.  Works only for ports where all bits
//  are readable and writable.
//

VOID PortMemClear (PUCHAR baseIoAddress, UCHAR mask)
{
    UCHAR tmp;

    PortMemGet (baseIoAddress, &tmp);
    tmp = tmp & (0xff ^ mask);
    PortMemPut (baseIoAddress, tmp);
}


//
//  PortMemTest
//
//  This routine clears a mask on a certain port.  It and's the mask with
//  the value currently at the port.  This result is returned.
//

BOOLEAN PortMemTest (PUCHAR baseIoAddress, UCHAR mask)
{
    UCHAR tmp;

    PortMemGet (baseIoAddress, &tmp);
    return (tmp & mask);
}

#endif