You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

212 line
12 KiB

  1. /*
  2. *********************************************************************************************************
  3. * uC/CPU
  4. * CPU CONFIGURATION & PORT LAYER
  5. *
  6. * Copyright 2004-2021 Silicon Laboratories Inc. www.silabs.com
  7. *
  8. * SPDX-License-Identifier: APACHE-2.0
  9. *
  10. * This software is subject to an open source license and is distributed by
  11. * Silicon Laboratories Inc. pursuant to the terms of the Apache License,
  12. * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0.
  13. *
  14. *********************************************************************************************************
  15. */
  16. /*
  17. *********************************************************************************************************
  18. *
  19. * CPU CONFIGURATION DEFINES
  20. *
  21. * Filename : cpu_def.h
  22. * Version : V1.32.01
  23. *********************************************************************************************************
  24. */
  25. /*
  26. *********************************************************************************************************
  27. * MODULE
  28. *
  29. * Note(s) : (1) This CPU definition header file is protected from multiple pre-processor inclusion
  30. * through use of the CPU definition module present pre-processor macro definition.
  31. *********************************************************************************************************
  32. */
  33. #ifndef CPU_DEF_MODULE_PRESENT
  34. #define CPU_DEF_MODULE_PRESENT
  35. /*
  36. *********************************************************************************************************
  37. * CORE CPU MODULE VERSION NUMBER
  38. *
  39. * Note(s) : (1) (a) The core CPU module software version is denoted as follows :
  40. *
  41. * Vx.yy.zz
  42. *
  43. * where
  44. * V denotes 'Version' label
  45. * x denotes major software version revision number
  46. * yy denotes minor software version revision number
  47. * zz denotes sub-minor software version revision number
  48. *
  49. * (b) The software version label #define is formatted as follows :
  50. *
  51. * ver = x.yyzz * 100 * 100
  52. *
  53. * where
  54. * ver denotes software version number scaled as an integer value
  55. * x.yyzz denotes software version number, where the unscaled integer
  56. * portion denotes the major version number & the unscaled
  57. * fractional portion denotes the (concatenated) minor
  58. * version numbers
  59. *********************************************************************************************************
  60. */
  61. #define CPU_CORE_VERSION 13201u /* See Note #1. */
  62. /*
  63. *********************************************************************************************************
  64. * CPU WORD CONFIGURATION
  65. *
  66. * Note(s) : (1) Configure CPU_CFG_ADDR_SIZE & CPU_CFG_DATA_SIZE in 'cpu.h' with CPU's word sizes :
  67. *
  68. * CPU_WORD_SIZE_08 8-bit word size
  69. * CPU_WORD_SIZE_16 16-bit word size
  70. * CPU_WORD_SIZE_32 32-bit word size
  71. * CPU_WORD_SIZE_64 64-bit word size
  72. *
  73. * (2) Configure CPU_CFG_ENDIAN_TYPE in 'cpu.h' with CPU's data-word-memory order :
  74. *
  75. * (a) CPU_ENDIAN_TYPE_BIG Big- endian word order (CPU words' most significant
  76. * octet @ lowest memory address)
  77. * (b) CPU_ENDIAN_TYPE_LITTLE Little-endian word order (CPU words' least significant
  78. * octet @ lowest memory address)
  79. *********************************************************************************************************
  80. */
  81. /* ---------------------- CPU WORD SIZE ----------------------- */
  82. #define CPU_WORD_SIZE_08 1u /* 8-bit word size (in octets). */
  83. #define CPU_WORD_SIZE_16 2u /* 16-bit word size (in octets). */
  84. #define CPU_WORD_SIZE_32 4u /* 32-bit word size (in octets). */
  85. #define CPU_WORD_SIZE_64 8u /* 64-bit word size (in octets). */
  86. /* ------------------ CPU WORD-ENDIAN ORDER ------------------- */
  87. #define CPU_ENDIAN_TYPE_NONE 0u
  88. #define CPU_ENDIAN_TYPE_BIG 1u /* Big- endian word order (see Note #1a). */
  89. #define CPU_ENDIAN_TYPE_LITTLE 2u /* Little-endian word order (see Note #1b). */
  90. /*
  91. *********************************************************************************************************
  92. * CPU STACK CONFIGURATION
  93. *
  94. * Note(s) : (1) Configure CPU_CFG_STK_GROWTH in 'cpu.h' with CPU's stack growth order :
  95. *
  96. * (a) CPU_STK_GROWTH_LO_TO_HI CPU stack pointer increments to the next higher stack
  97. * memory address after data is pushed onto the stack
  98. * (b) CPU_STK_GROWTH_HI_TO_LO CPU stack pointer decrements to the next lower stack
  99. * memory address after data is pushed onto the stack
  100. *********************************************************************************************************
  101. */
  102. /* ------------------ CPU STACK GROWTH ORDER ------------------ */
  103. #define CPU_STK_GROWTH_NONE 0u
  104. #define CPU_STK_GROWTH_LO_TO_HI 1u /* CPU stk incs towards higher mem addrs (see Note #1a). */
  105. #define CPU_STK_GROWTH_HI_TO_LO 2u /* CPU stk decs towards lower mem addrs (see Note #1b). */
  106. /*
  107. *********************************************************************************************************
  108. * CRITICAL SECTION CONFIGURATION
  109. *
  110. * Note(s) : (1) Configure CPU_CFG_CRITICAL_METHOD with CPU's/compiler's critical section method :
  111. *
  112. * Enter/Exit critical sections by ...
  113. *
  114. * CPU_CRITICAL_METHOD_INT_DIS_EN Disable/Enable interrupts
  115. * CPU_CRITICAL_METHOD_STATUS_STK Push/Pop interrupt status onto stack
  116. * CPU_CRITICAL_METHOD_STATUS_LOCAL Save/Restore interrupt status to local variable
  117. *
  118. * (a) CPU_CRITICAL_METHOD_INT_DIS_EN is NOT a preferred method since it does NOT support
  119. * multiple levels of interrupts. However, with some CPUs/compilers, this is the only
  120. * available method.
  121. *
  122. * (b) CPU_CRITICAL_METHOD_STATUS_STK is one preferred method since it supports multiple
  123. * levels of interrupts. However, this method assumes that the compiler provides C-level
  124. * &/or assembly-level functionality for the following :
  125. *
  126. * ENTER CRITICAL SECTION :
  127. * (1) Push/save interrupt status onto a local stack
  128. * (2) Disable interrupts
  129. *
  130. * EXIT CRITICAL SECTION :
  131. * (3) Pop/restore interrupt status from a local stack
  132. *
  133. * (c) CPU_CRITICAL_METHOD_STATUS_LOCAL is one preferred method since it supports multiple
  134. * levels of interrupts. However, this method assumes that the compiler provides C-level
  135. * &/or assembly-level functionality for the following :
  136. *
  137. * ENTER CRITICAL SECTION :
  138. * (1) Save interrupt status into a local variable
  139. * (2) Disable interrupts
  140. *
  141. * EXIT CRITICAL SECTION :
  142. * (3) Restore interrupt status from a local variable
  143. *
  144. * (2) Critical section macro's most likely require inline assembly. If the compiler does NOT
  145. * allow inline assembly in C source files, critical section macro's MUST call an assembly
  146. * subroutine defined in a 'cpu_a.asm' file located in the following software directory :
  147. *
  148. * \<CPU-Compiler Directory>\<cpu>\<compiler>\
  149. *
  150. * where
  151. * <CPU-Compiler Directory> directory path for common CPU-compiler software
  152. * <cpu> directory name for specific CPU
  153. * <compiler> directory name for specific compiler
  154. *
  155. * (3) (a) To save/restore interrupt status, a local variable 'cpu_sr' of type 'CPU_SR' MAY need
  156. * to be declared (e.g. if 'CPU_CRITICAL_METHOD_STATUS_LOCAL' method is configured).
  157. *
  158. * (1) 'cpu_sr' local variable SHOULD be declared via the CPU_SR_ALLOC() macro which,
  159. * if used, MUST be declared following ALL other local variables (see any 'cpu.h
  160. * CRITICAL SECTION CONFIGURATION Note #3a1').
  161. *
  162. * Example :
  163. *
  164. * void Fnct (void)
  165. * {
  166. * CPU_INT08U val_08;
  167. * CPU_INT16U val_16;
  168. * CPU_INT32U val_32;
  169. * CPU_SR_ALLOC(); MUST be declared after ALL other local variables
  170. * :
  171. * :
  172. * }
  173. *
  174. * (b) Configure 'CPU_SR' data type with the appropriate-sized CPU data type large enough to
  175. * completely store the CPU's/compiler's status word.
  176. *********************************************************************************************************
  177. */
  178. /* --------------- CPU CRITICAL SECTION METHODS --------------- */
  179. #define CPU_CRITICAL_METHOD_NONE 0u /* */
  180. #define CPU_CRITICAL_METHOD_INT_DIS_EN 1u /* DIS/EN ints (see Note #1a). */
  181. #define CPU_CRITICAL_METHOD_STATUS_STK 2u /* Push/Pop int status onto stk (see Note #1b). */
  182. #define CPU_CRITICAL_METHOD_STATUS_LOCAL 3u /* Save/Restore int status to local var (see Note #1c). */
  183. /*
  184. *********************************************************************************************************
  185. * MODULE END
  186. *
  187. * Note(s) : (1) See 'cpu_def.h MODULE'.
  188. *********************************************************************************************************
  189. */
  190. #endif /* End of CPU def module include. */