mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
first commit ra6m3-ek
This commit is contained in:
1 parent
5ff358fec6
commit
622062aaec
133 files changed
+110129
-1
No files matched your search
@@ -53,6 +53,9 @@ if GetDepend(['BSP_USING_CAN']):
|
||||
if GetDepend(['BSP_USING_SDHI']):
|
||||
src += ['drv_sdhi.c']
|
||||
|
||||
if GetDepend(['BSP_USING_LCD']):
|
||||
src += ['drv_lcd.c']
|
||||
|
||||
path = [cwd]
|
||||
path += [cwd + '/config']
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ extern "C"
|
||||
#endif
|
||||
#endif /* SOC_SERIES_R7FA6M5 */
|
||||
|
||||
#ifdef SOC_SERIES_R7FA6M5
|
||||
#if (defined(SOC_SERIES_R7FA6M3)) || (defined(SOC_SERIES_R7FA6M4))
|
||||
#include "ra6m4/uart_config.h"
|
||||
|
||||
#ifdef BSP_USING_ADC
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -3,6 +3,12 @@ config SOC_FAMILY_RENESAS
|
||||
bool
|
||||
default n
|
||||
|
||||
config SOC_SERIES_R7FA6M3
|
||||
bool
|
||||
select ARCH_ARM_CORTEX_M4
|
||||
select SOC_FAMILY_RENESAS
|
||||
default n
|
||||
|
||||
config SOC_SERIES_R7FA6M4
|
||||
bool
|
||||
select ARCH_ARM_CORTEX_M4
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,5 @@
|
||||
/RTE
|
||||
/Listings
|
||||
/Objects
|
||||
ra_cfg.txt
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# files format check exclude path, please follow the instructions below to modify;
|
||||
# If you need to exclude an entire folder, add the folder path in dir_path;
|
||||
# If you need to exclude a file, add the path to the file in file_path.
|
||||
|
||||
dir_path:
|
||||
- ra
|
||||
- ra_gen
|
||||
- ra_cfg
|
||||
- RTE
|
||||
@@ -0,0 +1,19 @@
|
||||
#Fri Nov 18 18:05:07 CST 2022
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#Common\#\#all\#\#fsp_common\#\#\#\#3.5.0/libraries=
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#ra6m3\#\#fsp\#\#\#\#3.5.0/libraries=
|
||||
com.renesas.cdt.ddsc.content/com.renesas.cdt.ddsc.content.defaultlinkerscript=script/fsp.scat
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#ra6m3\#\#fsp\#\#\#\#3.5.0/all=3427620923,ra/fsp/src/bsp/mcu/ra6m3/bsp_mcu_info.h|143358381,ra/fsp/src/bsp/mcu/ra6m3/bsp_elc.h|2743353138,ra/fsp/src/bsp/mcu/ra6m3/bsp_feature.h
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#Common\#\#all\#\#fsp_common\#\#\#\#3.5.0/all=568600546,ra/fsp/src/bsp/cmsis/Device/RENESAS/Source/startup.c|1630997354,ra/fsp/src/bsp/mcu/all/bsp_irq.c|4222527282,ra/fsp/src/bsp/mcu/all/bsp_module_stop.h|731782070,ra/fsp/src/bsp/mcu/all/bsp_irq.h|2386285210,ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/renesas.h|3255765648,ra/fsp/src/bsp/cmsis/Device/RENESAS/Source/system.c|546480625,ra/fsp/inc/fsp_common_api.h|2977689308,ra/fsp/src/bsp/mcu/all/bsp_mcu_api.h|3549961311,ra/fsp/src/bsp/mcu/all/bsp_tfu.h|1939984091,ra/fsp/inc/api/r_ioport_api.h|1904866635,ra/fsp/src/bsp/mcu/all/bsp_clocks.h|2308894280,ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/system.h|1236602439,ra/fsp/src/bsp/mcu/all/bsp_io.c|3492513568,ra/fsp/src/bsp/mcu/all/bsp_register_protection.c|460577388,ra/fsp/src/bsp/mcu/all/bsp_io.h|1728953905,ra/fsp/inc/fsp_features.h|2906400,ra/fsp/src/bsp/mcu/all/bsp_common.c|2425160085,ra/fsp/inc/api/bsp_api.h|1992062042,ra/fsp/src/bsp/mcu/all/bsp_compiler_support.h|4051445857,ra/fsp/src/bsp/mcu/all/bsp_common.h|3984836408,ra/fsp/src/bsp/mcu/all/bsp_group_irq.h|2208590403,ra/fsp/inc/instances/r_ioport.h|400573940,ra/fsp/src/bsp/mcu/all/bsp_register_protection.h|1499520276,ra/fsp/src/bsp/mcu/all/bsp_group_irq.c|1615019982,ra/fsp/src/bsp/mcu/all/bsp_sbrk.c|1353647784,ra/fsp/src/bsp/mcu/all/bsp_delay.c|3998046333,ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/base_addresses.h|1552630912,ra/fsp/src/bsp/mcu/all/bsp_guard.h|470601830,ra/fsp/src/bsp/mcu/all/bsp_clocks.c|3983299396,ra/fsp/src/bsp/mcu/all/bsp_delay.h|3297195641,ra/fsp/inc/fsp_version.h|521902797,ra/fsp/src/bsp/mcu/all/bsp_security.h|2920829723,ra/fsp/src/bsp/mcu/all/bsp_guard.c|3753300083,ra/fsp/src/bsp/mcu/all/bsp_arm_exceptions.h|2847966430,ra/fsp/src/bsp/mcu/all/bsp_security.c|3606266210,ra/fsp/src/bsp/mcu/all/bsp_rom_registers.c
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#HAL\ Drivers\#\#all\#\#r_sci_uart\#\#\#\#3.5.0/libraries=
|
||||
com.renesas.cdt.ddsc.settingseditor/com.renesas.cdt.ddsc.settingseditor.active_page=PinConfiguration
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Arm\#\#CMSIS\#\#CMSIS5\#\#CoreM\#\#\#\#5.8.0+renesas.0.fsp.3.5.0/all=4290386133,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm0plus.h|1577199483,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_iccarm.h|2333906976,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_version.h|364344841,ra/arm/CMSIS_5/CMSIS/Core/Include/core_sc300.h|3898569239,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_armclang.h|2381390623,ra/arm/CMSIS_5/CMSIS/Core/Include/core_armv8mml.h|3552689244,ra/arm/CMSIS_5/CMSIS/Core/Include/core_armv81mml.h|1168186370,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm55.h|2718020009,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm33.h|3127123217,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm35p.h|3911746910,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_armclang_ltm.h|2851112248,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm1.h|965562395,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_gcc.h|1745843273,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm0.h|2327633156,ra/arm/CMSIS_5/CMSIS/Core/Include/core_sc000.h|3007265674,ra/arm/CMSIS_5/CMSIS/Core/Include/core_armv8mbl.h|1564341101,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm7.h|2701379970,ra/arm/CMSIS_5/CMSIS/Core/Include/mpu_armv8.h|1494441116,ra/arm/CMSIS_5/CMSIS/Core/Include/mpu_armv7.h|304461792,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm3.h|3358993753,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm4.h|3163610011,ra/arm/CMSIS_5/CMSIS/Core/Include/pmu_armv8.h|1017116116,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_compiler.h|1372010515,ra/arm/CMSIS_5/CMSIS/Core/Include/core_cm23.h|302860276,ra/arm/CMSIS_5/CMSIS/Core/Include/cachel1_armv7.h|1441545198,ra/arm/CMSIS_5/LICENSE.txt|1044777225,ra/arm/CMSIS_5/CMSIS/Core/Include/cmsis_armcc.h|2635219934,ra/arm/CMSIS_5/CMSIS/Core/Include/tz_context.h
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#ra6m3\#\#device\#\#\#\#3.5.0/all=2308894280,ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/system.h
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#Board\#\#custom\#\#\#\#3.5.0/all=
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#ra6m3\#\#device\#\#R7FA6M3AH3CFC\#\#3.5.0/libraries=
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#HAL\ Drivers\#\#all\#\#r_ioport\#\#\#\#3.5.0/all=3254285722,ra/fsp/src/r_ioport/r_ioport.c|2208590403,ra/fsp/inc/instances/r_ioport.h|1939984091,ra/fsp/inc/api/r_ioport_api.h
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#ra6m3\#\#device\#\#\#\#3.5.0/libraries=
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#HAL\ Drivers\#\#all\#\#r_sci_uart\#\#\#\#3.5.0/all=1889256766,ra/fsp/inc/instances/r_sci_uart.h|1610456547,ra/fsp/inc/api/r_transfer_api.h|3916852077,ra/fsp/inc/api/r_uart_api.h|3094200246,ra/fsp/src/r_sci_uart/r_sci_uart.c
|
||||
com.renesas.cdt.ddsc.threads.configurator/collapse/module.driver.uart_on_sci_uart.136564520=false
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Arm\#\#CMSIS\#\#CMSIS5\#\#CoreM\#\#\#\#5.8.0+renesas.0.fsp.3.5.0/libraries=
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#HAL\ Drivers\#\#all\#\#r_ioport\#\#\#\#3.5.0/libraries=
|
||||
com.renesas.cdt.ddsc.packs.componentfiles/Renesas\#\#BSP\#\#Board\#\#custom\#\#\#\#3.5.0/libraries=
|
||||
@@ -0,0 +1,29 @@
|
||||
mainmenu "RT-Thread Configuration"
|
||||
|
||||
config BSP_DIR
|
||||
string
|
||||
option env="BSP_ROOT"
|
||||
default "."
|
||||
|
||||
config RTT_DIR
|
||||
string
|
||||
option env="RTT_ROOT"
|
||||
default "../../.."
|
||||
|
||||
# you can change the RTT_ROOT default "../.." to your rtthread_root,
|
||||
# example : default "F:/git_repositories/rt-thread"
|
||||
|
||||
config PKGS_DIR
|
||||
string
|
||||
option env="PKGS_ROOT"
|
||||
default "packages"
|
||||
|
||||
config ENV_DIR
|
||||
string
|
||||
option env="ENV_ROOT"
|
||||
default "/"
|
||||
|
||||
source "$RTT_DIR/Kconfig"
|
||||
source "$PKGS_DIR/Kconfig"
|
||||
source "../libraries/Kconfig"
|
||||
source "$BSP_DIR/board/Kconfig"
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<v1:pinSettings xmlns:v1="http://www.tasking.com/schema/pinsettings/v1.1">
|
||||
<v1:pinMappingsRef version="2.03" file="" />
|
||||
<v1:deviceSetting id="renesas.ra6m3_fc" pattern="R7FA6M3****FC">
|
||||
<v1:packageSetting id="renesas.176lqfp" />
|
||||
</v1:deviceSetting>
|
||||
<v1:configSetting configurationId="debug0.mode" altId="debug0.mode.jtag" />
|
||||
<v1:configSetting configurationId="p300.gpio_mode" altId="p300.gpio_mode.gpio_mode_peripheral" />
|
||||
<v1:configSetting configurationId="p300" altId="p300.debug0.tck">
|
||||
<v1:connectionSetting altId="debug0.tck.p300" />
|
||||
</v1:configSetting>
|
||||
<v1:configSetting configurationId="debug0.tck" altId="debug0.tck.p300">
|
||||
<v1:connectionSetting altId="p300.debug0.tck" />
|
||||
</v1:configSetting>
|
||||
<v1:configSetting configurationId="p108.gpio_mode" altId="p108.gpio_mode.gpio_mode_peripheral" />
|
||||
<v1:configSetting configurationId="p108" altId="p108.debug0.tms">
|
||||
<v1:connectionSetting altId="debug0.tms.p108" />
|
||||
</v1:configSetting>
|
||||
<v1:configSetting configurationId="debug0.tms" altId="debug0.tms.p108">
|
||||
<v1:connectionSetting altId="p108.debug0.tms" />
|
||||
</v1:configSetting>
|
||||
<v1:configSetting configurationId="p109.gpio_mode" altId="p109.gpio_mode.gpio_mode_peripheral" />
|
||||
<v1:configSetting configurationId="p109" altId="p109.debug0.tdo">
|
||||
<v1:connectionSetting altId="debug0.tdo.p109" />
|
||||
</v1:configSetting>
|
||||
<v1:configSetting configurationId="debug0.tdo" altId="debug0.tdo.p109">
|
||||
<v1:connectionSetting altId="p109.debug0.tdo" />
|
||||
</v1:configSetting>
|
||||
<v1:configSetting configurationId="p110.gpio_mode" altId="p110.gpio_mode.gpio_mode_peripheral" />
|
||||
<v1:configSetting configurationId="p110" altId="p110.debug0.tdi">
|
||||
<v1:connectionSetting altId="debug0.tdi.p110" />
|
||||
</v1:configSetting>
|
||||
<v1:configSetting configurationId="debug0.tdi" altId="debug0.tdi.p110">
|
||||
<v1:connectionSetting altId="p110.debug0.tdi" />
|
||||
</v1:configSetting>
|
||||
</v1:pinSettings>
|
||||
@@ -0,0 +1,27 @@
|
||||
# for module compiling
|
||||
import os
|
||||
Import('RTT_ROOT')
|
||||
Import('rtconfig')
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = []
|
||||
CPPPATH = []
|
||||
list = os.listdir(cwd)
|
||||
|
||||
if rtconfig.PLATFORM in ['iccarm']:
|
||||
print("\nThe current project does not support IAR build\n")
|
||||
Return('group')
|
||||
elif rtconfig.PLATFORM in ['gcc', 'armclang']:
|
||||
if GetOption('target') != 'mdk5':
|
||||
CPPPATH = [cwd]
|
||||
src = Glob('./src/*.c')
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
Return('group')
|
||||
@@ -0,0 +1,54 @@
|
||||
import os
|
||||
import sys
|
||||
import rtconfig
|
||||
|
||||
if os.getenv('RTT_ROOT'):
|
||||
RTT_ROOT = os.getenv('RTT_ROOT')
|
||||
else:
|
||||
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
|
||||
|
||||
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
||||
try:
|
||||
from building import *
|
||||
except:
|
||||
print('Cannot found RT-Thread root directory, please check RTT_ROOT')
|
||||
print(RTT_ROOT)
|
||||
exit(-1)
|
||||
|
||||
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
|
||||
|
||||
DefaultEnvironment(tools=[])
|
||||
env = Environment(tools = ['mingw'],
|
||||
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
|
||||
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
|
||||
AR = rtconfig.AR, ARFLAGS = '-rc',
|
||||
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
|
||||
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
|
||||
|
||||
if rtconfig.PLATFORM in ['iccarm']:
|
||||
env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
|
||||
env.Replace(ARFLAGS = [''])
|
||||
env.Replace(LINKCOM = env["LINKCOM"] + ' --map project.map')
|
||||
|
||||
Export('RTT_ROOT')
|
||||
Export('rtconfig')
|
||||
|
||||
SDK_ROOT = os.path.abspath('./')
|
||||
if os.path.exists(SDK_ROOT + '/libraries'):
|
||||
libraries_path_prefix = SDK_ROOT + '/libraries'
|
||||
else:
|
||||
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
|
||||
|
||||
SDK_LIB = libraries_path_prefix
|
||||
Export('SDK_LIB')
|
||||
|
||||
rtconfig.BSP_LIBRARY_TYPE = None
|
||||
|
||||
# prepare building environment
|
||||
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
|
||||
|
||||
# include drivers
|
||||
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'HAL_Drivers', 'SConscript')))
|
||||
|
||||
# make a building
|
||||
DoBuilding(TARGET, objs)
|
||||
@@ -0,0 +1,77 @@
|
||||
menu "Hardware Drivers Config"
|
||||
|
||||
config SOC_R7FA6M4AF
|
||||
bool
|
||||
select SOC_SERIES_R7FA6M3
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
select RT_USING_USER_MAIN
|
||||
default y
|
||||
|
||||
menu "Onboard Peripheral Drivers"
|
||||
|
||||
endmenu
|
||||
|
||||
menu "On-chip Peripheral Drivers"
|
||||
|
||||
source "../libraries/HAL_Drivers/Kconfig"
|
||||
|
||||
menuconfig BSP_USING_UART
|
||||
bool "Enable UART"
|
||||
default y
|
||||
select RT_USING_SERIAL
|
||||
select RT_USING_SERIAL_V2
|
||||
if BSP_USING_UART
|
||||
|
||||
menuconfig BSP_USING_UART7
|
||||
bool "Enable UART7"
|
||||
default n
|
||||
if BSP_USING_UART7
|
||||
config BSP_UART7_RX_USING_DMA
|
||||
bool "Enable UART7 RX DMA"
|
||||
depends on BSP_USING_UART7 && RT_SERIAL_USING_DMA
|
||||
default n
|
||||
|
||||
config BSP_UART7_TX_USING_DMA
|
||||
bool "Enable UART7 TX DMA"
|
||||
depends on BSP_USING_UART7 && RT_SERIAL_USING_DMA
|
||||
default n
|
||||
|
||||
config BSP_UART7_RX_BUFSIZE
|
||||
int "Set UART7 RX buffer size"
|
||||
range 64 65535
|
||||
depends on RT_USING_SERIAL_V2
|
||||
default 256
|
||||
|
||||
config BSP_UART7_TX_BUFSIZE
|
||||
int "Set UART7 TX buffer size"
|
||||
range 0 65535
|
||||
depends on RT_USING_SERIAL_V2
|
||||
default 0
|
||||
endif
|
||||
endif
|
||||
|
||||
config BSP_USING_LCD
|
||||
bool "Enable LCD"
|
||||
select BSP_USING_GPIO
|
||||
select BSP_USING_LCD
|
||||
default n
|
||||
|
||||
config BSP_USING_LVGL
|
||||
bool "Enable LVGL for LCD"
|
||||
select PKG_USING_LVGL
|
||||
select BSP_USING_TOUCH
|
||||
default n
|
||||
|
||||
if BSP_USING_LVGL
|
||||
config BSP_USING_LVGL_DEMO
|
||||
bool "Enable LVGL demo"
|
||||
select PKG_USING_LV_MUSIC_DEMO
|
||||
default y
|
||||
endif
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Board extended module Drivers"
|
||||
|
||||
endmenu
|
||||
endmenu
|
||||
@@ -0,0 +1,16 @@
|
||||
import os
|
||||
from building import *
|
||||
|
||||
objs = []
|
||||
cwd = GetCurrentDir()
|
||||
list = os.listdir(cwd)
|
||||
CPPPATH = [cwd]
|
||||
src = Glob('*.c')
|
||||
|
||||
objs = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
for item in list:
|
||||
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
|
||||
objs = objs + SConscript(os.path.join(item, 'SConscript'))
|
||||
|
||||
Return('objs')
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-10-10 Sherman first version
|
||||
*/
|
||||
|
||||
#ifndef __BOARD_H__
|
||||
#define __BOARD_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RA_SRAM_SIZE 640 /* The SRAM size of the chip needs to be modified */
|
||||
#define RA_SRAM_END (0x20000000 + RA_SRAM_SIZE * 1024)
|
||||
|
||||
#ifdef __ARMCC_VERSION
|
||||
extern int Image$$RAM_END$$ZI$$Base;
|
||||
#define HEAP_BEGIN ((void *)&Image$$RAM_END$$ZI$$Base)
|
||||
#elif __ICCARM__
|
||||
#pragma section="CSTACK"
|
||||
#define HEAP_BEGIN (__segment_end("CSTACK"))
|
||||
#else
|
||||
extern int __RAM_segment_used_end__;
|
||||
#define HEAP_BEGIN (&__RAM_segment_used_end__)
|
||||
#endif
|
||||
|
||||
#define HEAP_END RA_SRAM_END
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-port', src, depend = ['BSP_USING_LVGL'], CPPPATH = CPPPATH)
|
||||
Return('group')
|
||||
@@ -0,0 +1,17 @@
|
||||
from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
group = []
|
||||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
list = os.listdir(cwd)
|
||||
for d in list:
|
||||
path = os.path.join(cwd, d)
|
||||
if os.path.isfile(os.path.join(path, 'SConscript')):
|
||||
group = group + SConscript(os.path.join(d, 'SConscript'))
|
||||
|
||||
group = group + DefineGroup('LVGL-demo', src, depend = ['BSP_USING_LVGL', 'BSP_USING_LVGL_DEMO'], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-10-17 Meco Man First version
|
||||
* 2022-05-10 Meco Man improve rt-thread initialization process
|
||||
*/
|
||||
|
||||
void lv_user_gui_init(void)
|
||||
{
|
||||
/* display demo; you may replace with your LVGL application at here */
|
||||
extern void lv_demo_music(void);
|
||||
lv_demo_music();
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-10-18 Meco Man First version
|
||||
*/
|
||||
|
||||
#ifndef LV_CONF_H
|
||||
#define LV_CONF_H
|
||||
|
||||
/* Enable additional color format support */
|
||||
#define DLG_LVGL_CF 1
|
||||
|
||||
/* Enable sub byte color formats to be swapped. If disabled, which is recommended for
|
||||
* performance, bitmaps need to be in correct order */
|
||||
#define DLG_LVGL_CF_SUB_BYTE_SWAP 0
|
||||
|
||||
#define LV_USE_PERF_MONITOR 1
|
||||
#define LV_COLOR_DEPTH 16
|
||||
#define LV_HOR_RES_MAX 480
|
||||
#define LV_VER_RES_MAX 272
|
||||
|
||||
#define DLG_LVGL_USE_GPU_RA6M3 0
|
||||
|
||||
#ifdef PKG_USING_LV_MUSIC_DEMO
|
||||
/* music player demo */
|
||||
#define LV_USE_DEMO_RTT_MUSIC 1
|
||||
#define LV_DEMO_RTT_MUSIC_AUTO_PLAY 1
|
||||
#define LV_FONT_MONTSERRAT_12 1
|
||||
#define LV_FONT_MONTSERRAT_16 1
|
||||
#define LV_COLOR_SCREEN_TRANSP 0
|
||||
#endif /* PKG_USING_LV_MUSIC_DEMO */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-11-24 Rbb666 The first version
|
||||
*/
|
||||
#include <lvgl.h>
|
||||
#include "lcd_port.h"
|
||||
#include "hal_data.h"
|
||||
|
||||
#if DLG_LVGL_USE_GPU_RA6M3
|
||||
#include "lv_port_gpu.h"
|
||||
#endif
|
||||
|
||||
#define COLOR_BUFFER (LV_HOR_RES_MAX * LV_VER_RES_MAX / 4)
|
||||
|
||||
/*A static or global variable to store the buffers*/
|
||||
static lv_disp_draw_buf_t disp_buf;
|
||||
|
||||
/*Descriptor of a display driver*/
|
||||
static lv_disp_drv_t disp_drv;
|
||||
|
||||
/*Static or global buffer(s). The second buffer is optional*/
|
||||
// 0x1FFE0000 0x20040000
|
||||
__attribute__((section(".ARM.__at_0x1FFE0000"))) lv_color_t buf_1[COLOR_BUFFER];
|
||||
|
||||
static uint8_t lvgl_ready_done = RT_EBUSY;
|
||||
|
||||
static rt_device_t device;
|
||||
static struct rt_device_graphic_info info;
|
||||
static rt_sem_t trans_done_semphr = RT_NULL;
|
||||
|
||||
void _rm_guix_port_display_callback(display_callback_args_t *p_args)
|
||||
{
|
||||
if (lvgl_ready_done != RT_EOK)
|
||||
return;
|
||||
|
||||
if (DISPLAY_EVENT_LINE_DETECTION == p_args->event)
|
||||
{
|
||||
/* enter interrupt */
|
||||
rt_interrupt_enter();
|
||||
|
||||
lv_disp_flush_ready((lv_disp_drv_t *)&disp_drv);
|
||||
|
||||
rt_sem_release(trans_done_semphr);
|
||||
|
||||
/* exit interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
}
|
||||
|
||||
// Wait until Vsync is triggered through callback function
|
||||
void vsync_wait(void)
|
||||
{
|
||||
rt_sem_take(trans_done_semphr, RT_WAITING_FOREVER);
|
||||
}
|
||||
|
||||
static void color_to16_maybe(lv_color16_t *dst, lv_color_t *src)
|
||||
{
|
||||
#if (LV_COLOR_DEPTH == 16)
|
||||
dst->full = src->full;
|
||||
#else
|
||||
dst->ch.blue = src->ch.blue;
|
||||
dst->ch.green = src->ch.green;
|
||||
dst->ch.red = src->ch.red;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void disp_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
|
||||
{
|
||||
int x1, x2, y1, y2;
|
||||
|
||||
x1 = area->x1;
|
||||
x2 = area->x2;
|
||||
y1 = area->y1;
|
||||
y2 = area->y2;
|
||||
|
||||
/*Return if the area is out the screen*/
|
||||
if (x2 < 0)
|
||||
return;
|
||||
if (y2 < 0)
|
||||
return;
|
||||
if (x1 > info.width - 1)
|
||||
return;
|
||||
if (y1 > info.height - 1)
|
||||
return;
|
||||
|
||||
/*Truncate the area to the screen*/
|
||||
int32_t act_x1 = x1 < 0 ? 0 : x1;
|
||||
int32_t act_y1 = y1 < 0 ? 0 : y1;
|
||||
int32_t act_x2 = x2 > info.width - 1 ? info.width - 1 : x2;
|
||||
int32_t act_y2 = y2 > info.height - 1 ? info.height - 1 : y2;
|
||||
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
long int location = 0;
|
||||
|
||||
#if DLG_LVGL_USE_GPU_RA6M3
|
||||
lv_port_gpu_flush();
|
||||
#endif
|
||||
|
||||
/* color_p is a buffer pointer; the buffer is provided by LVGL */
|
||||
lv_color16_t *fbp16 = (lv_color16_t *)info.framebuffer;
|
||||
|
||||
for (y = act_y1; y <= act_y2; y++)
|
||||
{
|
||||
for (x = act_x1; x <= act_x2; x++)
|
||||
{
|
||||
location = (x) + (y) * info.width;
|
||||
color_to16_maybe(&fbp16[location], color_p);
|
||||
color_p++;
|
||||
}
|
||||
|
||||
color_p += x2 - act_x2;
|
||||
}
|
||||
|
||||
vsync_wait();
|
||||
}
|
||||
|
||||
void lv_port_disp_init(void)
|
||||
{
|
||||
/* LCD Device Init */
|
||||
device = rt_device_find("lcd");
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
|
||||
if (rt_device_open(device, RT_DEVICE_OFLAG_RDWR) == RT_EOK)
|
||||
{
|
||||
rt_device_control(device, RTGRAPHIC_CTRL_GET_INFO, &info);
|
||||
}
|
||||
|
||||
RT_ASSERT(info.bits_per_pixel == 8 || info.bits_per_pixel == 16 ||
|
||||
info.bits_per_pixel == 24 || info.bits_per_pixel == 32);
|
||||
|
||||
trans_done_semphr = rt_sem_create("lvgl_sem", 1, RT_IPC_FLAG_PRIO);
|
||||
if (trans_done_semphr == RT_NULL)
|
||||
{
|
||||
rt_kprintf("create transform done semphr failed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/*Initialize `disp_buf` with the buffer(s). With only one buffer use NULL instead buf_2 */
|
||||
lv_disp_draw_buf_init(&disp_buf, buf_1, NULL, COLOR_BUFFER);
|
||||
|
||||
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
|
||||
|
||||
/*Set the resolution of the display*/
|
||||
disp_drv.hor_res = LCD_WIDTH;
|
||||
disp_drv.ver_res = LCD_HEIGHT;
|
||||
|
||||
/*Set a display buffer*/
|
||||
disp_drv.draw_buf = &disp_buf;
|
||||
|
||||
/*Used to copy the buffer's content to the display*/
|
||||
disp_drv.flush_cb = disp_flush;
|
||||
|
||||
#if DLG_LVGL_USE_GPU_RA6M3
|
||||
/* Initialize GPU module */
|
||||
lv_port_gpu_init();
|
||||
#endif /* LV_PORT_DISP_GPU_EN */
|
||||
|
||||
/*Finally register the driver*/
|
||||
lv_disp_drv_register(&disp_drv);
|
||||
|
||||
lvgl_ready_done = RT_EOK;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-10-18 Meco Man The first version
|
||||
*/
|
||||
#include <lvgl.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
void lv_port_indev_init(void)
|
||||
{
|
||||
static lv_indev_drv_t indev_drv;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
from building import *
|
||||
import rtconfig
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
|
||||
src = []
|
||||
|
||||
if GetDepend(['BSP_USING_RW007']):
|
||||
src += Glob('drv_rw007.c')
|
||||
|
||||
CPPPATH = [cwd]
|
||||
LOCAL_CFLAGS = ''
|
||||
|
||||
if rtconfig.PLATFORM in ['gcc', 'armclang']:
|
||||
LOCAL_CFLAGS += ' -std=c99'
|
||||
elif rtconfig.PLATFORM in ['armcc']:
|
||||
LOCAL_CFLAGS += ' --c99'
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [], CPPPATH = CPPPATH, LOCAL_CFLAGS = LOCAL_CFLAGS)
|
||||
|
||||
Return('group')
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-01-19 Sherman first version
|
||||
*/
|
||||
|
||||
/* Number of IRQ channels on the device */
|
||||
#define RA_IRQ_MAX 16
|
||||
|
||||
/* PIN to IRQx table */
|
||||
#define PIN2IRQX_TABLE \
|
||||
{ \
|
||||
switch (pin) \
|
||||
{ \
|
||||
case BSP_IO_PORT_04_PIN_00: \
|
||||
case BSP_IO_PORT_02_PIN_06: \
|
||||
case BSP_IO_PORT_01_PIN_05: \
|
||||
return 0; \
|
||||
case BSP_IO_PORT_02_PIN_05: \
|
||||
case BSP_IO_PORT_01_PIN_01: \
|
||||
case BSP_IO_PORT_01_PIN_04: \
|
||||
return 1; \
|
||||
case BSP_IO_PORT_02_PIN_03: \
|
||||
case BSP_IO_PORT_01_PIN_00: \
|
||||
case BSP_IO_PORT_02_PIN_13: \
|
||||
return 2; \
|
||||
case BSP_IO_PORT_02_PIN_02: \
|
||||
case BSP_IO_PORT_01_PIN_10: \
|
||||
case BSP_IO_PORT_02_PIN_12: \
|
||||
return 3; \
|
||||
case BSP_IO_PORT_04_PIN_02: \
|
||||
case BSP_IO_PORT_01_PIN_11: \
|
||||
case BSP_IO_PORT_04_PIN_11: \
|
||||
return 4; \
|
||||
case BSP_IO_PORT_04_PIN_01: \
|
||||
case BSP_IO_PORT_03_PIN_02: \
|
||||
case BSP_IO_PORT_04_PIN_10: \
|
||||
return 5; \
|
||||
case BSP_IO_PORT_03_PIN_01: \
|
||||
case BSP_IO_PORT_00_PIN_00: \
|
||||
case BSP_IO_PORT_04_PIN_09: \
|
||||
return 6; \
|
||||
case BSP_IO_PORT_00_PIN_01: \
|
||||
case BSP_IO_PORT_04_PIN_08: \
|
||||
return 7; \
|
||||
case BSP_IO_PORT_00_PIN_02: \
|
||||
case BSP_IO_PORT_03_PIN_05: \
|
||||
case BSP_IO_PORT_04_PIN_15: \
|
||||
return 8; \
|
||||
case BSP_IO_PORT_00_PIN_04: \
|
||||
case BSP_IO_PORT_03_PIN_04: \
|
||||
case BSP_IO_PORT_04_PIN_14: \
|
||||
return 9; \
|
||||
case BSP_IO_PORT_00_PIN_05: \
|
||||
case BSP_IO_PORT_07_PIN_09: \
|
||||
return 10; \
|
||||
case BSP_IO_PORT_05_PIN_01: \
|
||||
case BSP_IO_PORT_00_PIN_06: \
|
||||
case BSP_IO_PORT_07_PIN_08: \
|
||||
return 11; \
|
||||
case BSP_IO_PORT_05_PIN_02: \
|
||||
case BSP_IO_PORT_00_PIN_08: \
|
||||
return 12; \
|
||||
case BSP_IO_PORT_00_PIN_15: \
|
||||
case BSP_IO_PORT_00_PIN_09: \
|
||||
return 13; \
|
||||
case BSP_IO_PORT_04_PIN_03: \
|
||||
case BSP_IO_PORT_05_PIN_12: \
|
||||
case BSP_IO_PORT_05_PIN_05: \
|
||||
return 14; \
|
||||
case BSP_IO_PORT_04_PIN_04: \
|
||||
case BSP_IO_PORT_05_PIN_11: \
|
||||
case BSP_IO_PORT_05_PIN_06: \
|
||||
return 15; \
|
||||
default : \
|
||||
return -1; \
|
||||
} \
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018-07-28 liu2guang the first version for STM32F469NI-Discovery.
|
||||
*/
|
||||
|
||||
#ifndef __DRV_LCD_H_
|
||||
#define __DRV_LCD_H_
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <board.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ROTATION_ZERO = 0,
|
||||
ROTATION_090 = 90,
|
||||
ROTATION_180 = 180,
|
||||
ROTATION_270 = 270,
|
||||
} bsp_rotation;
|
||||
|
||||
#define LCD_WIDTH DISPLAY_HSIZE_INPUT0
|
||||
#define LCD_HEIGHT DISPLAY_VSIZE_INPUT0
|
||||
#define LCD_BITS_PER_PIXEL DISPLAY_BITS_PER_PIXEL_INPUT1
|
||||
#define LCD_PIXEL_FORMAT RTGRAPHIC_PIXEL_FORMAT_RGB565
|
||||
#define LCD_BUF_SIZE (LCD_WIDTH * LCD_HEIGHT * LCD_BITS_PER_PIXEL / 8)
|
||||
|
||||
#define LCD_BL_PIN BSP_IO_PORT_06_PIN_03
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,25 @@
|
||||
Import('RTT_ROOT')
|
||||
Import('rtconfig')
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = []
|
||||
group = []
|
||||
CPPPATH = []
|
||||
|
||||
if rtconfig.PLATFORM in ['iccarm']:
|
||||
print("\nThe current project does not support IAR build\n")
|
||||
Return('group')
|
||||
elif rtconfig.PLATFORM in ['gcc', 'armclang']:
|
||||
if GetOption('target') != 'mdk5':
|
||||
src += Glob(cwd + '/fsp/src/bsp/mcu/all/*.c')
|
||||
src += [cwd + '/fsp/src/bsp/cmsis/Device/RENESAS/Source/system.c']
|
||||
src += [cwd + '/fsp/src/bsp/cmsis/Device/RENESAS/Source/startup.c']
|
||||
src += Glob(cwd + '/fsp/src/r_*/*.c')
|
||||
CPPPATH = [ cwd + '/arm/CMSIS_5/CMSIS/Core/Include',
|
||||
cwd + '/fsp/inc',
|
||||
cwd + '/fsp/inc/api',
|
||||
cwd + '/fsp/inc/instances',]
|
||||
|
||||
group = DefineGroup('ra', src, depend = [''], CPPPATH = CPPPATH)
|
||||
Return('group')
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,39 @@
|
||||
/**************************************************************************//**
|
||||
* @file cmsis_version.h
|
||||
* @brief CMSIS Core(M) Version definitions
|
||||
* @version V5.0.4
|
||||
* @date 23. July 2019
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2009-2019 ARM Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if defined ( __ICCARM__ )
|
||||
#pragma system_include /* treat file as system include file for MISRA check */
|
||||
#elif defined (__clang__)
|
||||
#pragma clang system_header /* treat file as system include file */
|
||||
#endif
|
||||
|
||||
#ifndef __CMSIS_VERSION_H
|
||||
#define __CMSIS_VERSION_H
|
||||
|
||||
/* CMSIS Version definitions */
|
||||
#define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */
|
||||
#define __CM_CMSIS_VERSION_SUB ( 4U) /*!< [15:0] CMSIS Core(M) sub version */
|
||||
#define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \
|
||||
__CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,70 @@
|
||||
/******************************************************************************
|
||||
* @file tz_context.h
|
||||
* @brief Context Management for Armv8-M TrustZone
|
||||
* @version V1.0.1
|
||||
* @date 10. January 2018
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2017-2018 Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if defined ( __ICCARM__ )
|
||||
#pragma system_include /* treat file as system include file for MISRA check */
|
||||
#elif defined (__clang__)
|
||||
#pragma clang system_header /* treat file as system include file */
|
||||
#endif
|
||||
|
||||
#ifndef TZ_CONTEXT_H
|
||||
#define TZ_CONTEXT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef TZ_MODULEID_T
|
||||
#define TZ_MODULEID_T
|
||||
/// \details Data type that identifies secure software modules called by a process.
|
||||
typedef uint32_t TZ_ModuleId_t;
|
||||
#endif
|
||||
|
||||
/// \details TZ Memory ID identifies an allocated memory slot.
|
||||
typedef uint32_t TZ_MemoryId_t;
|
||||
|
||||
/// Initialize secure context memory system
|
||||
/// \return execution status (1: success, 0: error)
|
||||
uint32_t TZ_InitContextSystem_S (void);
|
||||
|
||||
/// Allocate context memory for calling secure software modules in TrustZone
|
||||
/// \param[in] module identifies software modules called from non-secure mode
|
||||
/// \return value != 0 id TrustZone memory slot identifier
|
||||
/// \return value 0 no memory available or internal error
|
||||
TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module);
|
||||
|
||||
/// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S
|
||||
/// \param[in] id TrustZone memory slot identifier
|
||||
/// \return execution status (1: success, 0: error)
|
||||
uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id);
|
||||
|
||||
/// Load secure context (called on RTOS thread context switch)
|
||||
/// \param[in] id TrustZone memory slot identifier
|
||||
/// \return execution status (1: success, 0: error)
|
||||
uint32_t TZ_LoadContext_S (TZ_MemoryId_t id);
|
||||
|
||||
/// Store secure context (called on RTOS thread context switch)
|
||||
/// \param[in] id TrustZone memory slot identifier
|
||||
/// \return execution status (1: success, 0: error)
|
||||
uint32_t TZ_StoreContext_S (TZ_MemoryId_t id);
|
||||
|
||||
#endif // TZ_CONTEXT_H
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,66 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020] Renesas Electronics Corporation and/or its licensors. All Rights Reserved.
|
||||
*
|
||||
* This file is part of Renesas RA Flexible Software Package (FSP)
|
||||
*
|
||||
* The contents of this file (the "contents") are proprietary and confidential to Renesas Electronics Corporation
|
||||
* and/or its licensors ("Renesas") and subject to statutory and contractual protections.
|
||||
*
|
||||
* This file is subject to a Renesas FSP license agreement. Unless otherwise agreed in an FSP license agreement with
|
||||
* Renesas: 1) you may not use, copy, modify, distribute, display, or perform the contents; 2) you may not use any name
|
||||
* or mark of Renesas for advertising or publicity purposes or in connection with your use of the contents; 3) RENESAS
|
||||
* MAKES NO WARRANTY OR REPRESENTATIONS ABOUT THE SUITABILITY OF THE CONTENTS FOR ANY PURPOSE; THE CONTENTS ARE PROVIDED
|
||||
* "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT; AND 4) RENESAS SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, OR
|
||||
* CONSEQUENTIAL DAMAGES, INCLUDING DAMAGES RESULTING FROM LOSS OF USE, DATA, OR PROJECTS, WHETHER IN AN ACTION OF
|
||||
* CONTRACT OR TORT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE CONTENTS. Third-party contents
|
||||
* included in this file may be subject to different terms.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : board.h
|
||||
* Description : Includes and API function available for this board.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @ingroup BSP_Boards
|
||||
* @defgroup BOARD_RA6M2_CPK for the RA6M4_CPK Board
|
||||
* @brief BSP for the RA6M4_CPK Board
|
||||
*
|
||||
* The RA6M4_CPK is a development kit for the Renesas RA6M2 microcontroller.
|
||||
*
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes <System Includes> , "Project Includes"
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/* BSP Board Specific Includes. */
|
||||
#include "../ra6m3/board_ethernet_phy.h"
|
||||
#include "../ra6m3/board_init.h"
|
||||
#include "../ra6m3/board_leds.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
#define BOARD_RA6M3
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global functions (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** @} (end defgroup BOARD_RA6M4_CPK) */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @ingroup BOARD_RA6M4_CPK
|
||||
* @defgroup BOARD_RA6M4_CPK_ETHERNET_PHY Board Ethernet Phy
|
||||
* @brief Ethernet Phy information for this board.
|
||||
*
|
||||
* This is code specific to the RA6M4_CPK board.
|
||||
*
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef BSP_ETHERNET_PHY_H
|
||||
#define BSP_ETHERNET_PHY_H
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
|
||||
FSP_HEADER
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
#define BOARD_PHY_TYPE (0)
|
||||
#define BOARD_PHY_REF_CLK (1)
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Public Functions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
|
||||
FSP_FOOTER
|
||||
|
||||
#endif
|
||||
|
||||
/** @} (end defgroup BOARD_RA6M4_CPK_ETHERNET_PHY) */
|
||||
@@ -0,0 +1,66 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020] Renesas Electronics Corporation and/or its licensors. All Rights Reserved.
|
||||
*
|
||||
* This file is part of Renesas RA Flexible Software Package (FSP)
|
||||
*
|
||||
* The contents of this file (the "contents") are proprietary and confidential to Renesas Electronics Corporation
|
||||
* and/or its licensors ("Renesas") and subject to statutory and contractual protections.
|
||||
*
|
||||
* This file is subject to a Renesas FSP license agreement. Unless otherwise agreed in an FSP license agreement with
|
||||
* Renesas: 1) you may not use, copy, modify, distribute, display, or perform the contents; 2) you may not use any name
|
||||
* or mark of Renesas for advertising or publicity purposes or in connection with your use of the contents; 3) RENESAS
|
||||
* MAKES NO WARRANTY OR REPRESENTATIONS ABOUT THE SUITABILITY OF THE CONTENTS FOR ANY PURPOSE; THE CONTENTS ARE PROVIDED
|
||||
* "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT; AND 4) RENESAS SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, OR
|
||||
* CONSEQUENTIAL DAMAGES, INCLUDING DAMAGES RESULTING FROM LOSS OF USE, DATA, OR PROJECTS, WHETHER IN AN ACTION OF
|
||||
* CONTRACT OR TORT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE CONTENTS. Third-party contents
|
||||
* included in this file may be subject to different terms.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : bsp_init.c
|
||||
* Description : This module calls any initialization code specific to this BSP.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BOARD_RA6M4_CPK_INIT
|
||||
*
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes <System Includes> , "Project Includes"
|
||||
**********************************************************************************************************************/
|
||||
#include "bsp_api.h"
|
||||
|
||||
#if defined(BOARD_RA6M3)
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private global variables and functions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @brief Performs any initialization specific to this BSP.
|
||||
*
|
||||
* @param[in] p_args Pointer to arguments of the user's choice.
|
||||
**********************************************************************************************************************/
|
||||
void bsp_init (void * p_args)
|
||||
{
|
||||
FSP_PARAMETER_NOT_USED(p_args);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/** @} (end addtogroup BOARD_RA6M4_CPK_INIT) */
|
||||
@@ -0,0 +1,63 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020] Renesas Electronics Corporation and/or its licensors. All Rights Reserved.
|
||||
*
|
||||
* This file is part of Renesas RA Flexible Software Package (FSP)
|
||||
*
|
||||
* The contents of this file (the "contents") are proprietary and confidential to Renesas Electronics Corporation
|
||||
* and/or its licensors ("Renesas") and subject to statutory and contractual protections.
|
||||
*
|
||||
* This file is subject to a Renesas FSP license agreement. Unless otherwise agreed in an FSP license agreement with
|
||||
* Renesas: 1) you may not use, copy, modify, distribute, display, or perform the contents; 2) you may not use any name
|
||||
* or mark of Renesas for advertising or publicity purposes or in connection with your use of the contents; 3) RENESAS
|
||||
* MAKES NO WARRANTY OR REPRESENTATIONS ABOUT THE SUITABILITY OF THE CONTENTS FOR ANY PURPOSE; THE CONTENTS ARE PROVIDED
|
||||
* "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT; AND 4) RENESAS SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, OR
|
||||
* CONSEQUENTIAL DAMAGES, INCLUDING DAMAGES RESULTING FROM LOSS OF USE, DATA, OR PROJECTS, WHETHER IN AN ACTION OF
|
||||
* CONTRACT OR TORT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE CONTENTS. Third-party contents
|
||||
* included in this file may be subject to different terms.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : board_init.h
|
||||
* Description : This module calls any initialization code specific to this BSP.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @ingroup BOARD_RA6M4_CPK
|
||||
* @defgroup BOARD_RA6M4_CPK Board Specific Code
|
||||
* @brief Board specific code for the RA6M4_CPK Board
|
||||
*
|
||||
* This is code specific to the RA6M4_CPK board.
|
||||
*
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef BOARD_INIT_H
|
||||
#define BOARD_INIT_H
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
|
||||
FSP_HEADER
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global functions (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
void bsp_init(void * p_args);
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
|
||||
FSP_FOOTER
|
||||
|
||||
#endif
|
||||
|
||||
/** @} (end defgroup BOARD_RA6M4_CPK_INIT) */
|
||||
@@ -0,0 +1,74 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020] Renesas Electronics Corporation and/or its licensors. All Rights Reserved.
|
||||
*
|
||||
* This file is part of Renesas RA Flexible Software Package (FSP)
|
||||
*
|
||||
* The contents of this file (the "contents") are proprietary and confidential to Renesas Electronics Corporation
|
||||
* and/or its licensors ("Renesas") and subject to statutory and contractual protections.
|
||||
*
|
||||
* This file is subject to a Renesas FSP license agreement. Unless otherwise agreed in an FSP license agreement with
|
||||
* Renesas: 1) you may not use, copy, modify, distribute, display, or perform the contents; 2) you may not use any name
|
||||
* or mark of Renesas for advertising or publicity purposes or in connection with your use of the contents; 3) RENESAS
|
||||
* MAKES NO WARRANTY OR REPRESENTATIONS ABOUT THE SUITABILITY OF THE CONTENTS FOR ANY PURPOSE; THE CONTENTS ARE PROVIDED
|
||||
* "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT; AND 4) RENESAS SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, OR
|
||||
* CONSEQUENTIAL DAMAGES, INCLUDING DAMAGES RESULTING FROM LOSS OF USE, DATA, OR PROJECTS, WHETHER IN AN ACTION OF
|
||||
* CONTRACT OR TORT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE CONTENTS. Third-party contents
|
||||
* included in this file may be subject to different terms.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : board_leds.c
|
||||
* Description : This module has information about the LEDs on this board.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_RA6M4_CPK_LEDS
|
||||
*
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes
|
||||
**********************************************************************************************************************/
|
||||
#include "bsp_api.h"
|
||||
|
||||
#if defined(BOARD_RA6M4_CPK)
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private global variables and functions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** Array of LED IOPORT pins. */
|
||||
static const uint16_t g_bsp_prv_leds[] =
|
||||
{
|
||||
(uint16_t) BSP_IO_PORT_01_PIN_06, ///< USER LED
|
||||
};
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** Structure with LED information for this board. */
|
||||
|
||||
const bsp_leds_t g_bsp_leds =
|
||||
{
|
||||
.led_count = (uint16_t) ((sizeof(g_bsp_prv_leds) / sizeof(g_bsp_prv_leds[0]))),
|
||||
.p_leds = &g_bsp_prv_leds[0]
|
||||
};
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#endif
|
||||
|
||||
/** @} (end addtogroup BSP_RA6M4_CPK_LEDS) */
|
||||
@@ -0,0 +1,75 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020] Renesas Electronics Corporation and/or its licensors. All Rights Reserved.
|
||||
*
|
||||
* This file is part of Renesas RA Flexible Software Package (FSP)
|
||||
*
|
||||
* The contents of this file (the "contents") are proprietary and confidential to Renesas Electronics Corporation
|
||||
* and/or its licensors ("Renesas") and subject to statutory and contractual protections.
|
||||
*
|
||||
* This file is subject to a Renesas FSP license agreement. Unless otherwise agreed in an FSP license agreement with
|
||||
* Renesas: 1) you may not use, copy, modify, distribute, display, or perform the contents; 2) you may not use any name
|
||||
* or mark of Renesas for advertising or publicity purposes or in connection with your use of the contents; 3) RENESAS
|
||||
* MAKES NO WARRANTY OR REPRESENTATIONS ABOUT THE SUITABILITY OF THE CONTENTS FOR ANY PURPOSE; THE CONTENTS ARE PROVIDED
|
||||
* "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT; AND 4) RENESAS SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, OR
|
||||
* CONSEQUENTIAL DAMAGES, INCLUDING DAMAGES RESULTING FROM LOSS OF USE, DATA, OR PROJECTS, WHETHER IN AN ACTION OF
|
||||
* CONTRACT OR TORT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE CONTENTS. Third-party contents
|
||||
* included in this file may be subject to different terms.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* File Name : board_leds.h
|
||||
* Description : This module has information about the LEDs on this board.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @ingroup BOARD_RA6M4_CPK
|
||||
* @defgroup BSP_RA6M4_CPK_LEDS Board LEDs
|
||||
* @brief LED information for this board.
|
||||
*
|
||||
* This is code specific to the RA6M4_CPK board.
|
||||
*
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef BOARD_LEDS_H
|
||||
#define BOARD_LEDS_H
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
|
||||
FSP_HEADER
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** Information on how many LEDs and what pins they are on. */
|
||||
typedef struct st_bsp_leds
|
||||
{
|
||||
uint16_t led_count; ///< The number of LEDs on this board
|
||||
uint16_t const * p_leds; ///< Pointer to an array of IOPORT pins for controlling LEDs
|
||||
} bsp_leds_t;
|
||||
|
||||
/** Available user-controllable LEDs on this board. These enums can be can be used to index into the array of LED pins
|
||||
* found in the bsp_leds_t structure. */
|
||||
typedef enum e_bsp_led
|
||||
{
|
||||
BSP_LED_LED3 = 0, ///< TB LED - Red
|
||||
} bsp_led_t;
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Public Functions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
|
||||
FSP_FOOTER
|
||||
#endif /* BOARD_LEDS_H */
|
||||
|
||||
/** @} (end defgroup BSP_RA6M4_CPK_LEDS) */
|
||||
@@ -0,0 +1,107 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef BSP_API_H
|
||||
#define BSP_API_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes <System Includes> , "Project Includes"
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/* FSP Common Includes. */
|
||||
#include "fsp_common_api.h"
|
||||
|
||||
/* Gets MCU configuration information. */
|
||||
#include "bsp_cfg.h"
|
||||
|
||||
#if defined(__GNUC__) && !defined(__ARMCC_VERSION)
|
||||
|
||||
/* CMSIS-CORE currently generates 2 warnings when compiling with GCC. One in core_cmInstr.h and one in core_cm4_simd.h.
|
||||
* We are not modifying these files so we will ignore these warnings temporarily. */
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
#endif
|
||||
|
||||
/* Vector information for this project. This is generated by the tooling. */
|
||||
#include "../../src/bsp/mcu/all/bsp_arm_exceptions.h"
|
||||
#include "vector_data.h"
|
||||
|
||||
/* CMSIS-CORE Renesas Device Files. Must come after bsp_feature.h, which is included in bsp_cfg.h. */
|
||||
#include "../../src/bsp/cmsis/Device/RENESAS/Include/renesas.h"
|
||||
#include "../../src/bsp/cmsis/Device/RENESAS/Include/system.h"
|
||||
|
||||
#if defined(__GNUC__) && !defined(__ARMCC_VERSION)
|
||||
|
||||
/* Restore warning settings for 'conversion' and 'sign-conversion' to as specified on command line. */
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
/* BSP Common Includes. */
|
||||
#include "../../src/bsp/mcu/all/bsp_common.h"
|
||||
|
||||
/* BSP MCU Specific Includes. */
|
||||
#include "../../src/bsp/mcu/all/bsp_register_protection.h"
|
||||
#include "../../src/bsp/mcu/all/bsp_irq.h"
|
||||
#include "../../src/bsp/mcu/all/bsp_io.h"
|
||||
#include "../../src/bsp/mcu/all/bsp_group_irq.h"
|
||||
#include "../../src/bsp/mcu/all/bsp_clocks.h"
|
||||
#include "../../src/bsp/mcu/all/bsp_module_stop.h"
|
||||
#include "../../src/bsp/mcu/all/bsp_security.h"
|
||||
|
||||
/* Factory MCU information. */
|
||||
#include "../../inc/fsp_features.h"
|
||||
|
||||
/* BSP Common Includes (Other than bsp_common.h) */
|
||||
#include "../../src/bsp/mcu/all/bsp_delay.h"
|
||||
#include "../../src/bsp/mcu/all/bsp_mcu_api.h"
|
||||
|
||||
/* BSP TFU Includes. */
|
||||
#if BSP_FEATURE_TFU_SUPPORTED
|
||||
#include "../../src/bsp/mcu/all/bsp_tfu.h"
|
||||
#endif
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
|
||||
FSP_HEADER
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global functions (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
fsp_err_t R_FSP_VersionGet(fsp_pack_version_t * const p_version);
|
||||
|
||||
/** @} (end addtogroup BSP_MCU) */
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
|
||||
FSP_FOOTER
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,80 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef FSP_VERSION_H
|
||||
#define FSP_VERSION_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/* Includes board and MCU related header files. */
|
||||
#include "bsp_api.h"
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup RENESAS_COMMON
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** FSP pack major version. */
|
||||
#define FSP_VERSION_MAJOR (3U)
|
||||
|
||||
/** FSP pack minor version. */
|
||||
#define FSP_VERSION_MINOR (5U)
|
||||
|
||||
/** FSP pack patch version. */
|
||||
#define FSP_VERSION_PATCH (0U)
|
||||
|
||||
/** FSP pack version build number (currently unused). */
|
||||
#define FSP_VERSION_BUILD (0U)
|
||||
|
||||
/** Public FSP version name. */
|
||||
#define FSP_VERSION_STRING ("3.5.0")
|
||||
|
||||
/** Unique FSP version ID. */
|
||||
#define FSP_VERSION_BUILD_STRING ("Built with Renesas Advanced Flexible Software Package version 3.5.0")
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** FSP Pack version structure */
|
||||
typedef union st_fsp_pack_version
|
||||
{
|
||||
/** Version id */
|
||||
uint32_t version_id;
|
||||
|
||||
/** Code version parameters, little endian order. */
|
||||
struct
|
||||
{
|
||||
uint8_t build; ///< Build version of FSP Pack
|
||||
uint8_t patch; ///< Patch version of FSP Pack
|
||||
uint8_t minor; ///< Minor version of FSP Pack
|
||||
uint8_t major; ///< Major version of FSP Pack
|
||||
};
|
||||
} fsp_pack_version_t;
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,192 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef R_SCI_UART_H
|
||||
#define R_SCI_UART_H
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup SCI_UART
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes
|
||||
**********************************************************************************************************************/
|
||||
#include "bsp_api.h"
|
||||
#include "r_uart_api.h"
|
||||
#include "r_sci_uart_cfg.h"
|
||||
|
||||
/* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
|
||||
FSP_HEADER
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** Enumeration for SCI clock source */
|
||||
typedef enum e_sci_clk_src
|
||||
{
|
||||
SCI_UART_CLOCK_INT, ///< Use internal clock for baud generation
|
||||
SCI_UART_CLOCK_INT_WITH_BAUDRATE_OUTPUT, ///< Use internal clock for baud generation and output on SCK
|
||||
SCI_UART_CLOCK_EXT8X, ///< Use external clock 8x baud rate
|
||||
SCI_UART_CLOCK_EXT16X ///< Use external clock 16x baud rate
|
||||
} sci_clk_src_t;
|
||||
|
||||
/** UART flow control mode definition */
|
||||
typedef enum e_sci_uart_flow_control
|
||||
{
|
||||
SCI_UART_FLOW_CONTROL_RTS = 0U, ///< Use SCI pin for RTS
|
||||
SCI_UART_FLOW_CONTROL_CTS = 1U, ///< Use SCI pin for CTS
|
||||
SCI_UART_FLOW_CONTROL_CTSRTS = 3U, ///< Use SCI pin for CTS, external pin for RTS
|
||||
SCI_UART_FLOW_CONTROL_HARDWARE_CTSRTS = 8U, ///< Use CTSn_RTSn pin for RTS and CTSn pin for CTS. Available only for some channels on selected MCUs. See hardware manual for channel specific options
|
||||
} sci_uart_flow_control_t;
|
||||
|
||||
/** UART instance control block. */
|
||||
typedef struct st_sci_uart_instance_ctrl
|
||||
{
|
||||
/* Parameters to control UART peripheral device */
|
||||
uint8_t fifo_depth; // FIFO depth of the UART channel
|
||||
uint8_t rx_transfer_in_progress; // Set to 1 if a receive transfer is in progress, 0 otherwise
|
||||
uint8_t data_bytes : 2; // 1 byte for 7 or 8 bit data, 2 bytes for 9 bit data
|
||||
uint8_t bitrate_modulation : 1; // 1 if bit rate modulation is enabled, 0 otherwise
|
||||
uint32_t open; // Used to determine if the channel is configured
|
||||
|
||||
bsp_io_port_pin_t flow_pin;
|
||||
|
||||
/* Source buffer pointer used to fill hardware FIFO from transmit ISR. */
|
||||
uint8_t const * p_tx_src;
|
||||
|
||||
/* Size of source buffer pointer used to fill hardware FIFO from transmit ISR. */
|
||||
uint32_t tx_src_bytes;
|
||||
|
||||
/* Destination buffer pointer used for receiving data. */
|
||||
uint8_t const * p_rx_dest;
|
||||
|
||||
/* Size of destination buffer pointer used for receiving data. */
|
||||
uint32_t rx_dest_bytes;
|
||||
|
||||
/* Pointer to the configuration block. */
|
||||
uart_cfg_t const * p_cfg;
|
||||
|
||||
/* Base register for this channel */
|
||||
R_SCI0_Type * p_reg;
|
||||
|
||||
void (* p_callback)(uart_callback_args_t *); // Pointer to callback that is called when a uart_event_t occurs.
|
||||
uart_callback_args_t * p_callback_memory; // Pointer to non-secure memory that can be used to pass arguments to a callback in non-secure memory.
|
||||
|
||||
/* Pointer to context to be passed into callback function */
|
||||
void const * p_context;
|
||||
} sci_uart_instance_ctrl_t;
|
||||
|
||||
/** Receive FIFO trigger configuration. */
|
||||
typedef enum e_sci_uart_rx_fifo_trigger
|
||||
{
|
||||
SCI_UART_RX_FIFO_TRIGGER_1 = 0x1, ///< Callback after each byte is received without buffering
|
||||
SCI_UART_RX_FIFO_TRIGGER_MAX = 0xF, ///< Callback when FIFO is full or after 15 bit times with no data (fewer interrupts)
|
||||
} sci_uart_rx_fifo_trigger_t;
|
||||
|
||||
/** Asynchronous Start Bit Edge Detection configuration. */
|
||||
typedef enum e_sci_uart_start_bit_detect
|
||||
{
|
||||
SCI_UART_START_BIT_LOW_LEVEL = 0x0, ///< Detect low level on RXDn pin as start bit
|
||||
SCI_UART_START_BIT_FALLING_EDGE = 0x1, ///< Detect falling level on RXDn pin as start bit
|
||||
} sci_uart_start_bit_detect_t;
|
||||
|
||||
/** Noise cancellation configuration. */
|
||||
typedef enum e_sci_uart_noise_cancellation
|
||||
{
|
||||
SCI_UART_NOISE_CANCELLATION_DISABLE = 0x0, ///< Disable noise cancellation
|
||||
SCI_UART_NOISE_CANCELLATION_ENABLE = 0x1, ///< Enable noise cancellation
|
||||
} sci_uart_noise_cancellation_t;
|
||||
|
||||
/** Register settings to acheive a desired baud rate and modulation duty. */
|
||||
typedef struct st_baud_setting_t
|
||||
{
|
||||
union
|
||||
{
|
||||
uint8_t semr_baudrate_bits;
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t : 2;
|
||||
uint8_t brme : 1; ///< Bit Rate Modulation Enable
|
||||
uint8_t abcse : 1; ///< Asynchronous Mode Extended Base Clock Select 1
|
||||
uint8_t abcs : 1; ///< Asynchronous Mode Base Clock Select
|
||||
uint8_t : 1;
|
||||
uint8_t bgdm : 1; ///< Baud Rate Generator Double-Speed Mode Select
|
||||
uint8_t : 1;
|
||||
};
|
||||
};
|
||||
uint8_t cks : 2; ///< CKS value to get divisor (CKS = N)
|
||||
uint8_t brr; ///< Bit Rate Register setting
|
||||
uint8_t mddr; ///< Modulation Duty Register setting
|
||||
} baud_setting_t;
|
||||
|
||||
/** UART on SCI device Configuration */
|
||||
typedef struct st_sci_uart_extended_cfg
|
||||
{
|
||||
sci_clk_src_t clock; ///< The source clock for the baud-rate generator. If internal optionally output baud rate on SCK
|
||||
sci_uart_start_bit_detect_t rx_edge_start; ///< Start reception on falling edge
|
||||
sci_uart_noise_cancellation_t noise_cancel; ///< Noise cancellation setting
|
||||
baud_setting_t * p_baud_setting; ///< Register settings for a desired baud rate.
|
||||
sci_uart_rx_fifo_trigger_t rx_fifo_trigger; ///< Receive FIFO trigger level, unused if channel has no FIFO or if DTC is used.
|
||||
bsp_io_port_pin_t flow_control_pin; ///< UART Driver Enable pin
|
||||
sci_uart_flow_control_t flow_control; ///< CTS/RTS function of the SSn pin
|
||||
} sci_uart_extended_cfg_t;
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* Exported global variables
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** @cond INC_HEADER_DEFS_SEC */
|
||||
/** Filled in Interface API structure for this Instance. */
|
||||
extern const uart_api_t g_uart_on_sci;
|
||||
|
||||
/** @endcond */
|
||||
|
||||
fsp_err_t R_SCI_UART_Open(uart_ctrl_t * const p_api_ctrl, uart_cfg_t const * const p_cfg);
|
||||
fsp_err_t R_SCI_UART_Read(uart_ctrl_t * const p_api_ctrl, uint8_t * const p_dest, uint32_t const bytes);
|
||||
fsp_err_t R_SCI_UART_Write(uart_ctrl_t * const p_api_ctrl, uint8_t const * const p_src, uint32_t const bytes);
|
||||
fsp_err_t R_SCI_UART_BaudSet(uart_ctrl_t * const p_api_ctrl, void const * const p_baud_setting);
|
||||
fsp_err_t R_SCI_UART_InfoGet(uart_ctrl_t * const p_api_ctrl, uart_info_t * const p_info);
|
||||
fsp_err_t R_SCI_UART_Close(uart_ctrl_t * const p_api_ctrl);
|
||||
fsp_err_t R_SCI_UART_Abort(uart_ctrl_t * const p_api_ctrl, uart_dir_t communication_to_abort);
|
||||
fsp_err_t R_SCI_UART_BaudCalculate(uint32_t baudrate,
|
||||
bool bitrate_modulation,
|
||||
uint32_t baud_rate_error_x_1000,
|
||||
baud_setting_t * const p_baud_setting);
|
||||
fsp_err_t R_SCI_UART_CallbackSet(uart_ctrl_t * const p_api_ctrl,
|
||||
void ( * p_callback)(uart_callback_args_t *),
|
||||
void const * const p_context,
|
||||
uart_callback_args_t * const p_callback_memory);
|
||||
fsp_err_t R_SCI_UART_ReadStop(uart_ctrl_t * const p_api_ctrl, uint32_t * remaining_bytes);
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @} (end addtogroup SCI_UART)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
|
||||
FSP_FOOTER
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,58 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef SYSTEM_RENESAS_ARM_H
|
||||
#define SYSTEM_RENESAS_ARM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern uint32_t SystemCoreClock; /** System Clock Frequency (Core Clock) */
|
||||
|
||||
/**
|
||||
* Initialize the system
|
||||
*
|
||||
* @param none
|
||||
* @return none
|
||||
*
|
||||
* @brief Setup the microcontroller system.
|
||||
* Initialize the System and update the SystemCoreClock variable.
|
||||
*/
|
||||
extern void SystemInit(void);
|
||||
|
||||
/**
|
||||
* Update SystemCoreClock variable
|
||||
*
|
||||
* @param none
|
||||
* @return none
|
||||
*
|
||||
* @brief Updates the SystemCoreClock with current core Clock
|
||||
* retrieved from cpu registers.
|
||||
*/
|
||||
extern void SystemCoreClockUpdate(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,156 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes <System Includes> , "Project Includes"
|
||||
**********************************************************************************************************************/
|
||||
#include "bsp_api.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
#if BSP_TZ_SECURE_BUILD
|
||||
#define BSP_TZ_STACK_SEAL_SIZE (8U)
|
||||
#else
|
||||
#define BSP_TZ_STACK_SEAL_SIZE (0U)
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/* Defines function pointers to be used with vector table. */
|
||||
typedef void (* exc_ptr_t)(void);
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private global variables and functions
|
||||
**********************************************************************************************************************/
|
||||
void Reset_Handler(void);
|
||||
void Default_Handler(void);
|
||||
int32_t main(void);
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* MCU starts executing here out of reset. Main stack pointer is set up already.
|
||||
**********************************************************************************************************************/
|
||||
void Reset_Handler (void)
|
||||
{
|
||||
/* Initialize system using BSP. */
|
||||
SystemInit();
|
||||
|
||||
/* Call user application. */
|
||||
#ifdef __ARMCC_VERSION
|
||||
main();
|
||||
#elif defined(__GNUC__)
|
||||
extern int entry(void);
|
||||
entry();
|
||||
#endif
|
||||
|
||||
while (1)
|
||||
{
|
||||
/* Infinite Loop. */
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Default exception handler.
|
||||
**********************************************************************************************************************/
|
||||
void Default_Handler (void)
|
||||
{
|
||||
/** A error has occurred. The user will need to investigate the cause. Common problems are stack corruption
|
||||
* or use of an invalid pointer. Use the Fault Status window in e2 studio or manually check the fault status
|
||||
* registers for more information.
|
||||
*/
|
||||
BSP_CFG_HANDLE_UNRECOVERABLE_ERROR(0);
|
||||
}
|
||||
|
||||
/* Main stack */
|
||||
static uint8_t g_main_stack[BSP_CFG_STACK_MAIN_BYTES + BSP_TZ_STACK_SEAL_SIZE] BSP_ALIGN_VARIABLE(BSP_STACK_ALIGNMENT)
|
||||
BSP_PLACE_IN_SECTION(BSP_SECTION_STACK);
|
||||
|
||||
/* Heap */
|
||||
#if (BSP_CFG_HEAP_BYTES > 0)
|
||||
|
||||
BSP_DONT_REMOVE static uint8_t g_heap[BSP_CFG_HEAP_BYTES] BSP_ALIGN_VARIABLE(BSP_STACK_ALIGNMENT) \
|
||||
BSP_PLACE_IN_SECTION(BSP_SECTION_HEAP);
|
||||
#endif
|
||||
|
||||
/* All system exceptions in the vector table are weak references to Default_Handler. If the user wishes to handle
|
||||
* these exceptions in their code they should define their own function with the same name.
|
||||
*/
|
||||
#if defined(__ICCARM__)
|
||||
#define WEAK_REF_ATTRIBUTE
|
||||
|
||||
#pragma weak HardFault_Handler = Default_Handler
|
||||
#pragma weak MemManage_Handler = Default_Handler
|
||||
#pragma weak BusFault_Handler = Default_Handler
|
||||
#pragma weak UsageFault_Handler = Default_Handler
|
||||
#pragma weak SecureFault_Handler = Default_Handler
|
||||
#pragma weak SVC_Handler = Default_Handler
|
||||
#pragma weak DebugMon_Handler = Default_Handler
|
||||
#pragma weak PendSV_Handler = Default_Handler
|
||||
#pragma weak SysTick_Handler = Default_Handler
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#define WEAK_REF_ATTRIBUTE __attribute__((weak, alias("Default_Handler")))
|
||||
#endif
|
||||
|
||||
void NMI_Handler(void); // NMI has many sources and is handled by BSP
|
||||
void HardFault_Handler(void) WEAK_REF_ATTRIBUTE;
|
||||
void MemManage_Handler(void) WEAK_REF_ATTRIBUTE;
|
||||
void BusFault_Handler(void) WEAK_REF_ATTRIBUTE;
|
||||
void UsageFault_Handler(void) WEAK_REF_ATTRIBUTE;
|
||||
void SecureFault_Handler(void) WEAK_REF_ATTRIBUTE;
|
||||
void SVC_Handler(void) WEAK_REF_ATTRIBUTE;
|
||||
void DebugMon_Handler(void) WEAK_REF_ATTRIBUTE;
|
||||
void PendSV_Handler(void) WEAK_REF_ATTRIBUTE;
|
||||
void SysTick_Handler(void) WEAK_REF_ATTRIBUTE;
|
||||
|
||||
/* Vector table. */
|
||||
BSP_DONT_REMOVE const exc_ptr_t __Vectors[BSP_CORTEX_VECTOR_TABLE_ENTRIES] BSP_PLACE_IN_SECTION(
|
||||
BSP_SECTION_FIXED_VECTORS) =
|
||||
{
|
||||
(exc_ptr_t) (&g_main_stack[0] + BSP_CFG_STACK_MAIN_BYTES), /* Initial Stack Pointer */
|
||||
Reset_Handler, /* Reset Handler */
|
||||
NMI_Handler, /* NMI Handler */
|
||||
HardFault_Handler, /* Hard Fault Handler */
|
||||
MemManage_Handler, /* MPU Fault Handler */
|
||||
BusFault_Handler, /* Bus Fault Handler */
|
||||
UsageFault_Handler, /* Usage Fault Handler */
|
||||
SecureFault_Handler, /* Secure Fault Handler */
|
||||
0, /* Reserved */
|
||||
0, /* Reserved */
|
||||
0, /* Reserved */
|
||||
SVC_Handler, /* SVCall Handler */
|
||||
DebugMon_Handler, /* Debug Monitor Handler */
|
||||
0, /* Reserved */
|
||||
PendSV_Handler, /* PendSV Handler */
|
||||
SysTick_Handler, /* SysTick Handler */
|
||||
};
|
||||
|
||||
/** @} (end addtogroup BSP_MCU) */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,50 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** @} (end addtogroup BSP_MCU) */
|
||||
|
||||
#ifndef BSP_ARM_EXCEPTIONS_H
|
||||
#define BSP_ARM_EXCEPTIONS_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/* This list includes only Arm standard exceptions. Renesas interrupts are defined in vector_data.h. */
|
||||
typedef enum IRQn
|
||||
{
|
||||
Reset_IRQn = -15, /* 1 Reset Vector invoked on Power up and warm reset */
|
||||
NonMaskableInt_IRQn = -14, /* 2 Non maskable Interrupt cannot be stopped or preempted */
|
||||
HardFault_IRQn = -13, /* 3 Hard Fault all classes of Fault */
|
||||
MemoryManagement_IRQn = -12, /* 4 Memory Management MPU mismatch, including Access Violation and No Match */
|
||||
BusFault_IRQn = -11, /* 5 Bus Fault Pre-Fetch-, Memory Access, other address/memory Fault */
|
||||
UsageFault_IRQn = -10, /* 6 Usage Fault i.e. Undef Instruction, Illegal State Transition */
|
||||
SecureFault_IRQn = -9, /* 7 Secure Fault Interrupt */
|
||||
SVCall_IRQn = -5, /* 11 System Service Call via SVC instruction */
|
||||
DebugMonitor_IRQn = -4, /* 12 Debug Monitor */
|
||||
PendSV_IRQn = -2, /* 14 Pendable request for system service */
|
||||
SysTick_IRQn = -1, /* 15 System Tick Timer */
|
||||
} IRQn_Type;
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,195 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Includes
|
||||
**********************************************************************************************************************/
|
||||
#include "bsp_api.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
#if defined(__ICCARM__)
|
||||
#define WEAK_ERROR_ATTRIBUTE
|
||||
#define WEAK_INIT_ATTRIBUTE
|
||||
#pragma weak fsp_error_log = fsp_error_log_internal
|
||||
#pragma weak bsp_init = bsp_init_internal
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#define WEAK_ERROR_ATTRIBUTE __attribute__((weak, alias("fsp_error_log_internal")))
|
||||
|
||||
#define WEAK_INIT_ATTRIBUTE __attribute__((weak, alias("bsp_init_internal")))
|
||||
#endif
|
||||
|
||||
#define FSP_SECTION_VERSION ".version"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private function prototypes
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** Prototype of initialization function called before main. This prototype sets the weak association of this
|
||||
* function to an internal example implementation. If this function is defined in the application code, the
|
||||
* application code version is used. */
|
||||
|
||||
void bsp_init(void * p_args) WEAK_INIT_ATTRIBUTE;
|
||||
|
||||
void bsp_init_internal(void * p_args); /// Default initialization function
|
||||
|
||||
#if ((1 == BSP_CFG_ERROR_LOG) || (1 == BSP_CFG_ASSERT))
|
||||
|
||||
/** Prototype of function called before errors are returned in FSP code if BSP_CFG_ERROR_LOG is set to 1. This
|
||||
* prototype sets the weak association of this function to an internal example implementation. */
|
||||
|
||||
void fsp_error_log(fsp_err_t err, const char * file, int32_t line) WEAK_ERROR_ATTRIBUTE;
|
||||
|
||||
void fsp_error_log_internal(fsp_err_t err, const char * file, int32_t line); /// Default error logger function
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/* FSP pack version structure. */
|
||||
static BSP_DONT_REMOVE const fsp_pack_version_t g_fsp_version BSP_PLACE_IN_SECTION (FSP_SECTION_VERSION) =
|
||||
{
|
||||
.minor = FSP_VERSION_MINOR,
|
||||
.major = FSP_VERSION_MAJOR,
|
||||
.build = FSP_VERSION_BUILD,
|
||||
.patch = FSP_VERSION_PATCH
|
||||
};
|
||||
|
||||
/* Public FSP version name. */
|
||||
static BSP_DONT_REMOVE const uint8_t g_fsp_version_string[] BSP_PLACE_IN_SECTION(FSP_SECTION_VERSION) =
|
||||
FSP_VERSION_STRING;
|
||||
|
||||
/* Unique FSP version ID. */
|
||||
static BSP_DONT_REMOVE const uint8_t g_fsp_version_build_string[] BSP_PLACE_IN_SECTION(FSP_SECTION_VERSION) =
|
||||
FSP_VERSION_BUILD_STRING;
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private global variables and functions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Get the FSP version based on compile time macros.
|
||||
*
|
||||
* @param[out] p_version Memory address to return version information to.
|
||||
*
|
||||
* @retval FSP_SUCCESS Version information stored.
|
||||
* @retval FSP_ERR_ASSERTION The parameter p_version is NULL.
|
||||
**********************************************************************************************************************/
|
||||
fsp_err_t R_FSP_VersionGet (fsp_pack_version_t * const p_version)
|
||||
{
|
||||
#if BSP_CFG_PARAM_CHECKING_ENABLE
|
||||
|
||||
/** Verify parameters are valid */
|
||||
FSP_ASSERT(NULL != p_version);
|
||||
#endif
|
||||
|
||||
*p_version = g_fsp_version;
|
||||
|
||||
return FSP_SUCCESS;
|
||||
}
|
||||
|
||||
#if ((1 == BSP_CFG_ERROR_LOG) || (1 == BSP_CFG_ASSERT))
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Default error logger function, used only if fsp_error_log is not defined in the user application.
|
||||
*
|
||||
* @param[in] err The error code encountered.
|
||||
* @param[in] file The file name in which the error code was encountered.
|
||||
* @param[in] line The line number at which the error code was encountered.
|
||||
**********************************************************************************************************************/
|
||||
void fsp_error_log_internal (fsp_err_t err, const char * file, int32_t line)
|
||||
{
|
||||
/** Do nothing. Do not generate any 'unused' warnings. */
|
||||
FSP_PARAMETER_NOT_USED(err);
|
||||
FSP_PARAMETER_NOT_USED(file);
|
||||
FSP_PARAMETER_NOT_USED(line);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/** @} (end addtogroup BSP_MCU) */
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Default initialization function, used only if bsp_init is not defined in the user application.
|
||||
**********************************************************************************************************************/
|
||||
void bsp_init_internal (void * p_args)
|
||||
{
|
||||
/* Do nothing. */
|
||||
FSP_PARAMETER_NOT_USED(p_args);
|
||||
}
|
||||
|
||||
#if defined(__ARMCC_VERSION)
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Default implementation of assert for AC6.
|
||||
**********************************************************************************************************************/
|
||||
__attribute__((weak, noreturn))
|
||||
void __aeabi_assert (const char * expr, const char * file, int line)
|
||||
{
|
||||
FSP_PARAMETER_NOT_USED(expr);
|
||||
FSP_PARAMETER_NOT_USED(file);
|
||||
FSP_PARAMETER_NOT_USED(line);
|
||||
__BKPT(0);
|
||||
while (1)
|
||||
{
|
||||
/* Do nothing. */
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
/* The default assert implementation for GCC brings in printing/formatting code. FSP overrides the default assert
|
||||
* behavior to reduce code size. */
|
||||
|
||||
#if !BSP_CFG_USE_STANDARD_ASSERT
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Default implementation of assert for GCC.
|
||||
**********************************************************************************************************************/
|
||||
BSP_WEAK_REFERENCE void __assert_func (const char * file, int line, const char * func, const char * expr)
|
||||
{
|
||||
FSP_PARAMETER_NOT_USED(file);
|
||||
FSP_PARAMETER_NOT_USED(line);
|
||||
FSP_PARAMETER_NOT_USED(func);
|
||||
FSP_PARAMETER_NOT_USED(expr);
|
||||
__BKPT(0);
|
||||
while (1)
|
||||
{
|
||||
/* Do nothing. */
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,104 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef BSP_COMPILER_SUPPORT_H
|
||||
#define BSP_COMPILER_SUPPORT_H
|
||||
|
||||
#if (defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3))
|
||||
#include "arm_cmse.h"
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
#if defined(__ARMCC_VERSION) /* AC6 compiler */
|
||||
|
||||
/* The AC6 linker requires uninitialized code to be placed in a section that starts with ".bss." Without this, load
|
||||
* memory (ROM) is reserved unnecessarily. */
|
||||
#define BSP_UNINIT_SECTION_PREFIX ".bss"
|
||||
#define BSP_SECTION_HEAP BSP_UNINIT_SECTION_PREFIX ".heap"
|
||||
#define BSP_DONT_REMOVE
|
||||
#define BSP_ATTRIBUTE_STACKLESS __attribute__((naked))
|
||||
#define BSP_FORCE_INLINE __attribute__((always_inline))
|
||||
#elif defined(__GNUC__) /* GCC compiler */
|
||||
#define BSP_UNINIT_SECTION_PREFIX
|
||||
#define BSP_SECTION_HEAP ".heap"
|
||||
#define BSP_DONT_REMOVE
|
||||
#define BSP_ATTRIBUTE_STACKLESS __attribute__((naked))
|
||||
#define BSP_FORCE_INLINE __attribute__((always_inline))
|
||||
#elif defined(__ICCARM__) /* IAR compiler */
|
||||
#define BSP_UNINIT_SECTION_PREFIX
|
||||
#define BSP_SECTION_HEAP "HEAP"
|
||||
#define BSP_DONT_REMOVE __root
|
||||
#define BSP_ATTRIBUTE_STACKLESS __stackless
|
||||
#define BSP_FORCE_INLINE _Pragma("inline=forced")
|
||||
#endif
|
||||
|
||||
#define BSP_SECTION_STACK BSP_UNINIT_SECTION_PREFIX ".stack"
|
||||
#define BSP_SECTION_NOINIT BSP_UNINIT_SECTION_PREFIX ".noinit"
|
||||
#define BSP_SECTION_FIXED_VECTORS ".fixed_vectors"
|
||||
#define BSP_SECTION_APPLICATION_VECTORS ".application_vectors"
|
||||
#define BSP_SECTION_ROM_REGISTERS ".rom_registers"
|
||||
#define BSP_SECTION_ID_CODE ".id_code"
|
||||
|
||||
/* Compiler neutral macros. */
|
||||
#define BSP_PLACE_IN_SECTION(x) __attribute__((section(x))) __attribute__((__used__))
|
||||
|
||||
#define BSP_ALIGN_VARIABLE(x) __attribute__((aligned(x)))
|
||||
|
||||
#define BSP_PACKED __attribute__((aligned(1))) // DEPRECATED
|
||||
|
||||
#define BSP_WEAK_REFERENCE __attribute__((weak))
|
||||
|
||||
/** Stacks (and heap) must be sized and aligned to an integer multiple of this number. */
|
||||
#define BSP_STACK_ALIGNMENT (8)
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* TrustZone definitions
|
||||
**********************************************************************************************************************/
|
||||
#if (defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3)) && !defined(__clang_analyzer__)
|
||||
#if defined(__ICCARM__) /* IAR compiler */
|
||||
#define BSP_CMSE_NONSECURE_CALL __cmse_nonsecure_call
|
||||
#define BSP_CMSE_NONSECURE_ENTRY __cmse_nonsecure_entry
|
||||
#else
|
||||
#define BSP_CMSE_NONSECURE_CALL __attribute__((cmse_nonsecure_call))
|
||||
#define BSP_CMSE_NONSECURE_ENTRY __attribute__((cmse_nonsecure_entry))
|
||||
#endif
|
||||
#else
|
||||
#define BSP_CMSE_NONSECURE_CALL
|
||||
#define BSP_CMSE_NONSECURE_ENTRY
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global functions (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** @} (end of addtogroup BSP_MCU) */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,182 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes <System Includes> , "Project Includes"
|
||||
**********************************************************************************************************************/
|
||||
#include "bsp_api.h"
|
||||
#include "bsp_delay.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
#define BSP_DELAY_NS_PER_SECOND (1000000000)
|
||||
#define BSP_DELAY_NS_PER_US (1000)
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private function prototypes
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private global variables and functions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Delay for at least the specified duration in units and return.
|
||||
* @param[in] delay The number of 'units' to delay.
|
||||
* @param[in] units The 'base' (bsp_delay_units_t) for the units specified. Valid values are:
|
||||
* BSP_DELAY_UNITS_SECONDS, BSP_DELAY_UNITS_MILLISECONDS, BSP_DELAY_UNITS_MICROSECONDS.@n
|
||||
* For example:@n
|
||||
* At 1 MHz one cycle takes 1 microsecond (.000001 seconds).@n
|
||||
* At 12 MHz one cycle takes 1/12 microsecond or 83 nanoseconds.@n
|
||||
* Therefore one run through bsp_prv_software_delay_loop() takes:
|
||||
* ~ (83 * BSP_DELAY_LOOP_CYCLES) or 332 ns.
|
||||
* A delay of 2 us therefore requires 2000ns/332ns or 6 loops.
|
||||
*
|
||||
* The 'theoretical' maximum delay that may be obtained is determined by a full 32 bit loop count and the system clock rate.
|
||||
* @120MHz: ((0xFFFFFFFF loops * 4 cycles /loop) / 120000000) = 143 seconds.
|
||||
* @32MHz: ((0xFFFFFFFF loops * 4 cycles /loop) / 32000000) = 536 seconds
|
||||
*
|
||||
* Note that requests for very large delays will be affected by rounding in the calculations and the actual delay
|
||||
* achieved may be slightly longer. @32 MHz, for example, a request for 532 seconds will be closer to 536 seconds.
|
||||
*
|
||||
* Note also that if the calculations result in a loop_cnt of zero, the bsp_prv_software_delay_loop() function is not called
|
||||
* at all. In this case the requested delay is too small (nanoseconds) to be carried out by the loop itself, and the
|
||||
* overhead associated with executing the code to just get to this point has certainly satisfied the requested delay.
|
||||
*
|
||||
* @note This function calls bsp_cpu_clock_get() which ultimately calls R_CGC_SystemClockFreqGet() and therefore requires
|
||||
* that the BSP has already initialized the CGC (which it does as part of the Sysinit).
|
||||
* Care should be taken to ensure this remains the case if in the future this function were to be called as part
|
||||
* of the BSP initialization.
|
||||
*
|
||||
* @note This function will delay for **at least** the specified duration. Due to overhead in calculating the correct number
|
||||
* of loops to delay, very small delay values (generally 1-5 microseconds) may be significantly longer than specified.
|
||||
* Approximate overhead for this function is as follows:
|
||||
* - CM4: 20-50 cycles
|
||||
* - CM33: 10-60 cycles
|
||||
* - CM23: 75-200 cycles
|
||||
*
|
||||
* @note If more accurate microsecond timing must be performed in software it is recommended to use
|
||||
* bsp_prv_software_delay_loop() directly. In this case, use BSP_DELAY_LOOP_CYCLES or BSP_DELAY_LOOPS_CALCULATE()
|
||||
* to convert a calculated delay cycle count to a number of software delay loops.
|
||||
*
|
||||
* @note Delays may be longer than expected when compiler optimization is turned off.
|
||||
*
|
||||
* @warning The delay will be longer than specified on CM23 devices when the core clock is greater than 32 MHz. Setting
|
||||
* BSP_DELAY_LOOP_CYCLES to 6 will improve accuracy at 48 MHz but will result in shorter than expected delays
|
||||
* at lower speeds.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
void R_BSP_SoftwareDelay (uint32_t delay, bsp_delay_units_t units)
|
||||
{
|
||||
uint32_t iclk_hz;
|
||||
uint32_t cycles_requested;
|
||||
uint32_t ns_per_cycle;
|
||||
uint32_t loops_required = 0;
|
||||
uint32_t total_us = (delay * units); /** Convert the requested time to microseconds. */
|
||||
uint64_t ns_64bits;
|
||||
|
||||
iclk_hz = SystemCoreClock; /** Get the system clock frequency in Hz. */
|
||||
|
||||
/* Running on the Sub-clock (32768 Hz) there are 30517 ns/cycle. This means one cycle takes 31 us. One execution
|
||||
* loop of the delay_loop takes 6 cycles which at 32768 Hz is 180 us. That does not include the overhead below prior to even getting
|
||||
* to the delay loop. Given this, at this frequency anything less then a delay request of 122 us will not even generate a single
|
||||
* pass through the delay loop. For this reason small delays (<=~200 us) at this slow clock rate will not be possible and such a request
|
||||
* will generate a minimum delay of ~200 us.*/
|
||||
ns_per_cycle = BSP_DELAY_NS_PER_SECOND / iclk_hz; /** Get the # of nanoseconds/cycle. */
|
||||
|
||||
/* We want to get the time in total nanoseconds but need to be conscious of overflowing 32 bits. We also do not want to do 64 bit */
|
||||
/* division as that pulls in a division library. */
|
||||
ns_64bits = (uint64_t) total_us * (uint64_t) BSP_DELAY_NS_PER_US; // Convert to ns.
|
||||
|
||||
/* Have we overflowed 32 bits? */
|
||||
if (ns_64bits <= UINT32_MAX)
|
||||
{
|
||||
/* No, we will not overflow. */
|
||||
cycles_requested = ((uint32_t) ns_64bits / ns_per_cycle);
|
||||
loops_required = cycles_requested / BSP_DELAY_LOOP_CYCLES;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We did overflow. Try dividing down first. */
|
||||
total_us = (total_us / (ns_per_cycle * BSP_DELAY_LOOP_CYCLES));
|
||||
ns_64bits = (uint64_t) total_us * (uint64_t) BSP_DELAY_NS_PER_US; // Convert to ns.
|
||||
|
||||
/* Have we overflowed 32 bits? */
|
||||
if (ns_64bits <= UINT32_MAX)
|
||||
{
|
||||
/* No, we will not overflow. */
|
||||
loops_required = (uint32_t) ns_64bits;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We still overflowed, use the max count for cycles */
|
||||
loops_required = UINT32_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
/** Only delay if the supplied parameters constitute a delay. */
|
||||
if (loops_required > (uint32_t) 0)
|
||||
{
|
||||
bsp_prv_software_delay_loop(loops_required);
|
||||
}
|
||||
}
|
||||
|
||||
/** @} (end addtogroup BSP_MCU) */
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* This assembly language routine takes roughly 4 cycles per loop. 2 additional cycles
|
||||
* occur when the loop exits. The 'naked' attribute indicates that the specified function does not need
|
||||
* prologue/epilogue sequences generated by the compiler.
|
||||
* @param[in] loop_cnt The number of loops to iterate.
|
||||
**********************************************************************************************************************/
|
||||
BSP_ATTRIBUTE_STACKLESS void bsp_prv_software_delay_loop (__attribute__((unused)) uint32_t loop_cnt)
|
||||
{
|
||||
__asm volatile ("sw_delay_loop: \n"
|
||||
|
||||
#if defined(__ICCARM__) || defined(__ARMCC_VERSION)
|
||||
" subs r0, #1 \n" ///< 1 cycle
|
||||
#elif defined(__GNUC__)
|
||||
" sub r0, r0, #1 \n" ///< 1 cycle
|
||||
#endif
|
||||
|
||||
" cmp r0, #0 \n" ///< 1 cycle
|
||||
|
||||
/* CM0 and CM23 have a different instruction set */
|
||||
#if defined(__CORE_CM0PLUS_H_GENERIC) || defined(__CORE_CM23_H_GENERIC)
|
||||
" bne sw_delay_loop \n" ///< 2 cycles
|
||||
#else
|
||||
" bne.n sw_delay_loop \n" ///< 2 cycles
|
||||
#endif
|
||||
" bx lr \n"); ///< 2 cycles
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef BSP_DELAY_H
|
||||
#define BSP_DELAY_H
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes <System Includes> , "Project Includes"
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
|
||||
FSP_HEADER
|
||||
|
||||
#include "bsp_compiler_support.h"
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/* The number of cycles required per software delay loop. */
|
||||
#ifndef BSP_DELAY_LOOP_CYCLES
|
||||
#define BSP_DELAY_LOOP_CYCLES (4)
|
||||
#endif
|
||||
|
||||
/* Calculates the number of delay loops to pass to bsp_prv_software_delay_loop to achieve at least the requested cycle
|
||||
* count delay. This is 1 loop longer than optimal if cycles is a multiple of BSP_DELAY_LOOP_CYCLES, but it ensures
|
||||
* the requested number of loops is at least 1 since bsp_prv_software_delay_loop cannot be called with a loop count
|
||||
* of 0. */
|
||||
#define BSP_DELAY_LOOPS_CALCULATE(cycles) (((cycles) / BSP_DELAY_LOOP_CYCLES) + 1U)
|
||||
|
||||
/** Available delay units for R_BSP_SoftwareDelay(). These are ultimately used to calculate a total # of microseconds */
|
||||
typedef enum
|
||||
{
|
||||
BSP_DELAY_UNITS_SECONDS = 1000000, ///< Requested delay amount is in seconds
|
||||
BSP_DELAY_UNITS_MILLISECONDS = 1000, ///< Requested delay amount is in milliseconds
|
||||
BSP_DELAY_UNITS_MICROSECONDS = 1 ///< Requested delay amount is in microseconds
|
||||
} bsp_delay_units_t;
|
||||
|
||||
/** @} (end addtogroup BSP_MCU) */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global functions (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
BSP_ATTRIBUTE_STACKLESS void bsp_prv_software_delay_loop(uint32_t loop_cnt);
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
|
||||
FSP_FOOTER
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,121 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes <System Includes> , "Project Includes"
|
||||
**********************************************************************************************************************/
|
||||
#include "bsp_api.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
#define BSP_GRP_IRQ_TOTAL_ITEMS (16U)
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private global variables and functions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** This array holds callback functions. */
|
||||
bsp_grp_irq_cb_t g_bsp_group_irq_sources[BSP_GRP_IRQ_TOTAL_ITEMS] BSP_SECTION_EARLY_INIT;
|
||||
|
||||
void NMI_Handler(void);
|
||||
static void bsp_group_irq_call(bsp_grp_irq_t irq);
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Calls the callback function for an interrupt if a callback has been registered.
|
||||
*
|
||||
* @param[in] irq Which interrupt to check and possibly call.
|
||||
*
|
||||
* @retval FSP_SUCCESS Callback was called.
|
||||
* @retval FSP_ERR_INVALID_ARGUMENT No valid callback has been registered for this interrupt source.
|
||||
*
|
||||
* @warning This function is called from within an interrupt
|
||||
**********************************************************************************************************************/
|
||||
static void bsp_group_irq_call (bsp_grp_irq_t irq)
|
||||
{
|
||||
/** Check for valid callback */
|
||||
if (NULL != g_bsp_group_irq_sources[irq])
|
||||
{
|
||||
/** Callback has been found. Call it. */
|
||||
g_bsp_group_irq_sources[irq](irq);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
*
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Register a callback function for supported interrupts. If NULL is passed for the callback argument then any
|
||||
* previously registered callbacks are unregistered.
|
||||
*
|
||||
* @param[in] irq Interrupt for which to register a callback.
|
||||
* @param[in] p_callback Pointer to function to call when interrupt occurs.
|
||||
*
|
||||
* @retval FSP_SUCCESS Callback registered
|
||||
* @retval FSP_ERR_ASSERTION Callback pointer is NULL
|
||||
**********************************************************************************************************************/
|
||||
fsp_err_t R_BSP_GroupIrqWrite (bsp_grp_irq_t irq, void (* p_callback)(bsp_grp_irq_t irq))
|
||||
{
|
||||
#if BSP_CFG_PARAM_CHECKING_ENABLE
|
||||
|
||||
/* Check pointer for NULL value. */
|
||||
FSP_ASSERT(p_callback);
|
||||
#endif
|
||||
|
||||
/* Register callback. */
|
||||
g_bsp_group_irq_sources[irq] = p_callback;
|
||||
|
||||
return FSP_SUCCESS;
|
||||
}
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Non-maskable interrupt handler. This exception is defined by the BSP, unlike other system exceptions, because
|
||||
* there are many sources that map to the NMI exception.
|
||||
**********************************************************************************************************************/
|
||||
void NMI_Handler (void)
|
||||
{
|
||||
uint16_t nmisr = R_ICU->NMISR;
|
||||
|
||||
/* Loop over all NMI status flags */
|
||||
for (bsp_grp_irq_t irq = BSP_GRP_IRQ_IWDT_ERROR; irq <= BSP_GRP_IRQ_CACHE_PARITY; irq++)
|
||||
{
|
||||
/* If the current irq status register is set call the irq callback. */
|
||||
if (0U != (nmisr & (1U << irq)))
|
||||
{
|
||||
(void) bsp_group_irq_call(irq);
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear status flags that have been handled. */
|
||||
R_ICU->NMICLR = nmisr;
|
||||
}
|
||||
|
||||
/** @} (end addtogroup BSP_MCU) */
|
||||
@@ -0,0 +1,79 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef BSP_GROUP_IRQ_H
|
||||
#define BSP_GROUP_IRQ_H
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
|
||||
FSP_HEADER
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
*
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** Which interrupts can have callbacks registered. */
|
||||
typedef enum e_bsp_grp_irq
|
||||
{
|
||||
BSP_GRP_IRQ_IWDT_ERROR = 0, ///< IWDT underflow/refresh error has occurred
|
||||
BSP_GRP_IRQ_WDT_ERROR = 1, ///< WDT underflow/refresh error has occurred
|
||||
BSP_GRP_IRQ_LVD1 = 2, ///< Voltage monitoring 1 interrupt
|
||||
BSP_GRP_IRQ_LVD2 = 3, ///< Voltage monitoring 2 interrupt
|
||||
BSP_GRP_IRQ_VBATT = 4, ///< VBATT monitor interrupt
|
||||
BSP_GRP_IRQ_OSC_STOP_DETECT = 6, ///< Oscillation stop is detected
|
||||
BSP_GRP_IRQ_NMI_PIN = 7, ///< NMI Pin interrupt
|
||||
BSP_GRP_IRQ_RAM_PARITY = 8, ///< RAM Parity Error
|
||||
BSP_GRP_IRQ_RAM_ECC = 9, ///< RAM ECC Error
|
||||
BSP_GRP_IRQ_MPU_BUS_SLAVE = 10, ///< MPU Bus Slave Error
|
||||
BSP_GRP_IRQ_MPU_BUS_MASTER = 11, ///< MPU Bus Master Error
|
||||
BSP_GRP_IRQ_MPU_STACK = 12, ///< MPU Stack Error
|
||||
BSP_GRP_IRQ_TRUSTZONE = 13, ///< MPU Stack Error
|
||||
BSP_GRP_IRQ_CACHE_PARITY = 15, ///< MPU Stack Error
|
||||
} bsp_grp_irq_t;
|
||||
|
||||
/* Callback type. */
|
||||
typedef void (* bsp_grp_irq_cb_t)(bsp_grp_irq_t irq);
|
||||
|
||||
/** @} (end addtogroup BSP_MCU) */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global functions (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/* Public functions defined in bsp.h */
|
||||
void bsp_group_interrupt_open(void); // Used internally by BSP
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
|
||||
FSP_FOOTER
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,55 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#include "bsp_guard.h"
|
||||
|
||||
/* Only the secure project has nonsecure callable functions. */
|
||||
#if BSP_TZ_SECURE_BUILD
|
||||
|
||||
/* If the CGG Security Attribution is configured to secure access only. */
|
||||
#if BSP_TZ_CFG_CGFSAR != 0xFFFFFFFFU
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Set the callback used by the secure project to notify the nonsecure project when the clock settings have changed.
|
||||
*
|
||||
* @retval FSP_SUCCESS Callback set.
|
||||
* @retval FSP_ERR_ASSERTION An input parameter is invalid.
|
||||
**********************************************************************************************************************/
|
||||
BSP_CMSE_NONSECURE_ENTRY fsp_err_t R_BSP_ClockUpdateCallbackSet (bsp_clock_update_callback_t p_callback,
|
||||
bsp_clock_update_callback_args_t * p_callback_memory)
|
||||
{
|
||||
bsp_clock_update_callback_t p_callback_checked =
|
||||
(bsp_clock_update_callback_t) cmse_check_address_range((void *) p_callback, sizeof(void *), CMSE_AU_NONSECURE);
|
||||
|
||||
bsp_clock_update_callback_args_t * p_callback_memory_checked =
|
||||
(bsp_clock_update_callback_args_t *) cmse_check_address_range(p_callback_memory,
|
||||
sizeof(bsp_clock_update_callback_args_t),
|
||||
CMSE_AU_NONSECURE);
|
||||
FSP_ASSERT(p_callback == p_callback_checked);
|
||||
FSP_ASSERT(p_callback_memory == p_callback_memory_checked);
|
||||
|
||||
r_bsp_clock_update_callback_set(p_callback_checked, p_callback_memory_checked);
|
||||
|
||||
return FSP_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef BSP_GUARD_H
|
||||
#define BSP_GUARD_H
|
||||
|
||||
#include "bsp_api.h"
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
*
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
|
||||
FSP_HEADER
|
||||
|
||||
#if BSP_TZ_SECURE_BUILD || BSP_TZ_NONSECURE_BUILD
|
||||
BSP_CMSE_NONSECURE_ENTRY fsp_err_t R_BSP_ClockUpdateCallbackSet(bsp_clock_update_callback_t p_callback,
|
||||
bsp_clock_update_callback_args_t * p_callback_memory);
|
||||
|
||||
#endif
|
||||
|
||||
/** @} (end addtogroup BSP_MCU) */
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
|
||||
FSP_FOOTER
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,41 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes <System Includes> , "Project Includes"
|
||||
**********************************************************************************************************************/
|
||||
#include "bsp_api.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
volatile uint32_t g_protect_pfswe_counter BSP_SECTION_EARLY_INIT;
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private global variables and functions
|
||||
**********************************************************************************************************************/
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,112 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes <System Includes> , "Project Includes"
|
||||
**********************************************************************************************************************/
|
||||
#include "bsp_api.h"
|
||||
|
||||
/** ELC event definitions. */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
#define BSP_IRQ_UINT32_MAX (0xFFFFFFFFU)
|
||||
#define BSP_PRV_BITS_PER_WORD (32)
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/* This table is used to store the context in the ISR. */
|
||||
void * gp_renesas_isr_context[BSP_ICU_VECTOR_MAX_ENTRIES];
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private global variables and functions
|
||||
**********************************************************************************************************************/
|
||||
const bsp_interrupt_event_t g_interrupt_event_link_select[BSP_ICU_VECTOR_MAX_ENTRIES] BSP_WEAK_REFERENCE =
|
||||
{
|
||||
(bsp_interrupt_event_t) 0
|
||||
};
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
*
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** @} (end addtogroup BSP_MCU) */
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Using the vector table information section that has been built by the linker and placed into ROM in the
|
||||
* .vector_info. section, this function will initialize the ICU so that configured ELC events will trigger interrupts
|
||||
* in the NVIC.
|
||||
*
|
||||
**********************************************************************************************************************/
|
||||
void bsp_irq_cfg (void)
|
||||
{
|
||||
#if FSP_PRIV_TZ_USE_SECURE_REGS
|
||||
|
||||
/* Unprotect security registers. */
|
||||
R_BSP_RegisterProtectDisable(BSP_REG_PROTECT_SAR);
|
||||
|
||||
#if !BSP_TZ_SECURE_BUILD
|
||||
|
||||
/* Set the DMAC channels to secure access. */
|
||||
R_CPSCU->ICUSARC = ~R_CPSCU_ICUSARC_SADMACn_Msk;
|
||||
#endif
|
||||
|
||||
/* Place all vectors in non-secure state unless they are used in the secure project. */
|
||||
uint32_t interrupt_security_state[BSP_ICU_VECTOR_MAX_ENTRIES / BSP_PRV_BITS_PER_WORD];
|
||||
memset(&interrupt_security_state, UINT8_MAX, sizeof(interrupt_security_state));
|
||||
|
||||
for (uint32_t i = 0U; i < BSP_ICU_VECTOR_MAX_ENTRIES; i++)
|
||||
{
|
||||
if (0U != g_interrupt_event_link_select[i])
|
||||
{
|
||||
/* This is a secure vector. Clear the associated bit. */
|
||||
uint32_t index = i / BSP_PRV_BITS_PER_WORD;
|
||||
uint32_t bit = i % BSP_PRV_BITS_PER_WORD;
|
||||
interrupt_security_state[index] &= ~(1U << bit);
|
||||
}
|
||||
}
|
||||
|
||||
/* The Secure Attribute managed within the ARM CPU NVIC must match the security attribution of IELSEn
|
||||
* (Reference section 13.2.9 in the RA6M4 manual R01UH0890EJ0050). */
|
||||
uint32_t volatile * p_icusarg = &R_CPSCU->ICUSARG;
|
||||
for (uint32_t i = 0U; i < BSP_ICU_VECTOR_MAX_ENTRIES / BSP_PRV_BITS_PER_WORD; i++)
|
||||
{
|
||||
p_icusarg[i] = interrupt_security_state[i];
|
||||
NVIC->ITNS[i] = interrupt_security_state[i];
|
||||
}
|
||||
|
||||
/* Protect security registers. */
|
||||
R_BSP_RegisterProtectEnable(BSP_REG_PROTECT_SAR);
|
||||
#endif
|
||||
|
||||
for (uint32_t i = 0U; i < BSP_ICU_VECTOR_MAX_ENTRIES; i++)
|
||||
{
|
||||
R_ICU->IELSR[i] = (uint32_t) g_interrupt_event_link_select[i];
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,68 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef BSP_MCU_API_H
|
||||
#define BSP_MCU_API_H
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
|
||||
FSP_HEADER
|
||||
|
||||
typedef struct st_bsp_event_info
|
||||
{
|
||||
IRQn_Type irq;
|
||||
elc_event_t event;
|
||||
} bsp_event_info_t;
|
||||
|
||||
typedef enum e_bsp_clocks_octaclk_div
|
||||
{
|
||||
BSP_CLOCKS_OCTACLK_DIV_1 = 0, ///< Divide OCTA source clock by 1
|
||||
BSP_CLOCKS_OCTACLK_DIV_2, ///< Divide OCTA source clock by 2
|
||||
BSP_CLOCKS_OCTACLK_DIV_4, ///< Divide OCTA source clock by 4
|
||||
BSP_CLOCKS_OCTACLK_DIV_6, ///< Divide OCTA source clock by 6
|
||||
BSP_CLOCKS_OCTACLK_DIV_8 ///< Divide OCTA source clock by 8
|
||||
} bsp_clocks_octaclk_div_t;
|
||||
|
||||
typedef enum e_bsp_clocks_source
|
||||
{
|
||||
BSP_CLOCKS_CLOCK_HOCO = 0, ///< The high speed on chip oscillator.
|
||||
BSP_CLOCKS_CLOCK_MOCO, ///< The middle speed on chip oscillator.
|
||||
BSP_CLOCKS_CLOCK_LOCO, ///< The low speed on chip oscillator.
|
||||
BSP_CLOCKS_CLOCK_MAIN_OSC, ///< The main oscillator.
|
||||
BSP_CLOCKS_CLOCK_SUBCLOCK, ///< The subclock oscillator.
|
||||
BSP_CLOCKS_CLOCK_PLL, ///< The PLL oscillator.
|
||||
BSP_CLOCKS_CLOCK_PLL2, ///< The PLL2 oscillator.
|
||||
} bsp_clocks_source_t;
|
||||
|
||||
typedef struct st_bsp_octaclk_settings
|
||||
{
|
||||
bsp_clocks_source_t source_clock; ///< OCTACLK source clock
|
||||
bsp_clocks_octaclk_div_t divider; ///< OCTACLK divider
|
||||
} bsp_octaclk_settings_t;
|
||||
|
||||
void R_BSP_RegisterProtectEnable(bsp_reg_protect_t regs_to_protect);
|
||||
void R_BSP_RegisterProtectDisable(bsp_reg_protect_t regs_to_unprotect);
|
||||
fsp_err_t R_BSP_GroupIrqWrite(bsp_grp_irq_t irq, void (* p_callback)(bsp_grp_irq_t irq));
|
||||
void R_BSP_OctaclkUpdate(bsp_octaclk_settings_t * p_octaclk_setting);
|
||||
void R_BSP_SoftwareDelay(uint32_t delay, bsp_delay_units_t units);
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
|
||||
FSP_FOOTER
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,190 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef BSP_MODULE_H
|
||||
#define BSP_MODULE_H
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
|
||||
FSP_HEADER
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#if BSP_FEATURE_TZ_HAS_TRUSTZONE
|
||||
|
||||
/* MSTPCRA is located in R_MSTP for Star devices. */
|
||||
#define R_BSP_MSTPCRA (R_MSTP->MSTPCRA)
|
||||
#else
|
||||
|
||||
/* MSTPCRA is located in R_SYSTEM for W1D and Peaks devices. */
|
||||
#define R_BSP_MSTPCRA (R_SYSTEM->MSTPCRA)
|
||||
#endif
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Cancels the module stop state.
|
||||
*
|
||||
* @param ip fsp_ip_t enum value for the module to be stopped
|
||||
* @param channel The channel. Use channel 0 for modules without channels.
|
||||
**********************************************************************************************************************/
|
||||
#define R_BSP_MODULE_START(ip, channel) {FSP_CRITICAL_SECTION_DEFINE; \
|
||||
FSP_CRITICAL_SECTION_ENTER; \
|
||||
BSP_MSTP_REG_ ## ip(channel) &= ~BSP_MSTP_BIT_ ## ip(channel); \
|
||||
BSP_MSTP_REG_ ## ip(channel); \
|
||||
FSP_CRITICAL_SECTION_EXIT;}
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Enables the module stop state.
|
||||
*
|
||||
* @param ip fsp_ip_t enum value for the module to be stopped
|
||||
* @param channel The channel. Use channel 0 for modules without channels.
|
||||
**********************************************************************************************************************/
|
||||
#define R_BSP_MODULE_STOP(ip, channel) {FSP_CRITICAL_SECTION_DEFINE; \
|
||||
FSP_CRITICAL_SECTION_ENTER; \
|
||||
BSP_MSTP_REG_ ## ip(channel) |= BSP_MSTP_BIT_ ## ip(channel); \
|
||||
BSP_MSTP_REG_ ## ip(channel); \
|
||||
FSP_CRITICAL_SECTION_EXIT;}
|
||||
|
||||
/** @} (end addtogroup BSP_MCU) */
|
||||
|
||||
#if 0U == BSP_FEATURE_BSP_MSTP_HAS_MSTPCRE
|
||||
#define BSP_MSTP_REG_FSP_IP_GPT(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_GPT(channel) ((BSP_FEATURE_BSP_MSTP_GPT_MSTPD5_MAX_CH >= \
|
||||
channel) ? (1U << 5U) : (1U << 6U));
|
||||
#define BSP_MSTP_REG_FSP_IP_AGT(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_AGT(channel) (1U << (3U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_POEG(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_POEG(channel) (1U << (14U));
|
||||
#else
|
||||
#if (2U == BSP_FEATURE_ELC_VERSION)
|
||||
#define BSP_MSTP_REG_FSP_IP_GPT(channel) R_MSTP->MSTPCRE
|
||||
#define BSP_MSTP_BIT_FSP_IP_GPT(channel) (1U << 31);
|
||||
#define BSP_MSTP_REG_FSP_IP_AGT(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_AGT(channel) (1U << (3U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_KEY(channel) R_MSTP->MSTPCRE
|
||||
#define BSP_MSTP_BIT_FSP_IP_KEY(channel) (1U << 4U);
|
||||
#define BSP_MSTP_REG_FSP_IP_POEG(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_POEG(channel) (1U << (14U - channel));
|
||||
#else
|
||||
#define BSP_MSTP_REG_FSP_IP_GPT(channel) R_MSTP->MSTPCRE
|
||||
#define BSP_MSTP_BIT_FSP_IP_GPT(channel) (1U << (31 - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_AGT(channel) *((3U >= channel) ? &R_MSTP->MSTPCRD : &R_MSTP->MSTPCRE)
|
||||
#define BSP_MSTP_BIT_FSP_IP_AGT(channel) ((3U >= \
|
||||
channel) ? (1U << (3U - channel)) : (1U << (15U - (channel - 4U))));
|
||||
#define BSP_MSTP_REG_FSP_IP_KEY(channel) R_MSTP->MSTPCRE
|
||||
#define BSP_MSTP_BIT_FSP_IP_KEY(channel) (1U << (4U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_POEG(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_POEG(channel) (1U << (14U - channel));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BSP_MSTP_REG_FSP_IP_DMAC(channel) R_BSP_MSTPCRA
|
||||
#define BSP_MSTP_BIT_FSP_IP_DMAC(channel) (1U << (22U));
|
||||
#define BSP_MSTP_REG_FSP_IP_DTC(channel) R_BSP_MSTPCRA
|
||||
#define BSP_MSTP_BIT_FSP_IP_DTC(channel) (1U << (22U));
|
||||
#define BSP_MSTP_REG_FSP_IP_CAN(channel) R_MSTP->MSTPCRB
|
||||
#define BSP_MSTP_BIT_FSP_IP_CAN(channel) (1U << (2U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_CEC(channel) R_MSTP->MSTPCRB
|
||||
#define BSP_MSTP_BIT_FSP_IP_CEC(channel) (1U << (3U));
|
||||
#define BSP_MSTP_REG_FSP_IP_IRDA(channel) R_MSTP->MSTPCRB
|
||||
#define BSP_MSTP_BIT_FSP_IP_IRDA(channel) (1U << (5U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_QSPI(channel) R_MSTP->MSTPCRB
|
||||
#define BSP_MSTP_BIT_FSP_IP_QSPI(channel) (1U << (6U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_IIC(channel) R_MSTP->MSTPCRB
|
||||
#define BSP_MSTP_BIT_FSP_IP_IIC(channel) (1U << (9U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_USBFS(channel) R_MSTP->MSTPCRB
|
||||
#define BSP_MSTP_BIT_FSP_IP_USBFS(channel) (1U << (11U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_USBHS(channel) R_MSTP->MSTPCRB
|
||||
#define BSP_MSTP_BIT_FSP_IP_USBHS(channel) (1U << (12U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_EPTPC(channel) R_MSTP->MSTPCRB
|
||||
#define BSP_MSTP_BIT_FSP_IP_EPTPC(channel) (1U << (13U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_ETHER(channel) R_MSTP->MSTPCRB
|
||||
#define BSP_MSTP_BIT_FSP_IP_ETHER(channel) (1U << (15U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_OSPI(channel) R_MSTP->MSTPCRB
|
||||
#define BSP_MSTP_BIT_FSP_IP_OSPI(channel) (1U << (16U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_SPI(channel) R_MSTP->MSTPCRB
|
||||
#define BSP_MSTP_BIT_FSP_IP_SPI(channel) (1U << (19U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_SCI(channel) R_MSTP->MSTPCRB
|
||||
#define BSP_MSTP_BIT_FSP_IP_SCI(channel) (1U << (31U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_CAC(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_CAC(channel) (1U << (0U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_CRC(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_CRC(channel) (1U << (1U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_PDC(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_PDC(channel) (1U << (2U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_CTSU(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_CTSU(channel) (1U << (3U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_SLCDC(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_SLCDC(channel) (1U << (4U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_GLCDC(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_GLCDC(channel) (1U << (4U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_JPEG(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_JPEG(channel) (1U << (5U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_DRW(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_DRW(channel) (1U << (6U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_SSI(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_SSI(channel) (1U << (8U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_SRC(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_SRC(channel) (1U << (9U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_SDHIMMC(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_SDHIMMC(channel) (1U << (12U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_DOC(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_DOC(channel) (1U << (13U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_ELC(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_ELC(channel) (1U << (14U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_TFU(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_TFU(channel) (1U << (20U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_IIRFA(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_IIRFA(channel) (1U << (21U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_CANFD(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_CANFD(channel) (1U << (27U));
|
||||
#define BSP_MSTP_REG_FSP_IP_TRNG(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_TRNG(channel) (1U << (28U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_SCE(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_SCE(channel) (1U << (31U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_AES(channel) R_MSTP->MSTPCRC
|
||||
#define BSP_MSTP_BIT_FSP_IP_AES(channel) (1U << (31U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_ADC(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_ADC(channel) (1U << (16U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_SDADC(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_SDADC(channel) (1U << (17U - channel));
|
||||
#if (BSP_FEATURE_DAC_MAX_CHANNELS > 2U)
|
||||
#define BSP_MSTP_REG_FSP_IP_DAC(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_DAC(channel) (1U << (20U - channel));
|
||||
#else
|
||||
#define BSP_MSTP_REG_FSP_IP_DAC8(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_DAC8(channel) (1U << (19U));
|
||||
#define BSP_MSTP_REG_FSP_IP_DAC(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_DAC(channel) (1U << (20U));
|
||||
#endif
|
||||
#define BSP_MSTP_REG_FSP_IP_TSN(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_TSN(channel) (1U << (22U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_ACMPHS(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_ACMPHS(channel) (1U << (28U - channel));
|
||||
#define BSP_MSTP_REG_FSP_IP_ACMPLP(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_ACMPLP(channel) (1U << 29U);
|
||||
#define BSP_MSTP_REG_FSP_IP_OPAMP(channel) R_MSTP->MSTPCRD
|
||||
#define BSP_MSTP_BIT_FSP_IP_OPAMP(channel) (1U << (31U - channel));
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
|
||||
FSP_FOOTER
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,125 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes <System Includes> , "Project Includes"
|
||||
**********************************************************************************************************************/
|
||||
#include "bsp_api.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/* Key code for writing PRCR register. */
|
||||
#define BSP_PRV_PRCR_KEY (0xA500U)
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private global variables and functions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** Used for holding reference counters for protection bits. */
|
||||
volatile uint16_t g_protect_counters[4] BSP_SECTION_EARLY_INIT;
|
||||
|
||||
/** Masks for setting or clearing the PRCR register. Use -1 for size because PWPR in MPC is used differently. */
|
||||
static const uint16_t g_prcr_masks[] =
|
||||
{
|
||||
0x0001U, /* PRC0. */
|
||||
0x0002U, /* PRC1. */
|
||||
0x0008U, /* PRC3. */
|
||||
0x0010U, /* PRC4. */
|
||||
};
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
*
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Enable register protection. Registers that are protected cannot be written to. Register protection is
|
||||
* enabled by using the Protect Register (PRCR) and the MPC's Write-Protect Register (PWPR).
|
||||
*
|
||||
* @param[in] regs_to_protect Registers which have write protection enabled.
|
||||
**********************************************************************************************************************/
|
||||
void R_BSP_RegisterProtectEnable (bsp_reg_protect_t regs_to_protect)
|
||||
{
|
||||
/** Get/save the current state of interrupts */
|
||||
FSP_CRITICAL_SECTION_DEFINE;
|
||||
FSP_CRITICAL_SECTION_ENTER;
|
||||
|
||||
/* Is it safe to disable write access? */
|
||||
if (0U != g_protect_counters[regs_to_protect])
|
||||
{
|
||||
/* Decrement the protect counter */
|
||||
g_protect_counters[regs_to_protect]--;
|
||||
}
|
||||
|
||||
/* Is it safe to disable write access? */
|
||||
if (0U == g_protect_counters[regs_to_protect])
|
||||
{
|
||||
/** Enable protection using PRCR register. */
|
||||
|
||||
/** When writing to the PRCR register the upper 8-bits must be the correct key. Set lower bits to 0 to
|
||||
* disable writes. */
|
||||
R_SYSTEM->PRCR = ((R_SYSTEM->PRCR | BSP_PRV_PRCR_KEY) & (uint16_t) (~g_prcr_masks[regs_to_protect]));
|
||||
}
|
||||
|
||||
/** Restore the interrupt state */
|
||||
FSP_CRITICAL_SECTION_EXIT;
|
||||
}
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* Disable register protection. Registers that are protected cannot be written to. Register protection is
|
||||
* disabled by using the Protect Register (PRCR) and the MPC's Write-Protect Register (PWPR).
|
||||
*
|
||||
* @param[in] regs_to_unprotect Registers which have write protection disabled.
|
||||
**********************************************************************************************************************/
|
||||
void R_BSP_RegisterProtectDisable (bsp_reg_protect_t regs_to_unprotect)
|
||||
{
|
||||
/** Get/save the current state of interrupts */
|
||||
FSP_CRITICAL_SECTION_DEFINE;
|
||||
FSP_CRITICAL_SECTION_ENTER;
|
||||
|
||||
/* If this is first entry then disable protection. */
|
||||
if (0U == g_protect_counters[regs_to_unprotect])
|
||||
{
|
||||
/** Disable protection using PRCR register. */
|
||||
|
||||
/** When writing to the PRCR register the upper 8-bits must be the correct key. Set lower bits to 0 to
|
||||
* disable writes. */
|
||||
R_SYSTEM->PRCR = ((R_SYSTEM->PRCR | BSP_PRV_PRCR_KEY) | g_prcr_masks[regs_to_unprotect]);
|
||||
}
|
||||
|
||||
/** Increment the protect counter */
|
||||
g_protect_counters[regs_to_unprotect]++;
|
||||
|
||||
/** Restore the interrupt state */
|
||||
FSP_CRITICAL_SECTION_EXIT;
|
||||
}
|
||||
|
||||
/** @} (end addtogroup BSP_MCU) */
|
||||
@@ -0,0 +1,74 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef BSP_REGISTER_PROTECTION_H
|
||||
#define BSP_REGISTER_PROTECTION_H
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
|
||||
FSP_HEADER
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/** The different types of registers that can be protected. */
|
||||
typedef enum e_bsp_reg_protect
|
||||
{
|
||||
/** Enables writing to the registers related to the clock generation circuit. */
|
||||
BSP_REG_PROTECT_CGC = 0,
|
||||
|
||||
/** Enables writing to the registers related to operating modes, low power consumption, and battery backup
|
||||
* function. */
|
||||
BSP_REG_PROTECT_OM_LPC_BATT,
|
||||
|
||||
/** Enables writing to the registers related to the LVD: LVCMPCR, LVDLVLR, LVD1CR0, LVD1CR1, LVD1SR, LVD2CR0,
|
||||
* LVD2CR1, LVD2SR. */
|
||||
BSP_REG_PROTECT_LVD,
|
||||
|
||||
/** Enables writing to the registers related to the security function. */
|
||||
BSP_REG_PROTECT_SAR,
|
||||
} bsp_reg_protect_t;
|
||||
|
||||
/** @} (end addtogroup BSP_MCU) */
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global functions (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/* Public functions defined in bsp.h */
|
||||
void bsp_register_protect_open(void); // Used internally by BSP
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
|
||||
FSP_FOOTER
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,176 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes <System Includes> , "Project Includes"
|
||||
**********************************************************************************************************************/
|
||||
#include "bsp_api.h"
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
#define RA_NOT_DEFINED (0)
|
||||
|
||||
/** OR in the HOCO frequency setting from bsp_clock_cfg.h with the OFS1 setting from bsp_cfg.h. */
|
||||
#define BSP_ROM_REG_OFS1_SETTING \
|
||||
(((uint32_t) BSP_CFG_ROM_REG_OFS1 & BSP_FEATURE_BSP_OFS1_HOCOFRQ_MASK) | \
|
||||
((uint32_t) BSP_CFG_HOCO_FREQUENCY << BSP_FEATURE_BSP_OFS1_HOCOFRQ_OFFSET))
|
||||
|
||||
/** Build up SECMPUAC register based on MPU settings. */
|
||||
#define BSP_ROM_REG_MPU_CONTROL_SETTING \
|
||||
((0xFFFFFCF0U) | \
|
||||
((uint32_t) BSP_CFG_ROM_REG_MPU_PC0_ENABLE << 8) | \
|
||||
((uint32_t) BSP_CFG_ROM_REG_MPU_PC1_ENABLE << 9) | \
|
||||
((uint32_t) BSP_CFG_ROM_REG_MPU_REGION0_ENABLE) | \
|
||||
((uint32_t) BSP_CFG_ROM_REG_MPU_REGION1_ENABLE << 1) | \
|
||||
((uint32_t) BSP_CFG_ROM_REG_MPU_REGION2_ENABLE << 2) | \
|
||||
((uint32_t) BSP_CFG_ROM_REG_MPU_REGION3_ENABLE << 3))
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private global variables and functions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#if !BSP_CFG_BOOT_IMAGE
|
||||
|
||||
#if 33U != __CORTEX_M // NOLINT(readability-magic-numbers)
|
||||
|
||||
/** ROM registers defined here. Some have masks to make sure reserved bits are set appropriately. */
|
||||
BSP_DONT_REMOVE static const uint32_t g_bsp_rom_registers[] BSP_PLACE_IN_SECTION (BSP_SECTION_ROM_REGISTERS) =
|
||||
{
|
||||
(uint32_t) BSP_CFG_ROM_REG_OFS0,
|
||||
(uint32_t) BSP_ROM_REG_OFS1_SETTING,
|
||||
((uint32_t) BSP_CFG_ROM_REG_MPU_PC0_START & 0xFFFFFFFCU),
|
||||
((uint32_t) BSP_CFG_ROM_REG_MPU_PC0_END | 0x00000003U),
|
||||
((uint32_t) BSP_CFG_ROM_REG_MPU_PC1_START & 0xFFFFFFFCU),
|
||||
((uint32_t) BSP_CFG_ROM_REG_MPU_PC1_END | 0x00000003U),
|
||||
((uint32_t) BSP_CFG_ROM_REG_MPU_REGION0_START & BSP_FEATURE_BSP_MPU_REGION0_MASK & 0xFFFFFFFCU),
|
||||
(((uint32_t) BSP_CFG_ROM_REG_MPU_REGION0_END & BSP_FEATURE_BSP_MPU_REGION0_MASK) | 0x00000003U),
|
||||
((uint32_t) BSP_CFG_ROM_REG_MPU_REGION1_START & 0xFFFFFFFCU),
|
||||
((uint32_t) BSP_CFG_ROM_REG_MPU_REGION1_END | 0x00000003U),
|
||||
(((uint32_t) BSP_CFG_ROM_REG_MPU_REGION2_START & 0x407FFFFCU) | 0x40000000U),
|
||||
(((uint32_t) BSP_CFG_ROM_REG_MPU_REGION2_END & 0x407FFFFCU) | 0x40000003U),
|
||||
(((uint32_t) BSP_CFG_ROM_REG_MPU_REGION3_START & 0x407FFFFCU) | 0x40000000U),
|
||||
(((uint32_t) BSP_CFG_ROM_REG_MPU_REGION3_END & 0x407FFFFCU) | 0x40000003U),
|
||||
(uint32_t) BSP_ROM_REG_MPU_CONTROL_SETTING
|
||||
};
|
||||
|
||||
/** ID code definitions defined here. */
|
||||
BSP_DONT_REMOVE static const uint32_t g_bsp_id_codes[] BSP_PLACE_IN_SECTION (BSP_SECTION_ID_CODE) =
|
||||
{
|
||||
BSP_CFG_ID_CODE_LONG_1,
|
||||
#if BSP_FEATURE_BSP_OSIS_PADDING
|
||||
0xFFFFFFFFU,
|
||||
#endif
|
||||
BSP_CFG_ID_CODE_LONG_2,
|
||||
#if BSP_FEATURE_BSP_OSIS_PADDING
|
||||
0xFFFFFFFFU,
|
||||
#endif
|
||||
BSP_CFG_ID_CODE_LONG_3,
|
||||
#if BSP_FEATURE_BSP_OSIS_PADDING
|
||||
0xFFFFFFFFU,
|
||||
#endif
|
||||
BSP_CFG_ID_CODE_LONG_4
|
||||
};
|
||||
|
||||
#else /* CM33 parts */
|
||||
|
||||
#if !BSP_TZ_NONSECURE_BUILD
|
||||
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_ofs0") g_bsp_rom_ofs0 =
|
||||
BSP_CFG_ROM_REG_OFS0;
|
||||
|
||||
#if BSP_FEATURE_FLASH_HP_SUPPORTS_DUAL_BANK
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_dualsel") g_bsp_rom_dualsel =
|
||||
BSP_CFG_ROM_REG_DUALSEL;
|
||||
|
||||
#endif
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_sas") g_bsp_rom_sas =
|
||||
0xFFFFFFFF;
|
||||
|
||||
#else
|
||||
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_ofs1") g_bsp_rom_ofs1 =
|
||||
BSP_ROM_REG_OFS1_SETTING;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_banksel") g_bsp_rom_banksel =
|
||||
0xFFFFFFFF;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_bps0") g_bsp_rom_bps0 =
|
||||
BSP_CFG_ROM_REG_BPS0;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_bps1") g_bsp_rom_bps1 =
|
||||
BSP_CFG_ROM_REG_BPS1;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_bps2") g_bsp_rom_bps2 =
|
||||
BSP_CFG_ROM_REG_BPS2;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_pbps0") g_bsp_rom_pbps0 =
|
||||
BSP_CFG_ROM_REG_PBPS0;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_pbps1") g_bsp_rom_pbps1 =
|
||||
BSP_CFG_ROM_REG_PBPS1;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_pbps2") g_bsp_rom_pbps2 =
|
||||
BSP_CFG_ROM_REG_PBPS2;
|
||||
|
||||
#endif
|
||||
|
||||
#if !BSP_TZ_NONSECURE_BUILD
|
||||
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_ofs1_sec") g_bsp_rom_ofs1_sec =
|
||||
BSP_ROM_REG_OFS1_SETTING;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_banksel_sec") g_bsp_rom_banksel_sec =
|
||||
0xFFFFFFFF;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_bps_sec0") g_bsp_rom_bps_sec0 =
|
||||
BSP_CFG_ROM_REG_BPS0;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_bps_sec1") g_bsp_rom_bps_sec1 =
|
||||
BSP_CFG_ROM_REG_BPS1;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_bps_sec2") g_bsp_rom_bps_sec2 =
|
||||
BSP_CFG_ROM_REG_BPS2;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_pbps_sec0") g_bsp_rom_pbps_sec0 =
|
||||
BSP_CFG_ROM_REG_PBPS0;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_pbps_sec1") g_bsp_rom_pbps_sec1 =
|
||||
BSP_CFG_ROM_REG_PBPS1;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_pbps_sec2") g_bsp_rom_pbps_sec2 =
|
||||
BSP_CFG_ROM_REG_PBPS2;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_ofs1_sel") g_bsp_rom_ofs1_sel =
|
||||
BSP_CFG_ROM_REG_OFS1_SEL;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_banksel_sel") g_bsp_rom_banksel_sel =
|
||||
0xFFFFFFFF;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_bps_sel0") g_bsp_rom_bps_sel0 =
|
||||
BSP_CFG_ROM_REG_BPS_SEL0;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_bps_sel1") g_bsp_rom_bps_sel1 =
|
||||
BSP_CFG_ROM_REG_BPS_SEL1;
|
||||
BSP_DONT_REMOVE static const uint32_t BSP_PLACE_IN_SECTION(".option_setting_bps_sel2") g_bsp_rom_bps_sel2 =
|
||||
BSP_CFG_ROM_REG_BPS_SEL2;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} (end addtogroup BSP_MCU) */
|
||||
@@ -0,0 +1,106 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Includes <System Includes> , "Project Includes"
|
||||
**********************************************************************************************************************/
|
||||
#if defined(__GNUC__) && !defined(__ARMCC_VERSION)
|
||||
#include "bsp_api.h"
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private function prototypes
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
|
||||
caddr_t _sbrk(int incr);
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Private global variables and functions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* @addtogroup BSP_MCU
|
||||
* @{
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/*******************************************************************************************************************//**
|
||||
* FSP implementation of the standard library _sbrk() function.
|
||||
* @param[in] inc The number of bytes being asked for by malloc().
|
||||
*
|
||||
* @note This function overrides the _sbrk version that exists in the newlib library that is linked with.
|
||||
* That version improperly relies on the SP as part of it's allocation strategy. This is bad in general and
|
||||
* worse in an RTOS environment. This version insures that we allocate the byte pool requested by malloc()
|
||||
* only from our allocated HEAP area. Also note that newlib is pre-built and forces the pagesize used by
|
||||
* malloc() to be 4096. That requires that we have a HEAP of at least 4096 if we are to support malloc().
|
||||
* @retval Address of allocated area if successful, -1 otherwise.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
caddr_t _sbrk (int incr)
|
||||
{
|
||||
extern char _Heap_Begin __asm("__HeapBase"); ///< Defined by the linker.
|
||||
|
||||
extern char _Heap_Limit __asm("__HeapLimit"); ///< Defined by the linker.
|
||||
|
||||
uint32_t bytes = (uint32_t) incr;
|
||||
static char * current_heap_end = 0;
|
||||
char * current_block_address;
|
||||
|
||||
if (current_heap_end == 0)
|
||||
{
|
||||
current_heap_end = &_Heap_Begin;
|
||||
}
|
||||
|
||||
current_block_address = current_heap_end;
|
||||
|
||||
/* The returned address must be aligned to a word boundary to prevent hard faults on cores that do not support
|
||||
* unaligned access. We assume the heap starts on a word boundary and make sure all allocations are a multiple
|
||||
* of 4. */
|
||||
bytes = (bytes + 3U) & (~3U);
|
||||
if (current_heap_end + bytes > &_Heap_Limit)
|
||||
{
|
||||
/** Heap has overflowed */
|
||||
errno = ENOMEM;
|
||||
|
||||
return (caddr_t) -1;
|
||||
}
|
||||
|
||||
current_heap_end += bytes;
|
||||
|
||||
return (caddr_t) current_block_address;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/******************************************************************************************************************//**
|
||||
* @} (end addtogroup BSP_MCU)
|
||||
*********************************************************************************************************************/
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,47 @@
|
||||
/***********************************************************************************************************************
|
||||
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
|
||||
* of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized. Renesas products are
|
||||
* sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for the selection and use
|
||||
* of Renesas products and Renesas assumes no liability. No license, express or implied, to any intellectual property
|
||||
* right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
|
||||
* reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
|
||||
* IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
|
||||
* PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
|
||||
* DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH. TO THE MAXIMUM
|
||||
* EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
|
||||
* (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
|
||||
* WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
|
||||
* OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
|
||||
**********************************************************************************************************************/
|
||||
|
||||
#ifndef BSP_SECURITY_H
|
||||
#define BSP_SECURITY_H
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
|
||||
FSP_HEADER
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Macro definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Typedef definitions
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global variables
|
||||
**********************************************************************************************************************/
|
||||
|
||||
/***********************************************************************************************************************
|
||||
* Exported global functions (to be accessed by other files)
|
||||
**********************************************************************************************************************/
|
||||
void R_BSP_NonSecureEnter(void);
|
||||
|
||||
/** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
|
||||
FSP_FOOTER
|
||||
|
||||
#endif
|
||||
Loaded 100 of 133 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user