?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /******************************************************************************
2  
3 MRF24WB0M Driver Exernal Interrupt
4 Module for Microchip TCP/IP Stack
5 -Provides access to MRF24WB0M WiFi controller
6 -Reference: MRF24WB0M Data sheet, IEEE 802.11 Standard
7  
8 *******************************************************************************
9 FileName: WF_Eint.c
10 Dependencies: TCP/IP Stack header files
11 Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F, PIC32
12 Compiler: Microchip C32 v1.10b or higher
13 Microchip C30 v3.22 or higher
14 Microchip C18 v3.34 or higher
15 Company: Microchip Technology, Inc.
16  
17 Software License Agreement
18  
19 Copyright (C) 2002-2010 Microchip Technology Inc. All rights reserved.
20  
21 Microchip licenses to you the right to use, modify, copy, and distribute:
22 (i) the Software when embedded on a Microchip microcontroller or digital
23 signal controller product ("Device") which is integrated into
24 Licensee's product; or
25 (ii) ONLY the Software driver source files ENC28J60.c, ENC28J60.h,
26 ENCX24J600.c and ENCX24J600.h ported to a non-Microchip device used in
27 conjunction with a Microchip ethernet controller for the sole purpose
28 of interfacing with the ethernet controller.
29  
30 You should refer to the license agreement accompanying this Software for
31 additional information regarding your rights and obligations.
32  
33 THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
34 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY
35 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
36 NON-INFRINGEMENT. IN NO EVENT SHALL MICROCHIP BE LIABLE FOR ANY INCIDENTAL,
37 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST
38 OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS BY
39 THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), ANY CLAIMS
40 FOR INDEMNITY OR CONTRIBUTION, OR OTHER SIMILAR COSTS, WHETHER ASSERTED ON
41 THE BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR
42 OTHERWISE.
43  
44  
45 Author Date Comment
46 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47 Michael Palladino 10/13/07 Original
48 KO 31 Oct 2008 Port to PIC24F and PIC32 for TCP/IP stack v4.52
49 KH 19 Jun 2009 Modified MACMemCopyAsync to support TCB to TCB copy
50 KH 27 Jan 2010 Updated for MRF24WB0M
51 ******************************************************************************/
52  
53  
54 /*
55 *********************************************************************************************************
56 * INCLUDES
57 *********************************************************************************************************
58 */
59  
60 #include "TCPIP Stack/WFMac.h"
61  
62 #if defined(WF_CS_TRIS)
63  
64 /* used for assertions */
65 #ifdef WF_DEBUG
66 #define WF_MODULE_NUMBER WF_MODULE_WF_EINT
67 #endif
68  
69  
70 /*****************************************************************************
71 * FUNCTION:WF_EintIsDisabled
72 *
73 * RETURNS: TRUE if MRF24WB0M External Interrupt is disabled, else returns FALSE
74 *
75 * PARAMS: None
76 *
77 * NOTES: Called by WiFi Driver to determine if the MRF24WB0M External Interrupt
78 * is disabled.
79 *****************************************************************************/
80 BOOL WF_EintIsDisabled(void)
81 {
82 return(WF_INT_IE == 0); /* works for PIC18, PIC24, and PIC32 */
83 }
84  
85 BOOL WF_EintIsPending(void)
86 {
87 return(((WF_INT_IO == 0) && (WF_INT_IF == 0))); /* works for PIC18, PIC24, and PIC32 */
88 }
89  
90 /*====================================================================================================================*/
91 /*====================================================================================================================*/
92 /* PIC18 Interrupt Routines */
93 /*====================================================================================================================*/
94 /*====================================================================================================================*/
95 #if defined( __18CXX )
96 /*****************************************************************************
97 * PIC18 INTERRUPT SERVICE ROUTINE (Called from LowISR() in MainDemo.c)
98 *****************************************************************************/
99 void WFEintISR(void)
100 {
101 // if EINT enabled
102 if ( WF_INT_IE == 1u )
103 {
104 // if EINT event occurred
105 if ( WF_INT_IF == 1u )
106 {
107 // clear EINT
108 WF_INT_IF = 0;
109 WF_INT_IE = 0; // disable external interrupt
110  
111 // invoke handler
112 WFEintHandler();
113 }
114 }
115 }
116  
117 /*****************************************************************************
118 * FUNCTION:WF_EintEnable (Specific to PIC18)
119 *
120 * RETURNS: None
121 *
122 * PARAMS: None
123 *
124 * NOTES: Called by WiFi Driver to enable the MRF24WB0M External Interrupt.
125 *****************************************************************************/
126 void WF_EintEnable(void)
127 {
128 // if interrupt line is low, then we may have missed a falling edge
129 // while the interrupt was disabled.
130 if ( WF_INT_IO == 0 )
131 {
132 // if the interrupt pin is active
133 // then the MRF24WB0M has another event that needs to be serviced.
134 // This means that the MRF24WB0M will never generate another falling edge
135 // required to trigger the interrupt... So, we must force an interrupt.
136 // force the EINT
137 WF_INT_IF = 1;
138 }
139  
140 /* enable the external interrupt */
141 WF_INT_IE = 1;
142 }
143  
144 /*****************************************************************************
145 * FUNCTION:WF_EintDisable (Specific to PIC18)
146 *
147 * RETURNS: None
148 *
149 * PARAMS: None
150 *
151 * NOTES: Called by WiFi Driver to disable the MRF24WB0M External Interrupt.
152 *****************************************************************************/
153 void WF_EintDisable(void)
154 {
155 /* disable the external interrupt */
156 WF_INT_IE = 0;
157 }
158  
159 /*****************************************************************************
160 * FUNCTION:WF_EintInit (Specific to PIC18)
161 *
162 * RETURNS: None
163 *
164 * PARAMS: None
165 *
166 * NOTES: Called by WiFi Driver to initialize the MRF24WB0M External Interrupt.
167 *****************************************************************************/
168 void WF_EintInit(void)
169 {
170 /* disable the external interrupt */
171 WF_INT_IE = 0;
172 // WF_INT_IP = 0;
173  
174 /* configure IO pin as input and External Interrupt pin*/
175 /* assume port b pullups were enabled before entry */
176 WF_INT_TRIS = 1;
177 WF_INT_EDGE = 0; /* falling edge triggered */
178  
179 /* clear and enable the interrupt */
180 WF_INT_IF = 0;
181 WF_INT_IE = 1;
182 }
183  
184 /*====================================================================================================================*/
185 /*====================================================================================================================*/
186 /* PIC24 Interrupt Routines */
187 /*====================================================================================================================*/
188 /*====================================================================================================================*/
189 #elif defined( __C30__ )
190  
191 /*****************************************************************************
192 * PIC24 INTERRUPT SERVICE ROUTINE
193 *****************************************************************************/
194 #if defined(MRF24WB0M_IN_SPI2 )
195 void __attribute__((interrupt, auto_psv)) _INT3Interrupt(void)
196 #else
197 void __attribute__((interrupt, auto_psv)) _INT1Interrupt(void)
198 #endif
199 {
200 // clear EINT
201 if (WF_INT_IF && WF_INT_IE)
202 {
203 WF_INT_IF = 0;
204 WF_INT_IE = 0; /* disable external interrupt */
205 // invoke handler
206 WFEintHandler();
207 }
208 }
209  
210 /*****************************************************************************
211 * FUNCTION: WF_EintEnable (Specific to PIC24)
212 *
213 * RETURNS: None
214 *
215 * PARAMS: None
216 *
217 * NOTES: Called by WiFi Driver to enable the MRF24WB0M External Interrupt.
218 *****************************************************************************/
219 void WF_EintEnable(void)
220 {
221 // if interrupt line is low, then we may have missed a falling edge
222 // while the interrupt was disabled.
223 if ( WF_INT_IO == 0 )
224 {
225 // if the interrupt pin is active
226 // then the MRF24WB0M has another event that needs to be serviced.
227 // This means that the MRF24WB0M will never generate another falling edge
228 // required to trigger the interrupt... So, we must force an interrupt.
229 // force the EINT
230 WF_INT_IF = 1;
231 }
232  
233 /* enable the external interrupt */
234 WF_INT_IE = 1;
235 }
236  
237  
238 /*****************************************************************************
239 * FUNCTION: WF_EintDisable (Specific to PIC24)
240 *
241 * RETURNS: None
242 *
243 * PARAMS: None
244 *
245 * NOTES: Called by WiFi Driver to disable the MRF24WB0M External Interrupt.
246 *****************************************************************************/
247 void WF_EintDisable(void)
248 {
249 /* disable the external interrupt */
250 WF_INT_IE = 0;
251 }
252  
253 /*****************************************************************************
254 * FUNCTION: WF_EintInit (Specific to PIC24)
255 *
256 * RETURNS: None
257 *
258 * PARAMS: None
259 *
260 * NOTES: Called by WiFi Driver to initialize the MRF24WB0M External Interrupt.
261 *****************************************************************************/
262 void WF_EintInit(void)
263 {
264 /* disable the external interrupt */
265 WF_INT_IE = 0;
266  
267 /* configure IO pin as input and External Interrupt pin*/
268 /* set the I/O high since we do not have pull-ups */
269 WF_INT_IO = 1;
270 WF_INT_TRIS = 1;
271 WF_INT_EDGE = 1; /* falling edge triggered */
272  
273 /* clear and enable the interrupt */
274 WF_INT_IF = 0;
275 WF_INT_IE = 1;
276 }
277  
278 /*====================================================================================================================*/
279 /*====================================================================================================================*/
280 /* PIC32 Interrupt Routines */
281 /*====================================================================================================================*/
282 /*====================================================================================================================*/
283 #elif defined( __PIC32MX__ )
284  
285 /*****************************************************************************
286 * PIC32 INTERRUPT SERVICE ROUTINE
287 *****************************************************************************/
288 #if defined( MRF24WB0M_IN_SPI2 )
289 void __attribute((interrupt(ipl3), vector(_EXTERNAL_3_VECTOR), nomips16)) _WFInterrupt(void)
290 #else
291 void __attribute((interrupt(ipl3), vector(_EXTERNAL_1_VECTOR), nomips16)) _WFInterrupt(void)
292 #endif
293 {
294 // clear EINT
295 if (WF_INT_IF && WF_INT_IE)
296 {
297 WF_INT_IF_CLEAR = WF_INT_BIT;
298 WF_INT_IE_CLEAR = WF_INT_BIT; /* disable external interrupt */
299  
300 /* invoke handler */
301 WFEintHandler();
302 }
303 }
304  
305 /*****************************************************************************
306 * FUNCTION:WF_EintEnable (Specific to PIC32)
307 *
308 * RETURNS: None
309 *
310 * PARAMS: None
311 *
312 * NOTES: Called by WiFi Driver to enable the MRF24WB0M External Interrupt.
313 *****************************************************************************/
314 void WF_EintEnable(void)
315 {
316 // if interrupt line is low, then we may have missed a falling edge
317 // while the interrupt was disabled.
318 if ( WF_INT_IO == 0 )
319 {
320 // if the interrupt pin is active
321 // then the MRF24WB0M has another event that needs to be serviced.
322 // This means that the MRF24WB0M will never generate another falling edge
323 // required to trigger the interrupt... So, we must force an interrupt.
324 // force the EINT
325 WF_INT_IF_SET = WF_INT_BIT;
326 }
327  
328 /* enable the external interrupt */
329 WF_INT_IE_SET = WF_INT_BIT;
330 }
331  
332  
333 /*****************************************************************************
334 * FUNCTION:WF_EintDisable (Specific to PIC32)
335 *
336 * RETURNS: None
337 *
338 * PARAMS: None
339 *
340 * NOTES: Called by WiFi Driver to disable the MRF24WB0M External Interrupt.
341 *****************************************************************************/
342 void WF_EintDisable(void)
343 {
344 /* disable the external interrupt */
345 WF_INT_IE_CLEAR = WF_INT_BIT;
346 }
347  
348 /*****************************************************************************
349 * FUNCTION:WF_EintInit (Specific to PIC32)
350 *
351 * RETURNS: None
352 *
353 * PARAMS: None
354 *
355 * NOTES: Called by WiFi Driver to initialize the MRF24WB0M External Interrupt.
356 *****************************************************************************/
357 void WF_EintInit(void)
358 {
359 /* disable the external interrupt */
360 WF_INT_IE_CLEAR = WF_INT_BIT;
361  
362 /* configure IO pin as input and External Interrupt pin*/
363 /* set the I/O high since we do not have pull-ups */
364 WF_INT_IO = 1;
365 WF_INT_TRIS = 1;
366 WF_INT_EDGE = 0; /* falling edge triggered */
367  
368 /* clear and enable the interrupt */
369 WF_INT_IF_CLEAR = WF_INT_BIT;
370 WF_INT_IPCCLR = WF_INT_IPC_MASK;
371 WF_INT_IPCSET = WF_INT_IPC_VALUE;
372 WF_INT_IE_SET = WF_INT_BIT;
373 }
374 #endif
375  
376 #else
377 // dummy func to keep compiler happy when module has no executeable code
378 void MCHP_Eint_EmptyFunc(void)
379 {
380 }
381  
382 #endif /* WF_CS_TRIS */
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3