/******************************************************************************* * DISCLAIMER * This software is supplied by Renesas Electronics Corporation and is only * intended for use with Renesas products. No other uses are authorized. This * software is owned by Renesas Electronics Corporation and is protected under * all applicable laws, including copyright laws. * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * Renesas reserves the right, without notice, to make changes to this software * and to discontinue the availability of this software. By using this software, * you agree to the additional terms and conditions found by accessing the * following link: * http://www.renesas.com/disclaimer * (c) 2014 Renesas Electronics Corporation All rights reserved. *******************************************************************************/ /****************************************************************************** * File Name : r_interrupt.c * Version : 1.0 * Device(s) : R7F701007 RH850/F1L * Tool-Chain : IAR Embedded Workbench 1.30.1 * Description : This file is a sample of the interrupt. * Operation : - ******************************************************************************* ******************************************************************************* * History : DD.MM.YYYY Version Description * : 20.03.2014 1.00 First Release ******************************************************************************/ /****************************************************************************** Includes ******************************************************************************/ #include "r_typedefs.h" #include "iodefine.h" #ifdef __ghs__ #include "device.h" #endif #ifdef __IAR_SYSTEMS_ICC__ #include #endif /****************************************************************************** Imported global variables and functions (from other files) ******************************************************************************/ /****************************************************************************** Macro definitions ******************************************************************************/ /****************************************************************************** Exported global variables and functions (to be accessed by other files) ******************************************************************************/ void priority7_interrupt( uint32_t ); /****************************************************************************** Private global variables and functions ******************************************************************************/ uint32_t sg_value[8]; /****************************************************************************** * Function Name : #ifdef __ghs__ __interrupt void EINTPRIO_7(void) { #if !defined(__IAR_SYSTEMS_ICC__) priority7_interrupt( __STSR(EIIC)); #endif #ifdef __IAR_SYSTEMS_ICC__ priority7_interrupt( __STSR(Reg_CPU_EIIC,0)); #endif } #endif #ifdef __IAR_SYSTEMS_ICC__ __ei_int __interrupt void __eiint_prio7_handler(void) { priority7_interrupt( __STSR(Reg_CPU_EIIC,0)); } #endif void priority7_interrupt( uint32_t regEIIC_value ) * Description : This function is priority(7) interrupt processing. (direct vector) * Argument : regEIIC_value : Interrupt factor * Return Value : none ******************************************************************************/ #if !defined(__IAR_SYSTEMS_ICC__) && !defined(__ghs__) #pragma interrupt priority7_interrupt( enable=false , priority=EIINT_PRIORITY7 , callt=false , fpu=false ) #endif #ifdef __ghs__ __interrupt void EINTPRIO_7(void) { #if !defined(__IAR_SYSTEMS_ICC__) priority7_interrupt( __STSR(EIIC)); #endif #ifdef __IAR_SYSTEMS_ICC__ priority7_interrupt( __STSR(Reg_CPU_EIIC,0)); #endif } #endif #ifdef __IAR_SYSTEMS_ICC__ __ei_int __interrupt void __eiint_prio7_handler(void) { priority7_interrupt( __STSR(Reg_CPU_EIIC,0)); } #endif void priority7_interrupt( uint32_t regEIIC_value ) { switch ( regEIIC_value ) { case 0x0000100AUL: /* INTADCA0I0 */ /* SG1:ADCA0VCR00-02 */ sg_value[0] = ADCA0.DIR00.UINT32; sg_value[1] = ADCA0.DIR01.UINT32; sg_value[2] = ADCA0.DIR02.UINT32; P8 &= 0xFFFEU; /* P8_0:CN1D-96pin */ break; case 0x0000100BUL: /* INTADCA0I1 */ /* SG2:ADCA0VCR03,04 */ sg_value[3] = ADCA0.DIR03.UINT32; sg_value[4] = ADCA0.DIR04.UINT32; P8 &= 0xFFFDU; /* P8_1:CN1D-95pin */ break; case 0x0000100CUL: /* INTADCA0I2 */ /* SG3:ADCA0VCR05-07 */ sg_value[5] = ADCA0.DIR05.UINT32; sg_value[6] = ADCA0.DIR06.UINT32; sg_value[7] = ADCA0.DIR07.UINT32; P8 &= 0xFFFBU; /* P8_2:CN1D-94pin */ break; case 0x0000102FUL: /* INTADCA0ERR */ if ( ADCA0.OWER.UINT32 & 0x00000080UL ) /* Overwrite Error */ { /* Clear error ADCAnECR - Error Clear Register b31:b 4 - Reserved set to 0 b 3 ULEC - Upper Limit Error Flag (ADCAnULER.UE) / Lower Limit Error Flag (ADCAnULER.LE) Clear. - Unused. Set to 0'b b 2 OWEC - Overwrite Error Flag (ADCAnOWER.OWE) Clear. - Set to 1'b b 1:b 0 - Reserved set to 0 */ ADCA0.ECR.UINT32 = 0x00000004UL; } if ( ADCA0.ULER.UINT32 & 0x0000C000UL ) /* Upper Limit/Lower Limit Error */ { /* Clear error ADCAnECR - Error Clear Register b31:b 4 - Reserved set to 0 b 3 ULEC - Upper Limit Error Flag (ADCAnULER.UE) / Lower Limit Error Flag (ADCAnULER.LE) Clear. - Set to 1'b b 2 OWEC - Overwrite Error Flag (ADCAnOWER.OWE) Clear. - Unused. Set to 0'b b 1:b 0 - Reserved set to 0 */ ADCA0.ECR.UINT32 = 0x00000008UL; } break; case 0x0000104BUL: /* INTTAUJ0I3 */ PNOT0 ^= 0x4000U; /* P0_14:CN2C-72pin */ P8 |= 0x0007U; break; default: break; } }