00001 /* Copyright (c) 2002,2007 Marek Michalkiewicz 00002 All rights reserved. 00003 00004 Redistribution and use in source and binary forms, with or without 00005 modification, are permitted provided that the following conditions are met: 00006 00007 * Redistributions of source code must retain the above copyright 00008 notice, this list of conditions and the following disclaimer. 00009 00010 * Redistributions in binary form must reproduce the above copyright 00011 notice, this list of conditions and the following disclaimer in 00012 the documentation and/or other materials provided with the 00013 distribution. 00014 00015 * Neither the name of the copyright holders nor the names of 00016 contributors may be used to endorse or promote products derived 00017 from this software without specific prior written permission. 00018 00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00020 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00021 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00022 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00023 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00024 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00025 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00026 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00027 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00028 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00029 POSSIBILITY OF SUCH DAMAGE. */ 00030 00031 /* $Id: setjmp.h,v 1.10.2.1 2008/03/24 11:29:53 dmix Exp $ */ 00032 00033 #ifndef __SETJMP_H_ 00034 #define __SETJMP_H_ 1 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00040 /* 00041 jmp_buf: 00042 offset size description 00043 0 16 call-saved registers (r2-r17) 00044 16 2 frame pointer (r29:r28) 00045 18 2 stack pointer (SPH:SPL) 00046 20 1 status register (SREG) 00047 21 2/3 return address (PC) (2 bytes used for <=128Kw flash) 00048 23/24 = total size 00049 */ 00050 00051 #if !defined(__DOXYGEN__) 00052 00053 #if defined(__AVR_3_BYTE_PC__) && __AVR_3_BYTE_PC__ 00054 # define _JBLEN 24 00055 #else 00056 # define _JBLEN 23 00057 #endif 00058 typedef struct _jmp_buf { unsigned char _jb[_JBLEN]; } jmp_buf[1]; 00059 00060 #endif /* not __DOXYGEN__ */ 00061 00115 #ifndef __ATTR_NORETURN__ 00116 #define __ATTR_NORETURN__ __attribute__((__noreturn__)) 00117 #endif 00118 00134 extern int setjmp(jmp_buf __jmpb); 00135 00154 extern void longjmp(jmp_buf __jmpb, int __ret) __ATTR_NORETURN__; 00155 00156 #ifdef __cplusplus 00157 } 00158 #endif 00159 00160 #endif /* !__SETJMP_H_ */