arc_feature_config.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. /* ------------------------------------------
  2. * Copyright (c) 2016, Synopsys, Inc. All rights reserved.
  3. * Redistribution and use in source and binary forms, with or without modification,
  4. * are permitted provided that the following conditions are met:
  5. * 1) Redistributions of source code must retain the above copyright notice, this
  6. * list of conditions and the following disclaimer.
  7. * 2) Redistributions in binary form must reproduce the above copyright notice,
  8. * this list of conditions and the following disclaimer in the documentation and/or
  9. * other materials provided with the distribution.
  10. * 3) Neither the name of the Synopsys, Inc., nor the names of its contributors may
  11. * be used to endorse or promote products derived from this software without
  12. * specific prior written permission.
  13. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  14. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  15. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  16. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  17. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  18. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  19. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  20. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  21. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  22. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. *
  24. * \version 2016.05
  25. * \date 2016-09-08
  26. * \author Huaqi Fang(Huaqi.Fang@synopsys.com)
  27. --------------------------------------------- */
  28. /**
  29. * \file
  30. * \ingroup ARC_HAL_MISC
  31. * \brief header file for arc feature configuration
  32. */
  33. /**
  34. * \addtogroup ARC_HAL_MISC
  35. * @{
  36. */
  37. #ifndef _ARC_FEATURE_CONFIG_H_
  38. #define _ARC_FEATURE_CONFIG_H_
  39. // Enable core_config.h in EMSK OSP
  40. //#ifdef EMBARC_TCF_GENERATED
  41. #include "arc_core_config.h"
  42. //#endif
  43. /** ARC baseline instruction set version number */
  44. #if !defined(_ARCVER)
  45. #if defined(core_config_cir_identity_arcver)
  46. #define _ARCVER core_config_cir_identity_arcver
  47. #else
  48. #define _ARCVER 0x42
  49. #endif
  50. #endif
  51. /** ARC CPU Clock Frequency in Hz unit */
  52. #if !defined(ARC_FEATURE_CPU_CLOCK_FREQ)
  53. #if defined(core_config_clock_speed)
  54. #define ARC_FEATURE_CPU_CLOCK_FREQ (core_config_clock_speed*1000000)
  55. #endif
  56. #endif
  57. /** ARC PC size */
  58. #if !defined(ARC_FEATURE_PC_SIZE)
  59. #if defined(core_config_pc_size)
  60. #define ARC_FEATURE_PC_SIZE core_config_pc_size
  61. #else
  62. #define ARC_FEATURE_PC_SIZE 32
  63. #endif
  64. #endif
  65. /** ARC LPC size */
  66. #if !defined(ARC_FEATURE_LPC_SIZE)
  67. #if defined(core_config_lpc_size)
  68. #define ARC_FEATURE_LPC_SIZE core_config_lpc_size
  69. #else
  70. #define ARC_FEATURE_LPC_SIZE 32
  71. #endif
  72. #endif
  73. /** ARC Addr size */
  74. #if !defined(ARC_FEATURE_ADDR_SIZE)
  75. #if defined(core_config_addr_size)
  76. #define ARC_FEATURE_ADDR_SIZE core_config_addr_size
  77. #else
  78. #define ARC_FEATURE_ADDR_SIZE 32
  79. #endif
  80. #endif
  81. /** ARC Endian/Byte Order */
  82. #define ARC_FEATURE_LITTLE_ENDIAN 1234
  83. #define ARC_FEATURE_BIG_ENDIAN 4321
  84. #if !defined(ARC_FEATURE_BYTE_ORDER)
  85. #if defined(core_config_bcr_isa_config_b)
  86. #if core_config_bcr_isa_config_b == 0
  87. #define ARC_FEATURE_BYTE_ORDER ARC_FEATURE_LITTLE_ENDIAN
  88. #else
  89. #define ARC_FEATURE_BYTE_ORDER ARC_FEATURE_BIG_ENDIAN
  90. #endif
  91. #else
  92. #define ARC_FEATURE_BYTE_ORDER ARC_FEATURE_LITTLE_ENDIAN
  93. #endif
  94. #endif
  95. /** Reduced register option, if enabled, ARC_FEATURE_RF16 will be defined */
  96. #if !defined(ARC_FEATURE_RF16)
  97. #if defined(core_config_bcr_rf_build_e) && core_config_bcr_rf_build_e == 1
  98. #define ARC_FEATURE_RF16
  99. #endif
  100. #endif
  101. /** Unaligned access option, if enabled, ARC_FEATURE_UNALIGNED will be defined */
  102. #if !defined(ARC_FEATURE_UNALIGNED)
  103. #if defined(core_config_unaligned) && core_config_unaligned == 1
  104. #define ARC_FEATURE_UNALIGNED
  105. #endif
  106. #endif
  107. /** Code density option, if enabled, ARC_FEATURE_CODE_DENSITY will be defined */
  108. #if !defined(ARC_FEATURE_CODE_DENSITY)
  109. #if defined(core_config_code_density) && core_config_code_density == 1
  110. #define ARC_FEATURE_CODE_DENSITY
  111. #endif
  112. #endif
  113. /** The number of register file banks */
  114. #if !defined(ARC_FEATURE_RGF_NUM_BANKS)
  115. #if defined(core_config_rgf_num_banks)
  116. #define ARC_FEATURE_RGF_NUM_BANKS core_config_rgf_num_banks
  117. #else
  118. #define ARC_FEATURE_RGF_NUM_BANKS 1
  119. #endif
  120. #endif
  121. /** The number of registers replicated per register bank */
  122. #if !defined(ARC_FEATURE_RGF_BANKED_REGS)
  123. #if defined(core_config_rgf_banked_regs)
  124. #define ARC_FEATURE_RGF_BANKED_REGS core_config_rgf_banked_regs
  125. #endif
  126. #endif
  127. /** Interrupt unit presence */
  128. #if !defined(ARC_FEATURE_INTERRUPTS_PRESENT)
  129. #if defined(core_config_interrupts_present)
  130. #define ARC_FEATURE_INTERRUPTS_PRESENT core_config_interrupts_present
  131. #endif
  132. #endif
  133. /** FIRQ_OPTION configuration option, 1 for enabled, 0 for disabled */
  134. #if !defined(ARC_FEATURE_FIRQ)
  135. #if defined(core_config_bcr_irq_build_f)
  136. #define ARC_FEATURE_FIRQ core_config_bcr_irq_build_f
  137. #else
  138. #define ARC_FEATURE_FIRQ 0
  139. #endif
  140. #endif
  141. /** The number of interrupts */
  142. #if !defined(NUM_EXC_INT)
  143. #if defined(core_config_interrupts_number)
  144. #define NUM_EXC_INT core_config_interrupts_number
  145. #endif
  146. #endif
  147. /** The number of external interrupts */
  148. #if !defined(NUM_EXC_EXT_INT)
  149. #if defined(core_config_interrupts_externals)
  150. #define NUM_EXC_EXT_INT core_config_interrupts_externals
  151. #endif
  152. #endif
  153. /** The interrupt priority levels */
  154. #if !defined(INT_PRI_MIN)
  155. #if defined(core_config_interrupts_priorities)
  156. #define INT_PRI_MIN (-core_config_interrupts_priorities)
  157. #endif
  158. #endif
  159. // ARC TIMER_BUILD
  160. /** Timer0 present or not */
  161. #if !defined(ARC_FEATURE_TIMER0_PRESENT)
  162. #if defined(core_config_timer0)
  163. #define ARC_FEATURE_TIMER0_PRESENT core_config_timer0
  164. #define ARC_FEATURE_TIMER0_LEVEL (core_config_timer0_level-core_config_interrupts_priorities)
  165. #define ARC_FEATURE_TIMER0_VECTOR core_config_timer0_vector
  166. #endif
  167. #endif
  168. /** Timer1 present or not */
  169. #if !defined(ARC_FEATURE_TIMER1_PRESENT)
  170. #if defined(core_config_timer1)
  171. #define ARC_FEATURE_TIMER1_PRESENT core_config_timer1
  172. #define ARC_FEATURE_TIMER1_LEVEL (core_config_timer1_level-core_config_interrupts_priorities)
  173. #define ARC_FEATURE_TIMER1_VECTOR core_config_timer1_vector
  174. #endif
  175. #endif
  176. /** Secure Timer0 present or not */
  177. #if !defined(ARC_FEATURE_SEC_TIMER0_PRESENT)
  178. #if defined(core_config_sec_timer0)
  179. #define ARC_FEATURE_SEC_TIMER0_PRESENT core_config_sec_timer0
  180. #define ARC_FEATURE_SEC_TIMER0_LEVEL (core_config_sec_timer0_level-core_config_interrupts_priorities)
  181. #define ARC_FEATURE_SEC_TIMER0_VECTOR 20
  182. #endif
  183. #endif
  184. /** Secure Timer1 present or not */
  185. #if !defined(ARC_FEATURE_SEC_TIMER1_PRESENT)
  186. #if defined(core_config_sec_timer1)
  187. #define ARC_FEATURE_SEC_TIMER1_PRESENT core_config_sec_timer1
  188. #define ARC_FEATURE_SEC_TIMER1_LEVEL (core_config_sec_timer1_level-core_config_interrupts_priorities)
  189. #define ARC_FEATURE_SEC_TIMER1_VECTOR 21
  190. #endif
  191. #endif
  192. /** 64bit RTC present or not */
  193. #if !defined(ARC_FEATURE_RTC_PRESENT)
  194. #if defined(core_config_rtc)
  195. #define ARC_FEATURE_RTC_PRESENT core_config_rtc
  196. #endif
  197. #endif
  198. // Memory related definitions
  199. /** ICCM Presence, base address and size */
  200. #if !defined(ARC_FEATURE_ICCM_PRESENT)
  201. #if defined(core_config_iccm_present) && core_config_iccm_present == 1
  202. #define ARC_FEATURE_ICCM_PRESENT 1
  203. #define ARC_FEATURE_ICCM_BASE core_config_iccm_base
  204. #define ARC_FEATURE_ICCM_SIZE core_config_iccm_size
  205. #endif
  206. #endif
  207. /** ICCM0 Presence, base address and size */
  208. #if !defined(ARC_FEATURE_ICCM0_PRESENT)
  209. #if defined(core_config_iccm0_present) && core_config_iccm0_present == 1
  210. #define ARC_FEATURE_ICCM0_PRESENT 1
  211. #define ARC_FEATURE_ICCM0_BASE core_config_iccm0_base
  212. #define ARC_FEATURE_ICCM0_SIZE core_config_iccm0_size
  213. #endif
  214. #endif
  215. /** ICCM1 Presence, base address and size */
  216. #if !defined(ARC_FEATURE_ICCM1_PRESENT)
  217. #if defined(core_config_iccm1_present) && core_config_iccm1_present == 1
  218. #define ARC_FEATURE_ICCM1_PRESENT 1
  219. #define ARC_FEATURE_ICCM1_BASE core_config_iccm1_base
  220. #define ARC_FEATURE_ICCM1_SIZE core_config_iccm1_size
  221. #endif
  222. #endif
  223. /** DCCM Presence, base address and size */
  224. #if !defined(ARC_FEATURE_DCCM_PRESENT)
  225. #if defined(core_config_dccm_present) && core_config_dccm_present == 1
  226. #define ARC_FEATURE_DCCM_PRESENT 1
  227. #define ARC_FEATURE_DCCM_BASE core_config_dccm_base
  228. #define ARC_FEATURE_DCCM_SIZE core_config_dccm_size
  229. #ifdef core_config_dccm_interleave
  230. #define ARC_FEATURE_DCCM_INTERLEAVE core_config_dccm_interleave
  231. #endif
  232. #endif
  233. #endif
  234. /** Peripheral memory region(DMP) base address, if dmp configured, this macro will be defined as base address */
  235. #if !defined(ARC_FEATURE_DMP_PERIPHERAL)
  236. #if defined(core_config_cir_dmp_peripheral)
  237. #define ARC_FEATURE_DMP_PERIPHERAL core_config_cir_dmp_peripheral
  238. #endif
  239. #endif
  240. /** MPU options */
  241. #if !defined(ARC_FEATURE_MPU_PRESENT)
  242. #if defined(core_config_mpu_present) && core_config_mpu_present == 1
  243. #define ARC_FEATURE_MPU_PRESENT 1
  244. #define ARC_FEATURE_MPU_VERSION core_config_bcr_mpu_build_version
  245. #define ARC_FEATURE_MPU_REGIONS core_config_mpu_regions
  246. #ifdef core_config_bcr_mpu_build_i
  247. #define ARC_FEATURE_MPU_BUILD_I core_config_bcr_mpu_build_i
  248. #endif
  249. #ifdef core_config_bcr_mpu_build_s
  250. #define ARC_FEATURE_MPU_BUILD_S core_config_bcr_mpu_build_s
  251. #endif
  252. #endif
  253. #endif
  254. /** Secure BCR SEC_BUILD BCR */
  255. #if !defined(ARC_FEATURE_SEC_PRESENT)
  256. #if defined(core_config_bcr_sec_build)
  257. #define ARC_FEATURE_SEC_PRESENT 1
  258. #define ARC_FEATURE_SEC_VERSION core_config_bcr_sec_build_version
  259. #define ARC_FEATURE_SEC_BUILD_DSM core_config_bcr_sec_build_dsm
  260. #define ARC_FEATURE_SEC_BUILD_NSM core_config_bcr_sec_build_nsm
  261. #define ARC_FEATURE_SEC_BUILD_I1SM core_config_bcr_sec_build_i1sm
  262. #define ARC_FEATURE_SEC_BUILD_I0SM core_config_bcr_sec_build_i0sm
  263. #define ARC_FEATURE_SEC_BUILD_S core_config_bcr_sec_build_s
  264. #define ARC_FEATURE_SEC_BUILD_EI core_config_bcr_sec_build_ei
  265. #define ARC_FEATURE_SEC_BUILD_ED core_config_bcr_sec_build_ed
  266. #endif
  267. #endif
  268. #if !defined(ARC_FEATURE_SEC_MODES)
  269. #if defined(core_config_sec_modes)
  270. #define ARC_FEATURE_SEC_MODES core_config_sec_modes
  271. #endif
  272. #endif
  273. /** Data Cache options */
  274. #if !defined(ARC_FEATURE_DCACHE_PRESENT)
  275. #if defined(core_config_dcache_present) && core_config_dcache_present == 1
  276. #define ARC_FEATURE_DCACHE_PRESENT 1
  277. #define ARC_FEATURE_DCACHE_BUILD core_config_bcr_d_cache_build
  278. #define ARC_FEATURE_DCACHE_BUILD_VERSION core_config_bcr_d_cache_build_version
  279. #define ARC_FEATURE_DCACHE_BUILD_ASSOC core_config_bcr_d_cache_build_assoc
  280. #define ARC_FEATURE_DCACHE_BUILD_CAPACITY core_config_bcr_d_cache_build_capacity
  281. #define ARC_FEATURE_DCACHE_BUILD_BSIZE core_config_bcr_d_cache_build_bsize
  282. #define ARC_FEATURE_DCACHE_BUILD_FL core_config_bcr_d_cache_build_fl
  283. #define ARC_FEATURE_DCACHE_BUILD_U core_config_bcr_d_cache_build_u
  284. #define ARC_FEATURE_DCACHE_SIZE core_config_dcache_size
  285. #define ARC_FEATURE_DCACHE_LINE_SIZE core_config_dcache_line_size
  286. #define ARC_FEATURE_DCACHE_WAYS core_config_dcache_ways
  287. #define ARC_FEATURE_DCACHE_FEATURE core_config_dcache_feature
  288. #endif
  289. #endif
  290. /** Instruction Cache options */
  291. #if !defined(ARC_FEATURE_ICACHE_PRESENT)
  292. #if defined(core_config_icache_present) && core_config_icache_present == 1
  293. #define ARC_FEATURE_ICACHE_PRESENT 1
  294. #define ARC_FEATURE_ICACHE_BUILD core_config_bcr_i_cache_build
  295. #define ARC_FEATURE_ICACHE_BUILD_VERSION core_config_bcr_i_cache_build_version
  296. #define ARC_FEATURE_ICACHE_BUILD_ASSOC core_config_bcr_i_cache_build_assoc
  297. #define ARC_FEATURE_ICACHE_BUILD_CAPACITY core_config_bcr_i_cache_build_capacity
  298. #define ARC_FEATURE_ICACHE_BUILD_BSIZE core_config_bcr_i_cache_build_bsize
  299. #define ARC_FEATURE_ICACHE_BUILD_FL core_config_bcr_i_cache_build_fl
  300. #define ARC_FEATURE_ICACHE_BUILD_D core_config_bcr_i_cache_build_d
  301. #define ARC_FEATURE_ICACHE_SIZE core_config_icache_size
  302. #define ARC_FEATURE_ICACHE_LINE_SIZE core_config_icache_line_size
  303. #define ARC_FEATURE_ICACHE_WAYS core_config_icache_ways
  304. #define ARC_FEATURE_ICACHE_FEATURE core_config_icache_feature
  305. #endif
  306. #endif
  307. /** ARC uDMA options */
  308. #if !defined(ARC_FEATURE_DMAC)
  309. #if defined(core_config_dmac)
  310. #define ARC_FEATURE_DMAC core_config_dmac
  311. #define CORE_DMAC_CHANNELS core_config_dmac_channels
  312. #define CORE_DMAC_REGISTERS core_config_dmac_registers
  313. #if core_config_bcr_dmac_build_int_cfg == 2 && core_config_bcr_dmac_build_int_cfg == 4
  314. #define DMA_MULTI_IRQ 1
  315. #else
  316. #define DMA_MULTI_IRQ 0
  317. #endif
  318. #define ARC_FEATURE_DMAC_PRESENT core_config_dmac
  319. #define ARC_FEATURE_DMAC_VERSION core_config_bcr_dmac_build_version
  320. #define ARC_FEATURE_DMAC_CHANNELS core_config_dmac_channels
  321. #define ARC_FEATURE_DMAC_REGISTERS core_config_dmac_registers
  322. #define ARC_FEATURE_DMAC_INT_CFG core_config_bcr_dmac_build_int_cfg
  323. #define ARC_FEATURE_DMAC_FIFO_DEPTH core_config_dmac_fifo_depth
  324. #ifdef ARC_FEATURE_SEC_TIMER0_PRESENT
  325. #define DMA_IRQ_NUM_START 22
  326. #define ARC_FEATURE_DMAC_VECTOR_START 22
  327. #else
  328. #define DMA_IRQ_NUM_START 20
  329. #define ARC_FEATURE_DMAC_VECTOR_START 20
  330. #endif
  331. #endif
  332. #endif
  333. #ifdef __cplusplus
  334. extern "C" {
  335. #endif
  336. #ifdef ARC_FEATURE_UNALIGNED
  337. #define STATUS32_RESET_VALUE (1<<19)
  338. #else
  339. #define STATUS32_RESET_VALUE (0)
  340. #endif
  341. #ifdef __cplusplus
  342. }
  343. #endif
  344. #endif /* _ARC_FEATURE_CONFIG_H_ */
  345. /** @} */