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