hpm_misc.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (c) 2021 HPMicro
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #ifndef HPM_MISC_H
  8. #define HPM_MISC_H
  9. #define ILM_LOCAL_BASE (0x0U)
  10. #define ILM_SIZE_IN_BYTE (0x40000U)
  11. #define DLM_LOCAL_BASE (0x80000U)
  12. #define DLM_SIZE_IN_BYTE (0x40000U)
  13. #define CORE0_ILM_SYSTEM_BASE (0x1040000U)
  14. #define CORE0_DLM_SYSTEM_BASE (0x1060000U)
  15. #define CORE1_ILM_SYSTEM_BASE (0x1180000U)
  16. #define CORE1_DLM_SYSTEM_BASE (0x11C0000U)
  17. #define ADDRESS_IN_ILM(address) \
  18. ((ILM_LOCAL_BASE) <= (address)) && \
  19. ((ILM_LOCAL_BASE + ILM_SIZE_IN_BYTE) > (address))
  20. #define ADDRESS_IN_DLM(address) \
  21. ((DLM_LOCAL_BASE) <= (address)) && \
  22. ((DLM_LOCAL_BASE + DLM_SIZE_IN_BYTE) > (address))
  23. #define ADDRESS_IN_CORE0_DLM_SYSTEM(address) \
  24. ((CORE0_DLM_SYSTEM_BASE) <= (address)) && \
  25. ((CORE0_DLM_SYSTEM_BASE + DLM_SIZE_IN_BYTE) > (address))
  26. #define DLM_TO_SYSTEM(address) \
  27. (CORE0_DLM_SYSTEM_BASE + (address) - (DLM_LOCAL_BASE))
  28. #define ILM_TO_SYSTEM(address) \
  29. (CORE0_ILM_SYSTEM_BASE + (address) - (ILM_LOCAL_BASE))
  30. #define SYSTEM_TO_DLM(address) \
  31. ((address) - CORE0_DLM_SYSTEM_BASE + (DLM_LOCAL_BASE))
  32. #define HPM_CORE0 (0U)
  33. #define HPM_CORE1 (1U)
  34. /* map core local memory(DLM/ILM) to system address */
  35. static inline uint32_t core_local_mem_to_sys_address(uint8_t core_id, uint32_t addr)
  36. {
  37. return addr;
  38. }
  39. /* map system address to core local memory(DLM/ILM) */
  40. static inline uint32_t sys_address_to_core_local_mem(uint8_t core_id, uint32_t addr)
  41. {
  42. return addr;
  43. }
  44. #endif /* HPM_MISC_H */