1 /* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
\r
3 /*This file is prepared for Doxygen automatic documentation generation.*/
\r
4 /*! \file *********************************************************************
\r
6 * \brief NEWLIB_ADDONS exceptions include file for AVR32.
\r
8 * - Compiler: GNU GCC for AVR32
\r
9 * - Supported devices: All AVR32 devices can be used.
\r
12 * \author Atmel Corporation: http://www.atmel.com \n
\r
13 * Support and FAQ: http://support.atmel.no/
\r
15 ******************************************************************************/
\r
17 /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
\r
19 * Redistribution and use in source and binary forms, with or without
\r
20 * modification, are permitted provided that the following conditions are met:
\r
22 * 1. Redistributions of source code must retain the above copyright notice, this
\r
23 * list of conditions and the following disclaimer.
\r
25 * 2. Redistributions in binary form must reproduce the above copyright notice,
\r
26 * this list of conditions and the following disclaimer in the documentation
\r
27 * and/or other materials provided with the distribution.
\r
29 * 3. The name of Atmel may not be used to endorse or promote products derived
\r
30 * from this software without specific prior written permission.
\r
32 * 4. This software may only be redistributed and used in connection with an Atmel
\r
35 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
\r
36 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
37 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
\r
38 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
\r
39 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
\r
40 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
\r
41 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
\r
42 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
\r
43 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
\r
44 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
\r
48 #ifndef __AVR32_NEWLIB_ADDONS_EXCEPTIONS_H__
\r
49 #define __AVR32_NEWLIB_ADDONS_EXCEPTIONS_H__
\r
56 Exception vector offsets
\r
58 #define EVBA_UNRECOVERABLE 0x000
\r
59 #define EVBA_TLB_MULTIPLE 0x004
\r
60 #define EVBA_BUS_ERROR_DATA 0x008
\r
61 #define EVBA_BUS_ERROR_INSTR 0x00C
\r
62 #define EVBA_NMI 0x010
\r
63 #define EVBA_INSTR_ADDR 0x014
\r
64 #define EVBA_ITLB_MISS 0x050
\r
65 #define EVBA_ITLB_PROT 0x018
\r
66 #define EVBA_BREAKPOINT 0x01C
\r
67 #define EVBA_ILLEGAL_OPCODE 0x020
\r
68 #define EVBA_UNIMPLEMENTED 0x024
\r
69 #define EVBA_PRIVILEGE_VIOL 0x028
\r
70 #define EVBA_FLOATING_POINT 0x02C
\r
71 #define EVBA_COP_ABSENT 0x030
\r
72 #define EVBA_SCALL 0x100
\r
73 #define EVBA_DATA_ADDR_R 0x034
\r
74 #define EVBA_DATA_ADDR_W 0x038
\r
75 #define EVBA_DTLB_MISS_R 0x060
\r
76 #define EVBA_DTLB_MISS_W 0x070
\r
77 #define EVBA_DTLB_PROT_R 0x03C
\r
78 #define EVBA_DTLB_PROT_W 0x040
\r
79 #define EVBA_DTLB_MODIFIED 0x044
\r
83 Define the form of the function used when registering exceptions.
\r
84 The function should return the address which the exception should
\r
85 return to after the exception processing.
\r
88 typedef unsigned int (*__exception_handler)(int /*evba_offset*/, int /*return address*/);
\r
91 Define the form of the function used when registering a scall handler.
\r
94 typedef void (*__scall_handler)(int /*code*/, int /*p1*/, int /*p2*/
\r
95 , int /*p3*/, int /*p4*/);
\r
98 Function for registering an exception handler for the exception with
\r
99 offset given by evba_offset.
\r
101 void _register_exception_handler(__exception_handler handler, int evba_offset);
\r
104 Function for registering a scall handler which can be a arbirary
\r
105 function which uses r8-r12 for parameters.
\r
107 void _register_scall_handler(__scall_handler handler);
\r
110 Initialize exceptions. Must be called before registering exception handlers
\r
111 and needed to enable exceptions. 'evba' is the pointer to the exception
\r
112 vector. 'handler_table' is a pointer to an array where the pointers to
\r
113 the exception handlers are stored. This array must be at least 0x104 bytes
\r
116 void init_exceptions(void *evba, void *handler_table);
\r