hdo  beta
/home/mrazik/Documents/web/old/hdo/at91lib/peripherals/pio/pio.h
Zobrazit dokumentaci tohoto souboru.
00001 /* ----------------------------------------------------------------------------
00002  *         ATMEL Microcontroller Software Support 
00003  * ----------------------------------------------------------------------------
00004  * Copyright (c) 2008, Atmel Corporation
00005  *
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions are met:
00010  *
00011  * - Redistributions of source code must retain the above copyright notice,
00012  * this list of conditions and the disclaimer below.
00013  *
00014  * Atmel's name may not be used to endorse or promote products derived from
00015  * this software without specific prior written permission.
00016  *
00017  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00019  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
00020  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00022  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00023  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00024  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00025  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00026  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  * ----------------------------------------------------------------------------
00028  */
00029 
00030 //------------------------------------------------------------------------------
00065 //------------------------------------------------------------------------------
00066  
00067 #ifndef PIO_H
00068 #define PIO_H
00069 
00070 //------------------------------------------------------------------------------
00071 //         Headers
00072 //------------------------------------------------------------------------------
00073 
00074 #include <board.h>
00075 
00076 //------------------------------------------------------------------------------
00077 //         Global Definitions
00078 //------------------------------------------------------------------------------
00079 
00081 #define PIO_PERIPH_A                0
00082 
00083 #define PIO_PERIPH_B                1
00084 
00085 #define PIO_INPUT                   2
00086 
00087 #define PIO_OUTPUT_0                3
00088 
00089 #define PIO_OUTPUT_1                4
00090 
00092 #define PIO_DEFAULT                 (0 << 0)
00093 
00094 #define PIO_PULLUP                  (1 << 0)
00095 
00096 #define PIO_DEGLITCH                (1 << 1)
00097 
00098 #define PIO_OPENDRAIN               (1 << 2)
00099 
00100 //------------------------------------------------------------------------------
00101 //         Global Macros
00102 //------------------------------------------------------------------------------
00103 
00104 //------------------------------------------------------------------------------
00109 //------------------------------------------------------------------------------
00110 #define PIO_LISTSIZE(pPins)    (sizeof(pPins) / sizeof(Pin))
00111 
00112 //------------------------------------------------------------------------------
00113 //         Global Types
00114 //------------------------------------------------------------------------------
00115 
00116 //------------------------------------------------------------------------------
00130 //------------------------------------------------------------------------------
00131 typedef struct {
00132 
00134     unsigned int mask; 
00136     AT91S_PIO    *pio;
00138     unsigned char id;
00140     unsigned char type;
00142     unsigned char attribute;
00143 
00144 } Pin;
00145 
00146 //------------------------------------------------------------------------------
00147 //         Global Functions
00148 //------------------------------------------------------------------------------
00149 
00150 extern unsigned char PIO_Configure(const Pin *list, unsigned int size);
00151 
00152 extern void PIO_Set(const Pin *pin);
00153 
00154 extern void PIO_Clear(const Pin *pin);
00155 
00156 extern unsigned char PIO_Get(const Pin *pin);
00157 
00158 extern unsigned int PIO_GetISR(const Pin *pin);
00159 
00160 extern unsigned char PIO_GetOutputDataStatus(const Pin *pin);
00161 
00162 #endif //#ifndef PIO_H
00163