1 /* This source file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
2
3 /*! \page License
4 * Copyright (C) 2009, H&D Wireless AB All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 *
16 * 3. The name of H&D Wireless AB may not be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY H&D WIRELESS AB ``AS IS'' AND ANY EXPRESS OR IMPLIED
20 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
22 * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 #include "startup.h"
31 #include "pm.h"
32 #include "intc.h"
33 #include "board.h"
34 #include "print_funcs.h"
35 #include "clocks.h"
36
37
init_exceptions(void)38 static void init_exceptions(void)
39 {
40 extern void _evba;
41 Set_system_register(AVR32_EVBA, (int)&_evba);
42 Enable_global_exception();
43 }
44
init_hmatrix(void)45 static void init_hmatrix(void)
46 {
47 union {
48 unsigned long scfg;
49 avr32_hmatrix_scfg_t SCFG;
50 } u_avr32_hmatrix_scfg = {
51 AVR32_HMATRIX.scfg[AVR32_HMATRIX_SLAVE_FLASH]
52 };
53 u_avr32_hmatrix_scfg.SCFG.defmstr_type =
54 AVR32_HMATRIX_DEFMSTR_TYPE_LAST_DEFAULT;
55 AVR32_HMATRIX.scfg[AVR32_HMATRIX_SLAVE_FLASH] =
56 u_avr32_hmatrix_scfg.scfg;
57 }
58
init_interrupts(void)59 static void init_interrupts(void)
60 {
61 INTC_init_interrupts();
62
63 //initExtInt();
64
65 Enable_global_interrupt();
66 }
67
startup_init(void)68 void startup_init(void)
69 {
70 init_exceptions();
71 init_hmatrix();
72 init_sys_clocks();
73 init_interrupts();
74 init_dbg_rs232(FPBA_HZ);
75 }
76