aboutsummaryrefslogtreecommitdiff
path: root/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS
diff options
context:
space:
mode:
authorDavid A. Mellis <d.mellis@arduino.cc>2012-09-13 10:42:25 -0400
committerDavid A. Mellis <d.mellis@arduino.cc>2012-09-13 10:42:25 -0400
commitbd45bf50c7c68ec35c3aad8c5e7bf4d3db9cafc1 (patch)
treec02065cc7b15ce5f0a8eaa9f0030a268b37c89bb /firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS
parent6225a8596005bfb0be68fa641f5b47d01a95c12d (diff)
parent0d9a111face4f3629bcae8e52af843792af3b453 (diff)
Merge branch 'master' of ../wifishield
Diffstat (limited to 'firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS')
-rw-r--r--firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/ARDUINO/arduino.h234
-rw-r--r--firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/ARDUINO/led.c346
-rw-r--r--firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/ARDUINO/led.h191
-rw-r--r--firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/EVK1105/evk1105.h433
-rw-r--r--firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/EVK1105/led.c346
-rw-r--r--firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/EVK1105/led.h187
-rw-r--r--firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/board.h120
-rw-r--r--firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/board.h.ori121
8 files changed, 1978 insertions, 0 deletions
diff --git a/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/ARDUINO/arduino.h b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/ARDUINO/arduino.h
new file mode 100644
index 0000000..fbdd466
--- /dev/null
+++ b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/ARDUINO/arduino.h
@@ -0,0 +1,234 @@
+/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
+
+/*This file is prepared for Doxygen automatic documentation generation.*/
+/*! \file *********************************************************************
+ *
+ * \brief AT32UC3A EVK1100 board header file.
+ *
+ * This file contains definitions and services related to the features of the
+ * EVK1100 board rev. B and C.
+ *
+ * To use this board, define BOARD=EVK1100.
+ *
+ * - Compiler: IAR EWAVR32 and GNU GCC for AVR32
+ * - Supported devices: All AVR32 AT32UC3A devices can be used.
+ * - AppNote:
+ *
+ * \author Atmel Corporation: http://www.atmel.com \n
+ * Support and FAQ: http://support.atmel.no/
+ *
+ ******************************************************************************/
+
+/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The name of Atmel may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * 4. This software may only be redistributed and used in connection with an Atmel
+ * AVR product.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ */
+
+#ifndef _ARDUINO_H_
+#define _ARDUINO_H_
+
+#include "compiler.h"
+
+#ifdef __AVR32_ABI_COMPILER__ // Automatically defined when compiling for AVR32, not when assembling.
+# include "led.h"
+#endif // __AVR32_ABI_COMPILER__
+
+
+/*! \name Oscillator Definitions
+ */
+//! @{
+
+// RCOsc has no custom calibration by default. Set the following definition to
+// the appropriate value if a custom RCOsc calibration has been applied to your
+// part.
+//#define FRCOSC AVR32_PM_RCOSC_FREQUENCY //!< RCOsc frequency: Hz.
+
+#define FOSC32 32768 //!< Osc32 frequency: Hz.
+#define OSC32_STARTUP AVR32_PM_OSCCTRL32_STARTUP_8192_RCOSC //!< Osc32 startup time: RCOsc periods.
+
+#define FOSC0 12000000 //!< Osc0 frequency: Hz.
+#define OSC0_STARTUP AVR32_PM_OSCCTRL0_STARTUP_2048_RCOSC //!< Osc0 startup time: RCOsc periods.
+
+// Osc1 crystal is not mounted by default. Set the following definitions to the
+// appropriate values if a custom Osc1 crystal is mounted on your board.
+//#define FOSC1 12000000 //!< Osc1 frequency: Hz.
+//#define OSC1_STARTUP AVR32_PM_OSCCTRL1_STARTUP_2048_RCOSC //!< Osc1 startup time: RCOsc periods.
+
+//! @}
+
+
+//! Number of LEDs.
+#define LED_COUNT 3
+
+/*! \name GPIO Connections of LEDs
+ */
+//! @{
+#define LED0_GPIO AVR32_PIN_PB19
+#define LED1_GPIO AVR32_PIN_PB20
+#define LED2_GPIO AVR32_PIN_PB21
+//! @}
+
+/*! \name PWM Channels of LEDs
+ */
+//! @{
+#define LED0_PWM 0
+#define LED1_PWM 1
+#define LED2_PWM 2
+//! @}
+
+/*! \name PWM Functions of LEDs
+ */
+//! @{
+#define LED0_PWM_FUNCTION AVR32_PWM_0_FUNCTION
+#define LED1_PWM_FUNCTION AVR32_PWM_1_FUNCTION
+#define LED2_PWM_FUNCTION AVR32_PWM_2_FUNCTION
+//! @}
+
+/*! \name Color Identifiers of LEDs to Use with LED Functions
+ */
+//! @{
+#define LED_MONO0_GREEN LED0
+#define LED_MONO1_GREEN LED1
+#define LED_MONO2_GREEN LED2
+//! @}
+
+#if 0
+/*! \name SPI Connections of the DIP204 LCD
+ */
+//! @{
+#define DIP204_SPI (&AVR32_SPI1)
+#define DIP204_SPI_NPCS 2
+#define DIP204_SPI_SCK_PIN AVR32_SPI1_SCK_0_0_PIN
+#define DIP204_SPI_SCK_FUNCTION AVR32_SPI1_SCK_0_0_FUNCTION
+#define DIP204_SPI_MISO_PIN AVR32_SPI1_MISO_0_0_PIN
+#define DIP204_SPI_MISO_FUNCTION AVR32_SPI1_MISO_0_0_FUNCTION
+#define DIP204_SPI_MOSI_PIN AVR32_SPI1_MOSI_0_0_PIN
+#define DIP204_SPI_MOSI_FUNCTION AVR32_SPI1_MOSI_0_0_FUNCTION
+#define DIP204_SPI_NPCS_PIN AVR32_SPI1_NPCS_2_0_PIN
+#define DIP204_SPI_NPCS_FUNCTION AVR32_SPI1_NPCS_2_0_FUNCTION
+//! @}
+
+/*! \name GPIO and PWM Connections of the DIP204 LCD Backlight
+ */
+//! @{
+#define DIP204_BACKLIGHT_PIN AVR32_PIN_PB18
+#define DIP204_PWM_CHANNEL 6
+#define DIP204_PWM_PIN AVR32_PWM_6_PIN
+#define DIP204_PWM_FUNCTION AVR32_PWM_6_FUNCTION
+//! @}
+#endif
+
+/*! \name SPI Connections of the AT45DBX Data Flash Memory
+ */
+//! @{
+#define AT45DBX_SPI (&AVR32_SPI1)
+#define AT45DBX_SPI_NPCS 2
+#define AT45DBX_SPI_SCK_PIN AVR32_SPI1_SCK_0_0_PIN
+#define AT45DBX_SPI_SCK_FUNCTION AVR32_SPI1_SCK_0_0_FUNCTION
+#define AT45DBX_SPI_MISO_PIN AVR32_SPI1_MISO_0_0_PIN
+#define AT45DBX_SPI_MISO_FUNCTION AVR32_SPI1_MISO_0_0_FUNCTION
+#define AT45DBX_SPI_MOSI_PIN AVR32_SPI1_MOSI_0_0_PIN
+#define AT45DBX_SPI_MOSI_FUNCTION AVR32_SPI1_MOSI_0_0_FUNCTION
+#define AT45DBX_SPI_NPCS2_PIN AVR32_SPI1_NPCS_2_0_PIN
+#define AT45DBX_SPI_NPCS2_FUNCTION AVR32_SPI1_NPCS_2_0_FUNCTION
+#define AT45DBX_CHIP_RESET AVR32_PIN_PA02
+//! @}
+
+
+/*! \name GPIO and SPI Connections of the SD/MMC Connector
+ */
+//! @{
+//#define SD_MMC_CARD_DETECT_PIN AVR32_PIN_PA02
+//#define SD_MMC_WRITE_PROTECT_PIN AVR32_PIN_PA07
+#define SD_MMC_SPI (&AVR32_SPI1)
+#define SD_MMC_SPI_NPCS 1
+#define SD_MMC_SPI_SCK_PIN AVR32_SPI1_SCK_0_0_PIN
+#define SD_MMC_SPI_SCK_FUNCTION AVR32_SPI1_SCK_0_0_FUNCTION
+#define SD_MMC_SPI_MISO_PIN AVR32_SPI1_MISO_0_0_PIN
+#define SD_MMC_SPI_MISO_FUNCTION AVR32_SPI1_MISO_0_0_FUNCTION
+#define SD_MMC_SPI_MOSI_PIN AVR32_SPI1_MOSI_0_0_PIN
+#define SD_MMC_SPI_MOSI_FUNCTION AVR32_SPI1_MOSI_0_0_FUNCTION
+#define SD_MMC_SPI_NPCS_PIN AVR32_SPI1_NPCS_1_0_PIN
+#define SD_MMC_SPI_NPCS_FUNCTION AVR32_SPI1_NPCS_1_0_FUNCTION
+//! @}
+
+/* Timer Counter to generate clock for WiFi chip*/
+# define WIFI_TC (&AVR32_TC)
+# define WIFI_TC_CHANNEL_ID 0
+# define WIFI_TC_CHANNEL_PIN AVR32_TC_A0_0_0_PIN
+# define WIFI_TC_CHANNEL_FUNCTION AVR32_TC_A0_0_0_FUNCTION
+// Note that TC_A0_0_0 pin is pin 6 (PB23) on AT32UC3A1512 QFP100.
+
+/* Pin related to WiFi chip communication */
+#ifndef USE_POLL
+ #define USE_POLL
+#endif
+ #define SPI_CS 0
+ #define AVR32_SPI AVR32_SPI1
+ #define GPIO_IRQ_PIN AVR32_PIN_PA03
+ #define GPIO_IRQ AVR32_GPIO_IRQ_7
+ #define GPIO_W_RESET_PIN AVR32_PIN_PA07
+ #define GPIO_W_SHUTDOWN_PIN AVR32_PIN_PA09
+
+/* Pin related to shield communication */
+ #define ARDUINO_HANDSHAKE_PIN AVR32_PIN_PA25
+
+ #define AVR32_PDCA_PID_TX AVR32_PDCA_PID_SPI1_TX
+ #define AVR32_PDCA_PID_RX AVR32_PDCA_PID_SPI1_RX
+
+
+#if 0
+/*! \name TWI Connections of the Spare TWI Connector
+ */
+//! @{
+#define SPARE_TWI (&AVR32_TWI)
+#define SPARE_TWI_SCL_PIN AVR32_TWI_SCL_0_0_PIN
+#define SPARE_TWI_SCL_FUNCTION AVR32_TWI_SCL_0_0_FUNCTION
+#define SPARE_TWI_SDA_PIN AVR32_TWI_SDA_0_0_PIN
+#define SPARE_TWI_SDA_FUNCTION AVR32_TWI_SDA_0_0_FUNCTION
+//! @}
+
+
+/*! \name SPI Connections of the Spare SPI Connector
+ */
+//! @{
+#define SPARE_SPI (&AVR32_SPI0)
+#define SPARE_SPI_NPCS 0
+#define SPARE_SPI_SCK_PIN AVR32_SPI0_SCK_0_0_PIN
+#define SPARE_SPI_SCK_FUNCTION AVR32_SPI0_SCK_0_0_FUNCTION
+#define SPARE_SPI_MISO_PIN AVR32_SPI0_MISO_0_0_PIN
+#define SPARE_SPI_MISO_FUNCTION AVR32_SPI0_MISO_0_0_FUNCTION
+#define SPARE_SPI_MOSI_PIN AVR32_SPI0_MOSI_0_0_PIN
+#define SPARE_SPI_MOSI_FUNCTION AVR32_SPI0_MOSI_0_0_FUNCTION
+#define SPARE_SPI_NPCS_PIN AVR32_SPI0_NPCS_0_0_PIN
+#define SPARE_SPI_NPCS_FUNCTION AVR32_SPI0_NPCS_0_0_FUNCTION
+//! @}
+#endif
+
+#endif // _ARDUINO_H_
diff --git a/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/ARDUINO/led.c b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/ARDUINO/led.c
new file mode 100644
index 0000000..d7cd439
--- /dev/null
+++ b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/ARDUINO/led.c
@@ -0,0 +1,346 @@
+/* This source file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
+
+/*This file is prepared for Doxygen automatic documentation generation.*/
+/*! \file *********************************************************************
+ *
+ * \brief AT32UC3A EVK1100 board LEDs support package.
+ *
+ * This file contains definitions and services related to the LED features of
+ * the EVK1100 board.
+ *
+ * - Compiler: IAR EWAVR32 and GNU GCC for AVR32
+ * - Supported devices: All AVR32 AT32UC3A devices can be used.
+ * - AppNote:
+ *
+ * \author Atmel Corporation: http://www.atmel.com \n
+ * Support and FAQ: http://support.atmel.no/
+ *
+ ******************************************************************************/
+
+/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The name of Atmel may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * 4. This software may only be redistributed and used in connection with an Atmel
+ * AVR product.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ */
+
+#include <avr32/io.h>
+#include "preprocessor.h"
+#include "compiler.h"
+#include "arduino.h"
+#include "led.h"
+
+
+//! Structure describing LED hardware connections.
+typedef const struct
+{
+ struct
+ {
+ U32 PORT; //!< LED GPIO port.
+ U32 PIN_MASK; //!< Bit-mask of LED pin in GPIO port.
+ } GPIO; //!< LED GPIO descriptor.
+ struct
+ {
+ S32 CHANNEL; //!< LED PWM channel (< 0 if N/A).
+ S32 FUNCTION; //!< LED pin PWM function (< 0 if N/A).
+ } PWM; //!< LED PWM descriptor.
+} tLED_DESCRIPTOR;
+
+
+//! Hardware descriptors of all LEDs.
+static tLED_DESCRIPTOR LED_DESCRIPTOR[LED_COUNT] =
+{
+#define INSERT_LED_DESCRIPTOR(LED_NO, unused) \
+ { \
+ {LED##LED_NO##_GPIO / 32, 1 << (LED##LED_NO##_GPIO % 32)},\
+ {LED##LED_NO##_PWM, LED##LED_NO##_PWM_FUNCTION } \
+ },
+ MREPEAT(LED_COUNT, INSERT_LED_DESCRIPTOR, ~)
+#undef INSERT_LED_DESCRIPTOR
+};
+
+
+//! Saved state of all LEDs.
+static volatile U32 LED_State = (1 << LED_COUNT) - 1;
+
+
+U32 LED_Read_Display(void)
+{
+ return LED_State;
+}
+
+
+void LED_Display(U32 leds)
+{
+ // Use the LED descriptors to get the connections of a given LED to the MCU.
+ tLED_DESCRIPTOR *led_descriptor;
+ volatile avr32_gpio_port_t *led_gpio_port;
+
+ // Make sure only existing LEDs are specified.
+ leds &= (1 << LED_COUNT) - 1;
+
+ // Update the saved state of all LEDs with the requested changes.
+ LED_State = leds;
+
+ // For all LEDs...
+ for (led_descriptor = &LED_DESCRIPTOR[0];
+ led_descriptor < LED_DESCRIPTOR + LED_COUNT;
+ led_descriptor++)
+ {
+ // Set the LED to the requested state.
+ led_gpio_port = &AVR32_GPIO.port[led_descriptor->GPIO.PORT];
+ if (leds & 1)
+ {
+ led_gpio_port->ovrc = led_descriptor->GPIO.PIN_MASK;
+ }
+ else
+ {
+ led_gpio_port->ovrs = led_descriptor->GPIO.PIN_MASK;
+ }
+ led_gpio_port->oders = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->gpers = led_descriptor->GPIO.PIN_MASK;
+ leds >>= 1;
+ }
+}
+
+
+U32 LED_Read_Display_Mask(U32 mask)
+{
+ return Rd_bits(LED_State, mask);
+}
+
+
+void LED_Display_Mask(U32 mask, U32 leds)
+{
+ // Use the LED descriptors to get the connections of a given LED to the MCU.
+ tLED_DESCRIPTOR *led_descriptor = &LED_DESCRIPTOR[0] - 1;
+ volatile avr32_gpio_port_t *led_gpio_port;
+ U8 led_shift;
+
+ // Make sure only existing LEDs are specified.
+ mask &= (1 << LED_COUNT) - 1;
+
+ // Update the saved state of all LEDs with the requested changes.
+ Wr_bits(LED_State, mask, leds);
+
+ // While there are specified LEDs left to manage...
+ while (mask)
+ {
+ // Select the next specified LED and set it to the requested state.
+ led_shift = 1 + ctz(mask);
+ led_descriptor += led_shift;
+ led_gpio_port = &AVR32_GPIO.port[led_descriptor->GPIO.PORT];
+ leds >>= led_shift - 1;
+ if (leds & 1)
+ {
+ led_gpio_port->ovrc = led_descriptor->GPIO.PIN_MASK;
+ }
+ else
+ {
+ led_gpio_port->ovrs = led_descriptor->GPIO.PIN_MASK;
+ }
+ led_gpio_port->oders = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->gpers = led_descriptor->GPIO.PIN_MASK;
+ leds >>= 1;
+ mask >>= led_shift;
+ }
+}
+
+
+Bool LED_Test(U32 leds)
+{
+ return Tst_bits(LED_State, leds);
+}
+
+
+void LED_Off(U32 leds)
+{
+ // Use the LED descriptors to get the connections of a given LED to the MCU.
+ tLED_DESCRIPTOR *led_descriptor = &LED_DESCRIPTOR[0] - 1;
+ volatile avr32_gpio_port_t *led_gpio_port;
+ U8 led_shift;
+
+ // Make sure only existing LEDs are specified.
+ leds &= (1 << LED_COUNT) - 1;
+
+ // Update the saved state of all LEDs with the requested changes.
+ Clr_bits(LED_State, leds);
+
+ // While there are specified LEDs left to manage...
+ while (leds)
+ {
+ // Select the next specified LED and turn it off.
+ led_shift = 1 + ctz(leds);
+ led_descriptor += led_shift;
+ led_gpio_port = &AVR32_GPIO.port[led_descriptor->GPIO.PORT];
+ led_gpio_port->ovrs = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->oders = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->gpers = led_descriptor->GPIO.PIN_MASK;
+ leds >>= led_shift;
+ }
+}
+
+
+void LED_On(U32 leds)
+{
+ // Use the LED descriptors to get the connections of a given LED to the MCU.
+ tLED_DESCRIPTOR *led_descriptor = &LED_DESCRIPTOR[0] - 1;
+ volatile avr32_gpio_port_t *led_gpio_port;
+ U8 led_shift;
+
+ // Make sure only existing LEDs are specified.
+ leds &= (1 << LED_COUNT) - 1;
+
+ // Update the saved state of all LEDs with the requested changes.
+ Set_bits(LED_State, leds);
+
+ // While there are specified LEDs left to manage...
+ while (leds)
+ {
+ // Select the next specified LED and turn it on.
+ led_shift = 1 + ctz(leds);
+ led_descriptor += led_shift;
+ led_gpio_port = &AVR32_GPIO.port[led_descriptor->GPIO.PORT];
+ led_gpio_port->ovrc = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->oders = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->gpers = led_descriptor->GPIO.PIN_MASK;
+ leds >>= led_shift;
+ }
+}
+
+
+void LED_Toggle(U32 leds)
+{
+ // Use the LED descriptors to get the connections of a given LED to the MCU.
+ tLED_DESCRIPTOR *led_descriptor = &LED_DESCRIPTOR[0] - 1;
+ volatile avr32_gpio_port_t *led_gpio_port;
+ U8 led_shift;
+
+ // Make sure only existing LEDs are specified.
+ leds &= (1 << LED_COUNT) - 1;
+
+ // Update the saved state of all LEDs with the requested changes.
+ Tgl_bits(LED_State, leds);
+
+ // While there are specified LEDs left to manage...
+ while (leds)
+ {
+ // Select the next specified LED and toggle it.
+ led_shift = 1 + ctz(leds);
+ led_descriptor += led_shift;
+ led_gpio_port = &AVR32_GPIO.port[led_descriptor->GPIO.PORT];
+ led_gpio_port->ovrt = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->oders = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->gpers = led_descriptor->GPIO.PIN_MASK;
+ leds >>= led_shift;
+ }
+}
+
+
+U32 LED_Read_Display_Field(U32 field)
+{
+ return Rd_bitfield(LED_State, field);
+}
+
+
+void LED_Display_Field(U32 field, U32 leds)
+{
+ // Move the bit-field to the appropriate position for the bit-mask.
+ LED_Display_Mask(field, leds << ctz(field));
+}
+
+
+U8 LED_Get_Intensity(U32 led)
+{
+ tLED_DESCRIPTOR *led_descriptor;
+
+ // Check that the argument value is valid.
+ led = ctz(led);
+ led_descriptor = &LED_DESCRIPTOR[led];
+ if (led >= LED_COUNT || led_descriptor->PWM.CHANNEL < 0) return 0;
+
+ // Return the duty cycle value if the LED PWM channel is enabled, else 0.
+ return (AVR32_PWM.sr & (1 << led_descriptor->PWM.CHANNEL)) ?
+ AVR32_PWM.channel[led_descriptor->PWM.CHANNEL].cdty : 0;
+}
+
+
+void LED_Set_Intensity(U32 leds, U8 intensity)
+{
+ tLED_DESCRIPTOR *led_descriptor = &LED_DESCRIPTOR[0] - 1;
+ volatile avr32_pwm_channel_t *led_pwm_channel;
+ volatile avr32_gpio_port_t *led_gpio_port;
+ U8 led_shift;
+
+ // For each specified LED...
+ for (leds &= (1 << LED_COUNT) - 1; leds; leds >>= led_shift)
+ {
+ // Select the next specified LED and check that it has a PWM channel.
+ led_shift = 1 + ctz(leds);
+ led_descriptor += led_shift;
+ if (led_descriptor->PWM.CHANNEL < 0) continue;
+
+ // Initialize or update the LED PWM channel.
+ led_pwm_channel = &AVR32_PWM.channel[led_descriptor->PWM.CHANNEL];
+ if (!(AVR32_PWM.sr & (1 << led_descriptor->PWM.CHANNEL)))
+ {
+ led_pwm_channel->cmr = (AVR32_PWM_CPRE_MCK << AVR32_PWM_CPRE_OFFSET) &
+ ~(AVR32_PWM_CALG_MASK |
+ AVR32_PWM_CPOL_MASK |
+ AVR32_PWM_CPD_MASK);
+ led_pwm_channel->cprd = 0x000000FF;
+ led_pwm_channel->cdty = intensity;
+ AVR32_PWM.ena = 1 << led_descriptor->PWM.CHANNEL;
+ }
+ else
+ {
+ AVR32_PWM.isr;
+ while (!(AVR32_PWM.isr & (1 << led_descriptor->PWM.CHANNEL)));
+ led_pwm_channel->cupd = intensity;
+ }
+
+ // Switch the LED pin to its PWM function.
+ led_gpio_port = &AVR32_GPIO.port[led_descriptor->GPIO.PORT];
+ if (led_descriptor->PWM.FUNCTION & 0x1)
+ {
+ led_gpio_port->pmr0s = led_descriptor->GPIO.PIN_MASK;
+ }
+ else
+ {
+ led_gpio_port->pmr0c = led_descriptor->GPIO.PIN_MASK;
+ }
+ if (led_descriptor->PWM.FUNCTION & 0x2)
+ {
+ led_gpio_port->pmr1s = led_descriptor->GPIO.PIN_MASK;
+ }
+ else
+ {
+ led_gpio_port->pmr1c = led_descriptor->GPIO.PIN_MASK;
+ }
+ led_gpio_port->gperc = led_descriptor->GPIO.PIN_MASK;
+ }
+}
diff --git a/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/ARDUINO/led.h b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/ARDUINO/led.h
new file mode 100644
index 0000000..a577124
--- /dev/null
+++ b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/ARDUINO/led.h
@@ -0,0 +1,191 @@
+/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
+
+/*This file is prepared for Doxygen automatic documentation generation.*/
+/*! \file *********************************************************************
+ *
+ * \brief AT32UC3A EVK1100 board LEDs support package.
+ *
+ * This file contains definitions and services related to the LED features of
+ * the EVK1100 board.
+ *
+ * - Compiler: IAR EWAVR32 and GNU GCC for AVR32
+ * - Supported devices: All AVR32 AT32UC3A devices can be used.
+ * - AppNote:
+ *
+ * \author Atmel Corporation: http://www.atmel.com \n
+ * Support and FAQ: http://support.atmel.no/
+ *
+ ******************************************************************************/
+
+/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The name of Atmel may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * 4. This software may only be redistributed and used in connection with an Atmel
+ * AVR product.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ */
+
+#ifndef _LED_H_
+#define _LED_H_
+
+#include "compiler.h"
+
+
+/*! \name Identifiers of LEDs to Use with LED Functions
+ */
+//! @{
+#define LED0 0x01
+#define LED1 0x02
+#define LED2 0x04
+#define LED3 0x08
+#define LED4 0x10
+#define LED5 0x20
+#define LED6 0x40
+#define LED7 0x80
+//! @}
+
+
+/*! \brief Gets the last state of all LEDs set through the LED API.
+ *
+ * \return State of all LEDs (1 bit per LED).
+ *
+ * \note The GPIO pin configuration of all LEDs is left unchanged.
+ */
+extern U32 LED_Read_Display(void);
+
+/*! \brief Sets the state of all LEDs.
+ *
+ * \param leds New state of all LEDs (1 bit per LED).
+ *
+ * \note The pins of all LEDs are set to GPIO output mode.
+ */
+extern void LED_Display(U32 leds);
+
+/*! \brief Gets the last state of the specified LEDs set through the LED API.
+ *
+ * \param mask LEDs of which to get the state (1 bit per LED).
+ *
+ * \return State of the specified LEDs (1 bit per LED).
+ *
+ * \note The GPIO pin configuration of all LEDs is left unchanged.
+ */
+extern U32 LED_Read_Display_Mask(U32 mask);
+
+/*! \brief Sets the state of the specified LEDs.
+ *
+ * \param mask LEDs of which to set the state (1 bit per LED).
+ *
+ * \param leds New state of the specified LEDs (1 bit per LED).
+ *
+ * \note The pins of the specified LEDs are set to GPIO output mode.
+ */
+extern void LED_Display_Mask(U32 mask, U32 leds);
+
+/*! \brief Tests the last state of the specified LEDs set through the LED API.
+ *
+ * \param leds LEDs of which to test the state (1 bit per LED).
+ *
+ * \return \c TRUE if at least one of the specified LEDs has a state on, else
+ * \c FALSE.
+ *
+ * \note The GPIO pin configuration of all LEDs is left unchanged.
+ */
+extern Bool LED_Test(U32 leds);
+
+/*! \brief Turns off the specified LEDs.
+ *
+ * \param leds LEDs to turn off (1 bit per LED).
+ *
+ * \note The pins of the specified LEDs are set to GPIO output mode.
+ */
+extern void LED_Off(U32 leds);
+
+/*! \brief Turns on the specified LEDs.
+ *
+ * \param leds LEDs to turn on (1 bit per LED).
+ *
+ * \note The pins of the specified LEDs are set to GPIO output mode.
+ */
+extern void LED_On(U32 leds);
+
+/*! \brief Toggles the specified LEDs.
+ *
+ * \param leds LEDs to toggle (1 bit per LED).
+ *
+ * \note The pins of the specified LEDs are set to GPIO output mode.
+ */
+extern void LED_Toggle(U32 leds);
+
+/*! \brief Gets as a bit-field the last state of the specified LEDs set through
+ * the LED API.
+ *
+ * \param field LEDs of which to get the state (1 bit per LED).
+ *
+ * \return State of the specified LEDs (1 bit per LED, beginning with the first
+ * specified LED).
+ *
+ * \note The GPIO pin configuration of all LEDs is left unchanged.
+ */
+extern U32 LED_Read_Display_Field(U32 field);
+
+/*! \brief Sets as a bit-field the state of the specified LEDs.
+ *
+ * \param field LEDs of which to set the state (1 bit per LED).
+ * \param leds New state of the specified LEDs (1 bit per LED, beginning with
+ * the first specified LED).
+ *
+ * \note The pins of the specified LEDs are set to GPIO output mode.
+ */
+extern void LED_Display_Field(U32 field, U32 leds);
+
+/*! \brief Gets the intensity of the specified LED.
+ *
+ * \param led LED of which to get the intensity (1 bit per LED; only the least
+ * significant set bit is used).
+ *
+ * \return Intensity of the specified LED (0x00 to 0xFF).
+ *
+ * \warning The PWM channel of the specified LED is supposed to be used only by
+ * this module.
+ *
+ * \note The GPIO pin configuration of all LEDs is left unchanged.
+ */
+extern U8 LED_Get_Intensity(U32 led);
+
+/*! \brief Sets the intensity of the specified LEDs.
+ *
+ * \param leds LEDs of which to set the intensity (1 bit per LED).
+ * \param intensity New intensity of the specified LEDs (0x00 to 0xFF).
+ *
+ * \warning The PWM channels of the specified LEDs are supposed to be used only
+ * by this module.
+ *
+ * \note The pins of the specified LEDs are set to PWM output mode.
+ */
+extern void LED_Set_Intensity(U32 leds, U8 intensity);
+
+
+#endif // _LED_H_
diff --git a/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/EVK1105/evk1105.h b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/EVK1105/evk1105.h
new file mode 100644
index 0000000..edda44c
--- /dev/null
+++ b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/EVK1105/evk1105.h
@@ -0,0 +1,433 @@
+/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
+
+/*This file is prepared for Doxygen automatic documentation generation.*/
+/*! \file *********************************************************************
+ *
+ * \brief AT32UC3A EVK1105 board header file.
+ *
+ * This file contains definitions and services related to the features of the
+ * EVK1105 board rev. B.
+ *
+ * To use this board, define BOARD=EVK1105.
+ *
+ * - Compiler: IAR EWAVR32 and GNU GCC for AVR32
+ * - Supported devices: All AVR32 AT32UC3A devices can be used.
+ * - AppNote:
+ *
+ * \author Atmel Corporation: http://www.atmel.com \n
+ * Support and FAQ: http://support.atmel.no/
+ *
+ ******************************************************************************/
+
+/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The name of Atmel may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * 4. This software may only be redistributed and used in connection with an Atmel
+ * AVR product.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ */
+
+#ifndef _EVK1105_H_
+#define _EVK1105_H_
+
+#ifdef EVK1105_REV3
+# include "evk1105_rev3.h"
+#else
+
+#include "compiler.h"
+
+#ifdef __AVR32_ABI_COMPILER__ // Automatically defined when compiling for AVR32, not when assembling.
+# include "led.h"
+#endif // __AVR32_ABI_COMPILER__
+
+
+/*! \name Oscillator Definitions
+ */
+//! @{
+
+// RCOsc has no custom calibration by default. Set the following definition to
+// the appropriate value if a custom RCOsc calibration has been applied to your
+// part.
+//#define FRCOSC AVR32_PM_RCOSC_FREQUENCY //!< RCOsc frequency: Hz.
+
+#define FOSC32 32768 //!< Osc32 frequency: Hz.
+#define OSC32_STARTUP AVR32_PM_OSCCTRL32_STARTUP_8192_RCOSC //!< Osc32 startup time: RCOsc periods.
+
+#define FOSC0 12000000 //!< Osc0 frequency: Hz.
+#define OSC0_STARTUP AVR32_PM_OSCCTRL0_STARTUP_2048_RCOSC //!< Osc0 startup time: RCOsc periods.
+
+#define FOSC1 11289600 //!< Osc1 frequency: Hz
+#define OSC1_STARTUP AVR32_PM_OSCCTRL1_STARTUP_2048_RCOSC //!< Osc1 startup time: RCOsc periods.
+
+
+//! @}
+
+
+/*! \name SDRAM Definitions
+ */
+//! @{
+
+//! Part header file of used SDRAM(s).
+#define SDRAM_PART_HDR "MT48LC16M16A2TG7E/mt48lc16m16a2tg7e.h"
+
+//! Data bus width to use the SDRAM(s) with (16 or 32 bits; always 16 bits on
+//! UC3).
+#define SDRAM_DBW 16
+//! @}
+
+
+/*! \name USB Definitions
+ */
+//! @{
+//! Multiplexed pin used for USB_ID: AVR32_USBB_USB_ID_x_x.
+//! To be selected according to the AVR32_USBB_USB_ID_x_x_PIN and
+//! AVR32_USBB_USB_ID_x_x_FUNCTION definitions from <avr32/uc3axxxx.h>.
+#define AVR32_USBB_USB_ID_0_2_PIN 21
+#define AVR32_USBB_USB_ID_0_2_FUNCTION 2
+#define USB_ID AVR32_USBB_USB_ID_0_2
+
+//! Multiplexed pin used for USB_VBOF: AVR32_USBB_USB_VBOF_x_x.
+//! To be selected according to the AVR32_USBB_USB_VBOF_x_x_PIN and
+//! AVR32_USBB_USB_VBOF_x_x_FUNCTION definitions from <avr32/uc3axxxx.h>.
+# define USB_VBOF AVR32_USBB_USB_VBOF_0_1
+
+
+//! Active level of the USB_VBOF output pin.
+# define USB_VBOF_ACTIVE_LEVEL LOW
+
+//! USB overcurrent detection pin.
+# define USB_OVERCURRENT_DETECT_PIN AVR32_PIN_PX15
+
+//! @}
+
+
+//! GPIO connection of the MAC PHY PWR_DOWN/INT signal.
+# define MACB_INTERRUPT_PIN AVR32_PIN_PA26
+
+
+
+//! Number of LEDs.
+#define LED_COUNT 4
+
+/*! \name GPIO Connections of LEDs
+ */
+//! @{
+# define LED0_GPIO AVR32_PIN_PB27
+# define LED1_GPIO AVR32_PIN_PB28
+# define LED2_GPIO AVR32_PIN_PA05
+# define LED3_GPIO AVR32_PIN_PA06
+//! @}
+
+/*! \name Color Identifiers of LEDs to Use with LED Functions
+ */
+//! @{
+#define LED_MONO0_GREEN LED0
+#define LED_MONO1_GREEN LED1
+#define LED_MONO2_GREEN LED2
+#define LED_MONO3_GREEN LED3
+//! @}
+
+/*! \name PWM Channels of LEDs
+ */
+//! @{
+#define LED0_PWM 4
+#define LED1_PWM 5
+#define LED2_PWM (-1)
+#define LED3_PWM (-1)
+//! @}
+
+/*! \name PWM Functions of LEDs
+ */
+//! @{
+/* TODO: Implement PWM functionality */
+#define LED0_PWM_FUNCTION (-1)//AVR32_PWM_0_FUNCTION
+#define LED1_PWM_FUNCTION (-1)//AVR32_PWM_1_FUNCTION
+#define LED2_PWM_FUNCTION (-1)
+#define LED3_PWM_FUNCTION (-1)
+//! @}
+
+//! External interrupt connection of touch sensor.
+#define QT1081_EIC_EXTINT_PIN AVR32_EIC_EXTINT_1_PIN
+#define QT1081_EIC_EXTINT_FUNCTION AVR32_EIC_EXTINT_1_FUNCTION
+#define QT1081_EIC_EXTINT_IRQ AVR32_EIC_IRQ_1
+#define QT1081_EIC_EXTINT_INT AVR32_EIC_INT1
+/*! \name Touch sensor low power mode select
+ */
+#define QT1081_LP_MODE AVR32_PIN_PB29
+
+/*! \name GPIO Connections of touch buttons
+ */
+//! @{
+#define QT1081_TOUCH_SENSOR_0 AVR32_PIN_PB22
+#define QT1081_TOUCH_SENSOR_0_PRESSED 1
+#define QT1081_TOUCH_SENSOR_1 AVR32_PIN_PB23
+#define QT1081_TOUCH_SENSOR_1_PRESSED 1
+#define QT1081_TOUCH_SENSOR_2 AVR32_PIN_PB24
+#define QT1081_TOUCH_SENSOR_2_PRESSED 1
+#define QT1081_TOUCH_SENSOR_3 AVR32_PIN_PB25
+#define QT1081_TOUCH_SENSOR_3_PRESSED 1
+#define QT1081_TOUCH_SENSOR_4 AVR32_PIN_PB26
+#define QT1081_TOUCH_SENSOR_4_PRESSED 1
+
+#define QT1081_TOUCH_SENSOR_ENTER QT1081_TOUCH_SENSOR_4
+#define QT1081_TOUCH_SENSOR_ENTER_PRESSED QT1081_TOUCH_SENSOR_4_PRESSED
+#define QT1081_TOUCH_SENSOR_LEFT QT1081_TOUCH_SENSOR_3
+#define QT1081_TOUCH_SENSOR_LEFT_PRESSED QT1081_TOUCH_SENSOR_3_PRESSED
+#define QT1081_TOUCH_SENSOR_RIGHT QT1081_TOUCH_SENSOR_2
+#define QT1081_TOUCH_SENSOR_RIGHT_PRESSED QT1081_TOUCH_SENSOR_2_PRESSED
+#define QT1081_TOUCH_SENSOR_UP QT1081_TOUCH_SENSOR_0
+#define QT1081_TOUCH_SENSOR_UP_PRESSED QT1081_TOUCH_SENSOR_0_PRESSED
+#define QT1081_TOUCH_SENSOR_DOWN QT1081_TOUCH_SENSOR_1
+#define QT1081_TOUCH_SENSOR_DOWN_PRESSED QT1081_TOUCH_SENSOR_1_PRESSED
+//! @}
+
+/*! \name SPI Connections of the AT45DBX Data Flash Memory
+ */
+//! @{
+#define AT45DBX_SPI (&AVR32_SPI0)
+#define AT45DBX_SPI_NPCS 0
+#define AT45DBX_SPI_SCK_PIN AVR32_SPI0_SCK_0_0_PIN
+#define AT45DBX_SPI_SCK_FUNCTION AVR32_SPI0_SCK_0_0_FUNCTION
+#define AT45DBX_SPI_MISO_PIN AVR32_SPI0_MISO_0_0_PIN
+#define AT45DBX_SPI_MISO_FUNCTION AVR32_SPI0_MISO_0_0_FUNCTION
+#define AT45DBX_SPI_MOSI_PIN AVR32_SPI0_MOSI_0_0_PIN
+#define AT45DBX_SPI_MOSI_FUNCTION AVR32_SPI0_MOSI_0_0_FUNCTION
+#define AT45DBX_SPI_NPCS0_PIN AVR32_SPI0_NPCS_0_0_PIN
+#define AT45DBX_SPI_NPCS0_FUNCTION AVR32_SPI0_NPCS_0_0_FUNCTION
+//! @}
+
+/*! \name GPIO and SPI Connections of the SD/MMC Connector
+ */
+//! @{
+#define SD_MMC_CARD_DETECT_PIN AVR32_PIN_PA02
+#define SD_MMC_WRITE_PROTECT_PIN AVR32_PIN_PA18
+#define SD_MMC_SPI (&AVR32_SPI0)
+#define SD_MMC_SPI_NPCS 1
+#define SD_MMC_SPI_SCK_PIN AVR32_SPI0_SCK_0_0_PIN
+#define SD_MMC_SPI_SCK_FUNCTION AVR32_SPI0_SCK_0_0_FUNCTION
+#define SD_MMC_SPI_MISO_PIN AVR32_SPI0_MISO_0_0_PIN
+#define SD_MMC_SPI_MISO_FUNCTION AVR32_SPI0_MISO_0_0_FUNCTION
+#define SD_MMC_SPI_MOSI_PIN AVR32_SPI0_MOSI_0_0_PIN
+#define SD_MMC_SPI_MOSI_FUNCTION AVR32_SPI0_MOSI_0_0_FUNCTION
+#define SD_MMC_SPI_NPCS_PIN AVR32_SPI0_NPCS_1_0_PIN
+#define SD_MMC_SPI_NPCS_FUNCTION AVR32_SPI0_NPCS_1_0_FUNCTION
+//! @}
+
+
+/*! \name TWI expansion
+ */
+//! @{
+#define EXPANSION_TWI (&AVR32_TWI)
+#define EXPANSION_RESET AVR32_PIN_PX16
+#define EXPANSION_TWI_SCL_PIN AVR32_TWI_SCL_0_0_PIN
+#define EXPANSION_TWI_SCL_FUNCTION AVR32_TWI_SCL_0_0_FUNCTION
+#define EXPANSION_TWI_SDA_PIN AVR32_TWI_SDA_0_0_PIN
+#define EXPANSION_TWI_SDA_FUNCTION AVR32_TWI_SDA_0_0_FUNCTION
+//! @}
+
+/*! \name Wireless expansion
+ */
+
+#define WEXPANSION_EXTINT_PIN AVR32_EIC_EXTINT_8_PIN
+#define WEXPANSION_EXTINT_FUNCTION AVR32_EIC_EXTINT_8_FUNCTION
+#define WEXPANSION_GPIO1 AVR32_PIN_PB30
+#define WEXPANSION_GPIO2 AVR32_PIN_PB31
+
+#define WEXPANSION_SPI (&AVR32_SPI0)
+#define WEXPANSION_SPI_NPCS 2
+#define WEXPANSION_SPI_SCK_PIN AVR32_SPI0_SCK_0_0_PIN
+#define WEXPANSION_SPI_SCK_FUNCTION AVR32_SPI0_SCK_0_0_FUNCTION
+#define WEXPANSION_SPI_MISO_PIN AVR32_SPI0_MISO_0_0_PIN
+#define WEXPANSION_SPI_MISO_FUNCTION AVR32_SPI0_MISO_0_0_FUNCTION
+#define WEXPANSION_SPI_MOSI_PIN AVR32_SPI0_MOSI_0_0_PIN
+#define WEXPANSION_SPI_MOSI_FUNCTION AVR32_SPI0_MOSI_0_0_FUNCTION
+#define WEXPANSION_SPI_NPCS_PIN AVR32_SPI0_NPCS_2_0_PIN
+#define WEXPANSION_SPI_NPCS_FUNCTION AVR32_SPI0_NPCS_2_0_FUNCTION
+
+//! @}
+
+/*! \name ET024006DHU TFT display
+ */
+//! @{
+
+#define ET024006DHU_TE_PIN AVR32_PIN_PX19
+#define ET024006DHU_RESET_PIN AVR32_PIN_PX22
+#define ET024006DHU_BL_PIN AVR32_PWM_6_PIN
+#define ET024006DHU_BL_FUNCTION AVR32_PWM_6_FUNCTION
+#define ET024006DHU_DNC_PIN AVR32_EBI_ADDR_21_1_PIN
+#define ET024006DHU_DNC_FUNCTION AVR32_EBI_ADDR_21_1_FUNCTION
+#define ET024006DHU_EBI_NCS_PIN AVR32_EBI_NCS_0_1_PIN
+#define ET024006DHU_EBI_NCS_FUNCTION AVR32_EBI_NCS_0_1_FUNCTION
+
+//! @}
+/*! \name Optional SPI connection to the TFT
+ */
+//! @{
+
+#define ET024006DHU_SPI (&AVR32_SPI0)
+#define ET024006DHU_SPI_NPCS 3
+#define ET024006DHU_SPI_SCK_PIN AVR32_SPI0_SCK_0_0_PIN
+#define ET024006DHU_SPI_SCK_FUNCTION AVR32_SPI0_SCK_0_0_FUNCTION
+#define ET024006DHU_SPI_MISO_PIN AVR32_SPI0_MISO_0_0_PIN
+#define ET024006DHU_SPI_MISO_FUNCTION AVR32_SPI0_MISO_0_0_FUNCTION
+#define ET024006DHU_SPI_MOSI_PIN AVR32_SPI0_MOSI_0_0_PIN
+#define ET024006DHU_SPI_MOSI_FUNCTION AVR32_SPI0_MOSI_0_0_FUNCTION
+#define ET024006DHU_SPI_NPCS_PIN AVR32_SPI1_NPCS_3_0_PIN
+#define ET024006DHU_SPI_NPCS_FUNCTION AVR32_SPI1_NPCS_3_0_FUNCTION
+
+//! @}
+
+
+/*! \name Audio amplifier connection to the DAC
+ */
+//! @{
+
+#define TPA6130_ABDAC (&AVR32_ABDAC)
+
+#define TPA6130_DATA0_PIN AVR32_ABDAC_DATA_0_1_PIN
+#define TPA6130_DATA0_FUNCTION AVR32_ABDAC_DATA_0_1_FUNCTION
+#define TPA6130_DATAN0_PIN AVR32_ABDAC_DATAN_0_1_PIN
+#define TPA6130_DATAN0_FUNCTION AVR32_ABDAC_DATAN_0_1_FUNCTION
+#define TPA6130_DATA1_PIN AVR32_ABDAC_DATA_1_1_PIN
+#define TPA6130_DATA1_FUNCTION AVR32_ABDAC_DATA_1_1_FUNCTION
+#define TPA6130_DATAN1_PIN AVR32_ABDAC_DATAN_1_1_PIN
+#define TPA6130_DATAN1_FUNCTION AVR32_ABDAC_DATAN_1_1_FUNCTION
+
+#define TPA6130_ABDAC_PDCA_PID AVR32_PDCA_PID_ABDAC_TX
+#define TPA6130_ABDAC_PDCA_CHANNEL 0
+#define TPA6130_ABDAC_PDCA_IRQ AVR32_PDCA_IRQ_0
+#define TPA6130_ABDAC_PDCA_INT_LEVEL AVR32_INTC_INT3
+
+#define TPA6130_TWI (&AVR32_TWI)
+#define TPA6130_TWI_SCL_PIN AVR32_TWI_SCL_0_0_PIN
+#define TPA6130_TWI_SCL_FUNCTION AVR32_TWI_SCL_0_0_FUNCTION
+#define TPA6130_TWI_SDA_PIN AVR32_TWI_SDA_0_0_PIN
+#define TPA6130_TWI_SDA_FUNCTION AVR32_TWI_SDA_0_0_FUNCTION
+
+//! }@
+/*! \name TI TLV320AIC23B sound chip
+ */
+//! @{
+#define TLV320_SSC (&AVR32_SSC)
+#define TLV320_SSC_TX_CLOCK_PIN AVR32_SSC_TX_CLOCK_0_PIN
+#define TLV320_SSC_TX_CLOCK_FUNCTION AVR32_SSC_TX_CLOCK_0_FUNCTION
+#define TLV320_SSC_TX_DATA_PIN AVR32_SSC_TX_DATA_0_PIN
+#define TLV320_SSC_TX_DATA_FUNCTION AVR32_SSC_TX_DATA_0_FUNCTION
+#define TLV320_SSC_TX_FRAME_SYNC_PIN AVR32_SSC_TX_FRAME_SYNC_0_PIN
+#define TLV320_SSC_TX_FRAME_SYNC_FUNCTION AVR32_SSC_TX_FRAME_SYNC_0_FUNCTION
+
+#define TLV320_TWI (&AVR32_TWI)
+#define TLV320_TWI_SCL_PIN AVR32_TWI_SCL_0_0_PIN
+#define TLV320_TWI_SCL_FUNCTION AVR32_TWI_SCL_0_0_FUNCTION
+#define TLV320_TWI_SDA_PIN AVR32_TWI_SDA_0_0_PIN
+#define TLV320_TWI_SDA_FUNCTION AVR32_TWI_SDA_0_0_FUNCTION
+
+#define TLV320_PM_GCLK_PIN AVR32_PM_GCLK_0_0_PIN
+#define TLV320_PM_GCLK_FUNCTION AVR32_PM_GCLK_0_0_FUNCTION
+//! @}
+
+////! \name SPI: Apple Authentication Chip Hardware Connections
+////! @{
+#define IPOD_AUTH_CHIP_SPI (&AVR32_SPI0)
+#define IPOD_AUTH_CHIP_SPI_IRQ AVR32_SPI0_IRQ
+#define IPOD_AUTH_CHIP_SPI_NPCS 2
+#define IPOD_AUTH_CHIP_SPI_SCK_PIN AVR32_SPI0_SCK_0_0_PIN
+#define IPOD_AUTH_CHIP_SPI_SCK_FUNCTION AVR32_SPI0_SCK_0_0_FUNCTION
+#define IPOD_AUTH_CHIP_SPI_MISO_PIN AVR32_SPI0_MISO_0_0_PIN
+#define IPOD_AUTH_CHIP_SPI_MISO_FUNCTION AVR32_SPI0_MISO_0_0_FUNCTION
+#define IPOD_AUTH_CHIP_SPI_MOSI_PIN AVR32_SPI0_MOSI_0_0_PIN
+#define IPOD_AUTH_CHIP_SPI_MOSI_FUNCTION AVR32_SPI0_MOSI_0_0_FUNCTION
+#define IPOD_AUTH_CHIP_SPI_NPCS_PIN AVR32_SPI0_NPCS_2_0_PIN
+#define IPOD_AUTH_CHIP_SPI_NPCS_FUNCTION AVR32_SPI0_NPCS_2_0_FUNCTION
+#define IPOD_AUTH_CHIP_SPI_N_RESET_PIN AVR32_PIN_PB30
+#define IPOD_AUTH_CHIP_SPI_CP_READY_PIN AVR32_PIN_PB31
+//! }@
+
+/*! \name Connections of the iPOD Authentication Coprocessor
+ */
+//! @{
+
+#define IPOD_AUTH_CHIP_TWI (&AVR32_TWI)
+#define IPOD_AUTH_CHIP_TWI_SCL_PIN AVR32_TWI_SCL_0_0_PIN
+#define IPOD_AUTH_CHIP_TWI_SCL_FUNCTION AVR32_TWI_SCL_0_0_FUNCTION
+#define IPOD_AUTH_CHIP_TWI_SDA_PIN AVR32_TWI_SDA_0_0_PIN
+#define IPOD_AUTH_CHIP_TWI_SDA_FUNCTION AVR32_TWI_SDA_0_0_FUNCTION
+#define IPOD_AUTH_CHIP_TWI_N_RESET_PIN AVR32_PIN_PX16
+
+//! @}
+
+/*! \name USART connection to the UC3B board controller
+ */
+//! @{
+
+#define USART0_RXD_PIN AVR32_USART0_RXD_0_0_PIN
+#define USART0_RXD_FUNCTION AVR32_USART0_RXD_0_0_FUNCTION
+#define USART0_TXD_PIN AVR32_USART0_TXD_0_0_PIN
+#define USART0_TXD_FUNCTION AVR32_USART0_TXD_0_0_FUNCTION
+#define USART0_RTS_PIN AVR32_USART0_RTS_0_0_PIN
+#define USART0_RTS_FUNCTION AVR32_USART0_RTS_0_0_FUNCTION
+#define USART0_CTS_PIN AVR32_USART0_CTS_0_0_PIN
+#define USART0_CTS_FUNCTION AVR32_USART0_CTS_0_0_FUNCTION
+
+//! @}
+
+#define ADC_VEXT_PIN AVR32_ADC_AD_7_PIN
+#define ADC_VEXT_FUNCTION AVR32_ADC_AD_7_FUNCTION
+
+/*! \name LCD Connections of the ET024006DHU display
+ */
+//! @{
+#define ET024006DHU_SMC_USE_NCS 0
+#define ET024006DHU_SMC_COMPONENT_CS "smc_et024006dhu.h"
+
+#define ET024006DHU_EBI_DATA_0 AVR32_EBI_DATA_0
+#define ET024006DHU_EBI_DATA_1 AVR32_EBI_DATA_1
+#define ET024006DHU_EBI_DATA_2 AVR32_EBI_DATA_2
+#define ET024006DHU_EBI_DATA_3 AVR32_EBI_DATA_3
+#define ET024006DHU_EBI_DATA_4 AVR32_EBI_DATA_4
+#define ET024006DHU_EBI_DATA_5 AVR32_EBI_DATA_5
+#define ET024006DHU_EBI_DATA_6 AVR32_EBI_DATA_6
+#define ET024006DHU_EBI_DATA_7 AVR32_EBI_DATA_7
+#define ET024006DHU_EBI_DATA_8 AVR32_EBI_DATA_8
+#define ET024006DHU_EBI_DATA_9 AVR32_EBI_DATA_9
+#define ET024006DHU_EBI_DATA_10 AVR32_EBI_DATA_10
+#define ET024006DHU_EBI_DATA_11 AVR32_EBI_DATA_11
+#define ET024006DHU_EBI_DATA_12 AVR32_EBI_DATA_12
+#define ET024006DHU_EBI_DATA_13 AVR32_EBI_DATA_13
+#define ET024006DHU_EBI_DATA_14 AVR32_EBI_DATA_14
+#define ET024006DHU_EBI_DATA_15 AVR32_EBI_DATA_15
+
+#define ET024006DHU_EBI_ADDR_21 AVR32_EBI_ADDR_21_1
+
+#define ET024006DHU_EBI_NWE AVR32_EBI_NWE0_0
+#define ET024006DHU_EBI_NRD AVR32_EBI_NRD_0
+#define ET024006DHU_EBI_NCS AVR32_EBI_NCS_0_1
+//! @}
+
+
+#endif // !EVK1105_REVA
+
+#endif // _EVK1105_H_
diff --git a/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/EVK1105/led.c b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/EVK1105/led.c
new file mode 100644
index 0000000..561652a
--- /dev/null
+++ b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/EVK1105/led.c
@@ -0,0 +1,346 @@
+/* This source file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
+
+/*This file is prepared for Doxygen automatic documentation generation.*/
+/*! \file *********************************************************************
+ *
+ * \brief AT32UC3A EVK1105 board LEDs support package.
+ *
+ * This file contains definitions and services related to the LED features of
+ * the EVK1105 board.
+ *
+ * - Compiler: IAR EWAVR32 and GNU GCC for AVR32
+ * - Supported devices: All AVR32 AT32UC3A devices can be used.
+ * - AppNote:
+ *
+ * \author Atmel Corporation: http://www.atmel.com \n
+ * Support and FAQ: http://support.atmel.no/
+ *
+ ******************************************************************************/
+
+/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The name of Atmel may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * 4. This software may only be redistributed and used in connection with an Atmel
+ * AVR product.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ */
+
+#include <avr32/io.h>
+#include "preprocessor.h"
+#include "compiler.h"
+#include "evk1105.h"
+#include "led.h"
+
+
+//! Structure describing LED hardware connections.
+typedef const struct
+{
+ struct
+ {
+ U32 PORT; //!< LED GPIO port.
+ U32 PIN_MASK; //!< Bit-mask of LED pin in GPIO port.
+ } GPIO; //!< LED GPIO descriptor.
+ struct
+ {
+ S32 CHANNEL; //!< LED PWM channel (< 0 if N/A).
+ S32 FUNCTION; //!< LED pin PWM function (< 0 if N/A).
+ } PWM; //!< LED PWM descriptor.
+} tLED_DESCRIPTOR;
+
+
+//! Hardware descriptors of all LEDs.
+static tLED_DESCRIPTOR LED_DESCRIPTOR[LED_COUNT] =
+{
+#define INSERT_LED_DESCRIPTOR(LED_NO, unused) \
+ { \
+ {LED##LED_NO##_GPIO / 32, 1 << (LED##LED_NO##_GPIO % 32)},\
+ {LED##LED_NO##_PWM, LED##LED_NO##_PWM_FUNCTION } \
+ },
+ MREPEAT(LED_COUNT, INSERT_LED_DESCRIPTOR, ~)
+#undef INSERT_LED_DESCRIPTOR
+};
+
+
+//! Saved state of all LEDs.
+static volatile U32 LED_State = (1 << LED_COUNT) - 1;
+
+
+U32 LED_Read_Display(void)
+{
+ return LED_State;
+}
+
+
+void LED_Display(U32 leds)
+{
+ // Use the LED descriptors to get the connections of a given LED to the MCU.
+ tLED_DESCRIPTOR *led_descriptor;
+ volatile avr32_gpio_port_t *led_gpio_port;
+
+ // Make sure only existing LEDs are specified.
+ leds &= (1 << LED_COUNT) - 1;
+
+ // Update the saved state of all LEDs with the requested changes.
+ LED_State = leds;
+
+ // For all LEDs...
+ for (led_descriptor = &LED_DESCRIPTOR[0];
+ led_descriptor < LED_DESCRIPTOR + LED_COUNT;
+ led_descriptor++)
+ {
+ // Set the LED to the requested state.
+ led_gpio_port = &AVR32_GPIO.port[led_descriptor->GPIO.PORT];
+ if (leds & 1)
+ {
+ led_gpio_port->ovrc = led_descriptor->GPIO.PIN_MASK;
+ }
+ else
+ {
+ led_gpio_port->ovrs = led_descriptor->GPIO.PIN_MASK;
+ }
+ led_gpio_port->oders = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->gpers = led_descriptor->GPIO.PIN_MASK;
+ leds >>= 1;
+ }
+}
+
+
+U32 LED_Read_Display_Mask(U32 mask)
+{
+ return Rd_bits(LED_State, mask);
+}
+
+
+void LED_Display_Mask(U32 mask, U32 leds)
+{
+ // Use the LED descriptors to get the connections of a given LED to the MCU.
+ tLED_DESCRIPTOR *led_descriptor = &LED_DESCRIPTOR[0] - 1;
+ volatile avr32_gpio_port_t *led_gpio_port;
+ U8 led_shift;
+
+ // Make sure only existing LEDs are specified.
+ mask &= (1 << LED_COUNT) - 1;
+
+ // Update the saved state of all LEDs with the requested changes.
+ Wr_bits(LED_State, mask, leds);
+
+ // While there are specified LEDs left to manage...
+ while (mask)
+ {
+ // Select the next specified LED and set it to the requested state.
+ led_shift = 1 + ctz(mask);
+ led_descriptor += led_shift;
+ led_gpio_port = &AVR32_GPIO.port[led_descriptor->GPIO.PORT];
+ leds >>= led_shift - 1;
+ if (leds & 1)
+ {
+ led_gpio_port->ovrc = led_descriptor->GPIO.PIN_MASK;
+ }
+ else
+ {
+ led_gpio_port->ovrs = led_descriptor->GPIO.PIN_MASK;
+ }
+ led_gpio_port->oders = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->gpers = led_descriptor->GPIO.PIN_MASK;
+ leds >>= 1;
+ mask >>= led_shift;
+ }
+}
+
+
+Bool LED_Test(U32 leds)
+{
+ return Tst_bits(LED_State, leds);
+}
+
+
+void LED_Off(U32 leds)
+{
+ // Use the LED descriptors to get the connections of a given LED to the MCU.
+ tLED_DESCRIPTOR *led_descriptor = &LED_DESCRIPTOR[0] - 1;
+ volatile avr32_gpio_port_t *led_gpio_port;
+ U8 led_shift;
+
+ // Make sure only existing LEDs are specified.
+ leds &= (1 << LED_COUNT) - 1;
+
+ // Update the saved state of all LEDs with the requested changes.
+ Clr_bits(LED_State, leds);
+
+ // While there are specified LEDs left to manage...
+ while (leds)
+ {
+ // Select the next specified LED and turn it off.
+ led_shift = 1 + ctz(leds);
+ led_descriptor += led_shift;
+ led_gpio_port = &AVR32_GPIO.port[led_descriptor->GPIO.PORT];
+ led_gpio_port->ovrs = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->oders = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->gpers = led_descriptor->GPIO.PIN_MASK;
+ leds >>= led_shift;
+ }
+}
+
+
+void LED_On(U32 leds)
+{
+ // Use the LED descriptors to get the connections of a given LED to the MCU.
+ tLED_DESCRIPTOR *led_descriptor = &LED_DESCRIPTOR[0] - 1;
+ volatile avr32_gpio_port_t *led_gpio_port;
+ U8 led_shift;
+
+ // Make sure only existing LEDs are specified.
+ leds &= (1 << LED_COUNT) - 1;
+
+ // Update the saved state of all LEDs with the requested changes.
+ Set_bits(LED_State, leds);
+
+ // While there are specified LEDs left to manage...
+ while (leds)
+ {
+ // Select the next specified LED and turn it on.
+ led_shift = 1 + ctz(leds);
+ led_descriptor += led_shift;
+ led_gpio_port = &AVR32_GPIO.port[led_descriptor->GPIO.PORT];
+ led_gpio_port->ovrc = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->oders = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->gpers = led_descriptor->GPIO.PIN_MASK;
+ leds >>= led_shift;
+ }
+}
+
+
+void LED_Toggle(U32 leds)
+{
+ // Use the LED descriptors to get the connections of a given LED to the MCU.
+ tLED_DESCRIPTOR *led_descriptor = &LED_DESCRIPTOR[0] - 1;
+ volatile avr32_gpio_port_t *led_gpio_port;
+ U8 led_shift;
+
+ // Make sure only existing LEDs are specified.
+ leds &= (1 << LED_COUNT) - 1;
+
+ // Update the saved state of all LEDs with the requested changes.
+ Tgl_bits(LED_State, leds);
+
+ // While there are specified LEDs left to manage...
+ while (leds)
+ {
+ // Select the next specified LED and toggle it.
+ led_shift = 1 + ctz(leds);
+ led_descriptor += led_shift;
+ led_gpio_port = &AVR32_GPIO.port[led_descriptor->GPIO.PORT];
+ led_gpio_port->ovrt = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->oders = led_descriptor->GPIO.PIN_MASK;
+ led_gpio_port->gpers = led_descriptor->GPIO.PIN_MASK;
+ leds >>= led_shift;
+ }
+}
+
+
+U32 LED_Read_Display_Field(U32 field)
+{
+ return Rd_bitfield(LED_State, field);
+}
+
+
+void LED_Display_Field(U32 field, U32 leds)
+{
+ // Move the bit-field to the appropriate position for the bit-mask.
+ LED_Display_Mask(field, leds << ctz(field));
+}
+
+
+U8 LED_Get_Intensity(U32 led)
+{
+ tLED_DESCRIPTOR *led_descriptor;
+
+ // Check that the argument value is valid.
+ led = ctz(led);
+ led_descriptor = &LED_DESCRIPTOR[led];
+ if (led >= LED_COUNT || led_descriptor->PWM.CHANNEL < 0) return 0;
+
+ // Return the duty cycle value if the LED PWM channel is enabled, else 0.
+ return (AVR32_PWM.sr & (1 << led_descriptor->PWM.CHANNEL)) ?
+ AVR32_PWM.channel[led_descriptor->PWM.CHANNEL].cdty : 0;
+}
+
+
+void LED_Set_Intensity(U32 leds, U8 intensity)
+{
+ tLED_DESCRIPTOR *led_descriptor = &LED_DESCRIPTOR[0] - 1;
+ volatile avr32_pwm_channel_t *led_pwm_channel;
+ volatile avr32_gpio_port_t *led_gpio_port;
+ U8 led_shift;
+
+ // For each specified LED...
+ for (leds &= (1 << LED_COUNT) - 1; leds; leds >>= led_shift)
+ {
+ // Select the next specified LED and check that it has a PWM channel.
+ led_shift = 1 + ctz(leds);
+ led_descriptor += led_shift;
+ if (led_descriptor->PWM.CHANNEL < 0) continue;
+
+ // Initialize or update the LED PWM channel.
+ led_pwm_channel = &AVR32_PWM.channel[led_descriptor->PWM.CHANNEL];
+ if (!(AVR32_PWM.sr & (1 << led_descriptor->PWM.CHANNEL)))
+ {
+ led_pwm_channel->cmr = (AVR32_PWM_CPRE_MCK << AVR32_PWM_CPRE_OFFSET) &
+ ~(AVR32_PWM_CALG_MASK |
+ AVR32_PWM_CPOL_MASK |
+ AVR32_PWM_CPD_MASK);
+ led_pwm_channel->cprd = 0x000000FF;
+ led_pwm_channel->cdty = intensity;
+ AVR32_PWM.ena = 1 << led_descriptor->PWM.CHANNEL;
+ }
+ else
+ {
+ AVR32_PWM.isr;
+ while (!(AVR32_PWM.isr & (1 << led_descriptor->PWM.CHANNEL)));
+ led_pwm_channel->cupd = intensity;
+ }
+
+ // Switch the LED pin to its PWM function.
+ led_gpio_port = &AVR32_GPIO.port[led_descriptor->GPIO.PORT];
+ if (led_descriptor->PWM.FUNCTION & 0x1)
+ {
+ led_gpio_port->pmr0s = led_descriptor->GPIO.PIN_MASK;
+ }
+ else
+ {
+ led_gpio_port->pmr0c = led_descriptor->GPIO.PIN_MASK;
+ }
+ if (led_descriptor->PWM.FUNCTION & 0x2)
+ {
+ led_gpio_port->pmr1s = led_descriptor->GPIO.PIN_MASK;
+ }
+ else
+ {
+ led_gpio_port->pmr1c = led_descriptor->GPIO.PIN_MASK;
+ }
+ led_gpio_port->gperc = led_descriptor->GPIO.PIN_MASK;
+ }
+}
diff --git a/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/EVK1105/led.h b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/EVK1105/led.h
new file mode 100644
index 0000000..7766b6a
--- /dev/null
+++ b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/EVK1105/led.h
@@ -0,0 +1,187 @@
+/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
+
+/*This file is prepared for Doxygen automatic documentation generation.*/
+/*! \file *********************************************************************
+ *
+ * \brief AT32UC3A EVK1105 board LEDs support package.
+ *
+ * This file contains definitions and services related to the LED features of
+ * the EVK1105 board.
+ *
+ * - Compiler: IAR EWAVR32 and GNU GCC for AVR32
+ * - Supported devices: All AVR32 AT32UC3A devices can be used.
+ * - AppNote:
+ *
+ * \author Atmel Corporation: http://www.atmel.com \n
+ * Support and FAQ: http://support.atmel.no/
+ *
+ ******************************************************************************/
+
+/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The name of Atmel may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * 4. This software may only be redistributed and used in connection with an Atmel
+ * AVR product.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ */
+
+#ifndef _LED_H_
+#define _LED_H_
+
+#include "compiler.h"
+
+
+/*! \name Identifiers of LEDs to Use with LED Functions
+ */
+//! @{
+#define LED0 0x01
+#define LED1 0x02
+#define LED2 0x04
+#define LED3 0x08
+//! @}
+
+
+/*! \brief Gets the last state of all LEDs set through the LED API.
+ *
+ * \return State of all LEDs (1 bit per LED).
+ *
+ * \note The GPIO pin configuration of all LEDs is left unchanged.
+ */
+extern U32 LED_Read_Display(void);
+
+/*! \brief Sets the state of all LEDs.
+ *
+ * \param leds New state of all LEDs (1 bit per LED).
+ *
+ * \note The pins of all LEDs are set to GPIO output mode.
+ */
+extern void LED_Display(U32 leds);
+
+/*! \brief Gets the last state of the specified LEDs set through the LED API.
+ *
+ * \param mask LEDs of which to get the state (1 bit per LED).
+ *
+ * \return State of the specified LEDs (1 bit per LED).
+ *
+ * \note The GPIO pin configuration of all LEDs is left unchanged.
+ */
+extern U32 LED_Read_Display_Mask(U32 mask);
+
+/*! \brief Sets the state of the specified LEDs.
+ *
+ * \param mask LEDs of which to set the state (1 bit per LED).
+ *
+ * \param leds New state of the specified LEDs (1 bit per LED).
+ *
+ * \note The pins of the specified LEDs are set to GPIO output mode.
+ */
+extern void LED_Display_Mask(U32 mask, U32 leds);
+
+/*! \brief Tests the last state of the specified LEDs set through the LED API.
+ *
+ * \param leds LEDs of which to test the state (1 bit per LED).
+ *
+ * \return \c TRUE if at least one of the specified LEDs has a state on, else
+ * \c FALSE.
+ *
+ * \note The GPIO pin configuration of all LEDs is left unchanged.
+ */
+extern Bool LED_Test(U32 leds);
+
+/*! \brief Turns off the specified LEDs.
+ *
+ * \param leds LEDs to turn off (1 bit per LED).
+ *
+ * \note The pins of the specified LEDs are set to GPIO output mode.
+ */
+extern void LED_Off(U32 leds);
+
+/*! \brief Turns on the specified LEDs.
+ *
+ * \param leds LEDs to turn on (1 bit per LED).
+ *
+ * \note The pins of the specified LEDs are set to GPIO output mode.
+ */
+extern void LED_On(U32 leds);
+
+/*! \brief Toggles the specified LEDs.
+ *
+ * \param leds LEDs to toggle (1 bit per LED).
+ *
+ * \note The pins of the specified LEDs are set to GPIO output mode.
+ */
+extern void LED_Toggle(U32 leds);
+
+/*! \brief Gets as a bit-field the last state of the specified LEDs set through
+ * the LED API.
+ *
+ * \param field LEDs of which to get the state (1 bit per LED).
+ *
+ * \return State of the specified LEDs (1 bit per LED, beginning with the first
+ * specified LED).
+ *
+ * \note The GPIO pin configuration of all LEDs is left unchanged.
+ */
+extern U32 LED_Read_Display_Field(U32 field);
+
+/*! \brief Sets as a bit-field the state of the specified LEDs.
+ *
+ * \param field LEDs of which to set the state (1 bit per LED).
+ * \param leds New state of the specified LEDs (1 bit per LED, beginning with
+ * the first specified LED).
+ *
+ * \note The pins of the specified LEDs are set to GPIO output mode.
+ */
+extern void LED_Display_Field(U32 field, U32 leds);
+
+/*! \brief Gets the intensity of the specified LED.
+ *
+ * \param led LED of which to get the intensity (1 bit per LED; only the least
+ * significant set bit is used).
+ *
+ * \return Intensity of the specified LED (0x00 to 0xFF).
+ *
+ * \warning The PWM channel of the specified LED is supposed to be used only by
+ * this module.
+ *
+ * \note The GPIO pin configuration of all LEDs is left unchanged.
+ */
+extern U8 LED_Get_Intensity(U32 led);
+
+/*! \brief Sets the intensity of the specified LEDs.
+ *
+ * \param leds LEDs of which to set the intensity (1 bit per LED).
+ * \param intensity New intensity of the specified LEDs (0x00 to 0xFF).
+ *
+ * \warning The PWM channels of the specified LEDs are supposed to be used only
+ * by this module.
+ *
+ * \note The pins of the specified LEDs are set to PWM output mode.
+ */
+extern void LED_Set_Intensity(U32 leds, U8 intensity);
+
+
+#endif // _LED_H_
diff --git a/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/board.h b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/board.h
new file mode 100644
index 0000000..78ee91e
--- /dev/null
+++ b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/board.h
@@ -0,0 +1,120 @@
+/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
+
+/*This file is prepared for Doxygen automatic documentation generation.*/
+/*! \file *********************************************************************
+ *
+ * \brief Standard board header file.
+ *
+ * This file includes the appropriate board header file according to the
+ * defined board.
+ *
+ * - Compiler: IAR EWAVR32 and GNU GCC for AVR32
+ * - Supported devices: All AVR32 devices can be used.
+ * - AppNote:
+ *
+ * \author Atmel Corporation: http://www.atmel.com \n
+ * Support and FAQ: http://support.atmel.no/
+ *
+ ******************************************************************************/
+
+/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The name of Atmel may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * 4. This software may only be redistributed and used in connection with an Atmel
+ * AVR product.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ */
+
+#ifndef _BOARD_H_
+#define _BOARD_H_
+
+#include <avr32/io.h>
+
+/*! \name Base Boards
+ */
+//! @{
+#define EVK1100 1 //!< AT32UC3A EVK1100 board.
+#define EVK1101 2 //!< AT32UC3B EVK1101 board.
+#define UC3C_EK 3 //!< AT32UC3C UC3C_EK board.
+#define EVK1104 4 //!< AT32UC3A3 EVK1104 board.
+#define EVK1105 5 //!< AT32UC3A EVK1105 board.
+#define STK1000 6 //!< AT32AP7000 STK1000 board.
+#define NGW100 7 //!< AT32AP7000 NGW100 board.
+#define STK600_RCUC3L0 8 //!< STK600 RCUC3L0 board.
+#define UC3L_EK 9 //!< AT32UC3L-EK board.
+#define USER_BOARD 99 //!< User-reserved board (if any).
+//! @}
+
+/*! \name Extension Boards
+ */
+//! @{
+#define EXT1102 1 //!< AT32UC3B EXT1102 board.
+#define MC300 2 //!< AT32UC3 MC300 board.
+#define USER_EXT_BOARD 99 //!< User-reserved extension board (if any).
+//! @}
+
+#if BOARD == EVK1100
+ #include "EVK1100/evk1100.h"
+#elif BOARD == EVK1101
+ #include "EVK1101/evk1101.h"
+#elif BOARD == UC3C_EK
+ #include "UC3C_EK/uc3c_ek.h"
+#elif BOARD == EVK1104
+ #include "EVK1104/evk1104.h"
+#elif BOARD == EVK1105
+ #include "EVK1105/evk1105.h"
+#elif BOARD == STK1000
+ #include "STK1000/stk1000.h"
+#elif BOARD == NGW100
+ #include "NGW100/ngw100.h"
+#elif BOARD == STK600_RCUC3L0
+ #include "STK600/RCUC3L0/stk600_rcuc3l0.h"
+#elif BOARD == UC3L_EK
+ #include "UC3L_EK/uc3l_ek.h"
+#elif BOARD == ARDUINO
+ #include "ARDUINO/arduino.h"
+#else
+ #error No known AVR32 board defined
+#endif
+
+#if (defined EXT_BOARD)
+ #if EXT_BOARD == EXT1102
+ #include "EXT1102/ext1102.h"
+ #elif EXT_BOARD == MC300
+ #include "MC300/mc300.h"
+ #elif EXT_BOARD == USER_EXT_BOARD
+ // User-reserved area: #include the header file of your extension board here
+ // (if any).
+ #endif
+#endif
+
+
+#ifndef FRCOSC
+ #define FRCOSC AVR32_PM_RCOSC_FREQUENCY //!< Default RCOsc frequency.
+#endif
+
+
+#endif // _BOARD_H_
diff --git a/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/board.h.ori b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/board.h.ori
new file mode 100644
index 0000000..30052c8
--- /dev/null
+++ b/firmwares/wifishield/wifi_dnld/src/SOFTWARE_FRAMEWORK/BOARDS/board.h.ori
@@ -0,0 +1,121 @@
+/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
+
+/*This file is prepared for Doxygen automatic documentation generation.*/
+/*! \file *********************************************************************
+ *
+ * \brief Standard board header file.
+ *
+ * This file includes the appropriate board header file according to the
+ * defined board.
+ *
+ * - Compiler: IAR EWAVR32 and GNU GCC for AVR32
+ * - Supported devices: All AVR32 devices can be used.
+ * - AppNote:
+ *
+ * \author Atmel Corporation: http://www.atmel.com \n
+ * Support and FAQ: http://support.atmel.no/
+ *
+ ******************************************************************************/
+
+/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The name of Atmel may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * 4. This software may only be redistributed and used in connection with an Atmel
+ * AVR product.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
+ *
+ */
+
+#ifndef _BOARD_H_
+#define _BOARD_H_
+
+#include <avr32/io.h>
+
+/*! \name Base Boards
+ */
+//! @{
+#define EVK1100 1 //!< AT32UC3A EVK1100 board.
+#define EVK1101 2 //!< AT32UC3B EVK1101 board.
+#define UC3C_EK 3 //!< AT32UC3C UC3C_EK board.
+#define EVK1104 4 //!< AT32UC3A3 EVK1104 board.
+#define EVK1105 5 //!< AT32UC3A EVK1105 board.
+#define STK1000 6 //!< AT32AP7000 STK1000 board.
+#define NGW100 7 //!< AT32AP7000 NGW100 board.
+#define STK600_RCUC3L0 8 //!< STK600 RCUC3L0 board.
+#define UC3L_EK 9 //!< AT32UC3L-EK board.
+#define USER_BOARD 99 //!< User-reserved board (if any).
+//! @}
+
+/*! \name Extension Boards
+ */
+//! @{
+#define EXT1102 1 //!< AT32UC3B EXT1102 board.
+#define MC300 2 //!< AT32UC3 MC300 board.
+#define USER_EXT_BOARD 99 //!< User-reserved extension board (if any).
+//! @}
+
+#if BOARD == EVK1100
+ #include "EVK1100/evk1100.h"
+#elif BOARD == EVK1101
+ #include "EVK1101/evk1101.h"
+#elif BOARD == UC3C_EK
+ #include "UC3C_EK/uc3c_ek.h"
+#elif BOARD == EVK1104
+ #include "EVK1104/evk1104.h"
+#elif BOARD == EVK1105
+ #include "EVK1105/evk1105.h"
+#elif BOARD == STK1000
+ #include "STK1000/stk1000.h"
+#elif BOARD == NGW100
+ #include "NGW100/ngw100.h"
+#elif BOARD == STK600_RCUC3L0
+ #include "STK600/RCUC3L0/stk600_rcuc3l0.h"
+#elif BOARD == UC3L_EK
+ #include "UC3L_EK/uc3l_ek.h"
+#elif BOARD == USER_BOARD
+ // User-reserved area: #include the header file of your board here (if any).
+ #include "user_board.h"
+#else
+ #error No known AVR32 board defined
+#endif
+
+#if (defined EXT_BOARD)
+ #if EXT_BOARD == EXT1102
+ #include "EXT1102/ext1102.h"
+ #elif EXT_BOARD == MC300
+ #include "MC300/mc300.h"
+ #elif EXT_BOARD == USER_EXT_BOARD
+ // User-reserved area: #include the header file of your extension board here
+ // (if any).
+ #endif
+#endif
+
+
+#ifndef FRCOSC
+ #define FRCOSC AVR32_PM_RCOSC_FREQUENCY //!< Default RCOsc frequency.
+#endif
+
+
+#endif // _BOARD_H_