openamp_conf.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /**
  2. ******************************************************************************
  3. * @file openamp_conf.h
  4. * @author MCD Application Team
  5. * @brief Configuration file for OpenAMP MW
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef __OPENAMP_CONF__H__
  21. #define __OPENAMP_CONF__H__
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #if defined (__LOG_TRACE_IO_) || defined(__LOG_UART_IO_)
  27. #include "openamp_log.h"
  28. #endif
  29. /* ########################## Mailbox Interface Selection ############################## */
  30. /**
  31. * @brief This is the list of Mailbox interface to be used in the OpenAMP MW
  32. * Please note that not all interfaces are supported by a STM32 device
  33. */
  34. #define MAILBOX_IPCC_IF_ENABLED
  35. //#define MAILBOX_HSEM_IF_ENABLED
  36. /* Includes ------------------------------------------------------------------*/
  37. /**
  38. * @brief Include Maibox interface header file
  39. */
  40. #ifdef MAILBOX_IPCC_IF_ENABLED
  41. #include "mbox_ipcc.h"
  42. #endif /* MAILBOX_IPCC_IF_ENABLED */
  43. #ifdef MAILBOX_HSEM_IF_ENABLED
  44. #include "mbox_hsem.h"
  45. #endif /* MAILBOX_HSEM_IF_ENABLED */
  46. /* ########################## Virtual Diver Module Selection ############################## */
  47. /**
  48. * @brief This is the list of modules to be used in the OpenAMP Virtual driver module
  49. * Please note that virtual driver are not supported on all stm32 families
  50. */
  51. //#define VIRTUAL_UART_MODULE_ENABLED
  52. //#define VIRTUAL_I2C_MODULE_ENABLED
  53. /* Includes ------------------------------------------------------------------*/
  54. /**
  55. * @brief Include Virtual Driver module's header file
  56. */
  57. #ifdef VIRTUAL_UART_MODULE_ENABLED
  58. #include "virt_uart.h"
  59. #endif /* VIRTUAL_UART_MODULE_ENABLED */
  60. #ifdef VIRTUAL_I2C_MODULE_ENABLED
  61. #include "virt_i2c.h"
  62. #endif /* VIRTUAL_I2C_MODULE_ENABLED */
  63. /* ########################## Linux Master Selection ############################## */
  64. /**
  65. * @brief Due to Linux compatibility, it's important to distinguish if the MASTER is Linux or not.
  66. * In that case, the LINUX_RPROC_MASTER define is required
  67. */
  68. #define LINUX_RPROC_MASTER
  69. /* USER CODE BEGIN INCLUDE */
  70. /* USER CODE END INCLUDE */
  71. /** @addtogroup OPENAMP_MW
  72. * @{
  73. */
  74. /** @defgroup OPENAMP_CONF OPENAMP_CONF
  75. * @brief Configuration file for Openamp mw
  76. * @{
  77. */
  78. /** @defgroup OPENAMP_CONF_Exported_Variables OPENAMP_CONF_Exported_Variables
  79. * @brief Public variables.
  80. * @{
  81. */
  82. /**
  83. * @}
  84. */
  85. /** @defgroup OPENAMP_CONF_Exported_Defines OPENAMP_CONF_Exported_Defines
  86. * @brief Defines for configuration of the Openamp mw
  87. * @{
  88. */
  89. #if defined (__ICCARM__)
  90. /*
  91. * For IAR, the .icf file should contain the following lines:
  92. * define symbol __OPENAMP_region_start__ = BASE_ADDRESS; (0x38000400 for example)
  93. * define symbol __OPENAMP_region_size__ = MEM_SIZE; (0xB000 as example)
  94. *
  95. * export symbol __OPENAMP_region_start__;
  96. * export symbol __OPENAMP_region_size__;
  97. */
  98. extern const uint32_t __OPENAMP_region_start__;
  99. extern const uint8_t __OPENAMP_region_size__;
  100. #define SHM_START_ADDRESS ((metal_phys_addr_t)&__OPENAMP_region_start__)
  101. #define SHM_SIZE ((size_t)&__OPENAMP_region_size__)
  102. #elif defined(__CC_ARM)
  103. /*
  104. * For MDK-ARM, the scatter file .sct should contain the following line:
  105. * LR_IROM1 .... {
  106. * ...
  107. * __OpenAMP_SHMEM__ 0x38000400 EMPTY 0x0000B000 {} ; Shared Memory area used by OpenAMP
  108. * }
  109. *
  110. */
  111. extern unsigned int Image$$__OpenAMP_SHMEM__$$Base;
  112. extern unsigned int Image$$__OpenAMP_SHMEM__$$ZI$$Length;
  113. #define SHM_START_ADDRESS (unsigned int)&Image$$__OpenAMP_SHMEM__$$Base
  114. #define SHM_SIZE ((size_t)&Image$$__OpenAMP_SHMEM__$$ZI$$Length)
  115. #else
  116. /*
  117. * for GCC add the following content to the .ld file:
  118. * MEMORY
  119. * {
  120. * ...
  121. * OPEN_AMP_SHMEM (xrw) : ORIGIN = 0x38000400, LENGTH = 63K
  122. * }
  123. * __OPENAMP_region_start__ = ORIGIN(OPEN_AMP_SHMEM);
  124. * __OPENAMP_region_end__ = ORIGIN(OPEN_AMP_SHMEM) + LENGTH(OPEN_AMP_SHMEM);
  125. *
  126. * using the LENGTH(OPEN_AMP_SHMEM) to set the SHM_SIZE lead to a crash thus we
  127. * use the start and end address.
  128. */
  129. extern int __OPENAMP_region_start__[]; /* defined by linker script */
  130. extern int __OPENAMP_region_end__[]; /* defined by linker script */
  131. #define SHM_START_ADDRESS ((metal_phys_addr_t)__OPENAMP_region_start__)
  132. #define SHM_SIZE (size_t)((void *)__OPENAMP_region_end__ - (void *) __OPENAMP_region_start__)
  133. #endif
  134. #if defined LINUX_RPROC_MASTER
  135. #define VRING_RX_ADDRESS -1 /* allocated by Master processor: CA7 */
  136. #define VRING_TX_ADDRESS -1 /* allocated by Master processor: CA7 */
  137. #define VRING_BUFF_ADDRESS -1 /* allocated by Master processor: CA7 */
  138. #define VRING_ALIGNMENT 16 /* fixed to match with linux constraint */
  139. #define VRING_NUM_BUFFS 16 /* number of rpmsg buffer */
  140. #else
  141. #define VRING_RX_ADDRESS 0x10040000 /* allocated by Master processor: CA7 */
  142. #define VRING_TX_ADDRESS 0x10040400 /* allocated by Master processor: CA7 */
  143. #define VRING_BUFF_ADDRESS 0x10040800 /* allocated by Master processor: CA7 */
  144. #define VRING_ALIGNMENT 16 /* fixed to match with 4k page alignement requested by linux */
  145. #define VRING_NUM_BUFFS 16 /* number of rpmsg buffer */
  146. #endif
  147. /* Fixed parameter */
  148. #define NUM_RESOURCE_ENTRIES 2
  149. #define VRING_COUNT 2
  150. #define VDEV_ID 0xFF
  151. #define VRING0_ID 0 /* VRING0 ID (master to remote) fixed to 0 for linux compatibility*/
  152. #define VRING1_ID 1 /* VRING1 ID (remote to master) fixed to 1 for linux compatibility */
  153. /**
  154. * @}
  155. */
  156. /** @defgroup OPENAMP_CONF_Exported_Macros OPENAMP_CONF_Exported_Macros
  157. * @brief Aliases.
  158. * @{
  159. */
  160. /* DEBUG macros */
  161. #if defined (__LOG_TRACE_IO_) || defined(__LOG_UART_IO_)
  162. #define OPENAMP_log_dbg log_dbg
  163. #define OPENAMP_log_info log_info
  164. #define OPENAMP_log_warn log_warn
  165. #define OPENAMP_log_err log_err
  166. #else
  167. #define OPENAMP_log_dbg(...)
  168. #define OPENAMP_log_info(...)
  169. #define OPENAMP_log_warn(...)
  170. #define OPENAMP_log_err(...)
  171. #endif
  172. /**
  173. * @}
  174. */
  175. /** @defgroup OPENAMP_CONF_Exported_Types OPENAMP_CONF_Exported_Types
  176. * @brief Types.
  177. * @{
  178. */
  179. /**
  180. * @}
  181. */
  182. /** @defgroup OPENAMP_CONF_Exported_FunctionsPrototype OPENAMP_CONF_Exported_FunctionsPrototype
  183. * @brief Declaration of public functions for OpenAMP mw.
  184. * @{
  185. */
  186. /* Exported functions -------------------------------------------------------*/
  187. /**
  188. * @}
  189. */
  190. /**
  191. * @}
  192. */
  193. /**
  194. * @}
  195. */
  196. #ifdef __cplusplus
  197. }
  198. #endif
  199. #endif /* __OPENAMP_CONF__H__ */
  200. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/