mrfioc2  2.3.0
mrfBitOps.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2010 Brookhaven Science Associates, as Operator of
3 * Brookhaven National Laboratory.
4 * mrfioc2 is distributed subject to a Software License Agreement found
5 * in file LICENSE that is included with this distribution.
6 \*************************************************************************/
7 /*
8  * Author: Michael Davidsaver <mdavidsaver@gmail.com>
9  */
10 
11 #ifndef MRFBITOPS_H
12 #define MRFBITOPS_H
13 
14 /*
15  * I/O bit operations
16  */
17 
18 /*
19  * ex. BITSET(BE,16,base,REGA,0x10)
20  */
21 #define BITSET(ord,len,base,offset,mask) \
22  ord ## _WRITE ## len(base,offset, (ord ## _READ ## len(base,offset) | (epicsUInt ## len)(mask)))
23 /*
24  * ex. BITCLR(LE,32,base,REGB,0x80000)
25  */
26 #define BITCLR(ord,len,base,offset,mask) \
27  ord ## _WRITE ## len(base,offset, (ord ## _READ ## len(base,offset) & (epicsUInt ## len)~(mask)))
28 
29 /*
30  * ex. BITFLIP(BE,16,base,REGA,0x10)
31  */
32 #define BITFLIP(ord,len,base,offset,mask) \
33  ord ## _WRITE ## len(base,offset, (ord ## _READ ## len(base,offset) ^ (epicsUInt ## len)(mask)))
34 
35 #endif /* MRFBITOPS_H */