00001 /* ---------------------------------------------------------------------------- 00002 * SAM Software Package License 00003 * ---------------------------------------------------------------------------- 00004 * Copyright (c) 2011, 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 /** 00031 * \file 00032 * 00033 * \par Purpose 00034 * 00035 * Configuration and handling of interrupts on PIO status changes. The API 00036 * provided here have several advantages over the traditional PIO interrupt 00037 * configuration approach: 00038 * - It is highly portable 00039 * - It automatically demultiplexes interrupts when multiples pins have been 00040 * configured on a single PIO controller 00041 * - It allows a group of pins to share the same interrupt 00042 * 00043 * However, it also has several minor drawbacks that may prevent from using it 00044 * in particular applications: 00045 * - It enables the clocks of all PIO controllers 00046 * - PIO controllers all share the same interrupt handler, which does the 00047 * demultiplexing and can be slower than direct configuration 00048 * - It reserves space for a fixed number of interrupts, which can be 00049 * increased by modifying the appropriate constant in pio_it.c. 00050 * 00051 * \par Usage 00052 * 00053 * -# Initialize the PIO interrupt mechanism using PIO_InitializeInterrupts() 00054 * with the desired priority (0 ... 7). 00055 * -# Configure a status change interrupt on one or more pin(s) with 00056 * PIO_ConfigureIt(). 00057 * -# Enable & disable interrupts on pins using PIO_EnableIt() and 00058 * PIO_DisableIt(). 00059 */ 00060 00061 #ifndef _PIO_IT_ 00062 #define _PIO_IT_ 00063 00064 /* 00065 * Headers 00066 */ 00067 00068 #include "pio.h" 00069 00070 #ifdef __cplusplus 00071 extern "C" { 00072 #endif 00073 00074 /* 00075 * Global functions 00076 */ 00077 00078 extern void PIO_InitializeInterrupts( uint32_t dwPriority ) ; 00079 00080 extern void PIO_ConfigureIt( const Pin *pPin, void (*handler)( const Pin* ) ) ; 00081 00082 extern void PIO_EnableIt( const Pin *pPin ) ; 00083 00084 extern void PIO_DisableIt( const Pin *pPin ) ; 00085 00086 extern void PIO_IT_InterruptHandler( void ) ; 00087 00088 extern void PioInterruptHandler( uint32_t id, Pio *pPio ) ; 00089 00090 extern void PIO_CaptureHandler( void ) ; 00091 00092 #ifdef __cplusplus 00093 } 00094 #endif 00095 00096 #endif /* #ifndef _PIO_IT_ */ 00097