UCOS_TI_LM3S_Keil
首页
相关页面
结构体
文件
文件列表
全局定义
全部
结构体
文件
函数
变量
类型定义
宏定义
页
bsp_int.c
浏览该文件的文档.
1
/*
2
*********************************************************************************************************
3
* MICIRUM BOARD SUPPORT PACKAGE
4
*
5
* (c) Copyright 2009; Micrium, Inc.; Weston, FL
6
*
7
* All rights reserved. Protected by international copyright laws.
8
* Knowledge of the source code may not be used to write a similar
9
* product. This file may only be used in accordance with a license
10
* and should not be redistributed in any way.
11
*********************************************************************************************************
12
*/
13
14
/*
15
*********************************************************************************************************
16
*
17
* BOARD SUPPORT PACKAGE
18
* INTERRUPT SERVICES
19
*
20
* LUMINARY MICRO LM3S1968 on the EK-LM3S1968
21
*
22
* Filename : bsp_int.c
23
* Version : V1.02
24
* Programmer(s) : BAN
25
*********************************************************************************************************
26
*/
27
28
29
/*
30
*********************************************************************************************************
31
* INCLUDE FILES
32
*********************************************************************************************************
33
*/
34
35
#define BSP_INT_MODULE
36
#include <
bsp.h
>
37
38
39
/*
40
*********************************************************************************************************
41
* LOCAL DEFINES
42
*********************************************************************************************************
43
*/
44
45
#define BSP_INT_SRC_NBR 46u
46
47
48
/*
49
*********************************************************************************************************
50
* LOCAL CONSTANTS
51
*********************************************************************************************************
52
*/
53
54
55
/*
56
*********************************************************************************************************
57
* LOCAL DATA TYPES
58
*********************************************************************************************************
59
*/
60
61
62
/*
63
*********************************************************************************************************
64
* LOCAL TABLES
65
*********************************************************************************************************
66
*/
67
68
static
CPU_FNCT_VOID
BSP_IntVectTbl
[
BSP_INT_SRC_NBR
];
69
70
71
/*
72
*********************************************************************************************************
73
* LOCAL GLOBAL VARIABLES
74
*********************************************************************************************************
75
*/
76
77
78
/*
79
*********************************************************************************************************
80
* LOCAL FUNCTION PROTOTYPES
81
*********************************************************************************************************
82
*/
83
84
static
void
BSP_IntHandler
(
CPU_DATA
int_id);
85
86
static
void
BSP_IntHandlerDummy
(
void
);
87
88
89
/*
90
*********************************************************************************************************
91
* LOCAL CONFIGURATION ERRORS
92
*********************************************************************************************************
93
*/
94
95
96
/*
97
*********************************************************************************************************
98
* BSP_IntClr()
99
*
100
* Description : Clear interrupt.
101
*
102
* Argument(s) : int_id Interrupt to clear.
103
*
104
* Return(s) : none.
105
*
106
* Caller(s) : Application.
107
*
108
* Note(s) : (1) An interrupt does not need to be cleared within the interrupt controller.
109
*********************************************************************************************************
110
*/
111
112
void
BSP_IntClr
(
CPU_DATA
int_id)
113
{
114
115
}
116
117
118
/*
119
*********************************************************************************************************
120
* BSP_IntDis()
121
*
122
* Description : Disable interrupt.
123
*
124
* Argument(s) : int_id Interrupt to disable.
125
*
126
* Return(s) : none.
127
*
128
* Caller(s) : Application.
129
*
130
* Note(s) : none.
131
*********************************************************************************************************
132
*/
133
134
void
BSP_IntDis
(
CPU_DATA
int_id)
135
{
136
if
(int_id <
BSP_INT_SRC_NBR
) {
137
CPU_IntSrcDis
(int_id + 16u);
138
}
139
}
140
141
142
/*
143
*********************************************************************************************************
144
* BSP_IntDisAll()
145
*
146
* Description : Disable ALL interrupts.
147
*
148
* Argument(s) : none.
149
*
150
* Return(s) : none.
151
*
152
* Caller(s) : Application.
153
*
154
* Note(s) : none.
155
*********************************************************************************************************
156
*/
157
158
void
BSP_IntDisAll
(
void
)
159
{
160
CPU_IntDis
();
161
}
162
163
164
/*
165
*********************************************************************************************************
166
* BSP_IntEn()
167
*
168
* Description : Enable interrupt.
169
*
170
* Argument(s) : int_id Interrupt to enable.
171
*
172
* Return(s) : none.
173
*
174
* Caller(s) : Application.
175
*
176
* Note(s) : none.
177
*********************************************************************************************************
178
*/
179
180
void
BSP_IntEn
(
CPU_DATA
int_id)
181
{
182
if
(int_id <
BSP_INT_SRC_NBR
) {
183
CPU_IntSrcEn
(int_id + 16u);
184
}
185
}
186
187
188
/*
189
*********************************************************************************************************
190
* BSP_IntVectSet()
191
*
192
* Description : Assign ISR handler.
193
*
194
* Argument(s) : int_id Interrupt for which vector will be set.
195
*
196
* isr Handler to assign
197
*
198
* Return(s) : none.
199
*
200
* Caller(s) : Application.
201
*
202
* Note(s) : none.
203
*********************************************************************************************************
204
*/
205
206
void
BSP_IntVectSet
(
CPU_DATA
int_id,
207
CPU_FNCT_VOID
isr)
208
{
209
CPU_SR_ALLOC
();
210
211
212
if
(int_id <
BSP_INT_SRC_NBR
) {
213
CPU_CRITICAL_ENTER
();
214
BSP_IntVectTbl
[int_id] = isr;
215
CPU_CRITICAL_EXIT
();
216
}
217
}
218
219
220
/*
221
*********************************************************************************************************
222
* BSP_IntPrioSet()
223
*
224
* Description : Assign ISR priority.
225
*
226
* Argument(s) : int_id Interrupt for which vector will be set.
227
*
228
* prio Priority to assign
229
*
230
* Return(s) : none.
231
*
232
* Caller(s) : Application.
233
*
234
* Note(s) : none.
235
*********************************************************************************************************
236
*/
237
238
void
BSP_IntPrioSet
(
CPU_DATA
int_id,
239
CPU_INT08U
prio)
240
{
241
CPU_SR_ALLOC
();
242
243
244
if
(int_id <
BSP_INT_SRC_NBR
) {
245
CPU_CRITICAL_ENTER
();
246
CPU_IntSrcPrioSet
(int_id + 16, prio);
247
CPU_CRITICAL_EXIT
();
248
}
249
}
250
251
252
/*
253
*********************************************************************************************************
254
*********************************************************************************************************
255
* INTERNAL FUNCTIONS
256
*********************************************************************************************************
257
*********************************************************************************************************
258
*/
259
260
/*
261
*********************************************************************************************************
262
* BSP_IntInit()
263
*
264
* Description : Initialize interrupts:
265
*
266
* Argument(s) : none.
267
*
268
* Return(s) : none.
269
*
270
* Caller(s) : BSP_Init().
271
*
272
* Note(s) : none.
273
*********************************************************************************************************
274
*/
275
276
void
BSP_IntInit
(
void
)
277
{
278
CPU_DATA
int_id;
279
280
281
for
(int_id = 0; int_id <
BSP_INT_SRC_NBR
; int_id++) {
282
BSP_IntVectSet
(int_id,
BSP_IntHandlerDummy
);
283
}
284
}
285
286
287
/*
288
*********************************************************************************************************
289
* BSP_IntHandler####()
290
*
291
* Description : Handle an interrupt.
292
*
293
* Argument(s) : none.
294
*
295
* Return(s) : none.
296
*
297
* Caller(s) : This is an ISR.
298
*
299
* Note(s) : none.
300
*********************************************************************************************************
301
*/
302
303
void
BSP_IntHandlerGPIOA
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_GPIOA
); }
304
void
BSP_IntHandlerGPIOB
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_GPIOB
); }
305
void
BSP_IntHandlerGPIOC
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_GPIOC
); }
306
void
BSP_IntHandlerGPIOD
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_GPIOD
); }
307
void
BSP_IntHandlerGPIOE
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_GPIOE
); }
308
void
BSP_IntHandlerUART0
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_UART0
); }
309
void
BSP_IntHandlerUART1
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_UART1
); }
310
void
BSP_IntHandlerSSI0
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_SSI0
); }
311
void
BSP_IntHandlerI2C0
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_I2C0
); }
312
void
BSP_IntHandlerPWM_FAULT
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_PWM_FAULT
); }
313
void
BSP_IntHandlerPWM_GEN0
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_PWM_GEN0
); }
314
void
BSP_IntHandlerPWM_GEN1
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_PWM_GEN1
); }
315
void
BSP_IntHandlerPWM_GEN2
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_PWM_GEN2
); }
316
void
BSP_IntHandlerQEI0
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_QEI0
); }
317
void
BSP_IntHandlerADC0
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_ADC0
); }
318
void
BSP_IntHandlerADC1
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_ADC1
); }
319
320
void
BSP_IntHandlerADC2
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_ADC2
); }
321
void
BSP_IntHandlerADC3
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_ADC3
); }
322
void
BSP_IntHandlerWATCHDOG
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_WATCHDOG
); }
323
void
BSP_IntHandlerTIMER0A
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_TIMER0A
); }
324
void
BSP_IntHandlerTIMER0B
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_TIMER0B
); }
325
void
BSP_IntHandlerTIMER1A
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_TIMER1A
); }
326
void
BSP_IntHandlerTIMER1B
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_TIMER1B
); }
327
void
BSP_IntHandlerTIMER2A
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_TIMER2A
); }
328
void
BSP_IntHandlerTIMER2B
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_TIMER2B
); }
329
void
BSP_IntHandlerCOMP0
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_COMP0
); }
330
void
BSP_IntHandlerCOMP1
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_COMP1
); }
331
void
BSP_IntHandlerCOMP2
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_COMP2
); }
332
void
BSP_IntHandlerSYSCTL
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_SYSCTL
); }
333
void
BSP_IntHandlerFLASH
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_FLASH
); }
334
void
BSP_IntHandlerGPIOF
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_GPIOF
); }
335
void
BSP_IntHandlerGPIOG
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_GPIOG
); }
336
337
void
BSP_IntHandlerGPIOH
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_GPIOH
); }
338
void
BSP_IntHandlerUART2
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_UART2
); }
339
void
BSP_IntHandlerSSI1
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_SSI1
); }
340
void
BSP_IntHandlerTIMER3A
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_TIMER3A
); }
341
void
BSP_IntHandlerTIMER3B
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_TIMER3B
); }
342
void
BSP_IntHandlerI2C1
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_I2C1
); }
343
void
BSP_IntHandlerQEI1
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_QEI1
); }
344
void
BSP_IntHandlerHIBERNATE
(
void
) {
BSP_IntHandler
(
BSP_INT_ID_HIBERNATE
); }
345
346
347
/*
348
*********************************************************************************************************
349
*********************************************************************************************************
350
* LOCAL FUNCTIONS
351
*********************************************************************************************************
352
*********************************************************************************************************
353
*/
354
355
/*
356
*********************************************************************************************************
357
* BSP_IntHandler()
358
*
359
* Description : Central interrupt handler.
360
*
361
* Argument(s) : int_id Interrupt that will be handled.
362
*
363
* Return(s) : none.
364
*
365
* Caller(s) : ISR handlers.
366
*
367
* Note(s) : none.
368
*********************************************************************************************************
369
*/
370
371
static
void
BSP_IntHandler
(
CPU_DATA
int_id)
372
{
373
CPU_FNCT_VOID
isr;
374
375
376
OSIntEnter
();
/* Tell OS that we are starting an ISR. */
377
378
if
(int_id <
BSP_INT_SRC_NBR
) {
379
isr =
BSP_IntVectTbl
[int_id];
380
if
(isr != (
CPU_FNCT_VOID
)0) {
381
isr();
382
}
383
}
384
385
OSIntExit
();
/* Tell OS that we are leaving the ISR. */
386
}
387
388
389
/*
390
*********************************************************************************************************
391
* BSP_IntHandlerDummy()
392
*
393
* Description : Dummy interrupt handler.
394
*
395
* Argument(s) : none.
396
*
397
* Return(s) : none.
398
*
399
* Caller(s) : BSP_IntHandler().
400
*
401
* Note(s) : none.
402
*********************************************************************************************************
403
*/
404
405
static
void
BSP_IntHandlerDummy
(
void
)
406
{
407
408
}
UCOS_TI_LM3S_Keil
BSP
bsp_int.c
生成于 2013年 十月 1日 星期二 12:18:39 , 为 UCOS_TI_LM3S_Keil使用
1.8.4