iomacros.h 875 B

12345678910111213141516171819202122232425
  1. /*
  2. * DESCRIPTION for iomacros.h
  3. * Read/Write macros for memory mapped I/O
  4. */
  5. #ifndef _IOMACROS_H
  6. #define _IOMACROS_H
  7. #include "type.h"
  8. /****************************************************************************
  9. Constants Definitions
  10. ****************************************************************************/
  11. #define IO_READ8(p) (Uint8)(*(volatile Uint8 *)(p))
  12. #define IO_WRITE8(p,c) (*((volatile Uint8 *)(p)) = ((Uint8)(c)))
  13. #define IO_READ16(p) (Uint16)(*(volatile Uint16 *)(p))
  14. #define IO_WRITE16(p,v) (*((volatile Uint16 *)(p)) = (Uint16)(v))
  15. #define IO_READ32(p) (Uint32)(*(volatile Uint32 *)(p))
  16. #define IO_WRITE32(p,v) (*((volatile Uint32 *)(p)) = (Uint32)(v))
  17. //bit operation
  18. #define BSET32(reg, bit) ((reg) |= (bit))
  19. #define BCLR32(reg, bit) ((reg) &= ~(bit))
  20. #endif