]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/src/sys/_tms570_hydctr/sys_startup.c
Enable ethernet interrupts for all platforms
[pes-rpp/rpp-lib.git] / rpp / src / sys / _tms570_hydctr / sys_startup.c
1 /** @file sys_startup.c
2 *   @brief Startup Source File
3 *   @date 15.Mar.2012
4 *   @version 03.01.00
5 *
6 *   This file contains:
7 *   - Include Files
8 *   - Type Definitions
9 *   - External Functions
10 *   - VIM RAM Setup
11 *   - Startup Routine
12 *   .
13 *   which are relevant for the Startup.
14 */
15
16 /* (c) Texas Instruments 2009-2012, All rights reserved. */
17
18 /* Include Files */
19
20 #include "base.h"
21 #include "sys/system.h"
22 #include "sys/sys_vim.h"
23 #include "sys/sys_core.h"
24 #include "sys/sys_selftest.h"
25 #include "sys/ti_drv_esm.h"
26
27 #ifdef FREERTOS_POSIX
28 #define MDIOMiscInt    phantomInterrupt
29 #define EMACCore0RxIsr phantomInterrupt
30 #define EMACCore0TxIsr phantomInterrupt
31 #endif
32
33 /* Type Definitions */
34
35 typedef void (*handler_fptr)(const uint8_t *in, uint8_t *out);
36
37 /* External Functions */
38 #pragma WEAK(__TI_Handler_Table_Base)
39 #pragma WEAK(__TI_Handler_Table_Limit)
40 #pragma WEAK(__TI_CINIT_Base)
41 #pragma WEAK(__TI_CINIT_Limit)
42
43 extern uint32_t   __TI_Handler_Table_Base;
44 extern uint32_t   __TI_Handler_Table_Limit;
45 extern uint32_t   __TI_CINIT_Base;
46 extern uint32_t   __TI_CINIT_Limit;
47 extern uint32_t   __TI_PINIT_Base;
48 extern uint32_t   __TI_PINIT_Limit;
49 extern uint32_t * __binit__;
50
51 extern void main(void);
52 extern void exit(void);
53 /* Functions from library */
54 extern void __TI_auto_init(void);
55 extern void muxInit(void);
56
57 /* Vim Ram Definition */
58 /** @struct vimRam
59 *   @brief Vim Ram Definition
60 *
61 *   This type is used to access the Vim Ram.
62 */
63 /** @typedef vimRAM_t
64 *   @brief Vim Ram Type Definition
65 *
66 *   This type is used to access the Vim Ram.
67 */
68 typedef volatile struct vimRam
69 {
70     t_isrFuncPTR ISR[VIM_CHANNELS + 1];
71 } vimRAM_t;
72
73 #define vimRAM ((vimRAM_t *)0xFFF82000U)
74
75 static const t_isrFuncPTR s_vim_init[] =
76 {
77     &phantomInterrupt,
78     &esmHighInterrupt,      // 0
79     &phantomInterrupt,
80 #if FREERTOS_VERSION_NUMBER_MAYOR == 7 && \
81     FREERTOS_VERSION_NUMBER_MINOR == 0 && \
82     FREERTOS_VERSION_NUMBER_REV   == 2
83     &vPreemptiveTick,     // FreeRTOS 7.0.2
84 #else
85     &vPortPreemptiveTick, // FreeRTOS 7.4.0 and 7.4.2
86 #endif
87     &phantomInterrupt,
88     &phantomInterrupt,
89     &phantomInterrupt,      // 5
90     &phantomInterrupt,
91     &phantomInterrupt,
92     &phantomInterrupt,
93     &phantomInterrupt,
94     &phantomInterrupt,      // 10
95     &phantomInterrupt,
96     &mibspi1HighLevelInterrupt,
97 /*#if serialLine == scilinREG
98     &sciHighLevelinterrupt,
99 #else
100     &linHighLevelInterrupt,
101 #endif
102 */
103     &sciHighLevelInterrupt,
104     &phantomInterrupt,
105     &adc1Group1Interrupt,   // 15
106     &phantomInterrupt,
107     &spi2HighLevelInterrupt,
108     &phantomInterrupt,
109     &phantomInterrupt,
110     &phantomInterrupt,      // 20
111     &vPortYeildWithinAPI, // Software interrupt
112     &phantomInterrupt,
113     &phantomInterrupt,
114     &phantomInterrupt,
115     &phantomInterrupt,      // 25
116     &mibspi1LowLevelInterrupt,
117     &phantomInterrupt,
118     &phantomInterrupt,
119     &phantomInterrupt,
120     &spi2LowLevelInterrupt, // 30
121     &phantomInterrupt,
122     &phantomInterrupt,
123     &phantomInterrupt,
124     &phantomInterrupt,
125     &phantomInterrupt,    // 35
126     &phantomInterrupt,
127     &mibspi3HighInterruptLevel,
128     &mibspi3LowLevelInterrupt,
129     &phantomInterrupt,
130     &phantomInterrupt,      // 40
131     &phantomInterrupt,
132     &phantomInterrupt,
133     &phantomInterrupt,
134     &phantomInterrupt,
135     &phantomInterrupt,    // 45
136     &phantomInterrupt,
137     &phantomInterrupt,
138     &phantomInterrupt,
139     &spi4HighLevelInterrupt,
140     &phantomInterrupt,      // 50
141     &adc2Group1Interrupt,
142     &phantomInterrupt,
143     &mibspi5HighLevelInterrupt,
144     &spi4LowLevelInterrupt,
145     &phantomInterrupt,      // 55
146     &mibspi5LowLevelInterrupt,
147     &phantomInterrupt,
148     &phantomInterrupt,
149     &phantomInterrupt,
150     &phantomInterrupt,      // 60
151     &phantomInterrupt,
152     &phantomInterrupt,
153     &phantomInterrupt,
154     &sciHighLevelInterrupt,
155     &phantomInterrupt,      // 65
156     &i2cInterrupt,
157     &phantomInterrupt,
158     &phantomInterrupt,
159     &phantomInterrupt,
160     &phantomInterrupt,      // 70
161     &phantomInterrupt,
162     &phantomInterrupt,
163     &phantomInterrupt,
164     &phantomInterrupt,
165     &phantomInterrupt,      // 75
166     &MDIOMiscInt,      //MDIOMiscInt
167     &EMACCore0TxIsr,   //EMACCore0TxIsr
168     &phantomInterrupt,
169     &EMACCore0RxIsr,   //EMACCore0RxIsr
170     &phantomInterrupt,      // 80
171     &phantomInterrupt,
172     &phantomInterrupt,
173     &phantomInterrupt,
174     &phantomInterrupt,
175     &phantomInterrupt,      // 85
176     &phantomInterrupt,
177     &phantomInterrupt,
178     &phantomInterrupt,
179     &phantomInterrupt,
180     &phantomInterrupt,      // 90
181     &phantomInterrupt,
182     &phantomInterrupt,
183     &phantomInterrupt,
184     &phantomInterrupt,
185     &phantomInterrupt,      // 95
186     &phantomInterrupt,
187     &phantomInterrupt,
188     &phantomInterrupt,
189     &phantomInterrupt,
190     &phantomInterrupt,      // 100
191     &phantomInterrupt,
192     &phantomInterrupt,
193     &phantomInterrupt,
194     &phantomInterrupt,
195     &phantomInterrupt,
196     &phantomInterrupt,
197     &phantomInterrupt,
198     &phantomInterrupt,
199     &phantomInterrupt,
200     &phantomInterrupt,
201     &phantomInterrupt,
202     &phantomInterrupt,
203     &phantomInterrupt,
204     &phantomInterrupt,
205     &phantomInterrupt,
206     &phantomInterrupt,
207     &phantomInterrupt,
208     &phantomInterrupt,
209     &phantomInterrupt,
210     &phantomInterrupt,
211     &phantomInterrupt,
212     &phantomInterrupt,
213     &phantomInterrupt,
214     &phantomInterrupt,
215     &phantomInterrupt,
216     &phantomInterrupt,
217     &phantomInterrupt,
218 };
219
220
221 /** @fn void _errata_CORTEXR4_66_(void)
222 *   @brief Work Around for Errata CORTEX-R4#66
223 *
224 *   This function Disable out-of-order completion for divide
225 *   instructions in Auxiliary Control register.
226 */
227 void _errata_CORTEXR4_66_(void);
228
229 /** @fn void _errata_CORTEXR4_57_(void)
230 *   @brief Work Around for Errata CORTEX-R4#57
231 *
232 *   Disable out-of-order single-precision floating point
233 *   multiply-accumulate instruction completion.
234 */
235 void _errata_CORTEXR4_57_(void);
236
237
238 /* Startup Routine */
239
240 #pragma INTERRUPT(_c_int00, RESET)
241
242 void _c_int00()
243 {
244     /* Initialize Core Registers to avoid CCM Error */
245     _coreInitRegisters_();
246
247     /* Initialize Stack Pointers */
248     _coreInitStackPointer_();
249
250     /* Work Around for Errata DEVICE#140: ( Only on Rev A silicon)
251      *
252      * Errata Description:
253      *            The Core Compare Module(CCM-R4) may cause nERROR to be asserted after a cold power-on
254      * Workaround:
255      *            Clear ESM Group2 Channel 2 error in ESMSR2 and Compare error in CCMSR register
256      */
257     if (DEVICE_ID_REV == 0x802AAD05)
258     {
259         _esmCcmErrorsClear_();
260     }
261
262     /* Enable CPU Event Export */
263     /* This allows the CPU to signal any single-bit or double-bit errors detected
264      * by its ECC logic for accesses to program flash or data RAM.
265      */
266     _coreEnableEventBusExport_();
267
268     /* Enable response to ECC errors indicated by CPU for accesses to flash */
269     /*flashWREG->FEDACCTRL1 = 0x000A060A;*/
270
271     /* Enable CPU ECC checking for ATCM (flash accesses) */
272     /*_coreEnableFlashEcc_();*/
273
274     /* Reset handler: the following instructions read from the system exception status register
275      * to identify the cause of the CPU reset.
276      */
277
278     /* check for power-on reset condition */
279     if ((SYS_EXCEPTION & POWERON_RESET) != 0)
280     {
281         /* clear all reset status flags */
282         SYS_EXCEPTION = 0xFFFF;
283         /* Workaround for Errata CORTEXR4 66 */
284         _errata_CORTEXR4_66_();
285         /* Workaround for Errata CORTEXR4 57 */
286         _errata_CORTEXR4_57_();
287         /* continue with normal start-up sequence */
288     }
289     else if ((SYS_EXCEPTION & OSC_FAILURE_RESET) != 0)
290     {
291         /* Reset caused due to oscillator failure.
292         Add user code here to handle oscillator failure */
293     }
294     else if ((SYS_EXCEPTION & WATCHDOG_RESET) !=0 )
295     {
296         /* Reset caused due
297          *  1) windowed watchdog violation - Add user code here to handle watchdog violation.
298          *  2) ICEPICK Reset - After loading code via CCS / System Reset through CCS
299          */
300         /* Check the WatchDog Status register */
301         if(WATCHDOG_STATUS != 0U)
302         {
303             /* Add user code here to handle watchdog violation. */
304             /* Clear the Watchdog reset flag in Exception Status register */
305             SYS_EXCEPTION = WATCHDOG_RESET;
306         }
307         else
308         {
309             /* Clear the ICEPICK reset flag in Exception Status register */
310             SYS_EXCEPTION = ICEPICK_RESET;
311         }
312     }
313     else if ((SYS_EXCEPTION & CPU_RESET) !=0 )
314     {
315         /* Reset caused due to CPU reset.
316         CPU reset can be caused by CPU self-test completion, or
317         by toggling the "CPU RESET" bit of the CPU Reset Control Register. */
318         /* clear all reset status flags */
319         SYS_EXCEPTION = CPU_RESET;
320     }
321     else if ((SYS_EXCEPTION & SW_RESET) != 0)
322     {
323         /* Reset caused due to software reset.
324         Add user code to handle software reset. */
325     }
326     else
327     {
328         /* Reset caused by nRST being driven low externally.
329         Add user code to handle external reset. */
330     }
331
332     /* Check if there were ESM group3 errors during power-up.
333      * These could occur during eFuse auto-load or during reads from flash OTP
334      * during power-up. Device operation is not reliable and not recommended
335      * in this case.
336      * An ESM group3 error only drives the nERROR pin low. An external circuit
337      * that monitors the nERROR pin must take the appropriate action to ensure that
338      * the system is placed in a safe state, as determined by the application.
339      */
340     if (esmREG->ESTATUS1[2])
341     {
342         while(1);
343     }
344
345     /* Initialize System - Clock, Flash settings with Efuse self check */
346     systemInit();
347
348     /* Workaround for Errata PBIST#4 */
349     errata_PBIST_4();
350
351     /* Run a diagnostic check on the memory self-test controller.
352      * This function chooses a RAM test algorithm and runs it on an on-chip ROM.
353      * The memory self-test is expected to fail. The function ensures that the PBIST controller
354      * is capable of detecting and indicating a memory self-test failure.
355      */
356     pbistSelfCheck();
357
358         /* Run PBIST on STC ROM */
359     pbistRun((uint32_t)STC_ROM_PBIST_RAM_GROUP,
360              ((uint32_t)PBIST_TripleReadSlow | (uint32_t)PBIST_TripleReadFast));
361
362     /* Wait for PBIST for STC ROM to be completed */
363     while(!pbistIsTestCompleted());
364
365     /* Check if PBIST on STC ROM passed the self-test */
366     if( pbistIsTestPassed() != TRUE)
367     {
368         /* PBIST and STC ROM failed the self-test.
369          * Need custom handler to check the memory failure
370          * and to take the appropriate next step.
371          */
372         pbistFail();
373
374     }
375
376     /* Run PBIST on PBIST ROM */
377     pbistRun((uint32_t)PBIST_ROM_PBIST_RAM_GROUP,
378              ((uint32_t)PBIST_TripleReadSlow | (uint32_t)PBIST_TripleReadFast));
379
380     /* Wait for PBIST for PBIST ROM to be completed */
381     while(!pbistIsTestCompleted());
382
383     /* Check if PBIST ROM passed the self-test */
384     if( pbistIsTestPassed() != TRUE)
385     {
386         /* PBIST and STC ROM failed the self-test.
387          * Need custom handler to check the memory failure
388          * and to take the appropriate next step.
389          */
390
391         pbistFail();
392
393     }
394
395     /* Disable RAM ECC before doing PBIST for Main RAM */
396     _coreDisableRamEcc_();
397
398     /* Run PBIST on CPU RAM.
399      * The PBIST controller needs to be configured separately for single-port and dual-port SRAMs.
400      * The CPU RAM is a single-port memory. The actual "RAM Group" for all on-chip SRAMs is defined in the
401      * device datasheet.
402      */
403     pbistRun(0x08300020, /* ESRAM Single Port PBIST */
404              PBIST_March13N_SP);
405
406     /* Wait for PBIST for CPU RAM to be completed */
407     while(!pbistIsTestCompleted());
408
409     /* Check if CPU RAM passed the self-test */
410     if( pbistIsTestPassed() != TRUE)
411     {
412         /* CPU RAM failed the self-test.
413          * Need custom handler to check the memory failure
414          * and to take the appropriate next step.
415          */
416         pbistFail();
417     }
418
419     /* Disable PBIST clocks and disable memory self-test mode */
420     pbistStop();
421
422     /* Initialize CPU RAM.
423      * This function uses the system module's hardware for auto-initialization of memories and their
424      * associated protection schemes. The CPU RAM is initialized by setting bit 0 of the MSIENA register.
425      * Hence the value 0x1 passed to the function.
426      * This function will initialize the entire CPU RAM and the corresponding ECC locations.
427      */
428     memoryInit(0x1);
429
430     /* Enable ECC checking for TCRAM accesses.
431      * This function enables the CPU's ECC logic for accesses to B0TCM and B1TCM.
432      */
433     _coreEnableRamEcc_();
434
435     /* Start PBIST on all dual-port memories */
436     pbistRun(  0x00000000    /*   EMAC Dual Port PBIST  */
437              | 0x00000000    /*   USB Dual Port PBIST for RMx / Reserved for TMS570x */
438              | 0x00000800    /*   DMA Dual Port PBIST  */
439              | 0x00000200    /*   VIM Dual Port PBIST  */
440              | 0x00000040    /*   MIBSPI1 Dual Port PBIST  */
441              | 0x00000080    /*   MIBSPI3 Dual Port PBIST  */
442              | 0x00000100    /*   MIBSPI5 Dual Port PBIST  */
443              | 0x00000004    /*   CAN1 Dual Port PBIST  */
444              | 0x00000008    /*   CAN2 Dual Port PBIST  */
445              | 0x00000010    /*   CAN3 Dual Port PBIST  */
446              | 0x00000400    /*   ADC1 Dual Port PBIST  */
447              | 0x00020000    /*   ADC2 Dual Port PBIST  */
448              | 0x00001000    /*   HET1 Dual Port PBIST  */
449              | 0x00040000    /*   HET2 Dual Port PBIST  */
450              | 0x00002000    /*   HTU1 Dual Port PBIST  */
451              | 0x00080000    /*   HTU2 Dual Port PBIST  */
452              | 0x00004000    /*   RTP Dual Port PBIST  */
453              | 0x00000000    /*   FTU Dual Port PBIST for TMS570x / Reserved for RMx */
454              | 0x00008000    /*   FRAY Dual Port PBIST for TMS570x / Reserved for RMx */
455              , PBIST_March13N_DP);
456
457     /* Test the CPU ECC mechanism for RAM accesses.
458      * The checkBxRAMECC functions cause deliberate single-bit and double-bit errors in TCRAM accesses
459      * by corrupting 1 or 2 bits in the ECC. Reading from the TCRAM location with a 2-bit error
460      * in the ECC causes a data abort exception. The data abort handler is written to look for
461      * deliberately caused exception and to return the code execution to the instruction
462      * following the one that caused the abort.
463      */
464     checkB0RAMECC();
465     tcram1REG->RAMCTRL &= ~(0x00000100);                /* disable writes to ECC RAM */
466     tcram2REG->RAMCTRL &= ~(0x00000100);
467
468     checkB1RAMECC();
469     tcram1REG->RAMCTRL &= ~(0x00000100);                /* disable writes to ECC RAM */
470     tcram2REG->RAMCTRL &= ~(0x00000100);
471
472     /* Test the CPU ECC mechanism for Flash accesses.
473      * The checkFlashECC function uses the flash interface module's diagnostic mode 7
474      * to create single-bit and double-bit errors in CPU accesses to the flash. A double-bit
475      * error on reading from flash causes a data abort exception.
476      * The data abort handler is written to look for deliberately caused exception and
477      * to return the code execution to the instruction following the one that was aborted.
478      *
479      */
480     /*
481     checkFlashECC();
482     flashWREG->FDIAGCTRL = 0x000A0007; */                  /* disable flash diagnostic mode */
483
484     /* Wait for PBIST for CPU RAM to be completed */
485     while(!pbistIsTestCompleted());
486
487     /* Check if CPU RAM passed the self-test */
488     if( pbistIsTestPassed() != TRUE)
489     {
490         /* CPU RAM failed the self-test.
491          * Need custom handler to check the memory failure
492          * and to take the appropriate next step.
493          */
494         pbistFail();
495
496     }
497
498     /* Disable PBIST clocks and disable memory self-test mode */
499     pbistStop();
500
501     /* Release the MibSPI1 modules from local reset.
502      * This will cause the MibSPI1 RAMs to get initialized along with the parity memory.
503      */
504      mibspiREG1->GCR0 = 0x1;
505
506     /* Release the MibSPI3 modules from local reset.
507      * This will cause the MibSPI3 RAMs to get initialized along with the parity memory.
508      */
509     mibspiREG3->GCR0 = 0x1;
510
511     /* Release the MibSPI5 modules from local reset.
512      * This will cause the MibSPI5 RAMs to get initialized along with the parity memory.
513      */
514     mibspiREG5->GCR0 = 0x1;
515
516     /* Enable parity on selected RAMs */
517     enableParity();
518
519     /* Initialize all on-chip SRAMs except for MibSPIx RAMs
520      * The MibSPIx modules have their own auto-initialization mechanism which is triggered
521      * as soon as the modules are brought out of local reset.
522      */
523     /* The system module auto-init will hang on the MibSPI RAM if the module is still in local reset.
524      */
525     memoryInit(    1 << 1    /*   DMA Memory Init  */
526                  | 1 << 2    /*   VIM Memory Init  */
527                  | 1 << 5    /*   CAN1 Memory Init  */
528                  | 1 << 6    /*   CAN2 Memory Init  */
529                  | 1 << 10    /*   CAN3 Memory Init  */
530                  | 1 << 8    /*   ADC1 Memory Init  */
531                  | 1 << 14    /*   ADC2 Memory Init  */
532                  | 1 << 3    /*   HET1 Memory Init  */
533                  | 1 << 4    /*   HTU1 Memory Init  */
534                  | 1 << 15    /*   HET2 Memory Init  */
535                  | 1 << 16    /*   HTU2 Memory Init  */
536                  | 1 << 13);    /*   Reserved for RMx Family / FTU Memory Init for TMS570x Family */
537
538     /* Disable parity */
539     disableParity();
540
541     /* Test the parity protection mechanism for peripheral RAMs
542      * The following memories have parity protection that needs to be checked:
543      * VIM, DMA, ADC1, ADC2, NHET1, NHET2, HTU1, HTU2, FlexRay, FTU,
544      * MibSPI1, MibSPI3, MibSPI5, DCAN1, DCAN2, DCAN3 based on user selection
545      */
546     /* Test the parity protection mechanism for peripheral RAMs
547        NOTE : Please Refer DEVICE DATASHEET for the list of Supported Memories with parity.
548                  Parity Self check is perfomed only on the user selected memories in HALCoGen's GUI SAFETY INIT tab.
549     */
550
551
552     het1ParityCheck();
553     htu1ParityCheck();
554     het2ParityCheck();
555     htu2ParityCheck();
556     adc1ParityCheck();
557     adc2ParityCheck();
558     can1ParityCheck();
559     can2ParityCheck();
560     can3ParityCheck();
561     vimParityCheck();
562     dmaParityCheck();
563
564     while (mibspiREG1->BUFINIT);        /* wait for MibSPI1 RAM to complete initialization */
565     while (mibspiREG3->BUFINIT);        /* wait for MibSPI3 RAM to complete initialization */
566     while (mibspiREG5->BUFINIT);        /* wait for MibSPI5 RAM to complete initialization */
567
568     mibspi1ParityCheck();
569     mibspi3ParityCheck();
570     mibspi5ParityCheck();
571
572     /* Initialize VIM table */
573     {
574         uint32_t i;
575
576         for (i = 0; i < (VIM_CHANNELS + 1); i++)
577         {
578             vimRAM->ISR[i] = s_vim_init[i];
579         }
580     }
581
582     /* set IRQ/FIQ priorities */
583     vimREG->FIRQPR0 =  SYS_FIQ
584                     | (SYS_FIQ <<  1U)
585                     | (SYS_IRQ <<  2U)
586                     | (SYS_IRQ <<  3U)
587                     | (SYS_IRQ <<  4U)
588                     | (SYS_IRQ <<  5U)
589                     | (SYS_IRQ <<  6U)
590                     | (SYS_IRQ <<  7U)
591                     | (SYS_IRQ <<  8U)
592                     | (SYS_IRQ <<  9U)
593                     | (SYS_IRQ << 10U)
594                     | (SYS_IRQ << 11U)
595                     | (SYS_IRQ << 12U)
596                     | (SYS_IRQ << 13U)
597                     | (SYS_IRQ << 14U)
598                     | (SYS_IRQ << 15U)
599                     | (SYS_IRQ << 16U)
600                     | (SYS_IRQ << 17U)
601                     | (SYS_IRQ << 18U)
602                     | (SYS_IRQ << 19U)
603                     | (SYS_IRQ << 20U)
604                     | (SYS_IRQ << 21U)
605                     | (SYS_IRQ << 22U)
606                     | (SYS_IRQ << 23U)
607                     | (SYS_IRQ << 24U)
608                     | (SYS_IRQ << 25U)
609                     | (SYS_IRQ << 26U)
610                     | (SYS_IRQ << 27U)
611                     | (SYS_IRQ << 28U)
612                     | (SYS_IRQ << 29U)
613                     | (SYS_IRQ << 30U)
614                     | (SYS_IRQ << 31U);
615
616     vimREG->FIRQPR1 =  SYS_IRQ
617                     | (SYS_IRQ <<  1U)
618                     | (SYS_IRQ <<  2U)
619                     | (SYS_IRQ <<  3U)
620                     | (SYS_IRQ <<  4U)
621                     | (SYS_IRQ <<  5U)
622                     | (SYS_IRQ <<  6U)
623                     | (SYS_IRQ <<  7U)
624                     | (SYS_IRQ <<  8U)
625                     | (SYS_IRQ <<  9U)
626                     | (SYS_IRQ << 10U)
627                     | (SYS_IRQ << 11U)
628                     | (SYS_IRQ << 12U)
629                     | (SYS_IRQ << 13U)
630                     | (SYS_IRQ << 14U)
631                     | (SYS_IRQ << 15U)
632                     | (SYS_IRQ << 16U)
633                     | (SYS_IRQ << 17U)
634                     | (SYS_IRQ << 18U)
635                     | (SYS_IRQ << 19U)
636                     | (SYS_IRQ << 20U)
637                     | (SYS_IRQ << 21U)
638                     | (SYS_IRQ << 22U)
639                     | (SYS_IRQ << 23U)
640                     | (SYS_IRQ << 24U)
641                     | (SYS_IRQ << 25U)
642                     | (SYS_IRQ << 26U)
643                     | (SYS_IRQ << 27U)
644                     | (SYS_IRQ << 28U)
645                     | (SYS_IRQ << 29U)
646                     | (SYS_IRQ << 30U)
647                     | (SYS_IRQ << 31U);
648
649
650     vimREG->FIRQPR2 =  SYS_IRQ
651                     | (SYS_IRQ << 1U)
652                     | (SYS_IRQ << 2U)
653                     | (SYS_IRQ << 3U)
654                     | (SYS_IRQ << 4U)
655                     | (SYS_IRQ << 5U)
656                     | (SYS_IRQ << 6U)
657                     | (SYS_IRQ << 7U)
658                     | (SYS_IRQ << 8U)
659                     | (SYS_IRQ << 9U)
660                     | (SYS_IRQ << 10U)
661                     | (SYS_IRQ << 11U)
662                     | (SYS_IRQ << 12U)  // MDIOMiscInt
663                     | (SYS_IRQ << 13U)  // EMAC
664                     | (SYS_IRQ << 14U)
665                     | (SYS_IRQ << 15U)  // EMAC
666                     | (SYS_IRQ << 16U)
667                     | (SYS_IRQ << 17U)
668                     | (SYS_IRQ << 18U)
669                     | (SYS_IRQ << 19U)
670                     | (SYS_IRQ << 20U)
671                     | (SYS_IRQ << 21U)
672                     | (SYS_IRQ << 22U)
673                     | (SYS_IRQ << 23U)
674                     | (SYS_IRQ << 24U)
675                     | (SYS_IRQ << 25U)
676                     | (SYS_IRQ << 26U)
677                     | (SYS_IRQ << 27U)
678                     | (SYS_IRQ << 28U)
679                     | (SYS_IRQ << 29U)
680                     | (SYS_IRQ << 30U)
681                     | (SYS_IRQ << 31U);
682
683     vimREG->FIRQPR3 =  SYS_IRQ
684                     | (SYS_IRQ << 1U)
685                     | (SYS_IRQ << 2U)
686                     | (SYS_IRQ << 3U)
687                     | (SYS_IRQ << 4U)
688                     | (SYS_IRQ << 5U)
689                     | (SYS_IRQ << 6U)
690                     | (SYS_IRQ << 7U)
691                     | (SYS_IRQ << 8U)
692                     | (SYS_IRQ << 9U)
693                     | (SYS_IRQ << 10U)
694                     | (SYS_IRQ << 11U)
695                     | (SYS_IRQ << 12U)
696                     | (SYS_IRQ << 13U)
697                     | (SYS_IRQ << 14U)
698                     | (SYS_IRQ << 15U)
699                     | (SYS_IRQ << 16U)
700                     | (SYS_IRQ << 17U)
701                     | (SYS_IRQ << 18U)
702                     | (SYS_IRQ << 19U)
703                     | (SYS_IRQ << 20U)
704                     | (SYS_IRQ << 21U)
705                     | (SYS_IRQ << 22U)
706                     | (SYS_IRQ << 23U)
707                     | (SYS_IRQ << 24U)
708                     | (SYS_IRQ << 25U)
709                     | (SYS_IRQ << 26U)
710                     | (SYS_IRQ << 27U)
711                     | (SYS_IRQ << 28U)
712                     | (SYS_IRQ << 29U)
713                     | (SYS_IRQ << 30U)
714                     | (SYS_IRQ << 31U);
715
716
717     /* enable interrupts */
718     vimREG->REQMASKSET0 = 1U
719                         | (1U << 1U)
720                         | (1U << 2U)
721                         | (0U << 3U)
722                         | (0U << 4U)
723                         | (0U << 5U)
724                         | (0U << 6U)
725                         | (0U << 7U)
726                         | (0U << 8U)
727                         | (0U << 9U)
728                         | (0U << 10U)
729                         | (0U << 11U)
730                         | (1U << 12U)
731                         | (1U << 13U)
732                         | (0U << 14U)
733                         | (1U << 15U)
734                         | (0U << 16U)
735                         | (1U << 17U)
736                         | (0U << 18U)
737                         | (0U << 19U)
738                         | (0U << 20U)
739                         | (1U << 21U)
740                         | (0U << 22U)
741                         | (0U << 23U)
742                         | (0U << 24U)
743                         | (0U << 25U)
744                         | (1U << 26U)
745                         | (0U << 27U)
746                         | (0U << 28U)
747                         | (0U << 29U)
748                         | (1U << 30U)
749                         | (0U << 31U);
750
751     vimREG->REQMASKSET1 = 0U
752                         | (0U << 1U)
753                         | (0U << 2U)
754                         | (0U << 3U)
755                         | (0U << 4U)
756                         | (1U << 5U)
757                         | (1U << 6U)
758                         | (0U << 7U)
759                         | (0U << 8U)
760                         | (0U << 9U)
761                         | (0U << 10U)
762                         | (0U << 11U)
763                         | (0U << 12U)
764                         | (0U << 13U)
765                         | (0U << 14U)
766                         | (0U << 15U)
767                         | (0U << 16U)
768                         | (1U << 17U)
769                         | (0U << 18U)
770                         | (1U << 19U)
771                         | (0U << 20U)
772                         | (1U << 21U)
773                         | (1U << 22U)
774                         | (0U << 23U)
775                         | (1U << 24U)
776                         | (0U << 25U)
777                         | (0U << 26U)
778                         | (0U << 27U)
779                         | (0U << 28U)
780                         | (0U << 29U)
781                         | (0U << 30U)
782                         | (0U << 31U);
783
784     vimREG->REQMASKSET2 = 1U
785                         | (0U << 1U)
786                         | (0U << 2U)
787                         | (0U << 3U)
788                         | (0U << 4U)
789                         | (0U << 5U)
790                         | (0U << 6U)
791                         | (0U << 7U)
792                         | (0U << 8U)
793                         | (0U << 9U)
794                         | (0U << 10U)
795                         | (0U << 11U)
796                         | (1U << 12U)       // MDIOMiscInt
797                         | (1U << 13U)       // EMACCore0TxIsr
798                         | (0U << 14U)
799                         | (1U << 15U)       // EMACCore0RxIsr
800                         | (0U << 16U)
801                         | (0U << 17U)
802                         | (0U << 18U)
803                         | (0U << 19U)
804                         | (0U << 20U)
805                         | (0U << 21U)
806                         | (0U << 22U)
807                         | (0U << 23U)
808                         | (0U << 24U)
809                         | (0U << 25U)
810                         | (0U << 26U)
811                         | (0U << 27U)
812                         | (0U << 28U)
813                         | (0U << 29U)
814                         | (0U << 30U)
815                         | (0U << 31U);
816
817     vimREG->REQMASKSET3 =  0U
818                         | (0U << 1U)
819                         | (0U << 2U)
820                         | (0U << 3U)
821                         | (0U << 4U)
822                         | (0U << 5U)
823                         | (0U << 6U)
824                         | (0U << 7U)
825                         | (0U << 8U)
826                         | (0U << 9U)
827                         | (0U << 10U)
828                         | (0U << 11U)
829                         | (0U << 12U)
830                         | (0U << 13U)
831                         | (0U << 14U)
832                         | (0U << 15U)
833                         | (0U << 16U)
834                         | (0U << 17U)
835                         | (0U << 18U)
836                         | (0U << 19U)
837                         | (0U << 20U)
838                         | (0U << 21U)
839                         | (0U << 22U)
840                         | (0U << 23U)
841                         | (0U << 24U)
842                         | (0U << 25U)
843                         | (0U << 26U)
844                         | (0U << 27U)
845                         | (0U << 28U)
846                         | (0U << 29U)
847                         | (0U << 30U)
848                         | (0U << 31U);
849
850     /* Configure system response to error conditions signaled to the ESM group1 */
851     /* This function can be configured from the ESM tab of HALCoGen */
852     esmInit();
853
854     /* initialize copy table */
855     __TI_auto_init();
856
857     /* call the application */
858     main();
859     exit();
860 }