addrspace.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Defitions for the address spaces of the AVR32 CPUs. Heavily based on
  3. * include/asm-sh/addrspace.h
  4. *
  5. * Copyright (C) 2004-2006 Atmel Corporation
  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 version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef __ASM_AVR32_ADDRSPACE_H
  12. #define __ASM_AVR32_ADDRSPACE_H
  13. #ifdef CONFIG_MMU
  14. /* Memory segments when segmentation is enabled */
  15. #define P0SEG 0x00000000
  16. #define P1SEG 0x80000000
  17. #define P2SEG 0xa0000000
  18. #define P3SEG 0xc0000000
  19. #define P4SEG 0xe0000000
  20. /* Returns the privileged segment base of a given address */
  21. #define PXSEG(a) (((unsigned long)(a)) & 0xe0000000)
  22. /* Returns the physical address of a PnSEG (n=1,2) address */
  23. #define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff)
  24. /*
  25. * Map an address to a certain privileged segment
  26. */
  27. #define P1SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \
  28. | P1SEG))
  29. #define P2SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \
  30. | P2SEG))
  31. #define P3SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \
  32. | P3SEG))
  33. #define P4SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) \
  34. | P4SEG))
  35. #endif /* CONFIG_MMU */
  36. #endif /* __ASM_AVR32_ADDRSPACE_H */