]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/src/sys/_rm48_hdk/sys_startup.c
Enable ethernet interrupts for all platforms
[pes-rpp/rpp-lib.git] / rpp / src / sys / _rm48_hdk / 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     &phantomInterrupt,
97 /*#if serialLine == scilinREG
98     &sciHighLevelinterrupt,
99 #else
100     &linHighLevelInterrupt,
101 #endif
102 */
103     &sciHighLevelInterrupt,
104     &phantomInterrupt,
105     &adc1Group1Interrupt,   // 15
106     &phantomInterrupt,
107     &phantomInterrupt,
108     &phantomInterrupt,
109     &phantomInterrupt,
110     &phantomInterrupt,      // 20
111     &vPortYeildWithinAPI, // Software interrupt
112     &phantomInterrupt,
113     &phantomInterrupt,
114     &phantomInterrupt,
115     &phantomInterrupt,      // 25
116     &phantomInterrupt,
117     &phantomInterrupt,
118     &phantomInterrupt,
119     &phantomInterrupt,
120     &phantomInterrupt, // 30
121     &phantomInterrupt,
122     &phantomInterrupt,
123     &phantomInterrupt,
124     &phantomInterrupt,
125     &phantomInterrupt,    // 35
126     &phantomInterrupt,
127     &phantomInterrupt,
128     &phantomInterrupt,
129     &phantomInterrupt,
130     &phantomInterrupt,      // 40
131     &phantomInterrupt,
132     &phantomInterrupt,
133     &phantomInterrupt,
134     &phantomInterrupt,
135     &phantomInterrupt,    // 45
136     &phantomInterrupt,
137     &phantomInterrupt,
138     &phantomInterrupt,
139     &phantomInterrupt,
140     &phantomInterrupt,      // 50
141     &adc2Group1Interrupt,
142     &phantomInterrupt,
143     &phantomInterrupt,
144     &phantomInterrupt,
145     &phantomInterrupt,      // 55
146     &phantomInterrupt,
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              , PBIST_March13N_DP);
454
455     /* Test the CPU ECC mechanism for RAM accesses.
456      * The checkBxRAMECC functions cause deliberate single-bit and double-bit errors in TCRAM accesses
457      * by corrupting 1 or 2 bits in the ECC. Reading from the TCRAM location with a 2-bit error
458      * in the ECC causes a data abort exception. The data abort handler is written to look for
459      * deliberately caused exception and to return the code execution to the instruction
460      * following the one that caused the abort.
461      */
462     checkB0RAMECC();
463     tcram1REG->RAMCTRL &= ~(0x00000100);                /* disable writes to ECC RAM */
464     tcram2REG->RAMCTRL &= ~(0x00000100);
465
466     checkB1RAMECC();
467     tcram1REG->RAMCTRL &= ~(0x00000100);                /* disable writes to ECC RAM */
468     tcram2REG->RAMCTRL &= ~(0x00000100);
469
470     /* Test the CPU ECC mechanism for Flash accesses.
471      * The checkFlashECC function uses the flash interface module's diagnostic mode 7
472      * to create single-bit and double-bit errors in CPU accesses to the flash. A double-bit
473      * error on reading from flash causes a data abort exception.
474      * The data abort handler is written to look for deliberately caused exception and
475      * to return the code execution to the instruction following the one that was aborted.
476      *
477      */
478     /*
479     checkFlashECC();
480     flashWREG->FDIAGCTRL = 0x000A0007; */                  /* disable flash diagnostic mode */
481
482     /* Wait for PBIST for CPU RAM to be completed */
483     while(!pbistIsTestCompleted());
484
485     /* Check if CPU RAM passed the self-test */
486     if( pbistIsTestPassed() != TRUE)
487     {
488         /* CPU RAM failed the self-test.
489          * Need custom handler to check the memory failure
490          * and to take the appropriate next step.
491          */
492         pbistFail();
493
494     }
495
496     /* Disable PBIST clocks and disable memory self-test mode */
497     pbistStop();
498
499     /* Release the MibSPI1 modules from local reset.
500      * This will cause the MibSPI1 RAMs to get initialized along with the parity memory.
501      */
502      mibspiREG1->GCR0 = 0x1;
503
504     /* Release the MibSPI3 modules from local reset.
505      * This will cause the MibSPI3 RAMs to get initialized along with the parity memory.
506      */
507     mibspiREG3->GCR0 = 0x1;
508
509     /* Release the MibSPI5 modules from local reset.
510      * This will cause the MibSPI5 RAMs to get initialized along with the parity memory.
511      */
512     mibspiREG5->GCR0 = 0x1;
513
514     /* Enable parity on selected RAMs */
515     enableParity();
516
517     /* Initialize all on-chip SRAMs except for MibSPIx RAMs
518      * The MibSPIx modules have their own auto-initialization mechanism which is triggered
519      * as soon as the modules are brought out of local reset.
520      */
521     /* The system module auto-init will hang on the MibSPI RAM if the module is still in local reset.
522      */
523     memoryInit(    1 << 1    /*   DMA Memory Init  */
524                  | 1 << 2    /*   VIM Memory Init  */
525                  | 1 << 5    /*   CAN1 Memory Init  */
526                  | 1 << 6    /*   CAN2 Memory Init  */
527                  | 1 << 10    /*   CAN3 Memory Init  */
528                  | 1 << 8    /*   ADC1 Memory Init  */
529                  | 1 << 14    /*   ADC2 Memory Init  */
530                  | 1 << 3    /*   HET1 Memory Init  */
531                  | 1 << 4    /*   HTU1 Memory Init  */
532                  | 1 << 15    /*   HET2 Memory Init  */
533                  | 1 << 16    /*   HTU2 Memory Init  */
534                  | 1 << 13);    /*   Reserved for RMx Family / FTU Memory Init for TMS570x Family */
535
536     /* Disable parity */
537     disableParity();
538
539     /* Test the parity protection mechanism for peripheral RAMs
540      * The following memories have parity protection that needs to be checked:
541      * VIM, DMA, ADC1, ADC2, NHET1, NHET2, HTU1, HTU2, FlexRay, FTU,
542      * MibSPI1, MibSPI3, MibSPI5, DCAN1, DCAN2, DCAN3 based on user selection
543      */
544     /* Test the parity protection mechanism for peripheral RAMs
545        NOTE : Please Refer DEVICE DATASHEET for the list of Supported Memories with parity.
546                  Parity Self check is perfomed only on the user selected memories in HALCoGen's GUI SAFETY INIT tab.
547     */
548
549
550     het1ParityCheck();
551     htu1ParityCheck();
552     het2ParityCheck();
553     htu2ParityCheck();
554     adc1ParityCheck();
555     adc2ParityCheck();
556     can1ParityCheck();
557     can2ParityCheck();
558     can3ParityCheck();
559     vimParityCheck();
560     dmaParityCheck();
561
562     while (mibspiREG1->BUFINIT);        /* wait for MibSPI1 RAM to complete initialization */
563     while (mibspiREG3->BUFINIT);        /* wait for MibSPI3 RAM to complete initialization */
564     while (mibspiREG5->BUFINIT);        /* wait for MibSPI5 RAM to complete initialization */
565
566     mibspi1ParityCheck();
567     mibspi3ParityCheck();
568     mibspi5ParityCheck();
569
570     /* Initialize VIM table */
571     {
572         uint32_t i;
573
574         for (i = 0; i < (VIM_CHANNELS + 1); i++)
575         {
576             vimRAM->ISR[i] = s_vim_init[i];
577         }
578     }
579
580     /* set IRQ/FIQ priorities */
581     vimREG->FIRQPR0 =  SYS_FIQ
582                     | (SYS_FIQ <<  1U)
583                     | (SYS_IRQ <<  2U)
584                     | (SYS_IRQ <<  3U)
585                     | (SYS_IRQ <<  4U)
586                     | (SYS_IRQ <<  5U)
587                     | (SYS_IRQ <<  6U)
588                     | (SYS_IRQ <<  7U)
589                     | (SYS_IRQ <<  8U)
590                     | (SYS_IRQ <<  9U)
591                     | (SYS_IRQ << 10U)
592                     | (SYS_IRQ << 11U)
593                     | (SYS_IRQ << 12U)
594                     | (SYS_IRQ << 13U)
595                     | (SYS_IRQ << 14U)
596                     | (SYS_IRQ << 15U)
597                     | (SYS_IRQ << 16U)
598                     | (SYS_IRQ << 17U)
599                     | (SYS_IRQ << 18U)
600                     | (SYS_IRQ << 19U)
601                     | (SYS_IRQ << 20U)
602                     | (SYS_IRQ << 21U)
603                     | (SYS_IRQ << 22U)
604                     | (SYS_IRQ << 23U)
605                     | (SYS_IRQ << 24U)
606                     | (SYS_IRQ << 25U)
607                     | (SYS_IRQ << 26U)
608                     | (SYS_IRQ << 27U)
609                     | (SYS_IRQ << 28U)
610                     | (SYS_IRQ << 29U)
611                     | (SYS_IRQ << 30U)
612                     | (SYS_IRQ << 31U);
613
614     vimREG->FIRQPR1 =  SYS_IRQ
615                     | (SYS_IRQ <<  1U)
616                     | (SYS_IRQ <<  2U)
617                     | (SYS_IRQ <<  3U)
618                     | (SYS_IRQ <<  4U)
619                     | (SYS_IRQ <<  5U)
620                     | (SYS_IRQ <<  6U)
621                     | (SYS_IRQ <<  7U)
622                     | (SYS_IRQ <<  8U)
623                     | (SYS_IRQ <<  9U)
624                     | (SYS_IRQ << 10U)
625                     | (SYS_IRQ << 11U)
626                     | (SYS_IRQ << 12U)
627                     | (SYS_IRQ << 13U)
628                     | (SYS_IRQ << 14U)
629                     | (SYS_IRQ << 15U)
630                     | (SYS_IRQ << 16U)
631                     | (SYS_IRQ << 17U)
632                     | (SYS_IRQ << 18U)
633                     | (SYS_IRQ << 19U)
634                     | (SYS_IRQ << 20U)
635                     | (SYS_IRQ << 21U)
636                     | (SYS_IRQ << 22U)
637                     | (SYS_IRQ << 23U)
638                     | (SYS_IRQ << 24U)
639                     | (SYS_IRQ << 25U)
640                     | (SYS_IRQ << 26U)
641                     | (SYS_IRQ << 27U)
642                     | (SYS_IRQ << 28U)
643                     | (SYS_IRQ << 29U)
644                     | (SYS_IRQ << 30U)
645                     | (SYS_IRQ << 31U);
646
647
648     vimREG->FIRQPR2 =  SYS_IRQ
649                     | (SYS_IRQ << 1U)
650                     | (SYS_IRQ << 2U)
651                     | (SYS_IRQ << 3U)
652                     | (SYS_IRQ << 4U)
653                     | (SYS_IRQ << 5U)
654                     | (SYS_IRQ << 6U)
655                     | (SYS_IRQ << 7U)
656                     | (SYS_IRQ << 8U)
657                     | (SYS_IRQ << 9U)
658                     | (SYS_IRQ << 10U)
659                     | (SYS_IRQ << 11U)
660                     | (SYS_IRQ << 12U)  // MDIOMiscInt
661                     | (SYS_IRQ << 13U)  // EMAC
662                     | (SYS_IRQ << 14U)
663                     | (SYS_IRQ << 15U)  // EMAC
664                     | (SYS_IRQ << 16U)
665                     | (SYS_IRQ << 17U)
666                     | (SYS_IRQ << 18U)
667                     | (SYS_IRQ << 19U)
668                     | (SYS_IRQ << 20U)
669                     | (SYS_IRQ << 21U)
670                     | (SYS_IRQ << 22U)
671                     | (SYS_IRQ << 23U)
672                     | (SYS_IRQ << 24U)
673                     | (SYS_IRQ << 25U)
674                     | (SYS_IRQ << 26U)
675                     | (SYS_IRQ << 27U)
676                     | (SYS_IRQ << 28U)
677                     | (SYS_IRQ << 29U)
678                     | (SYS_IRQ << 30U)
679                     | (SYS_IRQ << 31U);
680
681     vimREG->FIRQPR3 =  SYS_IRQ
682                     | (SYS_IRQ << 1U)
683                     | (SYS_IRQ << 2U)
684                     | (SYS_IRQ << 3U)
685                     | (SYS_IRQ << 4U)
686                     | (SYS_IRQ << 5U)
687                     | (SYS_IRQ << 6U)
688                     | (SYS_IRQ << 7U)
689                     | (SYS_IRQ << 8U)
690                     | (SYS_IRQ << 9U)
691                     | (SYS_IRQ << 10U)
692                     | (SYS_IRQ << 11U)
693                     | (SYS_IRQ << 12U)
694                     | (SYS_IRQ << 13U)
695                     | (SYS_IRQ << 14U)
696                     | (SYS_IRQ << 15U)
697                     | (SYS_IRQ << 16U)
698                     | (SYS_IRQ << 17U)
699                     | (SYS_IRQ << 18U)
700                     | (SYS_IRQ << 19U)
701                     | (SYS_IRQ << 20U)
702                     | (SYS_IRQ << 21U)
703                     | (SYS_IRQ << 22U)
704                     | (SYS_IRQ << 23U)
705                     | (SYS_IRQ << 24U)
706                     | (SYS_IRQ << 25U)
707                     | (SYS_IRQ << 26U)
708                     | (SYS_IRQ << 27U)
709                     | (SYS_IRQ << 28U)
710                     | (SYS_IRQ << 29U)
711                     | (SYS_IRQ << 30U)
712                     | (SYS_IRQ << 31U);
713
714
715     /* enable interrupts */
716     vimREG->REQMASKSET0 = 1U
717                         | (1U << 1U)
718                         | (1U << 2U)
719                         | (0U << 3U)
720                         | (0U << 4U)
721                         | (0U << 5U)
722                         | (0U << 6U)
723                         | (0U << 7U)
724                         | (0U << 8U)
725                         | (0U << 9U)
726                         | (0U << 10U)
727                         | (0U << 11U)
728                         | (1U << 12U)
729                         | (1U << 13U)
730                         | (0U << 14U)
731                         | (1U << 15U)
732                         | (0U << 16U)
733                         | (1U << 17U)
734                         | (0U << 18U)
735                         | (0U << 19U)
736                         | (0U << 20U)
737                         | (1U << 21U)
738                         | (0U << 22U)
739                         | (0U << 23U)
740                         | (0U << 24U)
741                         | (0U << 25U)
742                         | (1U << 26U)
743                         | (0U << 27U)
744                         | (0U << 28U)
745                         | (0U << 29U)
746                         | (1U << 30U)
747                         | (0U << 31U);
748
749     vimREG->REQMASKSET1 = 0U
750                         | (0U << 1U)
751                         | (0U << 2U)
752                         | (0U << 3U)
753                         | (0U << 4U)
754                         | (1U << 5U)
755                         | (1U << 6U)
756                         | (0U << 7U)
757                         | (0U << 8U)
758                         | (0U << 9U)
759                         | (0U << 10U)
760                         | (0U << 11U)
761                         | (0U << 12U)
762                         | (0U << 13U)
763                         | (0U << 14U)
764                         | (0U << 15U)
765                         | (0U << 16U)
766                         | (1U << 17U)
767                         | (0U << 18U)
768                         | (1U << 19U)
769                         | (0U << 20U)
770                         | (0U << 21U)
771                         | (1U << 22U)
772                         | (0U << 23U)
773                         | (0U << 24U)
774                         | (0U << 25U)
775                         | (0U << 26U)
776                         | (0U << 27U)
777                         | (0U << 28U)
778                         | (0U << 29U)
779                         | (0U << 30U)
780                         | (0U << 31U);
781
782     vimREG->REQMASKSET2 = 1U
783                         | (0U << 1U)
784                         | (0U << 2U)
785                         | (0U << 3U)
786                         | (0U << 4U)
787                         | (0U << 5U)
788                         | (0U << 6U)
789                         | (0U << 7U)
790                         | (0U << 8U)
791                         | (0U << 9U)
792                         | (0U << 10U)
793                         | (0U << 11U)
794                         | (1U << 12U)       // MDIOMiscInt
795                         | (1U << 13U)       // EMACCore0TxIsr
796                         | (0U << 14U)
797                         | (1U << 15U)       // EMACCore0RxIsr
798                         | (0U << 16U)
799                         | (0U << 17U)
800                         | (0U << 18U)
801                         | (0U << 19U)
802                         | (0U << 20U)
803                         | (0U << 21U)
804                         | (0U << 22U)
805                         | (0U << 23U)
806                         | (0U << 24U)
807                         | (0U << 25U)
808                         | (0U << 26U)
809                         | (0U << 27U)
810                         | (0U << 28U)
811                         | (0U << 29U)
812                         | (0U << 30U)
813                         | (0U << 31U);
814
815     vimREG->REQMASKSET3 =  0U
816                         | (0U << 1U)
817                         | (0U << 2U)
818                         | (0U << 3U)
819                         | (0U << 4U)
820                         | (0U << 5U)
821                         | (0U << 6U)
822                         | (0U << 7U)
823                         | (0U << 8U)
824                         | (0U << 9U)
825                         | (0U << 10U)
826                         | (0U << 11U)
827                         | (0U << 12U)
828                         | (0U << 13U)
829                         | (0U << 14U)
830                         | (0U << 15U)
831                         | (0U << 16U)
832                         | (0U << 17U)
833                         | (0U << 18U)
834                         | (0U << 19U)
835                         | (0U << 20U)
836                         | (0U << 21U)
837                         | (0U << 22U)
838                         | (0U << 23U)
839                         | (0U << 24U)
840                         | (0U << 25U)
841                         | (0U << 26U)
842                         | (0U << 27U)
843                         | (0U << 28U)
844                         | (0U << 29U)
845                         | (0U << 30U)
846                         | (0U << 31U);
847
848     /* Configure system response to error conditions signaled to the ESM group1 */
849     /* This function can be configured from the ESM tab of HALCoGen */
850     esmInit();
851
852     /* initialize copy table */
853     __TI_auto_init();
854
855     /* call the application */
856     main();
857     exit();
858 }