mmu.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * File : mmu.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. */
  13. #ifndef __MMU_H__
  14. #define __MMU_H__
  15. #include <rtthread.h>
  16. #define CACHE_LINE_SIZE 32
  17. #define DESC_SEC (0x2|(1<<4))
  18. #define CB (3<<2) //cache_on, write_back
  19. #define CNB (2<<2) //cache_on, write_through
  20. #define NCB (1<<2) //cache_off,WR_BUF on
  21. #define NCNB (0<<2) //cache_off,WR_BUF off
  22. #define AP_RW (3<<10) //supervisor=RW, user=RW
  23. #define AP_RO (2<<10) //supervisor=RW, user=RO
  24. #define DOMAIN_FAULT (0x0)
  25. #define DOMAIN_CHK (0x1)
  26. #define DOMAIN_NOTCHK (0x3)
  27. #define DOMAIN0 (0x0<<5)
  28. #define DOMAIN1 (0x1<<5)
  29. #define DOMAIN0_ATTR (DOMAIN_CHK<<0)
  30. #define DOMAIN1_ATTR (DOMAIN_FAULT<<2)
  31. #define RW_CB (AP_RW|DOMAIN0|CB|DESC_SEC) /* Read/Write, cache, write back */
  32. #define RW_CNB (AP_RW|DOMAIN0|CNB|DESC_SEC) /* Read/Write, cache, write through */
  33. #define RW_NCNB (AP_RW|DOMAIN0|NCNB|DESC_SEC) /* Read/Write without cache and write buffer */
  34. #define RW_FAULT (AP_RW|DOMAIN1|NCNB|DESC_SEC) /* Read/Write without cache and write buffer */
  35. struct mem_desc {
  36. rt_uint32_t vaddr_start;
  37. rt_uint32_t vaddr_end;
  38. rt_uint32_t paddr_start;
  39. rt_uint32_t attr;
  40. };
  41. void rt_hw_mmu_init(struct mem_desc *mdesc, rt_uint32_t size);
  42. #endif