lwp_mm_area.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2006-2020, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2019-10-28 Jesven first version
  9. */
  10. #ifndef __LWP_MM_AREA_H__
  11. #define __LWP_MM_AREA_H__
  12. #include <string.h>
  13. #include <stdint.h>
  14. #include <lwp_avl.h>
  15. #ifdef ARCH_MM_MMU
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. enum
  20. {
  21. MM_AREA_TYPE_PHY = 0, /* mm_area physical address is IO register or reserved memory no cached*/
  22. MM_AREA_TYPE_PHY_CACHED, /* mm_area physical address is IO register or reserved memory with cached */
  23. MM_AREA_TYPE_SHM, /* mm_area physical address is shared memory */
  24. MM_AREA_TYPE_DATA, /* mm_area physical address is alloced from page manager for data */
  25. MM_AREA_TYPE_TEXT, /* mm_area physical address is alloced from page manager for text */
  26. MM_AREA_TYPE_UNKNOW,
  27. };
  28. struct rt_mm_area_struct
  29. {
  30. size_t addr;
  31. size_t size;
  32. int type;
  33. };
  34. int lwp_map_area_insert(struct lwp_avl_struct **avl_tree, size_t addr, size_t size, int ma_type);
  35. void lwp_map_area_remove(struct lwp_avl_struct **avl_tree, size_t addr);
  36. struct lwp_avl_struct* lwp_map_find(struct lwp_avl_struct* ptree, size_t addr);
  37. struct lwp_avl_struct* lwp_map_find_first(struct lwp_avl_struct* ptree);
  38. size_t lwp_vmem_count(struct lwp_avl_struct *ptree);
  39. #ifdef __cplusplus
  40. }
  41. #endif
  42. #endif
  43. #endif /*__LWP_MM_AREA_H__*/