source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/hardware/arduino/avr/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/DRIVERS/EIC/eic.h @ 4837

Last change on this file since 4837 was 4837, checked in by daduve, 2 years ago

Adding new version

File size: 8.9 KB
Line 
1/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
2
3/*This file is prepared for Doxygen automatic documentation generation.*/
4/*! \file *********************************************************************
5 *
6 * \brief EIC driver for AVR32 UC3.
7 *
8 * AVR32 External Interrupt Controller driver module.
9 *
10 * - Compiler:           IAR EWAVR32 and GNU GCC for AVR32
11 * - Supported devices:  All AVR32 devices with an EIC module can be used.
12 * - AppNote:
13 *
14 * \author               Atmel Corporation: http://www.atmel.com \n
15 *                       Support and FAQ: http://support.atmel.no/
16 *
17 ******************************************************************************/
18
19/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
20 *
21 * Redistribution and use in source and binary forms, with or without
22 * modification, are permitted provided that the following conditions are met:
23 *
24 * 1. Redistributions of source code must retain the above copyright notice, this
25 * list of conditions and the following disclaimer.
26 *
27 * 2. Redistributions in binary form must reproduce the above copyright notice,
28 * this list of conditions and the following disclaimer in the documentation
29 * and/or other materials provided with the distribution.
30 *
31 * 3. The name of Atmel may not be used to endorse or promote products derived
32 * from this software without specific prior written permission.
33 *
34 * 4. This software may only be redistributed and used in connection with an Atmel
35 * AVR product.
36 *
37 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
38 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
39 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
40 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
41 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
42 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
45 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
46 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
47 *
48 */
49
50#ifndef _EIC_H_
51#define _EIC_H_
52
53#include "compiler.h"
54
55/*! \name External Interrupt lines
56 */
57//! @{
58#if (UC3A || UC3B) 
59#define EXT_INT0    AVR32_EIC_INT0 //!< Line 0
60#define EXT_INT1    AVR32_EIC_INT1 //!< Line 1
61#define EXT_INT2    AVR32_EIC_INT2 //!< Line 2
62#define EXT_INT3    AVR32_EIC_INT3 //!< Line 3
63#define EXT_INT4    AVR32_EIC_INT4 //!< Line 4
64#define EXT_INT5    AVR32_EIC_INT5 //!< Line 5
65#define EXT_INT6    AVR32_EIC_INT6 //!< Line 6
66#define EXT_INT7    AVR32_EIC_INT7 //!< Line 7
67#define EXT_NMI     AVR32_EIC_NMI  //!< Line 8
68#else
69#define EXT_INT0    AVR32_EIC_INT1  //!< Line 0
70#define EXT_INT1    AVR32_EIC_INT2 //!< Line 1
71#define EXT_INT2    AVR32_EIC_INT3 //!< Line 2
72#define EXT_INT3    AVR32_EIC_INT4 //!< Line 3
73#define EXT_INT4    AVR32_EIC_INT5 //!< Line 4
74#define EXT_INT5    AVR32_EIC_INT6 //!< Line 5
75#define EXT_INT6    AVR32_EIC_INT7 //!< Line 6
76#define EXT_INT7    AVR32_EIC_INT8 //!< Line 7
77#define EXT_NMI     AVR32_EIC_NMI  //!< Line 8
78
79#endif
80
81//! @}
82
83/*! \name Mode Trigger Options
84 */
85//! @{
86#define EIC_MODE_EDGE_TRIGGERED   AVR32_EIC_EDGE_IRQ //!<
87#define EIC_MODE_LEVEL_TRIGGERED  AVR32_EIC_LEVEL_IRQ //!<
88//! @}
89
90/*! \name Edge level Options
91 */
92//! @{
93#define EIC_EDGE_FALLING_EDGE     AVR32_EIC_FALLING_EDGE //!<
94#define EIC_EDGE_RISING_EDGE      AVR32_EIC_RISING_EDGE //!<
95//! @}
96
97/*! \name Level Options
98 */
99//! @{
100#define EIC_LEVEL_LOW_LEVEL       AVR32_EIC_LOW_LEVEL //!<
101#define EIC_LEVEL_HIGH_LEVEL      AVR32_EIC_HIGH_LEVEL //!<
102//! @}
103
104/*! \name Filter Options
105 */
106//! @{
107#define EIC_FILTER_ENABLED        AVR32_EIC_FILTER_ON //!<
108#define EIC_FILTER_DISABLED       AVR32_EIC_FILTER_OFF //!<
109//! @}
110
111/*! \name Synch Mode Options
112 */
113//! @{
114#define EIC_SYNCH_MODE            AVR32_EIC_SYNC //!<
115#define EIC_ASYNCH_MODE           AVR32_EIC_USE_ASYNC //!<
116//! @}
117
118//! Configuration parameters of the EIC module.
119typedef struct
120{
121  //!Line
122  unsigned char eic_line;
123
124  //! Mode : EDGE_LEVEL or TRIGGER_LEVEL
125  unsigned char eic_mode;
126
127  //! Edge : FALLING_EDGE or RISING_EDGE
128  unsigned char eic_edge;
129
130  //! Level :  LOW_LEVEL or HIGH_LEVEL
131  unsigned char eic_level;
132
133  //! Filter:  NOT_FILTERED or FILTERED
134  unsigned char eic_filter;
135
136  //! Async:  SYNC mode or ASYNC
137  unsigned char eic_async;
138
139} eic_options_t;
140
141
142/*! \brief Init the EIC driver.
143 *
144 * \param eic Base address of the EIC module
145 * \param opt Configuration parameters of the EIC module (see \ref eic_options_t)
146 * \param nb_lines Number of lines to consider, equal to size of opt buffer
147 */
148extern void eic_init(volatile avr32_eic_t *eic, const eic_options_t *opt, unsigned int nb_lines);
149
150/*! \brief Enable the EIC driver.
151 *
152 * \param eic Base address of the EIC module
153 * \param mask_lines Mask for current selected lines
154 */
155extern void eic_enable_lines(volatile avr32_eic_t *eic, unsigned int mask_lines);
156
157/*! \brief Enable the EIC driver.
158 *
159 * \param eic Base address of the EIC module
160 * \param line_number Line number to enable
161 */
162extern void eic_enable_line(volatile avr32_eic_t *eic, unsigned int line_number);
163
164/*! \brief Disable the EIC driver.
165 *
166 * \param eic Base address of the EIC module
167 * \param mask_lines Mask for current selected lines
168 */
169extern void eic_disable_lines(volatile avr32_eic_t *eic, unsigned int mask_lines);
170
171/*! \brief Disable the EIC driver.
172 *
173 * \param eic Base address of the EIC module
174 * \param line_number Line number to disable
175 */
176extern void eic_disable_line(volatile avr32_eic_t *eic, unsigned int line_number);
177
178/*! \brief Tells whether an EIC line is enabled.
179 *
180 * \param eic Base address of the EIC module
181 * \param line_number Line number to test
182 *
183 * \return Whether an EIC line is enabled.
184 */
185extern Bool eic_is_line_enabled(volatile avr32_eic_t *eic, unsigned int line_number);
186
187/*! \name Interrupt Control Functions
188 */
189//! @{
190
191/*! \brief Enable the interrupt feature of the EIC.
192 *
193 * \param eic Base address of the EIC (i.e. &AVR32_EIC).
194 * \param mask_lines Mask for current selected lines
195 */
196extern void eic_enable_interrupt_lines(volatile avr32_eic_t *eic, unsigned int mask_lines);
197
198/*! \brief Enable the interrupt feature of the EIC.
199 *
200 * \param eic Base address of the EIC (i.e. &AVR32_EIC).
201 * \param line_number Line number to enable
202 */
203extern void eic_enable_interrupt_line(volatile avr32_eic_t *eic, unsigned int line_number);
204
205/*! \brief Disable the interrupt feature of the EIC.
206 *
207 * \param eic Base address of the EIC (i.e. &AVR32_EIC).
208 * \param mask_lines Mask for current selected lines
209 */
210extern void eic_disable_interrupt_lines(volatile avr32_eic_t *eic, unsigned int mask_lines);
211
212/*! \brief Disable the interrupt feature of the EIC.
213 *
214 * \param eic Base address of the EIC (i.e. &AVR32_EIC).
215 * \param line_number Line number to disable
216 */
217extern void eic_disable_interrupt_line(volatile avr32_eic_t *eic, unsigned int line_number);
218
219/*! \brief Tells whether an EIC interrupt line is enabled.
220 *
221 * \param eic Base address of the EIC module
222 * \param line_number Line number to test
223 *
224 * \return Whether an EIC interrupt line is enabled.
225 */
226extern Bool eic_is_interrupt_line_enabled(volatile avr32_eic_t *eic, unsigned int line_number);
227
228/*! \brief Clear the interrupt flag.
229 *         Call this function once you've handled the interrupt.
230 *
231 * \param eic Base address of the EIC (i.e. &AVR32_EIC).
232 * \param mask_lines Mask for current selected lines
233 */
234extern void eic_clear_interrupt_lines(volatile avr32_eic_t *eic, unsigned int mask_lines);
235
236/*! \brief Clear the interrupt flag.
237 *         Call this function once you've handled the interrupt.
238 *
239 * \param eic Base address of the EIC (i.e. &AVR32_EIC).
240 * \param line_number Line number to clear
241 */
242extern void eic_clear_interrupt_line(volatile avr32_eic_t *eic, unsigned int line_number);
243
244/*! \brief Tells whether an EIC interrupt line is pending.
245 *
246 * \param eic Base address of the EIC module
247 * \param line_number Line number to test
248 *
249 * \return Whether an EIC interrupt line is pending.
250 */
251extern Bool eic_is_interrupt_line_pending(volatile avr32_eic_t *eic, unsigned int line_number);
252
253/*! \brief Enable the interrupt scan feature of the EIC.
254 *
255 * \param eic Base address of the EIC (i.e. &AVR32_EIC).
256 * \param presc Prescale select for the keypad scan rate in the range [0,31].
257 */
258extern void eic_enable_interrupt_scan(volatile avr32_eic_t *eic, unsigned int presc);
259
260/*! \brief Disable the interrupt scan feature of the EIC.
261 *
262 * \param eic Base address of the EIC (i.e. &AVR32_EIC).
263 */
264extern void eic_disable_interrupt_scan(volatile avr32_eic_t *eic);
265
266/*! \brief Return scan pad number that causes interrupt.
267 *
268 * \param eic Base address of the EIC (i.e. &AVR32_EIC).
269 */
270extern unsigned long eic_get_interrupt_pad_scan(volatile avr32_eic_t *eic);
271
272//! @}
273
274
275#endif  // _EIC_H_
Note: See TracBrowser for help on using the repository browser.