/* * Signal handler header * * written by Vangelis Rokas, 2005 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * * $Id: signal2.h,v 1.1.1.1 2005/11/18 05:33:58 pete Exp $ */ #ifndef __SIGNAL_H__ #define __SIGNAL_H__ #define SRBIF 0x0 #define SINT0IF 0x1 #define STMR0IF 0x2 #define SINT1IF 0x0 #define SINT2IF 0x1 #define STMR1IF 0x0 #define STMR2IF 0x1 #define SCCP1IF 0x2 #define SSSPIF 0x3 #define STXIF 0x4 #define SRCIF 0x5 #define SADIF 0x6 #define SPSPIF 0x7 #define SCCP2IF 0x0 #define STMR3IF 0x1 #define SLVDIF 0x2 #define SBCLIF 0x3 #define SEEIF 0x4 /* interrupt testing arguments */ #define SIG_RB _INTCON, SRBIF #define SIG_INT0 _INTCON, SINT0IF #define SIG_INT1 _INTCON3, SINT1IF #define SIG_INT2 _INTCON3, SINT2IF #define SIG_CCP1 _PIR1, SCCP1IF #define SIG_CCP2 _PIR2, SCCP2IF #define SIG_TMR0 _INTCON, STMR0IF #define SIG_TMR1 _PIR1, STMR1IF #define SIG_TMR2 _PIR1, STMR2IF #define SIG_TMR3 _PIR2, STMR3IF #define SIG_EE _PIR2, SEEIF #define SIG_BCOL _PIR2, SBCLIF #define SIG_LVD _PIR2, SLVDIF #define SIG_PSP _PIR1, SPSPIF #define SIG_AD _PIR1, SADIF #define SIG_RC _PIR1, SRCIF #define SIG_TX _PIR1, STXIF #define SIG_MSSP _PIR1, SSSPIF #define DEF_ABSVECTOR(vecno, name) \ void __ivt_ ## name(void) __interrupt vecno __naked \ {\ __asm \n\ goto _ ## name \n\ __endasm; \ } #define DEF_INTHIGH(name) \ DEF_ABSVECTOR(1, name) \ void name(void) __naked __interrupt \ {\ __asm \n #define DEF_INTLOW(name) \ DEF_ABSVECTOR(2, name) \ void name(void) __naked __interrupt \ {\ __asm \n #define END_DEF \ retfie \n\ __endasm;\ } #define DEF_HANDLER(sig, handler) \ btfsc sig \n\ goto _ ## handler #define SIGHANDLER(handler) void handler (void) __interrupt #define SIGHANDLERNAKED(handler) void handler (void) __naked __interrupt #endif /* __SIGNAL_H__ */