]> git.sur5r.net Git - freertos/blob - Demo/AVR32_UC3A_GCC/Atmel_SW_Framework/DRIVERS/GPIO/gpio.h
3aa700bd8ba3524d0bb1205888ad7ab3436e6346
[freertos] / Demo / AVR32_UC3A_GCC / Atmel_SW_Framework / DRIVERS / GPIO / gpio.h
1 /* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */\r
2
3 /*This file has been prepared for Doxygen automatic documentation generation.*/\r
4 /*! \file *********************************************************************\r
5  *\r
6  * \brief GPIO header for AVR32 UC3.\r
7  *\r
8  * This file contains basic GPIO driver functions.\r
9  *\r
10  * - Compiler:           IAR EWAVR32 and GNU GCC for AVR32\r
11  * - Supported devices:  All AVR32 devices with a GPIO module can be used.\r
12  * - AppNote:\r
13  *\r
14  * \author               Atmel Corporation: http://www.atmel.com \n\r
15  *                       Support and FAQ: http://support.atmel.no/\r
16  *\r
17  *****************************************************************************/\r
18 \r
19 /* Copyright (c) 2009 Atmel Corporation. All rights reserved.\r
20  *\r
21  * Redistribution and use in source and binary forms, with or without\r
22  * modification, are permitted provided that the following conditions are met:\r
23  *\r
24  * 1. Redistributions of source code must retain the above copyright notice, this\r
25  * list of conditions and the following disclaimer.\r
26  *\r
27  * 2. Redistributions in binary form must reproduce the above copyright notice,\r
28  * this list of conditions and the following disclaimer in the documentation\r
29  * and/or other materials provided with the distribution.\r
30  *\r
31  * 3. The name of Atmel may not be used to endorse or promote products derived\r
32  * from this software without specific prior written permission.\r
33  *\r
34  * 4. This software may only be redistributed and used in connection with an Atmel\r
35  * AVR product.\r
36  *\r
37  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED\r
38  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
39  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE\r
40  * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR\r
41  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
42  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
43  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r
44  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
45  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
46  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\r
47  *\r
48  */\r
49 \r
50 #ifndef _GPIO_H_\r
51 #define _GPIO_H_\r
52 \r
53 #include <avr32/io.h>\r
54 #include "compiler.h"\r
55 \r
56 /*! \name Return Values of the GPIO API\r
57  */\r
58 //! @{\r
59 #define GPIO_SUCCESS            0 //!< Function successfully completed.\r
60 #define GPIO_INVALID_ARGUMENT   1 //!< Input parameters are out of range.\r
61 //! @}\r
62 \r
63 \r
64 /*! \name Interrupt Trigger Modes\r
65  */\r
66 //! @{\r
67 #define GPIO_PIN_CHANGE         0 //!< Interrupt triggered upon pin change.\r
68 #define GPIO_RISING_EDGE        1 //!< Interrupt triggered upon rising edge.\r
69 #define GPIO_FALLING_EDGE       2 //!< Interrupt triggered upon falling edge.\r
70 //! @}\r
71 \r
72 \r
73 //! A type definition of pins and modules connectivity.\r
74 typedef struct\r
75 {\r
76   unsigned char pin;              //!< Module pin.\r
77   unsigned char function;         //!< Module function.\r
78 } gpio_map_t[];\r
79 \r
80 \r
81 /*! \name Peripheral Bus Interface\r
82  *\r
83  * Low-speed interface with a non-deterministic number of clock cycles per\r
84  * access.\r
85  *\r
86  * This interface operates with lower clock frequencies (fPB <= fCPU), and its\r
87  * timing is not deterministic since it needs to access a shared bus which may\r
88  * be heavily loaded.\r
89  *\r
90  * \note This interface is immediately available without initialization.\r
91  */\r
92 //! @{\r
93 \r
94 /*! \brief Enables specific module modes for a set of pins.\r
95  *\r
96  * \param gpiomap The pin map.\r
97  * \param size The number of pins in \a gpiomap.\r
98  *\r
99  * \return \ref GPIO_SUCCESS or \ref GPIO_INVALID_ARGUMENT.\r
100  */\r
101 extern int gpio_enable_module(const gpio_map_t gpiomap, unsigned int size);\r
102 \r
103 /*! \brief Enables a specific module mode for a pin.\r
104  *\r
105  * \param pin The pin number.\n\r
106  *            Refer to the product header file `uc3x.h' (where x is the part\r
107  *            number; e.g. x = a0512) for module pins. E.g., to enable a PWM\r
108  *            channel output, the pin number can be AVR32_PWM_3_PIN for PWM\r
109  *            channel 3.\r
110  * \param function The pin function.\n\r
111  *                 Refer to the product header file `uc3x.h' (where x is the\r
112  *                 part number; e.g. x = a0512) for module pin functions. E.g.,\r
113  *                 to enable a PWM channel output, the pin function can be\r
114  *                 AVR32_PWM_3_FUNCTION for PWM channel 3.\r
115  *\r
116  * \return \ref GPIO_SUCCESS or \ref GPIO_INVALID_ARGUMENT.\r
117  */\r
118 extern int gpio_enable_module_pin(unsigned int pin, unsigned int function);\r
119 \r
120 /*! \brief Enables the GPIO mode of a set of pins.\r
121  *\r
122  * \param gpiomap The pin map.\r
123  * \param size The number of pins in \a gpiomap.\r
124  */\r
125 extern void gpio_enable_gpio(const gpio_map_t gpiomap, unsigned int size);\r
126 \r
127 /*! \brief Enables the GPIO mode of a pin.\r
128  *\r
129  * \param pin The pin number.\n\r
130  *            Refer to the product header file `uc3x.h' (where x is the part\r
131  *            number; e.g. x = a0512) for pin definitions. E.g., to enable the\r
132  *            GPIO mode of PX21, AVR32_PIN_PX21 can be used. Module pins such as\r
133  *            AVR32_PWM_3_PIN for PWM channel 3 can also be used to release\r
134  *            module pins for GPIO.\r
135  */\r
136 extern void gpio_enable_gpio_pin(unsigned int pin);\r
137 \r
138 // The open-drain mode is not synthesized on the current AVR32 products.\r
139 // If one day some AVR32 products have this feature, the corresponding part\r
140 // numbers should be listed in the #if below.\r
141 // Note that other functions are available in this driver to use pins with open\r
142 // drain in GPIO mode. The advantage of the open-drain mode functions over these\r
143 // other functions is that they can be used not only in GPIO mode but also in\r
144 // module mode.\r
145 #if 0\r
146 \r
147 /*! \brief Enables the open-drain mode of a pin.\r
148  *\r
149  * \param pin The pin number.\r
150  */\r
151 extern void gpio_enable_pin_open_drain(unsigned int pin);\r
152 \r
153 /*! \brief Disables the open-drain mode of a pin.\r
154  *\r
155  * \param pin The pin number.\r
156  */\r
157 extern void gpio_disable_pin_open_drain(unsigned int pin);\r
158 \r
159 #endif\r
160 \r
161 /*! \brief Enables the pull-up resistor of a pin.\r
162  *\r
163  * \param pin The pin number.\r
164  */\r
165 extern void gpio_enable_pin_pull_up(unsigned int pin);\r
166 \r
167 /*! \brief Disables the pull-up resistor of a pin.\r
168  *\r
169  * \param pin The pin number.\r
170  */\r
171 extern void gpio_disable_pin_pull_up(unsigned int pin);\r
172 \r
173 #if defined(AVR32_GPIO_200_H_INCLUDED) || defined(AVR32_GPIO_210_H_INCLUDED) || defined(AVR32_GPIO_211_H_INCLUDED)\r
174 // Added support of Pull-up Resistor, Pull-down Resistor and Buskeeper Control.\r
175 \r
176 /*! \brief Enables the pull-down resistor of a pin.\r
177  *\r
178  * \param pin The pin number.\r
179  */\r
180 extern void gpio_enable_pin_pull_down(unsigned int pin);\r
181 \r
182 /*! \brief Disables the pull-down resistor of a pin.\r
183  *\r
184  * \param pin The pin number.\r
185  */\r
186 extern void gpio_disable_pin_pull_down(unsigned int pin);\r
187 \r
188 /*! \brief Enables the buskeeper functionality on a pin.\r
189  *\r
190  * \param pin The pin number.\r
191  */\r
192 extern void gpio_enable_pin_buskeeper(unsigned int pin);\r
193 \r
194 /*! \brief Disables the buskeeper functionality on a pin.\r
195  *\r
196  * \param pin The pin number.\r
197  */\r
198 extern void gpio_disable_pin_buskeeper(unsigned int pin);\r
199 \r
200 #endif\r
201 \r
202 /*! \brief Returns the value of a pin.\r
203  *\r
204  * \param pin The pin number.\r
205  *\r
206  * \return The pin value.\r
207  */\r
208 extern int gpio_get_pin_value(unsigned int pin);\r
209 \r
210 /*! \brief Returns the output value set for a GPIO pin.\r
211  *\r
212  * \param pin The pin number.\r
213  *\r
214  * \return The pin output value.\r
215  *\r
216  * \note This function must be used in conjunction with \ref gpio_set_gpio_pin,\r
217  *       \ref gpio_clr_gpio_pin and \ref gpio_tgl_gpio_pin.\r
218  */\r
219 extern int gpio_get_gpio_pin_output_value(unsigned int pin);\r
220 \r
221 /*! \brief Returns the output value set for a GPIO pin using open drain.\r
222  *\r
223  * \param pin The pin number.\r
224  *\r
225  * \return The pin output value.\r
226  *\r
227  * \note This function must be used in conjunction with\r
228  *       \ref gpio_set_gpio_open_drain_pin, \ref gpio_clr_gpio_open_drain_pin\r
229  *       and \ref gpio_tgl_gpio_open_drain_pin.\r
230  */\r
231 extern int gpio_get_gpio_open_drain_pin_output_value(unsigned int pin);\r
232 \r
233 /*! \brief Drives a GPIO pin to 1.\r
234  *\r
235  * \param pin The pin number.\r
236  */\r
237 extern void gpio_set_gpio_pin(unsigned int pin);\r
238 \r
239 /*! \brief Drives a GPIO pin to 0.\r
240  *\r
241  * \param pin The pin number.\r
242  */\r
243 extern void gpio_clr_gpio_pin(unsigned int pin);\r
244 \r
245 /*! \brief Toggles a GPIO pin.\r
246  *\r
247  * \param pin The pin number.\r
248  */\r
249 extern void gpio_tgl_gpio_pin(unsigned int pin);\r
250 \r
251 /*! \brief Drives a GPIO pin to 1 using open drain.\r
252  *\r
253  * \param pin The pin number.\r
254  */\r
255 extern void gpio_set_gpio_open_drain_pin(unsigned int pin);\r
256 \r
257 /*! \brief Drives a GPIO pin to 0 using open drain.\r
258  *\r
259  * \param pin The pin number.\r
260  */\r
261 extern void gpio_clr_gpio_open_drain_pin(unsigned int pin);\r
262 \r
263 /*! \brief Toggles a GPIO pin using open drain.\r
264  *\r
265  * \param pin The pin number.\r
266  */\r
267 extern void gpio_tgl_gpio_open_drain_pin(unsigned int pin);\r
268 \r
269 /*! \brief Enables the glitch filter of a pin.\r
270  *\r
271  * When the glitch filter is enabled, a glitch with duration of less than 1\r
272  * clock cycle is automatically rejected, while a pulse with duration of 2 clock\r
273  * cycles or more is accepted. For pulse durations between 1 clock cycle and 2\r
274  * clock cycles, the pulse may or may not be taken into account, depending on\r
275  * the precise timing of its occurrence. Thus for a pulse to be guaranteed\r
276  * visible it must exceed 2 clock cycles, whereas for a glitch to be reliably\r
277  * filtered out, its duration must not exceed 1 clock cycle. The filter\r
278  * introduces 2 clock cycles latency.\r
279  *\r
280  * \param pin The pin number.\r
281  */\r
282 extern void gpio_enable_pin_glitch_filter(unsigned int pin);\r
283 \r
284 /*! \brief Disables the glitch filter of a pin.\r
285  *\r
286  * \param pin The pin number.\r
287  */\r
288 extern void gpio_disable_pin_glitch_filter(unsigned int pin);\r
289 \r
290 /*! \brief Enables the interrupt of a pin with the specified settings.\r
291  *\r
292  * \param pin The pin number.\r
293  * \param mode The trigger mode (\ref GPIO_PIN_CHANGE, \ref GPIO_RISING_EDGE or\r
294  *             \ref GPIO_FALLING_EDGE).\r
295  *\r
296  * \return \ref GPIO_SUCCESS or \ref GPIO_INVALID_ARGUMENT.\r
297  */\r
298 extern int gpio_enable_pin_interrupt(unsigned int pin, unsigned int mode);\r
299 \r
300 /*! \brief Disables the interrupt of a pin.\r
301  *\r
302  * \param pin The pin number.\r
303  */\r
304 extern void gpio_disable_pin_interrupt(unsigned int pin);\r
305 \r
306 /*! \brief Gets the interrupt flag of a pin.\r
307  *\r
308  * \param pin The pin number.\r
309  *\r
310  * \return The pin interrupt flag.\r
311  */\r
312 extern int gpio_get_pin_interrupt_flag(unsigned int pin);\r
313 \r
314 /*! \brief Clears the interrupt flag of a pin.\r
315  *\r
316  * \param pin The pin number.\r
317  */\r
318 extern void gpio_clear_pin_interrupt_flag(unsigned int pin);\r
319 \r
320 //! @}\r
321 \r
322 \r
323 #if (defined AVR32_GPIO_LOCAL_ADDRESS)\r
324 /*! \name Local Bus Interface\r
325  *\r
326  * High-speed interface with only one clock cycle per access.\r
327  *\r
328  * This interface operates with high clock frequency (fCPU), and its timing is\r
329  * deterministic since it does not need to access a shared bus which may be\r
330  * heavily loaded.\r
331  *\r
332  * \warning To use this interface, the clock frequency of the peripheral bus on\r
333  *          which the GPIO peripheral is connected must be set to the CPU clock\r
334  *          frequency (fPB = fCPU).\r
335  *\r
336  * \note This interface has to be initialized in order to be available.\r
337  */\r
338 //! @{\r
339 \r
340 /*! \brief Enables the local bus interface for GPIO.\r
341  *\r
342  * \note This function must have been called at least once before using other\r
343  *       functions in this interface.\r
344  */\r
345 #if (defined __GNUC__)\r
346 __attribute__((__always_inline__))\r
347 #endif\r
348 extern __inline__ void gpio_local_init(void)\r
349 {\r
350   Set_system_register(AVR32_CPUCR,\r
351                       Get_system_register(AVR32_CPUCR) | AVR32_CPUCR_LOCEN_MASK);\r
352 }\r
353 \r
354 /*! \brief Enables the output driver of a pin.\r
355  *\r
356  * \param pin The pin number.\r
357  *\r
358  * \note \ref gpio_local_init must have been called beforehand.\r
359  *\r
360  * \note This function does not enable the GPIO mode of the pin.\r
361  *       \ref gpio_enable_gpio_pin can be called for this purpose.\r
362  */\r
363 #if (defined __GNUC__)\r
364 __attribute__((__always_inline__))\r
365 #endif\r
366 extern __inline__ void gpio_local_enable_pin_output_driver(unsigned int pin)\r
367 {\r
368   AVR32_GPIO_LOCAL.port[pin >> 5].oders = 1 << (pin & 0x1F);\r
369 }\r
370 \r
371 /*! \brief Disables the output driver of a pin.\r
372  *\r
373  * \param pin The pin number.\r
374  *\r
375  * \note \ref gpio_local_init must have been called beforehand.\r
376  */\r
377 #if (defined __GNUC__)\r
378 __attribute__((__always_inline__))\r
379 #endif\r
380 extern __inline__ void gpio_local_disable_pin_output_driver(unsigned int pin)\r
381 {\r
382   AVR32_GPIO_LOCAL.port[pin >> 5].oderc = 1 << (pin & 0x1F);\r
383 }\r
384 \r
385 /*! \brief Returns the value of a pin.\r
386  *\r
387  * \param pin The pin number.\r
388  *\r
389  * \return The pin value.\r
390  *\r
391  * \note \ref gpio_local_init must have been called beforehand.\r
392  */\r
393 #if (defined __GNUC__)\r
394 __attribute__((__always_inline__))\r
395 #endif\r
396 extern __inline__ int gpio_local_get_pin_value(unsigned int pin)\r
397 {\r
398   return (AVR32_GPIO_LOCAL.port[pin >> 5].pvr >> (pin & 0x1F)) & 1;\r
399 }\r
400 \r
401 /*! \brief Drives a GPIO pin to 1.\r
402  *\r
403  * \param pin The pin number.\r
404  *\r
405  * \note \ref gpio_local_init must have been called beforehand.\r
406  *\r
407  * \note This function does not enable the GPIO mode of the pin nor its output\r
408  *       driver. \ref gpio_enable_gpio_pin and\r
409  *       \ref gpio_local_enable_pin_output_driver can be called for this\r
410  *       purpose.\r
411  */\r
412 #if (defined __GNUC__)\r
413 __attribute__((__always_inline__))\r
414 #endif\r
415 extern __inline__ void gpio_local_set_gpio_pin(unsigned int pin)\r
416 {\r
417   AVR32_GPIO_LOCAL.port[pin >> 5].ovrs = 1 << (pin & 0x1F);\r
418 }\r
419 \r
420 /*! \brief Drives a GPIO pin to 0.\r
421  *\r
422  * \param pin The pin number.\r
423  *\r
424  * \note \ref gpio_local_init must have been called beforehand.\r
425  *\r
426  * \note This function does not enable the GPIO mode of the pin nor its output\r
427  *       driver. \ref gpio_enable_gpio_pin and\r
428  *       \ref gpio_local_enable_pin_output_driver can be called for this\r
429  *       purpose.\r
430  */\r
431 #if (defined __GNUC__)\r
432 __attribute__((__always_inline__))\r
433 #endif\r
434 extern __inline__ void gpio_local_clr_gpio_pin(unsigned int pin)\r
435 {\r
436   AVR32_GPIO_LOCAL.port[pin >> 5].ovrc = 1 << (pin & 0x1F);\r
437 }\r
438 \r
439 /*! \brief Toggles a GPIO pin.\r
440  *\r
441  * \param pin The pin number.\r
442  *\r
443  * \note \ref gpio_local_init must have been called beforehand.\r
444  *\r
445  * \note This function does not enable the GPIO mode of the pin nor its output\r
446  *       driver. \ref gpio_enable_gpio_pin and\r
447  *       \ref gpio_local_enable_pin_output_driver can be called for this\r
448  *       purpose.\r
449  */\r
450 #if (defined __GNUC__)\r
451 __attribute__((__always_inline__))\r
452 #endif\r
453 extern __inline__ void gpio_local_tgl_gpio_pin(unsigned int pin)\r
454 {\r
455   AVR32_GPIO_LOCAL.port[pin >> 5].ovrt = 1 << (pin & 0x1F);\r
456 }\r
457 \r
458 /*! \brief Initializes the configuration of a GPIO pin so that it can be used\r
459  *         with GPIO open-drain functions.\r
460  *\r
461  * \note This function must have been called at least once before using\r
462  *       \ref gpio_local_set_gpio_open_drain_pin,\r
463  *       \ref gpio_local_clr_gpio_open_drain_pin or\r
464  *       \ref gpio_local_tgl_gpio_open_drain_pin.\r
465  */\r
466 #if (defined __GNUC__)\r
467 __attribute__((__always_inline__))\r
468 #endif\r
469 extern __inline__ void gpio_local_init_gpio_open_drain_pin(unsigned int pin)\r
470 {\r
471   AVR32_GPIO_LOCAL.port[pin >> 5].ovrc = 1 << (pin & 0x1F);\r
472 }\r
473 \r
474 /*! \brief Drives a GPIO pin to 1 using open drain.\r
475  *\r
476  * \param pin The pin number.\r
477  *\r
478  * \note \ref gpio_local_init and \ref gpio_local_init_gpio_open_drain_pin must\r
479  *       have been called beforehand.\r
480  *\r
481  * \note This function does not enable the GPIO mode of the pin.\r
482  *       \ref gpio_enable_gpio_pin can be called for this purpose.\r
483  */\r
484 #if (defined __GNUC__)\r
485 __attribute__((__always_inline__))\r
486 #endif\r
487 extern __inline__ void gpio_local_set_gpio_open_drain_pin(unsigned int pin)\r
488 {\r
489   AVR32_GPIO_LOCAL.port[pin >> 5].oderc = 1 << (pin & 0x1F);\r
490 }\r
491 \r
492 /*! \brief Drives a GPIO pin to 0 using open drain.\r
493  *\r
494  * \param pin The pin number.\r
495  *\r
496  * \note \ref gpio_local_init and \ref gpio_local_init_gpio_open_drain_pin must\r
497  *       have been called beforehand.\r
498  *\r
499  * \note This function does not enable the GPIO mode of the pin.\r
500  *       \ref gpio_enable_gpio_pin can be called for this purpose.\r
501  */\r
502 #if (defined __GNUC__)\r
503 __attribute__((__always_inline__))\r
504 #endif\r
505 extern __inline__ void gpio_local_clr_gpio_open_drain_pin(unsigned int pin)\r
506 {\r
507   AVR32_GPIO_LOCAL.port[pin >> 5].oders = 1 << (pin & 0x1F);\r
508 }\r
509 \r
510 /*! \brief Toggles a GPIO pin using open drain.\r
511  *\r
512  * \param pin The pin number.\r
513  *\r
514  * \note \ref gpio_local_init and \ref gpio_local_init_gpio_open_drain_pin must\r
515  *       have been called beforehand.\r
516  *\r
517  * \note This function does not enable the GPIO mode of the pin.\r
518  *       \ref gpio_enable_gpio_pin can be called for this purpose.\r
519  */\r
520 #if (defined __GNUC__)\r
521 __attribute__((__always_inline__))\r
522 #endif\r
523 extern __inline__ void gpio_local_tgl_gpio_open_drain_pin(unsigned int pin)\r
524 {\r
525   AVR32_GPIO_LOCAL.port[pin >> 5].odert = 1 << (pin & 0x1F);\r
526 }\r
527 \r
528 //! @}\r
529 #endif // AVR32_GPIO_LOCAL_ADDRESS\r
530 \r
531 #if UC3L\r
532 //! @{\r
533 /*! \name Peripheral Event System support\r
534  *\r
535  * The GPIO can be programmed to output peripheral events whenever an interrupt\r
536  * condition is detected, such as pin value change, or only when a rising or\r
537  * falling edge is detected.\r
538  *\r
539  */\r
540 \r
541 /*! \brief Enables the peripheral event generation of a pin.\r
542  *\r
543  * \param pin The pin number.\r
544  *\r
545  */\r
546 #if (defined __GNUC__)\r
547 __attribute__((__always_inline__))\r
548 #endif\r
549 extern __inline__ void gpio_enable_pin_periph_event(unsigned int pin)\r
550 {\r
551   AVR32_GPIO.port[pin >> 5].oderc = 1 << (pin & 0x1F); // The GPIO output driver is disabled for that pin.\r
552   AVR32_GPIO.port[pin >> 5].evers = 1 << (pin & 0x1F);\r
553 }\r
554 \r
555 /*! \brief Disables the peripheral event generation of a pin.\r
556  *\r
557  * \param pin The pin number.\r
558  *\r
559  */\r
560 #if (defined __GNUC__)\r
561 __attribute__((__always_inline__))\r
562 #endif\r
563 extern __inline__ void gpio_disable_pin_periph_event(unsigned int pin)\r
564 {\r
565   AVR32_GPIO.port[pin >> 5].everc = 1 << (pin & 0x1F);\r
566 }\r
567 \r
568 /*! \brief Configure the peripheral event trigger mode of a pin\r
569  *\r
570  * \param pin The pin number.\r
571  * \param mode The trigger mode (\ref GPIO_PIN_CHANGE, \ref GPIO_RISING_EDGE or\r
572  *             \ref GPIO_FALLING_EDGE).\r
573  * \param use_igf use the Input Glitch Filter (TRUE) or not (FALSE).\r
574  *\r
575  * \return \ref GPIO_SUCCESS or \ref GPIO_INVALID_ARGUMENT.\r
576  */\r
577 extern int gpio_configure_pin_periph_event_mode(unsigned int pin, unsigned int mode, unsigned int use_igf);\r
578 \r
579 //! @}\r
580 #endif\r
581 \r
582 \r
583 #endif  // _GPIO_H_\r