1 /*!
2 * \file sysIrqHandlers.c
3 *
4 * \brief Default IRQ handlers
5 *
6 * \copyright Revised BSD License, see section \ref LICENSE.
7 *
8 * \code
9 * ______ _
10 * / _____) _ | |
11 * ( (____ _____ ____ _| |_ _____ ____| |__
12 * \____ \| ___ | (_ _) ___ |/ ___) _ \
13 * _____) ) ____| | | || |_| ____( (___| | | |
14 * (______/|_____)_|_|_| \__)_____)\____)_| |_|
15 * (C)2013-2017 Semtech
16 *
17 * \endcode
18 *
19 * \author Miguel Luis ( Semtech )
20 *
21 * \author Gregory Cristian ( Semtech )
22 */
23
24 /*!
25 * \brief This function handles NMI exception.
26 * \param None
27 * \retval None
28 */
NMI_Handler(void)29 void NMI_Handler( void )
30 {
31 }
32
33 /*!
34 * \brief This function handles Hard Fault exception.
35 * \param None
36 * \retval None
37 */
38 #if defined( HARD_FAULT_HANDLER_ENABLED )
HardFault_Handler_C(unsigned int * args)39 void HardFault_Handler_C( unsigned int *args )
40 {
41 volatile unsigned int stacked_r0;
42 volatile unsigned int stacked_r1;
43 volatile unsigned int stacked_r2;
44 volatile unsigned int stacked_r3;
45 volatile unsigned int stacked_r12;
46 volatile unsigned int stacked_lr;
47 volatile unsigned int stacked_pc;
48 volatile unsigned int stacked_psr;
49
50 stacked_r0 = ( ( unsigned long) args[0] );
51 stacked_r1 = ( ( unsigned long) args[1] );
52 stacked_r2 = ( ( unsigned long) args[2] );
53 stacked_r3 = ( ( unsigned long) args[3] );
54
55 stacked_r12 = ( ( unsigned long) args[4] );
56 stacked_lr = ( ( unsigned long) args[5] );
57 stacked_pc = ( ( unsigned long) args[6] );
58 stacked_psr = ( ( unsigned long) args[7] );
59
60 ( void )stacked_r0;
61 ( void )stacked_r1;
62 ( void )stacked_r2;
63 ( void )stacked_r3;
64
65 ( void )stacked_r12;
66 ( void )stacked_lr ;
67 ( void )stacked_pc ;
68 ( void )stacked_psr;
69
70 while( 1 );
71 }
72
73 #if defined(__CC_ARM)
HardFault_Handler(void)74 __asm void HardFault_Handler(void)
75 {
76 TST LR, #4
77 ITE EQ
78 MRSEQ r0, MSP
79 MRSNE r0, PSP
80 B __cpp(HardFault_Handler_C)
81 }
82 #elif defined(__ICCARM__)
HardFault_Handler(void)83 void HardFault_Handler(void)
84 {
85 __asm("TST LR, #4");
86 __asm("ITE EQ");
87 __asm("MRSEQ r0, MSP");
88 __asm("MRSNE r0, PSP");
89 __asm("B HardFault_Handler_C");
90 }
91 #elif defined(__GNUC__)
HardFault_Handler(void)92 void HardFault_Handler(void)
93 {
94 __asm volatile( "TST LR, #4" );
95 __asm volatile( "ITE EQ" );
96 __asm volatile( "MRSEQ R0, MSP" );
97 __asm volatile( "MRSNE R0, PSP" );
98 __asm volatile( "B HardFault_Handler_C" );
99 }
100 #else
101 #warning Not supported compiler type
102 #endif
103
104 #endif
105
106 /*!
107 * \brief This function handles Memory Manage exception.
108 * \param None
109 * \retval None
110 */
MemManage_Handler(void)111 void MemManage_Handler( void )
112 {
113 /* Go to infinite loop when Memory Manage exception occurs */
114 while ( 1 )
115 {
116 }
117 }
118
119 /*!
120 * \brief This function handles Bus Fault exception.
121 * \param None
122 * \retval None
123 */
BusFault_Handler(void)124 void BusFault_Handler( void )
125 {
126 /* Go to infinite loop when Bus Fault exception occurs */
127 while ( 1 )
128 {
129 }
130 }
131
132 /*!
133 * \brief This function handles Usage Fault exception.
134 * \param None
135 * \retval None
136 */
UsageFault_Handler(void)137 void UsageFault_Handler( void )
138 {
139 /* Go to infinite loop when Usage Fault exception occurs */
140 while ( 1 )
141 {
142 }
143 }
144
145 /*!
146 * \brief This function handles Debug Monitor exception.
147 * \param None
148 * \retval None
149 */
DebugMon_Handler(void)150 void DebugMon_Handler( void )
151 {
152 }
153