00001 /*This file has been prepared for Doxygen automatic documentation generation.*/ 00023 /* Copyright (C) 2006-2008, Atmel Corporation All rights reserved. 00024 * 00025 * Redistribution and use in source and binary forms, with or without 00026 * modification, are permitted provided that the following conditions are met: 00027 * 00028 * 1. Redistributions of source code must retain the above copyright notice, 00029 * this list of conditions and the following disclaimer. 00030 * 00031 * 2. Redistributions in binary form must reproduce the above copyright notice, 00032 * this list of conditions and the following disclaimer in the documentation 00033 * and/or other materials provided with the distribution. 00034 * 00035 * 3. The name of ATMEL may not be used to endorse or promote products derived 00036 * from this software without specific prior written permission. 00037 * 00038 * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED 00039 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00040 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND 00041 * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, 00042 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00043 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00044 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00045 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00046 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00047 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00048 */ 00049 00050 00051 #ifndef _pio_h_ 00052 #define _pio_h_ 00053 00054 #ifdef __GNUC__ 00055 #include <avr32/io.h> 00056 #elif __ICCAVR32__ 00057 #include <avr32/ioap7000.h> 00058 #else 00059 #error No known compiler used 00060 #endif 00061 00067 typedef struct 00068 { 00069 unsigned char pin; 00070 unsigned char function; 00071 } gpio_map_t[]; 00072 00073 #define PIO_INVALID_ARGUMENT -1 00074 #define PIO_SUCCESS 0 00075 00081 extern volatile avr32_pio_t *pioGetHandle(int port); 00082 00089 extern int gpio_enable_module_pin(int pin, int function); 00090 00097 extern int pio_setup_pin(int pin, int function); 00098 00105 extern void pio_enable_module(const gpio_map_t piomap, int size); 00106 00113 extern void gpio_enable_module(const gpio_map_t piomap, int size); 00114 00115 #endif