HDG/ECU_APP/r_cg_intc.c
2024-05-26 11:13:55 +08:00

294 lines
13 KiB
C

/***********************************************************************************************************************
* 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
*
* Copyright (C) 2012, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_intc.c
* Version : CodeGenerator for RL78/F13 V2.03.07.02 [08 Nov 2021]
* Device(s) : R5F10BGG
* Tool-Chain : CCRL
* Description : This file implements device driver for INTC module.
* Creation Date: 2022/7/8
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_intc.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_INTC_Create
* Description : This function initializes INTP module.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC_Create(void)
{
PMK0 = 1U; /* disable INTP0 operation */
PIF0 = 0U; /* clear INTP0 interrupt flag */
PMK1 = 1U; /* disable INTP1 operation */
PIF1 = 0U; /* clear INTP1 interrupt flag */
PMK2 = 1U; /* disable INTP2 operation */
PIF2 = 0U; /* clear INTP2 interrupt flag */
PMK3 = 1U; /* disable INTP3 operation */
PIF3 = 0U; /* clear INTP3 interrupt flag */
PMK4 = 1U; /* disable INTP4 operation */
PIF4 = 0U; /* clear INTP4 interrupt flag */
PMK5 = 1U; /* disable INTP5 operation */
PIF5 = 0U; /* clear INTP5 interrupt flag */
PMK6 = 1U; /* disable INTP6 operation */
PIF6 = 0U; /* clear INTP6 interrupt flag */
PMK7 = 1U; /* disable INTP7 operation */
PIF7 = 0U; /* clear INTP7 interrupt flag */
PMK8 = 1U; /* disable INTP8 operation */
PIF8 = 0U; /* clear INTP8 interrupt flag */
PMK9 = 1U; /* disable INTP9 operation */
PIF9 = 0U; /* clear INTP9 interrupt flag */
/* Set INTP0 low priority */
PPR10 = 1U;
PPR00 = 1U;
/* Set INTP1 low priority */
PPR11 = 1U;
PPR01 = 1U;
/* Set INTP2 low priority */
PPR12 = 1U;
PPR02 = 1U;
/* Set INTP4 low priority */
PPR14 = 1U;
PPR04 = 1U;
/* Set INTP6 low priority */
PPR16 = 1U;
PPR06 = 1U;
/* Set INTP7 low priority */
PPR17 = 1U;
PPR07 = 1U;
/* Set INTP8 low priority */
PPR18 = 1U;
PPR08 = 1U;
EGP0 = _01_INTP0_EDGE_RISING_SEL | _02_INTP1_EDGE_RISING_SEL | _04_INTP2_EDGE_RISING_SEL |
_10_INTP4_EDGE_RISING_SEL | _40_INTP6_EDGE_RISING_SEL | _80_INTP7_EDGE_RISING_SEL;
EGN1 = _01_INTP8_EDGE_FALLING_SEL;
INTFLG0 &= _C2_INTFLG0_MASK_VALUE;
INTMSK = _00_INTP4_CONTROL_ENABLE | _02_INTP5_CONTROL_DISABLE | _00_INTP6_CONTROL_ENABLE |
_F8_INTP_INTMSK_INIT_VALUE;
/* Set INTP1 pin */
PIM12 &= 0xDFU;
PMC12 &= 0xDFU;
PM12 |= 0x20U;
/* Set INTP2 pin */
PM3 |= 0x02U;
/* Set INTP4 pin */
PMC12 &= 0xFEU;
PM12 |= 0x01U;
/* Set INTP6 pin */
PIM7 &= 0xFDU;
PM7 |= 0x02U;
/* Set INTP7 pin */
PM3 |= 0x04U;
/* Set INTP8 pin */
PIM7 &= 0xFEU;
PM7 |= 0x01U;
}
/***********************************************************************************************************************
* Function Name: R_INTC0_Start
* Description : This function clears INTP0 interrupt flag and enables interrupt.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC0_Start(void)
{
PIF0 = 0U; /* clear INTP0 interrupt flag */
PMK0 = 0U; /* enable INTP0 interrupt */
}
/***********************************************************************************************************************
* Function Name: R_INTC0_Stop
* Description : This function disables INTP0 interrupt and clears interrupt flag.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC0_Stop(void)
{
PMK0 = 1U; /* disable INTP0 interrupt */
PIF0 = 0U; /* clear INTP0 interrupt flag */
}
/***********************************************************************************************************************
* Function Name: R_INTC1_Start
* Description : This function clears INTP1 interrupt flag and enables interrupt.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC1_Start(void)
{
PIF1 = 0U; /* clear INTP1 interrupt flag */
PMK1 = 0U; /* enable INTP1 interrupt */
}
/***********************************************************************************************************************
* Function Name: R_INTC1_Stop
* Description : This function disables INTP1 interrupt and clears interrupt flag.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC1_Stop(void)
{
PMK1 = 1U; /* disable INTP1 interrupt */
PIF1 = 0U; /* clear INTP1 interrupt flag */
}
/***********************************************************************************************************************
* Function Name: R_INTC2_Start
* Description : This function clears INTP2 interrupt flag and enables interrupt.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC2_Start(void)
{
PIF2 = 0U; /* clear INTP2 interrupt flag */
PMK2 = 0U; /* enable INTP2 interrupt */
}
/***********************************************************************************************************************
* Function Name: R_INTC2_Stop
* Description : This function disables INTP2 interrupt and clears interrupt flag.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC2_Stop(void)
{
PMK2 = 1U; /* disable INTP2 interrupt */
PIF2 = 0U; /* clear INTP2 interrupt flag */
}
/***********************************************************************************************************************
* Function Name: R_INTC4_Start
* Description : This function clears INTP4 interrupt flag and enables interrupt.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC4_Start(void)
{
PIF4 = 0U; /* clear INTP4 interrupt flag */
PMK4 = 0U; /* enable INTP4 interrupt */
}
/***********************************************************************************************************************
* Function Name: R_INTC4_Stop
* Description : This function disables INTP4 interrupt and clears interrupt flag.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC4_Stop(void)
{
PMK4 = 1U; /* disable INTP4 interrupt */
PIF4 = 0U; /* clear INTP4 interrupt flag */
}
/***********************************************************************************************************************
* Function Name: R_INTC6_Start
* Description : This function clears INTP6 interrupt flag and enables interrupt.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC6_Start(void)
{
PIF6 = 0U; /* clear INTP6 interrupt flag */
PMK6 = 0U; /* enable INTP6 interrupt */
}
/***********************************************************************************************************************
* Function Name: R_INTC6_Stop
* Description : This function disables INTP6 interrupt and clears interrupt flag.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC6_Stop(void)
{
PMK6 = 1U; /* disable INTP6 interrupt */
PIF6 = 0U; /* clear INTP6 interrupt flag */
}
/***********************************************************************************************************************
* Function Name: R_INTC7_Start
* Description : This function clears INTP7 interrupt flag and enables interrupt.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC7_Start(void)
{
PIF7 = 0U; /* clear INTP7 interrupt flag */
PMK7 = 0U; /* enable INTP7 interrupt */
}
/***********************************************************************************************************************
* Function Name: R_INTC7_Stop
* Description : This function disables INTP7 interrupt and clears interrupt flag.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC7_Stop(void)
{
PMK7 = 1U; /* disable INTP7 interrupt */
PIF7 = 0U; /* clear INTP7 interrupt flag */
}
/***********************************************************************************************************************
* Function Name: R_INTC8_Start
* Description : This function clears INTP8 interrupt flag and enables interrupt.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC8_Start(void)
{
PIF8 = 0U; /* clear INTP8 interrupt flag */
PMK8 = 0U; /* enable INTP8 interrupt */
}
/***********************************************************************************************************************
* Function Name: R_INTC8_Stop
* Description : This function disables INTP8 interrupt and clears interrupt flag.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_INTC8_Stop(void)
{
PMK8 = 1U; /* disable INTP8 interrupt */
PIF8 = 0U; /* clear INTP8 interrupt flag */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */