[processor-sdk/performance-audio-sr.git] / pdk_k2g_1_0_1_0_eng / packages / ti / csl / arch / a15 / src / intvec.c
1 /* =============================================================================
2 * Copyright (c) Texas Instruments Incorporated 2013
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the
14 * distribution.
15 *
16 * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
34 /*
35 * \file intvec.c
36 *
37 * \brief Configures the PLL registers to achieve the required Operating
38 * frequency. Power and sleep controller is activated for UART and
39 * Interuppt controller. Interrupt vector is copied to the shared Ram.
40 * After doing all the above, controller is given to the application.
41 *
42 */
44 /* ========================================================================== */
45 /* Include Files */
46 /* ========================================================================== */
47 #include <stdint.h>
48 #include <ti/csl/arch/csl_arch.h>
49 #include <ti/csl/csl_a15.h>
50 #include <interrupt.h>
52 /* ========================================================================== */
53 /* Macros & Typedefs */
54 /* ========================================================================== */
55 #define E_PASS (0)
56 #define E_FAIL (-1)
58 /* ========================================================================== */
59 /* External Function Declarations */
60 /* ========================================================================== */
61 extern void _c_int00(void);
62 extern void UndefInstHandler(void);
63 extern void SVCHandler(void);
64 extern void AbortHandler(void);
65 extern void IRQHandler(void);
66 extern void FIQHandler(void);
68 /* ========================================================================== */
69 /* Internal Function Declarations */
70 /* ========================================================================== */
71 void CopyVectorTable(void);
73 /* ========================================================================== */
74 /* Global Variables */
75 /* ========================================================================== */
76 #if defined (SOC_TDA2XX) || defined (SOC_AM572x) || defined (SOC_DRA7XX)
77 const uint32_t TDA2XX_VECTOR_BASE = 0x40410000U;
78 #elif (defined (SOC_TDA2EX) || defined (SOC_AM571x))
79 const uint32_t TDA2XX_VECTOR_BASE = 0x40300100U;
80 #endif
82 void _c_int00(void)
83 {}
85 static uint32_t const vecTbl[14] =
86 {
87 0xE59FF018U,
88 0xE59FF018U,
89 0xE59FF018U,
90 0xE59FF018U,
91 0xE59FF014U,
92 0xE24FF008U,
93 0xE59FF010U,
94 0xE59FF010U,
95 (uint32_t) (&_c_int00),
96 (uint32_t) (&UndefInstHandler),
97 (uint32_t) (&SVCHandler),
98 (uint32_t) (&AbortHandler),
99 (uint32_t) (&IRQHandler),
100 (uint32_t) (&FIQHandler)
101 };
103 /* ========================================================================== */
104 /* Function Definitions */
105 /* ========================================================================== */
106 void CopyVectorTable(void)
107 {
108 uint32_t *dest = (uint32_t *) TDA2XX_VECTOR_BASE;
109 uint32_t *src = (uint32_t *) vecTbl;
110 uint32_t count;
112 /*
113 * Setting base address of the exception vector table has to be done
114 * in priviledge mode.
115 *
116 * This is done from SBL
117 *
118 */
119 CSL_a15VectorBaseAddrSet(TDA2XX_VECTOR_BASE);
121 for (count = 0; count < (sizeof (vecTbl) / sizeof (vecTbl[0])); count++)
122 {
123 dest[count] = src[count];
124 }
125 }
126 /***************************** End Of File ***********************************/