F2837xD_Examples.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. //###########################################################################
  2. //
  3. // FILE: F2837xD_Examples.h
  4. //
  5. // TITLE: F2837xD Device Definitions.
  6. //
  7. //###########################################################################
  8. // $TI Release: F2837xD Support Library v3.05.00.00 $
  9. // $Release Date: Tue Jun 26 03:15:23 CDT 2018 $
  10. // $Copyright:
  11. // Copyright (C) 2013-2018 Texas Instruments Incorporated - http://www.ti.com/
  12. //
  13. // Redistribution and use in source and binary forms, with or without
  14. // modification, are permitted provided that the following conditions
  15. // are met:
  16. //
  17. // Redistributions of source code must retain the above copyright
  18. // notice, this list of conditions and the following disclaimer.
  19. //
  20. // Redistributions in binary form must reproduce the above copyright
  21. // notice, this list of conditions and the following disclaimer in the
  22. // documentation and/or other materials provided with the
  23. // distribution.
  24. //
  25. // Neither the name of Texas Instruments Incorporated nor the names of
  26. // its contributors may be used to endorse or promote products derived
  27. // from this software without specific prior written permission.
  28. //
  29. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  30. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  31. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  32. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  33. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  34. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  35. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  36. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  37. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  38. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  39. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. // $
  41. //###########################################################################
  42. #ifndef F2837xD_EXAMPLES_H
  43. #define F2837xD_EXAMPLES_H
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. //
  48. // Defines
  49. //
  50. //
  51. // The following are values that can be passed to the
  52. // InitSysPll() & InitAuxPll() to select SYSPLL/AUXPLL integer multiplier
  53. //
  54. #define IMULT_0 0
  55. #define IMULT_1 1
  56. #define IMULT_2 2
  57. #define IMULT_3 3
  58. #define IMULT_4 4
  59. #define IMULT_5 5
  60. #define IMULT_6 6
  61. #define IMULT_7 7
  62. #define IMULT_8 8
  63. #define IMULT_9 9
  64. #define IMULT_10 10
  65. #define IMULT_11 11
  66. #define IMULT_12 12
  67. #define IMULT_13 13
  68. #define IMULT_14 14
  69. #define IMULT_15 15
  70. #define IMULT_16 16
  71. #define IMULT_17 17
  72. #define IMULT_18 18
  73. #define IMULT_19 19
  74. #define IMULT_20 20
  75. #define IMULT_21 21
  76. #define IMULT_22 22
  77. #define IMULT_23 23
  78. #define IMULT_24 24
  79. #define IMULT_25 25
  80. #define IMULT_26 26
  81. #define IMULT_27 27
  82. #define IMULT_28 28
  83. #define IMULT_29 29
  84. #define IMULT_30 30
  85. #define IMULT_31 31
  86. #define IMULT_32 32
  87. #define IMULT_33 33
  88. #define IMULT_34 34
  89. #define IMULT_35 35
  90. #define IMULT_36 36
  91. #define IMULT_37 37
  92. #define IMULT_38 38
  93. #define IMULT_39 39
  94. #define IMULT_40 40
  95. #define IMULT_41 41
  96. #define IMULT_42 42
  97. #define IMULT_43 43
  98. #define IMULT_44 44
  99. #define IMULT_45 45
  100. #define IMULT_46 46
  101. #define IMULT_47 47
  102. #define IMULT_48 48
  103. #define IMULT_49 49
  104. #define IMULT_50 50
  105. #define IMULT_51 51
  106. #define IMULT_52 52
  107. #define IMULT_53 53
  108. #define IMULT_54 54
  109. #define IMULT_55 55
  110. #define IMULT_56 56
  111. #define IMULT_57 57
  112. #define IMULT_58 58
  113. #define IMULT_59 59
  114. #define IMULT_60 60
  115. #define IMULT_61 61
  116. #define IMULT_62 62
  117. #define IMULT_63 63
  118. #define IMULT_64 64
  119. #define IMULT_65 65
  120. #define IMULT_66 66
  121. #define IMULT_67 67
  122. #define IMULT_68 68
  123. #define IMULT_69 69
  124. #define IMULT_70 70
  125. #define IMULT_71 71
  126. #define IMULT_72 72
  127. #define IMULT_73 73
  128. #define IMULT_74 74
  129. #define IMULT_75 75
  130. #define IMULT_76 76
  131. #define IMULT_77 77
  132. #define IMULT_78 78
  133. #define IMULT_79 79
  134. #define IMULT_80 80
  135. #define IMULT_81 81
  136. #define IMULT_82 82
  137. #define IMULT_83 83
  138. #define IMULT_84 84
  139. #define IMULT_85 85
  140. #define IMULT_86 86
  141. #define IMULT_87 87
  142. #define IMULT_88 88
  143. #define IMULT_89 89
  144. #define IMULT_90 90
  145. #define IMULT_91 91
  146. #define IMULT_92 92
  147. #define IMULT_93 93
  148. #define IMULT_94 94
  149. #define IMULT_95 95
  150. #define IMULT_96 96
  151. #define IMULT_97 97
  152. #define IMULT_98 98
  153. #define IMULT_99 99
  154. #define IMULT_100 100
  155. #define IMULT_101 101
  156. #define IMULT_102 102
  157. #define IMULT_103 103
  158. #define IMULT_104 104
  159. #define IMULT_105 105
  160. #define IMULT_106 106
  161. #define IMULT_107 107
  162. #define IMULT_108 108
  163. #define IMULT_109 109
  164. #define IMULT_110 110
  165. #define IMULT_111 111
  166. #define IMULT_112 112
  167. #define IMULT_113 113
  168. #define IMULT_114 114
  169. #define IMULT_115 115
  170. #define IMULT_116 116
  171. #define IMULT_117 117
  172. #define IMULT_118 118
  173. #define IMULT_119 119
  174. #define IMULT_120 120
  175. #define IMULT_121 121
  176. #define IMULT_122 122
  177. #define IMULT_123 123
  178. #define IMULT_124 124
  179. #define IMULT_125 125
  180. #define IMULT_126 126
  181. #define IMULT_127 127
  182. //
  183. // The following are values that can be passed to the
  184. // InitSysPll() & InitAuxPll() to select SYSPLL/AUXPLL fractional multiplier
  185. //
  186. #define FMULT_0 0
  187. #define FMULT_0pt25 1
  188. #define FMULT_0pt5 2
  189. #define FMULT_0pt75 3
  190. //
  191. // The following are values that can be passed to the
  192. // InitSysPll() to select divsel for SYSPLL
  193. //
  194. #define PLLCLK_BY_1 0
  195. #define PLLCLK_BY_2 1
  196. #define PLLCLK_BY_4 2
  197. #define PLLCLK_BY_6 3
  198. #define PLLCLK_BY_8 4
  199. #define PLLCLK_BY_10 5
  200. #define PLLCLK_BY_12 6
  201. #define PLLCLK_BY_14 7
  202. #define PLLCLK_BY_16 8
  203. #define PLLCLK_BY_18 9
  204. #define PLLCLK_BY_20 10
  205. #define PLLCLK_BY_22 11
  206. #define PLLCLK_BY_24 12
  207. #define PLLCLK_BY_26 13
  208. #define PLLCLK_BY_28 14
  209. #define PLLCLK_BY_30 15
  210. #define PLLCLK_BY_32 16
  211. #define PLLCLK_BY_34 17
  212. #define PLLCLK_BY_36 18
  213. #define PLLCLK_BY_38 19
  214. #define PLLCLK_BY_40 20
  215. #define PLLCLK_BY_42 21
  216. #define PLLCLK_BY_44 22
  217. #define PLLCLK_BY_46 23
  218. #define PLLCLK_BY_48 24
  219. #define PLLCLK_BY_50 25
  220. #define PLLCLK_BY_52 26
  221. #define PLLCLK_BY_54 27
  222. #define PLLCLK_BY_56 28
  223. #define PLLCLK_BY_58 29
  224. #define PLLCLK_BY_60 30
  225. #define PLLCLK_BY_62 31
  226. #define PLLCLK_BY_64 32
  227. #define PLLCLK_BY_66 33
  228. #define PLLCLK_BY_68 34
  229. #define PLLCLK_BY_70 35
  230. #define PLLCLK_BY_72 36
  231. #define PLLCLK_BY_74 37
  232. #define PLLCLK_BY_76 38
  233. #define PLLCLK_BY_78 39
  234. #define PLLCLK_BY_80 40
  235. #define PLLCLK_BY_82 41
  236. #define PLLCLK_BY_84 42
  237. #define PLLCLK_BY_86 43
  238. #define PLLCLK_BY_88 44
  239. #define PLLCLK_BY_90 45
  240. #define PLLCLK_BY_92 46
  241. #define PLLCLK_BY_94 47
  242. #define PLLCLK_BY_96 48
  243. #define PLLCLK_BY_98 49
  244. #define PLLCLK_BY_100 50
  245. #define PLLCLK_BY_102 51
  246. #define PLLCLK_BY_104 52
  247. #define PLLCLK_BY_106 53
  248. #define PLLCLK_BY_108 54
  249. #define PLLCLK_BY_110 55
  250. #define PLLCLK_BY_112 56
  251. #define PLLCLK_BY_114 57
  252. #define PLLCLK_BY_116 58
  253. #define PLLCLK_BY_118 59
  254. #define PLLCLK_BY_120 60
  255. #define PLLCLK_BY_122 61
  256. #define PLLCLK_BY_124 62
  257. #define PLLCLK_BY_126 63
  258. //
  259. // The following are values that can be passed to the
  260. // InitAuxPll() to select divsel for AUXPLL
  261. //
  262. #define AUXPLLRAWCLK_BY_1 0
  263. #define AUXPLLRAWCLK_BY_2 1
  264. #define AUXPLLRAWCLK_BY_4 2
  265. #define AUXPLLRAWCLK_BY_8 3
  266. //
  267. // The following are values that can be passed to the
  268. // IntOsc2Sel() & XtalOscSel() to select system PLL (or) AUX PLL
  269. //
  270. #define SYSTEM_PLL (Uint16) 0
  271. #define AUX_PLL (Uint16) 1
  272. //
  273. // The following are values that can be passed to the
  274. // InitSysPll() & InitAuxPll() to select clock source
  275. //
  276. #define INT_OSC2 0
  277. #define XTAL_OSC 1
  278. #define INT_OSC1 2
  279. #define AUXCLKIN 4
  280. //
  281. // Specify the clock rate of the CPU (SYSCLKOUT) in nS.
  282. //
  283. // Take into account the input clock frequency and the PLL multiplier
  284. // selected in step 1.
  285. //
  286. // Use one of the values provided, or define your own.
  287. // The trailing L is required tells the compiler to treat
  288. // the number as a 64-bit value.
  289. //
  290. // Only one statement should be uncommented.
  291. //
  292. // Example: 200 MHz devices:
  293. // CLKIN is a 10 MHz crystal or internal 10 MHz oscillator
  294. //
  295. // In step 1 the user specified the PLL multiplier = 40 for a
  296. // 200 MHz CPU clock (SYSCLKOUT = 200 MHz).
  297. //
  298. // In this case, the CPU_RATE will be 5.000L
  299. // Uncomment the line: #define CPU_RATE 5.000L
  300. //
  301. #define CPU_RATE 5.00L // for a 200MHz CPU clock speed (SYSCLKOUT)
  302. //#define CPU_RATE 5.263L // for a 190MHz CPU clock speed (SYSCLKOUT)
  303. //#define CPU_RATE 5.556L // for a 180MHz CPU clock speed (SYSCLKOUT)
  304. //#define CPU_RATE 5.882L // for a 170MHz CPU clock speed (SYSCLKOUT)
  305. //#define CPU_RATE 6.250L // for a 160MHz CPU clock speed (SYSCLKOUT)
  306. //#define CPU_RATE 6.667L // for a 150MHz CPU clock speed (SYSCLKOUT)
  307. //#define CPU_RATE 7.143L // for a 140MHz CPU clock speed (SYSCLKOUT)
  308. //#define CPU_RATE 7.692L // for a 130MHz CPU clock speed (SYSCLKOUT)
  309. //#define CPU_RATE 8.333L // for a 120MHz CPU clock speed (SYSCLKOUT)
  310. //
  311. // The following pointer to a function call calibrates the ADC reference,
  312. // DAC offset, and internal oscillators
  313. //
  314. #define Device_cal (void (*)(void))0x070282
  315. //
  316. // The following pointers to functions calibrate the ADC linearity. Use this
  317. // in the AdcSetMode(...) function only
  318. //
  319. #define CalAdcaINL (void (*)(void))0x0703B4
  320. #define CalAdcbINL (void (*)(void))0x0703B2
  321. #define CalAdccINL (void (*)(void))0x0703B0
  322. #define CalAdcdINL (void (*)(void))0x0703AE
  323. //
  324. // The following pointer to a function call looks up the ADC offset trim for a
  325. // given condition. Use this in the AdcSetMode(...) function only.
  326. //
  327. #define GetAdcOffsetTrimOTP (Uint16 (*)(Uint16 OTPoffset))0x0703AC
  328. //
  329. // Includes
  330. //
  331. #include "F2837xD_GlobalPrototypes.h" // Prototypes for global functions
  332. // within the .c files.
  333. #include "F2837xD_cputimervars.h"
  334. #include "F2837xD_Cla_defines.h" // Macros used for CLA examples.
  335. #include "F2837xD_EPwm_defines.h" // Macros used for PWM examples.
  336. #include "F2837xD_Adc_defines.h" // Macros used for ADC examples.
  337. #include "F2837xD_Emif_defines.h" // Macros used for EMIF examples.
  338. #include "F2837xD_Gpio_defines.h" // Macros used for GPIO support code
  339. #include "F2837xD_I2c_defines.h" // Macros used for I2C examples.
  340. #include "F2837xD_Ipc_defines.h" // Macros used for IPC support code.
  341. #include "F2837xD_Pie_defines.h" // Macros used for PIE examples.
  342. #include "F2837xD_Dma_defines.h" // Macros used for DMA examples.
  343. #include "F2837xD_SysCtrl_defines.h" // Macros used for LPM support code
  344. #include "F2837xD_Upp_defines.h" // Macros used for UPP examples.
  345. #define PARTNO_2837xPACKAGEHERE 0x00
  346. #define CPU_FRQ_200MHZ 1
  347. #define CPU_FRQ_150MHZ 0
  348. #define CPU_FRQ_120MHZ 0
  349. //
  350. // Include files not used with F/BIOS
  351. //
  352. #ifndef F28_BIOS
  353. #include "F2837xD_defaultisr.h"
  354. #endif
  355. extern void F28x_usDelay(long LoopCount);
  356. //
  357. // DO NOT MODIFY THIS LINE.
  358. //
  359. #define DELAY_US(A) F28x_usDelay(((((long double) A * 1000.0L) / (long double)CPU_RATE) - 9.0L) / 5.0L)
  360. //
  361. // Timer Operations:
  362. //
  363. //
  364. // Start Timer:
  365. //
  366. #define StartCpuTimer0() CpuTimer0Regs.TCR.bit.TSS = 0
  367. //
  368. // Stop Timer:
  369. //
  370. #define StopCpuTimer0() CpuTimer0Regs.TCR.bit.TSS = 1
  371. //
  372. // Reload Timer With period Value:
  373. //
  374. #define ReloadCpuTimer0() CpuTimer0Regs.TCR.bit.TRB = 1
  375. //
  376. // Read 32-Bit Timer Value:
  377. //
  378. #define ReadCpuTimer0Counter() CpuTimer0Regs.TIM.all
  379. //
  380. // Read 32-Bit Period Value:
  381. //
  382. #define ReadCpuTimer0Period() CpuTimer0Regs.PRD.all
  383. //
  384. // Start Timer:
  385. //
  386. #define StartCpuTimer1() CpuTimer1Regs.TCR.bit.TSS = 0
  387. #define StartCpuTimer2() CpuTimer2Regs.TCR.bit.TSS = 0
  388. //
  389. // Stop Timer:
  390. //
  391. #define StopCpuTimer1() CpuTimer1Regs.TCR.bit.TSS = 1
  392. #define StopCpuTimer2() CpuTimer2Regs.TCR.bit.TSS = 1
  393. //
  394. // Reload Timer With period Value:
  395. //
  396. #define ReloadCpuTimer1() CpuTimer1Regs.TCR.bit.TRB = 1
  397. #define ReloadCpuTimer2() CpuTimer2Regs.TCR.bit.TRB = 1
  398. //
  399. // Read 32-Bit Timer Value:
  400. //
  401. #define ReadCpuTimer1Counter() CpuTimer1Regs.TIM.all
  402. #define ReadCpuTimer2Counter() CpuTimer2Regs.TIM.all
  403. //
  404. // Read 32-Bit Period Value:
  405. //
  406. #define ReadCpuTimer1Period() CpuTimer1Regs.PRD.all
  407. #define ReadCpuTimer2Period() CpuTimer2Regs.PRD.all
  408. #ifdef __cplusplus
  409. }
  410. #endif /* extern "C" */
  411. #endif // end of F2837xD_EXAMPLES_H definition
  412. //
  413. // End of file
  414. //