cpu_def.h 12 KB

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