rpmsg_platform.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright 2022-2023 NXP
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef RPMSG_PLATFORM_H_
  7. #define RPMSG_PLATFORM_H_
  8. #include <stdint.h>
  9. /* RPMSG channel index */
  10. #define RPMSG_MBOX_CHANNEL (0)
  11. /*
  12. * Linux requires the ALIGN to 0x1000(4KB) instead of 0x80
  13. */
  14. #ifndef VRING_ALIGN
  15. #define VRING_ALIGN (0x1000U)
  16. #endif
  17. /* contains pool of descriptors and two circular buffers */
  18. #ifndef VRING_SIZE
  19. #define VRING_SIZE (0x8000UL)
  20. #endif
  21. /* define shared memory space for VRINGS per one channel */
  22. #define RL_VRING_OVERHEAD (2UL * VRING_SIZE)
  23. #define RL_GET_VQ_ID(link_id, queue_id) (((queue_id)&0x1U) | (((link_id) << 1U) & 0xFFFFFFFEU))
  24. #define RL_GET_LINK_ID(id) (((id)&0xFFFFFFFEU) >> 1U)
  25. #define RL_GET_Q_ID(id) ((id)&0x1U)
  26. #define RL_PLATFORM_USER_LINK_ID (0U)
  27. #define RL_PLATFORM_HIGHEST_LINK_ID (15U)
  28. /* platform interrupt related functions */
  29. int32_t platform_init_interrupt(uint32_t vector_id, void *isr_data);
  30. int32_t platform_deinit_interrupt(uint32_t vector_id);
  31. int32_t platform_interrupt_enable(uint32_t vector_id);
  32. int32_t platform_interrupt_disable(uint32_t vector_id);
  33. void platform_notify(uint32_t vector_id);
  34. /* platform low-level time-delay (busy loop) */
  35. void platform_time_delay(uint32_t num_msec);
  36. /* platform memory functions */
  37. void platform_map_mem_region(uint32_t vrt_addr, uint32_t phy_addr, uint32_t size, uint32_t flags);
  38. void platform_cache_all_flush_invalidate(void);
  39. void platform_cache_disable(void);
  40. uintptr_t platform_vatopa(void *addr);
  41. void *platform_patova(uintptr_t addr);
  42. /* platform init/deinit */
  43. int32_t platform_init(void);
  44. int32_t platform_deinit(void);
  45. void gen_sw_mbox_handler(void *data);
  46. #endif /* RPMSG_PLATFORM_H_ */