hardware.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Originates from Samsung's u-boot 1.1.6 port to S3C6400 / SMDK6400
  3. *
  4. * (C) Copyright 2008
  5. * Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (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. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #ifndef _ARCH_HARDWARE_H_
  23. #define _ARCH_HARDWARE_H_
  24. #include <asm/sizes.h>
  25. #ifndef __ASSEMBLY__
  26. #define UData(Data) ((unsigned long) (Data))
  27. #define __REG(x) (*(vu_long *)(x))
  28. #define __REGl(x) (*(vu_long *)(x))
  29. #define __REGw(x) (*(vu_short *)(x))
  30. #define __REGb(x) (*(vu_char *)(x))
  31. #define __REG2(x, y) (*(vu_long *)((x) + (y)))
  32. #else
  33. #define UData(Data) (Data)
  34. #define __REG(x) (x)
  35. #define __REGl(x) (x)
  36. #define __REGw(x) (x)
  37. #define __REGb(x) (x)
  38. #define __REG2(x, y) ((x) + (y))
  39. #endif
  40. #define Fld(Size, Shft) (((Size) << 16) + (Shft))
  41. #define FSize(Field) ((Field) >> 16)
  42. #define FShft(Field) ((Field) & 0x0000FFFF)
  43. #define FMsk(Field) (((UData (1) << FSize (Field)) - 1) << FShft (Field))
  44. #define FAlnMsk(Field) ((UData (1) << FSize (Field)) - 1)
  45. #define F1stBit(Field) (UData (1) << FShft (Field))
  46. #define FClrBit(Data, Bit) (Data = (Data & ~(Bit)))
  47. #define FClrFld(Data, Field) (Data = (Data & ~FMsk(Field)))
  48. #define FInsrt(Value, Field) \
  49. (UData (Value) << FShft (Field))
  50. #define FExtr(Data, Field) \
  51. ((UData (Data) >> FShft (Field)) & FAlnMsk (Field))
  52. #endif /* _ARCH_HARDWARE_H_ */