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 
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 
207  CPU_FNCT_VOID isr)
208 {
209  CPU_SR_ALLOC();
210 
211 
212  if (int_id < BSP_INT_SRC_NBR) {
214  BSP_IntVectTbl[int_id] = isr;
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 
239  CPU_INT08U prio)
240 {
241  CPU_SR_ALLOC();
242 
243 
244  if (int_id < BSP_INT_SRC_NBR) {
246  CPU_IntSrcPrioSet(int_id + 16, prio);
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++) {
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 
319 
336 
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 }