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