DSP2803x_SWPrioritizedPieVect.c 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. //###########################################################################
  2. //
  3. // FILE: DSP2803x_SWPiroritizedPieVect.c
  4. //
  5. // TITLE: DSP2803x Devices SW Prioritized PIE Vector Table Initialization.
  6. //
  7. //###########################################################################
  8. //
  9. // Original Source by A.T.
  10. //
  11. // $TI Release: F2803x C/C++ Header Files and Peripheral Examples V130 $
  12. // $Release Date: May 8, 2015 $
  13. // $Copyright: Copyright (C) 2009-2015 Texas Instruments Incorporated -
  14. // http://www.ti.com/ ALL RIGHTS RESERVED $
  15. //###########################################################################
  16. #include "DSP2803x_Device.h" // DSP2803x Headerfile Include File
  17. #include "DSP2803x_Examples.h" // DSP2803x Examples Include File
  18. #include "DSP2803x_SWPrioritizedIsrLevels.h"
  19. const struct PIE_VECT_TABLE PieVectTableInit = {
  20. PIE_RESERVED, // Reserved space
  21. PIE_RESERVED, // reserved
  22. PIE_RESERVED, // reserved
  23. PIE_RESERVED, // reserved
  24. PIE_RESERVED, // reserved
  25. PIE_RESERVED, // reserved
  26. PIE_RESERVED, // reserved
  27. PIE_RESERVED, // reserved
  28. PIE_RESERVED, // reserved
  29. PIE_RESERVED, // reserved
  30. PIE_RESERVED, // reserved
  31. PIE_RESERVED, // reserved
  32. PIE_RESERVED, // reserved
  33. // Non-Peripheral Interrupts:
  34. #if (INT13PL != 0)
  35. INT13_ISR, // CPU-Timer1
  36. #else
  37. INT_NOTUSED_ISR,
  38. #endif
  39. #if (INT14PL != 0)
  40. INT14_ISR, // CPU-Timer2
  41. #else
  42. INT_NOTUSED_ISR,
  43. #endif
  44. #if (INT15PL != 0)
  45. DATALOG_ISR, // Datalogging interrupt
  46. #else
  47. INT_NOTUSED_ISR,
  48. #endif
  49. #if (INT16PL != 0)
  50. RTOSINT_ISR, // RTOS interrupt
  51. #else
  52. INT_NOTUSED_ISR,
  53. #endif
  54. rsvd_ISR, // reserved interrupt
  55. NMI_ISR, // Non-maskable interrupt
  56. ILLEGAL_ISR, // Illegal operation TRAP
  57. USER1_ISR, // User Defined trap 1
  58. USER2_ISR, // User Defined trap 2
  59. USER3_ISR, // User Defined trap 3
  60. USER4_ISR, // User Defined trap 4
  61. USER5_ISR, // User Defined trap 5
  62. USER6_ISR, // User Defined trap 6
  63. USER7_ISR, // User Defined trap 7
  64. USER8_ISR, // User Defined trap 8
  65. USER9_ISR, // User Defined trap 9
  66. USER10_ISR, // User Defined trap 10
  67. USER11_ISR, // User Defined trap 11
  68. USER12_ISR, // User Defined trap 12
  69. // Group 1 PIE Vectors:
  70. #if (G11PL != 0)
  71. ADCINT1_ISR, // ADC or change to rsvd_ISR if 10.1 is ADCINT1
  72. #else
  73. INT_NOTUSED_ISR,
  74. #endif
  75. #if (G12PL != 0)
  76. ADCINT2_ISR, // ADC or change to rsvd_ISR if 10.2 is ADCINT2
  77. #else
  78. INT_NOTUSED_ISR,
  79. #endif
  80. rsvd_ISR,
  81. #if (G14PL != 0)
  82. XINT1_ISR, // External
  83. #else
  84. INT_NOTUSED_ISR,
  85. #endif
  86. #if (G15PL != 0)
  87. XINT2_ISR, // External
  88. #else
  89. INT_NOTUSED_ISR,
  90. #endif
  91. #if (G16PL != 0)
  92. ADCINT9_ISR, // ADC
  93. #else
  94. INT_NOTUSED_ISR,
  95. #endif
  96. #if (G17PL != 0)
  97. TINT0_ISR, // Timer 0
  98. #else
  99. INT_NOTUSED_ISR,
  100. #endif
  101. #if (G18PL != 0)
  102. WAKEINT_ISR, // WD & Low Power
  103. #else
  104. INT_NOTUSED_ISR,
  105. #endif
  106. // Group 2 PIE Vectors:
  107. #if (G21PL != 0)
  108. EPWM1_TZINT_ISR, // ePWM1 Trip Zone
  109. #else
  110. INT_NOTUSED_ISR,
  111. #endif
  112. #if (G22PL != 0)
  113. EPWM2_TZINT_ISR, // ePWM2 Trip Zone
  114. #else
  115. INT_NOTUSED_ISR,
  116. #endif
  117. #if (G23PL != 0)
  118. EPWM3_TZINT_ISR, // ePWM3 Trip Zone
  119. #else
  120. INT_NOTUSED_ISR,
  121. #endif
  122. #if (G24PL != 0)
  123. EPWM4_TZINT_ISR, // ePWM4 Trip Zone
  124. #else
  125. INT_NOTUSED_ISR,
  126. #endif
  127. #if (G25PL != 0)
  128. EPWM5_TZINT_ISR, // ePWM5 Trip Zone
  129. #else
  130. INT_NOTUSED_ISR,
  131. #endif
  132. #if (G26PL != 0)
  133. EPWM6_TZINT_ISR, // ePWM6 Trip Zone
  134. #else
  135. INT_NOTUSED_ISR,
  136. #endif
  137. #if (G27PL != 0)
  138. EPWM7_TZINT_ISR, // ePWM7 Trip Zone
  139. #else
  140. INT_NOTUSED_ISR,
  141. #endif
  142. rsvd_ISR,
  143. // Group 3 PIE Vectors:
  144. #if (G31PL != 0)
  145. EPWM1_INT_ISR, // ePWM1 Interrupt
  146. #else
  147. INT_NOTUSED_ISR,
  148. #endif
  149. #if (G32PL != 0)
  150. EPWM2_INT_ISR, // ePWM2 Interrupt
  151. #else
  152. INT_NOTUSED_ISR,
  153. #endif
  154. #if (G33PL != 0)
  155. EPWM3_INT_ISR, // ePWM3 Interrupt
  156. #else
  157. INT_NOTUSED_ISR,
  158. #endif
  159. #if (G34PL != 0)
  160. EPWM4_INT_ISR, // ePWM4 Interrupt
  161. #else
  162. INT_NOTUSED_ISR,
  163. #endif
  164. #if (G35PL != 0)
  165. EPWM5_INT_ISR, // ePWM5 Interrupt
  166. #else
  167. INT_NOTUSED_ISR,
  168. #endif
  169. #if (G36PL != 0)
  170. EPWM6_INT_ISR, // ePWM6 Interrupt
  171. #else
  172. INT_NOTUSED_ISR,
  173. #endif
  174. #if (G37PL != 0)
  175. EPWM7_INT_ISR, // ePWM7 Interrupt
  176. #else
  177. INT_NOTUSED_ISR,
  178. #endif
  179. rsvd_ISR,
  180. // Group 4 PIE Vectors:
  181. #if (G41PL != 0)
  182. ECAP1_INT_ISR, // eCAP1 Interrupt
  183. #else
  184. INT_NOTUSED_ISR,
  185. #endif
  186. rsvd_ISR,
  187. rsvd_ISR,
  188. rsvd_ISR,
  189. rsvd_ISR,
  190. rsvd_ISR,
  191. rsvd_ISR,
  192. rsvd_ISR,
  193. // Group 5 PIE Vectors:
  194. #if (G51PL != 0)
  195. EQEP1_INT_ISR, // eQEP1 Interrupt
  196. #else
  197. INT_NOTUSED_ISR,
  198. #endif
  199. rsvd_ISR,
  200. rsvd_ISR,
  201. rsvd_ISR,
  202. rsvd_ISR,
  203. rsvd_ISR,
  204. rsvd_ISR,
  205. rsvd_ISR,
  206. // Group 6 PIE Vectors:
  207. #if (G61PL != 0)
  208. SPIRXINTA_ISR, // SPI-A
  209. #else
  210. INT_NOTUSED_ISR,
  211. #endif
  212. #if (G62PL != 0)
  213. SPITXINTA_ISR, // SPI-A
  214. #else
  215. INT_NOTUSED_ISR,
  216. #endif
  217. rsvd_ISR,
  218. rsvd_ISR,
  219. rsvd_ISR,
  220. rsvd_ISR,
  221. rsvd_ISR,
  222. rsvd_ISR,
  223. // Group 7 PIE Vectors:
  224. rsvd_ISR,
  225. rsvd_ISR,
  226. rsvd_ISR,
  227. rsvd_ISR,
  228. rsvd_ISR,
  229. rsvd_ISR,
  230. rsvd_ISR,
  231. rsvd_ISR,
  232. // Group 8 PIE Vectors:
  233. #if (G81PL != 0)
  234. I2CINT1A_ISR, // I2C-A
  235. #else
  236. INT_NOTUSED_ISR,
  237. #endif
  238. #if (G82PL != 0)
  239. I2CINT2A_ISR, // I2C-A
  240. #else
  241. INT_NOTUSED_ISR,
  242. #endif
  243. rsvd_ISR,
  244. rsvd_ISR,
  245. #if (G85PL != 0)
  246. SCIRXINTC_ISR, // SCI-C
  247. #else
  248. INT_NOTUSED_ISR,
  249. #endif
  250. #if (G86PL != 0)
  251. SCITXINTC_ISR, // SCI-C
  252. #else
  253. INT_NOTUSED_ISR,
  254. #endif
  255. rsvd_ISR,
  256. rsvd_ISR,
  257. // Group 9 PIE Vectors:
  258. #if (G91PL != 0)
  259. SCIRXINTA_ISR, // SCI-A
  260. #else
  261. INT_NOTUSED_ISR,
  262. #endif
  263. #if (G92PL != 0)
  264. SCITXINTA_ISR, // SCI-A
  265. #else
  266. INT_NOTUSED_ISR,
  267. #endif
  268. #if (G93PL != 0)
  269. LIN0INTA_ISR, // LIN0-A
  270. #else
  271. INT_NOTUSED_ISR,
  272. #endif
  273. #if (G94PL != 0)
  274. LIN1INTA_ISR, // LIN1-A
  275. #else
  276. INT_NOTUSED_ISR,
  277. #endif
  278. #if (G95PL != 0)
  279. ECAN0INTA_ISR, // eCAN-A
  280. #else
  281. INT_NOTUSED_ISR,
  282. #endif
  283. #if (G96PL != 0)
  284. ECAN1INTA_ISR, // eCAN-A
  285. #else
  286. INT_NOTUSED_ISR,
  287. #endif
  288. rsvd_ISR,
  289. rsvd_ISR,
  290. // Group 10 PIE Vectors
  291. rsvd_ISR, // or change to ADCINT1_ISR if ADCINT1 is 10.1 in G101PL
  292. rsvd_ISR, // or change to ADCINT2_ISR if ADCINT2 is 10.2 in G102PL
  293. #if (G103PL != 0)
  294. ADCINT3_ISR, // ADC
  295. #else
  296. INT_NOTUSED_ISR,
  297. #endif
  298. #if (G104PL != 0)
  299. ADCINT4_ISR, // ADC
  300. #else
  301. INT_NOTUSED_ISR,
  302. #endif
  303. #if (G105PL != 0)
  304. ADCINT5_ISR, // ADC
  305. #else
  306. INT_NOTUSED_ISR,
  307. #endif
  308. #if (G106PL != 0)
  309. ADCINT6_ISR, // ADC
  310. #else
  311. INT_NOTUSED_ISR,
  312. #endif
  313. #if (G107PL != 0)
  314. ADCINT7_ISR, // ADC
  315. #else
  316. INT_NOTUSED_ISR,
  317. #endif
  318. #if (G108PL != 0)
  319. ADCINT8_ISR, // ADC
  320. #else
  321. INT_NOTUSED_ISR,
  322. #endif
  323. // Group 11 PIE Vectors
  324. #if (G111PL != 0)
  325. CLA1_INT1_ISR, // CLA1
  326. #else
  327. INT_NOTUSED_ISR,
  328. #endif
  329. #if (G112PL != 0)
  330. CLA1_INT2_ISR, // CLA1
  331. #else
  332. INT_NOTUSED_ISR,
  333. #endif
  334. #if (G113PL != 0)
  335. CLA1_INT3_ISR, // CLA1
  336. #else
  337. INT_NOTUSED_ISR,
  338. #endif
  339. #if (G114PL != 0)
  340. CLA1_INT4_ISR, // CLA1
  341. #else
  342. INT_NOTUSED_ISR,
  343. #endif
  344. #if (G115PL != 0)
  345. CLA1_INT5_ISR, // CLA1
  346. #else
  347. INT_NOTUSED_ISR,
  348. #endif
  349. #if (G116PL != 0)
  350. CLA1_INT6_ISR, // CLA1
  351. #else
  352. INT_NOTUSED_ISR,
  353. #endif
  354. #if (G117PL != 0)
  355. CLA1_INT7_ISR, // CLA1
  356. #else
  357. INT_NOTUSED_ISR,
  358. #endif
  359. #if (G118PL != 0)
  360. CLA1_INT8_ISR, // CLA1
  361. #else
  362. INT_NOTUSED_ISR,
  363. #endif
  364. // Group 12 PIE Vectors
  365. #if (G121PL != 0)
  366. XINT3_ISR, // External interrupt
  367. #else
  368. INT_NOTUSED_ISR,
  369. #endif
  370. rsvd_ISR,
  371. rsvd_ISR,
  372. rsvd_ISR,
  373. rsvd_ISR,
  374. rsvd_ISR,
  375. #if (G127PL != 0)
  376. LVF_ISR, // CLA1 Overflow
  377. #else
  378. INT_NOTUSED_ISR,
  379. #endif
  380. #if (G128PL != 0)
  381. LUF_ISR, // CLA1 Underflow
  382. #else
  383. INT_NOTUSED_ISR,
  384. #endif
  385. };
  386. //---------------------------------------------------------------------------
  387. // InitPieVectTable:
  388. //---------------------------------------------------------------------------
  389. // This function initializes the PIE vector table to a known state.
  390. // This function must be executed after boot time.
  391. //
  392. void InitPieVectTable(void)
  393. {
  394. int16 i;
  395. Uint32 *Source = (void *) &PieVectTableInit;
  396. Uint32 *Dest = (void *) &PieVectTable;
  397. // Do not write over first 3 32-bit locations (these locations are
  398. // initialized by Boot ROM with boot variables)
  399. Source = Source + 3;
  400. Dest = Dest + 3;
  401. EALLOW;
  402. for(i=0; i < 125; i++)
  403. *Dest++ = *Source++;
  404. EDIS;
  405. // Enable the PIE Vector Table
  406. PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
  407. }
  408. //===========================================================================
  409. // No more.
  410. //===========================================================================