hw_reg_access.h 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * hw_reg_access.h.h
  3. */
  4. /* (c) Texas Instruments 2009-2013, All rights reserved. */
  5. #ifndef _HW_REG_ACCESS_H_
  6. #define _HW_REG_ACCESS_H_
  7. /*******************************************************************************
  8. *
  9. * Macros for hardware access, both direct and via the bit-band region.
  10. *
  11. *****************************************************************************/
  12. #define HWREG(x) \
  13. (*((volatile uint32 *)(x)))
  14. #define HWREGH(x) \
  15. (*((volatile uint16 *)(x)))
  16. #define HWREGB(x) \
  17. (*((volatile uint8 *)(x)))
  18. #define HWREGBITW(x, b) \
  19. HWREG(((uint32)(x) & 0xF0000000U) | 0x02000000U | \
  20. (((uint32)(x) & 0x000FFFFFU) << 5U) | ((b) << 2U))
  21. #define HWREGBITH(x, b) \
  22. HWREGH(((uint32)(x) & 0xF0000000U) | 0x02000000U | \
  23. (((uint32)(x) & 0x000FFFFFU) << 5U) | ((b) << 2U))
  24. #define HWREGBITB(x, b) \
  25. HWREGB(((uint32)(x) & 0xF0000000U) | 0x02000000U | \
  26. (((uint32)(x) & 0x000FFFFFU) << 5U) | ((b) << 2U))
  27. #endif /* __HW_TYPES_H__ */