cx25821-biffuncs.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Driver for the Conexant CX25821 PCIe bridge
  3. *
  4. * Copyright (C) 2009 Conexant Systems Inc.
  5. * Authors <shu.lin@conexant.com>, <hiep.huynh@conexant.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. *
  16. * GNU General Public License for more details.
  17. */
  18. #ifndef _BITFUNCS_H
  19. #define _BITFUNCS_H
  20. #define SetBit(Bit) (1 << Bit)
  21. static inline u8 getBit(u32 sample, u8 index)
  22. {
  23. return (u8) ((sample >> index) & 1);
  24. }
  25. static inline u32 clearBitAtPos(u32 value, u8 bit)
  26. {
  27. return value & ~(1 << bit);
  28. }
  29. static inline u32 setBitAtPos(u32 sample, u8 bit)
  30. {
  31. sample |= (1 << bit);
  32. return sample;
  33. }
  34. #endif