Subversion Repositories NaviCtrl

Rev

Rev 24 | Rev 81 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 24 Rev 41
Line 52... Line 52...
52
// +  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
52
// +  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
53
// +  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53
// +  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54
// +  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
54
// +  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
55
// +  POSSIBILITY OF SUCH DAMAGE. 
55
// +  POSSIBILITY OF SUCH DAMAGE. 
56
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
 
57
#include "91x_lib.h"
-
 
58
#include "usb_lib.h"
-
 
59
#include "fat16.h"
57
#include "main.h"
60
#include "main.h"
58
 
-
 
-
 
61
#include "uart1.h"
59
#define global extern   /* to declare external variables and functions      */
62
#define global extern   /* to declare external variables and functions      */
Line 60... Line 63...
60
 
63
 
Line 61... Line 64...
61
extern void USB_Istr(void);
64
extern void USB_Istr(void);
Line 66... Line 69...
66
void Undefined_Handler (void) __attribute__ ((interrupt ("UNDEF")));
69
void Undefined_Handler (void) __attribute__ ((interrupt ("UNDEF")));
67
void FIQ_Handler (void)       __attribute__ ((interrupt ("FIQ")));
70
void FIQ_Handler (void)       __attribute__ ((interrupt ("FIQ")));
Line 68... Line 71...
68
 
71
 
69
void Dummy_Handler(void)
72
void Dummy_Handler(void)
70
{
73
{
71
VIC0->VAR = 0xFF;
74
        VIC0->VAR = 0xFF;
72
VIC1->VAR = 0XFF;
75
        VIC1->VAR = 0xFF;
Line -... Line 76...
-
 
76
}
73
}
77
 
74
 
78
/* avoid the surprising reset-like behaviour by spurious interrupts */
75
void InitInterrupt(void)
79
void Interrupt_Init(void)
76
{
80
{
77
  VIC0->DVAR = (u32)Dummy_Handler;
81
  VIC0->DVAR = (u32)Dummy_Handler;
-
 
82
  VIC1->DVAR = (u32)Dummy_Handler;
-
 
83
}
-
 
84
/*******************************************************************************
-
 
85
* Function Name  : SWI_Handler
-
 
86
* Description    : This function handles SW exception.
-
 
87
* Input          : None
78
  VIC1->DVAR = (u32)Dummy_Handler;
-
 
-
 
88
* Output         : None
79
}
89
* Return         : None
80
 
90
*******************************************************************************/
81
void SWI_Handler (void)
91
void SWI_Handler (void)
Line -... Line 92...
-
 
92
{
-
 
93
}
-
 
94
               
-
 
95
/*******************************************************************************
-
 
96
* Function Name  : Abort_Handler
-
 
97
* Description    : This function handles data abort exception.
82
{
-
 
-
 
98
* Input          : None
83
}
99
* Output         : None
84
               
100
* Return         : None
-
 
101
*******************************************************************************/
-
 
102
void Abort_Handler (void)
-
 
103
{
-
 
104
        SerialPutString("\r\nAbort Handler");
-
 
105
        while(1)
85
 
106
        {
Line -... Line 107...
-
 
107
        // infinite loop
-
 
108
        }
-
 
109
}
-
 
110
 
-
 
111
/*******************************************************************************
-
 
112
* Function Name  : Undefined_Handler
-
 
113
* Description    : This function handles undefined instruction exception.
86
void Abort_Handler (void)
114
* Input          : None
87
{
115
* Output         : None
-
 
116
* Return         : None
-
 
117
*******************************************************************************/
-
 
118
void Undefined_Handler (void)
-
 
119
{
-
 
120
        SerialPutString("\r\nUndefined Handler");
88
}
121
        while(1)
-
 
122
        {
-
 
123
        // infinite loop
-
 
124
        }
-
 
125
}
-
 
126
/*******************************************************************************
-
 
127
* Function Name  : FIQ_Handler
89
 
-
 
-
 
128
* Description    : This function handles FIQ exception.
90
void Undefined_Handler (void)
129
* Input          : None
91
{
130
* Output         : None
92
}
131
* Return         : None
93
 
132
*******************************************************************************/
94
void FIQ_Handler (void)
133
void FIQ_Handler (void)
95
{
134
{
96
}
135
}
97
/*******************************************************************************
136
/*******************************************************************************
98
* Function Name  : Prefetch_Handler
137
* Function Name  : Prefetch_Handler
-
 
138
* Description    : This function handles preftetch abort exception.
-
 
139
*******************************************************************************/
-
 
140
void Prefetch_Handler(void)
-
 
141
{
-
 
142
        SerialPutString("\r\nPrefetch Handler");
99
* Description    : This function handles preftetch abort exception.
143
        while(1)
100
*******************************************************************************/
144
        {
101
void Prefetch_Handler(void)
145
        // infinite loop
102
{
146
        }
103
}
147
}
104
/*******************************************************************************
148
/*******************************************************************************
105
* Function Name  : WDG_IRQHandler
149
* Function Name  : WDG_IRQHandler
-
 
150
* Description    : This function handles the WDG interrupt request
-
 
151
*******************************************************************************/
-
 
152
void WDG_IRQHandler(void)
-
 
153
{
-
 
154
   /*write your handler here*/
-
 
155
   /* ... */
106
* Description    : This function handles the WDG interrupt request
156
           
107
*******************************************************************************/
157
   
108
void WDG_IRQHandler(void)
158
   /*write any value to VIC0 VAR*/  
109
{
159
   VIC0->VAR = 0xFF;
110
}
160
}
111
/*******************************************************************************
161
/*******************************************************************************
112
* Function Name  : SW_IRQHandler
162
* Function Name  : SW_IRQHandler
-
 
163
* Description    : This function handles the SW interrupt request
-
 
164
*******************************************************************************/
-
 
165
void SW_IRQHandler(void)
-
 
166
{
-
 
167
        /*write your handler here*/
-
 
168
        /* ... */
113
* Description    : This function handles the SW interrupt request
169
       
114
*******************************************************************************/
170
       
115
void SW_IRQHandler(void)
171
        /*write any value to VIC0 VAR*/  
116
{
172
        VIC0->VAR = 0xFF;
117
}
173
}
118
/*******************************************************************************
174
/*******************************************************************************
119
* Function Name  : ARMRX_IRQHandler
175
* Function Name  : ARMRX_IRQHandler
-
 
176
* Description    : This function handles the ARMRX interrupt request
-
 
177
*******************************************************************************/
-
 
178
void ARMRX_IRQHandler(void)
-
 
179
{
-
 
180
        /*write your handler here*/
-
 
181
        /* ... */
120
* Description    : This function handles the ARMRX interrupt request
182
               
121
*******************************************************************************/
183
       
122
void ARMRX_IRQHandler(void)
184
        /*write any value to VIC0 VAR*/  
123
{
185
        VIC0->VAR = 0xFF;
124
}
186
}
125
/*******************************************************************************
187
/*******************************************************************************
126
* Function Name  : ARMTX_IRQHandler
188
* Function Name  : ARMTX_IRQHandler
-
 
189
* Description    : This function handles the ARMTX interrupt request
-
 
190
*******************************************************************************/
-
 
191
void ARMTX_IRQHandler(void)
-
 
192
{
-
 
193
        /*write your handler here*/
-
 
194
        /* ... */
127
* Description    : This function handles the ARMTX interrupt request
195
           
128
*******************************************************************************/
196
       
129
void ARMTX_IRQHandler(void)
197
        /*write any value to VIC0 VAR*/  
130
{
198
        VIC0->VAR = 0xFF;
131
}
199
}
132
/*******************************************************************************
200
/*******************************************************************************
133
* Function Name  : TIM0_IRQHandler
201
* Function Name  : TIM0_IRQHandler
-
 
202
* Description    : This function handles the TIM0 interrupt request
-
 
203
*******************************************************************************/
-
 
204
void TIM0_IRQHandler(void)
-
 
205
{
-
 
206
        /*write your handler here*/
-
 
207
        /* ... */
134
* Description    : This function handles the TIM0 interrupt request
208
               
135
*******************************************************************************/
209
       
136
void TIM0_IRQHandler(void)
210
        /*write any value to VIC0 VAR*/  
137
{
211
        VIC0->VAR = 0xFF;
138
}
212
}
-
 
213
/*******************************************************************************
139
/*******************************************************************************
214
* Function Name  : TIM1_IRQHandler
140
* Function Name  : TIM1_IRQHandler
215
* Description    : This function handles the TIM1 interrupt request
-
 
216
*******************************************************************************/
-
 
217
/*
-
 
218
void TIM1_IRQHandler(void)
141
* Description    : This function handles the TIM1 interrupt request
219
{
142
*******************************************************************************/
220
   // write any value to VIC0 VAR //  
143
//void TIM1_IRQHandler(void)
221
   VIC0->VAR = 0xFF;
144
//{
222
}
145
//}
223
*/
146
/*******************************************************************************
224
/*******************************************************************************
147
* Function Name  : TIM2_IRQHandler
225
* Function Name  : TIM2_IRQHandler
-
 
226
* Description    : This function handles the TIM2 interrupt request
-
 
227
*******************************************************************************/
-
 
228
void TIM2_IRQHandler(void)
-
 
229
{
-
 
230
        /*write your handler here*/
-
 
231
        /* ... */
148
* Description    : This function handles the TIM2 interrupt request
232
               
149
*******************************************************************************/
233
       
150
void TIM2_IRQHandler(void)
234
        /*write any value to VIC0 VAR*/  
151
{
235
        VIC0->VAR = 0xFF;
152
}
236
}
153
/*******************************************************************************
237
/*******************************************************************************
154
* Function Name  : TIM3_IRQHandler
238
* Function Name  : TIM3_IRQHandler
-
 
239
* Description    : This function handles the TIM3 interrupt request
-
 
240
*******************************************************************************/
-
 
241
void TIM3_IRQHandler(void)
-
 
242
{
-
 
243
        /*write your handler here*/
-
 
244
        /* ... */
155
* Description    : This function handles the TIM3 interrupt request
245
               
156
*******************************************************************************/
246
       
157
void TIM3_IRQHandler(void)
247
        /*write any value to VIC0 VAR*/  
158
{
248
        VIC0->VAR = 0xFF;
159
}
249
}
160
/*******************************************************************************
250
/*******************************************************************************
161
* Function Name  : USBHP_IRQHandler
251
* Function Name  : USBHP_IRQHandler
162
* Description    : This function handles the USBHP interrupt request
252
* Description    : This function handles the USBHP interrupt request
-
 
253
*******************************************************************************/
-
 
254
void USBHP_IRQHandler(void)
163
*******************************************************************************/
255
{
164
void USBHP_IRQHandler(void)
256
        CTR_HP();
165
{
257
        /*write any value to VIC0 VAR*/  
166
  CTR_HP();
258
        VIC0->VAR = 0xFF;
167
}
259
}
168
/*******************************************************************************
260
/*******************************************************************************
169
* Function Name  : USBLP_IRQHandler
261
* Function Name  : USBLP_IRQHandler
-
 
262
* Description    : This function handles the USBLP interrupt request
170
* Description    : This function handles the USBLP interrupt request
263
*******************************************************************************/
171
*******************************************************************************/
264
void USBLP_IRQHandler(void)
172
void USBLP_IRQHandler(void)
265
{
173
{
266
        USB_Istr();     /*write any value to VIC0 VAR*/  
174
  USB_Istr();
267
        VIC0->VAR = 0xFF;
175
}
268
}
176
/*******************************************************************************
269
/*******************************************************************************
177
* Function Name  : SCU_IRQHandler
270
* Function Name  : SCU_IRQHandler
-
 
271
* Description    : This function handles the SCU interrupt request
-
 
272
*******************************************************************************/
-
 
273
void SCU_IRQHandler(void)
-
 
274
{
-
 
275
        /*write your handler here*/
-
 
276
        /* ... */
178
* Description    : This function handles the SCU interrupt request
277
               
179
*******************************************************************************/
278
       
180
void SCU_IRQHandler(void)
279
        /*write any value to VIC0 VAR*/  
181
{
280
        VIC0->VAR = 0xFF;
182
}
281
}
183
/*******************************************************************************
282
/*******************************************************************************
184
* Function Name  : ENET_IRQHandler
283
* Function Name  : ENET_IRQHandler
-
 
284
* Description    : This function handles the DENET interrupt request
-
 
285
*******************************************************************************/
-
 
286
void ENET_IRQHandler(void)
-
 
287
{
-
 
288
        /*write your handler here*/
-
 
289
        /* ... */
185
* Description    : This function handles the DENET interrupt request
290
               
186
*******************************************************************************/
291
       
187
void ENET_IRQHandler(void)
292
        /*write any value to VIC0 VAR*/  
188
{
293
        VIC0->VAR = 0xFF;
189
}
294
}
190
/*******************************************************************************
295
/*******************************************************************************
191
* Function Name  : DMA_IRQHandler
296
* Function Name  : DMA_IRQHandler
-
 
297
* Description    : This function handles the DMA interrupt request
-
 
298
*******************************************************************************/
-
 
299
void DMA_IRQHandler(void)
-
 
300
{
-
 
301
        /*write your handler here*/
-
 
302
        /* ... */
192
* Description    : This function handles the DMA interrupt request
303
               
193
*******************************************************************************/
304
       
194
void DMA_IRQHandler(void)
305
        /*write any value to VIC0 VAR*/  
195
{
306
        VIC0->VAR = 0xFF;
196
}
307
}
197
/*******************************************************************************
308
/*******************************************************************************
198
* Function Name  : CAN_IRQHandler
309
* Function Name  : CAN_IRQHandler
-
 
310
* Description    : This function handles the CAN interrupt request
-
 
311
*******************************************************************************/
-
 
312
void CAN_IRQHandler(void)
-
 
313
{
-
 
314
        /*write your handler here*/
-
 
315
        /* ... */
199
* Description    : This function handles the CAN interrupt request
316
               
200
*******************************************************************************/
317
       
201
void CAN_IRQHandler(void)
318
        /*write any value to VIC0 VAR*/  
202
{
319
        VIC0->VAR = 0xFF;
203
}
320
}
204
/*******************************************************************************
321
/*******************************************************************************
205
* Function Name  : MC_IRQHandler
322
* Function Name  : MC_IRQHandler
-
 
323
* Description    : This function handles the MC interrupt request
-
 
324
*******************************************************************************/
-
 
325
void MC_IRQHandler(void)
-
 
326
{
-
 
327
        /*write your handler here*/
-
 
328
        /* ... */
206
* Description    : This function handles the MC interrupt request
329
               
207
*******************************************************************************/
330
       
208
void MC_IRQHandler(void)
331
        /*write any value to VIC0 VAR*/  
209
{
332
        VIC0->VAR = 0xFF;
210
}
333
}
211
/*******************************************************************************
334
/*******************************************************************************
212
* Function Name  : ADC_IRQHandler
335
* Function Name  : ADC_IRQHandler
-
 
336
* Description    : This function handles the ADC interrupt request
-
 
337
*******************************************************************************/
-
 
338
void ADC_IRQHandler(void)
-
 
339
{
-
 
340
        /*write your handler here*/
-
 
341
        /* ... */
213
* Description    : This function handles the ADC interrupt request
342
               
214
*******************************************************************************/
343
       
215
void ADC_IRQHandler(void)
344
        /*write any value to VIC0 VAR*/  
216
{
345
        VIC0->VAR = 0xFF;
217
}
346
}
Line 224... Line 353...
224
} */
353
} */
225
/*******************************************************************************
354
/*******************************************************************************
226
* Function Name  : UART1_IRQHandler
355
* Function Name  : UART1_IRQHandler
227
* Description    : This function handles the UART1 interrupt request
356
* Description    : This function handles the UART1 interrupt request
228
*******************************************************************************/
357
*******************************************************************************/
229
//void UART1_IRQHandler(void) __attribute__ ((interrupt ("IRQ")));
-
 
230
/*void UART1_IRQHandler(void)
358
/*void UART1_IRQHandler(void)
231
{
359
{      
232
        UART1->DR = UART1->DR;
-
 
233
 
-
 
234
     UART_ClearITPendingBit(UART1, UART_IT_Receive);
-
 
235
       
-
 
236
}
-
 
237
*/
360
} */
238
/*******************************************************************************
361
/*******************************************************************************
239
* Function Name  : UART2_IRQHandler
362
* Function Name  : UART2_IRQHandler
240
* Description    : This function handles the UART2 interrupt request
363
* Description    : This function handles the UART2 interrupt request
241
*******************************************************************************/
364
*******************************************************************************/
242
void UART2_IRQHandler(void)
365
/*void UART2_IRQHandler(void)
243
{
366
{
244
}
367
} */
245
/*******************************************************************************
368
/*******************************************************************************
246
* Function Name  : I2C0_IRQHandler
369
* Function Name  : I2C0_IRQHandler
247
* Description    : This function handles the I2C0 interrupt request
370
* Description    : This function handles the I2C0 interrupt request
248
*******************************************************************************/
371
*******************************************************************************/
249
void I2C0_IRQHandler(void)
372
void I2C0_IRQHandler(void)
Line 300... Line 423...
300
}
423
}
301
/*******************************************************************************
424
/*******************************************************************************
302
* Function Name  : EXTIT1_IRQHandler
425
* Function Name  : EXTIT1_IRQHandler
303
* Description    : This function handles the EXTIT1 interrupt request
426
* Description    : This function handles the EXTIT1 interrupt request
304
*******************************************************************************/
427
*******************************************************************************/
305
void EXTIT1_IRQHandler(void)
428
void EXTIT1_IRQHandler(void)
306
{
429
{
307
        VIC_ITCmd(EXTIT1_ITLine, DISABLE);
430
        VIC_ITCmd(EXTIT1_ITLine, DISABLE);
308
        if(WIU_GetITStatus(WIU_Line11) != RESET)
431
        if(WIU_GetITStatus(WIU_Line11) != RESET)
309
        {
432
        {
310
                BeepTime = 100;
433
                BeepTime = 100;
311
                InitFat16(); // initialize sd-card file system.
434
                Fat16_Init(); // initialize sd-card file system.
Line 312... Line 435...
312
 
435
 
313
                WIU_ClearFlag(WIU_Line1);
436
                WIU_ClearFlag(WIU_Line1);
314
                WIU_ClearITPendingBit(WIU_Line11);
437
                WIU_ClearITPendingBit(WIU_Line11);
315
        }
438
        }