PageRenderTime 38ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/src/main/inc/9S12XDP512_XGATE_flags.h

https://gitlab.com/libreems-suite/libreems-firmware
C Header | 317 lines | 189 code | 23 blank | 105 comment | 0 complexity | dc11e19c84c900953aefdafd5e358ea9 MD5 | raw file
  1. /* LibreEMS - the open source engine management system
  2. *
  3. * Copyright 2014 David J. Andruczyk
  4. *
  5. * This file is part of the LibreEMS project.
  6. *
  7. * LibreEMS software is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * LibreEMS software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with any LibreEMS software. If not, see http://www.gnu.org/licenses/
  19. *
  20. *
  21. * Thank you for choosing LibreEMS to run your engine!
  22. */
  23. /** @file
  24. *
  25. * @ingroup allHeaders
  26. * @ingroup globalHeaders
  27. *
  28. * @brief MC9S12XDP512 flag definitions
  29. *
  30. * This is the flag header for the FreeScale MC9S12XDP512 MCU. It contains
  31. * a unified set of masks to be used with configuration registers.
  32. *
  33. * These are taken from MC9S12XDP512V2.pdf Appendix G, note some are shared across multiple registers.
  34. */
  35. /* see if we've seen this, if not, mark seen and process */
  36. #ifndef FILE_9S12XDP512_XGATE_FLAGS_H_SEEN
  37. #define FILE_9S12XDP512_XGATE_FLAGS_H_SEEN
  38. // REFERENCE DOC: http://cache.freescale.com/files/microcontrollers/doc/data_sheet/MC9S12XDP512RMV2.pdf
  39. //
  40. /* -------------------------------------------------------------------------
  41. * XGATE CO-PROCESSOR REGISTERS (XGATE)
  42. * -------------------------------------------------------------------------
  43. */
  44. // XGMCTL (XGATE Control Register) 6.3.1.1, Table 6-1
  45. #define XGEM BIT15_16 // Controls write access to XGE Bit, see Table 6-1 in REFERNCE DOC
  46. #define XGFRZM BIT14_16 // Contols write access to the XGFRZ bit
  47. #define XGDBGM BIT13_16 // Controls write access to the XGDBG bit
  48. #define XGSSM BIT12_16 // Controls write access to the XGSS bit
  49. #define XGFACTM BIT11_16 // Controls write access to the XGFACT bit
  50. //#define 0 BIT10_16 // Reserved
  51. #define XGSWEIFM BIT9_16 // Controls write access to the XGSWEIF bit
  52. #define XGIEM BIT8_16 // Controls write access to the XGIE bit
  53. #define XGE BIT7_16 // XGATE Module enable bit, 0 = disabled,
  54. // 1 = enabled
  55. #define XGFRZ BIT6_16 // Halt XGATE in Freeze Mode, 0 = normal
  56. // in freeze, 1 stop in freeze
  57. #define XGDBG BIT5_16 // XGATE Debug Mode, 0 = not in debug mode,
  58. // 1 = Enter debug mode
  59. #define XGSS BIT4_16 // XGATE Single Step
  60. #define XGFACT BIT3_16 // Fake XGATE Activity, 0 = Flag activity
  61. // only if not idle, 1 = flag always
  62. //#define 0 BIT2_16 // Reserved
  63. #define XGSWEIF BIT1_16 // XGATE Software Error Interrupt Flag
  64. #define XGIE BIT0_16 // XGATE Interrupt Enable. 0 = disable all
  65. // XG interrups, 1 = enable all XGATE interrupts
  66. // XGCHID (XGATE Channel ID Register) 6.3.1.2, Table 6-2
  67. //#define 0 BIT7 //
  68. #define XGCHID6 BIT6 // XGCHID[6:0] ID of the currently active channel
  69. #define XGCHID5 BIT5 //
  70. #define XGCHID4 BIT4 //
  71. #define XGCHID3 BIT3 //
  72. #define XGCHID2 BIT2 //
  73. #define XGCHID1 BIT1 //
  74. #define XGCHID0 BIT0 //
  75. // XGVBR (XGATE Vector Base Address Register) 6.3.1.3, Table 6-3
  76. #define XGVBR15 BIT15_16 // XBVBR[15:1] Vector Base Adress, holds
  77. #define XGVBR14 BIT14_16 // the start address of the vector block
  78. #define XGVBR13 BIT13_16 // in the XGATE Memory map
  79. #define XGVBR12 BIT12_16 //
  80. #define XGVBR11 BIT11_16 //
  81. #define XGVBR10 BIT10_16 //
  82. #define XGVBR9 BIT9_16 //
  83. #define XGVBR8 BIT8_16 //
  84. #define XGVBR7 BIT7_16 //
  85. #define XGVBR6 BIT6_16 //
  86. #define XGVBR5 BIT5_16 //
  87. #define XGVBR4 BIT4_16 //
  88. #define XGVBR3 BIT3_16 //
  89. #define XGVBR2 BIT2_16 //
  90. #define XGVBR1 BIT1_16 //
  91. //#define 0 BIT0_16 // Reserved
  92. // XGIF_7F_70 (XGATE Channel Interrupt Flag Register (70-7F) 6.3.1.4, Table 6-4
  93. //#define 0 BIT15_16 // Reserved
  94. //#define 0 BIT14_16 // Reserved
  95. //#define 0 BIT13_16 // Reserved
  96. //#define 0 BIT12_16 // Reserved
  97. //#define 0 BIT11_16 // Reserved
  98. //#define 0 BIT10_16 // Reserved
  99. //#define 0 BIT9_16 // Reserved
  100. #define XGIF_78 BIT8_16 // The Interrupt vector provides access to the
  101. #define XGIF_77 BIT7_16 // interrupt flags bits of each channel. Each
  102. #define XGIF_76 BIT6_16 // flag may be cleared by writing a "1" to its
  103. #define XGIF_75 BIT5_16 // location
  104. #define XGIF_74 BIT4_16 //
  105. #define XGIF_73 BIT3_16 //
  106. #define XGIF_72 BIT2_16 //
  107. #define XGIF_71 BIT1_16 //
  108. #define XGIF_70 BIT0_16 //
  109. // XGIF_6F_60 (XGATE Channel Interrupt Flag Register (60-6F) 6.3.1.4, Table 6-4
  110. #define XGIF_6F BIT15_16 //
  111. #define XGIF_6E BIT14_16 //
  112. #define XGIF_6D BIT13_16 //
  113. #define XGIF_6C BIT12_16 //
  114. #define XGIF_6B BIT11_16 //
  115. #define XGIF_6A BIT10_16 //
  116. #define XGIF_69 BIT9_16 //
  117. #define XGIF_68 BIT8_16 //
  118. #define XGIF_67 BIT7_16 //
  119. #define XGIF_66 BIT6_16 //
  120. #define XGIF_65 BIT5_16 //
  121. #define XGIF_64 BIT4_16 //
  122. #define XGIF_63 BIT3_16 //
  123. #define XGIF_62 BIT2_16 //
  124. #define XGIF_61 BIT1_16 //
  125. #define XGIF_60 BIT0_16 //
  126. // XGIF_5F_50 (XGATE Channel Interrupt Flag Register (50-5F) 6.3.1.4, Table 6-4
  127. #define XGIF_5F BIT15_16 //
  128. #define XGIF_5E BIT14_16 //
  129. #define XGIF_5D BIT13_16 //
  130. #define XGIF_5C BIT12_16 //
  131. #define XGIF_5B BIT11_16 //
  132. #define XGIF_5A BIT10_16 //
  133. #define XGIF_59 BIT9_16 //
  134. #define XGIF_58 BIT8_16 //
  135. #define XGIF_57 BIT7_16 //
  136. #define XGIF_56 BIT6_16 //
  137. #define XGIF_55 BIT5_16 //
  138. #define XGIF_54 BIT4_16 //
  139. #define XGIF_53 BIT3_16 //
  140. #define XGIF_52 BIT2_16 //
  141. #define XGIF_51 BIT1_16 //
  142. #define XGIF_50 BIT0_16 //
  143. // XGIF_4F_40 (XGATE Channel Interrupt Flag Register (40-4F) 6.3.1.4, Table 6-4
  144. #define XGIF_4F BIT15_16 //
  145. #define XGIF_4E BIT14_16 //
  146. #define XGIF_4D BIT13_16 //
  147. #define XGIF_4C BIT12_16 //
  148. #define XGIF_4B BIT11_16 //
  149. #define XGIF_4A BIT10_16 //
  150. #define XGIF_49 BIT9_16 //
  151. #define XGIF_48 BIT8_16 //
  152. #define XGIF_47 BIT7_16 //
  153. #define XGIF_46 BIT6_16 //
  154. #define XGIF_45 BIT5_16 //
  155. #define XGIF_44 BIT4_16 //
  156. #define XGIF_43 BIT3_16 //
  157. #define XGIF_42 BIT2_16 //
  158. #define XGIF_41 BIT1_16 //
  159. #define XGIF_40 BIT0_16 //
  160. // XGIF_3F_30 (XGATE Channel Interrupt Flag Register (30-3F) 6.3.1.4, Table 6-4
  161. #define XGIF_3F BIT15_16 //
  162. #define XGIF_3E BIT14_16 //
  163. #define XGIF_3D BIT13_16 //
  164. #define XGIF_3C BIT12_16 //
  165. #define XGIF_3B BIT11_16 //
  166. #define XGIF_3A BIT10_16 //
  167. #define XGIF_39 BIT9_16 //
  168. #define XGIF_38 BIT8_16 //
  169. #define XGIF_37 BIT7_16 //
  170. #define XGIF_36 BIT6_16 //
  171. #define XGIF_35 BIT5_16 //
  172. #define XGIF_34 BIT4_16 //
  173. #define XGIF_33 BIT3_16 //
  174. #define XGIF_32 BIT2_16 //
  175. #define XGIF_31 BIT1_16 //
  176. #define XGIF_30 BIT0_16 //
  177. // XGIF_2F_20 (XGATE Channel Interrupt Flag Register (20-2F) 6.3.1.4, Table 6-4
  178. #define XGIF_2F BIT15_16 //
  179. #define XGIF_2E BIT14_16 //
  180. #define XGIF_2D BIT13_16 //
  181. #define XGIF_2C BIT12_16 //
  182. #define XGIF_2B BIT11_16 //
  183. #define XGIF_2A BIT10_16 //
  184. #define XGIF_29 BIT9_16 //
  185. #define XGIF_28 BIT8_16 //
  186. #define XGIF_27 BIT7_16 //
  187. #define XGIF_26 BIT6_16 //
  188. #define XGIF_25 BIT5_16 //
  189. #define XGIF_24 BIT4_16 //
  190. #define XGIF_23 BIT3_16 //
  191. #define XGIF_22 BIT2_16 //
  192. #define XGIF_21 BIT1_16 //
  193. #define XGIF_20 BIT0_16 //
  194. // XGIF_1F_10 (XGATE Channel Interrupt Flag Register (10-1F) 6.3.1.4, Table 6-4
  195. #define XGIF_1F BIT15_16 //
  196. #define XGIF_1E BIT14_16 //
  197. #define XGIF_1D BIT13_16 //
  198. #define XGIF_1C BIT12_16 //
  199. #define XGIF_1B BIT11_16 //
  200. #define XGIF_1A BIT10_16 //
  201. #define XGIF_19 BIT9_16 //
  202. #define XGIF_18 BIT8_16 //
  203. #define XGIF_17 BIT7_16 //
  204. #define XGIF_16 BIT6_16 //
  205. #define XGIF_15 BIT5_16 //
  206. #define XGIF_14 BIT4_16 //
  207. #define XGIF_13 BIT3_16 //
  208. #define XGIF_12 BIT2_16 //
  209. #define XGIF_11 BIT1_16 //
  210. #define XGIF_10 BIT0_16 //
  211. // XGIF_0F_00 (XGATE Channel Interrupt Flag Register (00-0F) 6.3.1.4, Table 6-4
  212. #define XGIF_0F BIT15_16 //
  213. #define XGIF_0E BIT14_16 //
  214. #define XGIF_0D BIT13_16 //
  215. #define XGIF_0C BIT12_16 //
  216. #define XGIF_0B BIT11_16 //
  217. #define XGIF_0A BIT10_16 //
  218. #define XGIF_09 BIT9_16 //
  219. //#define 0 BIT8_16 // Reserved
  220. //#define 0 BIT7_16 // Reserved
  221. //#define 0 BIT6_16 // Reserved
  222. //#define 0 BIT5_16 // Reserved
  223. //#define 0 BIT4_16 // Reserved
  224. //#define 0 BIT3_16 // Reserved
  225. //#define 0 BIT2_16 // Reserved
  226. //#define 0 BIT1_16 // Reserved
  227. //#define 0 BIT0_16 // Reserved
  228. // XGSWT (XGATE Software Trigger Register) 6.3.1.5, Table 6-5
  229. #define XGSWTM7 BIT15_16 // Software Trigger Mask. These bits control
  230. #define XGSWTM6 BIT14_16 // write access to the XGSWT bits, Each XGSWT
  231. #define XGSWTM5 BIT13_16 // bit can only be written if a "1" is written
  232. #define XGSWTM4 BIT12_16 // to the corresponding XGSWTM bit in the SAME
  233. #define XGSWTM3 BIT11_16 // ACCESS, These always read as 0.
  234. #define XGSWTM2 BIT10_16 //
  235. #define XGSWTM1 BIT9_16 //
  236. #define XGSWTM0 BIT8_16 //
  237. #define XGSWT7 BIT7_16 // Software Trigger Bits. These bits act as
  238. #define XGSWT6 BIT6_16 // interrupt flags that are able to trigger
  239. #define XGSWT5 BIT5_16 // XGATE software channels, They can only be set
  240. #define XGSWT4 BIT4_16 // and cleared bu software
  241. #define XGSWT3 BIT3_16 // See table 6-5 in REFERENCE_DOC
  242. #define XGSWT2 BIT2_16 //
  243. #define XGSWT1 BIT1_16 //
  244. #define XGSWT0 BIT0_16 //
  245. // XGSEM (XGATE Semaphore Register) 6.3.1.6, Table 6-6
  246. #define XGSEMM7 BIT15_16 // Semaphore Mask. These bits control access to
  247. #define XGSEMM6 BIT14_16 // the XGSEM bits
  248. #define XGSEMM5 BIT13_16 // 0 = disable write access to XGSEM bit in
  249. #define XGSEMM4 BIT12_16 // same bus cycle.
  250. #define XGSEMM3 BIT11_16 // 1 = enable write access to XGSEM bit in
  251. #define XGSEMM2 BIT10_16 // same bus cycle
  252. #define XGSEMM1 BIT9_16 //
  253. #define XGSEMM0 BIT8_16 //
  254. #define XGSEM7 BIT7_16 // Semaphore Bits. These bits indicate whether
  255. #define XGSEM6 BIT6_16 // a semaphore is locked by the S12X_CPU. A
  256. #define XGSEM5 BIT5_16 // semaphore can be attempted to be set by
  257. #define XGSEM4 BIT4_16 // writing a "1" to the XGSEM bit and to its
  258. #define XGSEM3 BIT3_16 // corresponding MASK bit in the same access.
  259. #define XGSEM2 BIT2_16 // Only unlocked semaphores can be set. Can be
  260. #define XGSEM1 BIT1_16 // be cleared by writing a "0" to XGSEM and 1 to
  261. #define XGSEM0 BIT0_16 // corresponding XGSEMM bit.
  262. // XGCCR (XGATE Condition Code Register) 6.3.1.7, Table 6-7
  263. //#define 0 BIT7 // Reserved
  264. //#define 0 BIT6 // Reserved
  265. //#define 0 BIT5 // Reserved
  266. //#define 0 BIT4 // Reserved
  267. #define XGN BIT3 // Sign Flag
  268. #define XGZ BIT2 // Zero Flag
  269. #define XGV BIT1 // Overflow Flag
  270. #define XGC BIT0 // Carry Flag
  271. // XGPC (XGATE Program Counter register) 6.3.1.8, Table 6-8
  272. // This is a 16 bit register (Program Counter)
  273. // XGR1 (XGATE Register 1) 6.3.1.9 Table 6-9
  274. // This is a 16 bit register
  275. // It is preloaded with the initial variable pointer of the channel's
  276. // service request vector (see 6-20 in REFERENCE DOC)
  277. // XGR2 (XGATE Register 2) 6.3.1.10, Tabele 6-10
  278. // This is a 16 bit register
  279. // XGR3 (XGATE Register 3) 6.3.1.11, Tabele 6-11
  280. // This is a 16 bit register
  281. // XGR4 (XGATE Register 4) 6.3.1.12, Tabele 6-12
  282. // This is a 16 bit register
  283. // XGR5 (XGATE Register 5) 6.3.1.13, Tabele 6-13
  284. // This is a 16 bit register
  285. // XGR6 (XGATE Register 6) 6.3.1.14, Tabele 6-14
  286. // This is a 16 bit register
  287. // XGR7 (XGATE Register 7) 6.3.1.15, Tabele 6-15
  288. // This is a 16 bit register
  289. #else
  290. /* let us know if we are being untidy with headers */
  291. #warning "Header file 9S12XDP512_XGATE_FLAGS_H seen before, sort it out!"
  292. /* end of the wrapper ifdef from the very top */
  293. #endif
  294. /* ex: set tabstop=2 shiftwidth=2 expandtab softtabstop=2: */