summaryrefslogtreecommitdiffstats
path: root/private/ntos/miniport/trantor/source/port.c
blob: e2246b3c6a0711d4b7e63f46ce3c1bffd9a9079a (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
//----------------------------------------------------------------------
//  File: PORT.C 
//
//  Contains generic port access routines.
//
//  Revisions:
//      01-08-93  KJB   First.
//      03-25-93  JAP   Fixed up typedef and prototype inconsistencies
//
//----------------------------------------------------------------------

#include CARDTXXX_H


//
//  CardPortSet
//
//  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 CardPortSet (PUCHAR baseIoAddress, UCHAR mask)
{
    UCHAR tmp;

    CardPortGet (baseIoAddress,&tmp);
    tmp = tmp | mask;
    CardPortPut (baseIoAddress,tmp);
}


//
//  CardPortClear
//
//  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 CardPortClear (PUCHAR baseIoAddress, UCHAR mask)
{
    UCHAR tmp;

    CardPortGet(baseIoAddress,&tmp);
    tmp = tmp & (0xff ^ mask);
    CardPortPut(baseIoAddress,tmp);
}

//
//  CardPortTest
//
//  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 CardPortTest(PUCHAR baseIoAddress, UCHAR mask)
{
    UCHAR tmp;

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