interrupt_iar.c

Go to the documentation of this file.
00001 /*This file has been prepared for Doxygen automatic documentation generation.*/
00022 /* Copyright (c) 2006, Atmel Corporation All rights reserved.
00023  *
00024  * Redistribution and use in source and binary forms, with or without
00025  * modification, are permitted provided that the following conditions are met:
00026  *
00027  * 1. Redistributions of source code must retain the above copyright notice,
00028  * this list of conditions and the following disclaimer.
00029  *
00030  * 2. Redistributions in binary form must reproduce the above copyright notice,
00031  * this list of conditions and the following disclaimer in the documentation
00032  * and/or other materials provided with the distribution.
00033  *
00034  * 3. The name of ATMEL may not be used to endorse or promote products derived
00035  * from this software without specific prior written permission.
00036  *
00037  * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
00038  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00039  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
00040  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
00041  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00042  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00043  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00044  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00045  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00046  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00047  */
00048 
00049 #ifdef __ICCAVR32__
00050 
00051 #include "interrupt_iar.h"
00052 
00053 char *stringINT;
00054 int stringSizeINT;
00055 char *stringINT2;
00056 int stringSizeINT2;
00057 
00058 
00061 #pragma handler = AVR32_USART1_IRQ_GROUP,0
00062 __interrupt __root void pdc_interrupt_handler(void)
00063 {
00064     pdc_setTxNextBuf( (void *) &USART_MODULE,
00065             pdc_translatePtr((void *)stringINT2), stringSizeINT2);
00066 }
00067 
00068 
00071 void init_usart_interrupts(void)
00072 {
00073 }
00074 
00075 
00078 void start_interrupts(void)
00079 {
00080     pdc_disable((void *) &USART_MODULE);
00081 
00082     stringINT = "INT: AVR32 PDC application demo\r\n";
00083     stringSizeINT = 33;
00084     stringINT2 = "INT: AVR32 PDC application demo ENDTX int\r\n";
00085     stringSizeINT2 = 43;
00086 
00087     pdc_flushCache((void *)stringINT, stringSizeINT/4);
00088     pdc_flushCache((void *)stringINT2, stringSizeINT2/4);
00089 
00090     pdc_setTxBuf((void *) &USART_MODULE,
00091             pdc_translatePtr( stringINT ), stringSizeINT,
00092             pdc_translatePtr( stringINT ), stringSizeINT);
00093 
00094     /* Turn on interrupts from USART0 (IER.txrdy) */
00095     USART_MODULE.ier = AVR32_USART_IER_TXRDY_MASK;
00096     __enable_interrupt();
00097 
00098     pdc_enable((void *) &USART_MODULE);
00099 }
00100 
00101 
00104 void stop_interrupts(void)
00105 {
00106     __disable_interrupt();
00107     USART_MODULE.idr = AVR32_USART_IDR_ENDRX_MASK;
00108 
00109     /* Wait for current PDC transfer to complete */
00110     do {
00111     } while(pdc_txBytesLeft((void *) &USART_MODULE) != 0);
00112 
00113     pdc_disable((void *) &USART_MODULE);
00114 }
00115 
00116 #endif /* #ifdef __ICCAVR32__ */
00117 

Generated on Wed May 10 15:03:11 2006 for AVR32108 - Peripheral Direct Memory Access Driver by  doxygen 1.4.6-NO