dsPid33
src/traps.c
Go to the documentation of this file.
00001 /**********************************************************************
00002 * � 2005 Microchip Technology Inc.
00003 *
00004 * FileName:        traps.c
00005 * Dependencies:    Header (.h) files if applicable, see below
00006 * Processor:       dsPIC33Fxxxx/PIC24Hxxxx
00007 * Compiler:        MPLAB� C30 v3.00 or higher
00008 *
00009 * SOFTWARE LICENSE AGREEMENT:
00010 * Microchip Technology Incorporated ("Microchip") retains all ownership and 
00011 * intellectual property rights in the code accompanying this message and in all 
00012 * derivatives hereto.  You may use this code, and any derivatives created by 
00013 * any person or entity by or on your behalf, exclusively with Microchip's
00014 * proprietary products.  Your acceptance and/or use of this code constitutes 
00015 * agreement to the terms and conditions of this notice.
00016 *
00017 * CODE ACCOMPANYING THIS MESSAGE IS SUPPLIED BY MICROCHIP "AS IS".  NO 
00018 * WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED 
00019 * TO, IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A 
00020 * PARTICULAR PURPOSE APPLY TO THIS CODE, ITS INTERACTION WITH MICROCHIP'S 
00021 * PRODUCTS, COMBINATION WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION. 
00022 *
00023 * YOU ACKNOWLEDGE AND AGREE THAT, IN NO EVENT, SHALL MICROCHIP BE LIABLE, WHETHER 
00024 * IN CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE OR BREACH OF STATUTORY DUTY), 
00025 * STRICT LIABILITY, INDEMNITY, CONTRIBUTION, OR OTHERWISE, FOR ANY INDIRECT, SPECIAL, 
00026 * PUNITIVE, EXEMPLARY, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, FOR COST OR EXPENSE OF 
00027 * ANY KIND WHATSOEVER RELATED TO THE CODE, HOWSOEVER CAUSED, EVEN IF MICROCHIP HAS BEEN 
00028 * ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE.  TO THE FULLEST EXTENT 
00029 * ALLOWABLE BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO 
00030 * THIS CODE, SHALL NOT EXCEED THE PRICE YOU PAID DIRECTLY TO MICROCHIP SPECIFICALLY TO 
00031 * HAVE THIS CODE DEVELOPED.
00032 *
00033 * You agree that you are solely responsible for testing the code and 
00034 * determining its suitability.  Microchip has no obligation to modify, test, 
00035 * certify, or support the code.
00036 *
00037 * REVISION HISTORY:
00038 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00039 * Author            Date      Comments on this revision
00040 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00041 * Settu D                       07/09/06  First release of source file
00042 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00043 *
00044 * ADDITIONAL NOTES:
00045 * 1. This file contains trap service routines (handlers) for hardware
00046 *    exceptions generated by the dsPIC33F device.
00047 * 2. All trap service routines in this file simply ensure that device
00048 *    continuously executes code within the trap service routine. Users
00049 *    may modify the basic framework provided here to suit to the needs
00050 *    of their application.
00051 *
00052 **********************************************************************/
00053 
00054 #if defined(__dsPIC33F__)
00055 #include "p33fxxxx.h"
00056 #elif defined(__PIC24H__)
00057 #include "p24hxxxx.h"
00058 #endif
00059 
00060 void __attribute__((__interrupt__)) _OscillatorFail(void);
00061 void __attribute__((__interrupt__)) _AddressError(void);
00062 void __attribute__((__interrupt__)) _StackError(void);
00063 void __attribute__((__interrupt__)) _MathError(void);
00064 void __attribute__((__interrupt__)) _DMACError(void);
00065 
00066 void __attribute__((__interrupt__)) _AltOscillatorFail(void);
00067 void __attribute__((__interrupt__)) _AltAddressError(void);
00068 void __attribute__((__interrupt__)) _AltStackError(void);
00069 void __attribute__((__interrupt__)) _AltMathError(void);
00070 void __attribute__((__interrupt__)) _AltDMACError(void);
00071 
00072 /*
00073 Primary Exception Vector handlers:
00074 These routines are used if INTCON2bits.ALTIVT = 0.
00075 All trap service routines in this file simply ensure that device
00076 continuously executes code within the trap service routine. Users
00077 may modify the basic framework provided here to suit to the needs
00078 of their application.
00079 */
00080 void __attribute__((interrupt, no_auto_psv)) _OscillatorFail(void)
00081 {
00082         INTCON1bits.OSCFAIL = 0;        //Clear the trap flag
00083         while (1);
00084 }
00085 
00086 void __attribute__((interrupt, no_auto_psv)) _AddressError(void)
00087 {
00088         INTCON1bits.ADDRERR = 0;        //Clear the trap flag
00089         while (1);
00090 }
00091 void __attribute__((interrupt, no_auto_psv)) _StackError(void)
00092 {
00093         INTCON1bits.STKERR = 0;         //Clear the trap flag
00094         while (1);
00095 }
00096 
00097 void __attribute__((interrupt, no_auto_psv)) _MathError(void)
00098 {
00099         INTCON1bits.MATHERR = 0;        //Clear the trap flag
00100         while (1);
00101 }
00102 
00103 void __attribute__((interrupt, no_auto_psv)) _DMACError(void)
00104 {
00105         INTCON1bits.DMACERR = 0;        //Clear the trap flag
00106         while (1);
00107 }
00108 
00109 
00110 
00111 
00112 
00113 /*
00114 Alternate Exception Vector handlers:
00115 These routines are used if INTCON2bits.ALTIVT = 1.
00116 All trap service routines in this file simply ensure that device
00117 continuously executes code within the trap service routine. Users
00118 may modify the basic framework provided here to suit to the needs
00119 of their application.
00120 */
00121 
00122 void __attribute__((interrupt, no_auto_psv)) _AltOscillatorFail(void)
00123 {
00124         INTCON1bits.OSCFAIL = 0;
00125         while (1);
00126 }
00127 
00128 void __attribute__((interrupt, no_auto_psv)) _AltAddressError(void)
00129 {
00130         INTCON1bits.ADDRERR = 0;
00131         while (1);
00132 }
00133 
00134 void __attribute__((interrupt, no_auto_psv)) _AltStackError(void)
00135 {
00136         INTCON1bits.STKERR = 0;
00137         while (1);
00138 }
00139 
00140 void __attribute__((interrupt, no_auto_psv)) _AltMathError(void)
00141 {
00142         INTCON1bits.MATHERR = 0;
00143         while (1);
00144 }
00145 
00146 void __attribute__((interrupt, no_auto_psv)) _AltDMACError(void)
00147 {
00148         INTCON1bits.DMACERR = 0;        //Clear the trap flag
00149         while (1);
00150 }
00151 
 All Data Structures Files Functions Variables Defines