add IPL
This commit is contained in:
155
IPL/Customer/Mobis/Gen4_ICUMX_Loader/intc/intc.c
Normal file
155
IPL/Customer/Mobis/Gen4_ICUMX_Loader/intc/intc.c
Normal file
@@ -0,0 +1,155 @@
|
||||
/*******************************************************************************
|
||||
* 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 2022-2023 Renesas Electronics Corporation All rights reserved.
|
||||
*******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* DESCRIPTION : Interrupt controler driver
|
||||
******************************************************************************/
|
||||
/******************************************************************************
|
||||
* @file intc.c
|
||||
* - Version : 0.02
|
||||
* @brief Interrupt controler driver.
|
||||
* .
|
||||
*****************************************************************************/
|
||||
/******************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 06.01.2022 0.01 First Release
|
||||
* : 05,04.2023 0.02 Remove string.h
|
||||
*****************************************************************************/
|
||||
#include <v800_ghs.h>
|
||||
#include <stdint.h>
|
||||
#include <mem_io.h>
|
||||
#include <rst_register.h>
|
||||
#include <intc.h>
|
||||
#include <log.h>
|
||||
#include <cpu.h>
|
||||
#include <intc.h>
|
||||
|
||||
#define INTC_EI_MAX (64U)
|
||||
#define INTC_EI_ID_MASK (0xFFU)
|
||||
|
||||
#define ICUMX_IC_MK_BIT (0x0080U) /* Interrupt request mask */
|
||||
#define ICUMX_IC_TB_BIT (0x0040U) /* Vector table selection system */
|
||||
#define ICUMX_IC_PRIORITY_MASK (0x0007U)
|
||||
|
||||
#define INT_FLG_ENABLE (0x10U)
|
||||
#define INT_FLG_DISABLE (0x00U)
|
||||
|
||||
#define EXCEPTION_SOURCE_CODE_BIT (0x1000U)
|
||||
|
||||
|
||||
typedef struct {
|
||||
INT_HANDLER handler;
|
||||
uint32_t arg;
|
||||
uint32_t flg;
|
||||
} INTC_HDR_TBL;
|
||||
|
||||
static INTC_HDR_TBL s_intc_tbl[INTC_EI_MAX];
|
||||
|
||||
void intc_set_interrupt(uint32_t int_no, uint32_t level, INT_HANDLER cb)
|
||||
{
|
||||
uint16_t reg;
|
||||
__DI();
|
||||
|
||||
/* check Exception Source code */
|
||||
if (INTC_EI_MAX <= int_no)
|
||||
{
|
||||
ERROR("Undefined Exception Source code error.(0x%x)\n", int_no);
|
||||
panic;
|
||||
}
|
||||
|
||||
/* set interrupt handler */
|
||||
s_intc_tbl[int_no].handler = cb;
|
||||
s_intc_tbl[int_no].flg = INT_FLG_ENABLE;
|
||||
|
||||
/* the interrupt enable */
|
||||
reg = mem_read16(get_icumx_ic_addr(int_no));
|
||||
reg &= (~(ICUMX_IC_MK_BIT) | ICUMX_IC_PRIORITY_MASK);
|
||||
reg |= (ICUMX_IC_TB_BIT | (level & ICUMX_IC_PRIORITY_MASK));
|
||||
mem_write16(get_icumx_ic_addr(int_no), reg);
|
||||
|
||||
__EI();
|
||||
}
|
||||
/* End of function intc_set_interrupt(uint32_t int_no, uint32_t level, INT_HANDLER cb) */
|
||||
|
||||
|
||||
void intc_disable_interrupt(uint32_t int_no)
|
||||
{
|
||||
uint16_t reg;
|
||||
__DI();
|
||||
|
||||
/* check Exception Source code */
|
||||
if (INTC_EI_MAX <= int_no)
|
||||
{
|
||||
ERROR("Undefined Exception Source code error.(0x%x)\n", int_no);
|
||||
panic;
|
||||
}
|
||||
|
||||
/* check interrupt enable flag */
|
||||
if (INT_FLG_DISABLE == (s_intc_tbl[int_no].flg & INT_FLG_ENABLE))
|
||||
{
|
||||
ERROR("Execption disabled.(0x%x)\n", int_no);
|
||||
panic;
|
||||
}
|
||||
|
||||
/* the interrupt disable */
|
||||
s_intc_tbl[int_no].flg &= ~INT_FLG_ENABLE;
|
||||
reg = mem_read16(get_icumx_ic_addr(int_no));
|
||||
reg &= ~(ICUMX_IC_TB_BIT);
|
||||
reg |= ICUMX_IC_MK_BIT;
|
||||
mem_write16(get_icumx_ic_addr(int_no), reg);
|
||||
|
||||
__EI();
|
||||
}
|
||||
/* End of function intc_disable_interrupt(uint32_t int_no) */
|
||||
|
||||
#pragma ghs interrupt(nonreentrant)
|
||||
void intc_handler(void)
|
||||
{
|
||||
uint32_t reg;
|
||||
uint32_t int_no;
|
||||
reg = __STSR(EIIC);
|
||||
|
||||
/* check Exception Source code */
|
||||
if ((reg & EXCEPTION_SOURCE_CODE_BIT) == 0U)
|
||||
{
|
||||
ERROR("Undefined Exception Source code error.(0x%x)\n", reg);
|
||||
panic;
|
||||
}
|
||||
int_no = reg & INTC_EI_ID_MASK;
|
||||
if (INTC_EI_MAX <= int_no)
|
||||
{
|
||||
ERROR("Undefined Exception Source code error.(0x%x)\n", int_no);
|
||||
panic;
|
||||
}
|
||||
|
||||
/* check interrupt enable flag */
|
||||
if (INT_FLG_DISABLE == (s_intc_tbl[int_no].flg & INT_FLG_ENABLE))
|
||||
{
|
||||
ERROR("Execption disabled.(0x%x)\n", int_no);
|
||||
panic;
|
||||
}
|
||||
|
||||
/* execute interrupt handler */
|
||||
s_intc_tbl[int_no].handler(int_no, s_intc_tbl[int_no].arg);
|
||||
}
|
||||
/* End of function intc_handler(void) */
|
||||
50
IPL/Customer/Mobis/Gen4_ICUMX_Loader/intc/vect_set.c
Normal file
50
IPL/Customer/Mobis/Gen4_ICUMX_Loader/intc/vect_set.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/*******************************************************************************
|
||||
* 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 2022 Renesas Electronics Corporation All rights reserved.
|
||||
*******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* DESCRIPTION : Set vector table function
|
||||
******************************************************************************/
|
||||
/******************************************************************************
|
||||
* @file vect_set.c
|
||||
* - Version : 0.01
|
||||
* @brief Set vector table function.
|
||||
* .
|
||||
*****************************************************************************/
|
||||
/******************************************************************************
|
||||
* History : DD.MM.YYYY Version Description
|
||||
* : 06.01.2022 0.01 First Release
|
||||
*****************************************************************************/
|
||||
#include <stdint.h>
|
||||
#include <v800_ghs.h>
|
||||
#include "intc.h"
|
||||
#include "vect_set.h"
|
||||
#include "cpu.h"
|
||||
#include "rst_register.h"
|
||||
#include "mem_io.h"
|
||||
|
||||
void set_vect_table(void)
|
||||
{
|
||||
/* set interrupt table */
|
||||
__LDSR(INTBP, (uint32_t)&__ghsbegin_EIINTTBL_ICU[0]);
|
||||
}
|
||||
/* End of function set_vect_table(void) */
|
||||
181
IPL/Customer/Mobis/Gen4_ICUMX_Loader/intc/vecttbl.S
Normal file
181
IPL/Customer/Mobis/Gen4_ICUMX_Loader/intc/vecttbl.S
Normal file
@@ -0,0 +1,181 @@
|
||||
/*******************************************************************************
|
||||
* 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 2022 Renesas Electronics Corporation All rights reserved.
|
||||
*******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* DESCRIPTION : Loader vector table
|
||||
******************************************************************************/
|
||||
|
||||
.global code_start
|
||||
.global intc_handler
|
||||
|
||||
.section ".reset"
|
||||
.align 512
|
||||
.align 16
|
||||
_start:
|
||||
jr32 code_start //RESET
|
||||
.align 16
|
||||
jr32 _Dummy //SYSERR
|
||||
.align 16
|
||||
jr32 _Dummy //HVTRAP
|
||||
.align 16
|
||||
jr32 _Dummy //FETRAP
|
||||
.align 16
|
||||
jr32 _Dummy //TRAP0
|
||||
.align 16
|
||||
jr32 _Dummy //TRAP1
|
||||
.align 16
|
||||
jr32 _Dummy //RIE
|
||||
.align 16
|
||||
jr32 _Dummy //FPP/FPI
|
||||
.align 16
|
||||
jr32 _Dummy //UCPOP
|
||||
.align 16
|
||||
jr32 _Dummy //MIP/MDP
|
||||
.align 16
|
||||
jr32 _Dummy //PIE
|
||||
.align 16
|
||||
jr32 _Dummy //Debug
|
||||
.align 16
|
||||
jr32 _Dummy //MAE
|
||||
.align 16
|
||||
jr32 _Dummy //(R.F.U)
|
||||
.align 16
|
||||
jr32 _Dummy //FENMI
|
||||
.align 16
|
||||
jr32 _Dummy //FEINT
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority0)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority1)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority2)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority3)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority4)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority5)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority6)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority7)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority8)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority9)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority10)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority11)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority12)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority13)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority14)
|
||||
.align 16
|
||||
jr32 _Dummy //INTn(priority15)
|
||||
|
||||
.section ".EIINTTBL_ICU", const
|
||||
.align 512
|
||||
.offset 0x0000
|
||||
.word _intc_handler /* 0 : INTICUECCLRAM */
|
||||
.offset 0x0004
|
||||
.word _intc_handler /* 1 : INTICUECCCRAM */
|
||||
.offset 0x0008
|
||||
.word _intc_handler /* 2 : INTICUEDCAXI */
|
||||
.offset 0x000C
|
||||
.word _intc_handler /* 3 : INTICUECCAXIAB */
|
||||
.offset 0x0010
|
||||
.word _intc_handler /* 4 : INTICUECCPKRAM */
|
||||
.offset 0x0014
|
||||
.word _intc_handler /* 5 : INTPES */
|
||||
.offset 0x0018
|
||||
.word _intc_handler /* 6 : INTPE */
|
||||
.offset 0x001C
|
||||
.word _intc_handler /* 7 : INTICUAESD0RD */
|
||||
.offset 0x0020
|
||||
.word _intc_handler /* 8 : Reserved */
|
||||
.offset 0x0024
|
||||
.word _intc_handler /* 9 : INTICUTRNGE0 */
|
||||
.offset 0x0028
|
||||
.word _intc_handler /* 10 : INTICUOSTM0 */
|
||||
.offset 0x002C
|
||||
.word _intc_handler /* 11 : INTICUOSTM1 */
|
||||
.offset 0x0030
|
||||
.word _intc_handler /* 12 : INTICUWDTA0 */
|
||||
.offset 0x0034
|
||||
.word _intc_handler /* 13 : INTICUPKCCA0 */
|
||||
.offset 0x0038
|
||||
.word _intc_handler /* 14 : INTICUDMACA0 */
|
||||
.offset 0x003C
|
||||
.word _intc_handler /* 15 : INTICUDMACA0AXI */
|
||||
.offset 0x0040
|
||||
.word _intc_handler /* 16 : Reserved */
|
||||
.offset 0x0044
|
||||
.word _intc_handler /* 17 : INTICUSHAA0IREQ */
|
||||
.offset 0x0048
|
||||
.word _intc_handler /* 18 : INTICUSHAA0OEND */
|
||||
.offset 0x004C
|
||||
.word _intc_handler /* 19 : INTICUCRCDRQA */
|
||||
.offset 0x0050
|
||||
.word _intc_handler /* 20 : INTICUCRRDRQA */
|
||||
.offset 0x0054
|
||||
.word _intc_handler /* 21 : INTICUCRCDRQ1 */
|
||||
.offset 0x0058
|
||||
.word _intc_handler /* 22 : INTICUCRRDRQ */
|
||||
.offset 0x005C
|
||||
.word _intc_handler /* 23 : INTICUCRCDRQ2 */
|
||||
.offset 0x0060
|
||||
.word _intc_handler /* 24 : Reserved */
|
||||
.offset 0x0064
|
||||
.word _intc_handler /* 25 : INTICUERRCFDA */
|
||||
.offset 0x0068
|
||||
.word _intc_handler /* 26 : INTICUERRDFDA */
|
||||
.offset 0x006C
|
||||
.word _intc_handler /* 27 : Reserved */
|
||||
.offset 0x0070
|
||||
.word _intc_handler /* 28 : Reserved */
|
||||
.offset 0x0074
|
||||
.word _intc_handler /* 29 : INTSAFRTRAMERR */
|
||||
.offset 0x0078
|
||||
.word _intc_handler /* 30 : INTSECRTRAMERR */
|
||||
.offset 0x007C
|
||||
.word _intc_handler /* 31 : INTEDCRTRAMERR */
|
||||
.offset 0x0080
|
||||
.word _intc_handler /* 32 : INTECCRTRAMCMPE */
|
||||
.offset 0x0084
|
||||
.word _intc_handler /* 33 : INTECCMRTRAMERR */
|
||||
.offset 0x0088
|
||||
.word _intc_handler /* 34 : INTECCSRTRAMERR */
|
||||
.offset 0x008C
|
||||
.word _intc_handler /* 35 : INTEDCMSECROMER */
|
||||
.offset 0x0090
|
||||
.word _intc_handler /* 36 : INTEDCSSECROMER */
|
||||
.offset 0x0094
|
||||
.word _intc_handler /* 37 : INTSCEGCALEND */
|
||||
|
||||
.section ".text"
|
||||
.align 2
|
||||
_Dummy:
|
||||
br _Dummy
|
||||
Reference in New Issue
Block a user