1b285192aSMauro Carvalho Chehab /*
2b285192aSMauro Carvalho Chehab  *  Driver for the Conexant CX25821 PCIe bridge
3b285192aSMauro Carvalho Chehab  *
4b285192aSMauro Carvalho Chehab  *  Copyright (C) 2009 Conexant Systems Inc.
5b285192aSMauro Carvalho Chehab  *  Authors  <shu.lin@conexant.com>, <hiep.huynh@conexant.com>
6b285192aSMauro Carvalho Chehab  *
7b285192aSMauro Carvalho Chehab  *  This program is free software; you can redistribute it and/or modify
8b285192aSMauro Carvalho Chehab  *  it under the terms of the GNU General Public License as published by
9b285192aSMauro Carvalho Chehab  *  the Free Software Foundation; either version 2 of the License, or
10b285192aSMauro Carvalho Chehab  *  (at your option) any later version.
11b285192aSMauro Carvalho Chehab  *
12b285192aSMauro Carvalho Chehab  *  This program is distributed in the hope that it will be useful,
13b285192aSMauro Carvalho Chehab  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14b285192aSMauro Carvalho Chehab  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15b285192aSMauro Carvalho Chehab  *
16b285192aSMauro Carvalho Chehab  *  GNU General Public License for more details.
17b285192aSMauro Carvalho Chehab  *
18b285192aSMauro Carvalho Chehab  *  You should have received a copy of the GNU General Public License
19b285192aSMauro Carvalho Chehab  *  along with this program; if not, write to the Free Software
20b285192aSMauro Carvalho Chehab  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21b285192aSMauro Carvalho Chehab  */
22b285192aSMauro Carvalho Chehab 
23b285192aSMauro Carvalho Chehab #ifndef _BITFUNCS_H
24b285192aSMauro Carvalho Chehab #define _BITFUNCS_H
25b285192aSMauro Carvalho Chehab 
26b285192aSMauro Carvalho Chehab #define SetBit(Bit)  (1 << Bit)
27b285192aSMauro Carvalho Chehab 
28b285192aSMauro Carvalho Chehab inline u8 getBit(u32 sample, u8 index)
29b285192aSMauro Carvalho Chehab {
30b285192aSMauro Carvalho Chehab 	return (u8) ((sample >> index) & 1);
31b285192aSMauro Carvalho Chehab }
32b285192aSMauro Carvalho Chehab 
33b285192aSMauro Carvalho Chehab inline u32 clearBitAtPos(u32 value, u8 bit)
34b285192aSMauro Carvalho Chehab {
35b285192aSMauro Carvalho Chehab 	return value & ~(1 << bit);
36b285192aSMauro Carvalho Chehab }
37b285192aSMauro Carvalho Chehab 
38b285192aSMauro Carvalho Chehab inline u32 setBitAtPos(u32 sample, u8 bit)
39b285192aSMauro Carvalho Chehab {
40b285192aSMauro Carvalho Chehab 	sample |= (1 << bit);
41b285192aSMauro Carvalho Chehab 	return sample;
42b285192aSMauro Carvalho Chehab 
43b285192aSMauro Carvalho Chehab }
44b285192aSMauro Carvalho Chehab 
45b285192aSMauro Carvalho Chehab #endif
46