From ae71ecce13995a8f33fbdf3cabd0f711377810cf Mon Sep 17 00:00:00 2001 From: Frank Voorburg Date: Mon, 24 Apr 2017 10:59:23 +0000 Subject: [PATCH] Refs #288. Added XMC1400 Boot Kit Dave4/GCC demo programs. git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@216 5dc33758-31d5-4daf-9ae8-b24bf3d40d73 --- .../Boot/.cproject | 124 + .../Boot/.project | 70 + .../Boot/.settings/com.dave.mbs.xc800.prefs | 14 + .../Boot/.settings/language.settings.xml | 13 + .../Boot/.settings/org.eclipse.cdt.core.prefs | 163 + .../Boot/.settings/org.eclipse.cdt.ui.prefs | 3 + .../Boot/.settings/properties.index | 5 + .../Boot/Boot Debug.launch | 85 + .../Boot/Debug/openblt_xmc1400.elf | Bin 0 -> 171692 bytes .../Boot/Debug/openblt_xmc1400.srec | 461 + .../Libraries/CMSIS/Include/cmsis_compiler.h | 223 + .../Boot/Libraries/CMSIS/Include/cmsis_gcc.h | 1899 ++++ .../Boot/Libraries/CMSIS/Include/core_cm0.h | 875 ++ .../Include/XMC1000_RomFunctionTable.h | 176 + .../Infineon/XMC1400_series/Include/XMC1400.h | 8899 +++++++++++++++++ .../XMC1400_series/Include/system_XMC1400.h | 99 + .../Boot/Libraries/Newlib/syscalls.c | 100 + .../Boot/Libraries/XMCLib/inc/xmc1_ccu4_map.h | 3791 +++++++ .../Boot/Libraries/XMCLib/inc/xmc1_ccu8_map.h | 2267 +++++ .../Boot/Libraries/XMCLib/inc/xmc1_eru_map.h | 1894 ++++ .../Boot/Libraries/XMCLib/inc/xmc1_flash.h | 415 + .../Boot/Libraries/XMCLib/inc/xmc1_gpio.h | 305 + .../Boot/Libraries/XMCLib/inc/xmc1_gpio_map.h | 7063 +++++++++++++ .../Boot/Libraries/XMCLib/inc/xmc1_rtc.h | 108 + .../Boot/Libraries/XMCLib/inc/xmc1_scu.h | 1341 +++ .../Boot/Libraries/XMCLib/inc/xmc1_usic_map.h | 3598 +++++++ .../Boot/Libraries/XMCLib/inc/xmc_acmp.h | 424 + .../Boot/Libraries/XMCLib/inc/xmc_bccu.h | 1976 ++++ .../Boot/Libraries/XMCLib/inc/xmc_can.h | 2198 ++++ .../Boot/Libraries/XMCLib/inc/xmc_can_map.h | 629 ++ .../Boot/Libraries/XMCLib/inc/xmc_ccu4.h | 2386 +++++ .../Boot/Libraries/XMCLib/inc/xmc_ccu8.h | 2929 ++++++ .../Boot/Libraries/XMCLib/inc/xmc_common.h | 285 + .../Boot/Libraries/XMCLib/inc/xmc_device.h | 1514 +++ .../Boot/Libraries/XMCLib/inc/xmc_eru.h | 884 ++ .../Boot/Libraries/XMCLib/inc/xmc_flash.h | 276 + .../Boot/Libraries/XMCLib/inc/xmc_gpio.h | 478 + .../Boot/Libraries/XMCLib/inc/xmc_i2c.h | 782 ++ .../Boot/Libraries/XMCLib/inc/xmc_i2s.h | 837 ++ .../Boot/Libraries/XMCLib/inc/xmc_ledts.h | 1052 ++ .../Boot/Libraries/XMCLib/inc/xmc_math.h | 1088 ++ .../Boot/Libraries/XMCLib/inc/xmc_pau.h | 396 + .../Boot/Libraries/XMCLib/inc/xmc_posif.h | 1046 ++ .../Boot/Libraries/XMCLib/inc/xmc_prng.h | 285 + .../Boot/Libraries/XMCLib/inc/xmc_rtc.h | 683 ++ .../Boot/Libraries/XMCLib/inc/xmc_scu.h | 598 ++ .../Boot/Libraries/XMCLib/inc/xmc_spi.h | 1279 +++ .../Boot/Libraries/XMCLib/inc/xmc_uart.h | 810 ++ .../Boot/Libraries/XMCLib/inc/xmc_usic.h | 2089 ++++ .../Boot/Libraries/XMCLib/inc/xmc_vadc.h | 4962 +++++++++ .../Boot/Libraries/XMCLib/inc/xmc_vadc_map.h | 293 + .../Boot/Libraries/XMCLib/inc/xmc_wdt.h | 439 + .../Boot/Libraries/XMCLib/src/xmc1_eru.c | 63 + .../Boot/Libraries/XMCLib/src/xmc1_flash.c | 254 + .../Boot/Libraries/XMCLib/src/xmc1_gpio.c | 104 + .../Boot/Libraries/XMCLib/src/xmc1_rtc.c | 160 + .../Boot/Libraries/XMCLib/src/xmc1_scu.c | 946 ++ .../Boot/Libraries/XMCLib/src/xmc_acmp.c | 119 + .../Boot/Libraries/XMCLib/src/xmc_bccu.c | 577 ++ .../Boot/Libraries/XMCLib/src/xmc_can.c | 744 ++ .../Boot/Libraries/XMCLib/src/xmc_ccu4.c | 1136 +++ .../Boot/Libraries/XMCLib/src/xmc_ccu8.c | 1320 +++ .../Boot/Libraries/XMCLib/src/xmc_common.c | 219 + .../Boot/Libraries/XMCLib/src/xmc_eru.c | 295 + .../Boot/Libraries/XMCLib/src/xmc_gpio.c | 81 + .../Boot/Libraries/XMCLib/src/xmc_i2c.c | 402 + .../Boot/Libraries/XMCLib/src/xmc_i2s.c | 268 + .../Boot/Libraries/XMCLib/src/xmc_ledts.c | 383 + .../Boot/Libraries/XMCLib/src/xmc_math.c | 473 + .../Boot/Libraries/XMCLib/src/xmc_pau.c | 109 + .../Boot/Libraries/XMCLib/src/xmc_posif.c | 275 + .../Boot/Libraries/XMCLib/src/xmc_prng.c | 107 + .../Boot/Libraries/XMCLib/src/xmc_rtc.c | 298 + .../Boot/Libraries/XMCLib/src/xmc_spi.c | 279 + .../Boot/Libraries/XMCLib/src/xmc_uart.c | 216 + .../Boot/Libraries/XMCLib/src/xmc_usic.c | 373 + .../Boot/Libraries/XMCLib/src/xmc_vadc.c | 2121 ++++ .../Boot/Libraries/XMCLib/src/xmc_wdt.c | 94 + .../Boot/Startup/startup_XMC1400.S | 375 + .../Boot/Startup/system_XMC1400.c | 276 + .../Boot/blt_conf.h | 175 + .../Boot/boot.dox | 7 + .../Boot/hooks.c | 295 + .../Boot/led.c | 105 + .../Boot/led.h | 40 + .../Boot/main.c | 113 + .../Prog/.cproject | 112 + .../Prog/.project | 28 + .../Prog/.settings/com.dave.mbs.xc800.prefs | 14 + .../Prog/.settings/language.settings.xml | 13 + .../Prog/.settings/org.eclipse.cdt.core.prefs | 163 + .../Prog/.settings/org.eclipse.cdt.ui.prefs | 3 + .../Prog/.settings/properties.index | 5 + .../Prog/Debug/demoprog_xmc1400.elf | Bin 0 -> 130283 bytes .../Prog/Debug/demoprog_xmc1400.srec | 220 + .../Libraries/CMSIS/Include/cmsis_compiler.h | 223 + .../Prog/Libraries/CMSIS/Include/cmsis_gcc.h | 1899 ++++ .../Prog/Libraries/CMSIS/Include/core_cm0.h | 875 ++ .../Include/XMC1000_RomFunctionTable.h | 176 + .../Infineon/XMC1400_series/Include/XMC1400.h | 8899 +++++++++++++++++ .../XMC1400_series/Include/system_XMC1400.h | 99 + .../Prog/Libraries/Newlib/syscalls.c | 100 + .../Prog/Libraries/XMCLib/inc/xmc1_ccu4_map.h | 3791 +++++++ .../Prog/Libraries/XMCLib/inc/xmc1_ccu8_map.h | 2267 +++++ .../Prog/Libraries/XMCLib/inc/xmc1_eru_map.h | 1894 ++++ .../Prog/Libraries/XMCLib/inc/xmc1_flash.h | 415 + .../Prog/Libraries/XMCLib/inc/xmc1_gpio.h | 305 + .../Prog/Libraries/XMCLib/inc/xmc1_gpio_map.h | 7063 +++++++++++++ .../Prog/Libraries/XMCLib/inc/xmc1_rtc.h | 108 + .../Prog/Libraries/XMCLib/inc/xmc1_scu.h | 1341 +++ .../Prog/Libraries/XMCLib/inc/xmc1_usic_map.h | 3598 +++++++ .../Prog/Libraries/XMCLib/inc/xmc_acmp.h | 424 + .../Prog/Libraries/XMCLib/inc/xmc_bccu.h | 1976 ++++ .../Prog/Libraries/XMCLib/inc/xmc_can.h | 2198 ++++ .../Prog/Libraries/XMCLib/inc/xmc_can_map.h | 629 ++ .../Prog/Libraries/XMCLib/inc/xmc_ccu4.h | 2386 +++++ .../Prog/Libraries/XMCLib/inc/xmc_ccu8.h | 2929 ++++++ .../Prog/Libraries/XMCLib/inc/xmc_common.h | 285 + .../Prog/Libraries/XMCLib/inc/xmc_device.h | 1514 +++ .../Prog/Libraries/XMCLib/inc/xmc_eru.h | 884 ++ .../Prog/Libraries/XMCLib/inc/xmc_flash.h | 276 + .../Prog/Libraries/XMCLib/inc/xmc_gpio.h | 478 + .../Prog/Libraries/XMCLib/inc/xmc_i2c.h | 782 ++ .../Prog/Libraries/XMCLib/inc/xmc_i2s.h | 837 ++ .../Prog/Libraries/XMCLib/inc/xmc_ledts.h | 1052 ++ .../Prog/Libraries/XMCLib/inc/xmc_math.h | 1088 ++ .../Prog/Libraries/XMCLib/inc/xmc_pau.h | 396 + .../Prog/Libraries/XMCLib/inc/xmc_posif.h | 1046 ++ .../Prog/Libraries/XMCLib/inc/xmc_prng.h | 285 + .../Prog/Libraries/XMCLib/inc/xmc_rtc.h | 683 ++ .../Prog/Libraries/XMCLib/inc/xmc_scu.h | 598 ++ .../Prog/Libraries/XMCLib/inc/xmc_spi.h | 1279 +++ .../Prog/Libraries/XMCLib/inc/xmc_uart.h | 810 ++ .../Prog/Libraries/XMCLib/inc/xmc_usic.h | 2089 ++++ .../Prog/Libraries/XMCLib/inc/xmc_vadc.h | 4962 +++++++++ .../Prog/Libraries/XMCLib/inc/xmc_vadc_map.h | 293 + .../Prog/Libraries/XMCLib/inc/xmc_wdt.h | 439 + .../Prog/Libraries/XMCLib/src/xmc1_eru.c | 63 + .../Prog/Libraries/XMCLib/src/xmc1_flash.c | 254 + .../Prog/Libraries/XMCLib/src/xmc1_gpio.c | 104 + .../Prog/Libraries/XMCLib/src/xmc1_rtc.c | 160 + .../Prog/Libraries/XMCLib/src/xmc1_scu.c | 946 ++ .../Prog/Libraries/XMCLib/src/xmc_acmp.c | 119 + .../Prog/Libraries/XMCLib/src/xmc_bccu.c | 577 ++ .../Prog/Libraries/XMCLib/src/xmc_can.c | 744 ++ .../Prog/Libraries/XMCLib/src/xmc_ccu4.c | 1136 +++ .../Prog/Libraries/XMCLib/src/xmc_ccu8.c | 1320 +++ .../Prog/Libraries/XMCLib/src/xmc_common.c | 219 + .../Prog/Libraries/XMCLib/src/xmc_eru.c | 295 + .../Prog/Libraries/XMCLib/src/xmc_gpio.c | 81 + .../Prog/Libraries/XMCLib/src/xmc_i2c.c | 402 + .../Prog/Libraries/XMCLib/src/xmc_i2s.c | 268 + .../Prog/Libraries/XMCLib/src/xmc_ledts.c | 383 + .../Prog/Libraries/XMCLib/src/xmc_math.c | 473 + .../Prog/Libraries/XMCLib/src/xmc_pau.c | 109 + .../Prog/Libraries/XMCLib/src/xmc_posif.c | 275 + .../Prog/Libraries/XMCLib/src/xmc_prng.c | 107 + .../Prog/Libraries/XMCLib/src/xmc_rtc.c | 298 + .../Prog/Libraries/XMCLib/src/xmc_spi.c | 279 + .../Prog/Libraries/XMCLib/src/xmc_uart.c | 216 + .../Prog/Libraries/XMCLib/src/xmc_usic.c | 373 + .../Prog/Libraries/XMCLib/src/xmc_vadc.c | 2121 ++++ .../Prog/Libraries/XMCLib/src/xmc_wdt.c | 94 + .../Prog/Prog Debug.launch | 85 + .../Prog/Startup/startup_XMC1400.S | 380 + .../Prog/Startup/system_XMC1400.c | 276 + .../Prog/boot.c | 351 + .../Prog/boot.h | 40 + .../Prog/header.h | 42 + .../Prog/led.c | 95 + .../Prog/led.h | 39 + .../Prog/linker_script.ld | 295 + .../Prog/main.c | 80 + .../Prog/prog.dox | 7 + .../Prog/timer.c | 106 + .../Prog/timer.h | 40 + .../ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/demo.dox | 9 + Target/Source/ARMCM0_XMC1/GCC/cpu_comp.c | 58 + Target/Source/ARMCM0_XMC1/GCC/memory.x | 218 + Target/Source/ARMCM0_XMC1/cpu.c | 2 +- 180 files changed, 155178 insertions(+), 1 deletion(-) create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.cproject create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.project create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/com.dave.mbs.xc800.prefs create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/language.settings.xml create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/org.eclipse.cdt.core.prefs create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/org.eclipse.cdt.ui.prefs create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/properties.index create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Boot Debug.launch create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Debug/openblt_xmc1400.elf create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Debug/openblt_xmc1400.srec create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Include/cmsis_compiler.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Include/cmsis_gcc.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Include/core_cm0.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1000_RomFunctionTable.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1400.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Infineon/XMC1400_series/Include/system_XMC1400.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/Newlib/syscalls.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_ccu4_map.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_ccu8_map.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_eru_map.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_flash.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_gpio.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_gpio_map.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_rtc.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_scu.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_usic_map.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_acmp.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_bccu.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_can.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_can_map.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_ccu4.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_ccu8.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_common.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_device.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_eru.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_flash.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_gpio.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_i2c.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_i2s.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_ledts.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_math.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_pau.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_posif.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_prng.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_rtc.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_scu.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_spi.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_uart.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_usic.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_vadc.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_vadc_map.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_wdt.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_eru.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_flash.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_gpio.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_rtc.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_scu.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_acmp.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_bccu.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_can.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_ccu4.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_ccu8.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_common.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_eru.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_gpio.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_i2c.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_i2s.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_ledts.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_math.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_pau.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_posif.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_prng.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_rtc.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_spi.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_uart.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_usic.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_vadc.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_wdt.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Startup/startup_XMC1400.S create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Startup/system_XMC1400.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/blt_conf.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/boot.dox create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/hooks.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/led.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/led.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/main.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.cproject create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.project create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/com.dave.mbs.xc800.prefs create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/language.settings.xml create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/org.eclipse.cdt.core.prefs create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/org.eclipse.cdt.ui.prefs create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/properties.index create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Debug/demoprog_xmc1400.elf create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Debug/demoprog_xmc1400.srec create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Include/cmsis_compiler.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Include/cmsis_gcc.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Include/core_cm0.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1000_RomFunctionTable.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1400.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Infineon/XMC1400_series/Include/system_XMC1400.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/Newlib/syscalls.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_ccu4_map.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_ccu8_map.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_eru_map.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_flash.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_gpio.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_gpio_map.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_rtc.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_scu.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_usic_map.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_acmp.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_bccu.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_can.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_can_map.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_ccu4.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_ccu8.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_common.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_device.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_eru.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_flash.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_gpio.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_i2c.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_i2s.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_ledts.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_math.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_pau.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_posif.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_prng.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_rtc.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_scu.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_spi.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_uart.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_usic.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_vadc.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_vadc_map.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_wdt.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_eru.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_flash.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_gpio.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_rtc.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_scu.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_acmp.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_bccu.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_can.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_ccu4.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_ccu8.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_common.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_eru.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_gpio.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_i2c.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_i2s.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_ledts.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_math.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_pau.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_posif.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_prng.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_rtc.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_spi.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_uart.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_usic.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_vadc.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_wdt.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Prog Debug.launch create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Startup/startup_XMC1400.S create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Startup/system_XMC1400.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/boot.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/boot.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/header.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/led.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/led.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/linker_script.ld create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/main.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/prog.dox create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/timer.c create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/timer.h create mode 100644 Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/demo.dox create mode 100644 Target/Source/ARMCM0_XMC1/GCC/cpu_comp.c create mode 100644 Target/Source/ARMCM0_XMC1/GCC/memory.x diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.cproject b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.cproject new file mode 100644 index 00000000..76c11ed8 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.cproject @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.project b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.project new file mode 100644 index 00000000..8be002c6 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.project @@ -0,0 +1,70 @@ + + + Boot + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + com.ifx.xmc4000.xmc4000Nature + com.dave.common.daveBenchNature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + Core + 2 + OPENBLT_CORE + + + + + 1493026132950 + Core + 9 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-true-false-ARMCM0_XMC1 + + + + 1493026132953 + Core + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-true-false-IAR + + + + 1493026325722 + Core/ARMCM0_XMC1 + 9 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-true-false-GCC + + + + + + OPENBLT_CORE + $%7BPARENT-3-PROJECT_LOC%7D/Source + + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/com.dave.mbs.xc800.prefs b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/com.dave.mbs.xc800.prefs new file mode 100644 index 00000000..8ea29cc8 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/com.dave.mbs.xc800.prefs @@ -0,0 +1,14 @@ +ACTIVE_CONFIG_NAME=Debug +AppCompatibilitySet=1 +DEVICE_DESC=Package\= VQFN64 \nROM\= 200 KB Flash \nRAM\= 16 KB RAM \nInOut\= 34 digital I/O \nADC\= 12 ADC Channels, 12-bit, Analog-to-Digital Converter \nTimed_InOut\= 10 Timer, 20 CAPCOM channels \nSerial\= 2 USIC channels \nSHS\= 2 Sample and Hold Sequencer \nCOMP\= Comparator Control Unit \nPOSIF\= Position Interface Unit \nBCCU\= Brightness and Color Control Unit \nMATH\= MATH Coprocessor \n +DEVICE_NAME=XMC1404-Q064x0200 +DEVICE_PACKAGE=VQFN64 +DEVICE_PACK_VERSION=2.1.20 +DEVICE_PATH=/DeviceRoot/Microcontrollers/XMC1000/XMC1400 Series/XMC1404-Q064x0200 +FLASH_SIZE=200 +MBS_PROVIDER_ID_KEY=com.dave.mbs.xmc4000.xmc4000MbsFactory +SOFTWARE_ID=XMC1.4.04.Q064.ALL +TEMPLATE_KEY=com.ifx.xmc4000.appEmptyMainTemplate +USED_DAVE_VERSIONS=4.3.2 +eclipse.preferences.version=1 +minDaveVersion=4.3.2 diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/language.settings.xml b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/language.settings.xml new file mode 100644 index 00000000..0241cc73 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/language.settings.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/org.eclipse.cdt.core.prefs b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 00000000..d4995d0c --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,163 @@ +eclipse.preferences.version=1 +org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.cdt.core.formatter.alignment_for_assignment=16 +org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80 +org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.cdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34 +org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18 +org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0 +org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16 +org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48 +org.eclipse.cdt.core.formatter.alignment_for_expression_list=0 +org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.cdt.core.formatter.alignment_for_member_access=0 +org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16 +org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=next_line +org.eclipse.cdt.core.formatter.brace_position_for_block=next_line +org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=next_line +org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=next_line +org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=next_line +org.eclipse.cdt.core.formatter.brace_position_for_switch=next_line +org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=next_line +org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1 +org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true +org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true +org.eclipse.cdt.core.formatter.compact_else_if=true +org.eclipse.cdt.core.formatter.continuation_indentation=2 +org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false +org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0 +org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true +org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false +org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false +org.eclipse.cdt.core.formatter.indent_empty_lines=false +org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.cdt.core.formatter.indentation.size=2 +org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert +org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert +org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert +org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.cdt.core.formatter.join_wrapped_lines=true +org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.cdt.core.formatter.lineSplit=80 +org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.cdt.core.formatter.tabulation.char=space +org.eclipse.cdt.core.formatter.tabulation.size=2 +org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/org.eclipse.cdt.ui.prefs b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/org.eclipse.cdt.ui.prefs new file mode 100644 index 00000000..7da732ea --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/org.eclipse.cdt.ui.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +formatter_profile=_Feaser +formatter_settings_version=1 diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/properties.index b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/properties.index new file mode 100644 index 00000000..d2d2e7c3 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/.settings/properties.index @@ -0,0 +1,5 @@ + + +
+
+ \ No newline at end of file diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Boot Debug.launch b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Boot Debug.launch new file mode 100644 index 00000000..3d0a16c6 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Boot Debug.launch @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Debug/openblt_xmc1400.elf b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Debug/openblt_xmc1400.elf new file mode 100644 index 0000000000000000000000000000000000000000..0c5674c558b513cbb2451cc2fd0ad03789f4dbe8 GIT binary patch literal 171692 zcmeFa33OCN`ZruveS1l#JGn_3$kIS3oj}+FL_k0d35JlcM9~oeH3(=>)QG4Nx3I{d zq62~s3Ztm#xQl4SQBYiF+%*U|EG}^$cU;5X-|ts-J0$A7@Bf_dobSBfc{^}#Jx@JL zJ@wRbtLj$WzWVqv$(Wx zA<`f;9c%)Z{#Ts?UR>@r^Z@t*LPV;2340`T@oG!2z7{e`BC?{lur0{(YO8-D=o3L- z2|Cr5xQ@_?C;k#1NO&OOfrJMV9!Pi~;emt)5*|o+AmM?82NE7gc;JW!ILGE(pE0*G z%*0F^bMds%>6PhKVo&DY^ooX2>A*68rR_~0ouQ$?-V8t@a$>f6-x|8O`rvzM;N!I_ z+x5OR?3Ia4)d$|I8^!s(p66q&;Nmo4b3V^BPjcq&40&-bzak(a_jecet+)<r@tK1*tsgFHpj|I30G#+bZg40P_?n#w34hbxiv4$bQSb0 zNmprQgl}^DwyjdHW`-)no|pCunNgKllieI^*%fP$!K$p=Nl}s*M-cUDc zb2(N)N@P{$;)eCiv%AFCsKWE3lSNLgFPs)$Im)+bb9r5(JDd_0`N_=JwUf7n{L$=7J-##;V^R5q70&7FYuG>$JXFW>yc^}bunt%0jVmx-=| zV9B@QVE0E$o-ONAU3S5E;p+Bm$>U{ZXTR>V!4aP5?UqvVq_DbgDA`yRuI@T}%2Lhbb>Wi?e=d)CDC`Ugrngo9w z2et@hmAsfIt0tXk%5`&|3$Uu1e9mO#z{J^&Ryfx3BRroyGgKCy>Owh976-P)T0V~1 z)B%6OPqp+J%VAIB8RdUMzOGrfpgc8veAR8`BC3|Vmdk>n&BJO}ip`lNqDNTld48W< zdPQw6ppE-HVSldJ^TIxN5BJU@4X@u<9=4hd{1E7(uczrTac$OUAyB^GQ%)*-SWhoXjsNNN=tU zcdeROrfwB`uG%;3+6AR@#|zn_IXnB7Qn|BZxOaGEsoE-!QGLGJp;l$(OfJuF$ zn^^9uxxP!5t2w$`W|jEDmtQM~t&*|aM?17icjrF*x?{^^#AW|t*- z(#l>$-1F7;Ci=f2(%_1<42?x=W#00#Xice(r{t*QvK6(R zN9UF-t5LPfYSHFvm{RW@CZ!iITjfdFHlnsFb&~gbE2B)+E}uHD4Ysw$-Ha4#Z$pan zYj@RHVM=?p#9Hn}88yJRT~l4)03>%!jn=wgm2NA04m=tYu~>;%<59I+W^SFi+r2yW zT90Qtq?=H$tgWzKHCxDmiqwrVJd?e^tg)l84Z1geP8Ck`~S_%c?Hg>I&+Yks@6VTs-eQYgTo~?On}-sw-uw7va@b@s-6xCl zRk$pzDqQx>w1J4r@ytWr%qTl|+C`U%UhbxI&P5!2dG0iK^UQMxTsEOgj+G2-O?0<- zaGH!xF8zA?z-xO=uS2;>;Svi`k6)NbpJbQ%wk$X|$8&I71N!F|r#D2OuU5^QL4Urw zZq%YSd}>R{c@67b%{S^cz@B?^Is2n==#Lhxo7Ur)oucP4O&w6z7nH|Z)*hOUUir${ zyz)qxP<_lB&KW18a=BPu98PPlD6c8&5x%S})^cuafxp4s5X`7tUTW=FSE}Cegu%5! z4i~+@-qH}wQQ{8M)+fzOuF5Ep$2_b$m&x1Zv4gCm&F(j_s{$T%>t@ z4zKq&ybZad-F_{h>px|_$8!rI#~v@pR5~oCa$8!Yu4d8c+d)q=INpWz4U>dfPCeIc9d7h+&uI;Pacx@%N1o+ zRWEs1969PtdH=&SI{qe&^a`QVXguUc8WL$7JeX9K zU0afSU0HTbcI|OTGjy*jV*i!BL5P&@Uc7awj@*gBWmVU3%wt>C9|3Iu907bbUdY&u zsa07zS1(NoAkC1@)%B$?O$L9~pX0gXUsPHVu7|XjC&l2jj8`E^m zZg2K>E1ZIIe)fGB5ARmDTE7LE(t@MW-91}?B7Kmj(N4xmk zabcWeH;O%}`$b`}N$h#qXxnqc0kNmUezC{9e`GDj7Khi2vNzQ=`kKqbW5dbyt~!hb z4&;T4!ac$hx~yI=dj7bjZqpEqwM2dv?0(|FG?A0FN(4rqI`RI}lpO~1RlJxv86(L1 zOWixCiR`SK#QaQqF2)JPpRVuM`;(oq$dFAxV?1m0*wC}o(c`P!nwc~AL5!WIiL9(^ z#o~!>N9voMGE!1%XzJifZ`_|Cau`D(019dIMn=l9)Ln!Q8pIpIL8UH=heT#_tn)7Pm z<@$Hlf0UVY*>$D9;Ty<-y2kAW*6NRoVNzJ}7 zqS=j7?}4(u8*yrjk&A?fY+A$mQzY!QevZ}n?DwKS>=5n}PWI=hmF2ElIndfN0{!D6 zNOo@;R$F$w8_#XV{4?h5l7pB}vxjF{#bVF*`-gS@BsA}dpHKm>4!FBu5J{=GCga=c%$fLepzo~RL{N;zQe7Jt= zx4oPAq*0iy@M7OYKhP(2+MgT)y>>WOnAud5C5OaXUIH9yio!E~^!*<6eYxQQ;a=dH z8cS;SwqlcF@si>5i~glf>fYPvfq!EycN}(yi?q($4$E+?kGm;W=x$7-G|_c6{|e47k@9Yzevm0Kt7w(M>5*4rqR=MFH=!#MZ8?Rct+CBU~-8$ZD& zJnQVnI8Tn(v&{-qZo`2{o#8RhL%VU|I(h#`7$eB#zG(7=RTp}PU4LQfz}GJn(d2mn z-8YXv5DDA4R-TN;TJ`}J4xDt*JX?c9@ywfUtz+NHbn8&3f?Z1bxOUnV7h@K5;a=9G z)fnZwnvyFnLrm>nksm-?>9Virv{=huG{s#pAC$>^W%1he53awv^!pvGtHnJ{pBSwQ z*Nfg6Tk=qj%fUZGB`Wd1@mr^*SRXYP7cVzy-#y?Rc5^`>Qt4P8Ed&b zW_6Lh)3hP?;B@Zov#;9gm1Hzgqr*(-oi zcc&O@;V+mmVFtWaY{6F@ca}#B~+46?pPb2W6pq zi_F6lzRruakFWNzos5Ei-CG1^+wdo1Kir4x^-!| zwtNJS###=;l8yU@IB6mG^$KHb7cPmbq|LL!2aVMGKjC3MuZ1lPTbytoLgY1yCu#lb znRxaW<%Y*}5j|SAWYkDJ?b$Xb)zytEf&H$k!+E>vGA~rQPY=EIL=$H>y2sEjv6io5 zvFImtGVhsTAD?J%BEP3927Zy3ec`F~r(Ss5g}W}yp6$sUIUp_zJ1}D1rpqZw^Cnf^ zHl6&F!0pZ5d7;S7ntkf*TW9_*=h+A*T` zvK*N15cDgT#)4yHK|vkU_&9~m60w$JV$HY@jR}7QviHnJija=ATy$uN_6N&- zWIgM%9I~*~^?n{KI5}qHc^>I}PW_#*cGdyvJ-7a@Su4t?jl6sMx%G13$h^B@fl1#A z9}oGK!*a+qj{H%vwC1U`Nn`JyUfB6e(5j%}>$++64`>Y!PM@YVJlG}=82MHG4QXvV zJfh2)Vb-?p7`M5$^e>9Fq{ITvUhO|V8|9F@XRR);8M$V<{EZ)s9giPYt#_6$m z+v-@WO}Q%cby!Adl4wixv&b!r%E~P##p%9ASADFPLT(Np9@1P`nO-k@R&E(QaM${y zdiL3|T;$^^atFpwsj(i-v6kMkZn!^sIEwpIhaH{_xq)RMEUV;3=%H^PqQ^@{--a==@>fl&!Kf_{Yq)rJ zc!8n+Kj^8-S-d$DPhkDrUJ5-+=vPOlWS@fPJ@KN(Yu9-m5Ct9TvS5iT_i)RZhpY!y zM>FaoVFhgRp-|PXnbnv*?V7r4rZ@jCgzA9~b*Wc3A?W(=2Oy&B^c45{vA9#|Ua|vmc@EOarIp1RbemIEwgLUEq2M>OcQdQR| z3c7@YV?NDZYu{69H9aVPnz(Y5JZkS3D8s$JDpGxaK&{&pUt^Dl9BXmKpUYjM#K7EN zC#ntXCR}4+58*lkW9rBKeOeatZ6TH#IEnBY1N#ZDGjKBD%?8Fh03n(T93NE;ac<7VJA!Vv?f6D~4v2H_F|hX_|2xC7xD19v1`XW&kR8w{LDc&UN22(K}4 zHsN&!#+F6cZ{RTDCIfdS+-zWMdxZT4?n+oFZGVKIZQxwO5d-HDE;4YGaEXEQ30E7q zfN+h0yAiH4aCgED1}-GL)WAImuQ6~>!s`s&i|}Rx_a@wA;68+#4cwRT9s~CyEL__D zB7(Mo`xA~BcmTk%q5V#|VD`EFF1p~XIhRhIJ)__Fx*6w}jyb8{NmFN^J!4M42^U;E zd)kbCBTgJ!Hn!-DiDS$9_q%xN>^Xg>K{macum?F;Q5(1?;7nZkxVp57kMsV29sXP( z?Em2U7}s~W+NQtX!3FH};0oY!TtH7H{t_NYcp%|{ga;BHNO&OOfrJMV9!Pi~;emt) z5*|o+AmM?82NE7gcp%|{ga;BHNO&OOfrJMV9!Pi~;emt)5*|o+AmM?82NE7gcp%|{ zga;BHNO&OOfrJMV9!Pi~;emt)5*|o+AmM?82NE7gcp%|{ga;BHNO&OOfrJMV9!Pi~ z;emt)5*|o+AmM?82NE7gcp%|{ga;BHNO&OOfrJMV9!Pi~;emt)5*|o+AmM?82NE7g zcp%|{-+7>Sg&6g_$TkrLZRkieSNO&OOfrJMV9!PlL{}K=A z-%&tb`8|K7^X$Z6oN^m*{uc5`sR{Zv9Csyd!rkz#1|NU>;30(kjfE!=E=4#Jzn#o) z^3Or2e@g){|K{LQVlae_d;{qGErbn(QZ@h~1g(TQh3ol2;|@qAT7KjZip*GKpp zTuQu+q)q-A7vc?nZNoW`Z;LPf4Nm^J{&*NKp9qQgi^s>q-_j$ROW-Gb%wN1*f?JDGMp1Yx|~A`U(7w|L0tD{v{XbZlH7 z<8-}%{8}RT8-nW~aOSr#Q`m94;`xY&@%|-VzZp&eKj{k*o`jHpael(|r4lEc+BSV; zPV4}`=}*ZO=eu!IobNr*EyOoFp=QF3HYzc7a-8o|(5Ik1lw=E=dKV(3595D^|MIir z{7s6NLO@*Z_PY!W{_t8!f&r#?F%vRs&y)a0tTp5YoQ*AM>Kb#k1q~eAw z^v4c_EdSmSlbJjo%I~i1V#;^fV!)USFQ6e*uJSf5Q<{ca0M+MA)_*OuE&7j_X_E&{zD1 z?+xfs!oN7qw;FWX_Y^|<`6Yz3bB7cEGr|b)P}Dq^BM50vHNs4UwFp@*OC9=Z2Y(4+ z3F57M6OKeU68K^#d;{Th;6?ato8AbgAf&!I2>JYPK&btOkoDssC)|keDd6!x$|`Z} z(s+L6;J0zKyb~@#*w#;m|H5T){uQ9pcTXW?{RrTx5W7~L2m$YB|_R2 z|GN=@GyXzrH-CNm_M0#VKSXqKUB8P=sDGTOxTvV_1pKJc6#l5ul=zPtO>utFXNvhz zqbVb2oOi*LHa}?;7d@l&f(z!HQ8jbU8KcU|rVs(^nHQfeMvXf;GGanxK;HqyeT#%_ zxYI?8*e6=@Fzzw}`;Gz-!4?1e7=V(VS9RcfnSpXI2cuHn-NY>S2w<+)ktsFe6dmI| zOvL9NPBx!+A27>u&pdw)xVaX>BB|b*rM`uJ|CdbnJhcQg6%~H|xRrIjgIdX>M+)l#2lM$~Aa9+PQ_+B* z4<_qEMWa+SZ+*|{bwMwE_bN4{(FgD;h?kp4->u8 zLF@cKGTp13gysl0aSv*#a33T@kGee&F>!p9dFWMlc57TdA(lkoWkA-|ie65NSdXd= z!2R2SS?iqig#UW-Jm#PlTbQucxB9o4);#V|1OC5}`3VQL{p7Y99W-PL<4H$0(@)#1 z4GuLd0^gDQDRmU0gK|9-%LgQ9DV(9GD}_vvPkCNQ_?b{UjU*>x3L?_>LS_fV)4D;BfJm2>RJTr273V<_%FKYev@?PI zXn1-ua;+r20apppo5(X4*o#zn6#yC`GGwOM_RxaDC#incZnPFJjbdg3AFt^`*iMG)5um{+s8b-VGuxYvL9aMS7TR<<9F2t&+ z*Y5hUG9xho`_gg+Uu(Yglq` zNQvaRxXa{y^mg)6z=7niaJQ4sfu>0EqtLP$a;zItmK>s7$V<8FLEj>h$0JxKledHK zBawUtf;(k$G9qu1$(JLsyJT`-L^jFfUWi1K3G7F#Qc|+_aJi&<0m%hrCYa>OlC_Dm zYE$RKwDvT)6zMT?jYCM49clCo7-Rm(JrnBeDjiR-h7>O)Q{^F~EYEAleKT0nH1~Pr zmer{Ek5G7aE89HC$~UO>6xueM;GKxmKZqET)vli)B|2D4BVFz%&!v(kuE+HPg}cIh zBYY`^KSrGW^dRz)l7f^n)`2%9PoOTN@&u}+N$K+M%>9+E_6!9iA8%E8B~?yBoKblt zRn`+NVK%O$RgVzuptaE1yMT6_fyte`n$!@YI$lY$8;A}7+KJ^G|C6gYG!fkqPiwYQ z?LG1d7|i90;}I?MA#E~v53ONKw>Qw)_fX?1pdCLZ`gfx2aI=`eD-eGJmt5Bg@|gs6 zA{ivW3ku_4Bsi9aZ)`Q_bBN2kTNB*K1U>YI_UJ}tKcA@1{zfJ^38=~MvqTpW)%ksn z=vtud^SiZOeuscA-)~L+MWSB#z~uLRCjSZIO!68{fpKX%`S+QCJkccnA(7sonZ%ok zRsuy9w^Hd3lK%W0*G$C9QLSnGz%;H!T=u6RvgA=yWJzn)%aPC1x%(uSjkq-Q0OgH+ z`zZSwaAV&-y60=E`VM^WfMzP)39ZV+AW*T^1d`J!Z@?3bopRfO=PV@nhn=!@4!Bk4 z(co|2KmS3eto|3B@+_!vbvPDkbf@h4qfYq|P(AdbZr(2f@U6lP!zxB@jpGxUXTgb_-})K!e5LZ zSGD}Li1+!I;U4hM2fOXx4Qj}L8sJR-9Kd0JBneuje>Ma*OMe~H^IwO%&%YM;fd5(C zZT}A3L;fFe&-4eNFYNDzd&FOYd%k}M?hB>=AcDoxe-l(Kk^bYLc&YSHL$E^n|BPUz z^goDTwe-J@V2$+ugkY`o-v@JElKwXlydwQSB6vgkJ7KurB>lq?Y?J<}2zE&SA_VV2 z3xa0pZ$j`XJW+v+xYuRDM@b68(!GIWVE2xCj#NH}BVSk-+G2!u^&( z@`EfwcT=WjEDSzLC0p_|Rubf})csC(ja39)q-{0H)dV>xb#L#lY10GM)f0sKT|=u2 zK10rb8w{h$6fk)n2fyb<3Uwy>2~ozmd&g1tAVOOaXFY~}&&eD3$J1TA?A&P2@VK&rv4%mB}slj#AT>NS%DGr+T+><#$1%Nf&VtfxlYpkwq{&$_NB zsHd{jok^SZO*Y`kJrHA=Ugmg$&%tb0?&$=df?8MaI)Y{{H=p1VC~^&1LGU|ha276qKC-%XlY96-@?>Sxle2sl%})tWjc@I0xPIkG1O*oHCn z;~Y;#CkC9UpGmhi;7t7tIxFBz{R~d>M%JE+9nTdT(fr`zxWb zjJvZn?m_#9g~VT>_z zPzoqFtBtTWnKRVSXy$hMaGk?00?rK8c*#Q73+j3&WnZ8fIm8UrPy+#HhH6kdfDV8& zRD*_0CZ2R;GXu^H)lkDCW1G`$4f4sOW%z>I&+Q4z<|Sv!B)JT6Rz%oyGBs!(3wO*{`Zz zQ%eIiSTwU*9NB79&-SXDH1)*5wfO0AYo9}%6?ioR=zg_YQ_l~)hAM0waH#cxt)w1w z5}F&>O6nnpdPU%UQV*+pwd_@akGlblX{sx_L7qYe(WOo| zKxgU3jj7;qfPM6265Bo<BA*_{2_XE2TZwojXcTlB$TolD3tcOuM-H&Yq)hZ?U z%zjpb#VAS7j{g8m-Oozu`Dm~QlHag%wXcI@Lxayg$!2KVhtaJzG-TQZg$yJ1qmXE5 zC=?ccnOu0jKM38af1*X6UrwWzd-ADeGwv9U2@AhhEmYw+ISfQt{+g;4Gl`9yn^g{qVgm1oel#nPhYtd zk4bwNRoj~>YX5+|TXrgZ?XzzKlWix%@QD3#2Trf;Pw6sg@1)0+{S4R|Ec;`6z-ND` z-DlZ0oJ+U%B^7S1WX|Ev706mc1C-nVgBuzeq(~`&q~{Eo1S`_kLri(*%5E4`*ar$| z`qgM@(oROw%1(l`%f1WlN5c1_8O>An>+t1#W&atqVS%zs;SN~yEJ}Z#Wj_rQ=Uet7 zcyfVdKNSJZV~+yoJdgc1=$-Ge??UBR;IYTjPM>`?ifNwD{v4|3`|Rn^vcPB0VO8+k zxybfBzx^H}=lktzz`4M0U)l|{fISzg=LPH`uy}sJegU~y5U__cy%hUTh@6*VABzmn zPqD9ofeTXXj=7-Oc28t$o^2<=i21htCUx5OC5UWDxA!v->Gob|nV)W-27v|X_CHV@ z4Ix`1m>05d2Iu^c{XDA3f{<;&6Ac~h68fd1-2q;j-_afg;}>+ak3()zs|%6PyiEHX zl*ar_yF0pz1)26Sv?bdPGY{GJwZP_Q+i!FSE!#eaWgWIHcyM0W?!^3s?a@efLD(*4 zIdrj`p=@3k`+Im|ei!=%rq{)O7Lh3KowO4xd3aqhKVmPSUn2Iq^h=(7Jj|V!XFp6@ zp1m5_f;>Bhgc|bgGhpt#e0vrQoS$z$O`ql4Gf;31-Rzr@(7bN;bX4s5-RylZVnH|i zC1kpx(2k%k%`3ELK-v64`w3K+1%;fwi-w+d4uW|-?ZGfu!Bw7L6}wdx^#mS89rCm&_M9r}4IH3h`xLuy+W7%I;@PkG zT)+raq!c5^o&)M(n2_-V%2<9Ync?`~du~Lngh`=uyOBs5p9~#l!I$!TqJ>Ze7YcDX z*g9dEXpVzlAIGKHq@Zb6W3ed&(esn~T>%@}F14i&8E%;`upur*7SuRG)kfYig zcLoKwq5MH0{51rH_Xqf)v-}G6PFA<)=UPBm^H*zrPxW%^gyj~vt9pa`)b`w)TD705 zxie4`MHe}n9zIh_CKLaor@jGu*E#3a2{~QUhLOFqycD%sp5I<`Cp0%>_xW1$1hPit zj&!hIDkW#J3vp3vL_UNL5X+j9G2H0GSY!`%O)hS)b_vwxUU23)BoLO>dE3#L@dW>FbKXCNPvl7pN0-#@@5|3iCq&3Z_S?xdj$Yx)S*5%;;0xrC)kP-Q4cSP@OFCUQ=bkc|IV+-Vstn{Br$v!9kN8cC7 zd~~7m>)%tl$O$Z~AEeGxTNw{pK{wq}f6_ErExOAAwDCZD<}YBZER+#e_G6AT6K@jm zGoU2mk+33@>E32 z3yvf@6#C_>pl3gZ!UE+Th)qIdURUB5YJ4^EdP>gL_&tyB*9Nz5BT@NO0eCvQ+VypfV3r@z z68((m>|z(c9g*R^a3Hup2QE*{d-gO0U0w8KXLS0e> zlLuz`7p8a;AGwos3Z;n5&Sc**$@LgSrvXPry`262)Faj|r0lnp9mHqrR2N?euBB`X zMk&CV^M4W#AHjbB{s*2el*=&?mlqt--kHrJ2Sb`a;4YA_uy)kDe%It9GMTnC9MQwt z6p>36ut{SL&wd>7~) zOvg&uPj6B1o+4$D-p1fP%{(;3v#1P8yn@njR*sJuXjYCZARYhPk4o|1-#NMd;GL7R zC*VwI_=DF^t`V1$&~8tFUL1B!UO|GhJ%DS(mU$D!HDW9G6cC-A0(Atr8f+bXtbSzE^m^Lf~Vho3|J)O~G=I<^Hk@`VIf1eL?(+GXC?60DesoEc&^dmw_A@ zIT&#tF^=ZkvB9jslwx3?7|a(Kdlaxw4HgKTJp|Zi2D1aD#6CAzDDY{2U|$$4 zGf1OUG%TzXMt@7Aw6PBX(8i{UlqTu!r z2lJ(tkHkx#fevrLUIZq0vEr&MR!Z&pCjmW5acR~S#R|k#{eTZrjT+yq^rn3GVD+@d zo0Xk42=pQ9CByHs^&6j~)ms{0oXX zY23#+_!};hX&R?9JxqAHDD7jWz3T|AMpk{>kq7T{L^bqkE3`EZrM*czj#YGDde~j5 zPC*Sy9mmA0bYdvS)NvDlj&V@SZlLGKI;hW{#CkB!K?C+>bj)}Mwe6>gRy%0O{x|E- z2@aYm(%dZS6V<1%CnLTl^%YDA={2d4UXu#xHK~wZlM3lIsgPci3Yj&jkXe%onKh}9 zS(6HxHK~xZCKYnlq(aV`RLEJA3dPr?Lal33Y0jF|G+5#6`RH&BaxB%Og%%9kj0}m; zc*cY-L*b4p3 zW)SL%yC+lu-*~Zx3xBGA4un*P%MmZtwi~J89>5~>9CZro-!MY$xR^Y{V1rceuP4t6 zz#{YyXqKYG7tkZsfh{Cl4b?JK1VdHm48*%c+6Ayk2}!w(&LCK7hV-Dr40U1pp*2wA z3tb9Rtx!Jd2-fSANc%f*b*_A$LS1zBHcM{K37x?-LuY~!TGx?4Z*Al9~R*L1A2XSgJmiH&V?Ur07*&$ua2H?Il$6O{*Fo z%l6w=H4oF{-^JC~UYh>B{1xS_qAq(QbNqvYTJ|#L^JfQj+qVC2Pw!Jn zE2E;rlDn4DR*|o(Zi4BSDpc!WR;K|>xQAZpusXZowocbmq^F6&C>Jr~sj!!c!KsKS z-p*U9yLuh+S#`K&U&2iH(F}OEs*2P;s#bJ(|F)_NnAm_es;Q`-;y$V@YRg_hZx$Ox znLaf{jRPq=$Z{WQ;3>3am^z*DPclQp)%Pfw>^JGpWAy@#aI>t)p*t_HaNi63{5b9s z9bbULh{{*bBhKE)G`ndSSqsuD=)Hr?0@iQr>zRu|$`pSfNL$%qA7(Weq1bk?YgFV| zd_bkWM@N(?rWIa8j(hOd<2zuTbC`#FEW*P36Ye?IbfgfTKyUv8Tp>&l4c9*mSC`$) z(n_TZ)-@31u3Q2@3}N9Nf_siNkxD}3d_qarm91P)Xs*u1bXTKdeCJBSPpbKZeKco- zhJ}}1h?g0RoHw;z$kDpVxE=&wE=KC3*`9JSNY?;(_`ZFd;d$HP85if#fXI`I4R)gB zw1H=V)~5o^@?$N6evlLChOZD8JqI?)Q%T9NvDEMj2fUN1>^P$Sqk&E#dOFef;VXF> z(d&r5)gS2TM0XI~N%Rb&RvOTo;eJ^|loP7_AB%uaC3+9gf+94CCzB9Ay+7iwW_)rw z&=z=7HV_>|^mC>-kLVIjrIPtX8-a>$vyio=xIU()6cX2y_(3c0<3xWTZ}+Xp@@?R~ z7ngiB28qIt5S5w%Vvl`*c2NGh$ltQ)dAx{ZF_%A!6O4AI+}4~;GX+MRXnS135h5K1DYS0PnYw+2FyjJg~`r7=IhlZz)j9(pI#;JceEaS{RtPR9e;y{qqK%mTEnB186;0( z9uMg%&l77rt=7Z@C8m(Z*h5Tj590FQVZDp7+|xP;G5B=wo)4|x;bPXgS8~WKM6N}K zhRg==H~?|9oQTd$W@3#HQ9R~06w>ls4Ec>cncAMS5IOMW{+g4v-$a~`JxDUi$AJ%B z#fq4%@u4F~Gw`r$=&LkrAAFI*N zU>vBG{aM4uKz!IBs=HS6UaHmY)9PZld#STn=F`Eq{9avIN?hG7THVc5S1}08E48|} zsjk1Qq&4>*$=A1tmRCa7CFLCvHW2$bSEpFJk#RQPx^duYjVko{=X06 z#?+uzBk7pp+NQBT$59Q9s1o|}BddN7mX+7sQh z`t8IYrDwY9vBJ;9htbwTjThtq*U6i~)@0&8u_c?K)*Rp{iSrm!VUkCL{<{ez`RCU3 zD|GtnDX-J7)akpi_+!$q(&-H+uG1f*@$-o5^vCM#t|YG0AE)uhfQwSOf;C~`kyS=| zb~BPbPCvI7Dn7VTh4f<9LPg5k6!davUn;+4kFl)1^ubo?WsdZ5T6&q5#v7nwc^Sq2 z);`lrm06szW5#XR~G198h;vi*?AWT zdAA1^qzJJu9+BqT zcKLm)^o#AJUu>1`FUPUPG#wE$8LCu#3{M+8r%;4}ytN4=*7 z=OOaA-L&mJMVeYxBfOl2jO1#RZ}4L%GAWPO?*Y6!q?Ffzshl?~(qPVUyk6e-{tOBq zQ-(51FA96n%(ZxhUcvI6W-#$8rz&DEx@BhtYYmzjTrX@8;(rq`IQZ`?SpUD4y_zw;D_XH?M&rApy&C)DUD0Wp_P^N`{T-Bh9!IH~UD1b#enOOS?f_J1 z)ZLNLR>V2GqPv4JMV`kRGD7l$0{kcd_Xx>Z;B@vh6O{2i&6fgs0Ssx}KP^XG0rV4~ z!hIp2bSnpUv!|K$Dn-6X)s?Lyah$Oh@@4QC)s<~kS5kF87}CztLS#E0sBp6~3ml0< z1^yhPCZ{pKbc|`th2V?-eHjAN|KePlReu~9dQ^koIilvQK|9-)XOhrv+w$c)rtP-n z8yI6wt2x`2@6a*k*y&s(;EEiN7-!4!=>*M|#&xTFbaEBQ1 zR~-xV7>8>6pCa{GhZ^!9WDjwigJznOs3i__ICpcAn7&_VP4E^01w zmmEb1FK-KXNG03Wr*fTsD53utq!R zNPj)b-l}xa3jbe-RypVx|F6u#7zeHPe^0B%I_aL||Apu{2c76YKy^mob^kny3&O2Gd&E?)Y9@?LFl~@Q9RhBq39};I2|CL3O3n(q}2-nTQDX zfC}k;w3GscAd8f0B8UN#0=pJy|dS}LLk}!)*l@aE;;diV}t*rA~ zSqCFox%79eehiG$^l)q`!Lz!?6S>Kebkn7&GMyWimnv_g}R8T-z#nkS;=+A^CSoCS$Wv8_|D)Pv&4)*a544$?`8CeTJwG zm&GwpE>^L1-h;aAp{bK>WVv9W;QuV73Y+x@EnH9n;cmYdzPVMn zn-;EU6)rRbOs4!48VXhgewY1sT7`?X@XS`>L24G3ouFACG^}SaKc}~6<)$ygdb(zPgRI$dHT`zp5!P=JEw2YJy?>te zelX8?-(Y=#!J5mNYiu3^qW@_4ldVZys*@ORSf`V9etT9fG8${y|)GroFy zq#0lNthfb`!U_(xZO z-+$34#Q47jjG5Hsr3fCjK}~w?cyeyyk$3<1<>Y)zb56ir`706Q@@L_Wccp_E^%75u zCodtW(&bGQONFy>M^uC5e;-JLM+8o27u*uCR0UY40$(}O7XI5|NCVF7M`=(G zc{?aU3oq<=oIGW~XheQ5>6MgY$gs!2Q_BGVpyAYNyz^E+n)q2rQ~ji2YT1kJXONu6 zOztxrpCOlOzk#1B0enEisnvK@t`3^`3&?*+!@@q5c~W>y$#*$vJW`66lFuyQ(4#6^k@hQH5Obo( zq|Kmep-h&l(~{_B>7Xa2-OM~F2c4J}qO8k7r=$%b)pF39w0f#?JLvTE^06?-qh8X^ zs!ikASb5b27J}%kwBD>aK6M#TY|N19rKeU4m87}3Q6udDlkz+GLY20j9!Yla#VYMv z$_E^LiAvi$0(ej-j+0O-?N7{oibG$a(p)qy)xlS)v>&M7cKBDTv}2iJ!bWst$2|wA{>qPsZPm@emxrxXqk($*GNf1ulV(D_bj^JV z9R8nRy6~R?s`MXAGllgs5ZBeWf|~T75;QW`HOITbvlg7vFPJs|dEm7C_v7yKKZ6+C zpN%X;{9|$7Ed1L*XpsIGC=JTrdn5wO--uKje113DQG@Njmb8e!I|E2OgL;nBJpScS zfL#K9FEun+BGiD0fNRISZgkar*YDbOFAPS7@30SQUAuKjMy(ECLy_x!gSk6=0J~lK zQv}$%-{EK|cj+$?VC#N|XPCW@*hyf~L0I#s<`d?y<1GNyDob|>t|r8E`T{m1hOlt+ zn-H1S4Hll)pHpLRyo<#FEyD#&OZ11A05e{=X==xpXiEpBpE0g(t^6G{zsR}*WR>NU zuCZ|vFs+IU0)QDW-0TaprR#Wx;N9@K|aR$UL~p>a0`>hi&6cNj9VBlPso1^ab3U~!6jGoLj(mcBB}|A zif-KXnGZrw67MYd1?VRr6nqI_A322HXV6_vLjA(-`c;Twx;Vn8)Asq|*?x#=2MUm} z0d&zLW*|=1uKS!6)pZJUo9vBs=9%r7(hn=m<`FLC9vx)R4nsHo8E;M4Qjt?Yjf+qB&jJ{#3EH^B3ZCdLQo3M1H#6Y`sfc5AJW`I=z_r?DT!(jTO0ap7D zcQ~6UPl4DUjH>?Mepu-ds5Rg4u-qTW*Ma%CZ}3C?EhO}1=xD1@)0!n$7xlu;7XXr3 zg)D=&#PO~M_rgh<-qGNl;<#G`oN?A5L@W2+F<(P^u5_qU@qd%Kkc_o)4gmqsv zkk76p|5*T~+Pj1N9{?7?0`OSDoD<=V;N!@DAXo%@Yh>AT7&Xm6al&VVRCkCcbHVY980dlfTda{dH6o~sm}K2Fj|SEYnj!X zvE?3IK}Mua*&zoLXyrP^ASYa&LC66 zQ_H~ogCv~h3^H}RGsq-NEqmq3)Zz>>HHS0E)UY$iB%J09GIhK&$RsS%TL+ovqgiG+ zgUtIuK|RfI2AKx6G8QrVGp82&GMqss^~h>Zknj07lJu~La{rkq z`zDPhIfG1A!j$+<+4^ zfj6^1*x;Ipc;TLgdnaod1l?@y9kST>-3_rjTgC1+Vz;unuQl)eES+WRhoG#N?7Jsoh`~=HU)Bw@M=)$LgS>k3K883m zysBp{lilOPD~*-_H6w|+RCE*3$)mw`1(_csdIwCFR}p=i=$YeyUQKil(YMJwk0?L< z8h(?u&nFrsI+1sX3+Q~PZ)kolD5KTKUQ9?I1~4Qe5*#Z8d*P*O{oK(XC2&U{|(^Rt@Y6^7y zw4~9~P3v)Mf9wKFH=R+Bq$Zw-hNcH;k9|Z_xEJuuG|vz@XmO^GYZ*2=Eb%J|^Vm&2+d966%wb}GBL zRavB+vRqAxE6dZ$p4H0uvM^sh$68*9%}^-Fg}6SXve%%j+cr9&P{T1qc0UKyo0Elj z3dBMjX&xea%ypuGx=N14EW`aah@C7B7rN-du^ca{m0u`7x;OOofCAI}$Fn3(MO^pQ zAkKwc2hgC&&4t|x(F3P0b+m~pK@`k=lX)M1B=4)J^fCwpT<@Fv`R2=vuEQGDEqVq&o$5=~V+ zmyXe!{(Pvs9782cdIje{@xLc9A^abFz8K%A`u#VHfAj4vv%ZNB8CzFDyYm?<&x1%* z-BgbluY4P@ESJ~B6G!+9UG)V3-)2pm3a~>T4B2NBtstu#&pV9Uzw3{P(Ttc4I`fTk z!7U&=MnIV=S)99YvGWf;PVo_!fR5voxQmqA7&DUcQl@Mta=bxO<;%casrs=X-4;y{ zZ{t$p{)|@VeF~nYHjcX@qVxDN`OFu);y#k*W6;j$pPi3EJ71lRf2~Y^6Z$t_fF3si zs!o?Ks~dp{(&d%|0bxSNPvti|IeQohdS>Is$PaMIUhwP)G8RiRed;iJE(a4MJ|+`3 z>2(Z1t%#yJIrZV+r{GsY+GJ^dE*Q=}3BKrC1ljl$&g9NHx{-HbWTQZ zmt1@+zYEsfH~z6wBRL!X}W^iz+Zm(Zu@JVnX~ zo6~ci{`y$8b9&A*z`@MvInO|c*PNd76su>UCVqO(bCh}oD96kC^qgmq;^#eG(aq-c zoM*85x5k^z={e63^^xH>r{_FJtFJY_#+;t>4ArSY-khHE40CYj^qgn7gTG=<&v}k< z@HcRJj%7#Vbf$57j$eZIG1J~R3Gu~(??)Evdqg$F&$=3DPaM*x=RC*atP@Yqc`DT$ zR2_YK&QqlmLpkcxbDl8{YEI92#yY4uJ?9zcpyu?PXS{=&({r9`2Q{bXJSRA)b9&Bm zB9=1I1L1Q{r>k3;{@C&OrjiDcyl}H>-H&*k)vh9~{!f5wR0E=%QFX>O?ETcEUm)s# zbG}WP^KBc!nclTlYf zD{*&;4*anTr84CMq#v*8g^UWVg`5?78L%%DLA)KxheRZF7J81&BJ=~u4Kg$ZJyrvj z%!yf{DsVUWLc_t*V2chfLBLYIWW){KX^51eN}cu&=(9q<;_eHb4;ef36yQjx32LDG zT`)oSpQ%)Zu4WQeXf*?0=pPL1P#tN_u22EPhJ)VF`;2eEr>#50kIV6+YJYfKj^?x; zms<)Xeq3%l>LE%peq7F=t;gkF)6~}Eat1weT&^67;)l$BLA{M1GGk5Ehs=HkL;R2# zRkuH6reoS2GSe|_4wH@1>Kc1ZI`D)dNKBS}2z08GP4 zct`^NC*pR6-HIpY} zmJoRbwO&p>9%7FnE>ereBd5#&dI)Ilp#eZoW5rg>rss8n-fmfVZ-Gl*&C^QJ0z~2A zikaUrfJi7Nv0)~ORjow2=pYClq%Hr>@6|-lY9-Q1B&3jd-`yn6ixcy|fyH?k+Z6;L z-XFkQpm)hY0%))pL>_P`xDk|VK#6HewcAybBqE|< zC8GJgng|>Lm9pr!8h>=;25Sb$HBhcQb3!@Fz<_pEz}JoR_2ZI$=1&uK?+Y}9p-Q2C zP4YOwQHbj?YX;8zJxez!g)GS)iTV|j#;*&rH zK$r>shSKBA$aAe3d50O<+G_bW%K7^tBYJPsc1jKes!d!3@g=zAj%y&~m`GKM}pT~>A%;Gqc)18Hc>Dz&L*-Q5A%SS{Rzaitp z>xgPrQ7=u;{VNIM*l^t1hq?DM;sg^xi~5<#78?@3C=s7*X}rHaP^P}eo0MwUGC<$> za2P4*3LiC*7n76y!T>_TJ6AI`;O=F^G6#KBDmYoE2C%^+k|z@J zm0T(R!APBuhIkWR_Gtt42_t+hRB{X;S)xXGpgzu{HaG+pt05H2Cy?2ssFVZsksP(d zVaY%X8o(Q@rzgZ$=n|Fqwj&yrnJF$f6`q8(@xQJ4VBpL^{lUyY%>}nA8V%;QlLXav zlAvB9&%pD@fh(x}~66{2T((ir`8{_l(bkVOEf=37oa`LR{dY+0(#BbPQ45;Oox>dLB^kATrOT z+(STvb8v=6W7~mwZ0P0N6yZnh#ZXbt{48wpOO+=>&ecsfO<@0FZ&PHj6uA*J_cfT$ z$_oH_3dlc<{M{wZKs+agR(Eo+GI&uLgb$qqeyFQcYiWNAiNZFe{bm6e{@XlIm$vJ7 zrQL2ys7u@R2c@md>~IlmYhUorl#um9@r&HnaSv!7Gfy_NLtVkz{p^Y|^S~99;s>|g zz3(7sri71a1$v*lo1ZF|Ni%!G!=B#Esb?8}b@WM;V|C>3)*UWFoCldn(LXQp zy<%EjFl9&`L~TDPGFJk(dxLuco{J*bm6U)>R}|`4gKG|F8K+avG^P@8QH~!JFnUrn z-blQV^i*!37avkD&fYnCeeWdxOR{1la$anu=*nQ@qrVO(%STt-n59mfU1ef@sFbMJlczE@S9 zfcky@zrUSS)w}ned+xdCoO|xM>jQmdZjV>&VA7JWGucyyZXc(9!7gWEfovSRoTW_0 zq!gBr!dv-1#Zvg57*)!ojBS62$oXF*^mOc{pms$q!r}(aNccqvFQRdH7Fd3Q54LUc zB|Gx`ZgQ&h6Nr5X5T%df;U5rH`b9kaD;^dQ9pSQo;S8zwNHUh}EbR_=^xeV`vITPOAidm|?MmDG9$4;l;OWB5wgg5_(byJ%JQl6I@D> z@$E&Sl+q6%h1^^4s0Kl@ck){7KVQDsIlSGvicLFLxII zEfT2ScS=I9XlV~BOL0##d)&JRo|v=XpEY2an-l2XVgO+g@2w=hUR90NO5lZ7E;F>SE-XOUC9tD6geWJ_?oS=Nu=vP_x zYU-d&RDH-8Js_fN{=RsXcJ;-9@;y$o&p+$k#J?f{9?hg#|xBU=<(N z%3G4Khu9S;$GHa#i8(($)Axnu9>B48h{XIox&Z*ci{~45cf|pUo&Qpx4?93{_rJ-s zi(RssuYCP21t*^GcM#%xU*L(xKphsE3~{S2Lhw@vq57yeVdl6`5>G}Hka&KC&o;ts zMYcj|_!)9JjkqGQ>zN4zuSKv>%zlP|Z$+^9S!CS^q$TK!pL2UkR9{@8Z{Tp|iUFSE z{*VQ}P6}jUd_V0+Sl}D|0$;}hzwQ_KIu__%j1qnU*iI=yx_KY<9PxVH4+v5sEZ|FM zkpmazqPBRwL+LS9TY9_hBciB;;mdG&6wmz@;ffLByFI{_Uy#Vp3qHc|rMN?cBV!X~ z2)&XI%kc2$%rH-Etykf?^Tfb-^;>oFsxo^} z2YW3n9;}7M&y&p7T3EbMiVTl-xB!+|EJGX)d=jfUMv~D^V$*}F5T4472PT)pw|9^$zCC8#~Fx`U))Ngz3FZ2vTW z3e>rh?T9z$O2`s(u0);(nvwa3E}zZ05{cJa{`joUmE1xsddr_c=q-Qp{GkS5`K899 z&Xq{K-ts3{f^#K*1y8}8EBQ6>qji~cB`WBjD^WrJTnX`5=So!2KUboH{<#tr^v{*B zQ0rWYO7+i`sNj}`@RuH;`8x!Cf@mKWz#gKYjwu%X5uVvtQ#g63Qa zmC&5kI3Jc@pVeScM7z|w+8m|^I}$nfffoJ;pOp`tRpT4gx%%}jn97CS!Z zC%sLQ&fo_4*xM6~cjBzjk_Ta{W5?#GvU!3)p*l84%0Ba2pz;>FuJ;p@gpedH+YhR- zDR~{Ru&cn{mePmWUEBf7f0j5m-?$8EPa$r319D#jfSd4fpWX(D6+MVTL)hsozXDIU zA>mC-{QdzXuDl*mD_;bF<*eOXknm0>K6f1x--W0Pkhtl!D|jeF(69Lo zGT#sMT*oQLDDBn})Pi%OYl;E>MWpb33FSE7TV0Mtkh-K-+{4s; zdBrwH+{${zy&p27hY`2kBoRMC#G2Qk5Nh;usx}IdbM{*h-A$Sw(&=lyj)#{ZrUJ!* z?zo2+rj%0-Gl2TO26yJL@T~w5C!qnC9O0QC343VZJc}D=D_{Tl1EA$%z8IktnRbe{ za1UIQvolT<8{`0ycL_G3-G<<~Y?kNp$%#LSuk+-bk9Wj%8FHy&0)l)zdW9)Y*L~DP zp35h!`rvzM!RPQDr|!aGZiANI6nEXHm`68oHAf^tSO)^Tw`}5pN@kEQ(x=iH}8jL!MF=jm%v^eUEiiz`J_{5xp zE8%Uam6W?7@CFFW{54|*P5bH|z0Ft^OFE4mWZG@d5IXF(OC{WmE){P*KF?D5{vL3N zH&NR*^0BNA!9SPar3ls{IOlA@K7fEzSb({6xZqqN;6TSYi#>w#&7c-vLC$Wg7SFL3 z`9{Th5y(^f;BvUcvGZAr==k?VX%Kt0%NiWSrw=5`(T7AOLO(->L_Ho7>>B&mYw2j!JbZG&-5x^$a{e2sKuVgszjt8MZVLJtQM!iFlCY=nCj&lROAN-s0#@sZ%SQY)#Cy z>Uap%2&-XK_q-E-#j4(eQk}$opvq0$hv!)0t$6kl-@t@lBZ82rSJm?{WaXR!hgiW-|*pKJUoC0bJvuI0q3d zE(dH8MEc)Cj+xqFw^N)#5?`^*(J&^I;8cJ(rW9^Q3STjdjY*_&p?lpyl=dl?SXuZ% zd`MLTaxRkI|1(T_1quZ42TAEq1(<+0Xy8#F_~!(^hro-amE+b{Y378y1)qOHl6wch z3tx>;D+wvubr5lzsTy&wyT~bD;wBJN@H*FBB3o?Y(B~!Mad9g14B15y*RwyA(o!-A z7i)YD#Nl#ltizeOGsJ7ag6%p0;AJf){!H0ULMuZiN&cne29VHgN+5wevJ#fKFFpwD zuXi!&{~|v9nZoIO0J&n$&}u}fuIST9{b#F9@v`UBpEinGDcS*VG{1YA4DV;s1xo7`GigXP701q%t5m;ly4Zo z{nQraJF%vhxBHoOJ3{QGKozSwjG}e_q<1D*vp2E5gxUOR!dRP{W9Q$+m~h|Q?jEPL zO~em@_LJQJz<4adMSu576><}G3|*x{u|yw3FJ&g&N}qTKLszS`=EMLBc3<{#!O}8k zbb0`Xh;Eh8PKReEops1o#4o?$#(sMcd0zf5Bo-Gk`&+SD1p)H=L-?%PhPXE%M~SQq zztttaZHO$nJtfc#zZl`UcfydnZxdLzXWrnHGh2Kwd*qC2_4DPZgb^o)n5w|d@VSOa96}!!u$xIM@U+645Y}=>3V z;c}#MBj6$&837+k=QHO6F}ED?-T1HsUe2USc)*lU`t$(caCInQj%v7%_;6n~a0@<7 zxT`&vFt5jF7b*EQ02L)yd#vl_q~t23UMQ5{W&n(;7Tn3K8{;msy$PS!FzXgHdX;r! zoLS$^tal<+S0YwejjZos*2@aqyO8iOJ|AON-dU)!URJ=Y-$i8Edy#rQN^=%GbO zVlLtFrk~PzjR-&N=b0x}+JwlmM*%^pls&04mpzS#TY;tQyXN6Hc(_~eevEjZiSg}0 zr7ie$67O;hA`~sp2;MQ`O(K=FEMA5O)O`q$MAWYcsUoM z@V-)bmuLds+mR}G-+~9;g77bb7vgh?9er8ZJCVW?%igbHq5T8E_nrcmxKrzJ78$7A z-Eo8eJ%Yc7_#fAK7Jpr1ISWvl?y_GXjvGG93V?$}EH1?Zsb~}^P!V&=mgz)i!BH0b zbb-qv58!hRi@n(|_Gu~hEiASksXry=oqpyUnYk$LGUGHp|HRCkm{2?^5>@;vGao`K zZ^U;NJjXn@xGv$Z!N+Mvn0tm*o?E2Fmm^ZG%--U@9Jv}1UU)U2R|3Z(wa$bZW7P@m z{|xDM-EX_s0^lxu*f^I;XXpN0Iy*+*rxVVU{t)iE%a{js>@w+t(OJ8UnLgVoJw&?N zQC~&Z5~1rlL@s^=5NtGW0MUksvZoQrR#Em{JW!3xp2Y)AMA^^qKpRl@8$8h3lobF! z?NeDX9!mL8iU-=nGF%Q(N^LD$jt8n&Sp^>0yvx?(feKMpi3f_PY%?BcG!}2g1BK1~ zx1tH<&f<0*w?)Od4bH-&h@yA^68D7meq}!O|ob@+{Q135{A|~$bJP&mt z56)_5?2{W&MBHmY#ue^$2hrKx*P00&;J*p@Y7BRo}0wuL9FPbzE)M z>vA^$303YIe0Y(M`v4*mS0PjkhGSUp?*|c?aj!+ptMR#*Fi#_;@MeTK&@H0X8X~AT zNypt=kZ?ObmlBj%61O2F=i!Ror%`n*Q@SPYZ}{+mzX}?g2%5e46<>TE67>GQ z+Z8%l@%kj56Cc9Y9DY58PvO7f%T?hYnXsqA1>lCH$5facmM~VlE=Ao7V#lixRs0ZC z5Vs^1Z!RIK*mC^Dt`c!viWE0-{Y5cAy$MrCPVwe>$X9$6@rA{=;(KoKbpS6d{t{9b z6~7qION*!Ryu7%)2w2_XNo4qEw|Ii(6~7wag~hx)XKwLB_%1De0^f^@pT+mmVjewR zUd*?PlovPPdu{O(_`bm{{uO?1c8hNVD%jO+K>T{Qco09gyTz}>&z)}ZyYX|ETg+Ls zd)(sZ@N=(Qj5Si{VYm3>_<6)FeilC;bBoWIivx~s@mBnN)-4{u&l7I(P5AjTu;AxO zxA-yqJOxhdL`4$!Uko0pyQmWnCp?he)!*kN{*AJL6Fj%8qsK{nRD}xW@urK!qXffJ z!@Oo9_|H-ask^8XAAeNxmCwb+2#HUqz}k7QM`Yr$#R91AqE38jm4wt?)QL~8m5{oN zI`J7*+`)NwGvDVbB~9H$op@ZOP0V|Mq38@T?#!7+Hpoo5{@v z=gb9z$St>L$Gz8~0xRX}aM%yG6y>a?~rnUFRcE)R@zEHW;f0 z(XRtab}MY3=I>`00_e2&UqlAdG=cFIM zQY>~-EOt^Xc2X>MQY>~-EOt^^?4+{TNoBE<%3>###ZD@Vom3V(sVsIP7(mt=25_JlE)uG*-Z1bb6O4b8Pi!6X zhJm6de!}XXfr=Cs{ntiV8hLL((O0QAsQ!Yp!LXty$ve!5FSr4wz36MyJnrN#*vI;R zotAr^T>a(!$5CKN%GF;aV0+{gt$?{_;L`A>hjjyzjf*GqA9x4Gr-J zGWWlb*HwAXsON!ZJge)f7V)|&?^zYky(<_pkq5-`GxxW|GT4OJpDPINUGaXQoY6B3@VJ{Yu4;6aLro>?~H-Re4`?m!je&?8Loqm}}KaVx;3K9V{rJz&-!Es*)BM zb?<4xgS{)oyspaomJXH{^SUbU+d8Cvs5?)v3 zeOCv!ESW+rv3I4I*Hw8x*3k_m_Y&$SI@q#=9L3(1lAn+Tztz$0B^jc2VoEc+ONz*5 zR|oq_cwLnj)4_cui0{uF5OW!Gk5duF8w+;7~EItMU@sh8-=TC*#eDtpFdf zccoRZzI$WE zXusaV*aeDQ>|J47idP_*_y#JLVE+;4mgxk04hhQM6>m|DN;q$C21Y0Lk30pMyb;e% z^57r}NS?qqF21`0QL&HgKq@Yz{YV^R{!Pq)nRedNoqP;XPV$HNc9Ug807};4+e`N0 zyC6A(?|AYKd?%70#P=L$?vI&pr+X5a=e`-c-V0VqkF~T6SiOJ2X?zzgSFRjlh|j!a z3ePm$XYz%2cwT^KC!WCfvVs=@Q=F|iehVU({yj*EZ3mt;=8J3hT{2RIkcG>;-)i@5JQ- zbH4ksfbYJ1z=!<@h4HMTWMP|2zv)hVUJNSTYM7|yZ)QR}ty}EYqsyNFuiOq5I=Fl% z)4Ek?-|}xUZI23duULX2E(WG{I$i0@im=~hE25m0oUnIRt>rhi&y;@xm1xm$v9{RC zA0h0l{5HQ=@wh61;KOwS{wTmEiSBalm087&j*OPA?BxNF8Nn)MC3_S_Vb9YfE#@4(F(Z1wH3+@Ud?JSnFnPh`5=>PO!B2V zc`-mFc^{LvFnI=>O-MC!GwEgc-s4`Rld!}5UF2YmEE<#T@5JX-Wc@K@Soao${)P{4 z!vjUO?j3wUjB|Ddy-LZ2^tP~N!R?~&@(-?i2h!Hd7xifUTL~I}GrpG<@HJEMcgW*? z_>NOf8)W&oc!%q5kagc;Uf1s~z`}Wd!Ye$ha9!cTI7?XIu1hW~@sejH`x6VWhliVE zV{37wu^y4&;Sw~ji%VWq(zX!#rQ=b4{A`CYiSy-Wj_bB9bP+CGjWFLGShUbBDM7wC zV~gi0B=NR|TR>k4f`v>|!MVB!1Ysa5oo#bfiRa8+fMZ_`#cyna6O#1ffMPV^q_D1p^pvbe9hRfJom;7S$m*Aa!>8s{$tgKS-U_GU0jD7U z1y&F&n1x$lDKrQ}yjO#_vEo~s0KRxWw1=`>67Z5Y)Sj^dyrJGHAD~BOAYNsH~&aZj-j!&JS~~ z)NpNqA1{`m%x9tm7gmC&v@X7;CbUK_ve*PhEDo#E5~UyH=NXpfQKdv3&(wHfD||~K zdZn?VLgY4dOVv+3mG+gYnaU@8+}h0eUG$< zGnDp=={3EU*fP^DB*nCgpzSLokVNB&n@(?jxV4mq+tLEN@t{=%jc#GM#Vj%{X|W$K zG%N|Xq%#8aB_;Dp=9bVXE!EYLwsz(`>8h6nfM@{5IxG)bLb;${5i|jKTtO=P9?|YV zZK>O?GGeN4V!BalVP1u=50I(SEv+eQbTQietqrt+ZDw7G+n*q|vrEvd%UnL56YVS3 z$DL|v%^U0#$2m8uObU7Bg?n$L~EX<5J~8`QUeq`uh#1kM&s3*@70LaUu~ zt9UHiZj;E@vZKjNMgi@cFUv|X zRsp*=j5kHAu-s~Kz_=o+^e?=VJCzv2;s_jEKVDjVcvxolBuTpqvAQ{oxTI6^yTAnj zAa$e+LCb$!$PS6|i~O!kx|YQ{7i7)UCE1Pos57Evs{>=4-SZiRvU@(%a;;@>g$wIUw|2IjLJ!VpUeF~N zoa>`Hw7~~PU!V-coHu$^w8I;H(<$EJ@6&YJrlT;d2jStb@z6?)hc?$&OX15r zV?C07yr}DZTSF~p3uCIFIOt$lL!pDFO^PNOm0TPsozkTxw#uDhRBoxyU!!406lZF9 zsuaWbA>j))@Egj00fgh%vn+h8QQ&&d4*7{ZO-38r9 zpn--rtist=5ccXE(-v6VdaIFexBzdBWA}5T`gmTpf`!HkN)6$Mar&UrrtH+Z7#Rdp zM3|;Bl1kW9Gjn{*K^roxEVKlNY8C}mAQOtMAW}<$mX7(Ez##ZN0wxB69BM)-X-BYH z^X;6`0Z#5oIcu=5r-e`vP71~Cn)y^vM2Qtp1jeY@mk|W zw*Q|PScxIYF|ZOt@_&0^l_f!=ndO1v&|_b11)-Ut_Dz9H3ttXE&J$=0vd*+k0-S9% zTE8`;Er%Px1_aq@>%I})hcYY}L@C1(G~n#UBqJ&kYYp?4gV?HocIDv*gM7c|2@S85 zVZgYGhN0GHkp^aMHruTzY%QLjCi}>vMm7=faZW%#YgedJ-q3`q6{&f)Vq(^SQ>Dalk~dxD6{l)p<(ADs~eN%y4Yl(60n!HMx1A8?&@Ne z+A3n%yfgiH(*?2@w>xdoGs$5ZBbMy!&Jpt`!FWK|-M9iPZ1h$d=2bKj?If&Hj(adu zsFh%~k6a>H(F)ZP*7&HAqPmWtKi9c~al{{>9oUpbL>}!(!-`*Q#D-4PlJi_6=g{f~ zTS90?-8ih6Os7F8&1OT+S_dmNd6%{9)?gNGARe}cIoglZL9=*cmu)FkvCW#0>V%vI zqc$SH5SZmS(DTSyq0?yge;N$>gF$85vX&a6{c|+|q zBug`^uN(Rrqx@{jYr_p=on;eH=Gg$%op-L0pD{<)$dCQ&^B(tEYN&m1TdmptD(whm zYN~7%&)emmMx(Rwg!q=w-3IvvX3PngQD_WBkxf@#B2J^BC1)$aGf=0dw{#go$` z$Kr|Y%3D$hu^}E%kg$vVU8-APt#ky=Kwc(j7l)&|=#U7+Nsmos4%u>(fI*P)9g=2L z9~$&XWmTWc^-%4BP~uzjIhv`DQ73kb{g+idsy^t^@1_`EaTnk z)TC*%5Wc}@i#{mDk0p~AMB6+-)Zo~Id% zcy#sv$fhq;XBrCaz!zD4V{x>GB{l}t=RkW{!=ME{U)o=&uM?hsKIP61WuQ3WLcOv! zbifl0>=hK(==&@iXu{^s9^D9XELf=FHndkcA!h{qU25_7Ov~t@(-ExQW6~7^e6kUX3GT$zl*N0w8nQt;fC7n zG1BlkZKRdR>?Z-A)XYuDD^<#Z86+}iL$t{|UqR!JIko(De~DEj-13CIV-7xUWo1?G z^uXlw%!K1isfYBwj^^sksZ?bzAuzWYTUv@6#Xju1t5>g1tzLugYJ9xn%GDJW46ehM zH?Le$)_5O!d3jY;bxlib zHys%q+_d>3c^n%b%WTRF92!0_JT^EoGn6?nIxu*2cr4@m9&kC$7gt>}K6$KaYW(o@ ziGj&XRo6sjtf{@Ps&8QONM^dKB{Mo+)!5U~+>sKY7|EoY#>c1AyN9RKJDQuT7^rF= zJ~TNnIh>iQYVPQ5>#b@VI}9qv$Evh2(^DBqZBx~Nu&KSD$$$2 zM&U7>KFclMpza_Lfhyj9{|Di%#t&WieaQd+8C^O#I#``PJTfqKROu1IIw&fXrB;xp zuU62cK&@ai8Azp4>7Mb??K5M8)5GIqeFKL^GSEPzS|tf;TBmENET41Sg-49e-OiZ* zLQI`eORB5)O~m+$Dly+f%x;rQVxD!})w_+Yx`%jv>bO-$OpL(%+HrgKUz)nyi4}OG z{Mv{wH?g$+~v)~`(rIl`&!(ss7O_;4q#?>d8J!pg%-?5fx5juWS1Yyj`~7& z)YoI~;?$Z@#_xxqPL`n+{1j2X)xUu;zeWrRuI~)xz1efmY_Css)~~6ruCL#XNiXq9 zr26-H?wVA}yJ{w!>_o~|co7Ppg+lumo0(W!!<@eWPY>}+2GCK4i3H~`ocVS9@iuV~iR}ntujr%U{8I=e=IS1~ickju=M=nWSQqhl? zXC&s1le^3y??($k!e?Apd%yqgm22Qu-tBB_6t)aH|r0Z7HwwtJ> zi+~6HSW2wR?gkUTnemuuSUqE6b~1(?knhj$V+^iNTyu5RnyNMH4B$yd--+YJC5Kb( zUEbTT+3J18oj$R;!n^C5T{vRDtE%ESYF$u=Wg+||>iNB!UzZv~C3fT|D80RIQ)Atx zYM%&6c%|nqYVX`;%9FS|5VyNN68R2V`ue(6Ary-igS=c%fMgaU_FA+=eYc;>>@Z}~d6De;Lxs#P^Om?ZyBXAOs9a-zzcVB;f>h?d! z_idMg7(ZW?*N2Sf`o&7V8(_=ZJL^NZZp{(*mvPWuSJw^$?j5hJT_3XGcpK~P;~lFi zHdSm|ezr^zLFonkzvfMOEbdkv-~FQM`jAue<+yvp?zRg2yQsGAMHL&X1sjjw$DG4| z8sVKbs+2L)Lg;sM zNB;uR^>vu{UR_lYg2x5C6?KRO8qe|!(NE>V{*K(y??-e_?2mBd#6m-5ekNz^R}foY zFC>PX)bF9c6AD8F%9tz*^K~5OWW~M~v6{RP<~I{M!tA%_h#Hkv zU%Ee3-A4f`(YvK|xo606p_sXr6>?5y{mFg)KevWKqcDTTtH6JrnHnBc4z!R#j(?>bR``Q;7U!o$&U zug-DB&1UY$W6b@omz5*_i%D_6uh>=F63X=nn6e{kF3@zJcx$JLx>=T4l7CY7yvu)o zm}RBY>z-v`Ckih9lqk5b?pdAbY-=pYS{+>uD!+rn`NNWeQ0w{6chZ^NR2sf;CGG{?V#)F%$yh*KJ)A*)#FrM zW$*aRWP`biJA1^_~?Yo;vC{xo7cA^FbSUUIzM`6y_I8Rns!Y_>RbMts8nC>vaG$pUE7RV;o!AvS zQ(3HrWhnCRuyrFFVJ)(Jx0t2gIkUBX4MGnT(;4~5%+^{nEVzN$KP@)@eZ`pe^B$ks zy3MPs$T|ZO#(x*zr+i z7GN{*E6v}8!da7DbE(TwJ%B4x3A&U`%kZCi@nyX^yXH2MJzOSt)Rpj zKyjtFztSs3JpcPhQp%?}dQc)9oX5#*h3mV?T!33Nd@niP=MclkFA0fX468cFADEQfj67N6p^P zr&#{QF4hKoYlYGsy0&)QcL|0KR^EyL?njKnyV~ryUoq|ju6wrcXBXgIx85VJ**^qp zIF~V>N4~Q1J*rT#^A6s9`unN2YL3y0vnyTBqMyP9qQ3&ao-wFwMXEl94T^g4q?@sv zXzXY=k{w~xwdfK7&cyaO5g+0LU>=F-UWaUme8g?HoecAu7qtgwvO+i z_C6^n{&F5&p{FKyZEJ^BpbpVBkaRY-%H5p%t!h64AL;Mh!$fw?VPhsXmIKWX9Jf*1 zqz=8tCPD86?O`g2iY2_OjLmE@bKO@H#cN&n{EkaI+Uxhc^|Fqm^=Dt%I3ok~``GrJ z*S_!;c$yOBuIs_kRGL#1j-!PUYN=>eN-k(wltDS(vFU9TPOoEamBsji(EIlP!}J~+ z7(6yKK0X;XszNbcLQrfp36IJX(6w04TKvj!&-NDV>bMczO|7vj2bqHHt=^LIx(?NQ z{jF5)6~9B}oI}_&t_Qc`wvryvc05=#D(6-bbp`w?`aQ(8Byc?pWGZ!jwcknbWw+kL zw3{Zf3uy4Vqu+t*({t0qDuhvdercQ>q*u=B$-WCbh&}PEc0Vgo=T=mw8d7k%OiSVG zW4*6C?z+qB8!oH&7H>7JkS}lb-hele8h>CeBi`=1jqT0t-ojn}Eb&&xe+tvOH(szB z8=Ov*dkcJvz}KgGn7Yc9b_3Jy!c39k^D$9`=HG#(B6VqBY)iKgeKlle=;xb5y?PVz zxO8cJ3uo4x)aiL2FUSZ`NZA%Zt7D*`MvYmIyGZuiJa_e)inZA0CjHEXaep{c~3L2y{&Zfdx0 z?Qr#FyG?uxeg;M;nT+VCwlLZ1mN1XZCgjziMqA^ z-uo2Z!RI~A@;I<@xW=LaeT)h-b+DwR8?WYPm^;Oqp{0; zVW;0S-X|F8z#E_k8FL3_ceib8zp<(!^badGRv6O=Udh(W8iuw1_Se#oq&Y=rTVIIL z!KtdF^rK(UD&3s}o-}=luj-gKG2V zNF#iZ#xzRmsT$!6I!_dy7d(w=l92rc_x`AkT%DdYdF_G-O613t7QGb(TsP8$7*6F& z$~udcQ%?uMp`?+zopP;lar(pidvWJJaSisl>d`6R4#v$c>xMg!{+I4nwC?}DW*?s4 zD9_)!X6tdYg2MN3u{%QIE8$4G-mk7v=I!mGD$V@y|+w|gEcH##uP z&7k{?RVad`#NPE^@G=V-w)Kgr-S-02lO(vYCM4wQ1X&uz<``#`L zMt;e2OWs>wx~mG21>Qel*7+#!|EN!^Hpy39u;l^0Q>s)84q&g0d z7^Wn>u;F@1!A%1?jfV`0w=o%{<)Y(e!0?ROBK$I)VV*GKvkBu7Z`#ccvn;~%kFa)G zCXJ`e$|7lN5jOdTByDNK^@)ZX;te+zG~DDhyi(VNd>|aplC2lG(uNxf8gBF&ZW0I^ zPxmZ%3@rc=-Zm!Z`ph(GJo<%W&^hbCLturGG}hOaDe3zx)R(7~NONOyQKUl6$>j|< z&uMs7LS#f({;>`=JyE=*ZzHsxf9K*u9^at(Ls*l>XB!qT{|Uj`XSN?-^6}hCG@o5p@{oB=U9T0|!ZyNAe^95}ZO4>_BuBNKfPPaJkE2BSLcDg~cEKIw zwbOP=TF};Pnr@M_aC^4%F41_6U9%|FwX&894V8xN!Vo?SVU*h8>OFh zH8c`_Gd?~pbmFt6QJ$vW#Djd&H<-A65*OunBQ7FQ^|5u1mmIi90+F=^4f(J*n@ zbtSIZ!sNMKcC@|CmN$yq$j{Jf?9&SkQ|IjRVN$Z>N_ww_v%@W)(|D$TY4;5#9Z6b; z!|BA&{M_+r=x3PQIoXCyI`fxD!sMHsZo*N$~l zmqoo>inr2n%g+JnD+4|>Cd);xOy~X_L(2`;xQA)neA5m*QCnb_!#Z6HSngCQ)Uc*b zCXJg`3{OoN(k_tC!Ipw@$(P+O>~aYIZNPKm!%huvkK;@__c(0Hkxp8epPL)jN_xP1 zlb72YMsnme>D;-Xcop^!iI2Fsap5Y-AMIOIUvA*IYvH88h z=;1DeeTa*;D^m_PAXG|v?s5!IxEDdmxd20AU_%~LCbuDU>vCB~?mgHdI0OC}Snfce z4lr!Xj^*4tAG)a1ZM`>X0C95Z5A$)$K)y6?9mto)Ed=?}xS1ed8n+dY2R5D2Ix&0_ zK->qwXV!yZ?gCh!BQMjq7l5)eu-pi6s&WYXB!IYpyd{Fyq;X}KGPm2QN#m+;$YwPr zmy!nJ+*qz;8`U3^&UM~<1#ej2qr6~QH!MKg#A;WRr@3J72P~H{bJd4wT*xe!a>F_n z)v2EWmTQWn*OnFOVH#H!7e&%?(bIrVgbR4(8ukXu4l<3acu`u3hiP2MqrD~#409bX zC3v!V#&oXdQC22D*YFr7%}nRI-Rbb~M}XxbTojggn8x+EXj-niZ(RsJ0oL%))Sa+Q z<4PExO_-}-f+HxdqDwFt|1$SsA=s3M1c4m`h+R!<572uk|{wq0yvq z5iE+AG)dk3d|`Q*bgqas2;SW3Tn?Kpoy%e^v*hRM*lg)sBpb?+-_(t(WE&+tXbUEd zD`k9+>OSku^|B~W3~#w|#`>Eum&{-e{4m$c7&hf_wd_NYa+o*T9&cWZa2f~>mjODx&HZU4ru%SBU`yt(v!k=Wyt#aH z z`=w!#lTOc|j} z=Jp<_U}s;m`KhL+?(9zQ$V_ja%v>>(85_J(1iPcPv$dzOU4-jwZ*T0~nQmnzrkSZLoxXu1z@qCJ zu%{V~VN%E1Tupa%w)XDq>Pzo!?P=S-AHnwhB%`~hYlky1G&Bjt&0EJydfNJ0okL`s zklvbZ>Fu+mqgcl8?Tu~i0>U<%Rg1JBN~6rauI8?Gu&t*HHp~*f%~=Jk=(SLFPmUj% z92iwH>qcX<(ptxOhhyvU4Ae2;iB_4e-Okv|Xj-Z<BwG!(KW7uSq%EoIEd zRa^cc7=uFzJD@!%zvh(XheSs8l*TG-pMa$7YH2YFQr;pOYL9K^XsXMycy3%c(-Ti&(o%?(HT49LWU`F~HJ6jri6mkLS z>hB{=d+XlTb}3R~X=u_qsjH|3&mN;sss z*4^LUp6>5<#%HF<-VrpQk(_|NjUC$k8Zt}ZYT&XQ#A^icDxb-H(=$?d$PS9d5J*0lBPY3}QR zJ?(94PQll$PIvW4pjrY*u2z(*F;G|Y?zHlwtp;o3!SHH}kB0#tPt675Zo?;sQ_|nv z=Z~hSqXG673?=Atw={Pt&9t$%_VoMslp;k^S#%Anpdo8mL8VPW5j}m)x)4;QT{R^e zPkU=iUvCXCrHBcY*i5u3qEecY1C{VUh?jOec;(;-T#bzQg6WCL321~Rn~1anWtFXk z-`v=#7>63FmTs48rv|J9sINGbiLmD)XDBl=aHWIthsT2|YS8Yk-nQ+26(rOi6TO6hCnkjc`P!G<*nCza~_{msD+b{fz*sX>n?T z8k+p!bk#2fI@2~q(p=-uDh%o#BnYADjq zY#VB56a!p+fpeIR(6B06ky>MCDc4%5b$+=E#v0{o1hvLgON8xy<+F=b=1$B+wQ>-M zC`whdAd{}uQ(2k7Y?)+Jb4d^S&Ya2FxlKQOzTFR>Pui-pSz>^ts6a-hD7zimz4*Y$ zU|(29R5J2=lG^Ob8-hjP4EV^ZYaGmQ98p7LTN=~(#3!wzI-7%r z|M~RD<_gSYV`n3^x!ODg%}q7v5nqp5#!rmVyr2j7Y0_P4FwJ6BH;(f$4Pbs7V1b ztB<1GglDiw(lJzCV+s-xAlTBwzE z4(Q0;hJrSriZ%PA9zP?5^v%^~E&K_u^sisycsTdj!MBcT1JKQ{o`k_WvHt&sGmCXz^RqH=yG(iZAN(ZLRr>-2MvpX_A zFqBo2-6V3@2PD%XNGXAZ50j~M4RJYiz$iJzq>OwXg`Y*FAZv1ZFwJ)=_4ai1?$$F9 z7i{K;4%2vaFebAqW{jCCFOSr7=JGuOxLQ+cwZLd=R40P`{vb-G*=;+JFK=4fM}R@M zd?VN>-G=Ak^lZhj)e(k+N2xI{=NF^feP+66dQh$JsQaS~m3A?dys?$groAn*4pWiS zc8z?7L}%V@EuLK`0#hc;s0oBEM_UmX;4XaEYqIFb#s;}PJ=)(wdI3`M^#kN}1 zg$+x@wI^op&}1 zLd086V009n%>}KfGE$t~%mh_X)?TJCq&_w0Yctoj(>w$QT!}%cAI)yp)Zp;Q$N(16 zE*Y2}JUTRfgq9H}*+z~9OpUZcW7VTJVd@?;XkwNz-3sJhy*W;Y@$naD)E6E_=OoJzSf@5GB15?{mu_{M!{Lr4iY!PRmk~v&~Z=OWKQ|-!g5(*9t^rQ)agu0OS}e*!crjz+jgauO^ZZwMF$O z+1{6tZaxN?bkSV~eCB5tX)3Jjd95=9b(6kK3+XuD`zR9#=vrkROkuRP`gk55-ux%vQLLyQ7)^h1yh?S zFx`epv%nnmk8#~RJgZ?isB+uG`amT*PR>kBH;<1^Phwr!;59A5 zsIX9N^<7!GgJN@M4TK)GxB1;%1*wNqX-*FL^o5gJy859EVTddW!D2rhL8su#CO^-QDf`;c2(^p@Rw-rs|@5=R7@-FBiWzM-{|< zG!sHTgk1&S;9yoY3ZNQYr0WUuHA-Wkr9p}jcbH|I#kD51qh)LJn}>Zy>6Bf~X)DFq zPzFO!D=LdoD+4R84&*dMK9Q=q2Mt=)yMOG+X-oqO5^`3V+H9KvbEj7xlp~UJ8rkq| z7T{nIiMfJF(b(C>*#XUm{cVJ85ZSk1A4wBs!Ga)tJxS`Z+~QFP0eJP1L3>hC~_tTJ-#9?m{RJWFcV6c zP#(oRi;oD+vS&d0O|dLf@Ev*@FLAK6qo)R(8KBq4Ibp z<0H*V5g)W&us6^wLxr&h)L3hpHRy#f4>6dlf75ac_6-n|iVXGFJ*~}s4t$Z!WSW)% zqjRjL$>7{bG)o4mp=H%rciNb`3Ng%dQNnP{fvMHI<3p3<%5R!59+fFiQ?BP%GJ)UU zHD*_IWc-Ao+2k}#Gi_I76?&kzkS~tKuCHfnRMO8#Y18 z;w@Kz3?(X2EgfWaq}-}_Wds!ZnZrX;H<e zSD*@!1j}{tQ*`glRZ-PFi>}B{S5xmSmO&I-0%gsa9Bs})i{MHnbjdPoKGTf|vm8#N z1FGSu-p8&%Q%9Tbi*~BMXmDn7Qmtv4N*EOWKq_c_+I4`{9?4_1ZP(SZdy)~e>xa2+ zdKf#q`+B4&P9K__P?2gH5gJC1wP|2x2$PF?4{tEX!{m-GLNpEzW+tYw4LZ|7JBKZC z6Tr(V5T?7av$>-s-Lk*4v7@aS8@;fxyD#0;y0fjb#lhV#Saa2TcKtcPj?umgb)7%G*En(dBj0^3DGWeRf(&^};r|p-9{lTr5H11Dx7^76S>(J#`>T^1` zV}nGfI6qI{zU^(>yV7uQ4-X&d=xQ36%IHj{4yY$Iu5Ac&*TaX0F-J&5!yrKnyAGH% zE0fyC+ycV=!lE4Y*C3qECJ3UVw;OCRD744thda4NP|ZWACS-VX2sAsLt<8EHGa0A{ zAie$ATdemBYmxQs?{4Lcr{Cd3M4;-U>PAD{J1{yilIb2ddmD&GQ6k$K`u0JnfdqQ; za*}>Fqsg zdpVSrMI9bKtaeHei57=iPCA^vVrF2>(h3yOlNrnmABPm%x&wx&T+ZltdSGQUNldV22Wq%|2lyCh5USSd zxjAOW2h3{G(7e65Eg%loGFQLR(Pb-lz=G{vdY=K2YE|jO!I~+vJj!^B(|%nWM=U_USFPHkt`?nCQJW%bpfcwk)6Gof(3h7F3Qm8hn8 z0Lr%?Xt=sZR6U7dia)_f`c;8Az}0DY1KJWy`!?v%`1JI+TA^kx;p4P6U@FNpbiXR7 zxb$;jsFNPqEeT{1CGeLkD_8{UVDj+oxOd$Asfk{FR_(^TP z2I;;l+d3<2pQ|n9@@|yIggP|koVH=YE!~ctp2)F+otJRdC_K4r zCj`R^HI~SoR^uE!F*rS`CQ}6j4C*kJ)ygAkVTHk?*}9nMK6hZ& z$P64BmSG0wdK`>2XGY-XboI1c>a^~q-eQvmE^jpbt_(exjGhRGs`j=vL!dYkN0vw$ zPGzQB_R7XyGv!XDP`YbDv|vXW@bti4#G#n3{+?zFi7udde5$i4K&@l3Te}B6VdsuW z$*P&KeC1Zbh>m11X^@^A7#c?J5g;OrKGYVW8&m~g7Q)V!bk}zD((P7qPIA)CZ9UEX z*vTEB2{^*~Vld*@cSm~@e9-_>W9%IsJDQ{3;6|=!OA0t@*NmxRa}vguRo}qa(V(D! zq#g{$0)l*QXiD}}pP%l%0-M|Yggsl*h?{nR0qw(&RtPE6FhazKY8b%n>4&qLqvQZ0 z$}OX-Gu-D(W%Wzf)HY5IqMCU)mjz9Z6IhOX!szDRoWL|*i)UZ;lW)-?{}0VtlbY=%HgH~8`jwhO`Od}=(iU8tW-L$8LHY5 zCFMvda>OzuhJZqyCEBcXG?-0ulCxFh(*z+UC?Mca%kXh<$j~9XzJ2<2c}f++nfvt_ zaK+$g4m3K&_MUy@a?gJGzBE7)=FBVx0qr!%g^o+c=GJ6%4kKtQQtRHf)*dz6DJOSx z5E`K0lfsBcca?${5jC}l0JCxIJ(_nPRl;@SA9)% z9=m&c(!IUSkhOBAOdiNXiDEl8p~CCOTrZq1B`^b{ofsVRR0rE~#M8ybFdMcZEeAkZ zfm~q9--J8S)W3Z@4trphs}18RV^d5PP^Aa_L;m!TUvt=?el?;s;1+>tzl7eMZQEf{ za~ELeAn9#5O$W!htrrKYTl>&!U}anlYt)pQ)7R6~t*2sUD-~N*InROd{dRawy*q(s zGBbUAV8j{6A$ggaF}r9@efq!(<0lI5D5|zLB`Q8Q+F~=}7ba*$_X!Gym7;B?1U=}_ zClg)&e5|t0vx|;2H*e3c22G9qEopcot!Z_;02gX!7lBM@fV*g&eY{TtvtT(D)s`6N zym$6s9r#jFopckthMZ4-XV=}|$?nWHa-!D!W zRH;+BZ@z4lz}SYAic+pD>h27y1}c7JEH|!HPCj9X6q0E~4;MhTq z3abpdiP+WET|=+5{-B%6U371E8-(V!@i01U`zFsrC7DJSqSw+8G*j9(qgOWPG?BoX zLzlDb8fF`7hHm2TeucM>IIv#Q?-joFReQM%`*LelDC4X`2|>=PZoG;?`sr|Q z5-_+n2ZtrqS8cq=@%Zpy2FrA~-U|D+*{aoHWxN#5uwEHHu`Fr*GH-!1>$axm_Nuap zo3*MD|0^IoEY;a@1WZsAazKhX#x$1KLaYq1Z^_oXpt0&!s+>{yuX3-KK6E9Ovd07= zRmw7K+cA&tTQ;AwS%l>-J4Ab)#%C_0ioimHLou3v`7F6yIfQjx?DX{)Mj=|YJ2zOD zGZM{BF8p@cRAIOD0Mb~%ebr&gW>@c=)=6i{R~ftf+*}K>CX2+d=H+h7w%X>>`P}6O z9hZ!+Lu3THnZtyuRS0ac%1mOxSnkB({NBJw-#ExuO&0RX(yM?|r|RH=M$k4>2lR%l zSqD9Q&r;5gKTp-eT#Yh4#ELu^w8I?&4e*2-t#90pW(Fo?&qAm!otYCj*2p^saV&3y z@1NUAxTb-zW0=z7ZdWYU;8HnAIh`Jw8c(Z(EzTI1s;3Z#hA}qoq^Ax|9<#HyVixsO zuh3Gwt+FnxtlH7sT!kAQvFT`(?{EZqwR;e|JDuiySyC+oWLR$P6u zM$;V1Vi>*`w@LTJCv&EcM1mw(^bp)FeG3P3~#dN57e45tQps?K9ELPMo5N z`eKEd?uT2g?}(HRWhY*AN@L!U83jkL#EnOAwGoy?3)q=pE@_-Q^<^uEC$T@J^Y|!8 zGJxDi+Nf_mMT)viwE1WT_rl_~1@;m=QpsIqlY$DDpH8RQqrH&sX%O!W9&|7cLu<+i zCa6vI1v3t2w5N{BrJw5BSKPqLn4ZiqOMd}cahTar7IzM^dI}#!p{|t`^pVO+T+8@a z#zAJBQMDk0+iQJ9xfm!IP#kM4f4Q4yt*0crsw`Au>v8ufP<=R8mzFJP6nDtFYlg zWQ5-rt{!8@`I7QcoR1zxMaIX5;4#f`l;X5^HMS^*>+7ATaSL?c@ZhnY3@(R}b|Cb; z0G;FxD!!?n2FHwl%$Q}Wb#ww-uebnUS?YcSb)VkEt&K0BP`#vZa&V$~dc5akyX;JN zOt5WCEDNtZHc?_mMD1)k^{5X@7@UgmCoV+?XcsVDJsGN=&K6t}p=J=dZ|9`bI0egw zQyjx1(YZaHO|8(XiC3~h7@vbG1&3}=O+V?HWUkOgmRWPyT_XZrSliV0nUN941{R*@ zD^DQ94i|3b$zb=^$Y~2|KscaGV%rpkW@B>S*Xhdn5d6HM@p0;udE|}uP7~r=5HI|) zQ$(yLRoXd?@$=DV8Z1R`A5T%>4re75K1d9@B!#c5Bi*(g-g+N4EXX6eXO;#PYQ(Ma z$1`ngZ-)nX9^+&m71P-_IH5$Q*@_{M%8D6ROm!l2RE&eVu#2mBv47Rn_~B`8BdgLE z`&ad0cVlL{N{^HV$Jy#pip^_8M(7FXFvan59vm$Or!>iJAT3W-q>UNEW#L3uqQ4j0 zXM7h(_2PiKl*z=7Q~E5R-UzaRv2oEhJ2Gir25dkm+mN+$=2Ry#7)7fd<0d|itq zKqk%D0BxC)!u^tzcMvMPdoqK?4s3L=DH8jlqk8$OgZ>G1Q;z^O%?ytWNmY7z*^|V< zKkVQsguw|T58bd~xOIb3fKV+6Mm=MktCMwvW(btcnM#kPk71TlPd}d2yhN4NE(cXA z?#jS!5qSn;kj;DaC)AyMm_lX}D1%jPRfjU5yebi#kON4<#BOZI=2im~LKMj8lc?Lf zE<>}S9oPNAjvSN5WCE=x;RRvd!Mx+%#7j%V`|Z2N9DGYYQBiDk=$K*##6qlavfy{) zq{8SFcK@D)$AJO@J8rgicFBF#?HO~OwXyGN-l}IGUUMPFP_H=o(KRedze$?_^uvu~ zuUoQA2!(Qs(+|B>O;eKme8El#PM@RT=3soIMxtt~2$r`DfZC2Z3x?)X6%mYt^Aw@x z#b+r(twYWNp!RFb0UKkt*F}cnASLh5jr>^qdKs=I#(20->7v z3TmJ%(yT|58m7``B4zd!kr!2weSb)G+0Lwy!nU@pR%H}`L4ro#%m7blX zEZo0a?u66*hJrnBC@{1noaekBI~)9_6~wE` zdiFJj>38FUI`Zco^4P~8Lgr(*uNt`lB1|YXf-t|&hoP2qEuSd2phI|l8cnIsiz>gP zJ*^u0>@;PCDDl06+_AY!2*LVwvAB_=s36MkJxo-j^0N_~j~?HnDRJi3&UZ?0cME^J zEX#meEyR><5sj>=S+Zssx*XUdHOcBaPi5&(m2RlcV}eg6dUC1|k=qi1+zBP!YmU zpEXv?4mfYsA=l$0FvgGK!$SG{n0j8s-%qRO<^288LV-yc#LV{;J}8qvPa)ZLF5?d& zEhjPn+(W>Bmefo5L%^`;9@j`?PW9aczFdHPr=Q6~h>AH|@8<6aKAuz9a5o33R~(C(twt>EJ{rkcfyh6EV`!K^M}D zB8r1Fvglqwql0v0aC9(nfiT@b=KnkA?sLz5R60t#W=*g5X6@|rKmUF9+2`Y)d+)io zs#cDexW}B0P6VsTgy|DoW9rQ`7MSoR$>_15~K~NWq9hQ8yXx>Ph>6_w*yVA|5 zvEC8tWS@(g?Q>D*OBe|>eieYZRnojp71QY0W(s-3=FBiGr*p*4bB4tQ!7v0GEqhzU z-sB8J*+IdpT~_P%z=oyZ7G?Qv8S2b<=AUJmg1?n;Vxq^7bLp@ez>iR#u7N1%{KDCm3_H7RGAGiXMwNDZ>>#FfgqSV9fxEj}G;fd7<4(W0R9A@(Sz z*Bg|jsy?|{3R@Mk4h3E=p(gZ|K0OXS?i80F_Ls2zj}jF})r;1;g~Bo)KxW&5tr=v` zGMPbZ=4?gmESoXU%fm~q;x^PF$%$IO=6rn8#IpPUoIT|I#+#siJA?^&_&+Hvx;fdB zOu)xEVZr;BOzxMcg(%;`uz)?GtY;h>mXH?(6W0%+M;}nu<9RD0dedcv`@vm;x4Num z6osNQ{x-n_l99>rNqv8kt;i26^D$=|>a&q#1np2d%oWRvZd&uRF*680^J5uJmpm~< z$;fsHHeWol%@aeEjBJg4+YM$izDt4w^eUeYJqEu-qB>E_BtAY;&7MF}E+07FE|d&Q z&f9~g0M}zHNWPVfT7;uZoaq$_`jAhDfZ)F`Q4!P=E?Go9<8x8Z`CJs`^MUPD&Ms%r zg4*qpt*F~wvJG{oOSYiycF9)MewPdrw@dI+$#F>~nR(V8l9x+HC*{HCetqO}W!d=j zEBi`GbQexw$G^)p1T{wD<0N&WCs1PpLF!~rpvDElYQg0w<#J(0f=dX-bu<|1kU_0Mr^Gisj1H-OXvPoNeBf>e_yP!|S*)Dlmi zmIcCEMqMzpz$~H`K)>J7je8oU&zI1erL=}{sDPe`{aJxo;;>QEV$&?9Fy7;3HBo}= z1#w56p-kLGE~1XIN{@Y#{=SP&)CKuDo>e(5v^j1+{b)9k6U&NCM+3*GD#nu`-jRO(o@zH5=1^2-~Ch8W-hHwzTP}%kq=6S!YVCguu{MpAMTn@Rvw5 zvMA{MkYmu}3|diUkliF%2uEwW@xQ~|2@ev4@YWiR+Q_34L_6q$Z$|Bq}pmx8-0|q;tK?@3lVM%3@IW~RN5Ho{t&b`g@M`=M;!7&VuJ%Gn>@H>p~F+Kb% zF!(puPg-jSb^K{q8Am6TA0#8@G)>AL5VRlNlnkGf&m3avMd!iWcFQ?-n>)|0NYG>7 z?bf%kRvrA8B&rKFO0=FAQCQ{|fXucfvt1F}W>>%432^n;S<;mNA6nI9o6 zUo#^BHF&?PUT7Vj)HDl6Vf@yDEDJL++XK5eSo zLxPgj+qx(7(HaMoP4J(l=8T6~MB}hc^pz52p>S81e8R@V;?`V0GJFrAdxNm;Vg{T( zM#rc7Z7OoR^BK;cy@KCxS>Z;r*2}%3wLiS-fHW17wvg@+_QiuoE1pHUUq)IUDF38S zT5;2HkV=Q!KjWiy=4dl9EH1;7a<=>LhsE5Oj-Dwn$iA98rU6szO$h;`Cy#gOu!zEs zQ=S4wLFWU;V7xPEMVUc1Lohhm8ML9yAd8Wlb0ma-Uggsv1o$};g@A(2hk(HXXV8i= zgDeCL{=^xyq0Ar)!Mf=WIc!6Z)c^Au!se2-F?uL_yCH_D`3H8uz+57slhE6JIy3=( zokXh%sz*Wu&3i~yJ%OT}C#=!rd`5z2^iw_^Jj3sj$TR9Tmn@?8`CQa@d@hRe`5LUI zngI?q7#}T;c?U-&tmN+bz@AV=(`-ukKh7XR8ZeNN231@pn zf_}=ULnnZrNqKZ~I)1Zv8?PzvO-Xd0?M%E`GEBPQ)8VQCUoTO_DCm3-W(F;>K{m#j zK`RFDa?XmV(_FF@b%xJHQAKou5!5J`)q?WH+fm*y+>~KB!WlNByy1$>Fx-exZlZ*# zgx=uOp~>)*C2BHijZ3zpu*|o9l5#L&aM2e_)Vr&se7SHBM%hax)QaBg)1g-Qeu-*D zLFcRLNe!q9iyI}X>L#gMeA4DBme)&$C!>$-A#sD_n^Bm$d=gX=O-11C5<)~j2c_n zd^)_e#`Z5HiV$^|OJ0P!+vlPl^|`3WeJ<*GpNl%^b5Sq&T-1v`7v+=ThghifM#r|G z?s3T?3U9tOq`b2tiooC6OdonH>RyR9Dp2M`4`M>zNqg)hyT>Jx?XF}S%EuW#R@tGf z>pY9{>`D~jjH1_PpEY|@xKXgmHQA`n+lM6~V_h(w4KwYK3j9XGsG&E!$ECwa!PhHK zBZX>~_=!xa)f1>%owq&;Lv2E7+%(gYNT@l-6GjFeIy2n-AhB_b_sZTH5 zd;;9>In;Mz&N`4tpOMf;^oTR^^9BBA615RkFIpXp!ZP2+%(f-7EylK48xIC&Vd}o5 ztk-;1Z%QSus^(!-sg_dU|592W{c=rt_`?$QGzvQ3y_rEvY>@S7X3!cN zWRnG-zm*Uo`gNZUA;SM3i9$d@=R?R0T4IAN1d6;Vp$2sQdtExz03PA<67-lF9(-cT zqbJnxlZDSod319P-y__c^5|_fJow6#M;{o1zd?EG0n|Q;?*UTxcmhSaeAnEh9E?UJ zW0GM>Q&`MzOY_-M&UTV4x7HfJ-;mIM=%;)-^dJ1g62*sl+$D>sCwwl7Liymxc}9X; z^s_!a3O%LZ^1~GZJk{qV=xsh7&M5fV5`}=Oy5tHJmicMC$pv)kfFGc0{ID=xZ zly?>u;04OM(6P;zNOk$7om_akQbME9g)?0`1PXthM1i9AyJS1+fX_vps6x85peUaY zpPY#jYCuo+=`b3`s|KTocA$IH*dS{^9?wZ@K(DT;0lX&V(StQS`0A8L@2=s&x1~IK ze+>`5H|5cf*YMycQXV~OqU(*&17n0w^mz&T0-p|J0RLWzdI&YcCEHP0<~s}93C^Ge zWd>PiH7j?eglCzHrB_Sj*ycl3a9c`WDZM>U13%+v?LtXk@6(|v;2TmNy|ab~e=g?pOLu5K>B5$4jlpi4-y56g3b@rxcBKnS%L%f89p5xz>k;60SY?r zV1sflmEZtO4GVhC= zMG}HR@9^p13x26YzEFcMSwvx(_eIWi5`3W__37XX{x2l*h1%zmMHH5KU*tR{!56ym ztb8ZI|E)y6P?JULnFobs-WNI3CHO+G^64<-@aIe93k98bK+Yu+9H6T{9UQ=SO5^|q zop(UaW(f|^SNe2t0RQhLa)5$gS$7y%-2mzw`v^r9hB6>^E>+9!){DUg}za;U7be5Nu zx4hc&;}y|qKB@#g!KcTdclmUq#Q?s==OyU7d^&VDc1LtLd;OxCTO@i3TxhOK3NBCo z?N;8tR1QcZ`~n-Kn#!QG*^}Ox%3kR@5km>wy%B#vX?|Zttu1-{;tGBh1;78n>LJZ9 zfG~T@H~cTv_}-ohKgIno_4m7$r!Iar{8;wb@Kc4yvin2v*1!DB+)DjW)oMwX#PW%S zAGSiqyPpa1<4&3%K|=W1BYxV5A2C`f*^&xB;&7}uvEe5V5WccU#_3Zlgs;_)RsLAK zwSzBPtC2s;KU#Tg`P$QX(tJK<`2Tlp?IY%~`Ut|}B|SS8KF+fIT5aVmpO1I=n8Gk= zzHC5vGj93E(%AC88{s{++1J(w_l(5ypH=#~RCot$`J{PaitsiQ;f0^^qhm6q14|{aQRM=TV*il2+ zNwfM%vu|a7NVCg?u$hFgX@rbPWrDPoC(Wi1!e$WClgc(}vm?#s3Bqm&!tMmZMgdaL z1FqSV=Hc8h>D8$WM){<9$VPaWHha=MJR>|bBgad|NG?c)=U0R$Q-mi_D^HpyPK0Me z%O}nA9P&^qJg^}=sUbXnAv|~$B+aStScUL(gz#9zgAUIs?g>Zt;5>HlxPWl0k8qog zaEpy_r;KpJi*TnqDA}FLK52y8Rivu>0*jwCw@2I(aT~;~&rXT)q`6x`xJyB}H!z+w z*MEfTzU9v?DCPd%bW-;&C6Al0-%459@}Z@T$%ru{myWKR+n5==e<*{K>&MldQuprR zX*!0(%i1$Hw|}mR;%Ui zHTw0*6}9enJWiJ#_Z%az*Rvm2l4df~!+zx(9cFesLyj3tk_BX>huKXP<^goLq`A&L zYx<1T&Wg+sChhD-%kJ7FF&~(k-T6wJzm>9EDZ4ooN)LP3{ddA<_xgK%y|F(_H_6U? z;{t#BN-P}akB=*2yQgkSl23jim<4Wajoo=O>XJX5{8l@@3yl5UyQ(hPL*vrJxGRJ$ z4ORS4b%}oDBplX`>y(2XS96YW_tYg{E%`M6!yz}PTFM>Yedn;`FBcig>e{QUxZeJY zhb4zbW_H#u_b5x<-*3$7HN%pR9cL)>agw(S#Fy6(OCAg;v!l*oQU24v(!r8A-~EEWm;b`hQA<;Tt0iKRd$k z57ywU7e+e&>|@DHM_s~sZwKuy2(YK+^L%^miZDF;T`|8u!tm^Y#r%}8FXh|I-dN0c zMVRvJo5j4%A6;_XTRJc^t4^5q+I(Ua2Cquz8}=8cIJQrni)l!@^uHa}{=u61Z;Wt3 z#_ZquGQNLyM;Lx@4QB7o?BUt7i!pn5hKYZd2l~Gu`W~8d*^f`Q&*$r}YHuknf3VIR zG-#hTJFGl=cd`9ogbO0r*Ngd`5r$_EF6QrxFg$y2G5=5vz91}E4ap8~=>E6(*ei?6 z|0?XG`T4^hn(+lC*h7mkducIdPc6pmt;LvqHpBG)810=IE-1m?nql~2gyGq9i}`~Q zhG#F%crbf%hVl1$SpORmT_(d}{lT7_&-CNnAC|?2nizs18|SX_RL_OJ{WlwfZx#_W?BroA_YWxFByD^Ixp%|Cl&vHi;tE{I^y zEanSgAIr}V_R?a$7-7n@cNX*8A`H)-TFgIGgB!zTrXhL28@m53e)inr^7n@YxFLCD z2z&PA%)X!m`*Viruh*jTPkO@rZ}qWv7u$~u`*yxR*wc&o!3Y;bu-6y!kJjMT(R%uf z48fGM^;h?QKpn>=ztI2Sg0%6I!)3Q2c~$v#Sp3;OqmS3^F*+lU*=zJ={QSQ$^7n>0 zlQw_ZzN8}1T6m_)H;K3Fb64cApnUc$rF7IK<7D40tZQnp-yQJ<<+HyjrK2wSpzOaO zJV^-u1!?v?rF7IK=ZpWIaF3Aj?1eg7{DtDD2`@-_#(P7=7lhd}mC~W#o+$eP;md{0 zAA6~e7Qa#aVc{(i&mODs_}>!Yg79F3;UA4KJbSTHI(+-slQoR}k_Z=s*{_ZH9TA3S z4>#tYj4(WVyD|S<4SqT7*VQFgsJ-Ahx~A0WAMxys=Hs>E!S&KMAMel)Wqbd}C3-wa zz%lvB6aRsCc*OPp%R|&Zp~ikv zgbOOl9=7-3`(r_b;n~}c`K}1Vv+o`ATWauK4O#zvRq=u2`>P#kY2yFx5bwZwd)cOi!1c?T0? z-o+TE{@D>O2=ksM=2t}+o_9AfKNw+n-su>Bwc5k;wVz-0uD$w%0y7=QB{$Pv;W<*a z-Ze-4arY4Yk-abS>(|bxKH5|NPW|VOhGhQ`<+Jxnb;&ox->UNb)e5^l@s7!tuS*^g z|4m_TY2fkyV8j=Mc^@UEqb~W0?7t^GPRQ(^jQE1`d1oc1qb~WC?4K64`tg4#;tRqr zNB9ldzamV&`5&wISb{oyfA9{>@Cn-DI7OISSZg2e#*9Bz{F%ayDNp@P5nmAIJ(`q` zy5ua`w+N3HviiFszMy>GwMpryOQy@dTX?dN*4%`|kP_VvYTOmi@Ig_CJXDf~>1uZ(!?d53BCKa%~YgyZq-k9h2P*J<|8$$mgM9v|L;8qfUM72$#~ z??+?)t_Z{P&NSxli!eOzQe(cq=6cf;-lO{Sv+0AG{cjX6c$6I2{nngl{W&5Yyu|T- zy^*i}vP}G`if>RhHa~Yn@fMWNJ8mf*zCTum{qTn5q9Oce@58ZJe2t#hIp5&FB;2C= zUqS|dP53K1-|^`W zg}V~ppJO!x&#vKT2=AQY=igY3@7x-GnXn$W3aU=^4NE$NuTp##|Ard-PYZWO{k2_q zvG(uS$tT_~3g4glBcA=j*JyvFnDXBhj^qDv4gRU{&AK13_Wq)Ve^q#^>f4?AtJf=w zpU6LRi26?!{)GDPjuf9Ge5?AG{-=M>7mn+168^UKJGmdCd|CJ>dS0~pZxFsfYbpo* z_j%#fQTx6md}D;~6~0FPxL?BGW5Vyzd@%n{3-5}?<9`T$MDd=H+W(U<=PT_wN&D#y z3gocHe@DunDtxQ@-~3M$R$B|A72mMrT;b7*-{#{y;Srtr_B@%pH6+@6mMck6uSe8s+9_&AM+!f?1x_-6I5 zjn97&K1KV*O)39*;q6iVcM6}X`81gF2ZVbf{=W%-MLhnQZ%+!(iTLM)_@9KK1~#k{WS`|67|PNga>qem2&NEsj=@6-WA2yBW&yA z*kpLJRoK?!v05*82ycn(Zx;Tx#_PV+|Cfb-to6|P_p8GFk^TL`H!B{SACCyf@&BFh zLbaFqO8@;*_)BWf?9~4&!f`y>;z;&K{!b8&{hcn{qWyBKZ;J3$@^9zQJmKr3^2>$4 zsramaR|%``f~t4(_flcIezG2vh3Bfh3)1+u3vZ3qliP$3MCJdB@TWAtcBb~<7QRaT zXY1|vgukHpcw}V0{!BP-&##45wjkQYqi6TzY0YoGTfly#CbGS+bLW%rsXE`y|3u*v zbpA;>`*W4}yztl*&k!C^e~nA=JoxDPv`qK}%|EkWAv{z5E#83|`>TaNRM5AJslS_r z--zbtmxXsk?KvP^r~TSOYX8^5as59Mo)XzVB|M=1l5+FqAC%Y|@rQ&zp!H%#>hA`qbp_;i8(nk3w*^UvnTJmD)8?;R;$6#iLsed!ebiR#ldbmc!ST#f46E<70F&k8Gq zg3R4`-75Tu=EsyeU;aD7ar^#8SaT`Z|Gn^%2>(yvKaZ}Dzpg3&Mh$Mzh54?i{CMFv zbiJ9PcxeAj;h(F0`kcezj|%_qXnYn4>)a0Uv&0(`WB-Zva*L7u7~yN8 z{ySYbwx2AlpBr!o=lARyexb1168fX1hVKymXf&U$5Z(~kUnhK3v>t!1ru-L$KM>s? zeyxUoKzLJh{(ZlO|6Ac~{jN`*ui*~~$M+wal)3hwDEtBWxBl0+7RjG0-cjli=F8c_ z7ewuuB^XbVc~ItO~H9Zj9RT|K38QrTLmmNtbVYm>zb7O$8(vvFo)vM5bW zOSWuUJFR0~PiJL={@%I+>-)R=EL~YU;FJ8Z?KG9~9h*9}SFJE(MQZB76b#E@ENY*m6m=+Nmf5*P0KXYGB z@^D^fr8KvzE6wJw%Fojma~r+YMdj{lDZ*`^?yj!g5M`)ju`j|4%W~)IsrdSrbZ+e% zs3vRr`n==Ce9X6oDqN~}^Cm@F?cP)>OKFKVN^cT>()Y<|5c74Jh6c^PlRZQDF zZ)>&WGSWXW@9>tj{qw7Rt)tyXI(62xSu>L~bIX!a?|OB#@@9p+#l6ktzV+o& zr9%FPL%y3ZMMXsR?4+|&DY*#N$ZuC)A8}f8d4H)l2Po#+DkBY-|9|eRQlUQTO%AFwJ1#tDV&WXD@@ct-WhEWZdGeG%Z(4^+BfhGLJ7LUFB`Q zausyF)w!v;T?k&AIbIt|;}EO64{h+R>4B=M6Mp zUC+41#Vs4jTzBFu>g?_r&~)kOSmBnRN;1E*H$89DA>*VexA$uWcC*Uo+OSqjU5T6* zJ1ZNLrp|KLqTB+l#k`|^Zfmh)ep82)NXT5YWNuqihfUee_4?{~Yo*w&9<;T6acj#* z6q6cOPLys8!~%VnyhL->t%_o11}3XNEjLfAnrn8m#<^`pFr25MTA-!EafCB}?y?S@ zi1RuJy2@(ieAd4FS@~Kd`ubnbrm8F0MhRyhTL!=u)R2f6?--%cXO8UZ{yuZS&hZ<}X=3|Kqfz zxm51%-%u)d_PDkzDwi%BDD|%08m=zwS~cl@yS`|d)f~{*-hR?4-r3e@VsA8HHMRHB zNAkd$r?a%XT1nhQ@h5)Cog}U?>F_J4bXs*Wf>DE9gl<-Rtal@d1;?>zh4KQ)~GfxIuw%k=G?XIQEJN!BBMhD-aS~sMjU!cMXvAk`5Q!^7T z*Slf1$o9Ofn>1E3^C!c!;4cfx-JLXRF{rq^2iF)pWVULWGfH&QSOc|qt10DblP)5z zyJiR1Dy)G{Cy!q?yE}V2D*fv3u;$b0v}uMJY6SdLviVAF7RItZ!3yZ)cCzc~*Hp0|;8Bb63AGydpvs>MZMvY1vhfiu31c2!pV#pNh5p zq$%vYX`K9>3{{0CN6mN3L9{#&WLV5{(`Qp(m%kzoG2q!8QSs@aEg`h*`X81AS~S!8 zwPqDaZ=f*Aoe;sETeSSbpG~d!Zj+ll*P!T5DNHcjXA6;B4movN-PFN0>oz|`wuolq zV)sh!WT4{glH;!Ts(@Twq%0o0?RJw0Dw`nDvg;l@2q7!z{JEjc?wnje>PmNS7*_JI Vcvo^WRcDSZZtiTdTTkcn{{o)zCA9zm literal 0 HcmV?d00001 diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Debug/openblt_xmc1400.srec b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Debug/openblt_xmc1400.srec new file mode 100644 index 00000000..2bc799ee --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Debug/openblt_xmc1400.srec @@ -0,0 +1,461 @@ +S01700006F70656E626C745F786D63313430302E73726563AD +S31510001000500900201910001000000000991000105F +S3151000101000180400000100001149124A124B00F09A +S3151000102018F8124880471249124A134B00F011F86B +S315100010301249134A134B00F00CF81349134A0020B7 +S31510001040521A02DD043A8850FCDC114880471148D8 +S3151000105080479B1A03DD043BC858D050FBDC704711 +S31510001060502B00100C0000205001002075110010AC +S31510001070942C00105009002054090020982C0010C0 +S31510001080540900205409002058090020940C00200F +S31510001090A927001099270010FEE70000024A936E58 +S315100010A001218B439366704700000140004870474A +S315100010B0002D310138B51D4B1B681B041B0E1C4A35 +S315100010C0136026D019480268FF211140194C21607F +S315100010D0C26903252A40120211432160C269920592 +S315100010E008D49B02C918144800F0C4FA0001134B27 +S315100010F018601AE0FFF7DAFF80010D4B19688902B4 +S315100011000C4B1B68C91800F0B5FA00010B4B1860A0 +S315100011100BE0064BDB699B0503D4094A074B1A60A3 +S3151000112003E0FFF7C3FF054B186038BD000301400D +S31510001130580900205C09002000001BB7FC1F002086 +S31510001140006CDC0208B50749C0234B62064BD86910 +S31510001150064A0240DA61064A1A60C3234B62FFF759 +S31510001160A9FF08BD0000014000030140FFFDFFFF7D +S315100011700001F13F08B5FFF791FFFFF7E3FF08BD48 +S31510001180034A9188C0239B010B4393807047C04646 +S3151000119000000540014B188880B2704700000540DA +S315100011A008B5021C82235B001B68081C111C98479B +S315100011B008BDC04670B5051C0E1C00240BE080232C +S315100011C05B001B68281C9847FFF7E4FFC307FBD496 +S315100011D00135FF350134B442F1D370BD08B5102185 +S315100011E0FFF7E8FF08BDC04608B5FFF7D9FF08BDF1 +S315100011F0F0B54F464646C0B48B08994604339B005B +S315100012001E5803250D40ED00FC27AF40BE431E506F +S31510001210436F4F000326BE40B3434367CB081033DA +S315100012209B001C5807260E40B6000427B740BC4347 +S315100012301C501F58BC465778B7403E1C67463E4365 +S315100012401E500C4B984204D1036E01268E40B343B8 +S31510001250036653688B4043604B4604339B00195812 +S315100012601278AA40151C0D431D500CBC9046994689 +S31510001270F0BDC04600020440C322014B5A627047BB +S3151000128000000140C022034B5A62024B5B6A5B07A7 +S31510001290FBD470470000014010B5041CFFF7F2FFA5 +S315100012A0054B1A6914431C61034B1B685B00FBD486 +S315100012B0FFF7E2FF10BDC04600030140014B18685E +S315100012C07047C046FC1F0020F0B55F465646C0B4B6 +S315100012D085B083460F1C454B9A4600230293039311 +S315100012E001253AE03B689800C0184000291C00F020 +S315100012F0C1F901907C68211C00F0BCF9061C0A217A +S3151000130000F0C2F9052905D9301C0A2100F0B2F9FE +S31510001310461C04E0301C0A2100F0ACF9061C002E15 +S3151000132006D0B10089194900019800F0A3F904E02C +S3151000133001980A2100F09EF90126A04201D3041B50 +S3151000134000E0241A142E07D8A24505D9284B9C4232 +S3151000135006D9A246029603950135402DC2D901E061 +S3151000136002960395214E0124402512E0681C1F4B5E +S315100013705843029900F07EF93B89834201D8C21A7C +S3151000138000E01A1A964201D9161C2C1C984202D358 +S31510001390013D022DEAD8029B191B5B461B684022B1 +S315100013A01343584603608B1E1903E023DB011940D3 +S315100013B0081C7B89013B9B01FF210B401843071C2E +S315100013C0013C2402F0231B011C402743039B013BD5 +S315100013D0C0390B401F435B461F611B6893435A4637 +S315100013E0136005B00CBC92469B46F0BD102700005A +S315100013F0E703000010B5E2235B00C4583D33FF330A +S315100014001C42F8D10131120402231A430906114372 +S31510001410C333FF33C15010BD10B5041C80208003A8 +S31510001420FFF73AFF236801229343236023689B0743 +S31510001430FCD410BD10B5E422520083580F24A343E8 +S315100014401943815010BDC046E4235B00C058BA3B17 +S31510001450FF3B18407047C04608B5FFF7F5FF012857 +S3151000146002D0022803D005E0FFF728FF03E0FFF7BC +S315100014701DFE00E0002008BDF0B5474680B4051CEF +S315100014800C1C161CFFF7C8FF281C211CFFF7D2FFE7 +S31510001490281CFFF7E1FF041C311C00F0EBF8802735 +S315100014A0FF003F1A194B9F4200D91F1C8021C9000B +S315100014B0C91B201C00F0DEF88046B009A409800282 +S315100014C0211C00F0D7F8114B984200D9181C444340 +S315100014D0A40AA4014346F21A341B002394425B412A +S315100014E0DBB2002B00D0381C002B01D0012300E00A +S315100014F00223E968064A0A40EA60EA689B03184331 +S315100015001043E86004BC9046F0BDC046FF030000DF +S31510001510003CFFFF10B5037E012B18D10368202273 +S31510001520DA61046821680B4B1940037B1B06F02215 +S31510001530120513400B432360036802691A6103689E +S3151000154042695A610368044ADA61002000E0032008 +S3151000155010BDC046FFFFFFF04000280010B502681E +S31510001560204BD318990A49039B05DB0E1B020B432C +S3151000157094681D4921409160026891680B439360FD +S31510001580037E012B2CD803682022DA61C3799B06CF +S315100015900ED441684B0F5A078B04134302689361AC +S315100015A081684B0F5A078B0413430268D36005E01A +S315100015B0036842689A6103688268DA60041C037ED5 +S315100015C0012B06D1FFF7A6FF236880221205DA61E8 +S315100015D003E0036880221201DA612368034ADA61A4 +S315100015E010BDC04600F0FBAFFF00FFFF4000A00695 +S315100015F00268D169D369DB05DB0F890606D5012B95 +S3151000160006D0E023DB04D361002002E0042000E0D2 +S31510001610022070470268D169D3695B07DB0F0905A1 +S315100016200FD4012B0FD01369036153694361D1693C +S31510001630D3691B07DB0F490707D5002BF3D1002011 +S3151000164004E0032002E0022000E000207047C046BC +S3151000165030B58B0804339B001C5803252940C9005C +S31510001660F9358D40AC431C501C588A40111C21433F +S31510001670195030BD034B04225A6318625962986A96 +S315100016807047C04600000340034B04225A63186299 +S315100016905962D96A986A70470000034070B5051CF4 +S315100016A00E1C00F0EFF8F479002C00D11034281C31 +S315100016B03168221C00F050F8B379013B5B006408D6 +S315100016C0013424021C43114B1C43EC633379013B58 +S315100016D01B068122520013436B637379002B05D0CE +S315100016E06A6B013B1B0413436B6305E0696B32792C +S315100016F0531E1B040B436B63A023DB00AB63012358 +S315100017005B42EB6433892B6470BDC0460100030055 +S3151000171084235B00C258E023DB041A4208D1836B92 +S315100017201B06FCD480239B01C3648023C15002E0B6 +S31510001730C0235B00C150704786235B00C258E0236C +S31510001740DB041A4202D1406D80B203E08E235B00A7 +S31510001750C05880B27047C046F0B55F464E46C0B41A +S3151000176083B063293DD9002A3DD0151C0C1C834635 +S31510001770FFF7A4FD6421FFF77DFF8146201C64213D +S31510001780FFF778FF071C1B4E012301930093341CAF +S3151000179011E048466043291C7943FFF76BFF830A23 +S315100017A08005800D134A934204D8B04202D2061C1B +S315100017B001930094013C002CEBD180231B02009F67 +S315100017C01F435B461F615A690B4B1340013DAD0227 +S315100017D01D43019E013E360435435B465D61002084 +S315100017E002E0012000E0012003B00CBC91469B46AC +S315100017F0F0BDC046FF030000EF8000FC70B58425E5 +S315100018006D004659064C344044514659054C264005 +S315100018101B02194314060A1C22433243425170BD5F +S31510001820FFFFFFF8C0C0FFF870B586256D0046595A +S31510001830084C344044514659074C26401B02194364 +S3151000184014060A1C22433243802149050A43425199 +S3151000185070BDC046FFFFFFF8C0C0FFEF08B5074BCD +S31510001860984203D10820FFF717FD06E0044B984273 +S3151000187003D18020C002FFF70FFD08BD0800004805 +S315100018800840004810B5041C9023DB05984202D08E +S315100018900C4B984203D10C48FFF7E0FF08E00B4BC6 +S315100018A0984202D00A4B984202D10A48FFF7D6FF57 +S315100018B00323E360E368DB07FCD5236C0F22934315 +S315100018C0236410BD0002004808000048004000488C +S315100018D000420048084000487047C04672B670473C +S315100018E062B6704730B585B0FFF7E8FC041C00E01F +S315100018F06400484B9C42FBD900E06408464B9C426E +S31510001900FBD846480121221CFFF7B6FD01A9019418 +S31510001910434B4B60FA235B010B8101254D81414CF2 +S31510001920201CFFF7D1FC2268402313432360236851 +S315100019301D4325603C4A3D4B1360D3793F210B4034 +S31510001940BF390B43D37153685B0F5B0738480343AA +S3151000195053609168490F4907014391601B0E20207F +S315100019608343D371090E20231943D17208231373AD +S31510001970002305E02C4AD218002111740133DBB282 +S31510001980072BF7D9284801230376FFF7E7FD2348ED +S3151000199001210022FFF72EFD264A274B1360D3792B +S315100019A03F210B40BF390B43D37153685B0F5B0765 +S315100019B02248034353609168490F490701439160D8 +S315100019C01B0E20208343D371090E20231943D17295 +S315100019D008231373002305E0164AD2180021117448 +S315100019E00133DBB2072BF7D9124800230376FFF732 +S315100019F0B5FD0A4801210122FFF7FCFC094B1A68C4 +S31510001A0040218A431A601A683F398A431A6005B022 +S31510001A1030BDC046FF1AB700000E2707000004505D +S31510001A2020A1070000030450600900200010045094 +S31510001A30E10700008009002020100450670600000E +S31510001A4010B50F4B1973002305E0C45C0C4AD2186D +S31510001A5014740133DBB28B42F7D3094C201CFFF709 +S31510001A6059FD23680222DA61201CFFF7C1FD01E04F +S31510001A7000F010FC024B1B68DB699B07F8D410BD05 +S31510001A806009002010B5114B1B68DB69DB071AD5FE +S31510001A90041C0E48FFF7BEFD002809D000200DE0FB +S31510001AA00A4AD218127CE2540133DBB2012001E05B +S31510001AB000200023054A127B9A42F1D8034B1B687B +S31510001AC00122DA6100E0002010BDC0468009002026 +S31510001AD008B5FFF703FF08BD10B500F00FFA002890 +S31510001AE00DD000F0C7FD002809D000F08DFB00F0E6 +S31510001AF015FA00F007FA4468FFF7F2FEA04710BD8A +S31510001B0070B508E0461C4D1C0B78037000F0C2FB44 +S31510001B10221C301C291C531E9CB2002AF2D170BD07 +S31510001B2038B5051C002419E000F0B4FB63001B193E +S31510001B309B000C495958A9420ED863001B199B00EB +S31510001B400848C3185B68C918A94205D963001A1951 +S31510001B5092008218107A04E00134E4B22F2CE3D9F3 +S31510001B60FF2038BDF427001038B5051C002410E0FE +S31510001B7000F090FB63001B199B00084AD3181B7AD0 +S31510001B80AB4204D1630019198900885805E0013465 +S31510001B90E4B22F2CECD90120404238BDF4270010B6 +S31510001BA008B5FF230B4209D103688B4208D002C047 +S31510001BB080225200FFF7A4FF012002E0002000E07F +S31510001BC0012008BD38B5041C0068FFF7A9FFFF28DF +S31510001BD026D0FFF7D5FA00F0C9F9451D211C01C919 +S31510001BE0FFF702FB05E000F0C1F9A8421AD800F091 +S31510001BF051FBFFF7CFFAC307F5D4FFF7CBFA00284E +S31510001C0012D1002308E02268D2181278D2B2E11855 +S31510001C1009798A420AD10133FF2BF4D9012006E053 +S31510001C20002004E0002002E0002000E0002038BD83 +S31510001C3038B5041C0D1C0C4B984207D00B4B99421F +S31510001C4006D0FFF7BFFF002803D109E0084C00E0DB +S31510001C50054C201C291CFFF7A3FF002802D102E027 +S31510001C60002000E0201C38BDA00900200030001024 +S31510001C70A40A0020F0B5474680B4071C0C1C151C9E +S31510001C801E1C0B0A1B0298460368013304D14146F9 +S31510001C90FFF786FF002827D03B68434505D0381C40 +S31510001CA04146FFF7C5FF071E1BD03B68E41A3C19D7 +S31510001CB0043400F0EFFA3B1DE31AFF2B08D9434614 +S31510001CC0591CFF31381CFFF7B3FF071E0BD0041D3C +S31510001CD02B78237001340135013E002EE9D1012005 +S31510001CE002E0002000E0002004BC9046F0BDC04693 +S31510001CF0F8B5051C0F1C88422AD802282AD9322981 +S31510001D0022D929E000F0C6FA281CFFF72DFF061C81 +S31510001D10431C23D0FFF734FA00F028F90A30041CCC +S31510001D20301CFFF75BFA05E000F020F9A04217D847 +S31510001D3000F0B0FAFFF72EFAC307F5D4FFF72AFA28 +S31510001D4000280FD10135EDB2BD42DBD901200AE0E2 +S31510001D50002008E0002006E0002004E0002002E059 +S31510001D60002000E00020F8BD01235B42024A136008 +S31510001D70024A13607047C046A40A0020A00900203A +S31510001D8070B5041C0D1C161CFFF7CAFEFF2818D0D0 +S31510001D9060190138FFF7C4FEFF2814D0230A1B026E +S31510001DA00A4A934206D10A48211C321C2B1CFFF703 +S31510001DB061FF09E00748211C321C2B1CFFF75AFF54 +S31510001DC002E0002000E0002070BDC0460030001088 +S31510001DD0A0090020A40A0020F8B5061C0C1CFFF769 +S31510001DE09FFE051C30190138FFF79AFE011CFF2DC6 +S31510001DF005D0FF2805D0281CFFF77AFF02E0002047 +S31510001E0000E00020F8BDC04600B583B00F4B1B683C +S31510001E10013318D00D4B5A68986884466244111CD9 +S31510001E20DA68944661441A69944661445A6994463C +S31510001E3061449A698B185B4201930548042101AAF3 +S31510001E40FFF79EFF00E0012003B000BDA0090020AF +S31510001E50183000100C4B1A680C4B1B68D3180C4A20 +S31510001E601268D3180B4A1268D3180B4A1268D31883 +S31510001E700A4A1268D3180A4A1268D318002B01D1DD +S31510001E80012000E0002070470030001004300010E0 +S31510001E90083000100C3000101030001014300010F4 +S31510001EA01830001008B50B4B1B68013304D00948D5 +S31510001EB0FFF788FE00280CD0074B1B68013305D0AE +S31510001EC00548FFF77FFE002802D102E0012000E05E +S31510001ED0012008BDA0090020A40A00200048704770 +S31510001EE00030001008B5FFF73FFF08BD08B5FFF733 +S31510001EF047FF08BD08B5FFF76FFF08BD08B5FFF728 +S31510001F00A9FF08BD08B5FFF7E9FF08BD08B5FFF73B +S31510001F107BFF002801D0FFF7C5FF08BD0022014B4B +S31510001F201A60704710E000E008B5FFF7F7FF054BA1 +S31510001F30054A5A6000229A6005211960034B1A60FF +S31510001F4008BDC04610E000E07FBB0000A80B0020D3 +S31510001F50044B1B68DB0303D5034A13680133136074 +S31510001F607047C04610E000E0A80B002008B5FFF748 +S31510001F70EFFF014B186808BDA80B002008B58A238F +S31510001F805B000B4AD358DB0410D481B2101CFFF748 +S31510001F90BFFB8A235B00064AD358DB05F9D580219F +S31510001FA049008C235B00D150012000E0002008BDC1 +S31510001FB00002004810B58A235B00064AD3581B0757 +S31510001FC006D4041C101CFFF7B7FB2070012000E09C +S31510001FD0002010BD0002004810B584B001A9E1230D +S31510001FE01B02019308230B714B71073B8B710F3347 +S31510001FF0CB7100230B810C4C201CFFF74FFB201CD0 +S31510002000102104220123FFF7F9FB201C00210422D2 +S315100020100123FFF709FC236C0F2293430D3A134358 +S31510002020236404B010BDC0460002004870B5061CFB +S315100020300D1E402D03D91048752100F071F8281C8B +S31510002040FFF79CFF012803D00B48792100F068F8B0 +S3151000205000240CE000F01EF9305DFFF78FFF012819 +S3151000206003D00548822100F05BF80134A4B2ABB26C +S31510002070A342EFD870BDC046342A001038B5051CEF +S31510002080234B1C78002C13D12248FFF793FF01280D +S315100020903CD1204B1B78002B33D0FFF767FF1E4B2C +S315100020A0186000221D4B1A700132194B1A702DE060 +S315100020B01A4B18780130174B1818FFF77BFF041EC0 +S315100020C0012C12D1154B1A780132D2B21A70114B5B +S315100020D01B789A4217D192B2281C0E490131FFF78C +S315100020E00FFD00220A4B1A7010E0FFF73FFF0A4B54 +S315100020F01B686433984208D90022054B1A700024D5 +S3151000210004E01C1C02E0002400E00024201C38BD62 +S31510002110F10B0020AC0B0020F40B0020F00B00207C +S3151000212008B500F0B7F8FCE708B500F0ABF80128E1 +S3151000213010D0094B1B78012B0CD1FFF717FF074B5B +S315100021401B68F533FF33984204D30022024B1A70F2 +S31510002150FFF7C2FC08BDC046F80B0020FC0B0020A0 +S3151000216008B50122044B1A70FFF700FF034B1860E5 +S31510002170FFF7DAFF08BDC046F80B0020FC0B002065 +S3151000218008B5FFF7A5FC00F081F8FFF7CDFEFFF7C5 +S31510002190A9FE00F00DF8FFF7E3FF08BD08B500F043 +S315100021A079F8FFF7D5FE00F013F8FFF7BDFF08BD6D +S315100021B010B500F0E5F9FFF795FB044C01232370E9 +S315100021C0FFF70AFF0023237010BDC04650090020F8 +S315100021D008B50B48FFF756FC012805D10122094B1B +S315100021E01A70074800F0EAF90548FFF747FF01287B +S315100021F005D10022034B1A70014800F0DFF908BD23 +S31510002200000C0020500900207047C04638B5051C48 +S315100022100C1C094B1B78012B02D1C9B2FFF710FC1D +S31510002220054B1B78002B03D1E1B2281CFFF7FEFEED +S3151000223000F0BCF938BDC04650090020074B1B788A +S31510002240022B05D0032B05D0012B05D0402004E02E +S31510002250002002E0002000E008207047500900200E +S31510002260074B1B78022B05D0032B05D0012B05D06D +S31510002270402004E0002002E0002000E00820704723 +S315100022805009002008B500F089F908BD08B500F01E +S31510002290F7F908BD08B500F0F9F908BD10B5002327 +S315100022A004E00178CB18DBB20130211C4C1E00294A +S315100022B0F7D11360012010BD0022014B5A707047F0 +S315100022C0400C0020034BFE22DA7018710221BA3A34 +S315100022D099527047400C002010B5054C002323700E +S315100022E0FFF7EAFFFF23E3700122BB3BE25210BD6A +S315100022F0400C0020064BFF22DA7000221A71597822 +S3151000230059719A71DA711A720621443299527047CC +S31510002310400C002008B50020FFF7D4FF08BDC046CA +S31510002320094BFF22DA70094A9A6400221A715A710F +S315100023309A710721D971002119725972997208314F +S31510002340442299527047C046400C0020482B00107A +S31510002350044BFF22DA7042689A6401214422995292 +S315100023607047C046400C002010B5084CFF23E370A0 +S315100023704168E21DA06CFFF791FF20710023637185 +S31510002380A37108224433E25210BDC046400C00200F +S3151000239008B53120FFF796FF08BDC04638B5084C82 +S315100023A0FF23E370002525716571FFF747FFA071C4 +S315100023B0E5712572657207224423E25238BDC04684 +S315100023C0400C002038B5FFF777FF0D4C012525701E +S315100023D0FF23E370EF3B237100236371FFF72EFF9A +S315100023E0A071FFF73DFFE071FFF73AFF000A207278 +S315100023F06572A57208224423E252FFF773FD38BDB9 +S31510002400400C002038B5051C4478FFF717FF01383B +S31510002410844203DD2220FFF755FF10E0084C201DF3 +S315100024206A78A16CFFF76CFBFF23E3706B78A26CE4 +S3151000243094466344A3646B7801334422A35238BD97 +S31510002440400C002038B5041C4578FFF7F7FE01381C +S31510002450854203DD2220FFF735FF11E06168094D43 +S31510002460A964281D6278FFF74BFBFF23EB70637896 +S31510002470AA6C94466344AB64637801334422AB522E +S3151000248038BDC046400C002038B5041C0E4B9D6C60 +S31510002490FFF7D4FE411E621C281CFFF727FD0028FB +S315100024A003D13130FFF70EFF0CE0074CFF23E3702A +S315100024B0FFF7C4FE0138A36C9C466044A064012259 +S315100024C04423E25238BDC046400C002038B5041CE7 +S315100024D04578FFF7B3FE0238854203DD2220FFF769 +S315100024E0F1FE21E0114BFF22DA700121BB3A99521D +S315100024F06178002907D1FFF709FD002814D1313082 +S31510002500FFF7E0FE10E0094B986CA21CFFF7EEFCFB +S31510002510002803D13130FFF7D5FE05E06378034A72 +S31510002520916C8C466344936438BDC046400C0020C1 +S3151000253008B5094B9B6C4168181CFFF7DBFC00289B +S3151000254003D13130FFF7BEFE05E0034BFF22DA70F0 +S315100025500121BB3A995208BD400C002008B5FFF77F +S31510002560BBFA034BFF22DA700121BB3A995208BD20 +S31510002570400C002008B589B2FFF748FE08BDC046DA +S31510002580054B00221A709A6443215A5401315A524B +S315100025909A705A707047C046400C0020024B18784B +S315100025A0002800D001207047400C00200021432352 +S315100025B0014AD1547047C046400C002008B5037834 +S315100025C0FF2B02D1FFF7FEFE38E0284A1278012AC7 +S315100025D04AD13733DAB2352A2DD89300244AD35844 +S315100025E09F46FFF70FFF29E0FFF72CFF26E0FFF7C6 +S315100025F0AFFE23E0FFF7B8FE20E0FFF791FE1DE0E7 +S31510002600FFF788FE1AE0FFF775FE17E0FFF764FE86 +S3151000261014E0FFF739FF11E0FFF758FF0EE0FFF760 +S31510002620BDFE0BE0FFF784FF08E0FFF797FF05E01C +S31510002630FFF7AEFE02E02020FFF744FE43230B4ACD +S31510002640D35C012B02D11020FFF73CFE4423074A2E +S31510002650D15A0BB2002B07DD101C01224323C254A2 +S31510002660033009B2FFF786FF08BDC046400C0020B4 +S31510002670702A001008B500F049F8012008BDC046C0 +S3151000268008B5642000F006F808BDC04608B500F08D +S3151000269013F808BD38B5051C054C201C00218022F6 +S315100026A0FEF7D6FF01236360024B1D8038BDC0467E +S315100026B0000404408E0C002008B5FFF757FC0F4BA2 +S315100026C01B68984218D30E4B1B78002B07D101229A +S315100026D00B4B1A70802252020A4B5A6005E00022F8 +S315100026E0074B1A700132074B5A60FFF73FFC064B37 +S315100026F01B88C018014B186008BDC046900C0020FE +S315100027008C0C0020000404408E0C00200122014B8A +S315100027105A6070470004044030B589B006AA0025F7 +S315100027201570194C201C0321FEF762FD04AA9C2388 +S315100027301370201C0221FEF75BFD144BDA69502141 +S315100027408A43DA61DA690724A243DA6102AA1570AC +S315100027500F4D281C4839FEF74BFDA4236A4613700B +S31510002760281C0921FEF744FD0A4B1A684020024333 +S315100027701A60DA68A24302210A43DA601A688243B1 +S315100027801A6009B030BDC04600010440000200487E +S31510002790000404400003045008B5FFF7F1FCFFF7EE +S315100027A0BBFFFFF7FBFCFCE70E4B70B500251E1CAC +S315100027B00D4CE41AA410A54204D0AB00F358984768 +S315100027C00135F8E7FFF788F8084B00251E1C084C62 +S315100027D0E41AA410A54204D0AB00F358984701356B +S315100027E0F8E770BD54090020540900205409002050 +S315100027F054090020003000100010000003000000F3 +S3151000280000400010001000000400000000500010EE +S31510002810001000000500000000600010001000000D +S3151000282006000000007000100010000007000000F5 +S31510002830008000100010000008000000009000103A +S31510002840001000000900000000A000100010000099 +S315100028500A00000000B00010001000000B0000007D +S3151000286000C00010001000000C00000000D0001086 +S31510002870001000000D00000000E000100010000025 +S315100028800E00000000F00010001000000F00000005 +S3151000289000000110001000001000000000100110D0 +S315100028A000100000110000000020011000100000B0 +S315100028B0120000000030011000100000130000008C +S315100028C0004001100010000014000000005001101C +S315100028D0001000001500000000600110001000003C +S315100028E01600000000700110001000001700000014 +S315100028F00080011000100000180000000090011068 +S31510002900001000001900000000A0011000100000C7 +S315100029101A00000000B00110001000001B0000009B +S3151000292000C00110001000001C00000000D00110B3 +S31510002930001000001D00000000E001100010000053 +S315100029401E00000000F00110001000001F00000023 +S3151000295000000210001000002000000000100210FD +S3151000296000100000210000000020021000100000DE +S3151000297022000000003002100010000023000000AA +S315100029800040021000100000240000000050021049 +S31510002990001000002500000000600210001000006A +S315100029A02600000000700210001000002700000032 +S315100029B00080021000100000280000000090021095 +S315100029C0001000002900000000A0021000100000F6 +S315100029D02A00000000B00210001000002B000000BA +S315100029E000C00210001000002C00000000D00210E1 +S315100029F0001000002D00000000E002100010000082 +S31510002A002E00000000F00210001000002F00000041 +S31510002A10000003100010000030000000001003102A +S31510002A20001000003100000000200310001000000C +S31510002A3032000000433A2F576F726B2F736F667414 +S31510002A40776172652F4F70656E424C542F546172C8 +S31510002A506765742F536F757263652F41524D434DE1 +S31510002A60305F584D43312F756172742E630000002C +S31510002A7012260010362600103626001030260010BA +S31510002A8036260010362600102A26001018260010AA +S31510002A90242600101E26001036260010362600109A +S31510002AA03626001036260010362600103626001060 +S31510002AB03626001036260010362600103626001050 +S31510002AC03626001036260010362600103626001040 +S31510002AD03626001036260010362600103626001030 +S31510002AE03626001036260010362600103626001020 +S31510002AF03626001036260010362600103626001010 +S31510002B0036260010362600103626001036260010FF +S31510002B103626001036260010F4250010E825001081 +S31510002B20E2250010EE25001036260010362600107D +S31510002B3036260010FA250010362600100026001042 +S31510002B40062600100C2600104F70656E424C54007D +S31510002B502C480047000000000000000000000000A4 +S31510002B60000000000000000000000000000000004F +S31510002B7025480047000000000000000023480047D9 +S31510002B802348004723480047234800472348004767 +S31510002B902348004723480047234800472348004757 +S31510002BA02348004723480047234800472348004747 +S31510002BB02348004723480047234800472348004737 +S31510002BC02348004723480047234800472348004727 +S31510002BD02348004723480047234800472348004717 +S31510002BE02348004723480047234800472348004707 +S31510002BF023480047234800472348004723480047F7 +S31510002C0023480047991000109910001099100010D1 +S31510002C1099100010991000109910001099100010BA +S31510002C2099100010991000109910001099100010AA +S31510002C30991000109910001099100010991000109A +S31510002C40991000109910001099100010991000108A +S31510002C50991000109910001099100010991000107A +S31510002C60991000109910001099100010991000106A +S31510002C70991000109910001099100010991000105A +S31510002C80991000109910001099100010991000104A +S30910002C909910001071 +S30910002C940400000022 +S70510001019C1 diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Include/cmsis_compiler.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Include/cmsis_compiler.h new file mode 100644 index 00000000..1003929e --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Include/cmsis_compiler.h @@ -0,0 +1,223 @@ +/**************************************************************************//** + * @file cmsis_compiler.h + * @brief CMSIS compiler generic header file + * @version V5.0.1 + * @date 30. January 2017 + ******************************************************************************/ +/* + * Copyright (c) 2009-2017 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. + */ + +#ifndef __CMSIS_COMPILER_H +#define __CMSIS_COMPILER_H + +#include + +/* + * ARM Compiler 4/5 + */ +#if defined ( __CC_ARM ) + #include "cmsis_armcc.h" + + +/* + * ARM Compiler 6 (armclang) + */ +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #include "cmsis_armclang.h" + + +/* + * GNU Compiler + */ +#elif defined ( __GNUC__ ) + #include "cmsis_gcc.h" + + +/* + * IAR Compiler + */ +#elif defined ( __ICCARM__ ) + + #ifndef __ASM + #define __ASM __asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + + #include + + #ifndef __NO_RETURN + #define __NO_RETURN __noreturn + #endif + #ifndef __USED + #define __USED __root + #endif + #ifndef __WEAK + #define __WEAK __weak + #endif + #ifndef __UNALIGNED_UINT32 + __packed struct T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __ALIGNED + #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored. + #define __ALIGNED(x) + #endif + #ifndef __PACKED + #define __PACKED __packed + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT __packed struct + #endif + + +/* + * TI ARM Compiler + */ +#elif defined ( __TI_ARM__ ) + #include + + #ifndef __ASM + #define __ASM __asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __NO_RETURN + #define __NO_RETURN __attribute__((noreturn)) + #endif + #ifndef __USED + #define __USED __attribute__((used)) + #endif + #ifndef __WEAK + #define __WEAK __attribute__((weak)) + #endif + #ifndef __UNALIGNED_UINT32 + struct __attribute__((packed)) T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) + #endif + #ifndef __PACKED + #define __PACKED __attribute__((packed)) + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __attribute__((packed)) + #endif + + +/* + * TASKING Compiler + */ +#elif defined ( __TASKING__ ) + /* + * The CMSIS functions have been implemented as intrinsics in the compiler. + * Please use "carm -?i" to get an up to date list of all intrinsics, + * Including the CMSIS ones. + */ + + #ifndef __ASM + #define __ASM __asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __NO_RETURN + #define __NO_RETURN __attribute__((noreturn)) + #endif + #ifndef __USED + #define __USED __attribute__((used)) + #endif + #ifndef __WEAK + #define __WEAK __attribute__((weak)) + #endif + #ifndef __UNALIGNED_UINT32 + struct __packed__ T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __ALIGNED + #define __ALIGNED(x) __align(x) + #endif + #ifndef __PACKED + #define __PACKED __packed__ + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __packed__ + #endif + + +/* + * COSMIC Compiler + */ +#elif defined ( __CSMC__ ) + #include + + #ifndef __ASM + #define __ASM _asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __NO_RETURN + // NO RETURN is automatically detected hence no warning here + #define __NO_RETURN + #endif + #ifndef __USED + #warning No compiler specific solution for __USED. __USED is ignored. + #define __USED + #endif + #ifndef __WEAK + #define __WEAK __weak + #endif + #ifndef __UNALIGNED_UINT32 + @packed struct T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __ALIGNED + #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored. + #define __ALIGNED(x) + #endif + #ifndef __PACKED + #define __PACKED @packed + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT @packed struct + #endif + + +#else + #error Unknown compiler. +#endif + + +#endif /* __CMSIS_COMPILER_H */ + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Include/cmsis_gcc.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Include/cmsis_gcc.h new file mode 100644 index 00000000..a4ad21a0 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Include/cmsis_gcc.h @@ -0,0 +1,1899 @@ +/**************************************************************************//** + * @file cmsis_gcc.h + * @brief CMSIS compiler GCC header file + * @version V5.0.1 + * @date 02. February 2017 + ******************************************************************************/ +/* + * Copyright (c) 2009-2017 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. + */ + +#ifndef __CMSIS_GCC_H +#define __CMSIS_GCC_H + +/* ignore some GCC warnings */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wunused-parameter" + +/* CMSIS compiler specific defines */ +#ifndef __ASM + #define __ASM __asm +#endif +#ifndef __INLINE + #define __INLINE inline +#endif +#ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline +#endif +#ifndef __NO_RETURN + #define __NO_RETURN __attribute__((noreturn)) +#endif +#ifndef __USED + #define __USED __attribute__((used)) +#endif +#ifndef __WEAK + #define __WEAK __attribute__((weak)) +#endif +#ifndef __UNALIGNED_UINT32 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpacked" +#pragma GCC diagnostic ignored "-Wattributes" + struct __attribute__((packed)) T_UINT32 { uint32_t v; }; +#pragma GCC diagnostic pop + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) +#endif +#ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) +#endif +#ifndef __PACKED + #define __PACKED __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) +#endif + + +/* ########################### Core Function Access ########################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions + @{ + */ + +/** + \brief Enable IRQ Interrupts + \details Enables IRQ interrupts by clearing the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__((always_inline)) __STATIC_INLINE void __enable_irq(void) +{ + __ASM volatile ("cpsie i" : : : "memory"); +} + + +/** + \brief Disable IRQ Interrupts + \details Disables IRQ interrupts by setting the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__((always_inline)) __STATIC_INLINE void __disable_irq(void) +{ + __ASM volatile ("cpsid i" : : : "memory"); +} + + +/** + \brief Get Control Register + \details Returns the content of the Control Register. + \return Control Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_CONTROL(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Control Register (non-secure) + \details Returns the content of the non-secure Control Register when in secure mode. + \return non-secure Control Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_CONTROL_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Control Register + \details Writes the given value to the Control Register. + \param [in] control Control Register value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_CONTROL(uint32_t control) +{ + __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Control Register (non-secure) + \details Writes the given value to the non-secure Control Register when in secure state. + \param [in] control Control Register value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_CONTROL_NS(uint32_t control) +{ + __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory"); +} +#endif + + +/** + \brief Get IPSR Register + \details Returns the content of the IPSR Register. + \return IPSR Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_IPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get APSR Register + \details Returns the content of the APSR Register. + \return APSR Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_APSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, apsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get xPSR Register + \details Returns the content of the xPSR Register. + \return xPSR Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_xPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get Process Stack Pointer + \details Returns the current value of the Process Stack Pointer (PSP). + \return PSP Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSP(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, psp" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Process Stack Pointer (non-secure) + \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state. + \return PSP Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PSP_NS(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, psp_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Process Stack Pointer + \details Assigns the given value to the Process Stack Pointer (PSP). + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : ); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Process Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state. + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : ); +} +#endif + + +/** + \brief Get Main Stack Pointer + \details Returns the current value of the Main Stack Pointer (MSP). + \return MSP Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSP(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, msp" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Main Stack Pointer (non-secure) + \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state. + \return MSP Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_MSP_NS(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, msp_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Main Stack Pointer + \details Assigns the given value to the Main Stack Pointer (MSP). + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : ); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Main Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state. + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : ); +} +#endif + + +/** + \brief Get Priority Mask + \details Returns the current state of the priority mask bit from the Priority Mask Register. + \return Priority Mask value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PRIMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Priority Mask (non-secure) + \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state. + \return Priority Mask value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PRIMASK_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Priority Mask + \details Assigns the given value to the Priority Mask Register. + \param [in] priMask Priority Mask + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask) +{ + __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Priority Mask (non-secure) + \details Assigns the given value to the non-secure Priority Mask Register when in secure state. + \param [in] priMask Priority Mask + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PRIMASK_NS(uint32_t priMask) +{ + __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory"); +} +#endif + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Enable FIQ + \details Enables FIQ interrupts by clearing the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__((always_inline)) __STATIC_INLINE void __enable_fault_irq(void) +{ + __ASM volatile ("cpsie f" : : : "memory"); +} + + +/** + \brief Disable FIQ + \details Disables FIQ interrupts by setting the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__((always_inline)) __STATIC_INLINE void __disable_fault_irq(void) +{ + __ASM volatile ("cpsid f" : : : "memory"); +} + + +/** + \brief Get Base Priority + \details Returns the current value of the Base Priority register. + \return Base Priority register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_BASEPRI(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Base Priority (non-secure) + \details Returns the current value of the non-secure Base Priority register when in secure state. + \return Base Priority register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_BASEPRI_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Base Priority + \details Assigns the given value to the Base Priority register. + \param [in] basePri Base Priority value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_BASEPRI(uint32_t basePri) +{ + __ASM volatile ("MSR basepri, %0" : : "r" (basePri) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Base Priority (non-secure) + \details Assigns the given value to the non-secure Base Priority register when in secure state. + \param [in] basePri Base Priority value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_BASEPRI_NS(uint32_t basePri) +{ + __ASM volatile ("MSR basepri_ns, %0" : : "r" (basePri) : "memory"); +} +#endif + + +/** + \brief Set Base Priority with condition + \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled, + or the new value increases the BASEPRI priority level. + \param [in] basePri Base Priority value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri) +{ + __ASM volatile ("MSR basepri_max, %0" : : "r" (basePri) : "memory"); +} + + +/** + \brief Get Fault Mask + \details Returns the current value of the Fault Mask register. + \return Fault Mask register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_FAULTMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Fault Mask (non-secure) + \details Returns the current value of the non-secure Fault Mask register when in secure state. + \return Fault Mask register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_FAULTMASK_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Fault Mask + \details Assigns the given value to the Fault Mask register. + \param [in] faultMask Fault Mask value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Fault Mask (non-secure) + \details Assigns the given value to the non-secure Fault Mask register when in secure state. + \param [in] faultMask Fault Mask value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory"); +} +#endif + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) + +/** + \brief Get Process Stack Pointer Limit + \details Returns the current value of the Process Stack Pointer Limit (PSPLIM). + \return PSPLIM Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSPLIM(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, psplim" : "=r" (result) ); + return(result); +} + + +#if ((defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) && \ + (defined (__ARM_ARCH_8M_MAIN__) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Get Process Stack Pointer Limit (non-secure) + \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. + \return PSPLIM Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PSPLIM_NS(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Process Stack Pointer Limit + \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM). + \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit) +{ + __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit)); +} + + +#if ((defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) && \ + (defined (__ARM_ARCH_8M_MAIN__) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Set Process Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. + \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit) +{ + __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit)); +} +#endif + + +/** + \brief Get Main Stack Pointer Limit + \details Returns the current value of the Main Stack Pointer Limit (MSPLIM). + \return MSPLIM Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSPLIM(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, msplim" : "=r" (result) ); + + return(result); +} + + +#if ((defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) && \ + (defined (__ARM_ARCH_8M_MAIN__) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Get Main Stack Pointer Limit (non-secure) + \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state. + \return MSPLIM Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_MSPLIM_NS(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Main Stack Pointer Limit + \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM). + \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_MSPLIM(uint32_t MainStackPtrLimit) +{ + __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit)); +} + + +#if ((defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) && \ + (defined (__ARM_ARCH_8M_MAIN__) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Set Main Stack Pointer Limit (non-secure) + \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state. + \param [in] MainStackPtrLimit Main Stack Pointer value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit) +{ + __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit)); +} +#endif + +#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) + +/** + \brief Get FPSCR + \details Returns the current value of the Floating Point Status/Control register. + \return Floating Point Status/Control register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_FPSCR(void) +{ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) + uint32_t result; + + __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); + return(result); +#else + return(0U); +#endif +} + + +/** + \brief Set FPSCR + \details Assigns the given value to the Floating Point Status/Control register. + \param [in] fpscr Floating Point Status/Control value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr) +{ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) + __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc", "memory"); +#else + (void)fpscr; +#endif +} + +#endif /* ((defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + + +/*@} end of CMSIS_Core_RegAccFunctions */ + + +/* ########################## Core Instruction Access ######################### */ +/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface + Access to dedicated instructions + @{ +*/ + +/* Define macros for porting to both thumb1 and thumb2. + * For thumb1, use low register (r0-r7), specified by constraint "l" + * Otherwise, use general registers, specified by constraint "r" */ +#if defined (__thumb__) && !defined (__thumb2__) +#define __CMSIS_GCC_OUT_REG(r) "=l" (r) +#define __CMSIS_GCC_RW_REG(r) "+l" (r) +#define __CMSIS_GCC_USE_REG(r) "l" (r) +#else +#define __CMSIS_GCC_OUT_REG(r) "=r" (r) +#define __CMSIS_GCC_RW_REG(r) "+r" (r) +#define __CMSIS_GCC_USE_REG(r) "r" (r) +#endif + +/** + \brief No Operation + \details No Operation does nothing. This instruction can be used for code alignment purposes. + */ +//__attribute__((always_inline)) __STATIC_INLINE void __NOP(void) +//{ +// __ASM volatile ("nop"); +//} +#define __NOP() __ASM volatile ("nop") /* This implementation generates debug information */ + +/** + \brief Wait For Interrupt + \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs. + */ +//__attribute__((always_inline)) __STATIC_INLINE void __WFI(void) +//{ +// __ASM volatile ("wfi"); +//} +#define __WFI() __ASM volatile ("wfi") /* This implementation generates debug information */ + + +/** + \brief Wait For Event + \details Wait For Event is a hint instruction that permits the processor to enter + a low-power state until one of a number of events occurs. + */ +//__attribute__((always_inline)) __STATIC_INLINE void __WFE(void) +//{ +// __ASM volatile ("wfe"); +//} +#define __WFE() __ASM volatile ("wfe") /* This implementation generates debug information */ + + +/** + \brief Send Event + \details Send Event is a hint instruction. It causes an event to be signaled to the CPU. + */ +//__attribute__((always_inline)) __STATIC_INLINE void __SEV(void) +//{ +// __ASM volatile ("sev"); +//} +#define __SEV() __ASM volatile ("sev") /* This implementation generates debug information */ + + +/** + \brief Instruction Synchronization Barrier + \details Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or memory, + after the instruction has been completed. + */ +__attribute__((always_inline)) __STATIC_INLINE void __ISB(void) +{ + __ASM volatile ("isb 0xF":::"memory"); +} + + +/** + \brief Data Synchronization Barrier + \details Acts as a special kind of Data Memory Barrier. + It completes when all explicit memory accesses before this instruction complete. + */ +__attribute__((always_inline)) __STATIC_INLINE void __DSB(void) +{ + __ASM volatile ("dsb 0xF":::"memory"); +} + + +/** + \brief Data Memory Barrier + \details Ensures the apparent order of the explicit memory operations before + and after the instruction, without ensuring their completion. + */ +__attribute__((always_inline)) __STATIC_INLINE void __DMB(void) +{ + __ASM volatile ("dmb 0xF":::"memory"); +} + + +/** + \brief Reverse byte order (32 bit) + \details Reverses the byte order in integer value. + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __REV(uint32_t value) +{ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) + return __builtin_bswap32(value); +#else + uint32_t result; + + __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +#endif +} + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order in two unsigned short values. + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __REV16(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +} + + +/** + \brief Reverse byte order in signed short value + \details Reverses the byte order in a signed short value with sign extension to integer. + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__((always_inline)) __STATIC_INLINE int32_t __REVSH(int32_t value) +{ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + return (short)__builtin_bswap16(value); +#else + int32_t result; + + __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +#endif +} + + +/** + \brief Rotate Right in unsigned value (32 bit) + \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. + \param [in] op1 Value to rotate + \param [in] op2 Number of Bits to rotate + \return Rotated value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2) +{ + return (op1 >> op2) | (op1 << (32U - op2)); +} + + +/** + \brief Breakpoint + \details Causes the processor to enter Debug state. + Debug tools can use this to investigate system state when the instruction at a particular address is reached. + \param [in] value is ignored by the processor. + If required, a debugger can use it to store additional information about the breakpoint. + */ +#define __BKPT(value) __ASM volatile ("bkpt "#value) + + +/** + \brief Reverse bit order of value + \details Reverses the bit order of the given value. + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value) +{ + uint32_t result; + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); +#else + int32_t s = (4 /*sizeof(v)*/ * 8) - 1; /* extra shift needed at end */ + + result = value; /* r will be reversed bits of v; first get LSB of v */ + for (value >>= 1U; value; value >>= 1U) + { + result <<= 1U; + result |= value & 1U; + s--; + } + result <<= s; /* shift when v's highest bits are zero */ +#endif + return(result); +} + + +/** + \brief Count leading zeros + \details Counts the number of leading zeros of a data value. + \param [in] value Value to count the leading zeros + \return number of leading zeros in value + */ +#define __CLZ __builtin_clz + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) +/** + \brief LDR Exclusive (8 bit) + \details Executes a exclusive LDR instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint8_t __LDREXB(volatile uint8_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDR Exclusive (16 bit) + \details Executes a exclusive LDR instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint16_t __LDREXH(volatile uint16_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDR Exclusive (32 bit) + \details Executes a exclusive LDR instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __LDREXW(volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) ); + return(result); +} + + +/** + \brief STR Exclusive (8 bit) + \details Executes a exclusive STR instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr) +{ + uint32_t result; + + __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief STR Exclusive (16 bit) + \details Executes a exclusive STR instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr) +{ + uint32_t result; + + __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief STR Exclusive (32 bit) + \details Executes a exclusive STR instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) ); + return(result); +} + + +/** + \brief Remove the exclusive lock + \details Removes the exclusive lock which is created by LDREX. + */ +__attribute__((always_inline)) __STATIC_INLINE void __CLREX(void) +{ + __ASM volatile ("clrex" ::: "memory"); +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +#define __SSAT(ARG1,ARG2) \ +({ \ + int32_t __RES, __ARG1 = (ARG1); \ + __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +#define __USAT(ARG1,ARG2) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + + +/** + \brief Rotate Right with Extend (32 bit) + \details Moves each bit of a bitstring right by one bit. + The carry input is shifted in at the left end of the bitstring. + \param [in] value Value to rotate + \return Rotated value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __RRX(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +} + + +/** + \brief LDRT Unprivileged (8 bit) + \details Executes a Unprivileged LDRT instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint8_t __LDRBT(volatile uint8_t *ptr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrbt %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" ); +#endif + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDRT Unprivileged (16 bit) + \details Executes a Unprivileged LDRT instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint16_t __LDRHT(volatile uint16_t *ptr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrht %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" ); +#endif + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDRT Unprivileged (32 bit) + \details Executes a Unprivileged LDRT instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __LDRT(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief STRT Unprivileged (8 bit) + \details Executes a Unprivileged STRT instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__((always_inline)) __STATIC_INLINE void __STRBT(uint8_t value, volatile uint8_t *ptr) +{ + __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief STRT Unprivileged (16 bit) + \details Executes a Unprivileged STRT instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__((always_inline)) __STATIC_INLINE void __STRHT(uint16_t value, volatile uint16_t *ptr) +{ + __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief STRT Unprivileged (32 bit) + \details Executes a Unprivileged STRT instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__((always_inline)) __STATIC_INLINE void __STRT(uint32_t value, volatile uint32_t *ptr) +{ + __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) ); +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) +/** + \brief Load-Acquire (8 bit) + \details Executes a LDAB instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint8_t __LDAB(volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint8_t) result); +} + + +/** + \brief Load-Acquire (16 bit) + \details Executes a LDAH instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint16_t __LDAH(volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint16_t) result); +} + + +/** + \brief Load-Acquire (32 bit) + \details Executes a LDA instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __LDA(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief Store-Release (8 bit) + \details Executes a STLB instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__((always_inline)) __STATIC_INLINE void __STLB(uint8_t value, volatile uint8_t *ptr) +{ + __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Store-Release (16 bit) + \details Executes a STLH instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__((always_inline)) __STATIC_INLINE void __STLH(uint16_t value, volatile uint16_t *ptr) +{ + __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Store-Release (32 bit) + \details Executes a STL instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__((always_inline)) __STATIC_INLINE void __STL(uint32_t value, volatile uint32_t *ptr) +{ + __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Load-Acquire Exclusive (8 bit) + \details Executes a LDAB exclusive instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint8_t __LDAEXB(volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaexb %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint8_t) result); +} + + +/** + \brief Load-Acquire Exclusive (16 bit) + \details Executes a LDAH exclusive instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint16_t __LDAEXH(volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaexh %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint16_t) result); +} + + +/** + \brief Load-Acquire Exclusive (32 bit) + \details Executes a LDA exclusive instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __LDAEX(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaex %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief Store-Release Exclusive (8 bit) + \details Executes a STLB exclusive instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlexb %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief Store-Release Exclusive (16 bit) + \details Executes a STLH exclusive instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlexh %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief Store-Release Exclusive (32 bit) + \details Executes a STL exclusive instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlex %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) ); + return(result); +} + +#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + +/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ + + +/* ################### Compiler specific Intrinsics ########################### */ +/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics + Access to dedicated SIMD instructions + @{ +*/ + +#if (__ARM_FEATURE_DSP == 1) /* ToDo ARMCLANG: This should be ARCH >= ARMv7-M + SIMD */ + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __QADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __USUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __QADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __USUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __QASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __QSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __USAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __USAD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#define __SSAT16(ARG1,ARG2) \ +({ \ + int32_t __RES, __ARG1 = (ARG1); \ + __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + +#define __USAT16(ARG1,ARG2) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SEL (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE int32_t __QADD( int32_t op1, int32_t op2) +{ + int32_t result; + + __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE int32_t __QSUB( int32_t op1, int32_t op2) +{ + int32_t result; + + __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +#if 0 +#define __PKHBT(ARG1,ARG2,ARG3) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) + +#define __PKHTB(ARG1,ARG2,ARG3) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + if (ARG3 == 0) \ + __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \ + else \ + __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) +#endif + +#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \ + ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) ) + +#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \ + ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) ) + +__attribute__((always_inline)) __STATIC_INLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3) +{ + int32_t result; + + __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#endif /* (__ARM_FEATURE_DSP == 1) */ +/*@} end of group CMSIS_SIMD_intrinsics */ + + +#pragma GCC diagnostic pop + +#endif /* __CMSIS_GCC_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Include/core_cm0.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Include/core_cm0.h new file mode 100644 index 00000000..6cdde790 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Include/core_cm0.h @@ -0,0 +1,875 @@ +/**************************************************************************//** + * @file core_cm0.h + * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File + * @version V5.0.1 + * @date 25. November 2016 + ******************************************************************************/ +/* + * Copyright (c) 2009-2016 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 (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM0_H_GENERIC +#define __CORE_CM0_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M0 + @{ + */ + +/* CMSIS CM0 definitions */ +#define __CM0_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS HAL main version */ +#define __CM0_CMSIS_VERSION_SUB ( 0U) /*!< [15:0] CMSIS HAL sub version */ +#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16U) | \ + __CM0_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ + +#define __CORTEX_M (0U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM0_H_DEPENDANT +#define __CORE_CM0_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM0_REV + #define __CM0_REV 0x0000U + #warning "__CM0_REV not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M0 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t _reserved0:1; /*!< bit: 0 Reserved */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[31U]; + __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[31U]; + __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[31U]; + __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[31U]; + uint32_t RESERVED4[64U]; + __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + uint32_t RESERVED0; + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. + Therefore they are not covered by the Cortex-M0 header file. + @{ + */ +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifndef CMSIS_NVIC_VIRTUAL +/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for Cortex-M0 */ +/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for Cortex-M0 */ + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ +/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M0 */ + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifndef CMSIS_VECTAB_VIRTUAL + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* Interrupt Priorities are WORD accessible only under ARMv6M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + Address 0 must be mapped to SRAM. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)0x0U; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)0x0U; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__STATIC_INLINE void NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1000_RomFunctionTable.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1000_RomFunctionTable.h new file mode 100644 index 00000000..d97a2b49 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1000_RomFunctionTable.h @@ -0,0 +1,176 @@ +/********************************************************************************************************************* + * @file XMC1000_RomFunctionTable.h + * @brief ROM functions prototypes for the XMC1400-Series + * @version V1.0 + * @date 03 Sep 2015 + * + * @cond + ********************************************************************************************************************* + * Copyright (c) 2015-2016, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + **************************** Change history ********************************* + * V1.0, 03 Sep 2015, JFT : Initial version + ***************************************************************************** + * @endcond + */ + +#ifndef ROM_FUNCTION_TABLE_H +#define ROM_FUNCTION_TABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* *************************************************************************** +******************************* Constants ******************************* +*************************************************************************** */ +/* Start address of the ROM function table */ +#define ROM_FUNCTION_TABLE_START (0x00000100U) + +/* Pointer to Erase Flash Page routine */ +#define _NvmErase (ROM_FUNCTION_TABLE_START + 0x00U) + +/* Pointer to Erase, Program & Verify Flash Page routine */ +#define _NvmProgVerify (ROM_FUNCTION_TABLE_START + 0x04U) + +/* Pointer to Request BMI installation routine */ +#define _BmiInstallationReq (ROM_FUNCTION_TABLE_START + 0x08U) + + +/* *************************************************************************** +******************************** Enumerations ******************************** +*************************************************************************** */ +typedef enum TagNVMStatus +{ + +/* The function succeeded */ + NVM_PASS = (int32_t)0x00010000U, + +/* Generic error code */ + NVM_E_FAIL = (int32_t)0x80010001U, + +/* Source data not in RAM */ + NVM_E_SRC_AREA_EXCCEED = (int32_t)0x80010003U, + +/* Source data is not 4 byte aligned */ + NVM_E_SRC_ALIGNMENT = (int32_t)0x80010004U, + +/* NVM module cannot be physically accessed */ + NVM_E_NVM_FAIL = (int32_t)0x80010005U, + +/* Verification of written page not successful */ + NVM_E_VERIFY = (int32_t)0x80010006U, + +/* Destination data is not (completely) located in NVM */ + NVM_E_DST_AREA_EXCEED = (int32_t)0x80010009U, + +/* Destination data is not properly aligned */ + NVM_E_DST_ALIGNMENT = (int32_t)0x80010010U, + +} NVM_STATUS; + + +/* *************************************************************************** +*********************************** Macros *********************************** +*************************************************************************** */ + +/* *************************************************************************** +Description: Erase granularity = 1 Page of 16 blocks of 16 Bytes + = Equivalent to 256 Bytes using this routine. + +Input parameters: +– Logical address of the Flash Page to be erased which must be page aligned +and in NVM address range + +Return status: +– OK (NVM_PASS) +– Invalid address (NVM_E_DST_ALIGNMENT or NVM_E_DST_AREA_EXCEED) +– Operation failed (Error during low level NVM programming driver): + NVM_E_FAIL + NVM_E_VERIFY + NVM_E_NVM_FAIL + +Prototype: + NVM_STATUS XMC1000_NvmErasePage(uint32_t *pageAddr) +*************************************************************************** */ +#define XMC1000_NvmErasePage (*((NVM_STATUS (**) (uint32_t * )) \ + _NvmErase)) + +/* *************************************************************************** +Description: This procedure performs erase (skipped if not necessary), program +and verify of selected Flash page. + +Input parameter: +– Logical address of the target Flash Page, must be page aligned and in NVM +address range + +– Address in SRAM where the data starts, must be 4-byte aligned + +Return status: +– OK (NVM_PASS) +– Invalid addresses + NVM_E_DST_ALIGNMENT + NVM_E_SRC_ALIGNMENT + NVM_E_DST_AREA_EXCEED + NVM_E_SRC_AREA_EXCCEED +– Operation failed (Error during low level NVM programming driver): + NVM_E_FAIL + NVM_E_VERIFY + NVM_E_NVM_FAIL + +Prototype: + NVM_STATUS XMC1000_NvmProgVerify(const uint32_t *srcAddr, uint32_t *dstAddr) +*************************************************************************** */ +#define XMC1000_NvmProgVerify (*((NVM_STATUS (**) (const uint32_t * ,\ + uint32_t * ))\ + _NvmProgVerify)) + + +/* *************************************************************************** +Description: This procedure initiates installation of a new BMI value. In +particular, it can be used as well as to restore the state upon delivery for a +device already in User Productive mode. + +Input parameter: +– BMI value to be installed + +Return status: +– wrong input BMI value (0x01) - only upon error, if OK the procedure triggers +a reset respectively does not return to calling routine ! + +Prototype: + unsigned long XMC1000_BmiInstallationReq(unsigned short requestedBmiValue) +**************************************************************************** */ +#define XMC1000_BmiInstallationReq (*((uint32_t (**) (uint16_t)) \ + _BmiInstallationReq)) + +#ifdef __cplusplus +} +#endif + +#endif /* ROM_FUNCTION_TABLE_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1400.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1400.h new file mode 100644 index 00000000..9c9fa178 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1400.h @@ -0,0 +1,8899 @@ +/********************************************************************************************************************* + * Copyright (c) 2015-2016, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + *********************************************************************************************************************/ + +/****************************************************************************************************//** + * @file XMC1400.h + * + * @brief CMSIS Cortex-M0 Peripheral Access Layer Header File for + * XMC1400 from Infineon. + * + * @version V1.1.0 (Reference Manual v1.1) + * @date 30. August 2016 + * + * @note Generated with SVDConv V2.87l + * from CMSIS SVD File 'XMC1400_Processed_SVD.xml' Version 1.1.0 (Reference Manual v1.1), + *******************************************************************************************************/ + + + +/** @addtogroup Infineon + * @{ + */ + +/** @addtogroup XMC1400 + * @{ + */ + +#ifndef XMC1400_H +#define XMC1400_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ------------------------- Interrupt Number Definition ------------------------ */ + +typedef enum { +/* ------------------- Cortex-M0 Processor Exceptions Numbers ------------------- */ + 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 */ + SVCall_IRQn = -5, /*!< 11 System Service Call via SVC instruction */ + PendSV_IRQn = -2, /*!< 14 Pendable request for system service */ + SysTick_IRQn = -1, /*!< 15 System Tick Timer */ +/* --------------------- XMC1400 Specific Interrupt Numbers --------------------- */ + IRQ0_IRQn = 0, + IRQ1_IRQn = 1, + IRQ2_IRQn = 2, + IRQ3_IRQn = 3, + IRQ4_IRQn = 4, + IRQ5_IRQn = 5, + IRQ6_IRQn = 6, + IRQ7_IRQn = 7, + IRQ8_IRQn = 8, + IRQ9_IRQn = 9, + IRQ10_IRQn = 10, + IRQ11_IRQn = 11, + IRQ12_IRQn = 12, + IRQ13_IRQn = 13, + IRQ14_IRQn = 14, + IRQ15_IRQn = 15, + IRQ16_IRQn = 16, + IRQ17_IRQn = 17, + IRQ18_IRQn = 18, + IRQ19_IRQn = 19, + IRQ20_IRQn = 20, + IRQ21_IRQn = 21, + IRQ22_IRQn = 22, + IRQ23_IRQn = 23, + IRQ24_IRQn = 24, + IRQ25_IRQn = 25, + IRQ26_IRQn = 26, + IRQ27_IRQn = 27, + IRQ28_IRQn = 28, + IRQ29_IRQn = 29, + IRQ30_IRQn = 30, + IRQ31_IRQn = 31 + +} IRQn_Type; + + +/** @addtogroup Configuration_of_CMSIS + * @{ + */ + + +/* ================================================================================ */ +/* ================ Processor and Core Peripheral Section ================ */ +/* ================================================================================ */ + +/* ----------------Configuration of the Cortex-M0 Processor and Core Peripherals---------------- */ +#define __CM0_REV 0x0000 /*!< Cortex-M0 Core Revision */ +#define __MPU_PRESENT 0 /*!< MPU present or not */ +#define __NVIC_PRIO_BITS 2 /*!< Number of Bits used for Priority Levels */ +#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */ +/** @} */ /* End of group Configuration_of_CMSIS */ + +#include "core_cm0.h" /*!< Cortex-M0 processor and core peripherals */ +#include "system_XMC1400.h" /*!< XMC1400 System */ + + +/* ================================================================================ */ +/* ================ Device Specific Peripheral Section ================ */ +/* ================================================================================ */ +/* Macro to modify desired bitfields of a register */ +#define WR_REG(reg, mask, pos, val) reg = (((uint32_t)val << pos) & \ + ((uint32_t)mask)) | \ + (reg & ((uint32_t)~((uint32_t)mask))) + +/* Macro to modify desired bitfields of a register */ +#define WR_REG_SIZE(reg, mask, pos, val, size) { \ +uint##size##_t VAL1 = (uint##size##_t)((uint##size##_t)val << pos); \ +uint##size##_t VAL2 = (uint##size##_t) (VAL1 & (uint##size##_t)mask); \ +uint##size##_t VAL3 = (uint##size##_t)~((uint##size##_t)mask); \ +uint##size##_t VAL4 = (uint##size##_t) ((uint##size##_t)reg & VAL3); \ +reg = (uint##size##_t) (VAL2 | VAL4);\ +} + +/** Macro to read bitfields from a register */ +#define RD_REG(reg, mask, pos) (((uint32_t)reg & (uint32_t)mask) >> pos) + +/** Macro to read bitfields from a register */ +#define RD_REG_SIZE(reg, mask, pos,size) ((uint##size##_t)(((uint32_t)reg & \ + (uint32_t)mask) >> pos) ) + +/** Macro to set a bit in register */ +#define SET_BIT(reg, pos) (reg |= ((uint32_t)1< + +/******************************************************************************* + * GLOBAL VARIABLES + *******************************************************************************/ + +extern uint32_t SystemCoreClock; + +/******************************************************************************* + * API PROTOTYPES + *******************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize the system + * + */ +void SystemInit(void); + +/** + * @brief Initialize CPU settings + * + */ +void SystemCoreSetup(void); + +/** + * @brief Initialize clock + * + */ +void SystemCoreClockSetup(void); + +/** + * @brief Update SystemCoreClock variable + * + */ +void SystemCoreClockUpdate(void); + +/** + * @brief Returns frequency of the high performace oscillator + * User needs to overload this function to return the correct oscillator frequency + */ +uint32_t OSCHP_GetFrequency(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/Newlib/syscalls.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/Newlib/syscalls.c new file mode 100644 index 00000000..0ce488cf --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/Newlib/syscalls.c @@ -0,0 +1,100 @@ +/********************************************************************************************************************* + * @file syscalls.c + * @brief Newlib stubs + * @version V1.6 + * @date 20 Apr 2017 + * + * @cond + ********************************************************************************************************************* + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * *************************** Change history ******************************** + * V0.1 : Initial version + * V0.2 : Label updates + * V1.0 : Made _sbrk device agnostic + * V1.1 : C++ support + * V1.2 : Restored compatibility with old project files + * V1.3 Jan 2014, PKB : Encapsulating everything in this file for use only with GCC + * V1.4 11 Dec 2015, JFT : Fix heap overflow + * V1.5 09 Mar 2016, JFT : Add dso_handle to support destructors call at exit + * V1.6 20 Apr 2017, JFT : Foward declaration of __sbrk to fix link time optimization (-flto) compilation errors + * @endcond + */ + +/* + * This file contains stubs for standard C library functionality that must + * typically be provided for the underlying platform. + * + */ +#if defined ( __GNUC__ ) + +#include +#include +#include + +/* Forward prototypes. */ +caddr_t _sbrk(int nbytes) __attribute__((externally_visible)); +void _init(void) __attribute__((externally_visible)); + +/* c++ destructor dynamic shared object needed if -fuse-cxa-atexit is used*/ +void *__dso_handle __attribute__ ((weak)); + +// defined in linker script +extern caddr_t Heap_Bank1_Start; +extern caddr_t Heap_Bank1_End; +caddr_t _sbrk(int nbytes) +{ + static caddr_t heap_ptr = NULL; + caddr_t base; + + if (heap_ptr == NULL) { + heap_ptr = (caddr_t)&Heap_Bank1_Start; + } + + base = heap_ptr; + + /* heap word alignment */ + nbytes = (nbytes + 3) & ~0x3U; + if ((caddr_t)&Heap_Bank1_End > (heap_ptr + nbytes)) + { + heap_ptr += nbytes; + return (base); + } + else + { + /* Heap overflow */ + errno = ENOMEM; + return ((caddr_t)-1); + } +} + +/* Init */ +void _init(void) +{} + +#endif /* __GNUC__ */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_ccu4_map.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_ccu4_map.h new file mode 100644 index 00000000..e69ac723 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_ccu4_map.h @@ -0,0 +1,3791 @@ +/** + * @file xmc1_ccu4_map.h + * @date 2015-08-25 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-08-25: + * - Initial version + * + * @endcond + */ + +#ifndef XMC1_CCU4_MAP_H +#define XMC1_CCU4_MAP_H + +#if UC_SERIES != XMC14 +#define XMC_CCU4_SLICE_INPUT_A (0U) +#define XMC_CCU4_SLICE_INPUT_B (1U) +#define XMC_CCU4_SLICE_INPUT_C (2U) +#define XMC_CCU4_SLICE_INPUT_D (3U) +#define XMC_CCU4_SLICE_INPUT_E (4U) +#define XMC_CCU4_SLICE_INPUT_F (5U) +#define XMC_CCU4_SLICE_INPUT_G (6U) +#define XMC_CCU4_SLICE_INPUT_H (7U) +#define XMC_CCU4_SLICE_INPUT_I (8U) +#define XMC_CCU4_SLICE_INPUT_J (9U) +#define XMC_CCU4_SLICE_INPUT_K (10U) +#define XMC_CCU4_SLICE_INPUT_L (11U) +#define XMC_CCU4_SLICE_INPUT_M (12U) +#define XMC_CCU4_SLICE_INPUT_N (13U) +#define XMC_CCU4_SLICE_INPUT_O (14U) +#define XMC_CCU4_SLICE_INPUT_P (15U) +#else +#define XMC_CCU4_SLICE_INPUT_AA (0U) +#define XMC_CCU4_SLICE_INPUT_AB (1U) +#define XMC_CCU4_SLICE_INPUT_AC (2U) +#define XMC_CCU4_SLICE_INPUT_AD (3U) +#define XMC_CCU4_SLICE_INPUT_AE (4U) +#define XMC_CCU4_SLICE_INPUT_AF (5U) +#define XMC_CCU4_SLICE_INPUT_AG (6U) +#define XMC_CCU4_SLICE_INPUT_AH (7U) +#define XMC_CCU4_SLICE_INPUT_AI (8U) +#define XMC_CCU4_SLICE_INPUT_AJ (9U) +#define XMC_CCU4_SLICE_INPUT_AK (10U) +#define XMC_CCU4_SLICE_INPUT_AL (11U) +#define XMC_CCU4_SLICE_INPUT_AM (12U) +#define XMC_CCU4_SLICE_INPUT_AN (13U) +#define XMC_CCU4_SLICE_INPUT_AO (14U) +#define XMC_CCU4_SLICE_INPUT_AP (15U) +#define XMC_CCU4_SLICE_INPUT_AQ (16U) +#define XMC_CCU4_SLICE_INPUT_AR (17U) +#define XMC_CCU4_SLICE_INPUT_AS (18U) +#define XMC_CCU4_SLICE_INPUT_AT (19U) +#define XMC_CCU4_SLICE_INPUT_AU (20U) +#define XMC_CCU4_SLICE_INPUT_AV (21U) +#define XMC_CCU4_SLICE_INPUT_AW (22U) +#define XMC_CCU4_SLICE_INPUT_AX (23U) +#define XMC_CCU4_SLICE_INPUT_AY (24U) +#define XMC_CCU4_SLICE_INPUT_AZ (25U) +#define XMC_CCU4_SLICE_INPUT_BA (26U) +#define XMC_CCU4_SLICE_INPUT_BB (27U) +#define XMC_CCU4_SLICE_INPUT_BC (28U) +#define XMC_CCU4_SLICE_INPUT_BD (29U) +#define XMC_CCU4_SLICE_INPUT_BE (30U) +#define XMC_CCU4_SLICE_INPUT_BF (31U) +#define XMC_CCU4_SLICE_INPUT_BG (32U) +#define XMC_CCU4_SLICE_INPUT_BH (33U) +#define XMC_CCU4_SLICE_INPUT_BI (34U) +#define XMC_CCU4_SLICE_INPUT_BJ (35U) +#define XMC_CCU4_SLICE_INPUT_BK (36U) +#define XMC_CCU4_SLICE_INPUT_BL (37U) +#define XMC_CCU4_SLICE_INPUT_BM (38U) +#define XMC_CCU4_SLICE_INPUT_BN (39U) +#define XMC_CCU4_SLICE_INPUT_BO (40U) +#define XMC_CCU4_SLICE_INPUT_BP (41U) +#define XMC_CCU4_SLICE_INPUT_BQ (42U) +#define XMC_CCU4_SLICE_INPUT_BR (43U) +#define XMC_CCU4_SLICE_INPUT_BS (44U) +#define XMC_CCU4_SLICE_INPUT_BT (45U) +#define XMC_CCU4_SLICE_INPUT_BU (46U) +#define XMC_CCU4_SLICE_INPUT_BV (47U) +#endif + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN24) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN40) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP16) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP38) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1200) && (UC_PACKAGE == TSSOP38) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_LEDTSledts_SR0 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_LEDTSledts_SR0 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == VQFN40) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_LEDTSledts_SR0 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_LEDTSledts_SR0 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP28) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_LEDTSledts_SR0 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_LEDTSledts_SR0 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP38) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_LEDTSledts_SR0 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_LEDTSledts_SR0 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN24) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN40) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP16) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP28) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN24) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN40) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP16) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP38) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN24) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN40) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP16) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP28) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP38) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == LQFP64) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_P4_8 21 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_P4_1 26 +#define CCU40_IN1_P4_9 21 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_LEDTS0_SR 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_P4_10 21 +#define CCU40_IN2_P4_2 26 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_LEDTS1_SR 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_P4_11 21 +#define CCU40_IN3_P4_3 26 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_0 2 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_P4_8 26 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_1 2 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_P4_9 26 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_10 26 +#define CCU41_IN2_P4_2 2 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_11 26 +#define CCU41_IN3_P4_3 2 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == VQFN48) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_LEDTS0_SR 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_LEDTS1_SR 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == LQFP64) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_P4_8 21 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_P4_1 26 +#define CCU40_IN1_P4_9 21 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_ACMP3_OUT 17 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_P4_10 21 +#define CCU40_IN2_P4_2 26 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_P4_11 21 +#define CCU40_IN3_P4_3 26 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_ACMP3_OUT 18 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_0 2 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_P4_8 26 +#define CCU41_IN0_POSIF1_OUT0 4 +#define CCU41_IN0_POSIF1_OUT1 5 +#define CCU41_IN0_POSIF1_OUT3 6 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_1 2 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_P4_9 26 +#define CCU41_IN1_POSIF1_OUT0 4 +#define CCU41_IN1_POSIF1_OUT1 5 +#define CCU41_IN1_POSIF1_OUT3 6 +#define CCU41_IN1_POSIF1_OUT4 7 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_ACMP3_OUT 17 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_10 26 +#define CCU41_IN2_P4_2 2 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_POSIF1_OUT0 28 +#define CCU41_IN2_POSIF1_OUT1 4 +#define CCU41_IN2_POSIF1_OUT2 5 +#define CCU41_IN2_POSIF1_OUT3 6 +#define CCU41_IN2_POSIF1_OUT4 7 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_11 26 +#define CCU41_IN3_P4_3 2 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_POSIF1_OUT0 28 +#define CCU41_IN3_POSIF1_OUT1 29 +#define CCU41_IN3_POSIF1_OUT3 4 +#define CCU41_IN3_POSIF1_OUT5 5 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_ACMP3_OUT 18 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN40) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN48) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_ACMP3_OUT 17 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_ACMP3_OUT 18 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_POSIF1_OUT0 4 +#define CCU41_IN0_POSIF1_OUT1 5 +#define CCU41_IN0_POSIF1_OUT3 6 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_POSIF1_OUT0 4 +#define CCU41_IN1_POSIF1_OUT1 5 +#define CCU41_IN1_POSIF1_OUT3 6 +#define CCU41_IN1_POSIF1_OUT4 7 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_ACMP3_OUT 17 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_POSIF1_OUT0 28 +#define CCU41_IN2_POSIF1_OUT1 4 +#define CCU41_IN2_POSIF1_OUT2 5 +#define CCU41_IN2_POSIF1_OUT3 6 +#define CCU41_IN2_POSIF1_OUT4 7 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_POSIF1_OUT0 28 +#define CCU41_IN3_POSIF1_OUT1 29 +#define CCU41_IN3_POSIF1_OUT3 4 +#define CCU41_IN3_POSIF1_OUT5 5 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_ACMP3_OUT 18 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN64) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_P4_8 21 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_P4_1 26 +#define CCU40_IN1_P4_9 21 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_ACMP3_OUT 17 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_P4_10 21 +#define CCU40_IN2_P4_2 26 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_P4_11 21 +#define CCU40_IN3_P4_3 26 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_ACMP3_OUT 18 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_0 2 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_P4_8 26 +#define CCU41_IN0_POSIF1_OUT0 4 +#define CCU41_IN0_POSIF1_OUT1 5 +#define CCU41_IN0_POSIF1_OUT3 6 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_1 2 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_P4_9 26 +#define CCU41_IN1_POSIF1_OUT0 4 +#define CCU41_IN1_POSIF1_OUT1 5 +#define CCU41_IN1_POSIF1_OUT3 6 +#define CCU41_IN1_POSIF1_OUT4 7 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_ACMP3_OUT 17 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_10 26 +#define CCU41_IN2_P4_2 2 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_POSIF1_OUT0 28 +#define CCU41_IN2_POSIF1_OUT1 4 +#define CCU41_IN2_POSIF1_OUT2 5 +#define CCU41_IN2_POSIF1_OUT3 6 +#define CCU41_IN2_POSIF1_OUT4 7 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_11 26 +#define CCU41_IN3_P4_3 2 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_POSIF1_OUT0 28 +#define CCU41_IN3_POSIF1_OUT1 29 +#define CCU41_IN3_POSIF1_OUT3 4 +#define CCU41_IN3_POSIF1_OUT5 5 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_ACMP3_OUT 18 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == TSSOP38) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN40) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN48) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN64) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_P4_8 21 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_P4_1 26 +#define CCU40_IN1_P4_9 21 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_P4_10 21 +#define CCU40_IN2_P4_2 26 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_P4_11 21 +#define CCU40_IN3_P4_3 26 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_0 2 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_P4_8 26 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_1 2 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_P4_9 26 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_10 26 +#define CCU41_IN2_P4_2 2 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_11 26 +#define CCU41_IN3_P4_3 2 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == LQFP64) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_P4_8 21 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_P4_1 26 +#define CCU40_IN1_P4_9 21 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_ACMP3_OUT 17 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_LEDTS0_SR 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_P4_10 21 +#define CCU40_IN2_P4_2 26 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_LEDTS1_SR 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_P4_11 21 +#define CCU40_IN3_P4_3 26 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_ACMP3_OUT 18 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_0 2 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_P4_8 26 +#define CCU41_IN0_POSIF1_OUT0 4 +#define CCU41_IN0_POSIF1_OUT1 5 +#define CCU41_IN0_POSIF1_OUT3 6 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_1 2 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_P4_9 26 +#define CCU41_IN1_POSIF1_OUT0 4 +#define CCU41_IN1_POSIF1_OUT1 5 +#define CCU41_IN1_POSIF1_OUT3 6 +#define CCU41_IN1_POSIF1_OUT4 7 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_ACMP3_OUT 17 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_10 26 +#define CCU41_IN2_P4_2 2 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_POSIF1_OUT0 28 +#define CCU41_IN2_POSIF1_OUT1 4 +#define CCU41_IN2_POSIF1_OUT2 5 +#define CCU41_IN2_POSIF1_OUT3 6 +#define CCU41_IN2_POSIF1_OUT4 7 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_11 26 +#define CCU41_IN3_P4_3 2 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_POSIF1_OUT0 28 +#define CCU41_IN3_POSIF1_OUT1 29 +#define CCU41_IN3_POSIF1_OUT3 4 +#define CCU41_IN3_POSIF1_OUT5 5 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_ACMP3_OUT 18 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN48) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_ACMP3_OUT 17 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_LEDTS0_SR 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_LEDTS1_SR 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_ACMP3_OUT 18 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_POSIF1_OUT0 4 +#define CCU41_IN0_POSIF1_OUT1 5 +#define CCU41_IN0_POSIF1_OUT3 6 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_POSIF1_OUT0 4 +#define CCU41_IN1_POSIF1_OUT1 5 +#define CCU41_IN1_POSIF1_OUT3 6 +#define CCU41_IN1_POSIF1_OUT4 7 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_ACMP3_OUT 17 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_POSIF1_OUT0 28 +#define CCU41_IN2_POSIF1_OUT1 4 +#define CCU41_IN2_POSIF1_OUT2 5 +#define CCU41_IN2_POSIF1_OUT3 6 +#define CCU41_IN2_POSIF1_OUT4 7 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_POSIF1_OUT0 28 +#define CCU41_IN3_POSIF1_OUT1 29 +#define CCU41_IN3_POSIF1_OUT3 4 +#define CCU41_IN3_POSIF1_OUT5 5 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_ACMP3_OUT 18 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN64) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_P4_8 21 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_P4_1 26 +#define CCU40_IN1_P4_9 21 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_ACMP3_OUT 17 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_LEDTS0_SR 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_P4_10 21 +#define CCU40_IN2_P4_2 26 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_LEDTS1_SR 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_P4_11 21 +#define CCU40_IN3_P4_3 26 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_ACMP3_OUT 18 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_0 2 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_P4_8 26 +#define CCU41_IN0_POSIF1_OUT0 4 +#define CCU41_IN0_POSIF1_OUT1 5 +#define CCU41_IN0_POSIF1_OUT3 6 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_1 2 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_P4_9 26 +#define CCU41_IN1_POSIF1_OUT0 4 +#define CCU41_IN1_POSIF1_OUT1 5 +#define CCU41_IN1_POSIF1_OUT3 6 +#define CCU41_IN1_POSIF1_OUT4 7 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_ACMP3_OUT 17 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_10 26 +#define CCU41_IN2_P4_2 2 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_POSIF1_OUT0 28 +#define CCU41_IN2_POSIF1_OUT1 4 +#define CCU41_IN2_POSIF1_OUT2 5 +#define CCU41_IN2_POSIF1_OUT3 6 +#define CCU41_IN2_POSIF1_OUT4 7 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_11 26 +#define CCU41_IN3_P4_3 2 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_POSIF1_OUT0 28 +#define CCU41_IN3_POSIF1_OUT1 29 +#define CCU41_IN3_POSIF1_OUT3 4 +#define CCU41_IN3_POSIF1_OUT5 5 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_ACMP3_OUT 18 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + +#endif /* XMC1_CCU4_MAP_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_ccu8_map.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_ccu8_map.h new file mode 100644 index 00000000..475e1291 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_ccu8_map.h @@ -0,0 +1,2267 @@ +/** + * @file xmc1_ccu8_map.h + * @date 2015-08-25 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-08-25: + * - Initial version + * + * @endcond + */ + +#ifndef XMC1_CCU8_MAP_H +#define XMC1_CCU8_MAP_H + +#if UC_SERIES != XMC14 +#define XMC_CCU8_SLICE_INPUT_A (0U) +#define XMC_CCU8_SLICE_INPUT_B (1U) +#define XMC_CCU8_SLICE_INPUT_C (2U) +#define XMC_CCU8_SLICE_INPUT_D (3U) +#define XMC_CCU8_SLICE_INPUT_E (4U) +#define XMC_CCU8_SLICE_INPUT_F (5U) +#define XMC_CCU8_SLICE_INPUT_G (6U) +#define XMC_CCU8_SLICE_INPUT_H (7U) +#define XMC_CCU8_SLICE_INPUT_I (8U) +#define XMC_CCU8_SLICE_INPUT_J (9U) +#define XMC_CCU8_SLICE_INPUT_K (10U) +#define XMC_CCU8_SLICE_INPUT_L (11U) +#define XMC_CCU8_SLICE_INPUT_M (12U) +#define XMC_CCU8_SLICE_INPUT_N (13U) +#define XMC_CCU8_SLICE_INPUT_O (14U) +#define XMC_CCU8_SLICE_INPUT_P (15U) +#else +#define XMC_CCU8_SLICE_INPUT_AA (0U) +#define XMC_CCU8_SLICE_INPUT_AB (1U) +#define XMC_CCU8_SLICE_INPUT_AC (2U) +#define XMC_CCU8_SLICE_INPUT_AD (3U) +#define XMC_CCU8_SLICE_INPUT_AE (4U) +#define XMC_CCU8_SLICE_INPUT_AF (5U) +#define XMC_CCU8_SLICE_INPUT_AG (6U) +#define XMC_CCU8_SLICE_INPUT_AH (7U) +#define XMC_CCU8_SLICE_INPUT_AI (8U) +#define XMC_CCU8_SLICE_INPUT_AJ (9U) +#define XMC_CCU8_SLICE_INPUT_AK (10U) +#define XMC_CCU8_SLICE_INPUT_AL (11U) +#define XMC_CCU8_SLICE_INPUT_AM (12U) +#define XMC_CCU8_SLICE_INPUT_AN (13U) +#define XMC_CCU8_SLICE_INPUT_AO (14U) +#define XMC_CCU8_SLICE_INPUT_AP (15U) +#define XMC_CCU8_SLICE_INPUT_AQ (16U) +#define XMC_CCU8_SLICE_INPUT_AR (17U) +#define XMC_CCU8_SLICE_INPUT_AS (18U) +#define XMC_CCU8_SLICE_INPUT_AT (19U) +#define XMC_CCU8_SLICE_INPUT_AU (20U) +#define XMC_CCU8_SLICE_INPUT_AV (21U) +#define XMC_CCU8_SLICE_INPUT_AW (22U) +#define XMC_CCU8_SLICE_INPUT_AX (23U) +#define XMC_CCU8_SLICE_INPUT_AY (24U) +#define XMC_CCU8_SLICE_INPUT_AZ (25U) +#define XMC_CCU8_SLICE_INPUT_BA (26U) +#define XMC_CCU8_SLICE_INPUT_BB (27U) +#define XMC_CCU8_SLICE_INPUT_BC (28U) +#define XMC_CCU8_SLICE_INPUT_BD (29U) +#define XMC_CCU8_SLICE_INPUT_BE (30U) +#define XMC_CCU8_SLICE_INPUT_BF (31U) +#define XMC_CCU8_SLICE_INPUT_BG (32U) +#define XMC_CCU8_SLICE_INPUT_BH (33U) +#define XMC_CCU8_SLICE_INPUT_BI (34U) +#define XMC_CCU8_SLICE_INPUT_BJ (35U) +#define XMC_CCU8_SLICE_INPUT_BK (36U) +#define XMC_CCU8_SLICE_INPUT_BL (37U) +#define XMC_CCU8_SLICE_INPUT_BM (38U) +#define XMC_CCU8_SLICE_INPUT_BN (39U) +#define XMC_CCU8_SLICE_INPUT_BO (40U) +#define XMC_CCU8_SLICE_INPUT_BP (41U) +#define XMC_CCU8_SLICE_INPUT_BQ (42U) +#define XMC_CCU8_SLICE_INPUT_BR (43U) +#define XMC_CCU8_SLICE_INPUT_BS (44U) +#define XMC_CCU8_SLICE_INPUT_BT (45U) +#define XMC_CCU8_SLICE_INPUT_BU (46U) +#define XMC_CCU8_SLICE_INPUT_BV (47U) +#endif + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN24) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN40) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP16) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP38) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN24) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN40) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP16) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP28) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP38) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == LQFP64) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_P4_0 20 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_P4_1 20 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_P4_2 20 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_ACMP3_OUT 18 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_P4_3 20 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_ACMP3_OUT 17 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_P3_0 0 +#define CCU81_IN0_P4_6 1 +#define CCU81_IN0_POSIF1_OUT2 3 +#define CCU81_IN0_POSIF1_OUT5 4 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_P3_0 0 +#define CCU81_IN1_P4_2 1 +#define CCU81_IN1_POSIF1_OUT2 3 +#define CCU81_IN1_POSIF1_OUT5 4 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_P3_0 0 +#define CCU81_IN2_POSIF1_OUT2 3 +#define CCU81_IN2_POSIF1_OUT5 4 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_ACMP3_OUT 18 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_P3_0 0 +#define CCU81_IN3_P4_10 1 +#define CCU81_IN3_POSIF1_OUT2 3 +#define CCU81_IN3_POSIF1_OUT5 4 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_ACMP3_OUT 17 +#define CCU81_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN40) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN48) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_ACMP3_OUT 18 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_ACMP3_OUT 17 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_P3_0 0 +#define CCU81_IN0_P4_6 1 +#define CCU81_IN0_POSIF1_OUT2 3 +#define CCU81_IN0_POSIF1_OUT5 4 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_P3_0 0 +#define CCU81_IN1_POSIF1_OUT2 3 +#define CCU81_IN1_POSIF1_OUT5 4 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_P3_0 0 +#define CCU81_IN2_POSIF1_OUT2 3 +#define CCU81_IN2_POSIF1_OUT5 4 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_ACMP3_OUT 18 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_P3_0 0 +#define CCU81_IN3_POSIF1_OUT2 3 +#define CCU81_IN3_POSIF1_OUT5 4 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_ACMP3_OUT 17 +#define CCU81_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN64) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_P4_0 20 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_P4_1 20 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_P4_2 20 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_ACMP3_OUT 18 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_P4_3 20 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_ACMP3_OUT 17 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_P3_0 0 +#define CCU81_IN0_P4_6 1 +#define CCU81_IN0_POSIF1_OUT2 3 +#define CCU81_IN0_POSIF1_OUT5 4 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_P3_0 0 +#define CCU81_IN1_P4_2 1 +#define CCU81_IN1_POSIF1_OUT2 3 +#define CCU81_IN1_POSIF1_OUT5 4 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_P3_0 0 +#define CCU81_IN2_POSIF1_OUT2 3 +#define CCU81_IN2_POSIF1_OUT5 4 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_ACMP3_OUT 18 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_P3_0 0 +#define CCU81_IN3_P4_10 1 +#define CCU81_IN3_POSIF1_OUT2 3 +#define CCU81_IN3_POSIF1_OUT5 4 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_ACMP3_OUT 17 +#define CCU81_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == TSSOP38) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == LQFP64) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_P4_0 20 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_P4_1 20 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_P4_2 20 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_ACMP3_OUT 18 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_P4_3 20 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_ACMP3_OUT 17 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_P3_0 0 +#define CCU81_IN0_P4_6 1 +#define CCU81_IN0_POSIF1_OUT2 3 +#define CCU81_IN0_POSIF1_OUT5 4 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_P3_0 0 +#define CCU81_IN1_P4_2 1 +#define CCU81_IN1_POSIF1_OUT2 3 +#define CCU81_IN1_POSIF1_OUT5 4 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_P3_0 0 +#define CCU81_IN2_POSIF1_OUT2 3 +#define CCU81_IN2_POSIF1_OUT5 4 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_ACMP3_OUT 18 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_P3_0 0 +#define CCU81_IN3_P4_10 1 +#define CCU81_IN3_POSIF1_OUT2 3 +#define CCU81_IN3_POSIF1_OUT5 4 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_ACMP3_OUT 17 +#define CCU81_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN48) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_ACMP3_OUT 18 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_ACMP3_OUT 17 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_P3_0 0 +#define CCU81_IN0_P4_6 1 +#define CCU81_IN0_POSIF1_OUT2 3 +#define CCU81_IN0_POSIF1_OUT5 4 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_P3_0 0 +#define CCU81_IN1_POSIF1_OUT2 3 +#define CCU81_IN1_POSIF1_OUT5 4 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_P3_0 0 +#define CCU81_IN2_POSIF1_OUT2 3 +#define CCU81_IN2_POSIF1_OUT5 4 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_ACMP3_OUT 18 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_P3_0 0 +#define CCU81_IN3_POSIF1_OUT2 3 +#define CCU81_IN3_POSIF1_OUT5 4 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_ACMP3_OUT 17 +#define CCU81_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN64) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_P4_0 20 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_P4_1 20 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_P4_2 20 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_ACMP3_OUT 18 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_P4_3 20 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_ACMP3_OUT 17 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_P3_0 0 +#define CCU81_IN0_P4_6 1 +#define CCU81_IN0_POSIF1_OUT2 3 +#define CCU81_IN0_POSIF1_OUT5 4 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_P3_0 0 +#define CCU81_IN1_P4_2 1 +#define CCU81_IN1_POSIF1_OUT2 3 +#define CCU81_IN1_POSIF1_OUT5 4 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_P3_0 0 +#define CCU81_IN2_POSIF1_OUT2 3 +#define CCU81_IN2_POSIF1_OUT5 4 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_ACMP3_OUT 18 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_P3_0 0 +#define CCU81_IN3_P4_10 1 +#define CCU81_IN3_POSIF1_OUT2 3 +#define CCU81_IN3_POSIF1_OUT5 4 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_ACMP3_OUT 17 +#define CCU81_IN3_SCU_GSC80 7 +#endif + +#endif /* XMC1_CCU8_MAP_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_eru_map.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_eru_map.h new file mode 100644 index 00000000..ce1757f8 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_eru_map.h @@ -0,0 +1,1894 @@ +/** + * @file xmc1_eru_map.h + * @date 2015-08-25 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial version + * + * 2015-08-25: + * - Added support for XMC1400 devices + * + * @endcond + */ +#ifndef XMC1_ERU_MAP_H +#define XMC1_ERU_MAP_H + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ +#define ERU0_ETL0 XMC_ERU0, 0 +#define ERU0_ETL1 XMC_ERU0, 1 +#define ERU0_ETL2 XMC_ERU0, 2 +#define ERU0_ETL3 XMC_ERU0, 3 + +#define ERU0_OGU0 XMC_ERU0, 0 +#define ERU0_OGU1 XMC_ERU0, 1 +#define ERU0_OGU2 XMC_ERU0, 2 +#define ERU0_OGU3 XMC_ERU0, 3 + +#if defined(ERU1) +#define ERU1_ETL0 XMC_ERU1, 0 +#define ERU1_ETL1 XMC_ERU1, 1 +#define ERU1_ETL2 XMC_ERU1, 2 +#define ERU1_ETL3 XMC_ERU1, 3 + +#define ERU1_OGU0 XMC_ERU1, 0 +#define ERU1_OGU1 XMC_ERU1, 1 +#define ERU1_OGU2 XMC_ERU1, 2 +#define ERU1_OGU3 XMC_ERU1, 3 +#endif + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN24) +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN40) +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP16) +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP38) +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1200) && (UC_PACKAGE == TSSOP38) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == VQFN40) +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP28) +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP38) +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN24) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN40) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP16) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP28) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN24) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN40) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP16) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP38) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN24) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN40) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP16) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP28) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP38) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == LQFP64) +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_P3_1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL1_INPUTA_P3_3 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_P3_2 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL2_INPUTA_P3_4 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == VQFN48) +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == LQFP64) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL1_INPUTA_P3_1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL1_INPUTA_P3_3 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTA_P3_2 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL2_INPUTA_P3_4 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTA_POSIF1_SR1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN40) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN48) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTA_POSIF1_SR1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN64) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL1_INPUTA_P3_1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL1_INPUTA_P3_3 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTA_P3_2 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL2_INPUTA_P3_4 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTA_POSIF1_SR1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == TSSOP38) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN40) +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CAN0_SR4 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CAN0_SR5 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CAN0_SR6 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CAN0_SR7 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN48) +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CAN0_SR4 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CAN0_SR5 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CAN0_SR6 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CAN0_SR7 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN64) +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_P3_1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL1_INPUTA_P3_3 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_P3_2 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL2_INPUTA_P3_4 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CAN0_SR4 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CAN0_SR5 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CAN0_SR6 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CAN0_SR7 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == LQFP64) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL1_INPUTA_P3_1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL1_INPUTA_P3_3 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTA_P3_2 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL2_INPUTA_P3_4 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTA_POSIF1_SR1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CAN0_SR4 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CAN0_SR5 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CAN0_SR6 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CAN0_SR7 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN48) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTA_POSIF1_SR1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CAN0_SR4 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CAN0_SR5 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CAN0_SR6 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CAN0_SR7 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN64) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL1_INPUTA_P3_1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL1_INPUTA_P3_3 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTA_P3_2 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL2_INPUTA_P3_4 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTA_POSIF1_SR1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CAN0_SR4 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CAN0_SR5 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CAN0_SR6 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CAN0_SR7 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + +#endif /* XMC1_ERU_MAP_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_flash.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_flash.h new file mode 100644 index 00000000..64406ab5 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_flash.h @@ -0,0 +1,415 @@ +/** + * @file xmc1_flash.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2014-12-10: + * - Initial
+ * 2015-02-20: + * - Updated for Documentation related changes
+ * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * @endcond + * + */ + +#ifndef XMC1_FLASH_H +#define XMC1_FLASH_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ + +#include "xmc_common.h" + +#if UC_FAMILY == XMC1 + +#include + +/** +* @addtogroup XMClib XMC Peripheral Library +* @{ +*/ + +/** +* @addtogroup FLASH +* @{ +*/ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +#define XMC_FLASH_PAGES_PER_SECTOR (16U) /**< Number of pages in a sector. A page consists of 16 blocks.*/ +#define XMC_FLASH_BLOCKS_PER_PAGE (16U) /**< Number of blocks in a page. A block consists of 4 words(16 bytes).*/ + +#define XMC_FLASH_BYTES_PER_SECTOR (4096U) /**< Number of bytes in a sector. (16 pages * 256 bytes = 4096 bytes)*/ +#define XMC_FLASH_BYTES_PER_PAGE (256U) /**< Number of bytes in a page. (16 blocks * 16 bytes = 256 bytes)*/ +#define XMC_FLASH_BYTES_PER_BLOCK (16U) /**< Number of bytes in a block. (128 bits = 16 bytes)*/ + +#define XMC_FLASH_WORDS_PER_SECTOR (1024U) /**< Number of words in a sector. (16 pages * 64 words = 1024 words)*/ +#define XMC_FLASH_WORDS_PER_PAGE (64U) /**< Number of words in a page. (16 blocks * 4 words = 64 words) */ +#define XMC_FLASH_WORDS_PER_BLOCK (4U) /**< Number of words in a block. (128 bit / 32 bit = 4 words) */ + +#define FLASH_BLOCK_ADDR_MASK (15U) /* Bitwise AND with block address is done to check the address alignment. + Applicable to XMC_FLASH_WriteBlocks() and XMC_FLASH_VerifyBlocks() + APIs.*/ +#define FLASH_PAGE_ADDR_MASK (255U) /* Bitwise AND with page address is done to check the address alignment. + Applicable to XMC_FLASH_ErasePages() API.*/ +#define FLASH_SECTOR_ADDR_MASK (4095U) /* Bitwise AND with sector address is done to check the address alignment. + Applicable to XMC_FLASH_EraseSector API.*/ + +#define XMC_FLASH_BASE (0x10001000U) /**< Starting address of flash for XMC1 family of microcontrollers*/ + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +/** + * Defines the status of flash, to verify the flash related API calls. Use type \a XMC_FLASH_STATUS_t for this enum. + * The members defines the respective masked status bits of \a NVMSTATUS register. + */ +typedef enum XMC_FLASH_STATUS +{ + XMC_FLASH_STATUS_OK = 0U, /**< Flash related operation was successfully + completed*/ + XMC_FLASH_STATUS_BUSY = NVM_NVMSTATUS_BUSY_Msk , /**< Cannot execute the flash request because + another operation is in progress*/ + XMC_FLASH_STATUS_SLEEP_MODE = NVM_NVMSTATUS_SLEEP_Msk , /**< Flash is in sleep mode*/ + XMC_FLASH_STATUS_VERIFY_ERROR = NVM_NVMSTATUS_VERR_Msk , /**< Flash reported a verification failure*/ + XMC_FLASH_STATUS_ECC1_READ_ERROR = NVM_NVMSTATUS_ECC1READ_Msk, /**< Flash reports a single bit failure, and it + is automatically corrected.*/ + XMC_FLASH_STATUS_ECC2_READ_ERROR = NVM_NVMSTATUS_ECC2READ_Msk, /**< Flash reported at least two bit failure*/ + XMC_FLASH_STATUS_WRITE_PROTOCOL_ERROR = NVM_NVMSTATUS_WRPERR_Msk , /**< Write/Verify operation on a block is + failed due to protocol violations or write + protected sectors*/ +} XMC_FLASH_STATUS_t; + +/** + * Defines NVM ready interrupt event. Use type \a XMC_FLASH_EVENT_t for this enum. + */ +typedef enum XMC_FLASH_EVENT +{ + XMC_FLASH_EVENT_READY = NVM_NVMCONF_INT_ON_Msk /**< Generates the NVM ready interrupts on flash sequence completion*/ +} XMC_FLASH_EVENT_t; + +/** + * Defines hard read levels for strict data verification. Use type \a XMC_FLASH_HARDREAD_LEVEL_t for this enum. + * These \a hardread levels provide some margin to ensure that the data is really programmed with suitably distinct + * levels for written and erased bits. + */ +typedef enum XMC_FLASH_HARDREAD_LEVEL +{ + XMC_FLASH_HARDREAD_LEVEL_NORMAL = (uint16_t)0x0, /**< No \a hardread level verification enabled (Normal read)*/ + XMC_FLASH_HARDREAD_LEVEL_WRITTEN = (uint16_t)0x1, /**< Enables strict margin compare for written data cells*/ + XMC_FLASH_HARDREAD_LEVEL_ERASED = (uint16_t)0x2 /**< Enables strict margin compare for erased data cells*/ +} XMC_FLASH_HARDREAD_LEVEL_t; + +/********************************************************************************************************************** + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * + * @param address Pointer to the starting address of the flash page from where the erase starts + * @param num_pages Number of pages to be erased.
Range: [1 to (flash size / 256)] + * + * @return None + * + * \parDescription:
+ * Erases a set of flash memory pages.

+ * Erase starts from the specified \a address. + * It erases a maximum number of \a num_pages flash pages. The maximum erasable pages are limited to + * microcontroller flash size. It sets NVMPROG register to continuous page erase mode before erase and resets + * it action back to normal state on completion. Call XMC_FLASH_GetStatus() after calling this API to verify the erase + * operation.\n + * + * \parNote:
+ * Flash will be in busy state during erase operation. Hence no operations on flash are allowed until it completes.\n + * + * \parRelated APIs:
+ * XMC_FLASH_EraseSector(), XMC_FLASH_ErasePage() \n\n\n + * + * \parRelated APIs:
+ * None + * + */ +void XMC_FLASH_ErasePages(uint32_t *address, uint32_t num_pages); + +/** + * + * @param address Pointer to the starting address of flash block from where the write starts. + * @param data Pointer to the source address where targeted data blocks are located. + * @param num_blocks Maximum number of flash block writes needed.
Range: [1 to (flash size / 16)] + * @param verify If \a true, hardware verification after block write is enabled else disabled. + * + * @return None + * + * \parDescription:
+ * Writes a set of data blocks into the flash.\n\n Minimum possible writable area is 16 byte block. It sets the NVMPROG + * register to continuous block write mode before write and resets it action back to normal state on completion. + * Call XMC_FLASH_GetStatus() API after calling this API to verify the erase operation. + * + * \parNote
+ * Flash will be busy state during write is ongoing, hence no operations allowed until it completes. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_FLASH_WriteBlocks(uint32_t *address, const uint32_t *data, uint32_t num_blocks, bool verify); + +/** + * + * @param address Pointer to the starting address of flash block from where the verification starts. + * @param data Pointer to the source address where targeted data blocks are located. + * @param num_blocks Maximum number of flash blocks writes needed.
Range: [1 to (flash size / 16)] + * + * @return None + * + * \parDescription:
+ * Performs verification of written data blocks.\n\n After calling XMC_FLASH_WriteBlocks() API, calling this API will + * verify the correctness of written blocks. It sets the \a NVMPROG register into continuous block write mode before + * write and resets it action back to normal state on completion. It reads back the written data blocks from the flash + * and verify the values against the internal buffer values. Calling XMC_FLASH_GetStatus() API after calling this API + * validates the result of verification. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_FLASH_VerifyBlocks(uint32_t *address, const uint32_t *data, uint32_t num_blocks); + + +/** + * + * @param address Pointer to the starting address of flash block from where the read starts. + * @param data Pointer to the destination address, where the read data blocks to be stored. + * @param num_blocks Number of blocks to be read.
Range: [1 to (flash size / 16)] + * + * @return None + * + * \parDescription:
+ * Reads multiple blocks from flash in one shot, starting from the \a address specified.\n\n The read blocks are stored + * into the locations starting from the \a data address. Calling XMC_FLASH_GetStatus() API after calling this API + * verifies the read operation. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_FLASH_ReadBlocks(uint32_t *address, uint32_t *data, uint32_t num_blocks); + + +/** + * + * @param address Pointer to the flash word address from where the read is expected + * + * @return
+ * a 32bit data word stored in the specified \a address. + * + * \parDescription:
+ * Reads a single word from the specified flash\a address.\n\n Calling XMC_FLASH_GetStatus() API after calling this + * API returns the read status. + * + * \parRelated APIs:
+ * XMC_FLASH_ReadBlocks() + * + */ +__STATIC_INLINE uint32_t XMC_FLASH_ReadWord(const uint32_t *const address) +{ + return *address; +} + +/** + * + * @param address Pointer to the starting address of the page to be erased + * + * @return None + * + * \parDescription:
+ * Erases a single flash page associated to the specified \a address.\n\n XMC1000 Flash can be erased with granularity + * of one page = 16 blocks of 16 Bytes = 256 Bytes using this API. It internally calls the Flash Firmware routine + * \a XMC1000_NvmErasePage(unsigned long pageAddr) to perform the erase operation. Refer XMC1000 reference manual + * for more details on flash firmware routines (Section 25.3). Call XMC_FLASH_GetStatus() API after calling this API, + * to verify the erase operation.\n + * + * \parRelated APIs:
+ * XMC_FLASH_ErasePages() \n\n\n + */ +void XMC_FLASH_ErasePage(uint32_t *address); + +/** + * + * @param address Pointer to the starting address of flash page from where the programming starts. + * @param data Pointer to the source address where targeted data blocks are located. + * + * @return None + * + * \parDescription:
+ * Erases, programs and verifies a single flash page starting from the \a address specified.\n\n XMC1000 Flash can be + * programmed with granularity of one page = 16 blocks of 16 Bytes = 256 Bytes using this API. It internally calls the + * Flash Firmware routine \a XMC1000_NvmProgVerify(unsigned long pageAddr) to perform the programming. Refer XMC1000 + * reference manual of for more details on flash firmware routines (Section 25.3). Call XMC_FLASH_GetStatus() API after + * calling this API, to verify the erase operation. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_FLASH_ProgramVerifyPage(uint32_t *address, const uint32_t *data); + +/** + * + * @param None + * + * @return None + * + * \parDescription:
+ * Enables the flash to enter into sleep mode by resetting the NVMCONF register NVM_ON bit.\n\n Flash can wake up from + * sleep mode on any flash operation completion ready event trigger. To disable the sleep mode any time during execution + * call the API XMC_FLASH_ExitSleepMode().\n + * + * \parRelated APIs:
+ * XMC_FLASH_ExitSleepMode()\n\n\n + * + */ +__STATIC_INLINE void XMC_FLASH_EnterSleepMode(void) +{ + NVM->NVMCONF &= (uint16_t)(~(uint32_t)NVM_NVMCONF_NVM_ON_Msk); +} + +/** + * + * @param None + * + * @return None + * + * \parDescription:
+ * Enables the flash to exit from sleep mode by setting the NVMCONF register NVM_ON bit.\n\n Calling the API + * XMC_FLASH_EnterSleepMode() allows the flash to renter into sleep mode.\n + * + * \parRelated APIs:
+ * XMC_FLASH_EnterSleepMode()\n\n\n + * + */ +__STATIC_INLINE void XMC_FLASH_ExitSleepMode(void) +{ + NVM->NVMCONF |= (uint16_t)NVM_NVMCONF_NVM_ON_Msk; +} + + +/** + * + * @param sector Flash sector number for which the address extraction is needed
Range: [0 to 51] + * + * @return uint32_t Starting address of the sector specified
Range: [0x10001000 to 0x10032000] + * + * \parDescription:
+ * Finds the starting address of the specified \a sector number.\n\n + * + * \parRelated APIs:
+ * None + * + */ +__STATIC_INLINE uint32_t XMC_FLASH_GetSectorAddress(uint32_t sector) +{ + return (XMC_FLASH_BASE + (XMC_FLASH_BYTES_PER_SECTOR * sector)); +} + + +/** + * + * @param num_sectors Number of sectors to be protected
Range: [0 to 51] + * + * @return None + * + * \parDescription:
+ * Protect the flash sectors starting from 0th sector to the specified \a num_sectors.\n\n It sets the NVMCONF register + * SECPROT field with the value specified in \a num_sectors. Changing the protection limit can be achieved by calling + * this API at runtime with a different value of \a num_sectors.\n\n + * + * \parRelated APIs:
+ * None + * + */ +__STATIC_INLINE void XMC_FLASH_SetSectorProtection(uint32_t num_sectors) +{ + NVM->NVMCONF &= (~(uint16_t)NVM_NVMCONF_SECPROT_Msk); + NVM->NVMCONF |= (uint16_t)((uint16_t)num_sectors << NVM_NVMCONF_SECPROT_Pos); +} + + +/** + * + * @param level Hard read levels specified in \a XMC_FLASH_HARDREAD_LEVEL_t. + * + * @return None + * + * \parDescription:
+ * Sets the hard read level for verification process.\n\n It insists the flash to do a strict margin compare + * with the written/erased data against the internal buffer. Sets the NVMCONF register HRLEV field with \a level + * value. This hardread level is used until the end of the verification sequence and, may not be changed in between.\n\n + * + * \parRelated APIs:
+ * None + * + */ +__STATIC_INLINE void XMC_FLASH_SetHardReadLevel(XMC_FLASH_HARDREAD_LEVEL_t level) +{ + NVM->NVMCONF &= (uint16_t)(~(uint16_t)NVM_NVMCONF_HRLEV_Msk); + NVM->NVMCONF |= (uint16_t)(level<< (uint16_t)NVM_NVMCONF_HRLEV_Pos); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif + +#endif /* FLASH_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_gpio.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_gpio.h new file mode 100644 index 00000000..34e52248 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_gpio.h @@ -0,0 +1,305 @@ +/** + * @file xmc1_gpio.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * @endcond + * + */ + +#ifndef XMC1_GPIO_H +#define XMC1_GPIO_H + +/********************************************************************************************************************** + * HEADER FILES + *********************************************************************************************************************/ + +#include "xmc_common.h" + +#if UC_FAMILY == XMC1 + +#include "xmc1_gpio_map.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup GPIO + * @{ + */ + +/********************************************************************************************************************** + * MACROS + *********************************************************************************************************************/ + +#if defined(PORT0) +#define XMC_GPIO_PORT0 ((XMC_GPIO_PORT_t *) PORT0_BASE) +#define XMC_GPIO_CHECK_PORT0(port) (port == XMC_GPIO_PORT0) +#else +#define XMC_GPIO_CHECK_PORT0(port) 0 +#endif + +#if defined(PORT1) +#define XMC_GPIO_PORT1 ((XMC_GPIO_PORT_t *) PORT1_BASE) +#define XMC_GPIO_CHECK_PORT1(port) (port == XMC_GPIO_PORT1) +#else +#define XMC_GPIO_CHECK_PORT1(port) 0 +#endif + +#if defined(PORT2) +#define XMC_GPIO_PORT2 ((XMC_GPIO_PORT_t *) PORT2_BASE) +#define XMC_GPIO_CHECK_PORT2(port) (port == XMC_GPIO_PORT2) +#else +#define XMC_GPIO_CHECK_PORT2(port) 0 +#endif + +#if defined(PORT3) +#define XMC_GPIO_PORT3 ((XMC_GPIO_PORT_t *) PORT3_BASE) +#define XMC_GPIO_CHECK_PORT3(port) (port == XMC_GPIO_PORT3) +#else +#define XMC_GPIO_CHECK_PORT3(port) 0 +#endif + +#if defined(PORT4) +#define XMC_GPIO_PORT4 ((XMC_GPIO_PORT_t *) PORT4_BASE) +#define XMC_GPIO_CHECK_PORT4(port) (port == XMC_GPIO_PORT4) +#else +#define XMC_GPIO_CHECK_PORT4(port) 0 +#endif + +#define XMC_GPIO_CHECK_PORT(port) (XMC_GPIO_CHECK_PORT0(port) || \ + XMC_GPIO_CHECK_PORT1(port) || \ + XMC_GPIO_CHECK_PORT2(port) || \ + XMC_GPIO_CHECK_PORT3(port) || \ + XMC_GPIO_CHECK_PORT4(port)) + +#define XMC_GPIO_CHECK_OUTPUT_PORT(port) XMC_GPIO_CHECK_PORT(port) + +#define XMC_GPIO_CHECK_ANALOG_PORT(port) (port == XMC_GPIO_PORT2) + +#define XMC_GPIO_CHECK_INPUT_HYSTERESIS(hysteresis) ((hysteresis == XMC_GPIO_INPUT_HYSTERESIS_STANDARD) || \ + (hysteresis == XMC_GPIO_INPUT_HYSTERESIS_LARGE)) + +/********************************************************************************************************************** + * ENUMS + *********************************************************************************************************************/ +/** + * Defines the direction and characteristics of a pin. Use type \a XMC_GPIO_MODE_t for this enum. For the operation + * with alternate functions, the port pins are directly connected to input or output functions of the on-chip periphery. + */ +typedef enum XMC_GPIO_MODE +{ + XMC_GPIO_MODE_INPUT_TRISTATE = 0x0UL << PORT_IOCR_PC_Pos, /**< No internal pull device active */ + XMC_GPIO_MODE_INPUT_PULL_DOWN = 0x1UL << PORT_IOCR_PC_Pos, /**< Internal pull-down device active */ + XMC_GPIO_MODE_INPUT_PULL_UP = 0x2UL << PORT_IOCR_PC_Pos, /**< Internal pull-up device active */ + XMC_GPIO_MODE_INPUT_SAMPLING = 0x3UL << PORT_IOCR_PC_Pos, /**< No internal pull device active; Pn_OUTx continuously samples the input value */ + XMC_GPIO_MODE_INPUT_INVERTED_TRISTATE = 0x4UL << PORT_IOCR_PC_Pos, /**< Inverted no internal pull device active */ + XMC_GPIO_MODE_INPUT_INVERTED_PULL_DOWN = 0x5UL << PORT_IOCR_PC_Pos, /**< Inverted internal pull-down device active */ + XMC_GPIO_MODE_INPUT_INVERTED_PULL_UP = 0x6UL << PORT_IOCR_PC_Pos, /**< Inverted internal pull-up device active */ + XMC_GPIO_MODE_INPUT_INVERTED_SAMPLING = 0x7UL << PORT_IOCR_PC_Pos, /**< Inverted no internal pull device active;Pn_OUTx continuously samples the input value */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL = 0x80UL, /**< Push-pull general-purpose output */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN = 0xc0UL, /**< Open-drain general-purpose output */ + XMC_GPIO_MODE_OUTPUT_ALT1 = 0x1UL << PORT_IOCR_PC_Pos, + XMC_GPIO_MODE_OUTPUT_ALT2 = 0x2UL << PORT_IOCR_PC_Pos, + XMC_GPIO_MODE_OUTPUT_ALT3 = 0x3UL << PORT_IOCR_PC_Pos, + XMC_GPIO_MODE_OUTPUT_ALT4 = 0x4UL << PORT_IOCR_PC_Pos, + XMC_GPIO_MODE_OUTPUT_ALT5 = 0x5UL << PORT_IOCR_PC_Pos, + XMC_GPIO_MODE_OUTPUT_ALT6 = 0x6UL << PORT_IOCR_PC_Pos, + XMC_GPIO_MODE_OUTPUT_ALT7 = 0x7UL << PORT_IOCR_PC_Pos, +#if (UC_SERIES == XMC14) + XMC_GPIO_MODE_OUTPUT_ALT8 = 0x8UL << PORT_IOCR_PC_Pos, + XMC_GPIO_MODE_OUTPUT_ALT9 = 0x9UL << PORT_IOCR_PC_Pos, +#endif + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT1, /**< Push-pull alternate output function 1 */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT2, /**< Push-pull alternate output function 2 */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT3 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT3, /**< Push-pull alternate output function 3 */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT4 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT4, /**< Push-pull alternate output function 4 */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT5 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT5, /**< Push-pull alternate output function 5 */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT6 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT6, /**< Push-pull alternate output function 6 */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT7, /**< Push-pull alternate output function 7 */ +#if (UC_SERIES == XMC14) + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT8 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT8, /**< Push-pull alternate output function 8 */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT9 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT9, /**< Push-pull alternate output function 9 */ +#endif + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT1 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT1, /**< Open drain alternate output function 1 */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT2 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT2, /**< Open drain alternate output function 2 */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT3 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT3, /**< Open drain alternate output function 3 */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT4 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT4, /**< Open drain alternate output function 4 */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT5 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT5, /**< Open drain alternate output function 5 */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT6 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT6, /**< Open drain alternate output function 6 */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT7 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT7, /**< Open drain alternate output function 7 */ +#if (UC_SERIES == XMC14) + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT8 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT8, /**< Open drain alternate output function 8 */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT9 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT9 /**< Open drain alternate output function 9 */ +#endif +} XMC_GPIO_MODE_t; + +/** + * Configures input hysteresis mode of pin. Use type \a XMC_GPIO_INPUT_HYSTERESIS_t for this enum. + * Selecting the appropriate pad hysteresis allows optimized pad oscillation behavior + * for touch-sensing applications. + */ +typedef enum XMC_GPIO_INPUT_HYSTERESIS +{ + XMC_GPIO_INPUT_HYSTERESIS_STANDARD = 0x0U, /**< Standard hysteresis */ + XMC_GPIO_INPUT_HYSTERESIS_LARGE = 0x4U /**< Large hysteresis */ +} XMC_GPIO_INPUT_HYSTERESIS_t; + + +/********************************************************************************************************************** + * DATA STRUCTURES + *********************************************************************************************************************/ +/** + * Structure points port hardware registers. Use type XMC_GPIO_PORT_t for this structure. + */ +typedef struct XMC_GPIO_PORT { + __IO uint32_t OUT; /**< The port output register determines the value of a GPIO pin when it is + selected by Pn_IOCRx as output */ + __O uint32_t OMR; /**< The port output modification register contains control bits that make it + possible to individually set, reset, or toggle the logic state of a single port + line*/ + __I uint32_t RESERVED0[2]; + __IO uint32_t IOCR[4]; /**< The port input/output control registers select the digital output and input + driver functionality and characteristics of a GPIO port pin */ + __I uint32_t RESERVED1; + __I uint32_t IN; /**< The logic level of a GPIO pin can be read via the read-only port input register + Pn_IN */ + __I uint32_t RESERVED2[6]; + __IO uint32_t PHCR[2]; /**< Pad hysteresis control register */ + __I uint32_t RESERVED3[6]; + __IO uint32_t PDISC; /**< Pin Function Decision Control Register is to disable/enable the digital pad + structure in shared analog and digital ports*/ + __I uint32_t RESERVED4[3]; + __IO uint32_t PPS; /**< Pin Power Save Register */ + __IO uint32_t HWSEL; /**< Pin Hardware Select Register */ +} XMC_GPIO_PORT_t; + +/** + * Structure initializes port pin. Use type XMC_GPIO_CONFIG_t for this structure. + */ +typedef struct XMC_GPIO_CONFIG +{ + XMC_GPIO_MODE_t mode; /**< Defines the direction and characteristics of a pin */ + XMC_GPIO_INPUT_HYSTERESIS_t input_hysteresis; /**< Defines input pad hysteresis of a pin */ + XMC_GPIO_OUTPUT_LEVEL_t output_level; /**< Defines output level of a pin */ +} XMC_GPIO_CONFIG_t; + +/********************************************************************************************************************** + * API PROTOTYPES + *********************************************************************************************************************/ +__STATIC_INLINE bool XMC_GPIO_IsModeValid(XMC_GPIO_MODE_t mode) +{ + return ((mode == XMC_GPIO_MODE_INPUT_TRISTATE) || + (mode == XMC_GPIO_MODE_INPUT_PULL_DOWN) || + (mode == XMC_GPIO_MODE_INPUT_PULL_UP) || + (mode == XMC_GPIO_MODE_INPUT_SAMPLING) || + (mode == XMC_GPIO_MODE_INPUT_INVERTED_TRISTATE) || + (mode == XMC_GPIO_MODE_INPUT_INVERTED_PULL_DOWN) || + (mode == XMC_GPIO_MODE_INPUT_INVERTED_PULL_UP) || + (mode == XMC_GPIO_MODE_INPUT_INVERTED_SAMPLING) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT3) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT4) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT5) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT6) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7) || +#if (UC_SERIES == XMC14) + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT8) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT9) || +#endif + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT1) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT2) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT3) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT4) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT5) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT6) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT7) +#if (UC_SERIES == XMC14) + || (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT8) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT9) +#endif + ); +} + + +/** + * @brief Sets pad hysteresis. + * @param port Constant pointer pointing to GPIO port, to access hardware register Pn_PHCR. + * @param pin Port pin number. + * @param hysteresis input hysteresis selection. Refer data structure @ref XMC_GPIO_INPUT_HYSTERESIS_t + * for details. + * + * @return None + * + * \parDescription:
+ * Sets port pin input hysteresis. It configures hardware registers Pn_PHCR.\a hysteresis is initially configured during + * initialization in XMC_GPIO_Init(). Call this API to alter pad hysteresis as needed later in the program. + * + * \parRelated APIs:
+ * None + * + * \parNote:
+ * Prior to this api, user has to configure port pin to input mode using XMC_GPIO_SetMode(). + * + */ + +void XMC_GPIO_SetInputHysteresis(XMC_GPIO_PORT_t *const port, + const uint8_t pin, + const XMC_GPIO_INPUT_HYSTERESIS_t hysteresis); + +/** + * @} (end addtogroup GPIO) + */ + +/** + * @} (end addtogroup XMClib) + */ + +#endif /* UC_FAMILY == XMC1 */ + +#endif /* XMC1_GPIO_H */ + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_gpio_map.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_gpio_map.h new file mode 100644 index 00000000..22a8183e --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_gpio_map.h @@ -0,0 +1,7063 @@ +/** + * @file xmc1_gpio_map.h + * @date 2016-08-22 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft + * + * 2015-06-20: + * - Updated copyright information + * + * 2015-08-25: + * - Added XMC1400 + * + * 2016-03-09: + * - Fixed VADC_EMUX signals + * - Added P1_6_AF_BCCU0_OUT2 for (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN40) + * - Added HWCTRL_U1C0_DOUTx for XMC14xx + * + * 2016-08-22: + * - Added P1_5_AF_U0C0_DOUT0 for XMC14xx + * - Add missing P4_5_AF_BCCU0_OUT8 for XMC1402/04 64/48 pins package + * + * @endcond + * + * @brief XMC pin mapping definitions + */ + +#ifndef XMC1_GPIO_MAP_H +#define XMC1_GPIO_MAP_H + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN24) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN40) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP16) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP38) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1200) && (UC_PACKAGE == TSSOP38) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == VQFN40) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP28) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP38) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN24) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN40) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP16) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP28) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN24) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN40) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP16) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP38) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN24) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN40) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP16) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP28) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP38) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == LQFP64) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P1_7 XMC_GPIO_PORT1, 7 +#define P1_8 XMC_GPIO_PORT1, 8 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P3_1 XMC_GPIO_PORT3, 1 +#define P3_2 XMC_GPIO_PORT3, 2 +#define P3_3 XMC_GPIO_PORT3, 3 +#define P3_4 XMC_GPIO_PORT3, 4 +#define P4_0 XMC_GPIO_PORT4, 0 +#define P4_1 XMC_GPIO_PORT4, 1 +#define P4_2 XMC_GPIO_PORT4, 2 +#define P4_3 XMC_GPIO_PORT4, 3 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 +#define P4_8 XMC_GPIO_PORT4, 8 +#define P4_9 XMC_GPIO_PORT4, 9 +#define P4_10 XMC_GPIO_PORT4, 10 +#define P4_11 XMC_GPIO_PORT4, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_7_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_7_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_7_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_8_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_8_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_8_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_LEDTS2_COL6 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_LEDTS2_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_1_AF_LEDTS2_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_1_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_2_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_2_AF_LEDTS2_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_3_AF_LEDTS2_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_3_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_4_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_4_AF_LEDTS2_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_4_AF_U1C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_4_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_0_AF_LEDTS2_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_0_AF_ERU1_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_0_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_1_AF_LEDTS2_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_1_AF_ERU1_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_1_AF_U1C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_2_AF_ERU1_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_2_AF_U1C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_3_AF_ERU1_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_3_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_LEDTS2_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_4_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_LEDTS2_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_5_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_LEDTS2_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_6_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_LEDTS2_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_8_AF_LEDTS2_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_8_AF_LEDTS2_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_8_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_8_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_9_AF_LEDTS2_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_9_AF_LEDTS2_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_9_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_9_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_9_AF_U1C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_10_AF_LEDTS2_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_10_AF_LEDTS2_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_10_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_10_AF_U1C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_11_AF_LEDTS2_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_11_AF_LEDTS2_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_11_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_11_AF_U1C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_1_HWCTRL_U1C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_2_HWCTRL_U1C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_3_HWCTRL_U1C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_4_HWCTRL_U1C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P4_4_HWCTRL_LEDTS2_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_5_HWCTRL_LEDTS2_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_6_HWCTRL_LEDTS2_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_7_HWCTRL_LEDTS2_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_8_HWCTRL_LEDTS2_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_9_HWCTRL_LEDTS2_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_10_HWCTRL_LEDTS2_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_11_HWCTRL_LEDTS2_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == VQFN48) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_LEDTS2_COL6 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_LEDTS2_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_LEDTS2_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_4_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_LEDTS2_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_5_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_LEDTS2_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_6_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P4_4_HWCTRL_LEDTS2_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_5_HWCTRL_LEDTS2_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_6_HWCTRL_LEDTS2_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_7_HWCTRL_LEDTS2_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == LQFP64) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P1_7 XMC_GPIO_PORT1, 7 +#define P1_8 XMC_GPIO_PORT1, 8 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P3_1 XMC_GPIO_PORT3, 1 +#define P3_2 XMC_GPIO_PORT3, 2 +#define P3_3 XMC_GPIO_PORT3, 3 +#define P3_4 XMC_GPIO_PORT3, 4 +#define P4_0 XMC_GPIO_PORT4, 0 +#define P4_1 XMC_GPIO_PORT4, 1 +#define P4_2 XMC_GPIO_PORT4, 2 +#define P4_3 XMC_GPIO_PORT4, 3 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 +#define P4_8 XMC_GPIO_PORT4, 8 +#define P4_9 XMC_GPIO_PORT4, 9 +#define P4_10 XMC_GPIO_PORT4, 10 +#define P4_11 XMC_GPIO_PORT4, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_7_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_7_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_7_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_7_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_7_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_8_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_8_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_8_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_8_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_8_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_8_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_1_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_1_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_1_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_1_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_2_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_2_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_2_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_2_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_3_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_3_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_3_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_4_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_4_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_4_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_4_AF_U1C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_4_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_4_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_0_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_0_AF_ERU1_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_0_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_1_AF_ERU1_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_1_AF_U1C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_1_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_2_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_2_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_2_AF_ERU1_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_2_AF_U1C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_2_AF_CCU81_OUT12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_3_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_3_AF_ERU1_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_3_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_3_AF_CCU81_OUT13 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_4_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_6_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_6_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU81_OUT02 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_7_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_7_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU81_OUT03 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_8_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_8_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_8_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_8_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_9_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_9_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_9_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_9_AF_U1C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_9_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_10_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_10_AF_U1C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_10_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_10_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_11_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_11_AF_U1C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_11_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_11_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_1_HWCTRL_U1C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_2_HWCTRL_U1C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_3_HWCTRL_U1C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_4_HWCTRL_U1C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN40) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN48) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_4_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_6_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_6_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU81_OUT02 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_7_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_7_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU81_OUT03 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN64) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P1_7 XMC_GPIO_PORT1, 7 +#define P1_8 XMC_GPIO_PORT1, 8 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P3_1 XMC_GPIO_PORT3, 1 +#define P3_2 XMC_GPIO_PORT3, 2 +#define P3_3 XMC_GPIO_PORT3, 3 +#define P3_4 XMC_GPIO_PORT3, 4 +#define P4_0 XMC_GPIO_PORT4, 0 +#define P4_1 XMC_GPIO_PORT4, 1 +#define P4_2 XMC_GPIO_PORT4, 2 +#define P4_3 XMC_GPIO_PORT4, 3 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 +#define P4_8 XMC_GPIO_PORT4, 8 +#define P4_9 XMC_GPIO_PORT4, 9 +#define P4_10 XMC_GPIO_PORT4, 10 +#define P4_11 XMC_GPIO_PORT4, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_7_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_7_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_7_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_7_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_7_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_8_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_8_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_8_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_8_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_8_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_8_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_1_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_1_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_1_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_1_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_2_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_2_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_2_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_2_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_3_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_3_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_3_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_4_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_4_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_4_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_4_AF_U1C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_4_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_4_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_0_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_0_AF_ERU1_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_0_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_1_AF_ERU1_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_1_AF_U1C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_1_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_2_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_2_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_2_AF_ERU1_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_2_AF_U1C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_2_AF_CCU81_OUT12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_3_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_3_AF_ERU1_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_3_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_3_AF_CCU81_OUT13 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_4_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_6_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_6_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU81_OUT02 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_7_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_7_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU81_OUT03 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_8_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_8_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_8_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_8_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_9_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_9_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_9_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_9_AF_U1C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_9_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_10_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_10_AF_U1C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_10_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_10_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_11_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_11_AF_U1C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_11_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_11_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_1_HWCTRL_U1C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_2_HWCTRL_U1C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_3_HWCTRL_U1C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_4_HWCTRL_U1C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == TSSOP38) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN40) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_4_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN48) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_4_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN64) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P1_7 XMC_GPIO_PORT1, 7 +#define P1_8 XMC_GPIO_PORT1, 8 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P3_1 XMC_GPIO_PORT3, 1 +#define P3_2 XMC_GPIO_PORT3, 2 +#define P3_3 XMC_GPIO_PORT3, 3 +#define P3_4 XMC_GPIO_PORT3, 4 +#define P4_0 XMC_GPIO_PORT4, 0 +#define P4_1 XMC_GPIO_PORT4, 1 +#define P4_2 XMC_GPIO_PORT4, 2 +#define P4_3 XMC_GPIO_PORT4, 3 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 +#define P4_8 XMC_GPIO_PORT4, 8 +#define P4_9 XMC_GPIO_PORT4, 9 +#define P4_10 XMC_GPIO_PORT4, 10 +#define P4_11 XMC_GPIO_PORT4, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_4_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_7_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_7_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_8_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_8_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_8_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_1_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_2_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_3_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_4_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_4_AF_U1C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_4_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_0_AF_ERU1_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_0_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_1_AF_ERU1_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_1_AF_U1C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_2_AF_ERU1_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_2_AF_U1C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_3_AF_ERU1_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_3_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_8_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_8_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_9_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_9_AF_U1C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_9_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_10_AF_U1C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_11_AF_U1C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_1_HWCTRL_U1C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_2_HWCTRL_U1C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_3_HWCTRL_U1C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_4_HWCTRL_U1C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == LQFP64) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P1_7 XMC_GPIO_PORT1, 7 +#define P1_8 XMC_GPIO_PORT1, 8 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P3_1 XMC_GPIO_PORT3, 1 +#define P3_2 XMC_GPIO_PORT3, 2 +#define P3_3 XMC_GPIO_PORT3, 3 +#define P3_4 XMC_GPIO_PORT3, 4 +#define P4_0 XMC_GPIO_PORT4, 0 +#define P4_1 XMC_GPIO_PORT4, 1 +#define P4_2 XMC_GPIO_PORT4, 2 +#define P4_3 XMC_GPIO_PORT4, 3 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 +#define P4_8 XMC_GPIO_PORT4, 8 +#define P4_9 XMC_GPIO_PORT4, 9 +#define P4_10 XMC_GPIO_PORT4, 10 +#define P4_11 XMC_GPIO_PORT4, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_4_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_7_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_7_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_7_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_7_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_7_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_7_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_8_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_8_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_8_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_8_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_8_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_8_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_12_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_LEDTS2_COL6 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_LEDTS2_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_0_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_1_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_1_AF_LEDTS2_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_1_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_1_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_1_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_2_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_2_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_2_AF_LEDTS2_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_2_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_2_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_3_AF_LEDTS2_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_3_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_3_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_3_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_4_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_4_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_4_AF_LEDTS2_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_4_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_4_AF_U1C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_4_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_4_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_0_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_0_AF_LEDTS2_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_0_AF_ERU1_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_0_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_1_AF_LEDTS2_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_1_AF_ERU1_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_1_AF_U1C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_1_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_2_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_2_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_2_AF_ERU1_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_2_AF_U1C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_2_AF_CCU81_OUT12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_3_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_3_AF_ERU1_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_3_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_3_AF_CCU81_OUT13 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_4_AF_LEDTS2_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_4_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_4_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_5_AF_LEDTS2_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_5_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_6_AF_LEDTS2_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_6_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_6_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_6_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU81_OUT02 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_7_AF_LEDTS2_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_7_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_7_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU81_OUT03 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_8_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_8_AF_LEDTS2_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_8_AF_LEDTS2_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_8_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_8_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_8_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_8_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_8_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_9_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_9_AF_LEDTS2_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_9_AF_LEDTS2_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_9_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_9_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_9_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_9_AF_U1C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_9_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_9_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_10_AF_LEDTS2_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_10_AF_LEDTS2_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_10_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_10_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_10_AF_U1C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_10_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_10_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_11_AF_LEDTS2_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_11_AF_LEDTS2_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_11_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_11_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_11_AF_U1C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_11_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_11_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_1_HWCTRL_U1C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_2_HWCTRL_U1C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_3_HWCTRL_U1C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_4_HWCTRL_U1C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P4_4_HWCTRL_LEDTS2_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_5_HWCTRL_LEDTS2_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_6_HWCTRL_LEDTS2_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_7_HWCTRL_LEDTS2_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_8_HWCTRL_LEDTS2_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_9_HWCTRL_LEDTS2_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_10_HWCTRL_LEDTS2_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_11_HWCTRL_LEDTS2_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN48) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_4_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_12_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_LEDTS2_COL6 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_LEDTS2_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_0_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_4_AF_LEDTS2_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_4_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_4_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_5_AF_LEDTS2_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_5_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_6_AF_LEDTS2_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_6_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_6_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_6_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU81_OUT02 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_7_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_7_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU81_OUT03 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P4_4_HWCTRL_LEDTS2_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_5_HWCTRL_LEDTS2_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_6_HWCTRL_LEDTS2_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_7_HWCTRL_LEDTS2_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN64) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P1_7 XMC_GPIO_PORT1, 7 +#define P1_8 XMC_GPIO_PORT1, 8 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P3_1 XMC_GPIO_PORT3, 1 +#define P3_2 XMC_GPIO_PORT3, 2 +#define P3_3 XMC_GPIO_PORT3, 3 +#define P3_4 XMC_GPIO_PORT3, 4 +#define P4_0 XMC_GPIO_PORT4, 0 +#define P4_1 XMC_GPIO_PORT4, 1 +#define P4_2 XMC_GPIO_PORT4, 2 +#define P4_3 XMC_GPIO_PORT4, 3 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 +#define P4_8 XMC_GPIO_PORT4, 8 +#define P4_9 XMC_GPIO_PORT4, 9 +#define P4_10 XMC_GPIO_PORT4, 10 +#define P4_11 XMC_GPIO_PORT4, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_4_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_7_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_7_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_7_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_7_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_7_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_7_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_8_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_8_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_8_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_8_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_8_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_8_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_12_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_LEDTS2_COL6 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_LEDTS2_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_0_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_1_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_1_AF_LEDTS2_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_1_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_1_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_1_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_2_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_2_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_2_AF_LEDTS2_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_2_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_2_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_3_AF_LEDTS2_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_3_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_3_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_3_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_4_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_4_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_4_AF_LEDTS2_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_4_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_4_AF_U1C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_4_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_4_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_0_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_0_AF_LEDTS2_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_0_AF_ERU1_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_0_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_1_AF_LEDTS2_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_1_AF_ERU1_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_1_AF_U1C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_1_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_2_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_2_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_2_AF_ERU1_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_2_AF_U1C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_2_AF_CCU81_OUT12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_3_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_3_AF_ERU1_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_3_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_3_AF_CCU81_OUT13 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_4_AF_LEDTS2_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_4_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_4_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_5_AF_LEDTS2_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_5_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_6_AF_LEDTS2_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_6_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_6_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_6_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU81_OUT02 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_7_AF_LEDTS2_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_7_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_7_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU81_OUT03 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_8_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_8_AF_LEDTS2_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_8_AF_LEDTS2_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_8_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_8_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_8_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_8_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_8_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_9_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_9_AF_LEDTS2_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_9_AF_LEDTS2_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_9_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_9_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_9_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_9_AF_U1C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_9_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_9_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_10_AF_LEDTS2_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_10_AF_LEDTS2_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_10_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_10_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_10_AF_U1C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_10_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_10_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_11_AF_LEDTS2_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_11_AF_LEDTS2_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_11_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_11_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_11_AF_U1C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_11_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_11_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_1_HWCTRL_U1C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_2_HWCTRL_U1C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_3_HWCTRL_U1C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_4_HWCTRL_U1C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P4_4_HWCTRL_LEDTS2_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_5_HWCTRL_LEDTS2_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_6_HWCTRL_LEDTS2_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_7_HWCTRL_LEDTS2_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_8_HWCTRL_LEDTS2_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_9_HWCTRL_LEDTS2_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_10_HWCTRL_LEDTS2_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_11_HWCTRL_LEDTS2_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#endif + +#endif /* XMC1_GPIO_MAP_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_rtc.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_rtc.h new file mode 100644 index 00000000..d76a8bf5 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_rtc.h @@ -0,0 +1,108 @@ +/** + * @file xmc1_rtc.h + * @date 2015-05-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial version + * + * 2015-05-20: + * - Documentation updates
+ * + * @endcond + * + */ + +#ifndef XMC1_RTC_H +#define XMC1_RTC_H + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup RTC + * @{ + */ + +/********************************************************************************************************************* + * ENUMS + *********************************************************************************************************************/ + +/** + * Debug mode status values + */ +typedef enum XMC_RTC_DEBUG_MODE +{ + XMC_RTC_RUN_IN_DEBUG_MODE = 0U, /**< RTC is not stopped during halting mode debug */ + XMC_RTC_STOP_IN_DEBUG_MODE = 1U /**< RTC is stopped during halting mode debug */ +} XMC_RTC_DEBUG_MODE_t; + +/********************************************************************************************************************* + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param debug_mode Debug mode value containing in (::XMC_RTC_DEBUG_MODE_t) to be set + * @return None + * + * \parDescription:
+ * Configures the RTC into running or stopping mode during halting mode debug
+ * + * \par + * The function sets the CTR.SUS bitfield to configure the RTC into running + * or stopping mode during halting mode debug. + */ +void XMC_RTC_SetDebugMode(const XMC_RTC_DEBUG_MODE_t debug_mode); + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* XMC1_RTC_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_scu.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_scu.h new file mode 100644 index 00000000..7bf0b034 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_scu.h @@ -0,0 +1,1341 @@ +/** + * @file xmc1_scu.h + * @date 2017-03-28 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial + * + * 2015-05-20: + * - Description updated
+ * + * 2015-06-20: + * - XMC_SCU_INTERRUPT_EVENT enum elements are typecasted to int64_t + * + * 2015-06-20: + * - Added support for XMC1400 + * + * 2015-11-30: + * - Documentation improved + * + * 2015-12-09: + * - Added XMC_SCU_EnablePrefetchUnit and XMC_SCU_DisablePrefetchUnit + * + * 2016-03-09: + * - Added XMC_SCU_POWER_EnableMonitor/XMC_SCU_POWER_DisableMonitor + * + * 2017-03-28: + * - Fixed prescaler formula comments for XMC_SCU_CLOCK_EnableDCO1ExtRefCalibration() + * - Added XMC_SCU_SetBMI() + * + * @endcond + * + */ + +#ifndef XMC1_SCU_H +#define XMC1_SCU_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include "xmc_common.h" + +#if UC_FAMILY == XMC1 + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup SCU + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +/* + * List of events + */ +#define XMC_SCU_INTERRUPT_EVENT_WDT_WARN SCU_INTERRUPT_SRMSK_PRWARN_Msk /**< WDT pre-warning event. */ +#define XMC_SCU_INTERRUPT_EVENT_RTC_PERIODIC SCU_INTERRUPT_SRCLR_PI_Msk /**< RTC periodic event. */ +#define XMC_SCU_INTERRUPT_EVENT_RTC_ALARM SCU_INTERRUPT_SRCLR_AI_Msk /**< RTC alarm event. */ +#define XMC_SCU_INTERRUPT_EVENT_VDDPI SCU_INTERRUPT_SRMSK_VDDPI_Msk /**< VDDP pre-warning event. */ +#if defined(COMPARATOR) +#define XMC_SCU_INTERRUPT_EVENT_ACMP0 SCU_INTERRUPT_SRMSK_ACMP0I_Msk /**< Analog comparator-0 output event. */ +#define XMC_SCU_INTERRUPT_EVENT_ACMP1 SCU_INTERRUPT_SRMSK_ACMP1I_Msk /**< Analog comparator-1 output event. */ +#define XMC_SCU_INTERRUPT_EVENT_ACMP2 SCU_INTERRUPT_SRMSK_ACMP2I_Msk /**< Analog comparator-2 output event. */ +#if (UC_SERIES == XMC14) || defined(DOXYGEN) +#define XMC_SCU_INTERRUPT_EVENT_ACMP3 (((int64_t)SCU_INTERRUPT_SRMSK1_ACMP3I_Msk) << 32U) /**< Analog comparator-3 output event. @note Only available for XMC1400 series */ +#endif +#endif +#define XMC_SCU_INTERRUPT_EVENT_VDROP SCU_INTERRUPT_SRMSK_VDROPI_Msk /**< VDROP event. */ +#if UC_SERIES != XMC11 +#define XMC_SCU_INTERRUPT_EVENT_ORC0 SCU_INTERRUPT_SRMSK_ORC0I_Msk /**< Out of range comparator-0 event. */ +#define XMC_SCU_INTERRUPT_EVENT_ORC1 SCU_INTERRUPT_SRMSK_ORC1I_Msk /**< Out of range comparator-1 event. */ +#define XMC_SCU_INTERRUPT_EVENT_ORC2 SCU_INTERRUPT_SRMSK_ORC2I_Msk /**< Out of range comparator-2 event. */ +#define XMC_SCU_INTERRUPT_EVENT_ORC3 SCU_INTERRUPT_SRMSK_ORC3I_Msk /**< Out of range comparator-3 event. */ +#define XMC_SCU_INTERRUPT_EVENT_ORC4 SCU_INTERRUPT_SRMSK_ORC4I_Msk /**< Out of range comparator-4 event. */ +#define XMC_SCU_INTERRUPT_EVENT_ORC5 SCU_INTERRUPT_SRMSK_ORC5I_Msk /**< Out of range comparator-5 event. */ +#define XMC_SCU_INTERRUPT_EVENT_ORC6 SCU_INTERRUPT_SRMSK_ORC6I_Msk /**< Out of range comparator-6 event. */ +#define XMC_SCU_INTERRUPT_EVENT_ORC7 SCU_INTERRUPT_SRMSK_ORC7I_Msk /**< Out of range comparator-7 event. */ +#endif +#define XMC_SCU_INTERRUPT_EVENT_LOCI SCU_INTERRUPT_SRMSK_LOCI_Msk /**< Loss of clock event. */ +#define XMC_SCU_INTERRUPT_EVENT_PESRAM SCU_INTERRUPT_SRMSK_PESRAMI_Msk /**< PSRAM Parity error event. */ +#define XMC_SCU_INTERRUPT_EVENT_PEUSIC0 SCU_INTERRUPT_SRMSK_PEU0I_Msk /**< USIC0 Parity error event. */ +#if defined(USIC1) +#define XMC_SCU_INTERRUPT_EVENT_PEUSIC1 (((int64_t)SCU_INTERRUPT_SRMSK1_PEU1I_Msk) << 32U) /**< USIC1 Parity error event. */ +#endif +#define XMC_SCU_INTERRUPT_EVENT_FLASH_ERROR SCU_INTERRUPT_SRMSK_FLECC2I_Msk /**< Flash ECC double bit error event. */ +#define XMC_SCU_INTERRUPT_EVENT_FLASH_COMPLETED SCU_INTERRUPT_SRCLR_FLCMPLTI_Msk /**< Flash operation completion event. */ +#define XMC_SCU_INTERRUPT_EVENT_VCLIP SCU_INTERRUPT_SRMSK_VCLIPI_Msk /**< VCLIP event. */ +#define XMC_SCU_INTERRUPT_EVENT_STDBYCLKFAIL SCU_INTERRUPT_SRMSK_SBYCLKFI_Msk /**< Standby clock failure event. */ +#define XMC_SCU_INTERRUPT_EVENT_RTCCTR_UPDATED SCU_INTERRUPT_SRMSK_RTC_CTR_Msk /**< RTCCTR register update event. */ +#define XMC_SCU_INTERRUPT_EVENT_RTCATIM0_UPDATED SCU_INTERRUPT_SRMSK_RTC_ATIM0_Msk /**< RTCATIM0 register update event. */ +#define XMC_SCU_INTERRUPT_EVENT_RTCATIM1_UPDATED SCU_INTERRUPT_SRMSK_RTC_ATIM1_Msk /**< RTCATIM1 register update event. */ +#define XMC_SCU_INTERRUPT_EVENT_RTCTIM0_UPDATED SCU_INTERRUPT_SRMSK_RTC_TIM0_Msk /**< RTCTIM0 register update event. */ +#define XMC_SCU_INTERRUPT_EVENT_RTCTIM1_UPDATED SCU_INTERRUPT_SRMSK_RTC_TIM1_Msk /**< RTCTIM1 register update event. */ +#define XMC_SCU_INTERRUPT_EVENT_TSE_DONE SCU_INTERRUPT_SRMSK_TSE_DONE_Msk /**< Temperature measurement Completion event. */ +#define XMC_SCU_INTERRUPT_EVENT_TSE_HIGH SCU_INTERRUPT_SRMSK_TSE_HIGH_Msk /**< Temperature too high event. */ +#define XMC_SCU_INTERRUPT_EVENT_TSE_LOW SCU_INTERRUPT_SRMSK_TSE_LOW_Msk /**< Temperature too low event. */ +#if defined(CAN) +#define XMC_SCU_INTERRUPT_EVENT_PEMCAN (((int64_t)SCU_INTERRUPT_SRMSK1_PEMCI_Msk) << 32U) /**< MultiCAN SRAM Parity Error Event. */ +#endif +#if (UC_SERIES == XMC14) || defined(DOXYGEN) +#define XMC_SCU_INTERRUPT_EVENT_LOSS_EXT_CLOCK (((int64_t)SCU_INTERRUPT_SRMSK1_LOECI_Msk) << 32U) /**< Loss of external OSC_HP clock event. @note Only available for XMC1400 series */ +#define XMC_SCU_INTERRUPT_EVENT_DCO1_OUT_SYNC (((int64_t)SCU_INTERRUPT_SRMSK1_DCO1OFSI_Msk) << 32U) /**< DCO1 Out of SYNC Event. @note Only available for XMC1400 series */ +#endif + +/* + * These are the flags which may be passed to XMC_SCU_SetBMI(). + */ +#if defined(CAN) || defined(DOXYGEN) +#define XMC_SCU_BMI_HWCFG_CAN_BSL (0x0080U) /**< CAN Bootstrap Loader Start-up Mode */ +#define XMC_SCU_BMI_HWCFG_CAN_BSLTO (0x0090U) /**< CAN Bootstrap Loader Start-up Mode with time-out */ +#define XMC_SCU_BMI_HWCFG_SBSL_CANOPEN (0x00A0U) /**< Secure Bootstrap Loader Start-up Mode over CANopen */ +#endif + +#define XMC_SCU_BMI_HWCFG_ASC_BSL (0x00C0U) /**< ASC Bootstrap Loader Start-up Mode */ +#define XMC_SCU_BMI_HWCFG_UPM (0x00C1U) /**< User productive Start-up Mode */ +#define XMC_SCU_BMI_HWCFG_UMD (0x00C3U) /**< User Start-up Mode with debug enabled */ +#define XMC_SCU_BMI_HWCFG_UMHAR (0x00C7U) /**< User Start-up Mode with debug enabled and halt after reset (HAR) */ +#define XMC_SCU_BMI_HWCFG_SSC_BSL (0x00C8U) /**< SSC Bootstrap Loader Start-up Mode */ +#define XMC_SCU_BMI_HWCFG_ASC_BSLTO (0x00D0U) /**< ASC BSL Start-up Mode with time-out */ +#define XMC_SCU_BMI_HWCFG_SSC_BSLTO (0x00D8U) /**< SSC BSL Start-up Mode with time-out */ +#define XMC_SCU_BMI_HWCFG_SBSL (0x00FAU) /**< Secure Bootstrap Loader Start-up Mode over ASC */ + +#define XMC_SCU_BMI_DAPTYP_SWD (0U << 8) /**< Serial wire debug (SWD) interface is selected */ +#define XMC_SCU_BMI_DAPTYP_SPD (1U << 8) /**< Single pin debug (SPD) interface is selected */ + +#define XMC_SCU_BMI_DAPDIS_CHANNEL_0 (0U << 9) /**< SWD/SPD_0 pin is selected */ +#define XMC_SCU_BMI_DAPDIS_CHANNEL_1 (1U << 9) /**< SWD/SPD_1 pin is selected */ + +#if defined(CAN) || defined(DOXYGEN) +#define XMC_SCU_BMI_CANCLK_DCO1 (0U << 11) /**< Synchronous CAN clock via internal oscillator (DCO1) with enabled trimming via external reference is selected */ +#define XMC_SCU_BMI_CANCLK_OSCHP (1U << 11) /**< Synchronous CAN clock via external oscillator (OSC_HP) is selected */ +#endif + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/** + * Defines the cause of last reset. The cause of last reset gets automatically stored in + * the \a SCU_RSTSTAT register and can be checked by user software to determine the state of the system and for debug + * purpose. All the enum items are tabulated as per bits present in \a SCU_RSTSTAT register. + * Use type \a XMC_SCU_RESET_REASON_t for accessing these enum parameters. + */ +typedef enum XMC_SCU_RESET_REASON +{ + XMC_SCU_RESET_REASON_PORST = (1UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos), /**< Reset due to Power On reset. */ + XMC_SCU_RESET_REASON_MASTER = (2UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos), /**< Reset due to Master reset. */ + XMC_SCU_RESET_REASON_SW = (4UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos), /**< Reset due to Software initiated reset. */ + XMC_SCU_RESET_REASON_LOCKUP = (8UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos), /**< Reset due to CPU lockup. */ + XMC_SCU_RESET_REASON_FLASH = (16UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos), /**< Reset due to flash error. */ + XMC_SCU_RESET_REASON_WATCHDOG = (32UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos), /**< Reset due to watchdog. */ + XMC_SCU_RESET_REASON_CLOCK_LOSS = (64UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos), /**< Reset due to clock loss. */ + XMC_SCU_RESET_REASON_PARITY_ERROR = (128UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos) /**< Reset due to RAM parity error. */ +} XMC_SCU_RESET_REASON_t; + +/** + * Defines the reset sources that can cause device reset. These enums can be used to configure reset source in reset + * control \a RSTCON register which enables different reset sources to identify the reset cause. The \a SCU_RSTSTAT + * register can be checked by user software to determine the state of the system and for debug + * purpose. Use type \a XMC_SCU_SYSTEM_RESET_REQUEST_t for accessing these enum parameters. + */ +typedef enum XMC_SCU_SYSTEM_RESET_REQUEST +{ + XMC_SCU_RESET_REQUEST_FLASH_ECC_ERROR = SCU_RESET_RSTCON_ECCRSTEN_Msk, /**< Reset when ECC double bit error occurs.*/ + XMC_SCU_RESET_REQUEST_CLOCK_LOSS = SCU_RESET_RSTCON_LOCRSTEN_Msk, /**< Reset when loss of clock occurs.*/ + XMC_SCU_RESET_REQUEST_SRAM_PARITY_ERROR = SCU_RESET_RSTCON_SPERSTEN_Msk, /**< Reset when SRAM parity error occurs.*/ + XMC_SCU_RESET_REQUEST_USIC_SRAM_PARITY_ERROR = SCU_RESET_RSTCON_U0PERSTEN_Msk /**< Reset when USIC0 memory parity error occurs.*/ +} XMC_SCU_SYSTEM_RESET_REQUEST_t; + +/** + * Defines list of events that can generate SCU interrupt. These enums can be used to configure events + * in \a SRMSK register for assertion of interrupt. All the enum items are tabulated as per bits present + * in \a SRMSK register. Use type \a XMC_SCU_INTERRUPT_EVENT_t for accessing these enum parameters. These + * enums can also be used for checking the status of events from the \a SRSTAT register. + */ +#if (UC_SERIES == XMC14) +typedef uint64_t XMC_SCU_INTERRUPT_EVENT_t; +#else +typedef uint32_t XMC_SCU_INTERRUPT_EVENT_t; +#endif + +/** + * Defines possible sources of RTC clock. These enums can be used to configure \a RTCCLKSEL bits of \a CLKCR Clock Control + * Register. Use type \a XMC_SCU_CLOCK_RTCCLKSRC_t for accessing these enum parameters. + */ +typedef enum XMC_SCU_CLOCK_RTCCLKSRC +{ + XMC_SCU_CLOCK_RTCCLKSRC_DCO2 = (0x0UL << SCU_CLK_CLKCR_RTCCLKSEL_Pos), /**< RTC clock source is standby clock. */ + XMC_SCU_CLOCK_RTCCLKSRC_ERU_IOUT0 = (0x1UL << SCU_CLK_CLKCR_RTCCLKSEL_Pos), /**< RTC clock source is external clock from + ERU0.IOUT0. */ + XMC_SCU_CLOCK_RTCCLKSRC_ACMP0_OUT = (0x2UL << SCU_CLK_CLKCR_RTCCLKSEL_Pos), /**< RTC clock source is external clock from + ACMP0.OUT. */ + XMC_SCU_CLOCK_RTCCLKSRC_ACMP1_OUT = (0x3UL << SCU_CLK_CLKCR_RTCCLKSEL_Pos), /**< RTC clock source is external clock from + ACMP1.OUT. */ + XMC_SCU_CLOCK_RTCCLKSRC_ACMP2_OUT = (0x4UL << SCU_CLK_CLKCR_RTCCLKSEL_Pos), /**< RTC clock source is external clock from + ACMP2.OUT. */ +#if (UC_SERIES == XMC14) || defined(DOXYGEN) + XMC_SCU_CLOCK_RTCCLKSRC_OSCLP = (0x5UL << SCU_CLK_CLKCR_RTCCLKSEL_Pos) /**< 32.768kHz XTAL clock via OSC_LP. @note Only available for XMC1400 series */ +#endif +} XMC_SCU_CLOCK_RTCCLKSRC_t; + +/** + * Defines possible sources of peripheral clock (PCLK). These enums can be used to configure \a PCLKSEL bits of \a CLKCR + * Clock Control Register. Use type \a XMC_SCU_CLOCK_PCLKSRC_t for accessing these enum parameters. + */ +typedef enum XMC_SCU_CLOCK_PCLKSRC +{ + XMC_SCU_CLOCK_PCLKSRC_MCLK = (0UL << SCU_CLK_CLKCR_PCLKSEL_Pos), /**< MCLK as the source for PCLK. */ + XMC_SCU_CLOCK_PCLKSRC_DOUBLE_MCLK = (1UL << SCU_CLK_CLKCR_PCLKSEL_Pos) /**< Source of PCLK is twice the MCLK. */ +} XMC_SCU_CLOCK_PCLKSRC_t; + +#if (UC_SERIES == XMC14) || defined(DOXYGEN) +/** + * DCLK clock source selection + * @note Only available in XMC1400 series + */ +typedef enum XMC_SCU_CLOCK_DCLKSRC +{ + XMC_SCU_CLOCK_DCLKSRC_DCO1 = 0UL << SCU_CLK_CLKCR1_DCLKSEL_Pos, /**< Internal oscillator DCO1 (48MHz) */ + XMC_SCU_CLOCK_DCLKSRC_EXT_XTAL = 1UL << SCU_CLK_CLKCR1_DCLKSEL_Pos, /**< External crystal oscillator */ +} XMC_SCU_CLOCK_DCLKSRC_t; + +/** + * OSCHP mode + * @note Only available in XMC1400 series + */ +typedef enum XMC_SCU_CLOCK_OSCHP_MODE +{ + XMC_SCU_CLOCK_OSCHP_MODE_OSC = 0UL << SCU_ANALOG_ANAOSCHPCTRL_MODE_Pos, /**< Oscillator is enabled and in active power mode with shaper enabled */ + XMC_SCU_CLOCK_OSCHP_MODE_DIRECT = 1UL << SCU_ANALOG_ANAOSCHPCTRL_MODE_Pos, /**< Oscillator in power down mode with shaper enabled */ + XMC_SCU_CLOCK_OSCHP_MODE_DISABLED = 3UL << SCU_ANALOG_ANAOSCHPCTRL_MODE_Pos, /**< Oscillator in power down mode with shaper enabled */ +} XMC_SCU_CLOCK_OSCHP_MODE_t; + +/** + * OSCLP mode + * @note Only available in XMC1400 series + */ +typedef enum XMC_SCU_CLOCK_OSCLP_MODE +{ + XMC_SCU_CLOCK_OSCLP_MODE_OSC = 0UL << SCU_ANALOG_ANAOSCLPCTRL_MODE_Pos, /**< Oscillator is enabled and in active power mode with shaper enabled */ + XMC_SCU_CLOCK_OSCLP_MODE_DISABLED = 3UL << SCU_ANALOG_ANAOSCLPCTRL_MODE_Pos, /**< Oscillator in power down mode with shaper enabled */ +} XMC_SCU_CLOCK_OSCLP_MODE_t; + +/** + * Clock source for synchronization + * @note Only available in XMC1400 series + */ +typedef enum XMC_SCU_CLOCK_SYNC_CLKSRC +{ + XMC_SCU_CLOCK_SYNC_CLKSRC_OSCLP = 0U << SCU_ANALOG_ANASYNC1_XTAL_SEL_Pos, + XMC_SCU_CLOCK_SYNC_CLKSRC_OSCHP = 1U << SCU_ANALOG_ANASYNC1_XTAL_SEL_Pos, +} XMC_SCU_CLOCK_SYNC_CLKSRC_t; + +#endif /* (UC_SERIES == XMC14) */ + +/** + * Defines the list of peripherals that support clock gating. After a master reset, only core, memories, SCU + * and PORT peripheral are not clock gated. The rest of the peripherals are by default clock gated. + * All the enum items are tabulated as per bits present in \a CGATSTAT0 register. + * Use type \a XMC_SCU_PERIPHERAL_CLOCK_t for accessing these enum parameters. + * @note Peripherals availability depends on device + */ +typedef enum XMC_SCU_PERIPHERAL_CLOCK +{ +#if defined(VADC) + XMC_SCU_PERIPHERAL_CLOCK_VADC = SCU_CLK_CGATSTAT0_VADC_Msk, /**< VADC peripheral clock gate. */ +#endif +#if defined(CCU80) + XMC_SCU_PERIPHERAL_CLOCK_CCU80 = SCU_CLK_CGATSTAT0_CCU80_Msk, /**< CCU80 peripheral clock gate. */ +#endif +#if defined(CCU40) + XMC_SCU_PERIPHERAL_CLOCK_CCU40 = SCU_CLK_CGATSTAT0_CCU40_Msk, /**< CCU40 peripheral clock gate. */ +#endif +#if defined(USIC0) + XMC_SCU_PERIPHERAL_CLOCK_USIC0 = SCU_CLK_CGATSTAT0_USIC0_Msk, /**< USIC0 peripheral clock gate. */ +#endif +#if defined(BCCU0) + XMC_SCU_PERIPHERAL_CLOCK_BCCU0 = SCU_CLK_CGATSTAT0_BCCU0_Msk, /**< BCCU0 peripheral clock gate. */ +#endif +#if defined(LEDTS0) + XMC_SCU_PERIPHERAL_CLOCK_LEDTS0 = SCU_CLK_CGATSTAT0_LEDTS0_Msk, /**< LEDTS0 peripheral clock gate. */ +#endif +#if defined(LEDTS1) + XMC_SCU_PERIPHERAL_CLOCK_LEDTS1 = SCU_CLK_CGATSTAT0_LEDTS1_Msk, /**< LEDTS1 peripheral clock gate. */ +#endif +#if defined(POSIF0) + XMC_SCU_PERIPHERAL_CLOCK_POSIF0 = SCU_CLK_CGATSTAT0_POSIF0_Msk, /**< POSIF0 peripheral clock gate. */ +#endif +#if defined(MATH) + XMC_SCU_PERIPHERAL_CLOCK_MATH = SCU_CLK_CGATSTAT0_MATH_Msk, /**< MATH peripheral clock gate. */ +#endif + XMC_SCU_PERIPHERAL_CLOCK_WDT = SCU_CLK_CGATSTAT0_WDT_Msk, /**< WDT peripheral clock gate. */ + XMC_SCU_PERIPHERAL_CLOCK_RTC = SCU_CLK_CGATSTAT0_RTC_Msk, /**< RTC peripheral clock gate. */ +#if defined(CCU81) + XMC_SCU_PERIPHERAL_CLOCK_CCU81 = SCU_CLK_CGATSTAT0_CCU81_Msk, /**< CCU80 peripheral clock gate. */ +#endif +#if defined(CCU41) + XMC_SCU_PERIPHERAL_CLOCK_CCU41 = SCU_CLK_CGATSTAT0_CCU41_Msk, /**< CCU80 peripheral clock gate. */ +#endif +#if defined(USIC1) + XMC_SCU_PERIPHERAL_CLOCK_USIC1 = SCU_CLK_CGATSTAT0_USIC1_Msk, /**< USIC0 peripheral clock gate. */ +#endif +#if defined(LEDTS2) + XMC_SCU_PERIPHERAL_CLOCK_LEDTS2 = SCU_CLK_CGATSTAT0_LEDTS2_Msk, /**< LEDTS1 peripheral clock gate. */ +#endif +#if defined(POSIF1) + XMC_SCU_PERIPHERAL_CLOCK_POSIF1 = SCU_CLK_CGATSTAT0_POSIF1_Msk, /**< POSIF0 peripheral clock gate. */ +#endif +#if defined(CAN) + XMC_SCU_PERIPHERAL_CLOCK_MCAN = SCU_CLK_CGATSTAT0_MCAN0_Msk, /**< POSIF0 peripheral clock gate. */ +#endif +} XMC_SCU_PERIPHERAL_CLOCK_t; + + +/** + * Defines options for Capture/Compare unit timer slice trigger that enables synchronous start function available on the \a SCU, + * \a CCUCON register. Use type \a XMC_SCU_CCU_TRIGGER_t for accessing these enum parameters. + */ +typedef enum XMC_SCU_CCU_TRIGGER +{ + XMC_SCU_CCU_TRIGGER_CCU40 = SCU_GENERAL_CCUCON_GSC40_Msk, /**< Trigger CCU40 peripheral. */ +#if defined(CCU80) + XMC_SCU_CCU_TRIGGER_CCU80 = SCU_GENERAL_CCUCON_GSC80_Msk, /**< Trigger CCU80 peripheral. */ +#endif +#if defined(CCU41) + XMC_SCU_CCU_TRIGGER_CCU41 = SCU_GENERAL_CCUCON_GSC41_Msk, /**< Trigger CCU40 peripheral. */ +#endif +#if defined(CCU81) + XMC_SCU_CCU_TRIGGER_CCU81 = SCU_GENERAL_CCUCON_GSC81_Msk, /**< Trigger CCU80 peripheral. */ +#endif +} XMC_SCU_CCU_TRIGGER_t; + +#if (UC_SERIES == XMC14) || defined(DOXYGEN) +/** + * Selects the service request connected to the interrupt node. + * @image html "xmc1400_irqmux.png" + * @note Only available for XMC1400 series + */ +typedef enum XMC_SCU_IRQCTRL +{ + XMC_SCU_IRQCTRL_SCU_SR0_IRQ0 = (0U << 8U) | 0U, /**< SCU_SR0 connected to IRQ0 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR0_IRQ0 = (0U << 8U) | 1U, /**< CAN0_SR0 connected to IRQ0 */ +#endif + XMC_SCU_IRQCTRL_CCU40_SR0_IRQ0 = (0U << 8U) | 2U, /**< CCU40_SR0 connected to IRQ0 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_SCU_SR0_OR_CAN0_SR0_IRQ0 = (0U << 8U) | 3U, /**< SCU_SR0 and CAN_SR0 are both connected to IRQ0*/ +#endif + + XMC_SCU_IRQCTRL_SCU_SR1_IRQ1 = (1U << 8U) | 0U, /**< SCU_SR1 connected to IRQ1 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR1_IRQ1 = (1U << 8U) | 1U, /**< CAN0_SR1 connected to IRQ1 */ +#endif +#if defined(CCU80) + XMC_SCU_IRQCTRL_CCU80_SR0_IRQ1 = (1U << 8U) | 2U, /**< CCU80_SR0 connected to IRQ1 */ +#endif +#if defined(CAN) + XMC_SCU_IRQCTRL_SCU_SR1_OR_CAN0_SR1_IRQ1 = (1U << 8U) | 3U, /**< SCU_SR1 and CAN0_SR1 connected to IRQ1 */ +#endif + + XMC_SCU_IRQCTRL_SCU_SR2_IRQ2 = (2U << 8U) | 0U, /**< SCU_SR2 connected to IRQ2 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR2_IRQ2 = (2U << 8U) | 1U, /**< CAN0_SR2 connected to IRQ2 */ +#endif +#if defined(CCU80) + XMC_SCU_IRQCTRL_CCU80_SR1_IRQ2 = (2U << 8U) | 2U, /**< CCU80_SR1 connected to IRQ2 */ +#endif +#if defined(CAN) + XMC_SCU_IRQCTRL_SCU_SR2_OR_CAN0_SR2_IRQ2 = (2U << 8U) | 3U, /**< SCU_SR2 and CAN0_SR2 connected to IRQ2 */ +#endif + + XMC_SCU_IRQCTRL_ERU0_SR0_IRQ3 = (3U << 8U) | 0U, /**< ERU0_SR0 connected to IRQ3 */ + XMC_SCU_IRQCTRL_ERU1_SR0_IRQ3 = (3U << 8U) | 1U, /**< ERU1_SR0 connected to IRQ3 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR0_IRQ3 = (3U << 8U) | 2U, /**< CAN0_SR0 connected to IRQ3 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR0_OR_ERU1_SR0_IRQ3 = (3U << 8U) | 3U, /**< ERU0_SR0 and ERU1_SR0 connected to IRQ3 */ + + XMC_SCU_IRQCTRL_ERU0_SR1_IRQ4 = (4U << 8U) | 0U, /**< ERU0_SR1 connected to IRQ4 */ + XMC_SCU_IRQCTRL_ERU1_SR1_IRQ4 = (4U << 8U) | 1U, /**< ERU1_SR1 connected to IRQ4 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR1_IRQ4 = (4U << 8U) | 2U, /**< CAN0_SR1 connected to IRQ4 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR1_OR_ERU1_SR1_IRQ4 = (4U << 8U) | 3U, /**< ERU0_SR1 and ERU1_SR1 connected to IRQ4 */ + + XMC_SCU_IRQCTRL_ERU0_SR2_IRQ5 = (5U << 8U) | 0U, /**< ERU0_SR2 connected to IRQ5 */ + XMC_SCU_IRQCTRL_ERU1_SR2_IRQ5 = (5U << 8U) | 1U, /**< ERU1_SR2 connected to IRQ5 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR2_IRQ5 = (5U << 8U) | 2U, /**< CAN0_SR2 connected to IRQ5 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR2_OR_ERU1_SR2_IRQ5 = (5U << 8U) | 3U, /**< ERU0_SR2 and ERU1_SR2 connected to IRQ5 */ + + XMC_SCU_IRQCTRL_ERU0_SR3_IRQ6 = (6U << 8U) | 0U, /**< ERU0_SR3 connected to IRQ6 */ + XMC_SCU_IRQCTRL_ERU1_SR3_IRQ6 = (6U << 8U) | 1U, /**< ERU1_SR3 connected to IRQ6 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR3_IRQ6 = (6U << 8U) | 2U, /**< CAN0_SR3 connected to IRQ6 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR3_OR_ERU1_SR3_IRQ6 = (6U << 8U) | 3U, /**< ERU0_SR3 and ERU1_SR3 connected to IRQ6 */ + +#if defined(MATH) + XMC_SCU_IRQCTRL_MATH_SR0_IRQ7 = (7U << 8U) | 0U, /**< MATH_SR0 connected to IRQ7 */ +#endif +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR3_IRQ7 = (7U << 8U) | 1U, /**< CAN0_SR3 connected to IRQ7 */ +#endif + XMC_SCU_IRQCTRL_CCU40_SR1_IRQ7 = (7U << 8U) | 2U, /**< CCU40_SR1 connected to IRQ7 */ +#if defined(MATH) && defined(CAN) + XMC_SCU_IRQCTRL_MATH_SR0_OR_CAN0_SR3_IRQ7 = (7U << 8U) | 3U, /**< MATH_SR0 and CAN0_SR3 connected to IRQ7 */ +#endif + +#if defined(LEDTS2) + XMC_SCU_IRQCTRL_LEDTS2_SR0_IRQ8 = (8U << 8U) | 0U, /**< LEDTS2_SR0 connected to IRQ8 */ +#endif + XMC_SCU_IRQCTRL_CCU40_SR0_IRQ8 = (8U << 8U) | 1U, /**< CCU40_SR0 connected to IRQ8 */ +#if defined(CCU80) + XMC_SCU_IRQCTRL_CCU80_SR0_IRQ8 = (8U << 8U) | 2U, /**< CCU80_SR0 connected to IRQ8 */ +#endif +#if defined(LEDTS2) + XMC_SCU_IRQCTRL_LEDTS2_SR0_OR_CCU40_SR0_IRQ8 = (8U << 8U) | 3U, /**< LEDTS2_SR0 and CCU40_SR0 connected to IRQ8 */ +#endif + + XMC_SCU_IRQCTRL_USIC0_SR0_IRQ9 = (9U << 8U) | 0U, /**< USIC0_SR0 connected to IRQ9 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC1_SR0_IRQ9 = (9U << 8U) | 1U, /**< USIC1_SR0 connected to IRQ9 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR0_IRQ9 = (9U << 8U) | 2U, /**< ERU0_SR0 connected to IRQ9 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC0_SR0_OR_USIC1_SR0_IRQ9 = (9U << 8U) | 3U, /**< USIC0_SR0 and USIC1_SR0 connected to IRQ9 */ +#endif + + XMC_SCU_IRQCTRL_USIC0_SR1_IRQ10 = (10U << 8U) | 0U, /**< USIC0_SR1 connected to IRQ10 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC1_SR1_IRQ10 = (10U << 8U) | 1U, /**< USIC1_SR1 connected to IRQ10 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR1_IRQ10 = (10U << 8U) | 2U, /**< ERU0_SR1 connected to IRQ10 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC0_SR1_OR_USIC1_SR1_IRQ10 = (10U << 8U) | 3U, /**< USIC0_SR1 and USIC1_SR1 connected to IRQ10 */ +#endif + + XMC_SCU_IRQCTRL_USIC0_SR2_IRQ11 = (11U << 8U) | 0U, /**< USIC0_SR2 connected to IRQ11 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC1_SR2_IRQ11 = (11U << 8U) | 1U, /**< USIC1_SR2 connected to IRQ11 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR2_IRQ11 = (11U << 8U) | 2U, /**< ERU0_SR2 connected to IRQ11 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC0_SR2_OR_USIC1_SR2_IRQ11 = (11U << 8U) | 3U, /**< USIC0_SR2 and USIC1_SR2 connected to IRQ11 */ +#endif + + XMC_SCU_IRQCTRL_USIC0_SR3_IRQ12 = (12U << 8U) | 0U, /**< USIC0_SR3 connected to IRQ12 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC1_SR3_IRQ12 = (12U << 8U) | 1U, /**< USIC1_SR3 connected to IRQ12 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR3_IRQ12 = (12U << 8U) | 2U, /**< ERU0_SR3 connected to IRQ12 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC0_SR3_OR_USIC1_SR3_IRQ12 = (12U << 8U) | 3U, /**< USIC0_SR3 and USIC1_SR3 connected to IRQ12 */ +#endif + + XMC_SCU_IRQCTRL_USIC0_SR4_IRQ13 = (13U << 8U) | 0U, /**< USIC0_SR4 connected to IRQ13 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC1_SR4_IRQ13 = (13U << 8U) | 1U, /**< USIC1_SR4 connected to IRQ13 */ +#endif +#if defined(CCU80) + XMC_SCU_IRQCTRL_CCU80_SR1_IRQ13 = (13U << 8U) | 2U, /**< CCU80_SR1 connected to IRQ13 */ +#endif +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC0_SR4_OR_USIC1_SR4_IRQ13 = (13U << 8U) | 3U, /**< USIC0_SR4 and USIC1_SR4 connected to IRQ13 */ +#endif + + XMC_SCU_IRQCTRL_USIC0_SR5_IRQ14 = (14U << 8U) | 0U, /**< USIC0_SR5 connected to IRQ14 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC1_SR5_IRQ14 = (14U << 8U) | 1U, /**< USIC1_SR5 connected to IRQ14 */ +#endif +#if defined(POSIF0) + XMC_SCU_IRQCTRL_POSIF0_SR0_IRQ14 = (14U << 8U) | 2U, /**< POSIF0_SR0 connected to IRQ14 */ +#endif +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC0_SR5_OR_USIC1_SR5_IRQ14 = (14U << 8U) | 3U, /**< USIC0_SR5 and USIC1_SR5 connected to IRQ14 */ +#endif + + XMC_SCU_IRQCTRL_VADC0_C0SR0_IRQ15 = (15U << 8U) | 0U, /**< VADC0_C0SR0 connected to IRQ15 */ + XMC_SCU_IRQCTRL_USIC0_SR0_IRQ15 = (15U << 8U) | 1U, /**< USIC0_SR0 connected to IRQ15 */ +#if defined(POSIF0) + XMC_SCU_IRQCTRL_POSIF0_SR1_IRQ15 = (15U << 8U) | 2U, /**< POSIF0_SR1 connected to IRQ15 */ +#endif + XMC_SCU_IRQCTRL_VADC0_C0SR0_OR_USIC0_SR0_IRQ15 = (15U << 8U) | 3U, /**< VADC0_C0SR0 and USIC0_SR0 connected to IRQ15 */ + + XMC_SCU_IRQCTRL_VADC0_C0SR1_IRQ16 = (16U << 8U) | 0U, /**< VADC0_C0SR1 connected to IRQ16 */ + XMC_SCU_IRQCTRL_USIC0_SR1_IRQ16 = (16U << 8U) | 1U, /**< USIC0_SR1 connected to IRQ16 */ + XMC_SCU_IRQCTRL_CCU40_SR2_IRQ16 = (16U << 8U) | 2U, /**< CCU40_SR2 connected to IRQ16 */ + XMC_SCU_IRQCTRL_VADC0_C0SR1_OR_USIC0_SR1_IRQ16 = (16U << 8U) | 3U, /**< VADC0_C0SR1 and USIC0_SR1 connected to IRQ16 */ + + XMC_SCU_IRQCTRL_VADC0_G0SR0_IRQ17 = (17U << 8U) | 0U, /**< VADC0_G0SR0 connected to IRQ17 */ + XMC_SCU_IRQCTRL_USIC0_SR2_IRQ17 = (17U << 8U) | 1U, /**< USIC0_SR2 connected to IRQ17 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR0_IRQ17 = (17U << 8U) | 2U, /**< CAN0_SR0 connected to IRQ17 */ +#endif + XMC_SCU_IRQCTRL_VADC0_G0SR0_OR_USIC0_SR2_IRQ17 = (17U << 8U) | 3U, /**< VADC0_G0SR0 and USIC0_SR2 connected to IRQ17 */ + + XMC_SCU_IRQCTRL_VADC0_G0SR1_IRQ18 = (18U << 8U) | 0U, /**< VADC0_G0SR1 connected to IRQ18 */ + XMC_SCU_IRQCTRL_USIC0_SR3_IRQ18 = (18U << 8U) | 1U, /**< USIC0_SR3 connected to IRQ18 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR1_IRQ18 = (18U << 8U) | 2U, /**< CAN0_SR1 connected to IRQ18 */ +#endif + XMC_SCU_IRQCTRL_VADC0_G0SR1_OR_USIC0_SR3_IRQ18 = (18U << 8U) | 3U, /**< VADC0_G0SR1 and USIC0_SR3 connected to IRQ18 */ + + XMC_SCU_IRQCTRL_VADC0_G1SR0_IRQ19 = (19U << 8U) | 0U, /**< VADC0_G1SR0 connected to IRQ19 */ + XMC_SCU_IRQCTRL_USIC0_SR4_IRQ19 = (19U << 8U) | 1U, /**< USIC0_SR4 connected to IRQ19 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR2_IRQ19 = (19U << 8U) | 2U, /**< CAN0_SR2 connected to IRQ19 */ +#endif + XMC_SCU_IRQCTRL_VADC0_G1SR0_OR_USIC0_SR4_IRQ19 = (19U << 8U) | 3U, /**< VADC0_G1SR0 and USIC0_SR4 connected to IRQ19 */ + + XMC_SCU_IRQCTRL_VADC0_G1SR1_IRQ20 = (20U << 8U) | 0U, /**< VADC0_G1SR1 connected to IRQ20 */ + XMC_SCU_IRQCTRL_USIC0_SR5_IRQ20 = (20U << 8U) | 1U, /**< USIC0_SR5 connected to IRQ20 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR4_IRQ20 = (20U << 8U) | 2U, /**< CAN0_SR4 connected to IRQ20 */ +#endif + XMC_SCU_IRQCTRL_VADC0_G1SR1_OR_USIC0_SR5_IRQ20 = (20U << 8U) | 3U, /**< VADC0_G1SR1 and USIC0_SR5 connected to IRQ20 */ + + XMC_SCU_IRQCTRL_CCU40_SR0_IRQ21 = (21U << 8U) | 0U, /**< CCU40_SR0 connected to IRQ21 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU41_SR0_IRQ21 = (21U << 8U) | 1U, /**< CCU41_SR0 connected to IRQ21 */ +#endif + XMC_SCU_IRQCTRL_USIC0_SR0_IRQ21 = (21U << 8U) | 2U, /**< USIC0_SR0 connected to IRQ21 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU40_SR0_OR_CCU41_SR0_IRQ21 = (21U << 8U) | 3U, /**< CCU40_SR0 and CCU41_SR0 connected to IRQ21 */ +#endif + + XMC_SCU_IRQCTRL_CCU40_SR1_IRQ22 = (22U << 8U) | 0U, /**< CCU40_SR1 connected to IRQ22 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU41_SR1_IRQ22 = (22U << 8U) | 1U, /**< CCU41_SR1 connected to IRQ22 */ +#endif + XMC_SCU_IRQCTRL_USIC0_SR1_IRQ22 = (22U << 8U) | 2U, /**< USIC0_SR1 connected to IRQ22 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU40_SR0_OR_CCU41_SR0_IRQ22 = (22U << 8U) | 3U, /**< CCU40_SR0 and CCU41_SR0 connected to IRQ22 */ +#endif + + XMC_SCU_IRQCTRL_CCU40_SR2_IRQ23 = (23U << 8U) | 0U, /**< CCU40_SR2 connected to IRQ23 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU41_SR2_IRQ23 = (23U << 8U) | 1U, /**< CCU41_SR2 connected to IRQ23 */ +#endif + XMC_SCU_IRQCTRL_USIC0_SR2_IRQ23 = (23U << 8U) | 2U, /**< USIC0_SR2 connected to IRQ23 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU40_SR2_OR_CCU41_SR2_IRQ23 = (23U << 8U) | 3U, /**< CCU40_SR2 and CCU41_SR2 connected to IRQ23 */ +#endif + + XMC_SCU_IRQCTRL_CCU40_SR3_IRQ24 = (24U << 8U) | 0U, /**< CCU40_SR3 connected to IRQ24 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU41_SR3_IRQ24 = (24U << 8U) | 1U, /**< CCU41_SR3 connected to IRQ24 */ +#endif + XMC_SCU_IRQCTRL_USIC0_SR3_IRQ24 = (24U << 8U) | 2U, /**< USIC0_SR3 connected to IRQ24 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU40_SR3_OR_CCU41_SR3_IRQ24 = (24U << 8U) | 3U, /**< CCU40_SR3 and CCU41_SR3 connected to IRQ24 */ +#endif + +#if defined(CCU80) + XMC_SCU_IRQCTRL_CCU80_SR0_IRQ25 = (25U << 8U) | 0U, /**< CCU80_SR0 connected to IRQ25 */ +#endif +#if defined(CCU81) + XMC_SCU_IRQCTRL_CCU81_SR0_IRQ25 = (25U << 8U) | 1U, /**< CCU81_SR0 connected to IRQ25 */ +#endif + XMC_SCU_IRQCTRL_USIC0_SR4_IRQ25 = (25U << 8U) | 2U, /**< USIC0_SR4 connected to IRQ25 */ +#if defined(CCU80) && defined(CCU81) + XMC_SCU_IRQCTRL_CCU80_SR0_OR_CCU81_SR0_IRQ25 = (25U << 8U) | 3U, /**< CCU80_SR0 and CCU81_SR0 connected to IRQ25 */ +#endif + +#if defined(CCU80) + XMC_SCU_IRQCTRL_CCU80_SR1_IRQ26 = (26U << 8U) | 0U, /**< CCU80_SR1 connected to IRQ26 */ +#endif +#if defined(CCU81) + XMC_SCU_IRQCTRL_CCU81_SR1_IRQ26 = (26U << 8U) | 1U, /**< CCU81_SR1 connected to IRQ26 */ +#endif + XMC_SCU_IRQCTRL_USIC0_SR5_IRQ26 = (26U << 8U) | 2U, /**< USIC0_SR5 connected to IRQ26 */ +#if defined(CCU80) && defined(CCU81) + XMC_SCU_IRQCTRL_CCU80_SR1_OR_CCU81_SR1_IRQ26 = (26U << 8U) | 3U, /**< CCU80_SR1 and CCU81_SR1 connected to IRQ26 */ +#endif + +#if defined(POSIF0) + XMC_SCU_IRQCTRL_POSIF0_SR0_IRQ27 = (27U << 8U) | 0U, /**< POSIF0_SR0 connected to IRQ27 */ +#endif +#if defined(POSIF1) + XMC_SCU_IRQCTRL_POSIF1_SR0_IRQ27 = (27U << 8U) | 1U, /**< POSIF1_SR0 connected to IRQ27 */ +#endif + XMC_SCU_IRQCTRL_CCU40_SR3_IRQ27 = (27U << 8U) | 2U, /**< CCU40_SR3 connected to IRQ27 */ +#if defined(POSIF0) && defined(POSIF1) + XMC_SCU_IRQCTRL_POSIF0_SR0_OR_POSIF1_SR0_IRQ27 = (27U << 8U) | 3U, /**< POSIF0_SR0 and POSIF1_SR0 connected to IRQ27 */ +#endif + +#if defined(POSIF0) + XMC_SCU_IRQCTRL_POSIF0_SR1_IRQ28 = (28U << 8U) | 0U, /**< POSIF0_SR1 connected to IRQ28 */ +#endif +#if defined(POSIF1) + XMC_SCU_IRQCTRL_POSIF1_SR1_IRQ28 = (28U << 8U) | 1U, /**< POSIF1_SR1 connected to IRQ28 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR0_IRQ28 = (28U << 8U) | 2U, /**< ERU0_SR0 connected to IRQ28 */ +#if defined(POSIF0) && defined(POSIF1) + XMC_SCU_IRQCTRL_POSIF0_SR1_OR_POSIF1_SR1_IRQ28 = (28U << 8U) | 3U, /**< POSIF0_SR1 and POSIF1_SR1 connected to IRQ28 */ +#endif + +#if defined(LEDTS0) + XMC_SCU_IRQCTRL_LEDTS0_SR0_IRQ29 = (29U << 8U) | 0U, /**< LEDTS0_SR0 connected to IRQ29 */ +#endif + XMC_SCU_IRQCTRL_CCU40_SR1_IRQ29 = (29U << 8U) | 1U, /**< CCU40_SR1 connected to IRQ29 */ + XMC_SCU_IRQCTRL_ERU0_SR1_IRQ29 = (29U << 8U) | 2U, /**< ERU0_SR1 connected to IRQ29 */ +#if defined(LEDTS0) + XMC_SCU_IRQCTRL_LEDTS0_SR0_OR_CCU40_SR1_IRQ29 = (29U << 8U) | 3U, /**< LEDTS0_SR0 and CCU40_SR1 connected to IRQ29 */ +#endif + +#if defined(LEDTS1) + XMC_SCU_IRQCTRL_LEDTS1_SR0_IRQ30 = (30U << 8U) | 0U, /**< LEDTS1_SR0 connected to IRQ30 */ +#endif + XMC_SCU_IRQCTRL_CCU40_SR2_IRQ30 = (30U << 8U) | 1U, /**< CCU40_SR2 connected to IRQ30 */ + XMC_SCU_IRQCTRL_ERU0_SR2_IRQ30 = (30U << 8U) | 2U, /**< ERU0_SR2 connected to IRQ30 */ +#if defined(LEDTS1) + XMC_SCU_IRQCTRL_LEDTS0_SR0_OR_CCU40_SR1_IRQ30 = (30U << 8U) | 3U, /**< LEDTS0_SR0 and CCU40_SR1 connected to IRQ30 */ +#endif + +#if defined(BCCU0) + XMC_SCU_IRQCTRL_BCCU0_SR0_IRQ31 = (31U << 8U) | 0U, /**< BCCU0_SR0 connected to IRQ31 */ +#endif + XMC_SCU_IRQCTRL_CCU40_SR3_IRQ31 = (31U << 8U) | 1U, /**< CCU40_SR3 connected to IRQ31 */ + XMC_SCU_IRQCTRL_ERU0_SR3_IRQ31 = (31U << 8U) | 2U, /**< ERU0_SR3 connected to IRQ31 */ +#if defined(BCCU0) + XMC_SCU_IRQCTRL_BCCU0_SR0_OR_CCU40_SR3_IRQ31 = (31U << 8U) | 3U, /**< BCCU0_SR0 and CCU40_SR3 connected to IRQ31 */ +#endif +} XMC_SCU_IRQCTRL_t; +#endif /* XMC_SERIES = XMC14 */ + +/** TODO + * + */ +typedef enum XMC_SCU_POWER_MONITOR_RANGE +{ + XMC_SCU_POWER_MONITOR_RANGE_2_25V = 0U << SCU_ANALOG_ANAVDEL_VDEL_SELECT_Pos, /**< */ + XMC_SCU_POWER_MONITOR_RANGE_3_00V = 1U << SCU_ANALOG_ANAVDEL_VDEL_SELECT_Pos, /**< */ + XMC_SCU_POWER_MONITOR_RANGE_4_40V = 2U << SCU_ANALOG_ANAVDEL_VDEL_SELECT_Pos /**< */ +} XMC_SCU_POWER_MONITOR_RANGE_t; + +/** TODO + * + */ +typedef enum XMC_SCU_POWER_MONITOR_DELAY +{ + XMC_SCU_POWER_MONITOR_DELAY_1US = 0U << SCU_ANALOG_ANAVDEL_VDEL_TIM_ADJ_Pos, /**< */ + XMC_SCU_POWER_MONITOR_DELAY_500NS = 1U << SCU_ANALOG_ANAVDEL_VDEL_TIM_ADJ_Pos, /**< */ + XMC_SCU_POWER_MONITOR_DELAY_250NS = 2U << SCU_ANALOG_ANAVDEL_VDEL_TIM_ADJ_Pos, /**< */ + XMC_SCU_POWER_MONITOR_DELAY_NONE = 3U << SCU_ANALOG_ANAVDEL_VDEL_TIM_ADJ_Pos /**< */ +} XMC_SCU_POWER_MONITOR_DELAY_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ +/** + * Defines a data structure for initializing the data of the supply voltage monitoring block. + * Supply voltage monitoring block consists of 2 detectors namely External voltage detector (VDEL) and External brownout + * detector (BDE) in the EVR that are used to monitor the VDDP. \a VDEL detector compares the supply voltage against a + * pre-warning threshold voltage. + * Use type \a XMC_SCU_SUPPLYMONITOR_t for accessing these structure parameters. + */ +typedef struct XMC_SCU_SUPPLYMONITOR +{ + uint32_t ext_supply_threshold; /**< External supply range (VDEL Range Select).\n + \b Range: +
    +
  • 00B sets threshold value to 2.25V +
  • 01B sets threshold value to 3.0V +
  • 10B sets threshold value to 4.4V +
*/ + uint32_t ext_supply_monitor_speed; /**< Speed of the voltage monitor(VDEL Timing Setting).\n + \b Range: +
    +
  • 00B sets monitor speed typ 1us - slowest response time +
  • 01B sets monitor speed typ 500n +
  • 10B sets monitor speed typ 250n +
  • 11B sets monitor speed with no delay - fastest response time. +
*/ + bool enable_prewarning_int; /**< Configure pre-warning interrupt generation.\n + \b Range: +
    +
  • \a true to enable the interrupt. +
  • \a false to disable the interrupt. +
*/ + bool enable_vdrop_int; /**< Configure VDROP interrupt generation.\n + \b Range: +
    +
  • \a true to enable the interrupt. +
  • \a false to disable the interrupt. +
*/ + bool enable_vclip_int; /**< Configure VCLIP interrupt.\n + \b Range: +
    +
  • \a true to enable the interrupt. +
  • \a false to disable the interrupt. +
*/ + bool enable_at_init; /**< Whether the monitor has to be enabled (VDEL unit Enable) after initialization.\n + \b Range: +
    +
  • \a true to enable after initialization. +
  • \a false to enable after initialization. +
*/ +} XMC_SCU_SUPPLYMONITOR_t; + +/** + * Defines a data structure for initializing the data of the clock functional block. + * Clock functional block configures clock dividers, peripheral and RTC clock source by configuring corresponding + * bits in \a CLKCR clock control register. + * Use type \a XMC_SCU_CLOCK_CONFIG_t for accessing these structure parameters. + */ +typedef struct XMC_SCU_CLOCK_CONFIG +{ +#if (UC_SERIES == XMC14) + uint16_t fdiv; /**< Fractional clock divider (FDIV). \b Range: 0 to 1023. */ +#else + uint8_t fdiv; /**< Fractional clock divider (FDIV). \b Range: 0 to 255. @note XMC1400 series extends the range to 1023 */ +#endif + uint8_t idiv; /**< Integer clock divider (IDIV). \b Range: 0 to 255. */ +#if (UC_SERIES == XMC14) || defined(DOXYGEN) + XMC_SCU_CLOCK_DCLKSRC_t dclk_src; /**< DCLK clock source selection. @note Only available in XMC1400 series */ + XMC_SCU_CLOCK_OSCHP_MODE_t oschp_mode; /**< OSCHP mode. @note Only available in XMC1400 series */ + XMC_SCU_CLOCK_OSCLP_MODE_t osclp_mode; /**< OSCLP mode. @note Only available in XMC1400 series */ +#endif + XMC_SCU_CLOCK_PCLKSRC_t pclk_src; /**< Source of PCLK Clock */ + XMC_SCU_CLOCK_RTCCLKSRC_t rtc_src; /**< Source of RTC Clock */ +} XMC_SCU_CLOCK_CONFIG_t; + +/** + * Defines the data structure for initializing the deep sleep mode. + * During deep sleep mode peripheral clock is disabled and flash is powered down. + * Use type \a XMC_SCU_CLOCK_DEEP_SLEEP_t for accessing these structure parameters. + */ +typedef struct XMC_SCU_CLOCK_DEEP_SLEEP +{ + bool flash_power_down; /**< Whether the device flash memory has to be powered down + during deep sleep mode.\n + \b Range: Set true to disable flash in deep sleep mode.*/ + uint32_t clock_gating_mask; /**< Configures mask value of clocks to be gated during deep sleep.\n + \b Range: Use type @ref XMC_SCU_PERIPHERAL_CLOCK_t to get the bitmask + of the peripheral clocks. Multiple peripherals can be combined by + using the \a OR operation.*/ +} XMC_SCU_CLOCK_DEEP_SLEEP_t; + +/********************************************************************************************************************* + * API PROTOTYPES + ********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * + * @param freq_khz Required MCLK frequency value in kHz.\n + * \b Range: XMC11/XMC12/XMC13 Device: 125 to 32000. + * XMC14 Device: 188 to 48000 when DCO1 is clock source for clock control unit. + * 79 to 48000 when OSC_HP is clock source for clock control unit.\n + * + * @return None + * + * \parDescription
+ * This API configures main clock (MCLK) frequency to requested frequency value.\n\n + * The API configures main clock by setting \a IDIV and \a FDIV bit's of the \a CLKCR register for + * XMC11/XMC12/XMC13/XMC14 Device and with additional \a FDIV bit (FDIV[9:8]) of the \a CLKCR1 register settings + * for XMC14 device. + * \parRelated APIs:
+ * XMC_SCU_CLOCK_ScaleMCLKFrequency()\n\n\n + */ +void XMC_SCU_CLOCK_SetMCLKFrequency(uint32_t freq_khz); + +/** + * + * @param idiv Divider value.\n + * \b Range: 0 to 255.\n + * @param fdiv Fractional Divider value.\n + * \b Range: XMC11/XMC12/XMC13 Device: 0 to 255. + * XMC14 Device: 0 to 1023.\n + * + * @return None + * + * \parDescription
+ * This API configures main clock (MCLK) frequency by updating user provided divider values.\n\n + * The API configures main clock by setting \a IDIV and \a FDIV bit's of the \a CLKCR register for + * XMC11/XMC12/XMC13/XMC14 Device and with additional \a FDIV bit (FDIV[9:8]) of the \a CLKCR1 register settings + * for XMC14 device. + * \parRelated APIs:
+ * XMC_SCU_CLOCK_SetMCLKFrequency()\n\n\n + */ +void XMC_SCU_CLOCK_ScaleMCLKFrequency(uint32_t idiv, uint32_t fdiv); + +/** + * + * @return None + * + * \parDescription
+ * Locks access to protected bit fields of the SCU.\n\n + * The bit protection scheme prevents changing selected register bits by unauthorized code. + * Bit protection scheme is enabled by writing 000000C3H to \a PASSWD register. By writing + * this value, the API is setting the \a MODE bit field to bit protection enabled state.\n + * List of Protected Register Bit Fields are mentioned below. \n + * + * + * + * + * + * + * + * + *
\a Register \a Bit fields
SCU_CLKCR FDIV, IDIV, PCLKSEL, RTCLKSEL
SCU_CGATSET0 All bits
SCU_CGATCLR0 All bits
SCU_ANAOFFSET ADJL_OFFSET
VADC0_ACCPROT0 All bits
VADC0_ACCPROT1 All bits
+ * + * \parRelated APIs:
+ * XMC_SCU_UnlockProtectedBits() \n\n\n + */ +void XMC_SCU_LockProtectedBits(void); + +/** + * + * @return None + * + * \parDescription
+ * Unlocks access to protected bit fields of the SCU.\n\n + * The bit protection scheme prevents changing selected register bits by unauthorized code. + * Bit protection scheme can be temporarily(for 32 MCLK cycles) disabled by writing 000000C0H to \a PASSWD register. + * By writing this value, the API is setting the \a MODE bit field to bit protection disabled state. The API + * waits for the protection to be disabled after changing the \a MODE.\n + * User can change the values of the protected bit fields within 32 MCLK cycles. After 32 MCLK cycles the lock will + * be enabled automatically. + * List of Protected Register Bit Fields are mentioned below. \n + * + * + * + * + * + * + * + * + *
\a Register \a Bit fields
SCU_CLKCR FDIV, IDIV, PCLKSEL, RTCLKSEL
SCU_CGATSET0 All bits
SCU_CGATCLR0 All bits
SCU_ANAOFFSET ADJL_OFFSET
VADC0_ACCPROT0 All bits
VADC0_ACCPROT1 All bits
+ * + * \parRelated APIs:
+ * XMC_SCU_LockProtectedBits() \n\n\n + */ +void XMC_SCU_UnlockProtectedBits(void); + +/** + * + * @param obj Pointer to data structure consisting voltage monitoring block configuration.\n + * \b Range: Use type @ref XMC_SCU_SUPPLYMONITOR_t for detailed description of structure members. + * + * @return None + * + * \parDescription
+ * Initializes power supply monitoring unit.\n\n + * Supply voltage monitoring block consist of 2 detectors namely External voltage detector (VDEL) and External brownout + * detector (BDE) in the EVR that are used to monitor the VDDP. \a VDEL detector compares the supply voltage against a + * pre-warning threshold voltage \a ext_supply_threshold. The threshold level is programmable via register \a ANAVDEL.VDEL_SELECT. An interrupt + * if enabled via \a enable_prewarning_int, will be triggered if a level below this threshold is detected and the flag, VDDPI, + * in SRRAW register bit is set. Similarly interrupts can be enabled for the events of VCLIP and prewarning, using the structure members, + * \a enable_vclip_int and \a enable_prewarning_int. The handlers for these interrupts have to be explicitly defined using + * the API XMC_SCU_INTERRUPT_SetEventHandler(). + * \parRelated APIs:
+ * XMC_SCU_INTERRUPT_SetEventHandler()\n\n\n + */ +void XMC_SCU_SupplyMonitorInit(const XMC_SCU_SUPPLYMONITOR_t *obj); + +/** + * @param limit Kelvin degree temperature lower compare limit in range [233,388] + * @return XMC_SCU_STATUS_t status of limit installation + * + * \parDescription
+ * Set lower temperature compare limit. + * A low temperature interrupt (SCU_IRQ1) is triggered if Tchip < limit and the event and interrupt are enabled. + * Alternatively XMC_SCU_LowTemperature() can be used to check the status. + * \parRelated APIs:
+ * XMC_SCU_LowTemperature()\n\n\n + * + **/ +XMC_SCU_STATUS_t XMC_SCU_SetTempLowLimit(uint32_t limit); + +/** + * @param limit Kelvin degree temperature higher compare limit in range [233,388] + * @return XMC_SCU_STATUS_t status of limit installation + * + * \parDescription
+ * Set higher temperature compare limit. + * A high temperature interrupt (SCU_IRQ1) is triggered if Tchip > limit and the event and interrupt are enabled. + * Alternatively XMC_SCU_HighTemperature() can be used to check the status. + * \parRelated APIs:
+ * XMC_SCU_HighTemperature()\n\n\n + * + **/ +XMC_SCU_STATUS_t XMC_SCU_SetTempHighLimit(uint32_t limit); + +/** + * + * @param lower_temp Lower threshold value for the die temperature.\n + * \b Range: 0 to 65535(16 bit unsigned value). + * @param upper_temp Upper threshold value for the die temperature.\n + * \b Range: 0 to 65535(16 bit unsigned value). + * + * @return None + * + * \parDescription
+ * Configures upper and lower thresholds of die temperature as raw digital values into temperature sensor.\n\n + * The API configures \a ANATSEIH and \a ANATSEIL registers for upper and lower die temperature threshold limits + * respectively.\n + * It is recommended to use following steps:\n + * - Call \a XMC_SCU_StopTempMeasurement to stop temperature measurement if it was started previously.\n + * - Call \a XMC_SCU_SetRawTempLimits with desired lower and upper temperature threshold limit values.\n + * - Finally call \a XMC_SCU_StartTempMeasurement to start temperature measurement.\n + * + * \parRelated APIs:
+ * XMC_SCU_StopTempMeasurement(), XMC_SCU_StartTempMeasurement() \n\n\n + */ +void XMC_SCU_SetRawTempLimits(const uint32_t lower_temp, const uint32_t upper_temp); + +// /* API to program temperature limits in centigrade into temperature sensor unit */ // need to implement in future +// void XMC_SCU_SetTempLimits(const uint32_t lower_temp, const uint32_t upper_temp); +/** + * + * @return XMC_SCU_STATUS_t Status of starting the temperature measurement.\n + * \b Range: Use type @ref XMC_SCU_STATUS_t to identify the result.\n + * XMC_SCU_STATUS_OK- Temperature measurement started successfully.\n + * Always returns the above status. + * + * \parDescription
+ * Starts die temperature measurement using internal temperature sensor.\n\n + * The API, enables die temperature measurement and waits for about 10000 cycles until + * temperature measurement result is available on \a SCU_ANALOG->ANATSEMON bit fields.\n + * It is recommended to use following steps:\n + * - Call \a XMC_SCU_StopTempMeasurement to stop temperature measurement if it was started previously.\n + * - Call \a XMC_SCU_SetRawTempLimits with desired lower and upper temperature threshold limit values if it is needed.\n + * - Call \a XMC_SCU_StartTempMeasurement to start temperature measurement.\n + * - Read die temperature value using \a XMC_SCU_GetTemperature API.\n + * \parRelated APIs:
+ * XMC_SCU_StopTempMeasurement(), XMC_SCU_SetRawTempLimits(), XMC_SCU_GetTemperature() \n\n\n + */ +void XMC_SCU_StartTempMeasurement(void); + +/** + * @return None + * + * \parDescription
+ * Stops the die temperature measurement.\n\n + * Die temperature measurement is stopped by disabling the sensor using \a TSE_EN bit of + * \a ANATSECTRL register. + * \parRelated APIs:
+ * XMC_SCU_StartTempMeasurement(), XMC_SCU_SetRawTempLimits(), XMC_SCU_GetTemperature() \n\n\n + */ +void XMC_SCU_StopTempMeasurement(void); + +/** + * + * @return bool Result of checking whether the die temperature is more than the upper threshold.\n + * \b Range: \a false if temperature is below the upper threshold. \a true if temperature + * has exceeded the upper threshold configured in \a ANATSEIH register. + * + * \parDescription
+ * Check if the temperature has exceeded the upper threshold value.\n\n + * The API checks for \a TSE_HIGH bit (TSE Compare High Temperature Event Status bit) of \a SRRAW register. + * The bit will be set when the \a TSE_MON value in \a ANATSEMON register exceeds the value of + * \a TSE_IH value in \a ANATSEIH register. + * \parRelated APIs:
+ * XMC_SCU_StartTempMeasurement(), XMC_SCU_SetRawTempLimits(), XMC_SCU_GetTemperature(), XMC_SCU_LowTemperature() \n\n\n + */ +bool XMC_SCU_HighTemperature(void); + +/** + * + * @return bool Result of checking whether the die temperature is less than the lower threshold.\n + * \b Range: \a false if temperature is higher than the lower threshold. \a true if temperature + * has dropped below the lower threshold configured in \a ANATSEIL register. + * + * \parDescription
+ * Check if the temperature has dropped below the lower threshold value.\n\n + * The API checks for \a TSE_LOW bit (TSE Compare Low Temperature Event Status bit) of \a SRRAW register. + * The bit will be set when the \a TSE_MON value in \a ANATSEMON register drops below the value of + * \a TSE_IL value in \a ANATSEIL register. + * \parRelated APIs:
+ * XMC_SCU_StartTempMeasurement(), XMC_SCU_SetRawTempLimits(), XMC_SCU_GetTemperature(), XMC_SCU_HighTemperature() \n\n\n + */ +bool XMC_SCU_LowTemperature(void); + +/** + * @return uint32_t Raw die temperature value. \b Range: 16 bit value. + * + * \parDescription
+ * Provides the raw die temperature value.\n\n + * The API reads temperature measurement result from \a SCU_ANALOG->ANATSEMON bit fields. + * \parRelated APIs:
+ * XMC_SCU_StartTempMeasurement() \n\n\n + */ +uint32_t XMC_SCU_GetTemperature(void); + +/** + * @return uint32_t Calculate die temperature value. \b Range: 16 bit value. + * + * \parDescription
+ * Calculates the die temperature value using ROM function.\n\n + * \parRelated APIs:
+ * XMC_SCU_StartTempMeasurement() \n\n\n + */ +uint32_t XMC_SCU_CalcTemperature(void); + +/** + * + * @return true DTS Measurement Done + * @return false DTS Measurement not Done + * + * \parDescription
+ * This functions checks the status of the DTS Measurement completion.\n\n + * \parRelated APIs:
+ * XMC_SCU_StartTempMeasurement() \n\n\n + */ +__STATIC_INLINE bool XMC_SCU_IsTempMeasurementDone(void) +{ + return ((SCU_INTERRUPT->SRRAW & SCU_INTERRUPT_SRRAW_TSE_DONE_Msk) != 0U); +} + +/** + * @return None + * + * \parDescription
+ * Trigger device master reset.\n\n + * The API triggers master reset by setting the \a MRSTEN bit of \a RSTCON register. + * It also internally triggers system reset. Almost all the logics of the device are affected by this reset. + * \parRelated APIs:
+ * XMC_SCU_RESET_EnableResetRequest() \n\n\n + */ +__STATIC_INLINE void XMC_SCU_RESET_AssertMasterReset(void) +{ + SCU_RESET->RSTCON |= SCU_RESET_RSTCON_MRSTEN_Msk; +} +/** + * + * @param request Reset source to trigger the device reset.\n + * \b Range: Use type @ref XMC_SCU_SYSTEM_RESET_REQUEST_t to identify the reset source.\n + * XMC_SCU_RESET_REQUEST_FLASH_ECC_ERROR- Reset when flash memory double bit error is detected.\n + * XMC_SCU_RESET_REQUEST_CLOCK_LOSS- Reset when loss of clock is detected.\n + * XMC_SCU_RESET_REQUEST_SRAM_PARITY_ERROR- Reset when SRAM parity error is detected.\n + * XMC_SCU_RESET_REQUEST_USIC_SRAM_PARITY_ERROR- Reset when USIC0 SRAM parity error is detected.\n + * + * @return None + * + * \parDescription
+ * Configures trigger for system reset from the selected source.\n\n + * The API configures the reset source specific bit in the \a RSTCON register. + * Multiple reset sources can be combined using \a OR operation. By enabling + * the reset using this API will not trigger the reset. The reset will happen when + * the configured source event is detected. + * \parRelated APIs:
+ * XMC_SCU_RESET_AssertMasterReset() \n\n\n + */ +__STATIC_INLINE void XMC_SCU_RESET_EnableResetRequest(uint32_t request) +{ + SCU_RESET->RSTCON |= request; +} + +/** + * + * @return uint32_t Fast peripheral clock frequency in Hertz. + * + * \parDescription
+ * Provides the clock frequency of peripherals on the peripheral bus that are using a shared functional clock.\n\n + * The value is derived using the bitfield \a PCLKSEL from \a CLKCR register. Peripheral clock + * can have 2 times the frequency of system clock if the \a PCLKSEL is set. + * \parRelated APIs:
+ * XMC_SCU_CLOCK_SetFastPeripheralClockSource() \n\n\n + */ +uint32_t XMC_SCU_CLOCK_GetFastPeripheralClockFrequency(void); + +/** + * + * @param source Fast peripheral clock source.\n + * \b Range: Use type @ref XMC_SCU_CLOCK_PCLKSRC_t to identify the clock source.\n + * XMC_SCU_CLOCK_PCLKSRC_MCLK- Use MCLK as the peripheral clock.\n + * XMC_SCU_CLOCK_PCLKSRC_DOUBLE_MCLK- peripheral clock will be 2 times the MCLK frequency. + * + * @return None + * + * \parDescription
+ * Configures the source of peripheral clock. \n\n + * The peripheral clock can be either same as MCLK or twice the frequency of MCLK. + * \parRelated APIs:
+ * XMC_SCU_CLOCK_GetFastPeripheralClockFrequency() \n\n\n + */ +void XMC_SCU_CLOCK_SetFastPeripheralClockSource(const XMC_SCU_CLOCK_PCLKSRC_t source); + +/** + * + * @param temperature measured temperature using the on-chip temperature sensor + * + * @return None + * + * \parDescription
+ * DCO1 clock frequency can be calibrated during runtime to achieve a better accuracy. + * This function start the DCO1 calibration based on temperature. + * + */ +void XMC_SCU_CLOCK_CalibrateOscillatorOnTemperature(int32_t temperature); + +#if (UC_SERIES == XMC14) || defined(DOXYGEN) +/** + * + * @param sync_clk Clock source selected as external reference. @ref XMC_SCU_CLOCK_SYNC_CLKSRC_t + * @param prescaler integer(\f$\frac{3000 \times f_{OSC}[MHz]}{48}\f$) + * @param syn_preload integer(\f$\frac{48 \times prescaler}{f_{OSC}[MHz]}\f$) + * + * @return None + * + * \parDescription
+ * DCO1 clock frequency can be calibrated during runtime to achieve a better accuracy. + * This function starts the automatic DCO1 calibration based on the selected clock source. + * @note Only available for XMC1400 series + */ +void XMC_SCU_CLOCK_EnableDCO1ExtRefCalibration(XMC_SCU_CLOCK_SYNC_CLKSRC_t sync_clk, uint32_t prescaler, uint32_t syn_preload); + +/** + * + * @return None + * + * \parDescription
+ * This function stops the automatic DCO1 calibration based on the selected clock source. + * @note Only available for XMC1400 series + */ +void XMC_SCU_CLOCK_DisableDCO1ExtRefCalibration(void); + +/** + * + * @return true DCO1 is synchronized to the selected XTAL frequency + * @return false Actual DCO1 frequency is out of target + * + * \parDescription
+ * This functions checks the status of the synchronisation + * @note Only available for XMC1400 series + */ +bool XMC_SCU_CLOCK_IsDCO1ExtRefCalibrationReady(void); + +/** + * + * @return None + * + * \parDescription
+ * This function enables the watchdog on the DCO1 frequency + * @note Only available for XMC1400 series + */ +void XMC_SCU_CLOCK_EnableDCO1OscillatorWatchdog(void); + +/** + * + * @return None + * + * \parDescription
+ * This function disables the watchdog on the DCO1 frequency + * @note Only available for XMC1400 series + */ +void XMC_SCU_CLOCK_DisableDCO1OscillatorWatchdog(void); + +/** + * + * @return None + * + * \parDescription
+ * This function clears the status of the watchdog on the DCO1 frequency + * @note Only available for XMC1400 series + */ +void XMC_SCU_CLOCK_ClearDCO1OscillatorWatchdogStatus(void); + +/* + * + * @return true The OSC frequency is usable + * @return false The OSC frequency is not usable. Frequency is too high or too low + * + * \parDescription
+ * This function checks if the DCO1 frequency is in the limits of the watchdog + * @note Only available for XMC1400 series + */ +bool XMC_SCU_CLOCK_IsDCO1ClockFrequencyUsable(void); + +/** + * This function selects service request source for a NVIC interrupt node. + * The XMC1400 series has up to 54 peripheral service requests. + * The Cortex M0 however has 32 interrupts available for peripherals. + * This function allows you to select which 32 peripheral requests of the 54 the CPU should react on. + * + * @param irq_number Interrupt number, 0 to 31 + * @param source Peripheral service request. See @ref XMC_SCU_IRQCTRL_t + * + * @note Only available for XMC1400 series + */ +void XMC_SCU_SetInterruptControl(uint8_t irq_number, XMC_SCU_IRQCTRL_t source); + +/** + * This function enables the Prefetch Unit (PFU). + * The purpose of the Prefetch unit is to reduce the Flash latency gap at higher system + * frequencies to increase the instruction per cycle performance. + * + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_SCU_EnablePrefetchUnit(void) +{ + SCU_GENERAL->PFUCR &= ~SCU_GENERAL_PFUCR_PFUBYP_Msk; +} + +/** + * This function disables the Prefetch Unit (PFU). + * The purpose of the Prefetch unit is to reduce the Flash latency gap at higher system + * frequencies to increase the instruction per cycle performance. + * + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_SCU_DisablePrefetchUnit(void) +{ + SCU_GENERAL->PFUCR |= SCU_GENERAL_PFUCR_PFUBYP_Msk; +} + +#endif + +/** + * + * @param range VDEL Range Select ::XMC_SCU_POWER_MONITOR_RANGE_t + * @param delay VDEL Timing Setting ::XMC_SCU_POWER_MONITOR_DELAY_t + * @return None + * + * \parDescription
+ * Enables VDEL detector. VDEL detector compares the supply voltage against a pre-warning threshold voltage + * + * @note Brown Out Trap need to be enabled previously + */ +__STATIC_INLINE void XMC_SCU_POWER_EnableMonitor(XMC_SCU_POWER_MONITOR_RANGE_t range, XMC_SCU_POWER_MONITOR_DELAY_t delay) +{ + SCU_ANALOG->ANAVDEL = SCU_ANALOG_ANAVDEL_VDEL_EN_Msk | + (uint32_t)range | + (uint32_t)delay; +} + +/** + * + * @return None + * + * \parDescription
+ * Disables VDEL detector + */ +__STATIC_INLINE void XMC_SCU_POWER_DisableMonitor(void) +{ + SCU_ANALOG->ANAVDEL &= ~SCU_ANALOG_ANAVDEL_VDEL_EN_Msk; +} + +/** + * + * @param flags may be any of:
+ * \ref XMC_SCU_BMI_HWCFG_CAN_BSL (only available for XMC1400 series with CAN Module)
+ * \ref XMC_SCU_BMI_HWCFG_CAN_BSLTO (only available for XMC1400 series with CAN Module)
+ * \ref XMC_SCU_BMI_HWCFG_SBSL_CANOPEN (only available for XMC1400 series with CAN Module)
+ * \ref XMC_SCU_BMI_HWCFG_ASC_BSL
+ * \ref XMC_SCU_BMI_HWCFG_UPM
+ * \ref XMC_SCU_BMI_HWCFG_UMD
+ * \ref XMC_SCU_BMI_HWCFG_UMHAR
+ * \ref XMC_SCU_BMI_HWCFG_SSC_BSL
+ * \ref XMC_SCU_BMI_HWCFG_ASC_BSLTO
+ * \ref XMC_SCU_BMI_HWCFG_SSC_BSLTO
+ * \ref XMC_SCU_BMI_HWCFG_SBSL

+ * optionally OR'd together with any of:
+ * \ref XMC_SCU_BMI_DAPTYP_SWD
+ * \ref XMC_SCU_BMI_DAPTYP_SPD

+ * optionally OR'd together with any of:
+ * \ref XMC_SCU_BMI_DAPDIS_CHANNEL_0
+ * \ref XMC_SCU_BMI_DAPDIS_CHANNEL_1

+ * @image html "xmc1000_debugif.png" + * optionally OR'd together with any of (only available for XMC1400 series with CAN Module):
+ * \ref XMC_SCU_BMI_CANCLK_DCO1
+ * \ref XMC_SCU_BMI_CANCLK_OSCHP

+ * + * @param timeout Only relevant if a start up mode is selected that uses timeout. The time-out duration is BSLTO*2664000 MCLK cycles, the supported time-out range is 0.3-5s (333...4995ms) + * @return false only upon error, if OK the procedure triggers a reset and does not return to calling routine + * + * \parDescription
+ * This procedure initiates installation of a new BMI value. In particular, it can be used as + * well as to restore the state upon delivery for a device already in User Productive mode. + * + * @code + * // Switch to ASC Bootstrap Loader + * XMC_SCU_SetBMI(XMC_SCU_BMI_HWCFG_ASC_BSL, 0); + * + * // Switch to Debug user mode SWD1 (pins P1.3 and P1.2) + * XMC_SCU_SetBMI(XMC_SCU_BMI_HWCFG_UMD | XMC_SCU_BMI_DAPTYP_SWD | XMC_SCU_BMI_DAPDIS_CHANNEL_1, 0); + * @endcode + */ +uint32_t XMC_SCU_SetBMI(uint32_t flags, uint8_t timeout); + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* UC_FAMILY == XMC1 */ + +#endif /* XMC1_SCU_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_usic_map.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_usic_map.h new file mode 100644 index 00000000..4362cf9d --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc1_usic_map.h @@ -0,0 +1,3598 @@ +/** + * @file xmc1_usic_map.h + * @date 2016-08-22 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial version + * + * 2015-08-25: + * - Added XMC1400 + * + * 2016-06-17: + * - Added support for XMC1201 TSSOP28, XMC1302 TSSOP28, XMC1402 TSSOP38, XMC1403 VQFN40 + * + * 2016-08-22: + * - Added USIC1_C0_DX1_P3_4 for XMC14xx 64 pins package + * + * @endcond + * + */ + +#ifndef XMC1_USIC_MAP_H +#define XMC1_USIC_MAP_H + +/********************************************************************************************************************** + * MACROS + *********************************************************************************************************************/ + +#define USIC_INPUT_ALWAYS_1 7 + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN24) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN40) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP16) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP38) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1200) && (UC_PACKAGE == TSSOP38) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == VQFN40) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP28) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP38) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN24) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN40) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP16) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP28) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN24) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN40) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP16) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP38) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN24) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN40) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP16) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP28) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP38) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == LQFP64) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P3_3 4 +#define USIC1_C0_DX0_P3_4 5 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P3_4 4 +#define USIC1_C0_DX1_P4_3 1 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P3_1 5 +#define USIC1_C0_DX2_P4_10 3 +#define USIC1_C0_DX2_P4_11 4 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX2_P4_8 1 +#define USIC1_C0_DX2_P4_9 2 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P1_8 1 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX3_P3_2 2 +#define USIC1_C0_DX3_P4_0 3 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P1_8 1 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_P3_2 2 +#define USIC1_C0_DX4_P4_0 3 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P1_7 1 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_P4_1 2 +#define USIC1_C0_DX5_P4_2 3 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX0_P3_1 5 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P1_8 2 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_P1_7 2 +#define USIC1_C1_DX2_P3_3 0 +#define USIC1_C1_DX2_P3_4 1 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX3_P3_2 3 +#define USIC1_C1_DX3_P4_11 0 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_P3_2 3 +#define USIC1_C1_DX4_P4_11 0 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_10 0 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == VQFN48) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == LQFP64) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P3_3 4 +#define USIC1_C0_DX0_P3_4 5 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P3_4 4 +#define USIC1_C0_DX1_P4_3 1 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P3_1 5 +#define USIC1_C0_DX2_P4_10 3 +#define USIC1_C0_DX2_P4_11 4 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX2_P4_8 1 +#define USIC1_C0_DX2_P4_9 2 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P1_8 1 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX3_P3_2 2 +#define USIC1_C0_DX3_P4_0 3 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P1_8 1 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_P3_2 2 +#define USIC1_C0_DX4_P4_0 3 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P1_7 1 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_P4_1 2 +#define USIC1_C0_DX5_P4_2 3 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX0_P3_1 5 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P1_8 2 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_P1_7 2 +#define USIC1_C1_DX2_P3_3 0 +#define USIC1_C1_DX2_P3_4 1 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX3_P3_2 3 +#define USIC1_C1_DX3_P4_11 0 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_P3_2 3 +#define USIC1_C1_DX4_P4_11 0 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_10 0 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN40) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN48) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN64) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P3_3 4 +#define USIC1_C0_DX0_P3_4 5 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P3_4 4 +#define USIC1_C0_DX1_P4_3 1 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P3_1 5 +#define USIC1_C0_DX2_P4_10 3 +#define USIC1_C0_DX2_P4_11 4 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX2_P4_8 1 +#define USIC1_C0_DX2_P4_9 2 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P1_8 1 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX3_P3_2 2 +#define USIC1_C0_DX3_P4_0 3 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P1_8 1 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_P3_2 2 +#define USIC1_C0_DX4_P4_0 3 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P1_7 1 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_P4_1 2 +#define USIC1_C0_DX5_P4_2 3 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX0_P3_1 5 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P1_8 2 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_P1_7 2 +#define USIC1_C1_DX2_P3_3 0 +#define USIC1_C1_DX2_P3_4 1 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX3_P3_2 3 +#define USIC1_C1_DX3_P4_11 0 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_P3_2 3 +#define USIC1_C1_DX4_P4_11 0 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_10 0 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == TSSOP38) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN40) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN48) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN64) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P3_3 4 +#define USIC1_C0_DX0_P3_4 5 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P3_4 4 +#define USIC1_C0_DX1_P4_3 1 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P3_1 5 +#define USIC1_C0_DX2_P4_10 3 +#define USIC1_C0_DX2_P4_11 4 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX2_P4_8 1 +#define USIC1_C0_DX2_P4_9 2 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P1_8 1 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX3_P3_2 2 +#define USIC1_C0_DX3_P4_0 3 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P1_8 1 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_P3_2 2 +#define USIC1_C0_DX4_P4_0 3 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P1_7 1 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_P4_1 2 +#define USIC1_C0_DX5_P4_2 3 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX0_P3_1 5 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P1_8 2 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_P1_7 2 +#define USIC1_C1_DX2_P3_3 0 +#define USIC1_C1_DX2_P3_4 1 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX3_P3_2 3 +#define USIC1_C1_DX3_P4_11 0 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_P3_2 3 +#define USIC1_C1_DX4_P4_11 0 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_10 0 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == LQFP64) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P3_3 4 +#define USIC1_C0_DX0_P3_4 5 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P3_4 4 +#define USIC1_C0_DX1_P4_3 1 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P3_1 5 +#define USIC1_C0_DX2_P4_10 3 +#define USIC1_C0_DX2_P4_11 4 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX2_P4_8 1 +#define USIC1_C0_DX2_P4_9 2 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P1_8 1 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX3_P3_2 2 +#define USIC1_C0_DX3_P4_0 3 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P1_8 1 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_P3_2 2 +#define USIC1_C0_DX4_P4_0 3 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P1_7 1 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_P4_1 2 +#define USIC1_C0_DX5_P4_2 3 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX0_P3_1 5 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P1_8 2 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_P1_7 2 +#define USIC1_C1_DX2_P3_3 0 +#define USIC1_C1_DX2_P3_4 1 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX3_P3_2 3 +#define USIC1_C1_DX3_P4_11 0 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_P3_2 3 +#define USIC1_C1_DX4_P4_11 0 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_10 0 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN48) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN64) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P3_3 4 +#define USIC1_C0_DX0_P3_4 5 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P3_4 4 +#define USIC1_C0_DX1_P4_3 1 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P3_1 5 +#define USIC1_C0_DX2_P4_10 3 +#define USIC1_C0_DX2_P4_11 4 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX2_P4_8 1 +#define USIC1_C0_DX2_P4_9 2 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P1_8 1 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX3_P3_2 2 +#define USIC1_C0_DX3_P4_0 3 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P1_8 1 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_P3_2 2 +#define USIC1_C0_DX4_P4_0 3 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P1_7 1 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_P4_1 2 +#define USIC1_C0_DX5_P4_2 3 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX0_P3_1 5 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P1_8 2 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_P1_7 2 +#define USIC1_C1_DX2_P3_3 0 +#define USIC1_C1_DX2_P3_4 1 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX3_P3_2 3 +#define USIC1_C1_DX3_P4_11 0 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_P3_2 3 +#define USIC1_C1_DX4_P4_11 0 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_10 0 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + +#endif /* XMC1_USIC_MAP_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_acmp.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_acmp.h new file mode 100644 index 00000000..41d65273 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_acmp.h @@ -0,0 +1,424 @@ +/** + * @file xmc_acmp.h + * @date 2015-09-02 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2014-12-10: + * - Initial version + * 2015-02-20: + * - Removed unused declarations
+ * 2015-05-08: + * - Fixed sequence problem of low power mode in XMC_ACMP_Init() API
+ * - Fixed wrong register setting in XMC_ACMP_SetInput() API
+ * - Removed return type variable and by default comparator enable from XMC_ACMP_Init() API.
+ * Additional call to XMC_ACMP_EnableComparator() API needed to start Comparator after Init.
+ * 2015-06-04: + * - Removed return type variable and by default comparator enable from XMC_ACMP_Init() API.
+ * - Divided XMC_ACMP_SetInput into two 3 APIs to reduce the code size and complexity as stated below
+ * (a)XMC_ACMP_EnableReferenceDivider
+ * (b)XMC_ACMP_DisableReferenceDivider
+ * (c)XMC_ACMP_SetInput
+ * - Optimized enable and disable API's and moved to header file as static inline APIs. + * - XMC_ACMP_t typedef changed to structure which overrides the standard header file structure. + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * 2015-06-26: + * - API help documentation modified. + * 2015-09-02: + * - API help documentation modified for XMC1400 device support. + * @endcond + * + */ + +#ifndef XMC_ACMP_H +#define XMC_ACMP_H + + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup ACMP + * @brief Analog Comparator(ACMP) low level driver for XMC1 family of microcontrollers.
+ * + * The ACMP module consists of minimum of 3 analog comparators. Each analog comparator has two inputs, INP and INN. + * Input INP is compared with input INN in the pad voltage domain. + * It generates a digital comparator output signal. The digital comparator output signal is shifted down from VDDP + * power supply voltage level to VDDC core voltage level. The ACMP module provides the following functionalities.\n + * -# Monitor external voltage level + * -# Operates in low power mode + * -# Provides Inverted ouput option\n + + * \par The ACMP low level driver funtionalities + *
    + *
  1. Initializes an instance of analog comparator module with the @ref XMC_ACMP_CONFIG_t configuration structure + * using the API XMC_ACMP_Init().
  2. + *
  3. Programs the source of input(INP) specified by @ref XMC_ACMP_INP_SOURCE_t parameter using the API + * XMC_ACMP_SetInput().
  4. + *
  5. Sets the low power mode of operation using XMC_ACMP_SetLowPowerMode() API.
  6. + *
+ * @{ + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +/* If ACMP is available*/ +#if defined (COMPARATOR) + +#define XMC_ACMP0 (XMC_ACMP_t*)COMPARATOR /**< Comparator module base address defined*/ + +#if UC_SERIES == XMC14 +#define XMC_ACMP_MAX_INSTANCES (4U) /* Maximum number of Analog Comparators available*/ +#else +#define XMC_ACMP_MAX_INSTANCES (3U) /* Maximum number of Analog Comparators available*/ +#endif + +/* Checks if the pointer being passed is valid*/ +#define XMC_ACMP_CHECK_MODULE_PTR(PTR) (((PTR)== (XMC_ACMP_t*)COMPARATOR)) + +/* Checks if the instance being addressed is valid*/ +#define XMC_ACMP_CHECK_INSTANCE(INST) (((INST)< XMC_ACMP_MAX_INSTANCES)) + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/** + * Defines the return value of an API. + */ +typedef enum XMC_ACMP_STATUS +{ + XMC_ACMP_STATUS_SUCCESS = 0U, /**< API completes the execution successfully */ + XMC_ACMP_STATUS_ERROR , /**< API cannot fulfill the request */ +} XMC_ACMP_STATUS_t; + +/** + * Defines the hysteresis voltage levels to reduce noise sensitivity. + */ +typedef enum XMC_ACMP_HYSTERESIS +{ + XMC_ACMP_HYSTERESIS_OFF = 0U, /**< No hysteresis */ + XMC_ACMP_HYSTERESIS_10 , /**< Hysteresis = 10mv */ + XMC_ACMP_HYSTERESIS_15 , /**< Hysteresis = 15mv */ + XMC_ACMP_HYSTERESIS_20 /**< Hysteresis = 20mv */ +} XMC_ACMP_HYSTERESIS_t; + +/** + * Defines the comparator output status options. + */ +typedef enum XMC_ACMP_COMP_OUT +{ + XMC_ACMP_COMP_OUT_NO_INVERSION = 0U, /**< ACMP output is HIGH when, Input Positive(INP) greater than Input + Negative(INN). Vplus > Vminus */ + XMC_ACMP_COMP_OUT_INVERSION /**< ACMP output is HIGH when, Input Negative(INN) greater than Input + Positive(INP). Vminus > Vplus*/ +} XMC_ACMP_COMP_OUT_t; + +/** + * Defines the analog comparator input connection method. + */ +typedef enum XMC_ACMP_INP_SOURCE +{ + XMC_ACMP_INP_SOURCE_STANDARD_PORT = 0U, /**< Input is connected to port */ + XMC_ACMP_INP_SOURCE_ACMP1_INP_PORT = (uint16_t)(COMPARATOR_ANACMP0_ACMP0_SEL_Msk) /**< Input is connected to port + and ACMP1 INP */ +} XMC_ACMP_INP_SOURCE_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + + +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * ACMP module + */ +typedef struct { + __IO uint32_t ORCCTRL; + __I uint32_t RESERVED[726]; + __IO uint32_t ANACMP[XMC_ACMP_MAX_INSTANCES]; +} XMC_ACMP_t; + +/** + * Structure for initializing the ACMP module. It configures the ANACMP register of the respective input. + */ +typedef struct XMC_ACMP_CONFIG +{ + union + { + struct + { + uint32_t : 1; + uint32_t filter_disable : 1; /**< Comparator filter option for removing glitches. By default this option + is selected in ANACMP register. Setting this option disables the filter */ + uint32_t : 1; + uint32_t output_invert : 1; /**< Option to invert the comparator output. Use XMC_@ref XMC_ACMP_COMP_OUT_t type*/ + uint32_t hysteresis : 2; /**< Hysteresis voltage to reduce noise sensitivity. Select the voltage levels + from the values defined in @ref XMC_ACMP_HYSTERESIS_t. */ + uint32_t : 26; + }; + uint32_t anacmp; + }; +} XMC_ACMP_CONFIG_t; + +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ + +/** + * @param peripheral Constant pointer to analog comparator module, of @ref XMC_ACMP_t type. Use @ref XMC_ACMP0 macro. + * @param instance ACMP instance number.
+ * Range:
0 - ACMP0
+ * 1 - ACMP1
+ * 2 - ACMP2
+ * 3 - ACMP3 - Only applicable for XMC1400 devices
+ * + * @param config Pointer to configuration data. Refer data structure @ref XMC_ACMP_CONFIG_t for settings. + * @return + * None
+ * + * \parDescription:
+ * Initializes an instance of analog comparator module.
\n + * Configures the ANACMP resister with hysteresis, comparator filter and inverted comparator output. + * + * \parRelated APIs:
+ * None. + */ +void XMC_ACMP_Init(XMC_ACMP_t *const peripheral, uint32_t instance, const XMC_ACMP_CONFIG_t *const config); + +/** + * @param peripheral Constant pointer to analog comparator module, of @ref XMC_ACMP_t type. Use @ref XMC_ACMP0 macro. + * @param instance ACMP instance number.
+ * Range:
0 - ACMP0
+ * 1 - ACMP1
+ * 2 - ACMP2
+ * 3 - ACMP3 - Only applicable for XMC1400 devices
+ * @return + * None
+ * + * \parDescription:
+ * Enables an instance of ACMP module.
\n + * Starts the comparator by setting CMP_EN bit of respective ANACMP \a instance register. The \a instance number + * determines which analog comparator to be switched on. Call this API after the successful completion of the comparator + * initilization and input selection. + * + * \parRelated APIs:
+ * XMC_ACMP_DisableComparator().
+ */ +__STATIC_INLINE void XMC_ACMP_EnableComparator(XMC_ACMP_t *const peripheral, uint32_t instance) +{ + XMC_ASSERT("XMC_ACMP_EnableComparator:Wrong module pointer", XMC_ACMP_CHECK_MODULE_PTR(peripheral)) + XMC_ASSERT("XMC_ACMP_EnableComparator:Wrong instance number", XMC_ACMP_CHECK_INSTANCE(instance) ) + + peripheral->ANACMP[instance] |= (uint16_t)COMPARATOR_ANACMP0_CMP_EN_Msk; + +} + + +/** + * @param peripheral Constant pointer to analog comparator module, of @ref XMC_ACMP_t type. Use @ref XMC_ACMP0 macro. + * @param instance ACMP instance number.
+ * Range:
0 - ACMP0
+ * 1 - ACMP1
+ * 2 - ACMP2
+ * 3 - ACMP3 - Only applicable for XMC1400 devices
+ * @return + * None
+ * \parDescription:
+ * Disables an instance of ACMP module.
\n + * Stops the comparator by resetting CMP_EN bit of respective ANACMP \a instance register. The \a instance number + * determines which analog comparator to be switched off. + * + * \parRelated APIs:
+ * XMC_ACMP_EnableComparator(). + */ +__STATIC_INLINE void XMC_ACMP_DisableComparator(XMC_ACMP_t *const peripheral, uint32_t instance) +{ + XMC_ASSERT("XMC_ACMP_DisableComparator:Wrong module pointer", XMC_ACMP_CHECK_MODULE_PTR(peripheral)) + XMC_ASSERT("XMC_ACMP_DisableComparator:Wrong instance number", XMC_ACMP_CHECK_INSTANCE(instance) ) + + peripheral->ANACMP[instance] &= (uint16_t)(~((uint32_t)COMPARATOR_ANACMP0_CMP_EN_Msk)); +} + +/** + * @param None + * @return + * None
+ * + * \parDescription:
+ * Enables the reference divider for analog comparator instance 1.
\n + * ACMP1 input INP is driven by an internal reference voltage by setting DIV_EN bit of ANACMP1 register. + * Other comparator instances can also share this reference divider option by calling the XMC_ACMP_SetInput() API. + * + * \parRelated APIs:
+ * XMC_ACMP_SetInput(). + */ +__STATIC_INLINE void XMC_ACMP_EnableReferenceDivider(void) +{ + /* Enable the divider switch and connect the divided reference to ACMP1.INP */ + COMPARATOR->ANACMP1 |= (uint16_t)(COMPARATOR_ANACMP1_REF_DIV_EN_Msk); +} + +/** + * @param None + * @return + * None
+ * + * \parDescription:
+ * Disables the reference divider for analog comparator instance 1.
\n + * ACMP1 input INP is disconnected from the reference divider. This is achieved by reseting DIV_EN bit of ANACMP1 + * register. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_ACMP_DisableReferenceDivider(void) +{ + /* Disable the divider switch and use ACMP1.INP as standard port*/ + COMPARATOR->ANACMP1 &= (uint16_t)(~(COMPARATOR_ANACMP1_REF_DIV_EN_Msk)); +} + +/** + * @param peripheral Constant pointer to analog comparator module, of @ref XMC_ACMP_t type. Use @ref XMC_ACMP0 macro. + * @param instance ACMP instance number.
+ * Range:
0 - ACMP0
+ * 2 - ACMP2
+ * 3 - ACMP3 - Only applicable for XMC1400 devices
+ * @param source ACMP input source selection options.
+ * Range:
XMC_ACMP_INP_SOURCE_STANDARD_PORT - Input is connected to port
+ * XMC_ACMP_INP_SOURCE_ACMP1_INP_PORT - Input is connected to port and ACMP1 INP
+ * @return + * None
+ * + * \parDescription:
+ * Sets the analog comparartor input selection for ACMP0, ACMP2 instances.
\n + * Apart from ACMP1 instance, each ACMP instances can be connected to its own port and ACMP1 INP. + * Calling @ref XMC_ACMP_EnableReferenceDivider() API, after this API can share the reference divider to one of the + * comparartor input as explained in the following options.
+ * The hardware options to set input are listed below.
+ *
    + *
  1. The comparator inputs aren't connected to other ACMP1 comparator inputs.
  2. + *
  3. Can program the comparator-0 to connect ACMP0.INP to ACMP1.INP in XMC1200 AA or XMC1300 AA
  4. + *
  5. Can program the comparator-0 to connect ACMP0.INN to ACMP1.INP in XMC1200 AB or XMC1300 AB or XMC1400 AA
  6. + *
  7. Can program the comparator-2 to connect ACMP2.INP to ACMP1.INP
  8. + *

+ * Directly accessed registers are ANACMP0, ANACMP2 according to the availability of instance in the devices. + * + * \parRelated APIs:
+ * @ref XMC_ACMP_EnableReferenceDivider.
+ * @ref XMC_ACMP_DisableReferenceDivider. + */ +void XMC_ACMP_SetInput(XMC_ACMP_t *const peripheral, uint32_t instance, const XMC_ACMP_INP_SOURCE_t source); + + +/** + * @param None + * @return + * None
+ * + * \parDescription:
+ * Set the comparartors to operate in low power mode, by setting the LPWR bit of ANACMP0 register.
\n + * The low power mode is controlled by ACMP0 instance. Low power mode is applicable for all instances of the + * comparator. In low power mode, blanking time will be introduced to ensure the stability of comparartor output. This + * will slow down the comparator operation. + * + * \parRelated APIs:
+ * XMC_ACMP_ClearLowPowerMode(). + */ +__STATIC_INLINE void XMC_ACMP_SetLowPowerMode(void) +{ + COMPARATOR->ANACMP0 |= (uint16_t)COMPARATOR_ANACMP0_CMP_LPWR_Msk; +} + +/** + * @param None + * @return + * None
+ * + * \parDescription:
+ * Exits the low power mode by reseting LPWR bit of ANACMP0 register.
\n + * The low power mode is controlled by ACMP0 module. Low power mode is applicable for all instances of the + * comparator. To re-enable the low power mode, call the related API @ref XMC_ACMP_SetLowPowerMode(). + * + * \parRelated APIs:
+ * XMC_ACMP_SetLowPowerMode(). + */ +__STATIC_INLINE void XMC_ACMP_ClearLowPowerMode(void) +{ + COMPARATOR->ANACMP0 &= (uint16_t)(~(uint16_t)COMPARATOR_ANACMP0_CMP_LPWR_Msk); +} + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* If ACMP is available*/ + +#endif /* XMC_ACMP_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_bccu.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_bccu.h new file mode 100644 index 00000000..87368e3a --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_bccu.h @@ -0,0 +1,1976 @@ +/** + * @file xmc_bccu.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-19: + * - Initial draft
+ * - Documentation improved
+ * + * 2015-05-08: + * - Minor bug fix in XMC_BCCU_ClearEventFlag(). + * - New APIs are added: XMC_BCCU_DIM_ReadDimDivider(), XMC_BCCU_DIM_GetDimCurve(), XMC_BCCU_IsDitherEnable()
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * Detailed description of file:
+ * APIs for the functional blocks of BCCU have been defined:
+ * -- GLOBAL configuration
+ * -- Clock configuration, Function/Event configuration, Interrupt configuration
+ * + * @endcond + * + */ + +#ifndef XMC_BCCU_H +#define XMC_BCCU_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup BCCU + * @brief Brightness and Color Control Unit (BCCU) driver for the XMC1 microcontroller family. + * + * The Brightness and Color Control Unit (BCCU) is a dimming control peripheral for LED lighting applications. The BCCU + * module can be used to control multiple LED channels. Every channel generates one-bit sigma-delta bit stream with a + * user adjustable 12-bit average value. The dimming engine changes the brightness gradually (exponential curve) to appear + * natural to the human eye. It supports color control by adjusting the relative intensity of selected channels using a + * linear walk scheme for smooth color changes. It also supports high-power multi-channel LED lamps by optionally packing + * the bitstream. The optional packer which decreases the average rate of output switching by enforcing a defined on-time. + * The BCCU module generates two trigger signals to the ADC (BCCU_TRIGOUT0 and BCCU_TRIGOU1) to start conversions in a + * synchronized manner. The module can also be used as a multi-channel digital-analog converter with low-pass filters on the + * outputs. The BCCU module supports 3 independent dimming engines, 9 independent channels, Trap functions and 2 ADC + * triggering modes. + * + * The driver is divided into global control (BCCU), channel control (BCCU_CH) and dimming control (BCCU_DIM). + * + * BCCU features: + * -# Configuration structure XMC_BCCU_GLOBAL_CONFIG_t and initialization function XMC_BCCU_GlobalInit() + * -# Allows configuring of clock settings (Fast clock, Bit clock and Dimming clock). XMC_BCCU_SetFastClockPrescaler(), + * -# XMC_BCCU_SelectBitClock(), XMC_BCCU_SetDimClockPrescaler(). + * -# Allows configuring global trigger settings. XMC_BCCU_ConfigGlobalTrigger() + * -# Allows enabling multiple channels together. XMC_BCCU_ConcurrentEnableChannels() + * -# Allows enabling single channel. XMC_BCCU_EnableChannel() + * -# Allows configuring global dimming level. XMC_BCCU_SetGlobalDimmingLevel() + * -# Starts linear walk for multiple channels together. XMC_BCCU_ConcurrentStartLinearWalk(). + * -# Starts linear walk for single channel. XMC_BCCU_StartLinearWalk(). + * -# Starts dimming for multiple dimming engines together. XMC_BCCU_ConcurrentStartDimming(). + * -# Starts dimming for single dimming engine. XMC_BCCU_StartDimming(). + * + * BCCU_CH features: + * -# Configuration structure (XMC_BCCU_CH_t and initialization function XMC_BCCU_CH_Init() + * -# Allows selecting dimming engine. XMC_BCCU_CH_SelectDimEngine(). + * -# Allows setting target channel intensity. XMC_BCCU_CH_SetTargetIntensity(). + * -# Allows knowing the status of linear walk completion. XMC_BCCU_IsLinearWalkComplete() + * -# Allows setting flicker watchdog. XMC_BCCU_CH_EnableFlickerWatchdog(). + * -# Allows configuring packer settings. XMC_BCCU_CH_EnablePacker(), XMC_BCCU_CH_SetPackerThreshold(), + * XMC_BCCU_CH_SetPackerOffCompare(), XMC_BCCU_CH_SetPackerOffCounte(), XMC_BCCU_CH_SetPackerOnCounter() + * -# Allows selecting dimming bypass. XMC_BCCU_CH_DisableDimmingBypass() + * + * BCCU_DIM features: + * -# Configuration structure (XMC_BCCU_DIM_t and initialization function XMC_BCCU_DIM_Init() + * -# Allows setting target dimming engine intensity. XMC_BCCU_DIM_SetTargetDimmingLevel(). + * XMC_BCCU_DIM_SetTargetDimmingLevel + * -# Allows knowing the status of dimming completion. XMC_BCCU_IsDimmingFinished() + * -# Allows configuring dimming divider. XMC_BCCU_DIM_SetDimDivider() + * -# Allows configuring dimming curve. XMC_BCCU_DIM_ConfigDimCurve() + * + * Recommended programming sequence: + * -# Set output passive and active levels using XMC_BCCU_ConcurrentSetOutputPassiveLevel() or XMC_BCCU_SetOutputPassiveLevel() + * -# Initializes global features using XMC_BCCU_GlobalInit() + * -# Initializes channel features using XMC_BCCU_CH_Init() + * -# Initializes dimming engine using XMC_BCCU_DIM_Init() + * -# Enable channels using XMC_BCCU_ConcurrentEnableChannels() or XMC_BCCU_EnableChannel() + * -# Enable dimming engines using XMC_BCCU_ConcurrentEnableDimmingEngine() or XMC_BCCU_EnableDimmingEngine() + * -# Configure channel linear walk prescaler using XMC_BCCU_CH_SetLinearWalkPrescaler() + * -# Configure dimming divider using XMC_BCCU_DIM_SetDimDivider() + * -# Set target intensities of channels using XMC_BCCU_CH_SetTargetIntensity() + * -# Set target dim levels of dimming engines using XMC_BCCU_DIM_SetTargetDimmingLevel() + * -# Start linear walk of the channels using XMC_BCCU_ConcurrentStartLinearWalk() or XMC_BCCU_StartLinearWalk() + * -# Start dimming of the dimming engines using XMC_BCCU_ConcurrentStartDimming() or XMC_BCCU_StartDimming() + * -# Check the status of linear walk completion using XMC_BCCU_IsLinearWalkComplete() + * -# Check the status of dimming completion XMC_BCCU_IsDimmingFinished() + * @{ + */ + +#if defined (BCCU0) + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +/** + * Defines the status of BCCU driver, to verify the related API calls. Use type \a XMC_BCCU_STATUS_t for this enum. + */ + typedef enum { + XMC_BCCU_STATUS_SUCCESS = 0U, /**< Operation completed successfully */ + XMC_BCCU_STATUS_ERROR = 1U, /**< Operation has some errors */ +} XMC_BCCU_STATUS_t; + +/** + * Provides the options to select bit clock mode. + */ +typedef enum { + XMC_BCCU_BCLK_MODE_NORMAL = 0U, /**< Normal Mode: Bit clock runs at 1/4 of fast clock */ + XMC_BCCU_BCLK_MODE_FAST = 1U, /**< Fast Mode: Bit clock runs at same as fast clock */ +} XMC_BCCU_BCLK_MODE_t; + +/** + * Provides the options to select trigger mode. + */ +typedef enum { + XMC_BCCU_TRIGMODE0 = 0U, /**< Mode0: Trigger on Any Channel using OR logic */ + XMC_BCCU_TRIGMODE1 = 1U, /**< Mode1: Trigger on Active channel using round-robin*/ +} XMC_BCCU_TRIGMODE_t; + +/** + * Provides the options to select trigger delay, and only be used if Bit clock in Normal mode + */ +typedef enum { + XMC_BCCU_TRIGDELAY_NO_DELAY = 0U, /**< BCCU trigger occurs on channel trigger(without delay) */ + XMC_BCCU_TRIGDELAY_QUARTER_BIT = 1U, /**< BCCU trigger occurs on 1/4 bit time delayed after channel trigger */ + XMC_BCCU_TRIGDELAY_HALF_BIT = 2U, /**< BCCU trigger occurs on 1/2 bit time delayed after channel trigger */ +} XMC_BCCU_TRIGDELAY_t; + +/** + * Provides the options to select suspend mode + */ +typedef enum { + XMC_BCCU_SUSPEND_MODE_IGNORE = 0U, /**< Request ignored, and module cannot get suspended */ + XMC_BCCU_SUSPEND_MODE_FREEZE = 1U, /**< All running channels gets stopped, and freeze into a last state (without safe stop) + */ + XMC_BCCU_SUSPEND_MODE_SAFE_FREEZE = 2U, /**< All running channels gets stopped, and freeze into a last state (with safe + stop) */ +} XMC_BCCU_SUSPEND_MODE_t; + +/** + * Provides the options to select trap edge + */ +typedef enum { + XMC_BCCU_TRAPEDGE_RISING = 0U, /**< Trap on rising edge of the BCCU.TRAPL signal */ + XMC_BCCU_TRAPEDGE_FALLING = 1U, /**< Trap on falling edge of the BCCU.TRAPL signal */ +} XMC_BCCU_TRAPEDGE_t; + +/** + * Provides the options to enable/disable the events. + * The members can be combined using 'OR' operator for multiple selection.
+ */ +typedef enum { + XMC_BCCU_EVENT_TRIGGER0 = 0x1U, /**< Trigger 0 event */ + XMC_BCCU_EVENT_TRIGGER1 = 0x2U, /**< Trigger 1 event */ + XMC_BCCU_EVENT_FIFOFULL = 0x4U, /**< FIFO Full event */ + XMC_BCCU_EVENT_FIFOEMPTY = 0x8U, /**< FIFO Empty event */ + XMC_BCCU_EVENT_TRAP = 0x10U, /**< Trap event */ +} XMC_BCCU_EVENT_t; + +/** + * Provides the options to know the status of the event flags. + * The members can be combined using 'OR' operator for multiple selection.
+ */ +typedef enum { + XMC_BCCU_EVENT_STATUS_TRIGGER0 = 0x1U, /**< Trigger 0 Event flag status */ + XMC_BCCU_EVENT_STATUS_TRIGGER1 = 0x2U, /**< Trigger 1 Event flag status */ + XMC_BCCU_EVENT_STATUS_FIFOFULL = 0x4U, /**< FIFO Full Event flag status */ + XMC_BCCU_EVENT_STATUS_FIFOEMPTY = 0x8U, /**< FIFO Empty Event flag status */ + XMC_BCCU_EVENT_STATUS_TRAP = 0x10U, /**< Trap Event flag status (Without Trap Set) */ + XMC_BCCU_EVENT_STATUS_TRAP_STATE = 0x40U, /**< Trap state flag status */ +} XMC_BCCU_EVENT_STATUS_t; + +/** + * Provides the options to know the status of trap occurrence + */ +typedef enum { + XMC_BCCU_TRAP_STATUS_DEACTIVE = 0x0U, /**< BCCU module is not in a Trap State */ + XMC_BCCU_TRAP_STATUS_ACTIVE = 0x1U, /**< BCCU module is in a Trap State */ +} XMC_BCCU_TRAP_STATUS_t; + +/** + * Provides the options to know the current level of trap + */ +typedef enum { + XMC_BCCU_TRAP_LEVEL_LOW = 0x0U, /**< BCCU.TRAPL is Low */ + XMC_BCCU_TRAP_LEVEL_HIGH = 0x1U, /**< BCCU.TRAPL is High */ +} XMC_BCCU_TRAP_LEVEL_t; + +/** + * Provides the options to select flicker watchdog enable/disable + */ +typedef enum { + XMC_BCCU_CH_FLICKER_WD_DS = 0U, /**< Disable: No control over a sigma-delta modulator output */ + XMC_BCCU_CH_FLICKER_WD_EN = 1U, /**< Enable: Limit consecutive zeros at sigma-delta modulator output */ +} XMC_BCCU_CH_FLICKER_WD_t; + +/** + * Provides the options to select gating functionality enable/disable, and be used for peak-current control + */ +typedef enum { + XMC_BCCU_CH_GATING_FUNC_DISABLE = 0U, /**< Disable: No control over a BCCU module output */ + XMC_BCCU_CH_GATING_FUNC_ENABLE = 1U, /**< Enable: External gating signal which controls BCCU module output */ +} XMC_BCCU_CH_GATING_FUNC_t; + +/** + * Provides the options to bypass dimming engine + */ +typedef enum { + XMC_BCCU_CH_DIMMING_ENGINE_BYPASS_DISABLE = 0U, /**< Disable: Brightness = Dimming Level * Intensity */ + XMC_BCCU_CH_DIMMING_ENGINE_BYPASS_ENABLE = 1U, /**< Enable: Brightness = Intensity */ +} XMC_BCCU_CH_DIMMING_ENGINE_BYPASS_t; + +/** + * Provides the options to select passive level of the channel output + */ +typedef enum{ + XMC_BCCU_CH_ACTIVE_LEVEL_HIGH = 0U, /**< Default passive level of the channel is low */ + XMC_BCCU_CH_ACTIVE_LEVEL_LOW = 1U, /**< Default passive level of the channel is high */ +} XMC_BCCU_CH_ACTIVE_LEVEL_t; + +/** + * Provides the options to select trigger edge + */ +typedef enum +{ + XMC_BCCU_CH_TRIG_EDGE_PASS_TO_ACT = 0U, /**< Trigger on output transition from passive to active */ + XMC_BCCU_CH_TRIG_EDGE_ACT_TO_PASS = 1U, /**< Trigger on output transition from active to passive */ +} XMC_BCCU_CH_TRIG_EDGE_t; + +/** + * Provides the options to select source of trap input + */ +typedef enum +{ + XMC_BCCU_CH_TRAP_INA = 0x0U, /**< Trap INA */ + XMC_BCCU_CH_TRAP_INB = 0x1U, /**< Trap INB */ + XMC_BCCU_CH_TRAP_INC = 0x2U, /**< Trap INC */ + XMC_BCCU_CH_TRAP_IND = 0x3U, /**< Trap IND */ + XMC_BCCU_CH_TRAP_INE = 0x4U, /**< Trap INE */ + XMC_BCCU_CH_TRAP_INF = 0x5U, /**< Trap INF */ + XMC_BCCU_CH_TRAP_ING = 0x6U, /**< Trap ING */ + XMC_BCCU_CH_TRAP_INH = 0x7U, /**< Trap INH */ + XMC_BCCU_CH_TRAP_INI = 0x8U, /**< Trap INI */ + XMC_BCCU_CH_TRAP_INJ = 0x9U, /**< Trap INJ */ + XMC_BCCU_CH_TRAP_INK = 0xAU, /**< Trap INK */ + XMC_BCCU_CH_TRAP_INL = 0xBU, /**< Trap INL */ + XMC_BCCU_CH_TRAP_INM = 0xCU, /**< Trap INM */ + XMC_BCCU_CH_TRAP_INN = 0xDU, /**< Trap INN */ + XMC_BCCU_CH_TRAP_INO = 0xEU, /**< Trap INO */ + XMC_BCCU_CH_TRAP_INP = 0xFU, /**< Trap INP */ +} XMC_BCCU_CH_TRAP_IN_t; + +/** + * Provides the options to select edge for trap occurrence + */ +typedef enum +{ + XMC_BCCU_CH_TRAP_EDGE_RISING = 0U, /**< Trap on rising edge of the BCCU.TRAPL signal */ + XMC_BCCU_CH_TRAP_EDGE_FALLING = 1U /**< Trap on falling edge of the BCCU.TRAPL signal */ +} XMC_BCCU_CH_TRAP_EDGE_t; + +/** + * Provides the options to select trigger output, and only be used in XMC_BCCU_TRIGMODE1 + */ +typedef enum { + XMC_BCCU_CH_TRIGOUT0 = 0U, /**< Trigger occurrence on BCCU_TRIGOUT0 signal */ + XMC_BCCU_CH_TRIGOUT1 = 1U, /**< Trigger occurrence on BCCU_TRIGOUT1 signal */ +} XMC_BCCU_CH_TRIGOUT_t; + +/** + * Provides the options to select dimming source of the channel + */ +typedef enum { + XMC_BCCU_CH_DIMMING_SOURCE_GLOBAL = 7U, /**< Global Dimming Engine */ + XMC_BCCU_CH_DIMMING_SOURCE_DE0 = 0U, /**< Dimming Engine 0 */ + XMC_BCCU_CH_DIMMING_SOURCE_DE1 = 1U, /**< Dimming Engine 1 */ + XMC_BCCU_CH_DIMMING_SOURCE_DE2 = 2U, /**< Dimming Engine 2 */ +} XMC_BCCU_CH_DIMMING_SOURCE_t; + +/** + * Provides the options to select exponential dimming curve + */ +typedef enum { + XMC_BCCU_DIM_CURVE_COARSE = 0U, /**< Coarse curve: Slope of the linear pieces doubles every time, when it passes specific + thresholds of 16, 32, 64, 128, 256, 512, 1024, 2048 */ + XMC_BCCU_DIM_CURVE_FINE = 1U, /**< Fine Curve: More pieces and different line slopes */ +} XMC_BCCU_DIM_CURVE_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ +/** + * Redefinition of BCCU module structure; pointer to bccu module base address + */ +typedef BCCU_Type XMC_BCCU_t; + +/** + * Redefinition of BCCU module channel structure; pointer to bccu module channel Base address + */ +typedef BCCU_CH_Type XMC_BCCU_CH_t; + +/** + * Redefinition of BCCU module dimming engine structure; pointer to bccu module dimming engine base address + */ +typedef BCCU_DE_Type XMC_BCCU_DIM_t; + +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * Configures a global setting of the BCCU module. + */ +typedef struct XMC_BCCU_GLOBAL_CONFIG +{ + union{ + struct{ + uint32_t trig_mode:1; /**< Selects trigger Mode. Use type @ref XMC_BCCU_TRIGMODE_t */ + uint32_t : 1; + uint32_t trig_delay:2; /**< Selects trigger delay between channel & module trigger. \n Use type @ref + XMC_BCCU_TRIGDELAY_t */ + uint32_t : 12; + uint32_t maxzero_at_output:12; /**< Configures maximum 0's allowed at modulator output */ + }; + uint32_t globcon; /* Not to use */ + }; + union{ + struct{ + uint32_t fclk_ps:12; /**< Configures the ratio between fast clock and module clock */ + uint32_t : 3; + uint32_t bclk_sel:1; /**< Selects the bit clock. Use type @ref XMC_BCCU_BCLK_MODE_t */ + uint32_t dclk_ps:12; /**< Configures the ratio between dimmer clock and module clock */ + }; + uint32_t globclk; /* Not to use */ + }; + uint32_t global_dimlevel; /**< Configures global dimming engine dimming level */ +} XMC_BCCU_GLOBAL_CONFIG_t; + + +/** + * Configures global trigger settings of the BCCU module. + */ +typedef struct XMC_BCCU_TRIG_CONFIG +{ + XMC_BCCU_TRIGMODE_t mode; /**< Selects global trigger mode which decides when to occur BCCU trigger */ + XMC_BCCU_TRIGDELAY_t delay; /**< Selects global trigger delay between channel trigger & BCCU trigger */ + uint16_t mask_chans; /**< Channel mask to configure trigger settings for multiple channels For example: + If channel 0 and 7, wants to configure then the channel mask is 01000 0001 = 0x81\n*/ + uint16_t mask_trig_lines; /**< Trigger line mask */ +} XMC_BCCU_TRIG_CONFIG_t; + +/** + * Configures channel settings of the BCCU module. + */ +#ifdef DOXYGEN +typedef struct XMC_BCCU_CH_CONFIG +{ + uint32_t pack_thresh:3; /**< Configures packer threshold value of FIFO */ + uint32_t pack_en:1; /**< Enables a packed output bitstream */ + uint32_t dim_sel:3; /**< Selects a dimming engine source of the channel. \n Use type @ref XMC_BCCU_CH_DIMMING_SOURCE_t */ + uint32_t dim_bypass:1; /**< Selects dimming engine bypass enable. \n Use type @ref XMC_BCCU_CH_DIMMING_ENGINE_BYPASS_t */ + uint32_t gate_en:1; /**< Selects gating enable. Use type @ref XMC_BCCU_CH_GATING_FUNC_t */ + uint32_t flick_wd_en:1; /**< Selects flicker watchdog enable. Use type @ref XMC_BCCU_CH_FLICKER_WD_t */ + uint32_t trig_edge:1; /**< Selects trigger edge. Use type @ref XMC_BCCU_CH_TRIG_EDGE_t */ + uint32_t force_trig_en:1; /**< Selects force trigger enable; generates a trigger if modulator output do not change\n for + 256 bclk cycles */ + uint32_t pack_offcmp_lev:8; /**< Configures a packer off-time compare level. When the off-time counter reaches this, the + measured on & off time counters are stored into FIFO */ + uint32_t pack_oncmp_lev:8; /**< Configures a packer on-time compare level. When the on-time counter reaches this,\n + the measured on & off time counters are stored into FIFO */ + uint32_t pack_offcnt_val:8; /**< Configures an initial packer off-time counter level, only if channel is disabled.
+ Controls phase shift of the modulator output */ + uint32_t pack_oncnt_val:8; /**< Configures an initial packer on-time counter level, only if channel is disabled.
+ Controls phase shift of the modulator output */ +}XMC_BCCU_CH_CONFIG_t; +#endif + +typedef struct XMC_BCCU_CH_CONFIG +{ + union{ + struct{ + uint32_t pack_thresh:3; /**< Configures packer threshold value of FIFO */ + uint32_t pack_en:1; /**< Enables a packed output bitstream */ + uint32_t dim_sel:3; /**< Selects a dimming engine source of the channel. \n Use type @ref XMC_BCCU_CH_DIMMING_SOURCE_t + */ + uint32_t dim_bypass:1; /**< Selects dimming engine bypass enable. \n Use type @ref XMC_BCCU_CH_DIMMING_ENGINE_BYPASS_t */ + uint32_t gate_en:1; /**< Selects gating enable. Use type @ref XMC_BCCU_CH_GATING_FUNC_t */ + uint32_t flick_wd_en:1; /**< Selects flicker watchdog enable. Use type @ref XMC_BCCU_CH_FLICKER_WD_t */ + uint32_t trig_edge:1; /**< Selects trigger edge. Use type @ref XMC_BCCU_CH_TRIG_EDGE_t */ + uint32_t force_trig_en:1; /**< Selects force trigger enable; generates a trigger if modulator output do not change\n + for 256 bclk cycles */ + }; + uint32_t chconfig; /* Not to use */ + }; + union{ + struct{ + uint32_t pack_offcmp_lev:8; /**< Configures a packer off-time compare level. When the off-time counter reaches \n + this, the measured on & off time counters are stored into FIFO */ + uint32_t : 8; + uint32_t pack_oncmp_lev:8; /**< Configures a packer on-time compare level. When the on-time counter reaches this,\n + the measured on & off time counters are stored into FIFO */ + }; + uint32_t pkcmp; /* Not to use */ + }; + union{ + struct{ + uint32_t pack_offcnt_val:8; /**< Configures an initial packer off-time counter level, only if channel is disabled.
+ Controls phase shift of the modulator output */ + uint32_t : 8; + uint32_t pack_oncnt_val:8; /**< Configures an initial packer on-time counter level, only if channel is disabled.
+ Controls phase shift of the modulator output */ + }; + uint32_t pkcntr; /* Not to use */ + }; +}XMC_BCCU_CH_CONFIG_t; + +/** + * Configures dimming engine settings of the BCCU module. + */ +#ifdef DOXYGEN +typedef struct XMC_BCCU_DIM_CONFIG +{ + uint32_t dim_div:10; /**< Configures a dimming clock divider, used to adjust the fade rate. If 0, the dimming level
+ as same as target dimming level on shadow transfer */ + uint32_t dither_en:1; /**< Selects a dither enable. Dithering added for every dimming step if dimming level < 128. */ + uint32_t cur_sel:1; /**< Selects a type of exponential curve. Use type @ref XMC_BCCU_DIM_CURVE_t. If dither
+ enabled, the configuration is being ignored */ +}XMC_BCCU_DIM_CONFIG_t; +#endif + +typedef struct XMC_BCCU_DIM_CONFIG +{ + union{ + struct{ + uint32_t dim_div:10; /**< Configures a dimming clock divider, used to adjust the fade rate. If 0, the dimming level
+ as same as target dimming level on shadow transfer */ + uint32_t : 6; + uint32_t dither_en:1; /**< Selects a dither enable. Dithering added for every dimming step if dimming level < 128. */ + uint32_t cur_sel:1; /**< Selects a type of exponential curve. Use type @ref XMC_BCCU_DIM_CURVE_t. If dither
+ enabled, the configuration is being ignored */ + }; + uint32_t dtt; /* Not to use */ + }; +}XMC_BCCU_DIM_CONFIG_t; + +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif +/********************************************************************************************************************* + * API PROTOTYPES + ********************************************************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param config Pointer to constant bccu global configuration data structure. Use type @ref XMC_BCCU_GLOBAL_CONFIG_t. + * + * @return None + * + * \parDescription:
+ * Initializes three main clocks (fast clock, bit clock, dimmer clock) by using \a fclk_ps \a bclk_sel \a dclk_ps parameters + * and writing into a GLOBCLK register.\n + * And also configures a trigger mode, trigger delay, maximum 0's allowed at modulator output by writing into a GLOBCON + * register.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_Init(), XMC_BCCU_DIM_Init()\n\n\n +*/ +void XMC_BCCU_GlobalInit (XMC_BCCU_t *const bccu, const XMC_BCCU_GLOBAL_CONFIG_t *const config); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mode Trigger mode selection. \b Range: XMC_BCCU_TRIGMODE0, XMC_BCCU_TRIGMODE1.\n + * 1. XMC_BCCU_TRIGMODE0 - Trigger on Any Channel + * 2. XMC_BCCU_TRIGMODE1 - Trigger on Active channel + * @param delay Delay to avoid sampling during switching noise. Use type @ref XMC_BCCU_TRIGDELAY_t. \n + * \b Range: XMC_BCCU_NO_DELAY, XMC_BCCU_QUARTER_BIT_DELAY, XMC_BCCU_HALF_BIT_DELAY. + * + * @return None + * + * \parDescription:
+ * Configures trigger mode and trigger delay by writing register bits GLOBCON.TM, GLOBCON.TRDEL. \a mode and \a delay + * parameters which decides when to trigger a conversion of vadc module for voltage measurement. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableChannelTrigger(), XMC_BCCU_ReadGlobalTrigger(), XMC_BCCU_ConcurrentConfigTrigger(), XMC_BCCU_GlobalInit(), + * XMC_BCCU_ReadLastTrigChanNr(), XMC_BCCU_GetChannelOutputLvlAtLastTrigger(), XMC_BCCU_CH_ConfigTrigger()\n\n\n + */ +void XMC_BCCU_ConfigGlobalTrigger(XMC_BCCU_t *const bccu, XMC_BCCU_TRIGMODE_t mode, XMC_BCCU_TRIGDELAY_t delay); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Source of Trigger mode. \b Range: 0 or 1 \n + * 0 - Trigger mode 0 (Trigger on Any Channel) \n + * 1 - Trigger mode 1 (Trigger on Active Channel)\n\n + * \parDescription:
+ * Retrieves global trigger mode of the BCCU module by reading the register bit GLOBCON_TM. Use XMC_BCCU_TRIGMODE_t type to + * validate a returned value.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConfigGlobalTrigger(), XMC_BCCU_ConcurrentConfigTrigger(), XMC_BCCU_GlobalInit()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadGlobalTrigger (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(bccu->GLOBCON & BCCU_GLOBCON_TM_Msk); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param input Trap input selection. Use type @ref XMC_BCCU_TRIGDELAY_t. + * \b Range: XMC_BCCU_TRIGDELAY_NO_DELAY, XMC_BCCU_TRIGDELAY_QUARTER_BIT, XMC_BCCU_TRIGDELAY_HALF_BIT. + * + * @return None + * + * \parDescription:
+ * Selects input of trap functionality by writing register bit GLOBCON_TRAPIS. The trap functionality is used to switch + * off the connected power devices when trap input becomes active.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetTrapEdge(), XMC_BCCU_ReadTrapInput(), XMC_BCCU_EnableTrap(), XMC_BCCU_ConcurrentEnableTrap()\n\n\n + */ +void XMC_BCCU_SelectTrapInput (XMC_BCCU_t *const bccu, XMC_BCCU_CH_TRAP_IN_t input); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Source of trap input. \b Range: 0 to 15 \n + * 0 - TRAPINA \n + * 1 - TRAPINB and so on. \n + * \parDescription:
+ * Retrieves trap input of the channel by reading the register bit GLOBCON_TRAPIS. Use XMC_BCCU_CH_TRAP_IN_t type to + * validate a returned value.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SelectTrapInput()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadTrapInput (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(( (bccu->GLOBCON) & BCCU_GLOBCON_TRAPIS_Msk) >> BCCU_GLOBCON_TRAPIS_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param edge Trap edge selection. Use type @ref XMC_BCCU_CH_TRAP_EDGE_t. \n + * \b Range: XMC_BCCU_CH_TRAP_EDGE_RISING, XMC_BCCU_CH_TRAP_EDGE_FALLING. + * + * @return None + * + * \parDescription:
+ * Selects active edge which detects trap on TRAPL signal by writing register bit GLOBCON_TRAPED.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SelectTrapInput(), XMC_BCCU_ReadTrapEdge(), XMC_BCCU_EnableTrap(), XMC_BCCU_ConcurrentEnableTrap()\n\n\n + */ +void XMC_BCCU_SetTrapEdge (XMC_BCCU_t *const bccu, XMC_BCCU_CH_TRAP_EDGE_t edge); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Trap edge selection. \b Range: 0 or 1 \n + * 0 - XMC_BCCU_CH_TRAP_EDGE_RISING \n + * 1 - XMC_BCCU_CH_TRAP_EDGE_FALLING. \n + * \parDescription:
+ * Retrieves trap edge by reading the register bit GLOBCON_TRAPED. Use XMC_BCCU_CH_TRAP_EDGE_t type to + * validate a returned value.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetTrapEdge()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadTrapEdge (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(( (bccu->GLOBCON) & BCCU_GLOBCON_TRAPED_Msk) >> BCCU_GLOBCON_TRAPED_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mode Suspend mode selection. Use type @ref XMC_BCCU_SUSPEND_MODE_t. \n + * \b Range: XMC_BCCU_SUSPEND_MODE_IGNORE, XMC_BCCU_SUSPEND_MODE_FREEZE, XMC_BCCU_USPEND_MODE_SAFE_FREEZE. \n + * + * @return None + * + * \parDescription:
+ * Configures suspend mode by writing register bit GLOBCON_SUSCFG.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ReadSuspendMode()\n\n\n + */ +void XMC_BCCU_ConfigSuspendMode (XMC_BCCU_t *const bccu, XMC_BCCU_SUSPEND_MODE_t mode); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Trap edge selection. \b Range: 0, 1, 2 \n + * 0 - XMC_BCCU_SUSPEND_MODE_IGNORE \n + * 1 - XMC_BCCU_SUSPEND_MODE_FREEZE. \n + * 2 - XMC_BCCU_USPEND_MODE_SAFE_FREEZE. \n + * \parDescription:
+ * Retrieves the state of suspend mode by reading the register bit GLOBCON_TRAPIS. Use XMC_BCCU_SUSPEND_MODE_t type to + * validate a returned value.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConfigSuspendMode()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadSuspendMode (XMC_BCCU_t *const bccu) +{ + return (uint32_t)( ((bccu->GLOBCON) & BCCU_GLOBCON_SUSCFG_Msk) >> BCCU_GLOBCON_SUSCFG_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Last triggered channel number. \b Range: 0 to 8\n + * 0 - BCCU Channel 0\n + * 1 - BCCU Channel 1 and so on.\n + * \parDescription:
+ * Retrieves last triggered channel number of a BCCU module by reading the register bit GLOBCON_LTRS.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_GetChannelOutputLvlAtLastTrigger(), XMC_BCCU_ConfigGlobalTrigger(), XMC_BCCU_ConcurrentConfigTrigger(), + * XMC_BCCU_ReadGlobalTrigger(), XMC_BCCU_GlobalInit()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadLastTrigChanNr (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(( (bccu->GLOBCON) & BCCU_GLOBCON_LTRS_Msk) >> BCCU_GLOBCON_LTRS_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param threshold_no Number of consecutive zeroes at modulator output. \b Range: 0 to 4095. + * + * @return None + * + * \parDescription:
+ * Configures number of consecutive zeroes allowed at modulator output (flicker watch-dog number) by writing register + * bit GLOBCON_WDMBN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_EnableFlickerWatchdog(), XMC_BCCU_ReadFlickerWDThreshold(), XMC_BCCU_CH_Init(), XMC_BCCU_CH_DisableFlickerWatchdog()\n\n\n + */ +void XMC_BCCU_SetFlickerWDThreshold (XMC_BCCU_t *const bccu, uint32_t threshold_no); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Number of consecutive zeroes at modulator output. \b Range: 0 to 4095 \n + * \parDescription:
+ * Retrieves number of consecutive zeroes at modulator output (flicker watchdog number) by reading the register bit + * GLOBCON_WDMBN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetFlickerWDThreshold(), XMC_BCCU_CH_EnableFlickerWatchdog(), XMC_BCCU_CH_Init(), XMC_BCCU_CH_DisableFlickerWatchdog()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadFlickerWDThreshold (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(( (bccu->GLOBCON) & BCCU_GLOBCON_WDMBN_Msk) >> BCCU_GLOBCON_WDMBN_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param div Prescaler factor. \b Range: 0 to 4095. + * + * @return None + * + * \parDescription:
+ * Configures trigger functionality clock prescaler factor of a BCCU module by writing register bit GLOBCLK_FCLK_PS.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetDimClockPrescaler(), XMC_BCCU_SelectBitClock(), XMC_BCCU_ReadFastClock()\n\n\n +*/ +void XMC_BCCU_SetFastClockPrescaler (XMC_BCCU_t *const bccu, uint32_t div); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Prescaler factor. \b Range: 0 to 4095 + * \parDescription:
+ * Retrieves fast clock prescaler factor of a BCCU module by reading the register bit GLOBCLK_FCLK_PS. The fast clock is + * derived from the bccu clock by prescaler factor i.e. fdclk = fbccu_clk / prescaler factor.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetFastClockPrescaler(), XMC_BCCU_ReadBitClock(), XMC_BCCU_ReadDimClock()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadFastClock (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(((bccu->GLOBCLK) & BCCU_GLOBCLK_FCLK_PS_Msk) >> BCCU_GLOBCLK_FCLK_PS_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param div Prescaler factor. \b Range: 0 to 4095. + * + * @return None + * + * \parDescription:
+ * Configures dimmer clock prescaler factor of a BCCU module by writing register bit GLOBCLK_DCLK_PS.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_SetDimDivider(), XMC_BCCU_SetFastClockPrescaler(), XMC_BCCU_SelectBitClock(), XMC_BCCU_ReadDimClock()\n\n\n + */ +void XMC_BCCU_SetDimClockPrescaler (XMC_BCCU_t *const bccu, uint32_t div); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Prescaler factor. \b Range: 0 to 4095 + * \parDescription:
+ * Retrieves dimmer clock prescaler factor of a BCCU module by reading the register bit GLOBCLK_DCLK_PS. The dim clock is + * derived from the bccu clock by prescaler factor. \n i.e. fdclk = fbccu_clk / prescaler factor.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetDimClockPrescaler(), XMC_BCCU_ReadBitClock(), XMC_BCCU_ReadFastClock()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadDimClock (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(((bccu->GLOBCLK) & BCCU_GLOBCLK_DCLK_PS_Msk) >> BCCU_GLOBCLK_DCLK_PS_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param div Prescaler factor. Use type @ref XMC_BCCU_BCLK_MODE_t. \n + * \b Range: XMC_BCCU_BCLK_MODE_NORMAL or XMC_BCCU_BCLK_MODE_FAST. \n + * @return None + * + * \parDescription:
+ * Configures modulator output (bit-time) clock prescaler factor of a BCCU module by writing register bit GLOBCLK_BCS.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetFastClockPrescaler(), XMC_BCCU_SetDimClockPrescaler(), XMC_BCCU_ReadBitClock()\n\n\n + */ +void XMC_BCCU_SelectBitClock (XMC_BCCU_t *const bccu, XMC_BCCU_BCLK_MODE_t div); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Prescaler factor. \b Range: 0 or 1 \n + * 0 - XMC_BCCU_BCLK_MODE_NORMAL \n + * 1 - XMC_BCCU_BCLK_MODE_FAST \n + * \parDescription:
+ * Retrieves modulator output (bit-time) clock prescaler factor of a BCCU module by reading the register bit GLOBCLK_BCS. + * Use XMC_BCCU_BCLK_MODE_t type to validate a returned value.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SelectBitClock(), XMC_BCCU_ReadDimClock(), XMC_BCCU_ReadFastClock()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadBitClock (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(((bccu->GLOBCLK) & BCCU_GLOBCLK_BCS_Msk) >> BCCU_GLOBCLK_BCS_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Channel mask to enable multiple channels.\n + * For example: If channel 0, channel 7, channel 1 wants to enable at a same time, \n + * then channel mask is 01000 0011 = 0x83\n + * ------------------------------------------------------------------------------------------------------\n + * | Chan8 | Chan7 | Chan6 | Chan5 | Chan4 | Chan3 | Chan2 | Chan1 | Chan0 |\n + * ------------------------------------------------------------------------------------------------------\n + * + * @return None + * + * \parDescription:
+ * Enables multiple channels at a same time using \a mask by writing a register CHEN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableChannel(), XMC_BCCU_ConcurrentDisableChannels()\n\n\n + */ +void XMC_BCCU_ConcurrentEnableChannels (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Channel mask to disable multiple channels.\n + * For example: If channel 0, channel 7, channel 1 wants to disable at a same time, \n + * then channel mask is 01000 0011 = 0x83\n + * ------------------------------------------------------------------------------------------------------\n + * | Chan8 | Chan7 | Chan6 | Chan5 | Chan4 | Chan3 | Chan2 | Chan1 | Chan0 |\n + * ------------------------------------------------------------------------------------------------------\n + * + * @return None + * + * \parDescription:
+ * Disables multiple channels at a same time using \a mask by writing a register CHEN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConcurrentEnableChannels(), XMC_BCCU_DisableChannel()\n\n\n + */ +void XMC_BCCU_ConcurrentDisableChannels (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_mask Channel mask to enable multiple channels.\n + * For example: If channel 0, channel 7, channel 1 wants to enable at a same time, \n + * then channel mask is 01000 0011 = 0x83\n + * ------------------------------------------------------------------------------------------------------\n + * | Chan8 | Chan7 | Chan6 | Chan5 | Chan4 | Chan3 | Chan2 | Chan1 | Chan0 |\n + * ------------------------------------------------------------------------------------------------------\n + * @param level Passive level selection. Use type @ref XMC_BCCU_CH_ACTIVE_LEVEL_t.\n + * \b Range: XMC_BCCU_CH_ACTIVE_LEVEL_HIGH or XMC_BCCU_CH_ACTIVE_LEVEL_LOW + * + * @return None + * + * \parDescription:
+ * Configures passive levels of multiple channels at a same time using \a mask by writing a register bit CHOCON_CHyOP.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetOutputPassiveLevel()\n\n\n + */ +void XMC_BCCU_ConcurrentSetOutputPassiveLevel(XMC_BCCU_t *const bccu, uint32_t chan_mask, XMC_BCCU_CH_ACTIVE_LEVEL_t level); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Channel mask to enable multiple channels trap functionality.\n + * For example: If channel 0, channel 7, channel 1 wants to enable a trap functionality at a same time, \n + * then channel mask is 01000 0011 = 0x83\n + * ------------------------------------------------------------------------------------------------------\n + * | Chan8 | Chan7 | Chan6 | Chan5 | Chan4 | Chan3 | Chan2 | Chan1 | Chan0 |\n + * ------------------------------------------------------------------------------------------------------\n + * + * @return None + * + * \parDescription:
+ * Enables multiple channels trap functionality at the same time using \a mask by writing a register bit CHOCON_CHyTPE.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableTrap(), XMC_BCCU_ConcurrentDisableTrap(), XMC_BCCU_SelectTrapInput(), XMC_BCCU_SetTrapEdge()\n\n\n + */ +void XMC_BCCU_ConcurrentEnableTrap (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Channel mask to disable multiple channels trap functionality. + * For example: If channel 0, channel 7, channel 1 wants to disable a trap functionality at a same time, \n + * then channel mask is 01000 0011 = 0x83\n + * ------------------------------------------------------------------------------------------------------\n + * | Chan8 | Chan7 | Chan6 | Chan5 | Chan4 | Chan3 | Chan2 | Chan1 | Chan0 |\n + * ------------------------------------------------------------------------------------------------------\n + * + * @return None + * + * \parDescription:
+ * Disables multiple channels trap functionality at the same time using \a mask by writing a register bit CHOCON_CHyTPE.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DisableTrap(), XMC_BCCU_ConcurrentEnableTrap()\n\n\n + */ +void XMC_BCCU_ConcurrentDisableTrap (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param trig Pointer to a trigger configuration data structure. Use type @ref XMC_BCCU_TRIG_CONFIG_t. + * + * @return None + * + * \parDescription:
+ * Configures global trigger settings: trigger mode, trigger delay, individual trigger lines and channel mask by writing a \n + * registers GLOBCON and CHTRIG. Trigger mode decides when to generate a BCCU trigger, trigger delay postpones the channel \n + * trigger by 1/4, or 1/2 bclk cycles\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConfigGlobalTrigger(), XMC_BCCU_ReadLastTrigChanNr(), XMC_BCCU_ReadGlobalTrigger(), XMC_BCCU_GlobalInit()\n\n\n + */ +void XMC_BCCU_ConcurrentConfigTrigger (XMC_BCCU_t *const bccu, XMC_BCCU_TRIG_CONFIG_t *trig); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Channel mask to start a linear walk for multiple channels at a same time.\n + * For example: If channel 0, channel 7, channel 1 wants to start a linear walk at a same time, \n + * then channel mask is 01000 0011 = 0x83\n + * ------------------------------------------------------------------------------------------------------\n + * | Chan8 | Chan7 | Chan6 | Chan5 | Chan4 | Chan3 | Chan2 | Chan1 | Chan0 |\n + * ------------------------------------------------------------------------------------------------------\n + * + * @return None + * + * \parDescription:
+ * After channel initialization, the outcome of executing the API starts changing the color smoothly towards to target \n + * for multiple channels at a same time using \a mask by writing a register CHSTRCON.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_StartLinearWalk(), XMC_BCCU_ConcurrentAbortLinearWalk()\n\n\n + */ +void XMC_BCCU_ConcurrentStartLinearWalk (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Channel mask to stop a linear walk for multiple channels at a same time.\n + * For example: If channel 0, channel 7, channel 1 wants to abort a linear walk at a same time, \n + * then channel mask is 01000 0011 = 0x83\n + * ------------------------------------------------------------------------------------------------------\n + * | Chan8 | Chan7 | Chan6 | Chan5 | Chan4 | Chan3 | Chan2 | Chan1 | Chan0 |\n + * ------------------------------------------------------------------------------------------------------\n + * + * @return None + * + * \parDescription:
+ * When the linear walk in progress, the outcome of executing the API is stopping the linear walk (i.e. color change) + * immediately for multiple channels at a same time using \a mask by writing a register CHSTRCON.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_AbortLinearWalk(), XMC_BCCU_ConcurrentStartLinearWalk()\n\n\n + */ +void XMC_BCCU_ConcurrentAbortLinearWalk (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Dimming engine mask to enable multiple dimming engine at a same time.\n + * For example: If dimming engine 0, channel 2 wants to enable a dimming at a same time, + * then dimming engine mask is 0101 = 0x03\n + * --------------------------\n + * | DE2 | DE1 | DE0 |\n + * --------------------------\n + * + * @return None + * + * \parDescription:
+ * Enables multiple dimming engines at a same time using \a mask by writing a register DEEN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableDimmingEngine(), XMC_BCCU_ConcurrentDisableDimmingEngine()\n\n\n + */ +void XMC_BCCU_ConcurrentEnableDimmingEngine (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Dimming engine mask to disable multiple dimming engine at a same time.\n + * For example: If dimming engine 0, channel 2 wants to disable a dimming at a same time, + * then dimming engine mask is 0101 = 0x03\n + * --------------------------\n + * | DE2 | DE1 | DE0 |\n + * --------------------------\n + * + * @return None + * + * \parDescription:
+ * Disables multiple dimming engines at a same time using \a mask by writing a register DEEN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DisableDimmingEngine(), XMC_BCCU_ConcurrentEnableDimmingEngine()\n\n\n + */ +void XMC_BCCU_ConcurrentDisableDimmingEngine (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Dimming engine mask to start a dimming for multiple dimming engines at a same time.\n + * For example: If dimming engine 0, channel 2 wants to start a dimming at a same time, + * then dimming engine mask is 0101 = 0x03\n + * --------------------------\n + * | DE2 | DE1 | DE0 |\n + * --------------------------\n + * + * @return None + * + * \parDescription:
+ * After dimming engine initialization, the outcome of executing the API starts changing the brightness towards to target + * for multiple dimming engines at a same time using \a mask by writing a register DESTRCON.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_StartDimming(), XMC_BCCU_ConcurrentAbortDimming()\n\n\n + */ +void XMC_BCCU_ConcurrentStartDimming (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Dimming engine mask to abort a dimming for multiple dimming engines at a same time.\n + * For example: If dimming engine 0, channel 2 wants to abort a dimming at a same time, + * then dimming engine mask is 0101 = 0x03\n + * --------------------------\n + * | DE2 | DE1 | DE0 |\n + * --------------------------\n + * + * @return None + * + * \parDescription:
+ * When the dimming in progress, the outcome of executing the API is stopping the dimming (i.e. fading) + * immediately for specific dimming engine number \a dim_no by writing a register DESTRCON.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_AbortDimming(), XMC_BCCU_ConcurrentStartDimming()\n\n\n + */ +void XMC_BCCU_ConcurrentAbortDimming (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param level Dimming level of global dimming engine. \b Range: 0 to 4095\n + * + * @return None + * + * \parDescription:
+ * Configures a global dimming level by writing a register GLOBDIM. This is useful only if global dimming engine selected. + * Otherwise the configuration is ignored. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_SetTargetDimmingLevel()\n\n\n + */ +void XMC_BCCU_SetGlobalDimmingLevel (XMC_BCCU_t *const bccu, uint32_t level); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param event Event mask to enable multiple events at a time using ORed values of @ref XMC_BCCU_EVENT_t.\n + * For example: If XMC_BCCU_EVENT_TRIGGER0, XMC_BCCU_EVENT_TRIGGER1, XMC_BCCU_EVENT_FIFOEMPTY wants to enable + * at a same time,\n then event mask is = (XMC_BCCU_EVENT_TRIGGER0 | XMC_BCCU_EVENT_TRIGGER1 | + * XMC_BCCU_EVENT_FIFOEMPTY) \n + * + * @return None + * + * \parDescription:
+ * Enables multiple interrupt events at a same time using ORed values of @ref XMC_BCCU_EVENT_t by writing a register EVIER.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DisableInterrupt()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_EnableInterrupt (XMC_BCCU_t *const bccu, uint32_t event) +{ + bccu->EVIER |= event; +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param event Event mask to disable multiple events at a time using ORed values of @ref XMC_BCCU_EVENT_t.\n + * For example: If XMC_BCCU_EVENT_TRIGGER0, XMC_BCCU_EVENT_TRIGGER1, XMC_BCCU_EVENT_FIFOEMPTY wants to disable\n + * at a same time, then event mask is = (XMC_BCCU_EVENT_TRIGGER0 | XMC_BCCU_EVENT_TRIGGER1 | + * XMC_BCCU_EVENT_FIFOEMPTY) \n + * + * @return None + * + * \parDescription:
+ * Disables multiple interrupt events at a same time using ORed values of @ref XMC_BCCU_EVENT_t by writing a register EVIER.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableInterrupt()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_DisableInterrupt (XMC_BCCU_t *const bccu, uint32_t event) +{ + bccu->EVIER &= (uint32_t)~(event); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Interrupt events flags at a same time using ORed values of @ref XMC_BCCU_EVENT_t. + * \parDescription:
+ * Retrieves interrupt event flags at the same time using ORed values of @ref XMC_BCCU_EVENT_t by reading the register \n + * EVFR. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetEventFlag()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadEventFlag (XMC_BCCU_t *const bccu) +{ + return (bccu->EVFR); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param flag_type Event flag mask to configure multiple events at a time using ORed values of @ref + * XMC_BCCU_EVENT_STATUS_t.\n + * For example: If XMC_BCCU_EVENT_STATUS_TRIGGER0, XMC_BCCU_EVENT_STATUS_TRIGGER1, XMC_BCCU_EVENT_STATUS_FIFOEMPTY + * wants to configure at a same time, then event mask is = (XMC_BCCU_EVENT_STATUS_TRIGGER0 | XMC_BCCU_EVENT_STATUS_TRIGGER1 | + * XMC_BCCU_EVENT_STATUS_FIFOEMPTY) \n + * + * @return None + * + * \parDescription:
+ * Configures multiple interrupt event flags at a same time using ORed values of @ref XMC_BCCU_EVENT_STATUS_t by writing a register EVFSR.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ClearEventFlag(), XMC_BCCU_ReadEventFlag()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_SetEventFlag (XMC_BCCU_t *const bccu, uint32_t flag_type) +{ + bccu->EVFSR = flag_type; +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param flag_type event flag mask to clear multiple events at a time using ORed values of @ref + * XMC_BCCU_EVENT_STATUS_t.\n + * For example: If XMC_BCCU_EVENT_STATUS_TRIGGER0, XMC_BCCU_EVENT_STATUS_TRIGGER1, XMC_BCCU_EVENT_STATUS_FIFOEMPTY + * wants to clear at a same time, then event mask is = (XMC_BCCU_EVENT_STATUS_TRIGGER0 | XMC_BCCU_EVENT_STATUS_TRIGGER1 | + * XMC_BCCU_EVENT_STATUS_FIFOEMPTY) \n + * + * @return None + * + * \parDescription:
+ * Clears multiple interrupt event flags at a same time using ORed values of @ref XMC_BCCU_EVENT_STATUS_t by writing a + * register EVFSR.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetEventFlag()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_ClearEventFlag (XMC_BCCU_t *const bccu, uint32_t flag_type) +{ + bccu->EVFCR = flag_type; +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Specific channel number to enable. \b Range: 0 to 8\n + * + * @return None + * + * \parDescription:
+ * Enables a specific channel number using \a chan_no by writing a register CHEN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConcurrentEnableChannels(), XMC_BCCU_DisableChannel()\n\n\n + */ +void XMC_BCCU_EnableChannel (XMC_BCCU_t *const bccu, uint32_t chan_no); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Specific channel number to disable. \b Range: 0 to 8\n + * + * @return None + * + * \parDescription:
+ * Disables a specific channel number using \a chan_no by writing a register CHEN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConcurrentDisableChannels(), XMC_BCCU_EnableChannel()\n\n\n + */ +void XMC_BCCU_DisableChannel (XMC_BCCU_t *const bccu, uint32_t chan_no); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Specific channel number to enable specific channel. \b Range: 0 to 8\n + * @param level Passive level selection. Use type @ref XMC_BCCU_CH_ACTIVE_LEVEL_t.\n + * \b Range: XMC_BCCU_CH_ACTIVE_LEVEL_HIGH or XMC_BCCU_CH_ACTIVE_LEVEL_LOW + * + * @return None + * + * \parDescription:
+ * Configures passive level of specific channel using \a chan_no by writing a register bit CHOCON_CHyOP.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConcurrentSetOutputPassiveLevel()\n\n\n + */ +void XMC_BCCU_SetOutputPassiveLevel(XMC_BCCU_t *const bccu, uint32_t chan_no, XMC_BCCU_CH_ACTIVE_LEVEL_t level); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Channel number to enable specific channel trap functionality. \b Range: 0 to 8 + * + * @return None + * + * \parDescription:
+ * Enables specific channel trap functionality using \a chan_no by writing a register bit CHOCON_CHyTPE.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DisableTrap(), XMC_BCCU_ConcurrentEnableTrap(), XMC_BCCU_SelectTrapInput(), XMC_BCCU_SetTrapEdge()\n\n\n + */ +void XMC_BCCU_EnableTrap (XMC_BCCU_t *const bccu, uint32_t chan_no); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Channel number to disable specific channel trap functionality. \b Range: 0 to 8 + * + * @return None + * + * \parDescription:
+ * Disables specific channel trap functionality using \a chan_no by writing a register bit CHOCON_CHyTPE.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableTrap(), XMC_BCCU_ConcurrentDisableTrap()\n\n\n + */ +void XMC_BCCU_DisableTrap (XMC_BCCU_t *const bccu, uint32_t chan_no); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Channel number to trigger a specific channel. \b Range: 0 to 8 + * @param trig_line Trigger line number to trigger a vadc. Use type @ref XMC_BCCU_CH_TRIGOUT_t.\n + * \b Range: XMC_BCCU_CH_TRIGOUT0 or XMC_BCCU_CH_TRIGOUT1 + * + * @return None + * + * \parDescription:
+ * Enables specific channel trigger using \a chan_no by writing a register bit CHOCON_CHyTPE.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConfigGlobalTrigger(), XMC_BCCU_DisableChannelTrigger(), XMC_BCCU_CH_ConfigTrigger()\n\n\n + */ +void XMC_BCCU_EnableChannelTrigger (XMC_BCCU_t *const bccu, uint32_t chan_no, XMC_BCCU_CH_TRIGOUT_t trig_line); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Channel number to trigger a specific channel. \b Range: 0 to 8 + * + * @return None + * + * \parDescription:
+ * Disables specific channel trigger using \a chan_no by writing a register bit CHOCON_CHyTPE.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableChannelTrigger()\n\n\n + */ +void XMC_BCCU_DisableChannelTrigger (XMC_BCCU_t *const bccu, uint32_t chan_no); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param config Pointer to constant bccu channel configuration data structure. Use type @ref XMC_BCCU_CH_CONFIG_t. + * + * @return None + * + * \parDescription:
+ * Configures dimming engine source, dimming bypass selection, channel trigger edge, flicker watchdog selection and force + * trigger selection by using \a dim_sel, \a dim_bypass, \a trig_edge, \a flick_wd_en, \a force_trig_en by writing into a + * CHCONFIG register. And also configures packer settings: threshold, off and on compare levels, initial values of off & on + * counters, by writing into a CHCONFIG, PKCMP and PKCNTR registers.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_GlobalInit(), XMC_BCCU_DIM_Init()\n\n\n + */ +void XMC_BCCU_CH_Init (XMC_BCCU_CH_t *const channel, const XMC_BCCU_CH_CONFIG_t *const config); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param edge Output transition selection. Use type @ref XMC_BCCU_CH_TRIG_EDGE_t. \n + * \b Range: XMC_BCCU_CH_TRIG_EDGE_PASS_TO_ACT or XMC_BCCU_CH_TRIG_EDGE_ACT_TO_PASS\n + * @param force_trig_en Forcing a trigger at output. \b Range: 0 or 1\n + * Generates a trigger if modulator output do not change for 256 bclk cycles\n + * + * @return None + * + * \parDescription:
+ * Configures global trigger settings: trigger edge, force trigger enable by writing a register CHCONFIG. + * And also configures force trigger enable, generates a trigger if modulator output do not change for 256 bclk cycles + * + * \parRelated APIs:
+ * XMC_BCCU_ConfigGlobalTrigger(), XMC_BCCU_EnableChannelTrigger()\n\n\n + */ +void XMC_BCCU_CH_ConfigTrigger (XMC_BCCU_CH_t *const channel, XMC_BCCU_CH_TRIG_EDGE_t edge, uint32_t force_trig_en); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Specific channel number to start color change \b Range: 0 to 8\n + * + * @return None + * + * \parDescription:
+ * After channel initialization, the outcome of executing the API starts changing the color smoothly towards to target + * by writing a register bit CHSTRCON_CHyS.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_AbortLinearWalk(), XMC_BCCU_CH_SetTargetIntensity(), XMC_BCCU_IsLinearWalkComplete(), + * XMC_BCCU_ConcurrentStartLinearWalk()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_StartLinearWalk (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + bccu->CHSTRCON |= (uint32_t)(BCCU_CHSTRCON_CH0S_Msk << chan_no); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Specific channel number to stop color change \b Range: 0 to 8\n + * + * @return None + * + * \parDescription:
+ * When the linear walk in progress, the outcome of executing the API is stopping the linear walk (i.e. color change) + * immediately for specific channels number using \a mask by writing a register CHSTRCON_CHyA.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_StartLinearWalk(), XMC_BCCU_ConcurrentAbortLinearWalk()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_AbortLinearWalk (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + bccu->CHSTRCON |= (uint32_t)(BCCU_CHSTRCON_CH0A_Msk << chan_no); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Specific channel number to get an output level on last trigger. \b Range: 0 to 8\n + * + * @return Trap channel output level. \b Range: 0 or 1 + * \parDescription:
+ * Retrieves output level of specific channel number when last trigger occurred by reading the register bit LTCHOL_LTOLy. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ReadLastTrigChanNr(), XMC_BCCU_ConfigGlobalTrigger(), XMC_BCCU_ConcurrentConfigTrigger(), + * XMC_BCCU_ReadGlobalTrigger(), XMC_BCCU_GlobalInit()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_GetChannelOutputLvlAtLastTrigger (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + return (uint32_t)((bccu->LTCHOL & (BCCU_LTCHOL_LTOL0_Msk << chan_no)) >> chan_no); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param clk_div Prescaler factor. \b Range: 0 to 1023 + * + * @return None + * + * \parDescription:
+ * configure the linear walker clock prescaler factor by writing register bit CHCONFIG_LINPRES.\n\n + * + */ +void XMC_BCCU_CH_SetLinearWalkPrescaler (XMC_BCCU_CH_t *const channel, uint32_t clk_div); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Channel number to know the linear walk completion status. \b Range: 0 to 8\n + * + * @return Linear walk completion status. \b Range: 0-Completed or 1-intensity start changing towards the target + * \parDescription:
+ * Retrieves linear walk completion status for specific channel using \a chan_no by reading the register bit CHSTRCON_CHyS. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetTargetIntensity(), XMC_BCCU_StartLinearWalk()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_IsLinearWalkComplete (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + return (uint32_t)((bccu->CHSTRCON & (BCCU_CHSTRCON_CH0S_Msk << chan_no)) >> chan_no); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param ch_int Target channel intensity. \b Range: 0 to 4095 + * + * @return None + * + * \parDescription:
+ * Configures target channel intensity by writing register INTS, only be written if no shadow transfer of linear walk. + * Use XMC_BCCU_IsLinearWalkComplete() to know shadow transfer finished \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_IsLinearWalkComplete(), XMC_BCCU_StartLinearWalk(), XMC_BCCU_CH_ReadIntensity()\n\n\n + */ +void XMC_BCCU_CH_SetTargetIntensity (XMC_BCCU_CH_t *const channel, uint32_t ch_int); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return Current channel intensity. \b Range: 0 or 4095 + * \parDescription:
+ * Retrieves current channel intensity by reading the register INT.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetTargetIntensity()\n\n\n + */ +uint32_t XMC_BCCU_CH_ReadIntensity (XMC_BCCU_CH_t *const channel); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param thresh Packer threshold value of FIFO. It defines number of queue stages must be filled before output generator + * starts generating the pulses. Until that, only off-bits are generated at the output.\n + * @param off_comp Packer off-time compare level. When the off-time counter reaches this, the measured on off time + * counters are stored into FIFO + * @param on_comp Packer on-time compare level. When the on-time counter reaches this, the measured on & off time + * counters are stored into FIFO + * + * @return None + * + * \parDescription:
+ * Enables packer by writing register bit CHCONFIG_PEN. And also configures packer threshold, off and on compare levels + * by writing register PKCMP. The main purpose of the packer is to decrease the average rate of switching of the output + * signal, to decrease the load on external switching circuits and improve EMC behavior\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_DisablePacker(), XMC_BCCU_CH_SetPackerThreshold(), XMC_BCCU_CH_SetPackerOffCompare(), XMC_BCCU_CH_SetPackerOnCompare\n\n\n + */ +void XMC_BCCU_CH_EnablePacker (XMC_BCCU_CH_t *const channel, uint32_t thresh, uint32_t off_comp, uint32_t on_comp); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param val Packer threshold value of FIFO + * + * @return None + * + * \parDescription:
+ * Configures packer threshold by writing register bit CHCONFIG_PKTH\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerOffCompare(), XMC_BCCU_CH_SetPackerOnCompare, XMC_BCCU_CH_ReadPackerThreshold()\n\n\n + */ +void XMC_BCCU_CH_SetPackerThreshold (XMC_BCCU_CH_t *const channel, uint32_t val); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param level Packer off-time compare level. When the off-time counter reaches this, the measured on & off time counters + * are stored into FIFO + * + * @return None + * + * \parDescription:
+ * Configures packer off compare level by writing register bit PKCMP_OFFCMP\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerThreshold(), XMC_BCCU_CH_SetPackerOnCompare(), XMC_BCCU_CH_SetPackerOffCounter(), + * XMC_BCCU_CH_ReadPackerOffCompare()\n\n\n + */ +void XMC_BCCU_CH_SetPackerOffCompare (XMC_BCCU_CH_t *const channel, uint32_t level); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param level Packer on-time compare level. When the on-time counter reaches this, the measured on & off time counters + * are stored into FIFO + * + * @return None + * + * \parDescription:
+ * Configures packer on compare level by writing register bit PKCMP_ONCMP\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerThreshold(), XMC_BCCU_CH_SetPackerOffCompare(), XMC_BCCU_CH_SetPackerOnCounter(), + * XMC_BCCU_CH_ReadPackerOnCompare()\n\n\n + */ +void XMC_BCCU_CH_SetPackerOnCompare (XMC_BCCU_CH_t *const channel, uint32_t level); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return Packer threshold value of FIFO + * \parDescription:
+ * Retrieves packer threshold value by reading the register bit CHCONFIG_PKTH.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerThreshold()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_CH_ReadPackerThreshold (XMC_BCCU_CH_t *const channel) +{ + return (uint32_t)((channel->CHCONFIG) & BCCU_CH_CHCONFIG_PKTH_Msk); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return Packer off-time compare level. When the off-time counter reaches this, the measured on & off time counters + * are stored into FIFO + * \parDescription:
+ * Retrieves packer off compare level by reading the register bit PKCMP_OFFCMP.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerOffCompare()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_CH_ReadPackerOffCompare (XMC_BCCU_CH_t *const channel) +{ + return (uint32_t)((channel->PKCMP) & BCCU_CH_PKCMP_OFFCMP_Msk); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return Packer on-time compare level. When the on-time counter reaches this,
+ * the measured on & off time counters are stored into FIFO + * \parDescription:
+ * Retrieves packer on compare level by reading the register bit PKCMP_ONCMP.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerOnCompare()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_CH_ReadPackerOnCompare (XMC_BCCU_CH_t *const channel) +{ + return (uint32_t)(((channel->PKCMP) & BCCU_CH_PKCMP_ONCMP_Msk) >> BCCU_CH_PKCMP_ONCMP_Pos); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return None + * + * \parDescription:
+ * Disables packer by clearing writing register bit CHCONFIG_PEN. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_EnablePacker()\n\n\n + */ +void XMC_BCCU_CH_DisablePacker (XMC_BCCU_CH_t *const channel); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param cnt_val Configures an initial packer off-time counter level, only if channel is disabled. Controls phase + * shift of the modulator output + * + * @return None + * + * \parDescription:
+ * Configures packer initial off counter value by writing register bit PKCNTR_OFFCNTVAL\n + * Note: Shall only be called if channel disabled.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerOnCounter(), XMC_BCCU_CH_SetPackerOffCompare()\n\n\n + */ +void XMC_BCCU_CH_SetPackerOffCounter (XMC_BCCU_CH_t *const channel, uint32_t cnt_val); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param cnt_val Configures an initial packer on-time counter level, only if channel is disabled. Controls phase shift + * of the modulator output + * + * @return None + * + * \parDescription:
+ * Configures packer initial on counter value by writing register bit PKCNTR_ONCNTVAL\n + * Note: Shall only be called if channel disabled.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerOffCounter(), XMC_BCCU_CH_SetPackerOnCompare()\n\n\n + */ +void XMC_BCCU_CH_SetPackerOnCounter (XMC_BCCU_CH_t *const channel, uint32_t cnt_val); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param sel Selects a dimming engine source of the channel. Use type @ref XMC_BCCU_CH_DIMMING_SOURCE_t + * + * @return None + * + * \parDescription:
+ * Configures dimming engine source by writing register bit CHCONFIG_DSEL\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_EnableDimmingBypass()\n\n\n + */ +void XMC_BCCU_CH_SelectDimEngine (XMC_BCCU_CH_t *const channel, XMC_BCCU_CH_DIMMING_SOURCE_t sel); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return None + * + * \parDescription:
+ * Enables dimming engine bypass by writing register bit CHCONFIG_DBP. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SelectDimEngine(), XMC_BCCU_CH_DisableDimmingBypass()\n\n\n + */ +void XMC_BCCU_CH_EnableDimmingBypass (XMC_BCCU_CH_t *const channel); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return None + * + * \parDescription:
+ * Disables dimming engine bypass by clearing register bit CHCONFIG_DBP. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_EnableDimmingBypass()\n\n\n + */ +void XMC_BCCU_CH_DisableDimmingBypass (XMC_BCCU_CH_t *const channel); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return None + * + * \parDescription:
+ * Enables gating feature by writing register bit CHCONFIG_GEN. The gating feature is used to enable fast control schemes, + * such as peak-current control and this has been controlled by Analog Comparator module.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_DisableGating()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_CH_EnableGating (XMC_BCCU_CH_t *const channel) +{ + channel->CHCONFIG |= (uint32_t)(BCCU_CH_CHCONFIG_GEN_Msk); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return None + * + * \parDescription:
+ * Disables gating feature by writing register bit CHCONFIG_GEN. The gating feature is used to enable/disable fast control + * schemes, such as peak-current control and this has been controlled by Analog Comparator module. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_EnableGating()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_CH_DisableGating (XMC_BCCU_CH_t *const channel) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_GEN_Msk); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return None + * + * \parDescription:
+ * Enables flicker watchdog by writing register bit CHCONFIG_WEN. And limits the sigma-delta modulator output\n + * according to Watchdog threshold\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetFlickerWDThreshold(), XMC_BCCU_ReadFlickerWDThreshold(), XMC_BCCU_CH_Init(), + * XMC_BCCU_CH_DisableFlickerWatchdog()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_CH_EnableFlickerWatchdog (XMC_BCCU_CH_t *const channel) +{ + channel->CHCONFIG |= (uint32_t)(BCCU_CH_CHCONFIG_WEN_Msk); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return None + * + * \parDescription:
+ * Disables flicker watchdog by writing register bit CHCONFIG_WEN. No limits the sigma-delta modulator output + * according to Watchdog threshold\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetFlickerWDThreshold(), XMC_BCCU_ReadFlickerWDThreshold(), XMC_BCCU_CH_Init(), + * XMC_BCCU_CH_EnableFlickerWatchdog()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_CH_DisableFlickerWatchdog (XMC_BCCU_CH_t *const channel) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_WEN_Msk); +} + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * @param config Pointer to constant dimming engine configuration data structure. Use type @ref XMC_BCCU_DIM_CONFIG_t. + * + * @return None + * + * \parDescription:
+ * Configures dimming clock divider to adjust the fade rate, dither selection and exponential curve selection using \a + * dim_div, \a dither_en, \a cur_sel parameters and by writing into a DTT register.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_GlobalInit(), XMC_BCCU_CH_Init()\n\n\n + */ +void XMC_BCCU_DIM_Init (XMC_BCCU_DIM_t *const dim_engine, const XMC_BCCU_DIM_CONFIG_t *const config); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param dim_no Specific dimming engine number to enable. \b Range: 0 to 2\n + * + * @return None + * + * \parDescription:
+ * Enables a specific dimming engine number using \a dim_no by writing a register bit DEEN_EDEy.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DisableDimmingEngine(), XMC_BCCU_ConcurrentEnableDimmingEngine()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_EnableDimmingEngine (XMC_BCCU_t *const bccu, uint32_t dim_no) +{ + bccu->DEEN |= (uint32_t)(BCCU_DEEN_EDE0_Msk << dim_no); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param dim_no Specific dimming engine number to disable. \b Range: 0 to 2\n + * + * @return None + * + * \parDescription:
+ * Disables a specific dimming engine number using \a dim_no by clearing a register bit DEEN_EDEy.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableDimmingEngine(), XMC_BCCU_ConcurrentDisableDimmingEngine()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_DisableDimmingEngine (XMC_BCCU_t *const bccu, uint32_t dim_no) +{ + bccu->DEEN &= ~(uint32_t)(BCCU_DEEN_EDE0_Msk << dim_no); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param dim_no Specific dimming engine number to start dimming process \b Range: 0 to 2\n + * + * @return None + * + * \parDescription:
+ * After dimming engine initialization, the outcome of executing the API starts changing the brightness towards to target + * by writing a register bit DESTRCON_DEyS.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_AbortDimming(), XMC_BCCU_ConcurrentStartDimming()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_StartDimming (XMC_BCCU_t *const bccu, uint32_t dim_no) +{ + bccu->DESTRCON = (uint32_t)(BCCU_DESTRCON_DE0S_Msk << dim_no); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param dim_no Specific dimming engine number to stop dimming process \b Range: 0 to 2\n + * + * @return None + * + * \parDescription:
+ * When the dimming in progress, the outcome of executing the API is stopping the dimming (i.e. fading) + * immediately for specific dimming engine number \a dim_no by writing a register bit DESTRCON_DEyA.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_StartDimming(), XMC_BCCU_ConcurrentAbortDimming()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_AbortDimming (XMC_BCCU_t *const bccu, uint32_t dim_no) +{ + bccu->DESTRCON = (uint32_t)(BCCU_DESTRCON_DE0A_Msk << dim_no); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param dim_no Specific dimming engine number to know the dimming status. \b Range: 0 to 2\n + * + * @return Dimming completion status. \b Range: 0-Completed or 1-start change towards the target + * \parDescription:
+ * Retrieves dimming completion status for specific dimming engine number using \a dim_no by reading the register bit + * DESTRCON_DEyS. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_SetTargetDimmingLevel(), XMC_BCCU_StartDimming()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_IsDimmingFinished (XMC_BCCU_t *const bccu, uint32_t dim_no) +{ + return (uint32_t)((bccu->DESTRCON & (BCCU_DESTRCON_DE0S_Msk << dim_no)) >> dim_no); +} + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * @param level Target dimming level. \b Range: 0 to 4095 + * + * @return None + * + * \parDescription:
+ * Configures target dimming level by writing register DLS, only be written if no shadow transfer of dimming. + * Use XMC_BCCU_IsDimmingFinished() to know shadow transfer finished \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_StartDimming(), XMC_BCCU_IsDimmingFinished(), XMC_BCCU_SetGlobalDimmingLevel(), \n + * XMC_BCCU_DIM_ReadDimmingLevel()\n\n\n + */ +void XMC_BCCU_DIM_SetTargetDimmingLevel (XMC_BCCU_DIM_t *const dim_engine, uint32_t level); + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * + * @return Current dimming level. \b Range: 0 or 4095 + * \parDescription:
+ * Retrieves current dimming level by reading the register DE_DL_DLEV.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_SetTargetDimmingLevel()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_DIM_ReadDimmingLevel (XMC_BCCU_DIM_t *const dim_engine) +{ + return (uint32_t)(dim_engine->DL & BCCU_DE_DL_DLEV_Msk); +} + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * @param div Dimming clock divider, used to adjust the fade rate. If 0, the dimming level + as same as target dimming level on shadow transfer\n + * + * @return None + * + * \parDescription:
+ * Configures dimming clock divider by writing register bit DE_DTT_DIMDIV.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetDimClockPrescaler(), XMC_BCCU_DIM_ReadDimDivider()\n\n\n + */ +void XMC_BCCU_DIM_SetDimDivider (XMC_BCCU_DIM_t *const dim_engine, uint32_t div); + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * + * @return Dimming clock divider value. \b Range: 0 to 1023 + * \parDescription:
+ * Retrieves dimming clock divider value by reading the register BCCU_DE_DTT_DIMDIV.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_SetDimDivider()\n\n\n + */ + __STATIC_INLINE uint32_t XMC_BCCU_DIM_ReadDimDivider(XMC_BCCU_DIM_t *const dim_engine) +{ + return (uint32_t)(dim_engine->DTT & BCCU_DE_DTT_DIMDIV_Msk); +} + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * @param dither_en Dither enable. Dithering added for every dimming step if dimming level < 128.
+ * @param sel Type of exponential curve. Use type @ref XMC_BCCU_DIM_CURVE_t. Note: If dither + enabled, the configuration is being ignored\n + * + * @return None + * + * \parDescription:
+ * Configures dimming clock curve by writing register bit DE_DTT_CSEL.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_Init()\n\n\n + */ +void XMC_BCCU_DIM_ConfigDimCurve (XMC_BCCU_DIM_t *const dim_engine, uint32_t dither_en, XMC_BCCU_DIM_CURVE_t sel); + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * + * @return Type of exponential curve \b Range: XMC_BCCU_DIM_CURVE_COARSE or XMC_BCCU_DIM_CURVE_FINE + * \parDescription:
+ * Retrieves exponential curve type by reading the register bit BCCU_DE_DTT_CSEL. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_ConfigDimCurve(), XMC_BCCU_IsDitherEnable()\n\n\n + */ +__STATIC_INLINE XMC_BCCU_DIM_CURVE_t XMC_BCCU_DIM_GetDimCurve (XMC_BCCU_DIM_t *const dim_engine) +{ + return (XMC_BCCU_DIM_CURVE_t)((dim_engine->DTT & BCCU_DE_DTT_CSEL_Msk) >> BCCU_DE_DTT_CSEL_Pos); +} + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * + * @return Dither enable status. \b Range: 1-Enabled or 0-Disabled + * \parDescription:
+ * Retrieves dither enable status by reading the register bit BCCU_DE_DTT_DTEN. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_ConfigDimCurve(), XMC_BCCU_DIM_GetDimCurve()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_IsDitherEnable(XMC_BCCU_DIM_t *const dim_engine) +{ + return (uint32_t)((dim_engine->DTT & BCCU_DE_DTT_DTEN_Msk) >> BCCU_DE_DTT_DTEN_Pos); +} + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* BCCU0 */ + +#endif /* XMC_BCCU_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_can.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_can.h new file mode 100644 index 00000000..7e6048fd --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_can.h @@ -0,0 +1,2198 @@ +/** + * @file xmc_can.h + * @date 2016-06-07 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * - Documentation improved
+ * + * 2015-05-20: + * - New elements have added in XMC_CAN_MO_t data structure
+ * - XMC_CAN_MO_Config() signature has changed
+ * - XMC_CAN_STATUS_t enum structure has updated.
+ * + * 2015-06-20: + * - New APIs added: XMC_CAN_NODE_ClearStatus(),XMC_CAN_MO_ReceiveData(), XMC_CAN_GATEWAY_InitDesObject().
+ * - Removed version macros and declaration of GetDriverVersion API + * + * 2015-07-09: + * - New API added: XMC_CAN_NODE_Enable.
+ * + * 2015-09-01: + * - Removed fCANB clock support
+ * + * 2015-09-15: + * - Added "xmc_can_map.h" include
+ * + * 2016-06-07: + * - Added XMC_CAN_IsPanelControlReady() + * + * Details of use for node configuration related APIs
+ * Please use the XMC_CAN_NODE_SetInitBit() and XMC_CAN_NODE_EnableConfigurationChange() before calling node configuration + * related APIs. + * XMC_CAN_NODE_DisableConfigurationChange() and XMC_CAN_NODE_ResetInitBit() can be called for disable the configuration + * change and enable the node for communication afterwards. + * Do not use this when configuring the nominal bit time with XMC_CAN_NODE_NominalBitTimeConfigure(). In this case the + * Enable/Disable node configuration change is taken in account. + * + * Example Usage: + * @code + * //disabling the Node + * XMC_CAN_NODE_SetInitBit(CAN_NODE0) + * //allowing the configuration change + * XMC_CAN_NODE_EnableConfigurationChange(CAN_NODE0) + * //Node configuration + * XMC_CAN_NODE_FrameCounterConfigure(CAN_NODE0,&can_node_frame_counter); + * XMC_CAN_NODE_EnableLoopBack(CAN_NODE0) + * //disable configuration + * XMC_CAN_NODE_DisableConfigurationChange(CAN_NODE0) + * //Enabling node for communication + * XMC_CAN_NODE_ResetInitBit(CAN_NODE0) + * @endcode + * + * 2016-06-20: + * - Fixed bug in XMC_CAN_MO_Config()
+ * @endcond + * + */ + +#ifndef XMC_CAN_H +#define XMC_CAN_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include "xmc_common.h" + +#if defined(CAN) + +#include "xmc_scu.h" +#include "xmc_can_map.h" +#include + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup CAN + * @brief Controller Area Network Controller (CAN) driver for the XMC microcontroller family. + * + * CAN driver provides transfer of CAN frames in accordance with CAN specificetion V2.0 B (active). Each CAN node + * can receive and transmit standard frames with 11-bit identifiers as well as extended frames with 29-bit identifiers. + * All CAN nodes share a common set of message objects. Each message object can be individually allocated to one of the + * CAN nodes. + * Besides serving as a storage container for incoming and outgoing frames, message objects can be combined to build + * gateways between + * the CAN nodes or to setup a FIFO buffer. The CAN module provides Analyzer mode,Loop-back mode and bit timming for + * node analysis. + * + * The driver is divided into five sections: + * \par CAN Global features: + * -# Allows to configure module frequency using function XMC_CAN_Init(). + * -# Allows to configure Module interrupt using configuration structure XMC_CAN_NODE_INTERRUPT_TRIGGER_t and function + * XMC_CAN_EventTrigger(). + * + * \par CAN_NODE features: + * -# Allows to set baud rate by configuration structure XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t and Baudrate Configuration + * function XMC_CAN_NODE_NominalBitTimeConfigure(). + * -# Allows to configure loop-back mode using fuction XMC_CAN_NODE_EnableLoopBack(). + * -# Allows to configure CAN Node analyzer using function XMC_CAN_NODE_SetAnalyzerMode(). + * -# Allows CAN node events enable/ disable by enum structure XMC_CAN_NODE_EVENT_t and functions XMC_CAN_NODE_EnableEvent() + * and XMC_CAN_NODE_DisableEvent(). + * -# Provides bit timming analysis, configuration structure XMC_CAN_NODE_FRAME_COUNTER_t and function + * XMC_CAN_NODE_FrameCounterConfigure(). + * + * \par CAN_MO features: + * -# Allows message object initialization by configuration structure XMC_CAN_MO_t and function XMC_CAN_MO_Config(). + * -# Allows transfer of message objects using functions XMC_CAN_MO_Transmit() and XMC_CAN_MO_Receive(). + * -# Allows to configure Single Data Transfer and Single Transmit Trial using functions + * XMC_CAN_MO_EnableSingleTransmitTrial() and XMC_CAN_MO_EnableSingleTransmitTrial(). + * -# Allows to configure MO events using function XMC_CAN_MO_EnableEvent(). + * + * \par CAN_FIFO features: + * -# Allows message object FIFO structure by configuration structure XMC_CAN_FIFO_CONFIG_t and functions + * XMC_CAN_TXFIFO_ConfigMOBaseObject() , XMC_CAN_RXFIFO_ConfigMOBaseObject() and XMC_CAN_TXFIFO_Transmit(). + * + * \par CAN_GATEWAY features: + * -# Provides Gateway mode, configuration structure XMC_CAN_GATEWAY_CONFIG_t and function XMC_CAN_GATEWAY_InitSourceObject(). + * + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_CAN_MO_MOAR_STDID_Pos (18U) /**< Standard Identifier bitposition */ + +#define XMC_CAN_MO_MOAR_STDID_Msk ((0x000007FFUL) << XMC_CAN_MO_MOAR_STDID_Pos) /**< Standard Identifier bitMask */ + +#define CAN_NODE_NIPR_Msk (0x7UL) /**< Node event mask */ + +#define CAN_MO_MOIPR_Msk (0x7U) /**< Message Object event mask */ + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +/** + * Defines the status of CAN, to verify the CAN related API calls. Use type \a XMC_CAN_STATUS_t for this enum. +*/ +typedef enum XMC_CAN_STATUS +{ + XMC_CAN_STATUS_SUCCESS, /**< Driver accepted application request*/ + XMC_CAN_STATUS_ERROR, /**< Returned when unknown error occurred */ + XMC_CAN_STATUS_BUSY, /**< Driver is busy and can not handle request*/ + XMC_CAN_STATUS_MO_NOT_ACCEPTABLE, /**< Message object type not allowed*/ + XMC_CAN_STATUS_MO_DISABLED /**< Returned if Message object is disabled */ +} XMC_CAN_STATUS_t; + +/** +* Defines CAN module Panel Commands . Use type \a XMC_CAN_PANCMD_t for this enum. +*/ +typedef enum XMC_CAN_PANCMD +{ + XMC_CAN_PANCMD_INIT_LIST = 1U, /**< Command to initialize a list */ + XMC_CAN_PANCMD_STATIC_ALLOCATE = 2U, /**< Command to activate static allocation */ + XMC_CAN_PANCMD_DYNAMIC_ALLOCATE = 3U, /**< Command to activate dynamic allocation */ + + XMC_CAN_PANCMD_STATIC_INSERT_BEFORE = 4U, /**< Remove a message object from the list and insert it before a given object.*/ + XMC_CAN_PANCMD_DYNAMIC_INSERT_BEFORE = 5U, /**< Command to activate dynamic allocation */ + XMC_CAN_PANCMD_STATIC_INSERT_BEHIND = 6U, /**< Command to activate dynamic allocation */ + XMC_CAN_PANCMD_DYNAMIC_INSERT_BEHIND = 7U /**< Command to activate dynamic allocation */ +} XMC_CAN_PANCMD_t; + +/** +* Defines loop Back Mode, to enable/disable an in-system test of the MultiCAN module . +* Use type \a XMC_CAN_LOOKBACKMODE_t for this enum. +*/ +typedef enum XMC_CAN_LOOKBACKMODE +{ + XMC_CAN_LOOKBACKMODE_ENABLED, /**< Each CAN node can be connected to the internal CAN bus */ + XMC_CAN_LOOKBACKMODE_DISABLED /**< Each CAN node can be connected to the external CAN bus */ +} XMC_CAN_LOOKBACKMODE_t; + +/** + * Defines Message Object direction. Use type \a XMC_CAN_MO_TYPE_t for this enum. + */ +typedef enum XMC_CAN_MO_TYPE +{ + XMC_CAN_MO_TYPE_RECMSGOBJ, /**< Receive Message Object selected */ + XMC_CAN_MO_TYPE_TRANSMSGOBJ /**< Transmit Message Object selected */ +} XMC_CAN_MO_TYPE_t; + +/** + * Defines Data frame types. Use type \a XMC_CAN_FRAME_TYPE_t for this enum. + */ +typedef enum XMC_CAN_FRAME_TYPE +{ + XMC_CAN_FRAME_TYPE_STANDARD_11BITS, /**< Standard type identifier*/ + XMC_CAN_FRAME_TYPE_EXTENDED_29BITS /**< Extended type identifier*/ +} XMC_CAN_FRAME_TYPE_t; + + +/** + * Defines arbitration mode for transmit acceptance filtering. Use type \a XMC_CAN_ARBITRATION_MODE_t for this enum. + */ +typedef enum XMC_CAN_ARBITRATION_MODE +{ + XMC_CAN_ARBITRATION_MODE_ORDER_BASED_PRIO_1 = 1U, /**< Transmit acceptance based in the order(prio) */ + XMC_CAN_ARBITRATION_MODE_IDE_DIR_BASED_PRIO_2 = 2U, /**< Transmit acceptance filtering is based on the CAN identifier */ + XMC_CAN_ARBITRATION_MODE_ORDER_BASED_PRIO_3 = 3U /**< Transmit acceptance based in the order */ +} XMC_CAN_ARBITRATION_MODE_t; + +/** + * Defines the operation mode of the frame counter. Use type \a XMC_CAN_FRAME_COUNT_MODE_t for this enum. + */ +typedef enum XMC_CAN_FRAME_COUNT_MODE +{ + XMC_CAN_FRAME_COUNT_MODE = 0U, /**< Frame Count Mode */ + XMC_CAN_FRAME_COUNT_MODE_TIME_STAMP = 1U, /**< The frame counter is incremented with the beginning of a new bit time*/ + XMC_CAN_FRAME_COUNT_MODE_BIT_TIMING = 2U /**< Used for baud rate detection and analysis of the bit timing */ +} XMC_CAN_FRAME_COUNT_MODE_t; + +/** + * Defines the Divider Modes. Use type \a XMC_CAN_DM_t for this enum. + */ +typedef enum XMC_CAN_DM +{ + XMC_CAN_DM_NORMAL = 1U, /**< Normal divider mode */ + XMC_CAN_DM_FRACTIONAL = 2U, /**< Fractional divider mode */ + XMC_CAN_DM_OFF = 3U /**< Divider Mode in off-state*/ +} XMC_CAN_DM_t; + +/** + * Defines mask value for CAN Message Object set status. Use type \a XMC_CAN_MO_SET_STATUS_t for this enum. + */ +typedef enum XMC_CAN_MO_SET_STATUS +{ + XMC_CAN_MO_SET_STATUS_RX_PENDING = CAN_MO_MOCTR_SETRXPND_Msk, /**< Set receive pending */ + XMC_CAN_MO_SET_STATUS_TX_PENDING = CAN_MO_MOCTR_SETTXPND_Msk, /**< Set transmit pending */ + XMC_CAN_MO_SET_STATUS_RX_UPDATING = CAN_MO_MOCTR_SETRXUPD_Msk, /**< Set receive updating */ + XMC_CAN_MO_SET_STATUS_NEW_DATA = CAN_MO_MOCTR_SETNEWDAT_Msk, /**< Set new data */ + XMC_CAN_MO_SET_STATUS_MESSAGE_LOST = CAN_MO_MOCTR_SETMSGLST_Msk, /**< Set message lost */ + XMC_CAN_MO_SET_STATUS_MESSAGE_VALID = CAN_MO_MOCTR_SETMSGVAL_Msk, /**< Set message valid */ + XMC_CAN_MO_SET_STATUS_RX_TX_SELECTED = CAN_MO_MOCTR_SETRTSEL_Msk, /**< Set transmit/receive selected */ + XMC_CAN_MO_SET_STATUS_RX_ENABLE = CAN_MO_MOCTR_SETRXEN_Msk, /**< Set receive enable */ + XMC_CAN_MO_SET_STATUS_TX_REQUEST = CAN_MO_MOCTR_SETTXRQ_Msk, /**< Set transmit request */ + XMC_CAN_MO_SET_STATUS_TX_ENABLE0 = CAN_MO_MOCTR_SETTXEN0_Msk, /**< Set transmit enable 0 */ + XMC_CAN_MO_SET_STATUS_TX_ENABLE1 = CAN_MO_MOCTR_SETTXEN1_Msk, /**< Set transmit enable 1 */ + XMC_CAN_MO_SET_STATUS_MESSAGE_DIRECTION = CAN_MO_MOCTR_SETDIR_Msk /**< Set message direction */ +} XMC_CAN_MO_SET_STATUS_t; + +/** + * Defines mask value for CAN Message Object reset status. Use type \a XMC_CAN_MO_RESET_STATUS_t for this enum. + */ +typedef enum XMC_CAN_MO_RESET_STATUS +{ + XMC_CAN_MO_RESET_STATUS_RX_PENDING = CAN_MO_MOCTR_RESRXPND_Msk, /**< Reset receive pending */ + XMC_CAN_MO_RESET_STATUS_TX_PENDING = CAN_MO_MOCTR_RESTXPND_Msk, /**< Reset transmit pending */ + XMC_CAN_MO_RESET_STATUS_RX_UPDATING = CAN_MO_MOCTR_RESRXUPD_Msk, /**< Reset receive updating */ + XMC_CAN_MO_RESET_STATUS_NEW_DATA = CAN_MO_MOCTR_RESNEWDAT_Msk, /**< Reset new data */ + XMC_CAN_MO_RESET_STATUS_MESSAGE_LOST = CAN_MO_MOCTR_RESMSGLST_Msk, /**< Reset message lost */ + XMC_CAN_MO_RESET_STATUS_MESSAGE_VALID = CAN_MO_MOCTR_RESMSGVAL_Msk, /**< Reset message valid */ + XMC_CAN_MO_RESET_STATUS_RX_TX_SELECTED = CAN_MO_MOCTR_RESRTSEL_Msk, /**< Reset transmit/receive selected */ + XMC_CAN_MO_RESET_STATUS_RX_ENABLE = CAN_MO_MOCTR_RESRXEN_Msk, /**< Reset receive enable */ + XMC_CAN_MO_RESET_STATUS_TX_REQUEST = CAN_MO_MOCTR_RESTXRQ_Msk, /**< Reset transmit request */ + XMC_CAN_MO_RESET_STATUS_TX_ENABLE0 = CAN_MO_MOCTR_RESTXEN0_Msk, /**< Reset transmit enable 0 */ + XMC_CAN_MO_RESET_STATUS_TX_ENABLE1 = CAN_MO_MOCTR_RESTXEN1_Msk, /**< Reset transmit enable 1 */ + XMC_CAN_MO_RESET_STATUS_MESSAGE_DIRECTION = CAN_MO_MOCTR_RESDIR_Msk /**< Reset message direction */ +} XMC_CAN_MO_RESET_STATUS_t; + +/** + * Defines mask value for CAN Message Object status. Use type \a XMC_CAN_MO_STATUS_t for this enum. + */ +typedef enum XMC_CAN_MO_STATUS +{ + XMC_CAN_MO_STATUS_RX_PENDING = CAN_MO_MOSTAT_RXPND_Msk, /**< Defines message has been successfully received or not received */ + XMC_CAN_MO_STATUS_TX_PENDING = CAN_MO_MOSTAT_TXPND_Msk, /**< Defines message has been successfully transmitted or not transmitted */ + XMC_CAN_MO_STATUS_RX_UPDATING = CAN_MO_MOSTAT_RXUPD_Msk, /**< Defines Message identifier, DLC, and data of the message object are currently updated or not updated */ + XMC_CAN_MO_STATUS_NEW_DATA = CAN_MO_MOSTAT_NEWDAT_Msk, /**< Defines no update of the message object since last flag reset or Message object has been updated */ + XMC_CAN_MO_STATUS_MESSAGE_LOST = CAN_MO_MOSTAT_MSGLST_Msk, /**< CAN message is lost because NEWDAT has become set again when it has already been set or No CAN message is lost */ + XMC_CAN_MO_STATUS_MESSAGE_VALID = CAN_MO_MOSTAT_MSGVAL_Msk, /**< Message valid */ + XMC_CAN_MO_STATUS_RX_TX_SELECTED = CAN_MO_MOSTAT_RTSEL_Msk, /**< Transmit/Receive selected */ + XMC_CAN_MO_STATUS_RX_ENABLE = CAN_MO_MOSTAT_RXEN_Msk, /**< Receive enable */ + XMC_CAN_MO_STATUS_TX_REQUEST = CAN_MO_MOSTAT_TXRQ_Msk, /**< Transmit request */ + XMC_CAN_MO_STATUS_TX_ENABLE0 = CAN_MO_MOSTAT_TXEN0_Msk, /**< Transmit enable 0 */ + XMC_CAN_MO_STATUS_TX_ENABLE1 = CAN_MO_MOSTAT_TXEN1_Msk, /**< Transmit enable 1 */ + XMC_CAN_MO_STATUS_MESSAGE_DIRECTION = CAN_MO_MOSTAT_DIR_Msk, /**< Message direction */ + XMC_CAN_MO_STATUS_LIST = CAN_MO_MOSTAT_LIST_Msk, /**< List allocation */ + XMC_CAN_MO_STATUS_POINTER_TO_PREVIOUS_MO = CAN_MO_MOSTAT_PPREV_Msk, /**< Pointer to previous Message Object */ + XMC_CAN_MO_STATUS_POINTER_TO_NEXT_MO = (int32_t)CAN_MO_MOSTAT_PNEXT_Msk /**< Pointer to next Message Object */ +} XMC_CAN_MO_STATUS_t; + +/** + * Defines mask value for CAN Node status. Use type \a XMC_CAN_NODE_STATUS_t for this enum. + */ +typedef enum XMC_CAN_NODE_STATUS +{ + XMC_CAN_NODE_STATUS_LAST_ERROR_CODE = CAN_NODE_NSR_LEC_Msk, /**< Last Error Code */ + XMC_CAN_NODE_STATUS_TX_OK = CAN_NODE_NSR_TXOK_Msk, /**< Message transmitted successfully */ + XMC_CAN_NODE_STATUS_RX_OK = CAN_NODE_NSR_RXOK_Msk, /**< Message received successfully */ + XMC_CAN_NODE_STATUS_ALERT_WARNING = CAN_NODE_NSR_ALERT_Msk, /**< Alert warning */ + XMC_CAN_NODE_STATUS_ERROR_WARNING_STATUS = CAN_NODE_NSR_EWRN_Msk, /**< Error warning status */ + XMC_CAN_NODE_STATUS_BUS_OFF= CAN_NODE_NSR_BOFF_Msk, /**< Bus-off status */ + XMC_CAN_NODE_STATUS_LIST_LENGTH_ERROR = CAN_NODE_NSR_LLE_Msk, /**< List length error */ + XMC_CAN_NODE_STATUS_LIST_OBJECT_ERROR = CAN_NODE_NSR_LOE_Msk, /**< List object error */ +#if !defined(MULTICAN_PLUS) + XMC_CAN_NODE_STATUS_SUSPENDED_ACK = CAN_NODE_NSR_SUSACK_Msk /**< Suspend Acknowledge */ +#endif +} XMC_CAN_NODE_STATUS_t; + +/** + * Defines mask value for CAN Node control like initialization, node disable and analyzer mode . + * Use type \a XMC_CAN_NODE_CONTROL_t for this enum. + */ +typedef enum XMC_CAN_NODE_CONTROL +{ + XMC_CAN_NODE_CONTROL_NODE_INIT = CAN_NODE_NCR_INIT_Msk, /**< Node initialization */ + XMC_CAN_NODE_CONTROL_TX_INT_ENABLE = CAN_NODE_NCR_TRIE_Msk, /**< Transfer event enable */ + XMC_CAN_NODE_CONTROL_LEC_INT_ENABLE = CAN_NODE_NCR_LECIE_Msk, /**< LEC Indicated Error Event Enable */ + XMC_CAN_NODE_CONTROL_ALERT_INT_ENABLE = CAN_NODE_NCR_ALIE_Msk, /**< Alert Event Enable */ + XMC_CAN_NODE_CONTROL_CAN_DISABLE = CAN_NODE_NCR_CANDIS_Msk, /**< CAN disable */ + XMC_CAN_NODE_CONTROL_CONF_CHANGE_ENABLE= CAN_NODE_NCR_CCE_Msk, /**< Configuration change enable */ + XMC_CAN_NODE_CONTROL_CAN_ANALYZER_NODEDE = CAN_NODE_NCR_CALM_Msk, /**< CAN Analyzer mode */ +#if !defined(MULTICAN_PLUS) + XMC_CAN_NODE_CONTROL_SUSPENDED_ENABLE = CAN_NODE_NCR_SUSEN_Msk /**< Suspend Enable */ +#endif +} XMC_CAN_NODE_CONTROL_t; + +/** + * Defines mask value for CAN Node events. Use type \a XMC_CAN_NODE_EVENT_t for this enum. + */ +typedef enum XMC_CAN_NODE_EVENT +{ + XMC_CAN_NODE_EVENT_TX_INT = CAN_NODE_NCR_TRIE_Msk, /**< Node Transfer OK Event */ + XMC_CAN_NODE_EVENT_ALERT = CAN_NODE_NCR_ALIE_Msk, /**< Node Alert Event */ + XMC_CAN_NODE_EVENT_LEC = CAN_NODE_NCR_LECIE_Msk, /**< Last Error code Event */ + XMC_CAN_NODE_EVENT_CFCIE = CAN_NODE_NFCR_CFCIE_Msk /**< CAN Frame Count Event */ +} XMC_CAN_NODE_EVENT_t; + +/** + * Defines mask value for CAN node pointer events position. Use type \a XMC_CAN_NODE_POINTER_EVENT_t for this enum. + */ +typedef enum XMC_CAN_NODE_POINTER_EVENT +{ + XMC_CAN_NODE_POINTER_EVENT_ALERT = CAN_NODE_NIPR_ALINP_Pos, /**< Node Alert Event node pointer */ + XMC_CAN_NODE_POINTER_EVENT_LEC = CAN_NODE_NIPR_LECINP_Pos, /**< Last Error code Event node pointer */ + XMC_CAN_NODE_POINTER_EVENT_TRANSFER_OK = CAN_NODE_NIPR_TRINP_Pos, /**< Transmit Event node pointer */ + XMC_CAN_NODE_POINTER_EVENT_FRAME_COUNTER = CAN_NODE_NIPR_CFCINP_Pos /**< CAN Frame Count Event node pointer */ +} XMC_CAN_NODE_POINTER_EVENT_t; + +/** + * Defines CAN Message Object event node pointer position. Use type \a XMC_CAN_MO_POINTER_EVENT_t for this enum. + */ +typedef enum XMC_CAN_MO_POINTER_EVENT +{ + XMC_CAN_MO_POINTER_EVENT_TRANSMIT = CAN_MO_MOIPR_TXINP_Pos, /**< Transmit Event node pointer */ + XMC_CAN_MO_POINTER_EVENT_RECEIVE = CAN_MO_MOIPR_RXINP_Pos /**< Receive Event node pointer */ +} XMC_CAN_MO_POINTER_EVENT_t; + +/** + * Defines mask value for CAN Message Object event type. Use type \a XMC_CAN_MO_EVENT_t for this enum. + */ +typedef enum XMC_CAN_MO_EVENT +{ + XMC_CAN_MO_EVENT_TRANSMIT = CAN_MO_MOFCR_TXIE_Msk, /**< Message Object transmit event */ + XMC_CAN_MO_EVENT_RECEIVE = CAN_MO_MOFCR_RXIE_Msk, /**< Message Object receive event */ + XMC_CAN_MO_EVENT_OVERFLOW = CAN_MO_MOFCR_OVIE_Msk, /**< Message Object overflow event */ +} XMC_CAN_MO_EVENT_t; + +/** + * Defines the possible receive inputs. Use type \a XMC_CAN_NODE_RECEIVE_INPUT_t for this enum. + */ +typedef enum XMC_CAN_NODE_RECEIVE_INPUT +{ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCA, /**< CAN Receive Input A */ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCB, /**< CAN Receive Input B */ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCC, /**< CAN Receive Input C */ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCD, /**< CAN Receive Input D */ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCE, /**< CAN Receive Input E */ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCF, /**< CAN Receive Input F */ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCG, /**< CAN Receive Input G */ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCH /**< CAN Receive Input H */ +} XMC_CAN_NODE_RECEIVE_INPUT_t; + +/** + * Defines last error transfer direction. Use type \a XMC_CAN_NODE_LAST_ERROR_DIR_t for this enum. + */ +typedef enum XMC_CAN_NODE_LAST_ERROR_DIR +{ + XMC_CAN_NODE_LAST_ERROR_DIR_WHILE_NODE_RECEPCION, /**< The last error occurred while the CAN node x was receiver */ + XMC_CAN_NODE_LAST_ERROR_DIR_WHILE_NODE_TRANSMISSION /**< The last error occurred while the CAN node x was transmitter */ +} XMC_CAN_NODE_LAST_ERROR_DIR_t; + + +/** + * Defines last error increment. Use type \a XMC_CAN_NODE_LAST_ERROR_INC_t for this enum. + */ +typedef enum XMC_CAN_NODE_LAST_ERROR_INC +{ + XMC_CAN_NODE_LAST_ERROR_INC_1, /**< The last error led to an error counter increment of 1. */ + XMC_CAN_NODE_LAST_ERROR_INC_8 /**< The last error led to an error counter increment of 8. */ +} XMC_CAN_NODE_LAST_ERROR_INC_t; + +/** + * Defines interrupt request on interrupt output line INT_O[n]. Use type \a XMC_CAN_NODE_INTERRUPT_TRIGGER_t for this enum. + */ +typedef enum XMC_CAN_NODE_INTERRUPT_TRIGGER +{ + XMC_CAN_NODE_INTR_TRIGGER_0 = 0x1U, + XMC_CAN_NODE_INTR_TRIGGER_1 = 0x2U, + XMC_CAN_NODE_INTR_TRIGGER_2 = 0x4U, + XMC_CAN_NODE_INTR_TRIGGER_3 = 0x8U, + XMC_CAN_NODE_INTR_TRIGGER_4 = 0x16U, + XMC_CAN_NODE_INTR_TRIGGER_5 = 0x32U, + XMC_CAN_NODE_INTR_TRIGGER_6 = 0x64U, + XMC_CAN_NODE_INTR_TRIGGER_7 = 0x128U, +} XMC_CAN_NODE_INTERRUPT_TRIGGER_t; + +#if defined(MULTICAN_PLUS) || defined(DOXYGEN) +/** + * Defines the Clock source used for the MCAN peripheral. @note Only available for XMC1400, XMC4800 and XMC4700 series + */ +typedef enum XMC_CAN_CANCLKSRC +{ +#if UC_FAMILY == XMC4 + XMC_CAN_CANCLKSRC_FPERI = 0x1U, + XMC_CAN_CANCLKSRC_FOHP = 0x2U, +#else + XMC_CAN_CANCLKSRC_MCLK = 0x1U, + XMC_CAN_CANCLKSRC_FOHP = 0x2U +#endif +} XMC_CAN_CANCLKSRC_t; +#endif + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ +/** + * Defines CAN node Nominal Bit Time. Use type \a XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t for this structure. +*/ +typedef struct XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG +{ + uint32_t can_frequency; /**< Frequency of the CAN module(fCAN). \a can_frequency shall be range of 5MHz to 120MHz */ + uint32_t baudrate; /**< Specifies the node baud rate. Unit: baud \a baudrate shall be range of 100Kbps to 1000Kbps*/ + uint16_t sample_point; /**< Sample point is used to compensate mismatch between transmitter and receiver clock phases detected in + the synchronization segment. Sample point. Range = [0, 10000] with respect [0%, 100%] of the total bit time.*/ + uint16_t sjw; /**< (Re) Synchronization Jump Width. Range:0-3 */ +} XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t; + +/** + * Defines base, top and bottom of CAN Message Object FIFO Structure. Use type \a XMC_CAN_FIFO_CONFIG_t for this structure. + * A FIFO consists of one base object and n slave objects. + */ +typedef struct XMC_CAN_FIFO_CONFIG +{ + uint8_t fifo_bottom; /**< points to the first element(slave object) in a FIFO structure.Range :0-63*/ + uint8_t fifo_top; /**< points to the last element(slave object) in a FIFO structure. Range :0-63*/ + uint8_t fifo_base; /**< points to the actual target object(Base object) within a FIFO/Gateway structure. Range :0-63*/ +} XMC_CAN_FIFO_CONFIG_t; + +/** + * Defines CAN Gateway FIFO structure and provides additional options for gateway destination object. + * Use type \a XMC_CAN_GATEWAY_CONFIG_t for this structure. + */ +typedef struct XMC_CAN_GATEWAY_CONFIG +{ + uint8_t gateway_bottom; /**< points to the first element(gateway destination object) in a FIFO structure. Range :0-63*/ + uint8_t gateway_top; /**< points to the last element(gateway destination object) in a FIFO structure. Range :0-63*/ + uint8_t gateway_base; /**< points to the actual target object within a FIFO/Gateway structure. Range :0-63*/ + bool gateway_data_frame_send; /**< TXRQ updated in the gateway destination object after the internal transfer from the gateway source + to the gateway destination object */ + bool gateway_identifier_copy; /**< The identifier of the gateway source object (after storing the received frame in the source) is copied + to the gateway destination object. */ + + bool gateway_data_length_code_copy; /**< Data length code of the gateway source object (after storing the received frame in the source) is copied to the + gateway destination object */ + bool gateway_data_copy; /**< Data fields in registers MODATALn and MODATAHn of the gateway source object (after storing the received frame in the source) + are copied to the gateway destination.*/ + +} XMC_CAN_GATEWAY_CONFIG_t; + +/** +* Defines CAN Global Initialization structure +*/ +typedef CAN_GLOBAL_TypeDef XMC_CAN_t; + +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * Defines frame counter configuration. Use type \a XMC_CAN_NODE_FRAME_COUNTER_t for this structure. + * It provides configuration of frame counter that counts transmitted/received CAN frames or obtains information about the time + * when a frame has been started to transmit or be received by the CAN node. +*/ +typedef struct XMC_CAN_NODE_FRAME_COUNTER +{ + + union{ + struct{ + uint32_t : 16; + uint32_t can_frame_count_selection:3; /**< Defines function of the frame counter */ + uint32_t can_frame_count_mode:2; /**< Determines the operation mode of the frame counter */ + uint32_t : 11; + }; + uint32_t nfcr; + + }; +} XMC_CAN_NODE_FRAME_COUNTER_t; + +/** + *Defines Node Runtime structure. +*/ +typedef CAN_NODE_TypeDef XMC_CAN_NODE_t; /**< pointer to the Node CAN register */ + +/** + * Defines CAN Message Object runtime elements. Use type \a XMC_CAN_MO_t for this structure. + */ +typedef struct XMC_CAN_MO +{ + CAN_MO_TypeDef *can_mo_ptr; /**< Pointer to the Message Object CAN register */ + union{ + struct{ + uint32_t can_identifier:29; /**< standard (11 bit)/Extended (29 bit) message identifier */ + uint32_t can_id_mode:1; /**< Standard/Extended identifier support */ + uint32_t can_priority:2; /**< Arbitration Mode/Priority */ + }; + uint32_t mo_ar; + }; + union{ + struct{ + uint32_t can_id_mask:29; /**< CAN Identifier of Message Object */ + uint32_t can_ide_mask:1; /**< Identifier Extension Bit of Message Object */ + }; + uint32_t mo_amr; + }; + uint8_t can_data_length; /**< Message data length, Range:0-8 */ + + union{ + + uint8_t can_data_byte[8]; /**< Each position of the array represents a data byte*/ + uint16_t can_data_word[4]; /**< Each position of the array represents a 16 bits data word*/ + uint32_t can_data[2]; /**< can_data[0] lower 4 bytes of the data. can_data[1], higher 4 bytes + of the data */ + uint64_t can_data_long; /** Data of the Message Object*/ + }; + + XMC_CAN_MO_TYPE_t can_mo_type; /**< Message Type */ + +} XMC_CAN_MO_t; +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * + * @param obj Pointer pointing to XMC_CAN Global Initialization structure. Defines CAN global registers,refer CAN_NODE_TypeDef + * for details. + * + * @return None + * + * \parDescription:
+ * Disables CAN module. In disabled state, no registers of CAN module can be read or written except the CAN_CLC register. + * + * \parRelated APIs:
+ * XMC_CAN_Enable()\n\n\n + * + */ + +void XMC_CAN_Disable(XMC_CAN_t *const obj); + +/** + * + * @param obj Pointer pointing to XMC_CAN Global Initialization structure. Defines CAN global registers,refer CAN_NODE_TypeDef + * for details. + * + * @return None + * + * \parDescription:
+ * Enables CAN module and initializes all CAN registers to reset values. It is required to re-configure desired CAN nodes, + * before any data transfer. It configures CAN_CLC.DISR bit. + * + * \parRelated APIs:
+ * XMC_CAN_Disable()\n\n\n + * + */ + +void XMC_CAN_Enable(XMC_CAN_t *const obj); + +/** + * + * @param obj Pointer pointing to XMC_CAN Global Initialization structure. Defines CAN global registers,refer CAN_NODE_TypeDef + * for details. + * + * @param node_num CAN node number,Range : 0-2 + * @param mo_num CAN Message Object number,Range : 0-63 + * + * @return None + * + * \parDescription:
+ * Allocates Message Object from free list to node list. Each \a node_num is linked to one unique list of message objects. + * A CAN node performs message transfer only with the \a mo_num message objects that are allocated to the list of the CAN node. + * It configures PANCTR register. + * + * \parRelated APIs:
+ * None + * + */ + +void XMC_CAN_AllocateMOtoNodeList(XMC_CAN_t *const obj, const uint8_t node_num, const uint8_t mo_num); + +/** + * + * @param obj Pointer pointing to XMC_CAN Global Initialization structure. Defines CAN global registers,refer CAN_NODE_TypeDef + * for details. + * + * @return Ready status of list controller + * + * \parDescription:
+ * Returns ready status of the list controller + * + * \parRelated APIs:
+ * XMC_CAN_PanelControl() + * + */ +__STATIC_INLINE bool XMC_CAN_IsPanelControlReady(XMC_CAN_t *const obj) +{ + return (bool)((obj->PANCTR & (CAN_PANCTR_BUSY_Msk | CAN_PANCTR_RBUSY_Msk)) == 0); +} + +/** + * + * @param obj Pointer pointing to XMC_CAN Global Initialization structure. Defines CAN global registers,refer CAN_NODE_TypeDef + * for details. + * + * @param pancmd panal command selection. Refer @ref XMC_CAN_PANCMD_t for valid values. + * @param arg1 Panel Argument 1,Range : 0-2 + * @param arg2 Panel Argument 2, Range : 0-63 + * + * @return None + * + * \parDescription:
+ * Configures the panel command and panel arguments. A panel operation consists of a command code (PANCMD) and up to two + * panel arguments (PANAR1, PANAR2). Commands that have a return value deliver it to the PANAR1 bit field. Commands that + * return an error flag deliver it to bit 31 of the Panel Control Register, this means bit 7 of PANAR2. \a arg1 represents + * panel argument PANAR1,\a arg2 represents panel argument PANAR2 and \a pancmd represents command code. It configures PANCTR + * register. + * + * \parRelated APIs:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_PanelControl(XMC_CAN_t *const obj, + const XMC_CAN_PANCMD_t pancmd, + const uint8_t arg1, + const uint8_t arg2) +{ + obj->PANCTR = (((uint32_t)pancmd << CAN_PANCTR_PANCMD_Pos) & (uint32_t)CAN_PANCTR_PANCMD_Msk) | + (((uint32_t)arg1 << CAN_PANCTR_PANAR1_Pos) & (uint32_t)CAN_PANCTR_PANAR1_Msk) | + (((uint32_t)arg2 << CAN_PANCTR_PANAR2_Pos) & (uint32_t)CAN_PANCTR_PANAR2_Msk); +} + + +/** + * + * @param obj Pointer pointing to XMC_CAN Global Initialization structure. Defines CAN global registers,refer CAN_NODE_TypeDef + * for details. + * + * @param service_requestr Interrupt trigger number selection. Refer @ref XMC_CAN_NODE_INTERRUPT_TRIGGER_t for valid values. + * Multiple interrupt trigger events can be ORed. + * + * @return None + * + * \parDescription:
+ * Configures multiple interrupt requests with a single write operation. \a service_requestr represents single interrupt + * request or multiple.It configures MITR register. + * + * \parRelated APIs:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_EventTrigger(XMC_CAN_t *const obj,const XMC_CAN_NODE_INTERRUPT_TRIGGER_t service_requestr) +{ + obj->MITR = ((uint32_t)service_requestr << CAN_MITR_IT_Pos) & (uint32_t)CAN_MITR_IT_Msk; +} + + + + /*INIT APIs*/ + +/** + * + * @param obj Pointer pointing to XMC_CAN Global Initialization structure. Defines CAN global registers,refer CAN_NODE_TypeDef + * for details. + * + * @param can_frequency CAN module frequency(fCAN). Range : 5MHz to 120MHz + * + * @return None + * + * \parDescription:
+ * Configures clock rate of the module timer clock fCAN. Altering CAN module \a can_frequency shall affects baud rate, + * call XMC_CAN_NODE_NominalBitTimeConfigure() to configure baud rate for current CAN frequency.It configures FDR register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_NominalBitTimeConfigure()\n\n\n + * + */ + + +#if defined(MULTICAN_PLUS) +void XMC_CAN_Init(XMC_CAN_t *const obj, XMC_CAN_CANCLKSRC_t clksrc, uint32_t can_frequency); +/** + * + */ +XMC_CAN_CANCLKSRC_t XMC_CAN_GetBaudrateClockSource(XMC_CAN_t *const obj); +/** + * + */ +void XMC_CAN_SetBaudrateClockSource(XMC_CAN_t *const obj,const XMC_CAN_CANCLKSRC_t source); +/** + * + */ +uint32_t XMC_CAN_GetBaudrateClockFrequency(XMC_CAN_t *const obj); +#else +void XMC_CAN_Init(XMC_CAN_t *const obj, uint32_t can_frequency); +#endif + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Initializes CAN message object. Initialization includes configuring Message Object identifier type, Message Object + * identifier value, Message Object type, and transfer requests. It configures FDR register. + * + * \parRelated APIs:
+ * None + * + */ + +void XMC_CAN_MO_Config(const XMC_CAN_MO_t *const can_mo); + + + /*NODE APIs*/ + + +/** + * + * @param can_node Pointer pointing to CAN_NODE Structure. Defines CAN_NODE registers. + * @param ptr_event CAN_NODE interrupt pointer position. Refer @ref XMC_CAN_NODE_POINTER_EVENT_t structure for valid values. + * @param service_request Interrupt service request number. Range : 0-7 + * + * @return None + * + * \parDescription:
+ * Configures node interrupt pointer \a service_request for CAN Node events \a ptr_event. It configures NIPR register. + * + * \parRelated APIs:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_SetEventNodePointer(XMC_CAN_NODE_t *const can_node, + const XMC_CAN_NODE_POINTER_EVENT_t ptr_event, + const uint32_t service_request) +{ + can_node->NIPR = (uint32_t)((can_node->NIPR) & ~(uint32_t)(CAN_NODE_NIPR_Msk << (uint32_t)ptr_event)) | (service_request << (uint32_t)ptr_event); +} + + +/** + * + * @param can_node Pointer pointing to CAN_NODE Structure. Defines CAN_NODE registers. Range :CAN_NODE0-CAN_NODE2 + * @param can_bit_time Nominal bit time configuration data structure. Refer @ref XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t for details. + * + * @return None + * + * \parDescription:
+ * Configures CAN node Baudrate. \a can_bit_time specifies required baudrate for a specified \a can_node. + * It configures NBTR register. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_CAN_NODE_NominalBitTimeConfigure (XMC_CAN_NODE_t *const can_node, + const XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t *const can_bit_time); + +/** + * @param can_node Pointer pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param input CAN receive input selection. Refer @ref XMC_CAN_NODE_RECEIVE_INPUT_t for details. + * + * @return None + * + * \parDescription:
+ * \a input specifies CAN input receive pin. This API Configures NPCRx register,it is required to call + * XMC_CAN_NODE_EnableConfigurationChange(), before configuring NPCRx register, call XMC_CAN_NODE_DisableConfigurationChange() + * API after configuring NPCRx register. CAN input receive pins which falls under analog port pins should call + * XMC_GPIO_EnableDigitalInput(),to enable digital pad. + * + *\parRelated APIs:
+ * None + * + * \parNote:
+ * NPCRx can be written only if bit NCRx.CCE is set. + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_SetReceiveInput(XMC_CAN_NODE_t *const can_node, + const XMC_CAN_NODE_RECEIVE_INPUT_t input) +{ + can_node->NPCR = ((can_node->NPCR) & ~(uint32_t)(CAN_NODE_NPCR_RXSEL_Msk)) | + (((uint32_t)input << CAN_NODE_NPCR_RXSEL_Pos) & (uint32_t)CAN_NODE_NPCR_RXSEL_Msk); +} + + +/** + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Enable Node \a can_node in Loop-Back Mode. A Node is connected to an internal (virtual) loop-back CAN bus. All CAN + * nodes which are in Loop- Back Mode are connected to this virtual CAN bus so that they can communicate with each + * other internally. The external transmit line is forced recessive in Loop-Back Mode. This API Configures NPCRx register. + * call XMC_CAN_NODE_EnableConfigurationChange() API before NPCRx configuration, same way XMC_CAN_NODE_DisableConfigurationChange() + * API after NPCRx configuration configuration. + * + * \parRelated APIs:
] + * XMC_CAN_NODE_DisableLoopBack(). + * + * \parNote:
+ * NPCRx can be written only if bit NCRx.CCE is set. + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_EnableLoopBack(XMC_CAN_NODE_t *const can_node) +{ + can_node->NPCR |= (uint32_t)CAN_NODE_NPCR_LBM_Msk; +} + + +/** + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Disable Node Loop-Back Mode, disables internal (virtual) loop-back CAN bus. This API Configures NPCRx register. + * Call XMC_CAN_NODE_EnableConfigurationChange() API before NPCRx configuration, same way XMC_CAN_NODE_DisableConfigurationChange() + * API after NPCRx configuration. + * + * \parRelated APIs:
] + * XMC_CAN_NODE_EnableLoopBack() + * + * + * \parNote:
+ * NPCRx can be written only if bit NCRx.CCE is set. + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_DisableLoopBack(XMC_CAN_NODE_t *const can_node) +{ + can_node->NPCR &= ~(uint32_t)CAN_NODE_NPCR_LBM_Msk; +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param event CAN node event mask value. Refer @ref XMC_CAN_NODE_EVENT_t structure for valid values. + * multiple events can be ORed. + * + * @return None + * + * \parDescription:
+ * Enable CAN Node events. It configures NFCR register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_DisableEvent() + * + */ + +void XMC_CAN_NODE_EnableEvent(XMC_CAN_NODE_t *const can_node, const XMC_CAN_NODE_EVENT_t event); + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param event CAN node event mask value. Refer @ref XMC_CAN_NODE_EVENT_t structure for valid values. + * multiple events can be ORed. + * + * @return None + * + * \parDescription:
+ * Disable CAN Node events. It configures NFCR register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_EnableEvent() + * + */ + +void XMC_CAN_NODE_DisableEvent(XMC_CAN_NODE_t *const can_node, const XMC_CAN_NODE_EVENT_t event); + + +/** + * + * @param node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return XMC_CAN_NODE_LAST_ERROR_DIR_t Last error transfer direction. Refer @ref XMC_CAN_NODE_LAST_ERROR_DIR_t. + * + * \parDescription:
+ * Returns NODE Last Error occurred during Transmit/receive direction. It returns value of NFCR register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_GetLastErrTransferInc()\n\n\n + * + */ + +__STATIC_INLINE XMC_CAN_NODE_LAST_ERROR_DIR_t XMC_CAN_NODE_GetLastErrTransferDir(XMC_CAN_NODE_t *const node) +{ + return (XMC_CAN_NODE_LAST_ERROR_DIR_t)(((node->NECNT) & CAN_NODE_NECNT_LETD_Msk) >> CAN_NODE_NECNT_LETD_Pos); +} + + +/** + * + * @param node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return XMC_CAN_NODE_LAST_ERROR_INC_t Last error transfer increment. Refer @ref XMC_CAN_NODE_LAST_ERROR_INC_t. + * + * \parDescription:
+ * Returns NODE Last Error Transfer Increment. It returns value of NFCR register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_GetLastErrTransferDir()\n\n\n + * + */ + +__STATIC_INLINE XMC_CAN_NODE_LAST_ERROR_INC_t XMC_CAN_NODE_GetLastErrTransferInc(XMC_CAN_NODE_t *const node) +{ + return (XMC_CAN_NODE_LAST_ERROR_INC_t)(((node->NECNT) & CAN_NODE_NECNT_LEINC_Msk)>> CAN_NODE_NECNT_LEINC_Pos); +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param error_warning_level Error Warning level value. Range :0-255. + * + * @return None + * + * \parDescription:
+ * Configures error warning level in order to set the corresponding error warning bit EWRN. It configures \a error_warning_level + * into NECNT register. Before this configuration call XMC_CAN_NODE_EnableConfigurationChange() API. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_GetErrorWarningLevel()\n\n\n + * + * \parNote:
+ * NECNTx can be written only if bit NCRx.CCE is set. + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_SetErrorWarningLevel(XMC_CAN_NODE_t *const can_node, uint8_t error_warning_level) +{ + can_node->NECNT = ((can_node->NECNT) & ~(uint32_t)(CAN_NODE_NECNT_EWRNLVL_Msk)) | + (((uint32_t)error_warning_level << CAN_NODE_NECNT_EWRNLVL_Pos) & (uint32_t)CAN_NODE_NECNT_EWRNLVL_Msk); +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param can_tec transmit error counter value. Range :0-255 + * + * @return None + * + * \parDescription:
+ * Configures Transmit error counter. It configures \a can_tec into NECNT register. Before this configuration call + * XMC_CAN_NODE_EnableConfigurationChange() API. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_GetTransmitErrorCounter()\n\n\n + * + * \parNote:
+ * NECNTx can be written only if bit NCRx.CCE is set. + * + */ + + +__STATIC_INLINE void XMC_CAN_NODE_SetTransmitErrorCounter(XMC_CAN_NODE_t *const can_node, uint8_t can_tec) +{ + can_node->NECNT = ((can_node->NECNT) & ~(uint32_t)(CAN_NODE_NECNT_TEC_Msk)) | + (((uint32_t)can_tec << CAN_NODE_NECNT_TEC_Pos) & (uint32_t)CAN_NODE_NECNT_TEC_Msk); +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param can_rec receive error counter value. Range :0-255 + * + * @return None + * + * \parDescription:
+ * Configures Receive Error Counter. It configures \a can_rec into NECNT register. Before this configuration call + * XMC_CAN_NODE_EnableConfigurationChange() API. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_GetReceiveErrorCounter()\n\n\n + * + * \parNote:
+ * NECNTx can be written only if bit NCRx.CCE is set. + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_SetReceiveErrorCounter(XMC_CAN_NODE_t *const can_node, uint8_t can_rec) +{ + can_node->NECNT = ((can_node->NECNT) & ~(uint32_t)(CAN_NODE_NECNT_REC_Msk)) | + (((uint32_t)can_rec << CAN_NODE_NECNT_REC_Pos) & (uint32_t)CAN_NODE_NECNT_REC_Msk); +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return uint8_t Error Warning Level. Range :0 - 255 + * + * \parDescription:
+ * Returns error warning level. This determines the threshold value (warning level, default 96) to be reached in order + * to set the corresponding error warning bit EWRN. It reads NECNT register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_SetErrorWarningLevel()\n\n\n + * + */ + + +__STATIC_INLINE uint8_t XMC_CAN_NODE_GetErrorWarningLevel(XMC_CAN_NODE_t *const can_node) +{ + return (uint8_t)((uint32_t)((can_node->NECNT) & CAN_NODE_NECNT_EWRNLVL_Msk) >> CAN_NODE_NECNT_EWRNLVL_Pos); +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return uint8_t transmit error counter value. Range :0 - 255 + * + * \parDescription:
+ * Returns Transmit Error Counter value. If the Bitstream Processor detects an error while a transmit operation is + * running, the Transmit Error Counter is incremented by 8. An increment of 1 is used when the error condition was + * reported by an external CAN node via an Error Frame generation. It reads NECNT register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_SetTransmitErrorCounter() + * + * \parNote:
+ * NECNTx can be written only if bit NCRx.CCE is set. + * + */ + +__STATIC_INLINE uint8_t XMC_CAN_NODE_GetTransmitErrorCounter(XMC_CAN_NODE_t *const can_node) +{ + return (uint8_t)((uint32_t)((can_node->NECNT) & CAN_NODE_NECNT_TEC_Msk) >> CAN_NODE_NECNT_TEC_Pos); +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return uint8_t receive error counter value. + * + * \parDescription:
+ * Returns Receive Error Counter value. It reads NECNT register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_SetReceiveErrorCounter() + * + */ + +__STATIC_INLINE uint8_t XMC_CAN_NODE_GetReceiveErrorCounter(XMC_CAN_NODE_t *const can_node) +{ + return (uint8_t)((uint32_t)((can_node->NECNT) & CAN_NODE_NECNT_REC_Msk) >> CAN_NODE_NECNT_REC_Pos); +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return uint32_t Current status of the node. + * + * \parDescription:
+ * Returns errors status as well as successfully transferred CAN frames status. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_ClearStatus() + * + */ + +__STATIC_INLINE uint32_t XMC_CAN_NODE_GetStatus(XMC_CAN_NODE_t *const can_node) +{ + return ((can_node->NSR)); +} + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param can_node_status Status to clear.Refer @ref XMC_CAN_NODE_STATUS_t for valid values. + * + * @return None + * + * \parDescription:
+ * Clear errors status as well as successfully transferred CAN frames status. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_GetStatus() + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_ClearStatus(XMC_CAN_NODE_t *const can_node,XMC_CAN_NODE_STATUS_t can_node_status) +{ + can_node->NSR &= ~(uint32_t)can_node_status; +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Allow to change the configuration of the CAN node, like bit timing, CAN bus transmit/receive ports and error + * counters read. It configures NCRx.CCE bit. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_DisableConfigurationChange() + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_EnableConfigurationChange(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR |= (uint32_t)CAN_NODE_NCR_CCE_Msk; +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Forbid to change the configuration of the CAN node. It configures NCRx.CCE bit. + * + * \parRelated API's:
+ * XMC_CAN_NODE_EnableConfigurationChange() + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_DisableConfigurationChange(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR &= ~(uint32_t)CAN_NODE_NCR_CCE_Msk; +} + + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Disable CAN node participation in CAN traffic. Bit INIT is automatically set when the CAN node enters the bus-off + * state. It configures NCR.INIT bit. + * + * \parRelated API's:
+ * XMC_CAN_NODE_ResetInitBit() + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_SetInitBit(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR |= (uint32_t)CAN_NODE_NCR_INIT_Msk; +} + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Enable CAN node participation in CAN traffic. Bit INIT is automatically set when the CAN node enters the bus-off + * state. It configures NCR.INIT bit. + * + * \parRelated API's:
+ * XMC_CAN_NODE_SetInitBit() + * + */ +__STATIC_INLINE void XMC_CAN_NODE_ResetInitBit(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR &= ~(uint32_t)CAN_NODE_NCR_INIT_Msk; +} + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Enable the CAN node, starts the participation in CAN traffic. It configures NCR.CANDIS and the NCR.INIT bits. + * + * \parRelated API's:
+ * None + * + */ +__STATIC_INLINE void XMC_CAN_NODE_Enable(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR &= ~(uint32_t)CAN_NODE_NCR_CANDIS_Msk; + XMC_CAN_NODE_ResetInitBit(can_node); +} + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Disable the CAN node, terminates participation in CAN traffic. It configures NCR.CANDIS bit. + * + * \parRelated API's:
+ * None + * + */ +__STATIC_INLINE void XMC_CAN_NODE_Disable(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR |= (uint32_t)CAN_NODE_NCR_CANDIS_Msk; +} + +/** + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Configure CAN node in Analyzer Mode. This means that messages may be received, but not transmitted. No acknowledge + * is sent on the CAN bus upon frame reception. Active-error flags are sent recessive instead of dominant. + * The transmit line is continuously held at recessive (1) level. XMC_CAN_NODE_SetInitBit() should be called before + * set / reset AnalyzerMode. It configures NCR.CALM bit. + * + * \parRelated API's:
+ * XMC_CAN_NODE_ReSetAnalyzerMode() + * + */ + + +__STATIC_INLINE void XMC_CAN_NODE_SetAnalyzerMode(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR |= (uint32_t)CAN_NODE_NCR_CALM_Msk; +} + + +/** + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Reset the Analyzer mode. CAN node is no more in Analyzer Mode. Please refer XMC_CAN_NODE_SetAnalyzerMode(). + * It configures NCR.CALM bit. XMC_CAN_NODE_SetInitBit() should be called before set / reset AnalyzerMode. + * + * \parRelated API's:
+ * XMC_CAN_NODE_SetAnalyzerMode() + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_ReSetAnalyzerMode(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR &= ~(uint32_t)CAN_NODE_NCR_CALM_Msk; +} + +#if !defined(MULTICAN_PLUS) +/** + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Trigger the suspension of the CAN node. An OCDS(on chip debug support) suspend trigger disables the CAN node: As + * soon as the CAN node becomes bus-idle or bus-off, bit INIT is internally forced to 1 to disable the CAN node. + * The actual value of bit INIT remains unchanged. It configures NCR.SUSEN bit + * + * \parRelated API's:
+ * None + * + *\parNote:
+ * Bit SUSEN is reset via OCDS(on chip debug support) Reset. + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_EnableSuspend(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR |= (uint32_t)CAN_NODE_NCR_SUSEN_Msk; +} +#else +/** + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Disables the transmission on CAN node x as soon as bus-idle is reached. + * + * \parRelated API's:
+ * None + * + * @note Only available for XMC1400,XMC4800 and XMC4700 series + */ + +__STATIC_INLINE void XMC_CAN_NODE_DisableTransmit(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR |= (uint32_t)CAN_NODE_NCR_TXDIS_Msk; +} +#endif + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param can_node_init frame counter mode selection. Refer @ref XMC_CAN_NODE_FRAME_COUNTER_t for valid values. + * + * @return None + * + * \parDescription:
+ * Configures frame counter functions. Each CAN \a can_node is equipped with a frame counter that counts transmitted/received + * CAN frames or obtains information about the time when a frame has been started to transmit or be received by the CAN + * node. It configures NFCR register. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_FrameCounterConfigure(XMC_CAN_NODE_t *const can_node, + const XMC_CAN_NODE_FRAME_COUNTER_t *const can_node_init) +{ + can_node->NFCR = (can_node->NFCR & ~(uint32_t)(CAN_NODE_NFCR_CFMOD_Msk | + CAN_NODE_NFCR_CFSEL_Msk)) | + can_node_init->nfcr; +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return uint16_t current value of the CAN frame counter. Range :0-65535 + * + * \parDescription:
+ * Returns the frame counter value \a can_node of the CAN node. In Frame Count Mode (CFMOD = 00B), this API returns the frame + * count value. In Time Stamp Mode (CFMOD = 01B), this API returns the captured bit time count value, captured with + * the start of a new frame. In all Bit Timing Analysis Modes (CFMOD = 10B), this API always returns the number of + * fCLC clock cycles (measurement result) minus 1. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE uint16_t XMC_CAN_NODE_GetCANFrameCounter(XMC_CAN_NODE_t *const can_node) +{ + return (uint16_t)(((uint32_t)(can_node->NFCR & CAN_NODE_NFCR_CFC_Msk) >> CAN_NODE_NFCR_CFC_Pos)); +} + + /*MO APIs*/ + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return XMC_CAN_STATUS_t CAN Node status. Refer @ref XMC_CAN_STATUS_t structure for details. + * + * @return None + * + * \parDescription:
+ * Configures Data to be transmitted and data length code. + * + * \parRelated API's:
+ * XMC_CAN_MO_Config()\n\n\n + * + */ + + +XMC_CAN_STATUS_t XMC_CAN_MO_UpdateData(const XMC_CAN_MO_t *const can_mo); + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return XMC_CAN_STATUS_t CAN Node status. Refer @ref XMC_CAN_STATUS_t structure for details. + * + * \parDescription:
+ * Configures transmit request for sending data frame. It configures MOCTR register. Data shall be updated + * using XMC_CAN_MO_UpdateData() before calling this API. + * + * \parRelated API's:
+ * XMC_CAN_MO_UpdateData()\n\n\n + * + */ + +XMC_CAN_STATUS_t XMC_CAN_MO_Transmit(const XMC_CAN_MO_t *const can_mo); + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return XMC_CAN_STATUS_t CAN Node status. Refer @ref XMC_CAN_STATUS_t structure for details. + * + * \parDescription:
+ * Reads the Message Object data bytes, into message pointer passed as input parameter \a can_mo. + * can_data[0] of can_mo holds lower 4 bytes, can_data[1] of can_mo holds higher 4 bytes. + * + * \parRelated API's:
+ * None + * + */ + +XMC_CAN_STATUS_t XMC_CAN_MO_Receive(XMC_CAN_MO_t *can_mo); + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return XMC_CAN_STATUS_t CAN Node status. Refer @ref XMC_CAN_STATUS_t structure for details. + * + * \parDescription:
+ * Reads the Message Object data bytes, into message pointer passed as input parameter \a can_mo. + * can_data[0] of can_mo holds lower 4 bytes, can_data[1] of can_mo holds higher 4 bytes. + * + * \parRelated API's:
+ * None + * + */ +XMC_CAN_STATUS_t XMC_CAN_MO_ReceiveData (XMC_CAN_MO_t *can_mo); +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param can_mo_ptr_int Message Object event node pointer selection. Refer @ref XMC_CAN_MO_POINTER_EVENT_t structure + * for valid values. + * @param service_request interrupt output line of multiCAN module. + * + * @return None + * + * \parDescription:
+ * Configures Message Object event node pointer with \a service_request number. It configures MOIPR register. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_MO_SetEventNodePointer(const XMC_CAN_MO_t *const can_mo, + const XMC_CAN_MO_POINTER_EVENT_t can_mo_ptr_int, + const uint32_t service_request) +{ + can_mo->can_mo_ptr->MOIPR = ((can_mo->can_mo_ptr->MOIPR ) & ~(uint32_t)((uint32_t)CAN_MO_MOIPR_Msk << (uint32_t)can_mo_ptr_int)) | + (service_request << (uint32_t)can_mo_ptr_int); +} + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return uint32_t Current Message Object status. + * + * \parDescription:
+ * Returns Message Object status, that indicates message object transfer status and message object list status + * information such as the number of the current message object predecessor and successor message object, as well as + * the list number to which the message object is assigned. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE uint32_t XMC_CAN_MO_GetStatus(const XMC_CAN_MO_t *const can_mo) +{ + return ((can_mo->can_mo_ptr->MOSTAT)); +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param mask Message Object set status selection. Refer @ref XMC_CAN_MO_SET_STATUS_t for details. + * Multiple enums can be ORed. + * @return None + * + * \parDescription:
+ * Configures Message Object set Status. It configures MOCTR register. + * + * \parRelated API's:
+ * XMC_CAN_MO_ResetStatus()\n\n\n + * + */ + +__STATIC_INLINE void XMC_CAN_MO_SetStatus(const XMC_CAN_MO_t *const can_mo, const uint32_t mask) +{ + can_mo->can_mo_ptr->MOCTR = mask; +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param mask Message Object set status selection. Refer @ref XMC_CAN_MO_RESET_STATUS_t for details. + * Multiple enums can be ORed. + * @return None + * + * \parDescription:
+ * Clears Message Object interrupt events. It configures MOCTR register. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_MO_ResetStatus(const XMC_CAN_MO_t *const can_mo,const uint32_t mask) +{ + can_mo->can_mo_ptr->MOCTR = mask; +} + + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param event CAN node Message Object event selection. Refer @ref XMC_CAN_MO_EVENT_t for details. + * + * @return None + * + * \parDescription:
+ * Enable CAN Message Object events. \a event can be ORed multiple Message Object events. It configures MOFCR register. + * + * \parRelated API's:
+ * XMC_CAN_MO_DisableEvent() + * + */ + +__STATIC_INLINE void XMC_CAN_MO_EnableEvent(const XMC_CAN_MO_t *const can_mo, + const uint32_t event) +{ + can_mo->can_mo_ptr->MOFCR |= event; +} + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param event CAN node Message Object event selection. Refer @ref XMC_CAN_MO_EVENT_t for details. + * + * @return None + * + * \parDescription:
+ * Disable CAN Message Object events. \a event can be ORed multiple Message Object events. It configures MOFCR register. + * + * \parRelated API's:
+ * XMC_CAN_MO_EnableEvent() + * + * + */ + +__STATIC_INLINE void XMC_CAN_MO_DisableEvent(const XMC_CAN_MO_t *const can_mo, + const uint32_t event) +{ + can_mo->can_mo_ptr->MOFCR &= ~event; +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Enable the single transmit trial(STT). In STT,TXRQ is cleared on transmission start of message object n. Thus, + * no transmission retry is performed in case of transmission failure. It configures MOFCR.STT bit. + * + * \parRelated API's:
+ * XMC_CAN_MO_DisableSingleTransmitTrial() + * + */ + +__STATIC_INLINE void XMC_CAN_MO_EnableSingleTransmitTrial(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR |= (uint32_t) CAN_MO_MOFCR_STT_Msk; +} + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Disable the single transmit trial(STT). In STT,TXRQ is cleared on transmission start of message object n. Thus, + * no transmission retry is performed in case of transmission failure. It configures MOFCR.STT bit. + * + * \parRelated API's:
+ * XMC_CAN_MO_EnableSingleTransmitTrial() + * + */ + +__STATIC_INLINE void XMC_CAN_MO_DisableSingleTransmitTrial(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR &= ~(uint32_t)CAN_MO_MOFCR_STT_Msk; +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param data_length_code transfer data length. Range:0-8 + * + * @return None + * + * \parDescription:
+ * Configures CAN Message Object Data Length Code. It configures MOFCR register. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_MO_DataLengthCode(const XMC_CAN_MO_t *const can_mo,const uint8_t data_length_code) +{ + can_mo->can_mo_ptr->MOFCR = ((can_mo->can_mo_ptr->MOFCR ) & ~(uint32_t)(CAN_MO_MOFCR_DLC_Msk)) | + (((uint32_t)data_length_code << CAN_MO_MOFCR_DLC_Pos) & (uint32_t)CAN_MO_MOFCR_DLC_Msk); +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param data_length_code transfer data length. Range:0-8 + * + * @return None + * + * \parDescription:
+ * Configures CAN Message Object Data Length Code. It configures MOFCR register. + * + * \parRelated API's:
+ * XMC_CAN_MO_GetDataLengthCode() + * + */ + +__STATIC_INLINE void XMC_CAN_MO_SetDataLengthCode(XMC_CAN_MO_t *const can_mo,const uint8_t data_length_code) +{ + can_mo->can_data_length = data_length_code; + can_mo->can_mo_ptr->MOFCR = ((can_mo->can_mo_ptr->MOFCR ) & ~(uint32_t)(CAN_MO_MOFCR_DLC_Msk)) | + (((uint32_t)data_length_code << CAN_MO_MOFCR_DLC_Pos) & (uint32_t)CAN_MO_MOFCR_DLC_Msk); +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return Data length code + * + * \parDescription:
+ * Gets the Data Length Code. + * + * \parRelated API's:
+ * XMC_CAN_MO_SetDataLengthCode() + * + */ + +__STATIC_INLINE uint8_t XMC_CAN_MO_GetDataLengthCode(const XMC_CAN_MO_t *const can_mo) +{ + return (((can_mo->can_mo_ptr->MOFCR) & (uint32_t)(CAN_MO_MOFCR_DLC_Msk)) >> CAN_MO_MOFCR_DLC_Pos); +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param can_identifier Identifier. + * + * @return None + * + * \parDescription:
+ * Configures CAN Message Object Identifier. It configures MOAR register. + * + * \parRelated API's:
+ * XMC_CAN_MO_GetIdentifier() + * + */ + +void XMC_CAN_MO_SetIdentifier(XMC_CAN_MO_t *const can_mo, const uint32_t can_identifier); + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return CAN MO identifier + * + * \parDescription:
+ * Gets the Identifier of the MO + * + * \parRelated API's:
+ * XMC_CAN_MO_SetIdentifier() + * + */ + +uint32_t XMC_CAN_MO_GetIdentifier(const XMC_CAN_MO_t *const can_mo); + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return Acceptance mask + * + * \parDescription:
+ * Gets the acceptance mask for the CAN MO. + * + * \parRelated API's:
+ * XMC_CAN_MO_SetAcceptanceMask() + * + */ + +uint32_t XMC_CAN_MO_GetAcceptanceMask(const XMC_CAN_MO_t *const can_mo); + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param can_id_mask CAN MO acceptance mask. + * + * @return None + * + * \parDescription:
+ * Sets the acceptance mask of the MO + * + * \parRelated API's:
+ * XMC_CAN_MO_GetAcceptanceMask() + * + */ + +void XMC_CAN_MO_SetAcceptanceMask(XMC_CAN_MO_t *const can_mo,const uint32_t can_id_mask); + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Message object receives frames only with matching IDE bit. + * + * \parRelated API's:
+ * XMC_CAN_MO_AcceptStandardAndExtendedID() + * + */ + +__STATIC_INLINE void XMC_CAN_MO_AcceptOnlyMatchingIDE(XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_ide_mask = 1U; + can_mo->can_mo_ptr->MOAMR |=(uint32_t)(CAN_MO_MOAMR_MIDE_Msk); +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Message object accepts the reception of both, standard and extended frames. + * + * \parRelated API's:
+ * XMC_CAN_MO_AcceptOnlyMatchingIDE() + * + */ + +__STATIC_INLINE void XMC_CAN_MO_AcceptStandardAndExtendedID(XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_ide_mask = 0U; + can_mo->can_mo_ptr->MOAMR &= ~(uint32_t)(CAN_MO_MOAMR_MIDE_Msk); +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Message object handles standard frames with 11-bit identifier. + * + * \parRelated API's:
+ * XMC_CAN_MO_SetExtendedID() + * + * \parNote:
+ * After setting the identifier type user has to set the identifier value by using @ref XMC_CAN_MO_SetIdentifier() API. + */ + +__STATIC_INLINE void XMC_CAN_MO_SetStandardID(XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_id_mode = (uint32_t)XMC_CAN_FRAME_TYPE_STANDARD_11BITS; + can_mo->can_mo_ptr->MOAR &= ~(uint32_t)(CAN_MO_MOAR_IDE_Msk); +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Message object handles extended frames with 29-bit identifier. + * + * \parRelated API's:
+ * XMC_CAN_MO_SetStandardID() + * + * \parNote:
+ * After setting the identifier type user has to set the identifier value by using @ref XMC_CAN_MO_SetIdentifier() API. + * + */ + +__STATIC_INLINE void XMC_CAN_MO_SetExtendedID(XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_id_mode = (uint32_t)XMC_CAN_FRAME_TYPE_EXTENDED_29BITS; + can_mo->can_mo_ptr->MOAR |= (uint32_t)CAN_MO_MOAR_IDE_Msk; +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configuration allows to enable the FIFO Foreign Remote Request. This Specifies TXRQ of the message object referenced + * by the pointer CUR is set on reception of a matching Remote Frame. It configures MOFCR.FRREN register. + * + * \parRelated API's:
+ * XMC_CAN_FIFO_DisableForeingRemoteRequest()\n\n\n + * + */ + +__STATIC_INLINE void XMC_CAN_FIFO_EnableForeignRemoteRequest(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR |= (uint32_t)CAN_MO_MOFCR_FRREN_Msk; +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configuration allows to disable the FIFO Foreign Remote Request. TXRQ of message object n is set on reception + * of a matching Remote Frame. It configures MOFCR.FRREN register. + * + * \parRelated API's:
+ * XMC_CAN_FIFO_EnableForeignRemoteRequest()\n\n\n + * + */ + +__STATIC_INLINE void XMC_CAN_FIFO_DisableForeingRemoteRequest(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR &= ~(uint32_t)CAN_MO_MOFCR_FRREN_Msk; +} + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configuration allows to enable the FIFO Remote Monitoring. This Specifies identifier, IDE(Identifier Extension) bit, + * and DLC of a matching Remote Frame are copied to transmit object n in order to monitor incoming Remote Frames. + * It configures MOFCR.RMM bit. + * + * \parRelated API's:
+ * XMC_CAN_FIFO_DisableRemoteMonitoring()\n\n\n + * + * \parNote:
+ * Remote monitoring(RMM) applies only to transmit objects and has no effect on receive objects. + * + */ +__STATIC_INLINE void XMC_CAN_FIFO_EnableRemoteMonitoring(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR |= (uint32_t)CAN_MO_MOFCR_RMM_Msk; +} + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configuration allows to disable the FIFO Remote Monitoring. This Specifies Identifier, Identifier Extension bit, + * and DLC of message object n remain unchanged upon the reception of a matching Remote Frame. + * It configures MOFCR.RMM bit. + * + * \parRelated API's:
+ * XMC_CAN_FIFO_EnableRemoteMonitoring()\n\n\n + * + * \parNote:
+ * Remote monitoring(RMM) applies only to transmit objects and has no effect on receive objects. + * + */ + +__STATIC_INLINE void XMC_CAN_FIFO_DisableRemoteMonitoring(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR &= ~(uint32_t)CAN_MO_MOFCR_RMM_Msk; +} + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param select_pointer Selected Message Object number. Range:0-63 + * + * @return None + * + * \parDescription:
+ * Set Object Select Pointer. If the current pointer CUR of FIFO base object becomes equal \a select_pointer, + * a FIFO overflow interrupt request is generated. Used for FIFO monitoring purpose. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_FIFO_SetSELMO(const XMC_CAN_MO_t *const can_mo,const uint8_t select_pointer) +{ + can_mo->can_mo_ptr->MOFGPR = ((can_mo->can_mo_ptr->MOFGPR ) & ~(uint32_t)(CAN_MO_MOFGPR_SEL_Msk)) | + (((uint32_t)select_pointer << CAN_MO_MOFGPR_SEL_Pos) & (uint32_t)CAN_MO_MOFGPR_SEL_Msk); +} + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return uint8_t Current Message Object Number. Range:0-63 + * + * \parDescription:
+ * Returns the current FIFO Message Object,points to the actual target object within a FIFO/Gateway structure. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE uint8_t XMC_CAN_FIFO_GetCurrentMO(const XMC_CAN_MO_t *const can_mo) +{ + return (uint8_t)((uint32_t)(can_mo->can_mo_ptr->MOFGPR & CAN_MO_MOFGPR_CUR_Msk) >> CAN_MO_MOFGPR_CUR_Pos); +} + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configuration allows to enable the Single Data Transfer of the FIFO Message Object. If SDT = 1 and message object n + * is not a FIFO base object, then MSGVAL is reset when this object has taken part in a successful data transfer + * (receive or transmit). If SDT = 1 and message object n is a FIFO base object, then MSGVAL is reset when the pointer + * to the current object CUR reaches the value of SEL in the FIFO/Gateway Pointer Register. It configures MOFCR.SDT bit. + * + * \parRelated API's:
+ * XMC_CAN_FIFO_DisableSingleDataTransfer() + * + */ + +__STATIC_INLINE void XMC_CAN_FIFO_EnableSingleDataTransfer(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR |= (uint32_t)CAN_MO_MOFCR_SDT_Msk; +} + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configuration allows to disable the Single Data Transfer of the FIFO Message Object, with this configuration bit + * MSGVAL is not affected. It configures MOFCR.SDT bit. + * + * \parRelated API's:
+ * XMC_CAN_FIFO_EnableSingleDataTransfer() + * + */ + +__STATIC_INLINE void XMC_CAN_FIFO_DisableSingleDataTransfer(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR &= ~(uint32_t)CAN_MO_MOFCR_SDT_Msk; +} + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param can_fifo CAN FIFO configuration data structure. Refer @ref XMC_CAN_FIFO_CONFIG_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configures the transmit FIFO. A FIFO consists of one base object and n slave objects. Please refer + * reference manual \b Transmit FIFO for more info. + * + * \parRelated API's:
+ * None. + * + */ + +void XMC_CAN_TXFIFO_ConfigMOBaseObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_FIFO_CONFIG_t can_fifo); + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param can_fifo CAN FIFO configuration data structure. Refer @ref XMC_CAN_FIFO_CONFIG_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configures the base object of receive FIFO. + * + * \parRelated API's:
+ * None + */ + +void XMC_CAN_RXFIFO_ConfigMOBaseObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_FIFO_CONFIG_t can_fifo); + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param can_fifo CAN FIFO configuration data structure. Refer @ref XMC_CAN_FIFO_CONFIG_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configures the slave object of transmit FIFO. + * + * \parRelated API's:
+ * None + * + */ +void XMC_CAN_TXFIFO_ConfigMOSlaveObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_FIFO_CONFIG_t can_fifo); + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configures the slave Object of receive FIFO. It configures MOCTR.RESRXEN bit. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_RXFIFO_ConfigMOSlaveObject(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOCTR = (uint32_t)CAN_MO_MOCTR_RESRXEN_Msk; +} + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param can_gateway CAN gateway configuration data structure. Refer XMC_CAN_GATEWAY_CONFIG_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configures the Gateway source object. The Gateway Mode \a can_gateway makes it possible to establish an automatic + * information transfer between two independent CAN buses without CPU interaction. Please refer reference manual + * \b GatewayMode for more info. + * + * \parRelated API's:
+ * None + * + */ + +void XMC_CAN_GATEWAY_InitSourceObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_GATEWAY_CONFIG_t can_gateway); + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configures the Gateway destination object. The Gateway Mode \a can_gateway makes it possible to establish an automatic + * information transfer between two independent CAN buses without CPU interaction. Please refer reference manual + * \b GatewayMode for more info. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_GATEWAY_InitDesObject(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOCTR = CAN_MO_MOCTR_RESRXEN_Msk | + CAN_MO_MOCTR_RESNEWDAT_Msk; +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return XMC_CAN_STATUS_t CAN Node status. Refer @ref XMC_CAN_STATUS_t structure for details. + * + * \parDescription:
+ * To transmit Message Object from the FIFO. Prior to this CAN node Message Object FIFO structure shall be made using + * XMC_CAN_TXFIFO_ConfigMOBaseObject(), XMC_CAN_TXFIFO_ConfigMOSlaveObject(),XMC_CAN_RXFIFO_ConfigMOBaseObject() API's. + * Please refer reference manual \b MessageObject \b FIFOStructure for more info. + * + * + */ +XMC_CAN_STATUS_t XMC_CAN_TXFIFO_Transmit(const XMC_CAN_MO_t *const can_mo); + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(CAN) */ + +#endif /* XMC_CAN_H */ + + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_can_map.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_can_map.h new file mode 100644 index 00000000..a8bff4d6 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_can_map.h @@ -0,0 +1,629 @@ +/** + * @file xmc_can_map.h + * @date 2015-10-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-10-20: + * - Removed "const" in the MOs for avoiding compiler warnings + * + * 2015-09-15: + * - Initial version + * + * @endcond + * + */ + +#ifndef XMC_CAN_MAP_H +#define XMC_CAN_MAP_H + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN48) +#define CAN_NODE0_RXD_P0_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P0_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P0_14 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE0_RXD_P0_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE0_RXD_P2_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE0_RXD_P2_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE0_RXD_P1_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE0_RXD_P1_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#define CAN_NODE1_RXD_P0_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P0_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_10 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE1_RXD_P2_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE1_RXD_P1_2 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE1_RXD_P1_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#endif + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN64) +#define CAN_NODE0_RXD_P0_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P0_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P0_14 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE0_RXD_P0_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE0_RXD_P2_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE0_RXD_P2_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE0_RXD_P1_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE0_RXD_P1_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#define CAN_NODE1_RXD_P0_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P0_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P4_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P4_9 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_P2_10 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE1_RXD_P2_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE1_RXD_P1_2 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE1_RXD_P1_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#endif + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN48) +#define CAN_NODE0_RXD_P0_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P0_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P0_14 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE0_RXD_P0_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE0_RXD_P2_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE0_RXD_P2_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE0_RXD_P1_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE0_RXD_P1_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#define CAN_NODE1_RXD_P0_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P0_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_10 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE1_RXD_P2_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE1_RXD_P1_2 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE1_RXD_P1_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#endif + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN64) +#define CAN_NODE0_RXD_P0_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P0_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P0_14 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE0_RXD_P0_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE0_RXD_P2_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE0_RXD_P2_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE0_RXD_P1_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE0_RXD_P1_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#define CAN_NODE1_RXD_P0_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P0_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P4_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P4_9 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_P2_10 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE1_RXD_P2_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE1_RXD_P1_2 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE1_RXD_P1_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#endif + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == LQFP64) +#define CAN_NODE0_RXD_P0_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P0_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P0_14 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE0_RXD_P0_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE0_RXD_P2_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE0_RXD_P2_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE0_RXD_P1_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE0_RXD_P1_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#define CAN_NODE1_RXD_P0_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P0_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P4_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P4_9 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_P2_10 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE1_RXD_P2_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE1_RXD_P1_2 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE1_RXD_P1_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#endif + +#if (UC_DEVICE == XMC4100) && (UC_PACKAGE == LQFP64) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + +#if (UC_DEVICE == XMC4100) && (UC_PACKAGE == LQFP64) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + +#if (UC_DEVICE == XMC4100) && (UC_PACKAGE == VQFN48) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + +#if (UC_DEVICE == XMC4108) && (UC_PACKAGE == LQFP64) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#endif + + +#if (UC_DEVICE == XMC4108) && (UC_PACKAGE == VQFN48) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#endif + + +#if (UC_DEVICE == XMC4200) && (UC_PACKAGE == LQFP64) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4200) && (UC_PACKAGE == VQFN48) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4400) && (UC_PACKAGE == LQFP100) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4400) && (UC_PACKAGE == LQFP64) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4402) && (UC_PACKAGE == LQFP100) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4402) && (UC_PACKAGE == LQFP64) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4500) && (UC_PACKAGE == BGA144) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P3_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P3_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE2_RXD_P1_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE2_RXD_P3_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE2_RXD_P4_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE2_RXD_CAN1INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4500) && (UC_PACKAGE == LQFP100) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE2_RXD_P1_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE2_RXD_CAN1INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4500) && (UC_PACKAGE == LQFP144) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P3_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P3_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE2_RXD_P1_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE2_RXD_P3_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE2_RXD_P4_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE2_RXD_CAN1INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4502) && (UC_PACKAGE == LQFP100) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE2_RXD_P1_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE2_RXD_CAN1INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + +#if (UC_DEVICE == XMC4800) && (UC_PACKAGE == LQFP144) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P3_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P3_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE2_RXD_P1_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE2_RXD_P3_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE2_RXD_P4_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE2_RXD_CAN1INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE3_RXD_P0_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE3_RXD_P6_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE4_RXD_P2_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE4_RXD_P14_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE5_RXD_P5_10 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE5_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#endif + +#if (UC_DEVICE == XMC4800) && (UC_PACKAGE == LQFP100) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P3_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE2_RXD_P1_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE2_RXD_CAN1INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE3_RXD_P0_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE3_RXD_P6_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE4_RXD_P2_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE4_RXD_P14_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE5_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#endif + +#if (UC_DEVICE == XMC4800) && (UC_PACKAGE == LFBGA196) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P3_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P3_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE2_RXD_P1_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE2_RXD_P3_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE2_RXD_P4_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE2_RXD_CAN1INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE3_RXD_P0_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE3_RXD_P6_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE3_RXD_P7_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE4_RXD_P2_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE4_RXD_P14_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE4_RXD_P7_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE5_RXD_P5_10 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE5_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE5_RXD_P8_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#endif + +#if (UC_DEVICE == XMC4300) && (UC_PACKAGE == LQFP100) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P3_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + +#if (UC_SERIES == XMC47) || (UC_SERIES == XMC48) || (UC_SERIES == XMC43)|| (UC_SERIES == XMC14) +#define CAN_MO0 ((CAN_MO_TypeDef *)&(CAN_MO->MO[0])) +#define CAN_MO1 ((CAN_MO_TypeDef *)&(CAN_MO->MO[1])) +#define CAN_MO2 ((CAN_MO_TypeDef *)&(CAN_MO->MO[2])) +#define CAN_MO3 ((CAN_MO_TypeDef *)&(CAN_MO->MO[3])) +#define CAN_MO4 ((CAN_MO_TypeDef *)&(CAN_MO->MO[4])) +#define CAN_MO5 ((CAN_MO_TypeDef *)&(CAN_MO->MO[5])) +#define CAN_MO6 ((CAN_MO_TypeDef *)&(CAN_MO->MO[6])) +#define CAN_MO7 ((CAN_MO_TypeDef *)&(CAN_MO->MO[7])) +#define CAN_MO8 ((CAN_MO_TypeDef *)&(CAN_MO->MO[8])) +#define CAN_MO9 ((CAN_MO_TypeDef *)&(CAN_MO->MO[9])) +#define CAN_MO10 ((CAN_MO_TypeDef *)&(CAN_MO->MO[10])) +#define CAN_MO11 ((CAN_MO_TypeDef *)&(CAN_MO->MO[11])) +#define CAN_MO12 ((CAN_MO_TypeDef *)&(CAN_MO->MO[12])) +#define CAN_MO13 ((CAN_MO_TypeDef *)&(CAN_MO->MO[13])) +#define CAN_MO14 ((CAN_MO_TypeDef *)&(CAN_MO->MO[14])) +#define CAN_MO15 ((CAN_MO_TypeDef *)&(CAN_MO->MO[15])) +#define CAN_MO16 ((CAN_MO_TypeDef *)&(CAN_MO->MO[16])) +#define CAN_MO17 ((CAN_MO_TypeDef *)&(CAN_MO->MO[17])) +#define CAN_MO18 ((CAN_MO_TypeDef *)&(CAN_MO->MO[18])) +#define CAN_MO19 ((CAN_MO_TypeDef *)&(CAN_MO->MO[19])) +#define CAN_MO20 ((CAN_MO_TypeDef *)&(CAN_MO->MO[20])) +#define CAN_MO21 ((CAN_MO_TypeDef *)&(CAN_MO->MO[21])) +#define CAN_MO22 ((CAN_MO_TypeDef *)&(CAN_MO->MO[22])) +#define CAN_MO23 ((CAN_MO_TypeDef *)&(CAN_MO->MO[23])) +#define CAN_MO24 ((CAN_MO_TypeDef *)&(CAN_MO->MO[24])) +#define CAN_MO25 ((CAN_MO_TypeDef *)&(CAN_MO->MO[25])) +#define CAN_MO26 ((CAN_MO_TypeDef *)&(CAN_MO->MO[26])) +#define CAN_MO27 ((CAN_MO_TypeDef *)&(CAN_MO->MO[27])) +#define CAN_MO28 ((CAN_MO_TypeDef *)&(CAN_MO->MO[28])) +#define CAN_MO29 ((CAN_MO_TypeDef *)&(CAN_MO->MO[29])) +#define CAN_MO30 ((CAN_MO_TypeDef *)&(CAN_MO->MO[30])) +#define CAN_MO31 ((CAN_MO_TypeDef *)&(CAN_MO->MO[31])) +#endif + + +#if (UC_SERIES == XMC47) || (UC_SERIES == XMC48)|| (UC_SERIES == XMC43) +#define CAN_MO32 ((CAN_MO_TypeDef *)&(CAN_MO->MO[32])) +#define CAN_MO33 ((CAN_MO_TypeDef *)&(CAN_MO->MO[33])) +#define CAN_MO34 ((CAN_MO_TypeDef *)&(CAN_MO->MO[34])) +#define CAN_MO35 ((CAN_MO_TypeDef *)&(CAN_MO->MO[35])) +#define CAN_MO36 ((CAN_MO_TypeDef *)&(CAN_MO->MO[36])) +#define CAN_MO37 ((CAN_MO_TypeDef *)&(CAN_MO->MO[37])) +#define CAN_MO38 ((CAN_MO_TypeDef *)&(CAN_MO->MO[38])) +#define CAN_MO39 ((CAN_MO_TypeDef *)&(CAN_MO->MO[39])) +#define CAN_MO40 ((CAN_MO_TypeDef *)&(CAN_MO->MO[40])) +#define CAN_MO41 ((CAN_MO_TypeDef *)&(CAN_MO->MO[41])) +#define CAN_MO42 ((CAN_MO_TypeDef *)&(CAN_MO->MO[42])) +#define CAN_MO43 ((CAN_MO_TypeDef *)&(CAN_MO->MO[43])) +#define CAN_MO44 ((CAN_MO_TypeDef *)&(CAN_MO->MO[44])) +#define CAN_MO45 ((CAN_MO_TypeDef *)&(CAN_MO->MO[45])) +#define CAN_MO46 ((CAN_MO_TypeDef *)&(CAN_MO->MO[46])) +#define CAN_MO47 ((CAN_MO_TypeDef *)&(CAN_MO->MO[47])) +#define CAN_MO48 ((CAN_MO_TypeDef *)&(CAN_MO->MO[48])) +#define CAN_MO49 ((CAN_MO_TypeDef *)&(CAN_MO->MO[49])) +#define CAN_MO50 ((CAN_MO_TypeDef *)&(CAN_MO->MO[50])) +#define CAN_MO51 ((CAN_MO_TypeDef *)&(CAN_MO->MO[51])) +#define CAN_MO52 ((CAN_MO_TypeDef *)&(CAN_MO->MO[52])) +#define CAN_MO53 ((CAN_MO_TypeDef *)&(CAN_MO->MO[53])) +#define CAN_MO54 ((CAN_MO_TypeDef *)&(CAN_MO->MO[54])) +#define CAN_MO55 ((CAN_MO_TypeDef *)&(CAN_MO->MO[55])) +#define CAN_MO56 ((CAN_MO_TypeDef *)&(CAN_MO->MO[56])) +#define CAN_MO57 ((CAN_MO_TypeDef *)&(CAN_MO->MO[57])) +#define CAN_MO58 ((CAN_MO_TypeDef *)&(CAN_MO->MO[58])) +#define CAN_MO59 ((CAN_MO_TypeDef *)&(CAN_MO->MO[59])) +#define CAN_MO60 ((CAN_MO_TypeDef *)&(CAN_MO->MO[60])) +#define CAN_MO61 ((CAN_MO_TypeDef *)&(CAN_MO->MO[61])) +#define CAN_MO62 ((CAN_MO_TypeDef *)&(CAN_MO->MO[62])) +#define CAN_MO63 ((CAN_MO_TypeDef *)&(CAN_MO->MO[63])) +#if (UC_SERIES != XMC43) +#define CAN_MO64 ((CAN_MO_TypeDef *)&(CAN_MO->MO[64])) +#define CAN_MO65 ((CAN_MO_TypeDef *)&(CAN_MO->MO[65])) +#define CAN_MO66 ((CAN_MO_TypeDef *)&(CAN_MO->MO[66])) +#define CAN_MO67 ((CAN_MO_TypeDef *)&(CAN_MO->MO[67])) +#define CAN_MO68 ((CAN_MO_TypeDef *)&(CAN_MO->MO[68])) +#define CAN_MO69 ((CAN_MO_TypeDef *)&(CAN_MO->MO[69])) +#define CAN_MO70 ((CAN_MO_TypeDef *)&(CAN_MO->MO[70])) +#define CAN_MO71 ((CAN_MO_TypeDef *)&(CAN_MO->MO[71])) +#define CAN_MO72 ((CAN_MO_TypeDef *)&(CAN_MO->MO[72])) +#define CAN_MO73 ((CAN_MO_TypeDef *)&(CAN_MO->MO[73])) +#define CAN_MO74 ((CAN_MO_TypeDef *)&(CAN_MO->MO[74])) +#define CAN_MO75 ((CAN_MO_TypeDef *)&(CAN_MO->MO[75])) +#define CAN_MO76 ((CAN_MO_TypeDef *)&(CAN_MO->MO[76])) +#define CAN_MO77 ((CAN_MO_TypeDef *)&(CAN_MO->MO[77])) +#define CAN_MO78 ((CAN_MO_TypeDef *)&(CAN_MO->MO[78])) +#define CAN_MO79 ((CAN_MO_TypeDef *)&(CAN_MO->MO[79])) +#define CAN_MO80 ((CAN_MO_TypeDef *)&(CAN_MO->MO[80])) +#define CAN_MO81 ((CAN_MO_TypeDef *)&(CAN_MO->MO[81])) +#define CAN_MO82 ((CAN_MO_TypeDef *)&(CAN_MO->MO[82])) +#define CAN_MO83 ((CAN_MO_TypeDef *)&(CAN_MO->MO[83])) +#define CAN_MO84 ((CAN_MO_TypeDef *)&(CAN_MO->MO[84])) +#define CAN_MO85 ((CAN_MO_TypeDef *)&(CAN_MO->MO[85])) +#define CAN_MO86 ((CAN_MO_TypeDef *)&(CAN_MO->MO[86])) +#define CAN_MO87 ((CAN_MO_TypeDef *)&(CAN_MO->MO[87])) +#define CAN_MO88 ((CAN_MO_TypeDef *)&(CAN_MO->MO[88])) +#define CAN_MO89 ((CAN_MO_TypeDef *)&(CAN_MO->MO[89])) +#define CAN_MO90 ((CAN_MO_TypeDef *)&(CAN_MO->MO[90])) +#define CAN_MO91 ((CAN_MO_TypeDef *)&(CAN_MO->MO[91])) +#define CAN_MO92 ((CAN_MO_TypeDef *)&(CAN_MO->MO[92])) +#define CAN_MO93 ((CAN_MO_TypeDef *)&(CAN_MO->MO[93])) +#define CAN_MO94 ((CAN_MO_TypeDef *)&(CAN_MO->MO[94])) +#define CAN_MO95 ((CAN_MO_TypeDef *)&(CAN_MO->MO[95])) +#define CAN_MO96 ((CAN_MO_TypeDef *)&(CAN_MO->MO[96])) +#define CAN_MO97 ((CAN_MO_TypeDef *)&(CAN_MO->MO[97])) +#define CAN_MO98 ((CAN_MO_TypeDef *)&(CAN_MO->MO[98])) +#define CAN_MO99 ((CAN_MO_TypeDef *)&(CAN_MO->MO[99])) +#define CAN_MO100 ((CAN_MO_TypeDef *)&(CAN_MO->MO[100])) +#define CAN_MO101 ((CAN_MO_TypeDef *)&(CAN_MO->MO[101])) +#define CAN_MO102 ((CAN_MO_TypeDef *)&(CAN_MO->MO[102])) +#define CAN_MO103 ((CAN_MO_TypeDef *)&(CAN_MO->MO[103])) +#define CAN_MO104 ((CAN_MO_TypeDef *)&(CAN_MO->MO[104])) +#define CAN_MO105 ((CAN_MO_TypeDef *)&(CAN_MO->MO[105])) +#define CAN_MO106 ((CAN_MO_TypeDef *)&(CAN_MO->MO[106])) +#define CAN_MO107 ((CAN_MO_TypeDef *)&(CAN_MO->MO[107])) +#define CAN_MO108 ((CAN_MO_TypeDef *)&(CAN_MO->MO[108])) +#define CAN_MO109 ((CAN_MO_TypeDef *)&(CAN_MO->MO[109])) +#define CAN_MO110 ((CAN_MO_TypeDef *)&(CAN_MO->MO[110])) +#define CAN_MO111 ((CAN_MO_TypeDef *)&(CAN_MO->MO[111])) +#define CAN_MO112 ((CAN_MO_TypeDef *)&(CAN_MO->MO[112])) +#define CAN_MO113 ((CAN_MO_TypeDef *)&(CAN_MO->MO[113])) +#define CAN_MO114 ((CAN_MO_TypeDef *)&(CAN_MO->MO[114])) +#define CAN_MO115 ((CAN_MO_TypeDef *)&(CAN_MO->MO[115])) +#define CAN_MO116 ((CAN_MO_TypeDef *)&(CAN_MO->MO[116])) +#define CAN_MO117 ((CAN_MO_TypeDef *)&(CAN_MO->MO[117])) +#define CAN_MO118 ((CAN_MO_TypeDef *)&(CAN_MO->MO[118])) +#define CAN_MO119 ((CAN_MO_TypeDef *)&(CAN_MO->MO[119])) +#define CAN_MO120 ((CAN_MO_TypeDef *)&(CAN_MO->MO[120])) +#define CAN_MO121 ((CAN_MO_TypeDef *)&(CAN_MO->MO[121])) +#define CAN_MO122 ((CAN_MO_TypeDef *)&(CAN_MO->MO[122])) +#define CAN_MO123 ((CAN_MO_TypeDef *)&(CAN_MO->MO[123])) +#define CAN_MO124 ((CAN_MO_TypeDef *)&(CAN_MO->MO[124])) +#define CAN_MO125 ((CAN_MO_TypeDef *)&(CAN_MO->MO[125])) +#define CAN_MO126 ((CAN_MO_TypeDef *)&(CAN_MO->MO[126])) +#define CAN_MO127 ((CAN_MO_TypeDef *)&(CAN_MO->MO[127])) +#define CAN_MO128 ((CAN_MO_TypeDef *)&(CAN_MO->MO[128])) +#define CAN_MO129 ((CAN_MO_TypeDef *)&(CAN_MO->MO[129])) +#define CAN_MO130 ((CAN_MO_TypeDef *)&(CAN_MO->MO[130])) +#define CAN_MO131 ((CAN_MO_TypeDef *)&(CAN_MO->MO[131])) +#define CAN_MO132 ((CAN_MO_TypeDef *)&(CAN_MO->MO[132])) +#define CAN_MO133 ((CAN_MO_TypeDef *)&(CAN_MO->MO[133])) +#define CAN_MO134 ((CAN_MO_TypeDef *)&(CAN_MO->MO[134])) +#define CAN_MO135 ((CAN_MO_TypeDef *)&(CAN_MO->MO[135])) +#define CAN_MO136 ((CAN_MO_TypeDef *)&(CAN_MO->MO[136])) +#define CAN_MO137 ((CAN_MO_TypeDef *)&(CAN_MO->MO[137])) +#define CAN_MO138 ((CAN_MO_TypeDef *)&(CAN_MO->MO[138])) +#define CAN_MO139 ((CAN_MO_TypeDef *)&(CAN_MO->MO[139])) +#define CAN_MO140 ((CAN_MO_TypeDef *)&(CAN_MO->MO[140])) +#define CAN_MO141 ((CAN_MO_TypeDef *)&(CAN_MO->MO[141])) +#define CAN_MO142 ((CAN_MO_TypeDef *)&(CAN_MO->MO[142])) +#define CAN_MO143 ((CAN_MO_TypeDef *)&(CAN_MO->MO[143])) +#define CAN_MO144 ((CAN_MO_TypeDef *)&(CAN_MO->MO[144])) +#define CAN_MO145 ((CAN_MO_TypeDef *)&(CAN_MO->MO[145])) +#define CAN_MO146 ((CAN_MO_TypeDef *)&(CAN_MO->MO[146])) +#define CAN_MO147 ((CAN_MO_TypeDef *)&(CAN_MO->MO[147])) +#define CAN_MO148 ((CAN_MO_TypeDef *)&(CAN_MO->MO[148])) +#define CAN_MO149 ((CAN_MO_TypeDef *)&(CAN_MO->MO[149])) +#define CAN_MO150 ((CAN_MO_TypeDef *)&(CAN_MO->MO[150])) +#define CAN_MO151 ((CAN_MO_TypeDef *)&(CAN_MO->MO[151])) +#define CAN_MO152 ((CAN_MO_TypeDef *)&(CAN_MO->MO[152])) +#define CAN_MO153 ((CAN_MO_TypeDef *)&(CAN_MO->MO[153])) +#define CAN_MO154 ((CAN_MO_TypeDef *)&(CAN_MO->MO[154])) +#define CAN_MO155 ((CAN_MO_TypeDef *)&(CAN_MO->MO[155])) +#define CAN_MO156 ((CAN_MO_TypeDef *)&(CAN_MO->MO[156])) +#define CAN_MO157 ((CAN_MO_TypeDef *)&(CAN_MO->MO[157])) +#define CAN_MO158 ((CAN_MO_TypeDef *)&(CAN_MO->MO[158])) +#define CAN_MO159 ((CAN_MO_TypeDef *)&(CAN_MO->MO[159])) +#define CAN_MO160 ((CAN_MO_TypeDef *)&(CAN_MO->MO[160])) +#define CAN_MO161 ((CAN_MO_TypeDef *)&(CAN_MO->MO[161])) +#define CAN_MO162 ((CAN_MO_TypeDef *)&(CAN_MO->MO[162])) +#define CAN_MO163 ((CAN_MO_TypeDef *)&(CAN_MO->MO[163])) +#define CAN_MO164 ((CAN_MO_TypeDef *)&(CAN_MO->MO[164])) +#define CAN_MO165 ((CAN_MO_TypeDef *)&(CAN_MO->MO[165])) +#define CAN_MO166 ((CAN_MO_TypeDef *)&(CAN_MO->MO[166])) +#define CAN_MO167 ((CAN_MO_TypeDef *)&(CAN_MO->MO[167])) +#define CAN_MO168 ((CAN_MO_TypeDef *)&(CAN_MO->MO[168])) +#define CAN_MO169 ((CAN_MO_TypeDef *)&(CAN_MO->MO[169])) +#define CAN_MO170 ((CAN_MO_TypeDef *)&(CAN_MO->MO[170])) +#define CAN_MO171 ((CAN_MO_TypeDef *)&(CAN_MO->MO[171])) +#define CAN_MO172 ((CAN_MO_TypeDef *)&(CAN_MO->MO[172])) +#define CAN_MO173 ((CAN_MO_TypeDef *)&(CAN_MO->MO[173])) +#define CAN_MO174 ((CAN_MO_TypeDef *)&(CAN_MO->MO[174])) +#define CAN_MO175 ((CAN_MO_TypeDef *)&(CAN_MO->MO[175])) +#define CAN_MO176 ((CAN_MO_TypeDef *)&(CAN_MO->MO[176])) +#define CAN_MO177 ((CAN_MO_TypeDef *)&(CAN_MO->MO[177])) +#define CAN_MO178 ((CAN_MO_TypeDef *)&(CAN_MO->MO[178])) +#define CAN_MO179 ((CAN_MO_TypeDef *)&(CAN_MO->MO[179])) +#define CAN_MO180 ((CAN_MO_TypeDef *)&(CAN_MO->MO[180])) +#define CAN_MO181 ((CAN_MO_TypeDef *)&(CAN_MO->MO[181])) +#define CAN_MO182 ((CAN_MO_TypeDef *)&(CAN_MO->MO[182])) +#define CAN_MO183 ((CAN_MO_TypeDef *)&(CAN_MO->MO[183])) +#define CAN_MO184 ((CAN_MO_TypeDef *)&(CAN_MO->MO[184])) +#define CAN_MO185 ((CAN_MO_TypeDef *)&(CAN_MO->MO[185])) +#define CAN_MO186 ((CAN_MO_TypeDef *)&(CAN_MO->MO[186])) +#define CAN_MO187 ((CAN_MO_TypeDef *)&(CAN_MO->MO[187])) +#define CAN_MO188 ((CAN_MO_TypeDef *)&(CAN_MO->MO[188])) +#define CAN_MO189 ((CAN_MO_TypeDef *)&(CAN_MO->MO[189])) +#define CAN_MO190 ((CAN_MO_TypeDef *)&(CAN_MO->MO[190])) +#define CAN_MO191 ((CAN_MO_TypeDef *)&(CAN_MO->MO[191])) +#define CAN_MO192 ((CAN_MO_TypeDef *)&(CAN_MO->MO[192])) +#define CAN_MO193 ((CAN_MO_TypeDef *)&(CAN_MO->MO[193])) +#define CAN_MO194 ((CAN_MO_TypeDef *)&(CAN_MO->MO[194])) +#define CAN_MO195 ((CAN_MO_TypeDef *)&(CAN_MO->MO[195])) +#define CAN_MO196 ((CAN_MO_TypeDef *)&(CAN_MO->MO[196])) +#define CAN_MO197 ((CAN_MO_TypeDef *)&(CAN_MO->MO[197])) +#define CAN_MO198 ((CAN_MO_TypeDef *)&(CAN_MO->MO[198])) +#define CAN_MO199 ((CAN_MO_TypeDef *)&(CAN_MO->MO[199])) +#define CAN_MO200 ((CAN_MO_TypeDef *)&(CAN_MO->MO[200])) +#define CAN_MO201 ((CAN_MO_TypeDef *)&(CAN_MO->MO[201])) +#define CAN_MO202 ((CAN_MO_TypeDef *)&(CAN_MO->MO[202])) +#define CAN_MO203 ((CAN_MO_TypeDef *)&(CAN_MO->MO[203])) +#define CAN_MO204 ((CAN_MO_TypeDef *)&(CAN_MO->MO[204])) +#define CAN_MO205 ((CAN_MO_TypeDef *)&(CAN_MO->MO[205])) +#define CAN_MO206 ((CAN_MO_TypeDef *)&(CAN_MO->MO[206])) +#define CAN_MO207 ((CAN_MO_TypeDef *)&(CAN_MO->MO[207])) +#define CAN_MO208 ((CAN_MO_TypeDef *)&(CAN_MO->MO[208])) +#define CAN_MO209 ((CAN_MO_TypeDef *)&(CAN_MO->MO[209])) +#define CAN_MO210 ((CAN_MO_TypeDef *)&(CAN_MO->MO[210])) +#define CAN_MO211 ((CAN_MO_TypeDef *)&(CAN_MO->MO[211])) +#define CAN_MO212 ((CAN_MO_TypeDef *)&(CAN_MO->MO[212])) +#define CAN_MO213 ((CAN_MO_TypeDef *)&(CAN_MO->MO[213])) +#define CAN_MO214 ((CAN_MO_TypeDef *)&(CAN_MO->MO[214])) +#define CAN_MO215 ((CAN_MO_TypeDef *)&(CAN_MO->MO[215])) +#define CAN_MO216 ((CAN_MO_TypeDef *)&(CAN_MO->MO[216])) +#define CAN_MO217 ((CAN_MO_TypeDef *)&(CAN_MO->MO[217])) +#define CAN_MO218 ((CAN_MO_TypeDef *)&(CAN_MO->MO[218])) +#define CAN_MO219 ((CAN_MO_TypeDef *)&(CAN_MO->MO[219])) +#define CAN_MO220 ((CAN_MO_TypeDef *)&(CAN_MO->MO[220])) +#define CAN_MO221 ((CAN_MO_TypeDef *)&(CAN_MO->MO[221])) +#define CAN_MO222 ((CAN_MO_TypeDef *)&(CAN_MO->MO[222])) +#define CAN_MO223 ((CAN_MO_TypeDef *)&(CAN_MO->MO[223])) +#define CAN_MO224 ((CAN_MO_TypeDef *)&(CAN_MO->MO[224])) +#define CAN_MO225 ((CAN_MO_TypeDef *)&(CAN_MO->MO[225])) +#define CAN_MO226 ((CAN_MO_TypeDef *)&(CAN_MO->MO[226])) +#define CAN_MO227 ((CAN_MO_TypeDef *)&(CAN_MO->MO[227])) +#define CAN_MO228 ((CAN_MO_TypeDef *)&(CAN_MO->MO[228])) +#define CAN_MO229 ((CAN_MO_TypeDef *)&(CAN_MO->MO[229])) +#define CAN_MO230 ((CAN_MO_TypeDef *)&(CAN_MO->MO[230])) +#define CAN_MO231 ((CAN_MO_TypeDef *)&(CAN_MO->MO[231])) +#define CAN_MO232 ((CAN_MO_TypeDef *)&(CAN_MO->MO[232])) +#define CAN_MO233 ((CAN_MO_TypeDef *)&(CAN_MO->MO[233])) +#define CAN_MO234 ((CAN_MO_TypeDef *)&(CAN_MO->MO[234])) +#define CAN_MO235 ((CAN_MO_TypeDef *)&(CAN_MO->MO[235])) +#define CAN_MO236 ((CAN_MO_TypeDef *)&(CAN_MO->MO[236])) +#define CAN_MO237 ((CAN_MO_TypeDef *)&(CAN_MO->MO[237])) +#define CAN_MO238 ((CAN_MO_TypeDef *)&(CAN_MO->MO[238])) +#define CAN_MO239 ((CAN_MO_TypeDef *)&(CAN_MO->MO[239])) +#define CAN_MO240 ((CAN_MO_TypeDef *)&(CAN_MO->MO[240])) +#define CAN_MO241 ((CAN_MO_TypeDef *)&(CAN_MO->MO[241])) +#define CAN_MO242 ((CAN_MO_TypeDef *)&(CAN_MO->MO[242])) +#define CAN_MO243 ((CAN_MO_TypeDef *)&(CAN_MO->MO[243])) +#define CAN_MO244 ((CAN_MO_TypeDef *)&(CAN_MO->MO[244])) +#define CAN_MO245 ((CAN_MO_TypeDef *)&(CAN_MO->MO[245])) +#define CAN_MO246 ((CAN_MO_TypeDef *)&(CAN_MO->MO[246])) +#define CAN_MO247 ((CAN_MO_TypeDef *)&(CAN_MO->MO[247])) +#define CAN_MO248 ((CAN_MO_TypeDef *)&(CAN_MO->MO[248])) +#define CAN_MO249 ((CAN_MO_TypeDef *)&(CAN_MO->MO[249])) +#define CAN_MO250 ((CAN_MO_TypeDef *)&(CAN_MO->MO[250])) +#define CAN_MO251 ((CAN_MO_TypeDef *)&(CAN_MO->MO[251])) +#define CAN_MO252 ((CAN_MO_TypeDef *)&(CAN_MO->MO[252])) +#define CAN_MO253 ((CAN_MO_TypeDef *)&(CAN_MO->MO[253])) +#define CAN_MO254 ((CAN_MO_TypeDef *)&(CAN_MO->MO[254])) +#define CAN_MO255 ((CAN_MO_TypeDef *)&(CAN_MO->MO[255])) +#endif +#endif + +#endif /* XMC_CAN_MAP_H*/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_ccu4.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_ccu4.h new file mode 100644 index 00000000..5d5c02c8 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_ccu4.h @@ -0,0 +1,2386 @@ +/** + * @file xmc_ccu4.h + * @date 2016-05-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * - Documentation updates
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-07-22: + * - XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent() is updated to support XMC14 device.
+ * + * 2015-08-17: + * - XMC_CCU4_SLICE_PRESCALER_t enum is added to set the prescaler divider.
+ * - XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_t enum item names are updated according to the guidelines.
+ * - XMC_CCU4_EnableShadowTransfer() API is made as inline, to improve the speed.
+ * + * 2015-09-29: + * - In XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_t, two more enum items are added to support external count direction + * settings. + * + * 2015-10-07: + * - XMC_CCU4_SLICE_GetEvent() is made as inline. + * - XMC_CCU4_SLICE_MULTI_IRQ_ID_t is added to support the XMC_CCU4_SLICE_EnableMultipleEvents() and + * XMC_CCU4_SLICE_DisableMultipleEvents() APIs. + * - DOC updates for the newly added APIs. + * + * 2016-03-09: + * - Optimization of write only registers + * + * 2016-05-20: + * - Added XMC_CCU4_SLICE_StopClearTimer() + * - Changed implementation of XMC_CCU4_SLICE_StopTimer() and XMC_CCU4_SLICE_ClearTimer() to avoid RMW access + * + * @endcond + */ + +#ifndef XMC_CCU4_H +#define XMC_CCU4_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include "xmc_common.h" +#if defined(CCU40) + +#if UC_FAMILY == XMC1 + #include "xmc1_ccu4_map.h" +#endif + +#if UC_FAMILY == XMC4 + #include "xmc4_ccu4_map.h" +#endif + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup CCU4 + * @brief Capture Compare Unit 4 (CCU4) low level driver for XMC family of microcontrollers
+ * + * The CCU4 peripheral is a major component for systems that need general purpose timers for signal + * monitoring/conditioning and Pulse Width Modulation (PWM) signal generation. Power electronic control systems like + * switched mode power supplies or interruptible power supplies, can easily be implemented with the functions inside the + * CCU4 peripheral.\n + * Each CCU4 module is comprised of four identical 16 bit Capture/Compare Timer slices, CC4y (where y = [0..4]). Each + * timer slice can work in compare mode or in capture mode. + * + * APIs provided in this file cover the following functional blocks of CCU4:\n + * -- Timer configuration, Capture configuration, Function/Event configuration, Interrupt configuration\n + * \par Note: + * 1. SLICE (APIs prefixed with e.g. XMC_CCU4_SLICE_) + * 2. Module (APIs are not having any prefix e.g. XMC_CCU4_) + * + * \par Timer(Compare mode) configuration: + * This section of the LLD provides the configuration structure XMC_CCU4_SLICE_COMPARE_CONFIG_t and the initialization + * function XMC_CCU4_SLICE_CompareInit(). + * + * It can be used to: + * -# Start and Stop the timer. (XMC_CCU4_SLICE_StartTimer(), XMC_CCU4_SLICE_StopTimer()) + * -# Update the period, compare, Dither, Prescaler and Passive values. (XMC_CCU4_SLICE_SetTimerPeriodMatch(), + * XMC_CCU4_SLICE_SetTimerCompareMatch(), XMC_CCU4_SLICE_SetPrescaler(), XMC_CCU4_SLICE_SetDitherCompareValue(), + * XMC_CCU4_SLICE_SetPassiveLevel()) + * -# Enable the slices to support multichannel mode. (XMC_CCU4_SLICE_EnableMultiChannelMode()) + * + * \par Capture configuration: + * This section of the LLD provides the configuration structure XMC_CCU4_SLICE_CAPTURE_CONFIG_t and the initialization + * function XMC_CCU4_SLICE_CaptureInit(). + * + * It can be used to: + * -# Configure the capture functionality. (XMC_CCU4_SLICE_Capture0Config(), XMC_CCU4_SLICE_Capture1Config()) + * -# Read the captured values along with the status, which indicate the value is latest or not. + * (XMC_CCU4_SLICE_GetCaptureRegisterValue()) + * + * \par Function/Event configuration: + * This section of the LLD provides the configuration structure XMC_CCU4_SLICE_EVENT_CONFIG_t.\n + * + * It can be used to: + * -# Enable and Disable the events. (XMC_CCU4_SLICE_EnableEvent(), XMC_CCU4_SLICE_DisableEvent()) + * -# Configure to start and stop the timer on external events.(XMC_CCU4_SLICE_StartConfig(), XMC_CCU4_SLICE_StopConfig()) + * -# Modulation, external load and Gating of the timer output.(XMC_CCU4_SLICE_ModulationConfig(), + * XMC_CCU4_SLICE_LoadConfig(), XMC_CCU4_SLICE_GateConfig()) + * -# Control the count direction of the timer based on the external event. (XMC_CCU4_SLICE_DirectionConfig()) + * -# Count the external events.(XMC_CCU4_SLICE_CountConfig()) + * -# External Trap. Which can be used as protective feature.(XMC_CCU4_SLICE_EnableTrap(), XMC_CCU4_SLICE_DisableTrap(), + * XMC_CCU4_SLICE_TrapConfig()) + * + * \par Interrupt configuration: + * This section of the LLD provides the function to configure the interrupt node to each event (XMC_CCU4_SLICE_SetInterruptNode()) + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +/* Macro to check if the interrupt enum passed is valid */ +#define XMC_CCU4_SLICE_CHECK_INTERRUPT(interrupt) \ + ((interrupt == XMC_CCU4_SLICE_IRQ_ID_PERIOD_MATCH) || \ + (interrupt == XMC_CCU4_SLICE_IRQ_ID_ONE_MATCH) || \ + (interrupt == XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_UP) || \ + (interrupt == XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_DOWN)|| \ + (interrupt == XMC_CCU4_SLICE_IRQ_ID_EVENT0) || \ + (interrupt == XMC_CCU4_SLICE_IRQ_ID_EVENT1) || \ + (interrupt == XMC_CCU4_SLICE_IRQ_ID_EVENT2) || \ + (interrupt == XMC_CCU4_SLICE_IRQ_ID_TRAP)) + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/** + * Typedef for CCU4 Global data structure + */ +typedef CCU4_GLOBAL_TypeDef XMC_CCU4_MODULE_t; + +/** + * Typedef for CCU4 Slice data structure + */ +typedef CCU4_CC4_TypeDef XMC_CCU4_SLICE_t; + +/** + * Return Value of an API + */ +typedef enum XMC_CCU4_STATUS +{ + XMC_CCU4_STATUS_OK = 0U, /**< API fulfils request */ + XMC_CCU4_STATUS_ERROR , /**< API cannot fulfil the request */ + XMC_CCU4_STATUS_RUNNING , /**< The timer slice is currently running */ + XMC_CCU4_STATUS_IDLE /**< The timer slice is currently idle */ +} XMC_CCU4_STATUS_t; + +/** + * CCU4 module clock + */ +typedef enum XMC_CCU4_CLOCK +{ + XMC_CCU4_CLOCK_SCU = 0U, /**< Select the fCCU as the clock */ + XMC_CCU4_CLOCK_EXTERNAL_A , /**< External clock-A */ + XMC_CCU4_CLOCK_EXTERNAL_B , /**< External clock-B */ + XMC_CCU4_CLOCK_EXTERNAL_C /**< External clock-C */ +} XMC_CCU4_CLOCK_t; + +/** + * CCU4 set the shadow transfer type for multichannel mode + */ +typedef enum XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER +{ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE0 = (uint32_t)0x4000000, /**< Shadow transfer through software + only for slice 0*/ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE0 = (uint32_t)0x4000400, /**< Shadow transfer through software + and hardware for slice 0 */ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE1 = (uint32_t)0x8000000, /**< Shadow transfer through software + only for slice 1*/ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE1 = (uint32_t)0x8000800, /**< Shadow transfer through software + and hardware for slice 1 */ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE2 = (uint32_t)0x10000000, /**< Shadow transfer through software + only for slice 2 */ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE2 = (uint32_t)0x10001000, /**< Shadow transfer through software + and hardware for slice 2 */ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE3 = (uint32_t)0x20000000, /**< Shadow transfer through software + only for slice 3*/ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE3 = (uint32_t)0x20002000 /**< Shadow transfer through software + and hardware for slice 3 */ +} XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_t; + +/** + * Operational modes of CCU4 slice + */ +typedef enum XMC_CCU4_SLICE_MODE +{ + XMC_CCU4_SLICE_MODE_COMPARE = 0U, /**< slice(CC4y) operates in Compare Mode */ + XMC_CCU4_SLICE_MODE_CAPTURE /**< slice(CC4y) operates in Capture Mode */ +} XMC_CCU4_SLICE_MODE_t; + +/** + * Timer counting modes for the slice + */ +typedef enum XMC_CCU4_SLICE_TIMER_COUNT_MODE +{ + XMC_CCU4_SLICE_TIMER_COUNT_MODE_EA = 0U, /**< Edge Aligned Mode */ + XMC_CCU4_SLICE_TIMER_COUNT_MODE_CA /**< Center Aligned Mode */ +} XMC_CCU4_SLICE_TIMER_COUNT_MODE_t; + +/** + * Timer repetition mode for the slice + */ +typedef enum XMC_CCU4_SLICE_TIMER_REPEAT_MODE +{ + XMC_CCU4_SLICE_TIMER_REPEAT_MODE_REPEAT = 0U, /**< Repetitive mode: continuous mode of operation */ + XMC_CCU4_SLICE_TIMER_REPEAT_MODE_SINGLE /**< Single shot mode: Once a Period match/One match + occurs timer goes to idle state */ +} XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t; + +/** + * Timer counting direction for the CCU4 slice + */ +typedef enum XMC_CCU4_SLICE_TIMER_COUNT_DIR +{ + XMC_CCU4_SLICE_TIMER_COUNT_DIR_UP = 0U, /**< Counting up */ + XMC_CCU4_SLICE_TIMER_COUNT_DIR_DOWN /**< Counting down */ +} XMC_CCU4_SLICE_TIMER_COUNT_DIR_t; + +/** + * Capture mode register sets + */ +typedef enum XMC_CCU4_SLICE_CAP_REG_SET +{ + XMC_CCU4_SLICE_CAP_REG_SET_LOW = 0U, /**< Capture register-0, Capture register-1 used */ + XMC_CCU4_SLICE_CAP_REG_SET_HIGH /**< Capture register-2, Capture register-3 used */ +} XMC_CCU4_SLICE_CAP_REG_SET_t; + +/** + * Prescaler mode + */ +typedef enum XMC_CCU4_SLICE_PRESCALER_MODE +{ + XMC_CCU4_SLICE_PRESCALER_MODE_NORMAL = 0U, /**< Fixed division of module clock */ + XMC_CCU4_SLICE_PRESCALER_MODE_FLOAT /**< Floating divider. */ +} XMC_CCU4_SLICE_PRESCALER_MODE_t; + +/** + * Timer output passive level + */ +typedef enum XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL +{ + XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_LOW = 0U, /**< Passive level = Low */ + XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_HIGH /**< Passive level = High */ +} XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_t; + +/** + * Timer clock Divider + */ +typedef enum XMC_CCU4_SLICE_PRESCALER +{ + XMC_CCU4_SLICE_PRESCALER_1 = 0U, /**< Slice Clock = fccu4 */ + XMC_CCU4_SLICE_PRESCALER_2 , /**< Slice Clock = fccu4/2 */ + XMC_CCU4_SLICE_PRESCALER_4 , /**< Slice Clock = fccu4/4 */ + XMC_CCU4_SLICE_PRESCALER_8 , /**< Slice Clock = fccu4/8 */ + XMC_CCU4_SLICE_PRESCALER_16 , /**< Slice Clock = fccu4/16 */ + XMC_CCU4_SLICE_PRESCALER_32 , /**< Slice Clock = fccu4/32 */ + XMC_CCU4_SLICE_PRESCALER_64 , /**< Slice Clock = fccu4/64 */ + XMC_CCU4_SLICE_PRESCALER_128 , /**< Slice Clock = fccu4/128 */ + XMC_CCU4_SLICE_PRESCALER_256 , /**< Slice Clock = fccu4/256 */ + XMC_CCU4_SLICE_PRESCALER_512 , /**< Slice Clock = fccu4/512 */ + XMC_CCU4_SLICE_PRESCALER_1024 , /**< Slice Clock = fccu4/1024 */ + XMC_CCU4_SLICE_PRESCALER_2048 , /**< Slice Clock = fccu4/2048 */ + XMC_CCU4_SLICE_PRESCALER_4096 , /**< Slice Clock = fccu4/4096 */ + XMC_CCU4_SLICE_PRESCALER_8192 , /**< Slice Clock = fccu4/8192 */ + XMC_CCU4_SLICE_PRESCALER_16384 , /**< Slice Clock = fccu4/16384 */ + XMC_CCU4_SLICE_PRESCALER_32768 /**< Slice Clock = fccu4/32768 */ +} XMC_CCU4_SLICE_PRESCALER_t; + +/** + * External Function list + */ +typedef enum XMC_CCU4_SLICE_FUNCTION +{ + XMC_CCU4_SLICE_FUNCTION_START = 0U, /**< Start function */ + XMC_CCU4_SLICE_FUNCTION_STOP , /**< Stop function */ + XMC_CCU4_SLICE_FUNCTION_CAPTURE_EVENT0 , /**< Capture Event-0 function, CCycapt0 signal is used for event + generation */ + XMC_CCU4_SLICE_FUNCTION_CAPTURE_EVENT1 , /**< Capture Event-1 function, CCycapt1 signal is used for event + generation */ + XMC_CCU4_SLICE_FUNCTION_GATING , /**< Gating function */ + XMC_CCU4_SLICE_FUNCTION_DIRECTION , /**< Direction function */ + XMC_CCU4_SLICE_FUNCTION_LOAD , /**< Load function */ + XMC_CCU4_SLICE_FUNCTION_COUNT , /**< Counting function */ + XMC_CCU4_SLICE_FUNCTION_OVERRIDE , /**< Override function */ + XMC_CCU4_SLICE_FUNCTION_MODULATION , /**< Modulation function */ + XMC_CCU4_SLICE_FUNCTION_TRAP /**< Trap function */ +} XMC_CCU4_SLICE_FUNCTION_t; + +/** + * External Event list + */ +typedef enum XMC_CCU4_SLICE_EVENT +{ + XMC_CCU4_SLICE_EVENT_NONE = 0U, /**< None */ + XMC_CCU4_SLICE_EVENT_0 , /**< Event-0 */ + XMC_CCU4_SLICE_EVENT_1 , /**< Event-1 */ + XMC_CCU4_SLICE_EVENT_2 /**< Event-2 */ +} XMC_CCU4_SLICE_EVENT_t; + +/** + * External Event trigger criteria - Edge sensitivity + */ +typedef enum XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY +{ + XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_NONE = 0U, /**< None */ + XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_RISING_EDGE , /**< Rising Edge of the input signal generates event trigger*/ + XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_FALLING_EDGE , /**< Falling Edge of the input signal generates event + trigger */ + XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_DUAL_EDGE /**< Both Rising and Falling edges cause an event trigger*/ +} XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_t; + +/** + * External Event trigger criteria - Level sensitivity + */ +typedef enum XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY +{ + XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH = 0U, /**< Level sensitive functions react to a high signal level*/ + XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW = 1U, /**< Level sensitive functions react to a low signal level*/ + /* Below enum items can be utilised specific to the functionality */ + XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_COUNT_UP_ON_LOW = 0U, /**< Timer counts up, during Low state of the control signal */ + XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_COUNT_UP_ON_HIGH = 1U /**< Timer counts up, during High state of the control signal */ +} XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_t; + +/** + * Low pass filter Configuration. The External Event input should be stable for a selected number of clock cycles. + */ +typedef enum XMC_CCU4_SLICE_EVENT_FILTER +{ + XMC_CCU4_SLICE_EVENT_FILTER_DISABLED = 0U, /**< No Low Pass Filter */ + XMC_CCU4_SLICE_EVENT_FILTER_3_CYCLES , /**< 3 clock cycles */ + XMC_CCU4_SLICE_EVENT_FILTER_5_CYCLES , /**< 5 clock cycles */ + XMC_CCU4_SLICE_EVENT_FILTER_7_CYCLES /**< 7 clock cycles */ +} XMC_CCU4_SLICE_EVENT_FILTER_t; + +/** + * External Event Input list. This list depicts the possible input connections to the CCU4 slice. + * Interconnects are specific to each device. + */ +typedef uint8_t XMC_CCU4_SLICE_INPUT_t; + +/** + * Actions that can be performed upon detection of an external Timer STOP event + */ +typedef enum XMC_CCU4_SLICE_END_MODE +{ + XMC_CCU4_SLICE_END_MODE_TIMER_STOP = 0U, /**< Stops the timer, without clearing TIMER register */ + XMC_CCU4_SLICE_END_MODE_TIMER_CLEAR , /**< Without stopping timer, clears the TIMER register */ + XMC_CCU4_SLICE_END_MODE_TIMER_STOP_CLEAR /**< Stops the timer and clears the TIMER register */ +} XMC_CCU4_SLICE_END_MODE_t; + +/** + * Actions that can be performed upon detection of an external Timer START event + */ +typedef enum XMC_CCU4_SLICE_START_MODE +{ + XMC_CCU4_SLICE_START_MODE_TIMER_START = 0U, /**< Start the timer from the current count of TIMER register */ + XMC_CCU4_SLICE_START_MODE_TIMER_START_CLEAR /**< Clears the TIMER register and start the timer */ +} XMC_CCU4_SLICE_START_MODE_t; + +/** + * Modulation of timer output signals + */ +typedef enum XMC_CCU4_SLICE_MODULATION_MODE +{ + XMC_CCU4_SLICE_MODULATION_MODE_CLEAR_ST_OUT = 0U, /**< Clear ST and OUT signals */ + XMC_CCU4_SLICE_MODULATION_MODE_CLEAR_OUT /**< Clear only the OUT signal */ +} XMC_CCU4_SLICE_MODULATION_MODE_t; + +/** + * Trap exit mode + */ +typedef enum XMC_CCU4_SLICE_TRAP_EXIT_MODE +{ + XMC_CCU4_SLICE_TRAP_EXIT_MODE_AUTOMATIC = 0U, /**< Clear trap state as soon as the trap signal is de-asserted */ + XMC_CCU4_SLICE_TRAP_EXIT_MODE_SW /**< Clear only when acknowledged by software */ +} XMC_CCU4_SLICE_TRAP_EXIT_MODE_t; + +/** + * Timer clear on capture + */ +typedef enum XMC_CCU4_SLICE_TIMER_CLEAR_MODE +{ + XMC_CCU4_SLICE_TIMER_CLEAR_MODE_NEVER = 0U, /**< Never clear the timer on any capture event */ + XMC_CCU4_SLICE_TIMER_CLEAR_MODE_CAP_HIGH , /**< Clear only when timer value has been captured in C3V and C2V */ + XMC_CCU4_SLICE_TIMER_CLEAR_MODE_CAP_LOW , /**< Clear only when timer value has been captured in C1V and C0V */ + XMC_CCU4_SLICE_TIMER_CLEAR_MODE_ALWAYS /**< Always clear the timer upon detection of any capture event */ +} XMC_CCU4_SLICE_TIMER_CLEAR_MODE_t; + +/** + * Multi Channel Shadow transfer request configuration options + */ +typedef enum XMC_CCU4_SLICE_MCMS_ACTION +{ + XMC_CCU4_SLICE_MCMS_ACTION_TRANSFER_PR_CR = 0U, /**< Transfer Compare and Period Shadow register values to + the actual registers upon MCS xfer request */ + XMC_CCU4_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP = 1U, /**< Transfer Compare, Period and Prescaler Compare Shadow + register values to the actual registers upon MCS xfer + request */ + XMC_CCU4_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP_DIT = 3U /**< Transfer Compare, Period ,Prescaler Compare and Dither + Compare register values to the actual registers upon + MCS xfer request */ +} XMC_CCU4_SLICE_MCMS_ACTION_t; + +/** + * Available Interrupt Event Ids + */ +typedef enum XMC_CCU4_SLICE_IRQ_ID +{ + XMC_CCU4_SLICE_IRQ_ID_PERIOD_MATCH = 0U , /**< Period match counting up */ + XMC_CCU4_SLICE_IRQ_ID_ONE_MATCH = 1U , /**< Period match -> One match counting down */ + XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_UP = 2U , /**< Compare match counting up */ + XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_DOWN = 3U , /**< Compare match counting down */ + XMC_CCU4_SLICE_IRQ_ID_EVENT0 = 8U , /**< Event-0 occurrence */ + XMC_CCU4_SLICE_IRQ_ID_EVENT1 = 9U , /**< Event-1 occurrence */ + XMC_CCU4_SLICE_IRQ_ID_EVENT2 = 10U, /**< Event-2 occurrence */ + XMC_CCU4_SLICE_IRQ_ID_TRAP = 11U /**< Trap occurrence */ +} XMC_CCU4_SLICE_IRQ_ID_t; + +/** + * Available Interrupt Event Ids, which is added to support multi event APIs + */ +typedef enum XMC_CCU4_SLICE_MULTI_IRQ_ID +{ + XMC_CCU4_SLICE_MULTI_IRQ_ID_PERIOD_MATCH = 0x1U, /**< Period match counting up */ + XMC_CCU4_SLICE_MULTI_IRQ_ID_ONE_MATCH = 0x2U, /**< Period match -> One match counting down */ + XMC_CCU4_SLICE_MULTI_IRQ_ID_COMPARE_MATCH_UP = 0x4U, /**< Compare match counting up */ + XMC_CCU4_SLICE_MULTI_IRQ_ID_COMPARE_MATCH_DOWN = 0x8U, /**< Compare match counting down */ + XMC_CCU4_SLICE_MULTI_IRQ_ID_EVENT0 = 0x100U, /**< Event-0 occurrence */ + XMC_CCU4_SLICE_MULTI_IRQ_ID_EVENT1 = 0x200U, /**< Event-1 occurrence */ + XMC_CCU4_SLICE_MULTI_IRQ_ID_EVENT2 = 0x400U, /**< Event-2 occurrence */ +} XMC_CCU4_SLICE_MULTI_IRQ_ID_t; + +/** + * Service Request Lines for CCU4. Event are mapped to these SR lines and these are used to generate the interrupt. + */ +typedef enum XMC_CCU4_SLICE_SR_ID +{ + XMC_CCU4_SLICE_SR_ID_0 = 0U, /**< Service Request Line-0 selected */ + XMC_CCU4_SLICE_SR_ID_1 , /**< Service Request Line-1 selected */ + XMC_CCU4_SLICE_SR_ID_2 , /**< Service Request Line-2 selected */ + XMC_CCU4_SLICE_SR_ID_3 /**< Service Request Line-3 selected */ +} XMC_CCU4_SLICE_SR_ID_t; + +/** + * Slice shadow transfer options. + */ +typedef enum XMC_CCU4_SHADOW_TRANSFER +{ + XMC_CCU4_SHADOW_TRANSFER_SLICE_0 = CCU4_GCSS_S0SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-0 */ + XMC_CCU4_SHADOW_TRANSFER_DITHER_SLICE_0 = CCU4_GCSS_S0DSE_Msk, /**< Transfer Dither compare shadow register value + to actual register for SLICE-0 */ + XMC_CCU4_SHADOW_TRANSFER_PRESCALER_SLICE_0 = CCU4_GCSS_S0PSE_Msk, /**< Transfer Prescaler shadow register value to + actual register for SLICE-0 */ + XMC_CCU4_SHADOW_TRANSFER_SLICE_1 = CCU4_GCSS_S1SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-1 */ + XMC_CCU4_SHADOW_TRANSFER_DITHER_SLICE_1 = CCU4_GCSS_S1DSE_Msk, /**< Transfer Dither compare shadow register value + to actual registers for SLICE-1 */ + XMC_CCU4_SHADOW_TRANSFER_PRESCALER_SLICE_1 = CCU4_GCSS_S1PSE_Msk, /**< Transfer Prescaler shadow register value to + actual register for SLICE-1 */ + XMC_CCU4_SHADOW_TRANSFER_SLICE_2 = CCU4_GCSS_S2SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-2 */ + XMC_CCU4_SHADOW_TRANSFER_DITHER_SLICE_2 = CCU4_GCSS_S2DSE_Msk, /**< Transfer Dither compare shadow register value + to actual register for SLICE-2 */ + XMC_CCU4_SHADOW_TRANSFER_PRESCALER_SLICE_2 = CCU4_GCSS_S2PSE_Msk, /**< Transfer Prescaler shadow register value to + actual register for SLICE-2 */ + XMC_CCU4_SHADOW_TRANSFER_SLICE_3 = CCU4_GCSS_S3SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-3 */ + XMC_CCU4_SHADOW_TRANSFER_DITHER_SLICE_3 = CCU4_GCSS_S3DSE_Msk, /**< Transfer Dither compare shadow register value + to actual register for SLICE-3 */ + XMC_CCU4_SHADOW_TRANSFER_PRESCALER_SLICE_3 = CCU4_GCSS_S3PSE_Msk /**< Transfer Prescaler shadow register value to + actual register for SLICE-3 */ +} XMC_CCU4_SHADOW_TRANSFER_t; + +#if defined(CCU4V3) || defined(DOXYGEN)/* Defined for XMC1400 devices only */ +/** + * Slice shadow transfer mode options. + * @note Only available for XMC1400 series + */ +typedef enum XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE +{ + XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_IN_PERIOD_MATCH_AND_ONE_MATCH = 0U, /**< Shadow transfer is done in Period Match and + One match. */ + XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_ONLY_IN_PERIOD_MATCH = 1U, /**< Shadow transfer is done only in Period Match. */ + XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_ONLY_IN_ONE_MATCH = 2U /**< Shadow transfer is done only in One Match. */ +} XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_t; + + +/** + * Immediate write into configuration register + * @note Only available for XMC1400 series + */ +typedef enum XMC_CCU4_SLICE_WRITE_INTO +{ + XMC_CCU4_SLICE_WRITE_INTO_PERIOD_CONFIGURATION = CCU4_CC4_STC_IRPC_Msk, /**< Immediate or Coherent + Write into Period + Configuration */ + XMC_CCU4_SLICE_WRITE_INTO_COMPARE_CONFIGURATION = CCU4_CC4_STC_IRCC_Msk, /**< Immediate or Coherent + Write into Compare + Configuration */ + XMC_CCU4_SLICE_WRITE_INTO_PASSIVE_LEVEL_CONFIGURATION = CCU4_CC4_STC_IRLC_Msk, /**< Immediate or Coherent + Write into Passive Level + Configuration */ + XMC_CCU4_SLICE_WRITE_INTO_DITHER_VALUE_CONFIGURATION = CCU4_CC4_STC_IRDC_Msk, /**< Immediate or Coherent + Write into Dither Value + Configuration */ + XMC_CCU4_SLICE_WRITE_INTO_FLOATING_PRESCALER_VALUE_CONFIGURATION = CCU4_CC4_STC_IRFC_Msk /**< Immediate or Coherent + Write into Floating Prescaler + Value Configuration */ +} XMC_CCU4_SLICE_WRITE_INTO_t; + + +/** + * Automatic Shadow Transfer request when writing into shadow register + * @note Only available for XMC1400 series + */ +typedef enum XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO +{ + XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_PERIOD_SHADOW = CCU4_CC4_STC_ASPC_Msk, /**< Automatic Shadow + Transfer request when + writing into Period + Shadow Register */ + XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_COMPARE_SHADOW = CCU4_CC4_STC_ASCC_Msk, /**< Automatic Shadow + transfer request + when writing into + Compare Shadow Register */ + XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_PASSIVE_LEVEL = CCU4_CC4_STC_ASLC_Msk, /**< Automatic Shadow transfer + request when writing + into Passive Level Register*/ + XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_DITHER_SHADOW = CCU4_CC4_STC_ASDC_Msk, /**< Automatic Shadow transfer + request when writing + into Dither Shadow Register */ + XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_FLOATING_PRESCALER_SHADOW = CCU4_CC4_STC_ASFC_Msk /**< Automatic Shadow transfer + request when writing + into Floating Prescaler Shadow + register */ + +} XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_t; +#endif +/** + * Used to create Mask needed for Multi-channel Shadow transfer enable/disable + */ +typedef enum XMC_CCU4_SLICE_MASK +{ + XMC_CCU4_SLICE_MASK_SLICE_0 = 1U , /**< SLICE-0 */ + XMC_CCU4_SLICE_MASK_SLICE_1 = 2U , /**< SLICE-1 */ + XMC_CCU4_SLICE_MASK_SLICE_2 = 4U , /**< SLICE-2 */ + XMC_CCU4_SLICE_MASK_SLICE_3 = 8U /**< SLICE-3 */ +} XMC_CCU4_SLICE_MASK_t; + + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/** + * Configuration data structure of an External Event(Event-0/1/2). + * Needed to configure the various aspects of an External Event. + * This structure will not connect the external event with an external function. + */ +typedef struct XMC_CCU4_SLICE_EVENT_CONFIG +{ + XMC_CCU4_SLICE_INPUT_t mapped_input; /**< Required input signal for the Event */ + XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_t edge; /**< Select the event edge of the input signal. + This is needed for an edge sensitive External function.*/ + XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_t level; /**< Select the event level of the input signal. + This is needed for an level sensitive External function.*/ + XMC_CCU4_SLICE_EVENT_FILTER_t duration; /**< Low Pass filter duration in terms of fCCU clock cycles */ +} XMC_CCU4_SLICE_EVENT_CONFIG_t; + +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * Configuration data structure for CCU4 slice. Specifically configures the CCU4 slice to compare mode operation. + * This excludes event and function configuration. + */ +typedef struct XMC_CCU4_SLICE_COMPARE_CONFIG +{ + union + { + struct + { + uint32_t timer_mode : 1; /**< Edge aligned or Centre Aligned. + Accepts enum ::XMC_CCU4_SLICE_TIMER_COUNT_MODE_t */ + uint32_t monoshot : 1; /**< Single shot or Continuous mode . + Accepts enum :: XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t*/ + uint32_t shadow_xfer_clear : 1; /**< Should PR and CR shadow xfer happen when timer is cleared? */ + uint32_t : 10; + uint32_t dither_timer_period: 1; /**< Can the period of the timer dither? */ + uint32_t dither_duty_cycle : 1; /**< Can the compare match of the timer dither? */ + uint32_t : 1; + uint32_t prescaler_mode: 1; /**< Normal or floating prescaler mode. + Accepts enum :: XMC_CCU4_SLICE_PRESCALER_MODE_t*/ + uint32_t : 8; + uint32_t mcm_enable : 1; /**< Multi-Channel mode enable? */ + uint32_t : 6; + }; + uint32_t tc; + }; + uint32_t prescaler_initval : 4; /**< Initial prescaler divider value + Accepts enum :: XMC_CCU4_SLICE_PRESCALER_t */ + uint32_t float_limit : 4; /**< The max value which the prescaler divider can increment to */ + uint32_t dither_limit : 4; /**< The value that determines the spreading of dithering */ + uint32_t passive_level : 1; /**< Configuration of ST and OUT passive levels. + Accepts enum :: XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_t*/ + uint32_t timer_concatenation : 1; /**< Enables the concatenation of the timer if true.*/ +} XMC_CCU4_SLICE_COMPARE_CONFIG_t; + +/** + * Configuration data structure for CCU4 slice. Specifically configures the CCU4 slice to capture mode operation. + * This excludes event and function configuration. + */ +typedef struct XMC_CCU4_SLICE_CAPTURE_CONFIG +{ + union + { + struct + { + uint32_t : 4; + uint32_t fifo_enable : 1; /**< Should the capture registers be setup as a FIFO?(Extended capture mode)*/ + uint32_t timer_clear_mode : 2; /**< How should the timer register be cleared upon detection of capture event? + Accepts enum ::XMC_CCU4_SLICE_TIMER_CLEAR_MODE_t*/ + uint32_t : 4; + uint32_t same_event : 1; /**< Should the capture event for C1V/C0V and C3V/C2V be same capture edge? */ + uint32_t ignore_full_flag : 1; /**< Should updates to capture registers follow full flag rules? */ + uint32_t : 3; + uint32_t prescaler_mode: 1; /**< Normal or floating prescaler Accepts enum :: XMC_CCU4_SLICE_PRESCALER_MODE_t*/ + uint32_t : 15; + }; + uint32_t tc; + }; + uint32_t prescaler_initval : 4; /**< Prescaler divider value */ + uint32_t float_limit : 4; /**< The max value which the prescaler divider can increment to */ + uint32_t timer_concatenation : 1; /**< Enables the concatenation of the timer */ +} XMC_CCU4_SLICE_CAPTURE_CONFIG_t; +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +__STATIC_INLINE bool XMC_CCU4_IsValidModule(const XMC_CCU4_MODULE_t *const module) +{ + bool tmp = false; + + tmp = (module == CCU40); + +#if defined(CCU41) + tmp = tmp || (module == CCU41); +#endif + +#if defined(CCU42) + tmp = tmp || (module == CCU42); +#endif + +#if defined(CCU43) + tmp = tmp || (module == CCU43); +#endif + + return tmp; +} + +__STATIC_INLINE bool XMC_CCU4_IsValidSlice(const XMC_CCU4_SLICE_t *const slice) +{ + bool tmp = false; + + tmp = (slice == CCU40_CC40); +#if defined(CCU40_CC41) + tmp = tmp || (slice == CCU40_CC41); +#endif +#if defined(CCU40_CC42) + tmp = tmp || (slice == CCU40_CC42); +#endif +#if defined(CCU40_CC43) + tmp = tmp || (slice == CCU40_CC43); +#endif +#if defined(CCU41) + tmp = tmp || (slice == CCU41_CC40); +#if defined(CCU41_CC41) + tmp = tmp || (slice == CCU41_CC41); +#endif +#if defined(CCU41_CC42) + tmp = tmp || (slice == CCU41_CC42); +#endif +#if defined(CCU41_CC43) + tmp = tmp || (slice == CCU41_CC43); +#endif +#endif +#if defined(CCU42) + tmp = tmp || (slice == CCU42_CC40); +#if defined(CCU42_CC41) + tmp = tmp || (slice == CCU42_CC41); +#endif +#if defined(CCU42_CC42) + tmp = tmp || (slice == CCU42_CC42); +#endif +#if defined(CCU42_CC43) + tmp = tmp || (slice == CCU42_CC43); +#endif +#endif +#if defined(CCU43) + tmp = tmp || (slice == CCU43_CC40); +#if defined(CCU43_CC41) + tmp = tmp || (slice == CCU43_CC41); +#endif +#if defined(CCU43_CC42) + tmp = tmp || (slice == CCU43_CC42); +#endif +#if defined(CCU43_CC43) + tmp = tmp || (slice == CCU43_CC43); +#endif +#endif + + return tmp; +} + +/** + * @param module Constant pointer to CCU4 module + * @param mcs_action multi-channel shadow transfer request configuration + * @return
+ * None
+ * + * \parDescription:
+ * Initialization of global register GCTRL.
\n + * As part of module initialization, behaviour of the module upon detection + * Multi-Channel Mode trigger is configured. Will also invoke the XMC_CCU4_EnableModule(). + * The API call would bring up the required CCU4 module and also initialize the module for + * the required multi-channel shadow transfer. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_CompareInit()
XMC_CCU4_SLICE_CaptureInit(). + */ +void XMC_CCU4_Init(XMC_CCU4_MODULE_t *const module, const XMC_CCU4_SLICE_MCMS_ACTION_t mcs_action); + +/** + * @param module Constant pointer to CCU4 module + * @param clock Choice of input clock to the module + * @return
+ * None
+ * + * \parDescription:
+ * Selects the Module Clock by configuring GCTRL.PCIS bits.
\n + * There are 3 potential clock sources. This API helps to select the required clock source. + * Call to this API is valid after the XMC_CCU4_Init(). + * + * \parRelated APIs:
+ * None.
+ */ +void XMC_CCU4_SetModuleClock(XMC_CCU4_MODULE_t *const module, const XMC_CCU4_CLOCK_t clock); + +/** + * @param module Constant pointer to CCU4 module + * @return
+ * None
+ * + * \parDescription:
+ * Enables the CCU4 module and brings it to active state.
\n + * Also disables the gating of the clock signal (if applicable depending on the device being selected). + * Invoke this API before any operations are done on the CCU4 module. Invoked from XMC_CCU4_Init(). + * + * \parRelated APIs:
+ * XMC_CCU4_SetModuleClock()
XMC_CCU4_DisableModule()
XMC_CCU4_StartPrescaler(). + */ +void XMC_CCU4_EnableModule(XMC_CCU4_MODULE_t *const module); + +/** + * @param module Constant pointer to CCU4 module + * @return
+ * None
+ * + * \parDescription:
+ * Brings the CCU4 module to reset state and enables gating of the clock signal(if applicable depending + * on the device being selected).
\n + * Invoke this API when a CCU4 module needs to be disabled completely. + * Any operation on the CCU4 module will have no effect after this API is called. + * + * \parRelated APIs:
+ * XMC_CCU4_EnableModule()
XMC_CCU4_DisableModule(). + */ +void XMC_CCU4_DisableModule(XMC_CCU4_MODULE_t *const module); + +/** + * @param module Constant pointer to CCU4 module + * @return
+ * None
+ * + * \parDescription:
+ * Starts the prescaler and restores clocks to the timer slices, by setting GIDLC.SPRB bit.
\n + * Once the input to the prescaler has been chosen and the prescaler divider of all slices programmed, + * the prescaler itself may be started. Invoke this API after XMC_CCU4_Init() + * (Mandatory to fully initialize the module).Directly accessed register is GIDLC. + * + * \parRelated APIs:
+ * XMC_CCU4_Init()
XMC_CCU4_EnableClock()
XMC_CCU4_DisableClock()
XMC_CCU4_StartPrescaler()
+ * XMC_CCU4_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU4_StartPrescaler(XMC_CCU4_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU4_StartPrescaler:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + module->GIDLC |= (uint32_t) CCU4_GIDLC_SPRB_Msk; +} + +/** + * @param module Constant pointer to CCU4 module + * @return
+ * None
+ * + * \parDescription:
+ * Stops the prescaler and blocks clocks to the timer slices, by setting GIDLS.CPRB bit.
\n + * Opposite of the StartPrescaler routine. + * Clears the run bit of the prescaler. Ensures that the module clock is not supplied to + * the slices of the module.Registers directly accessed is GIDLS. + * + * \parRelated APIs:
+ * XMC_CCU4_EnableClock()
XMC_CCU4_DisableClock()
XMC_CCU4_StartPrescaler()
XMC_CCU4_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU4_StopPrescaler(XMC_CCU4_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU4_StopPrescaler:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + module->GIDLS |= (uint32_t) CCU4_GIDLS_CPRB_Msk; +} + +/** + * @param module Constant pointer to CCU4 module + * @return
+ * None
+ * + * \parDescription:
+ * Returns the state of the prescaler, by reading GSTAT.PRB bit.
\n + * This will return true if the prescaler is running. If clock is being supplied to the slices of the + * module then returns as true. + * + * \parRelated APIs:
+ * XMC_CCU4_StartPrescaler()
XMC_CCU4_StopPrescaler()
XMC_CCU4_EnableClock()
XMC_CCU4_DisableClock(). + */ +__STATIC_INLINE bool XMC_CCU4_IsPrescalerRunning(XMC_CCU4_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU4_IsPrescalerRunning:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + return((bool)((module->GSTAT & (uint32_t) CCU4_GSTAT_PRB_Msk) == (uint32_t)CCU4_GSTAT_PRB_Msk)); +} + +/** + * @param module Constant pointer to CCU4 module + * @param clock_mask Slices whose clocks are to be enabled simultaneously. + * Bit location 0/1/2/3 represents slice-0/1/2/3 respectively. + * Range: [0x1 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Enables clocks of multiple slices at a time, by configuring GIDLC.CS0I, GIDLC.CS1I, GIDLC.CS2I, + * GIDLC.CS3I bits.\n\n + * Takes an input clock_mask, which determines the slices that would receive the clock. Bring them out + * of the idle state simultaneously. + * + * \parRelated APIs:
+ * XMC_CCU4_EnableClock()
XMC_CCU4_DisableClock(). + */ +__STATIC_INLINE void XMC_CCU4_EnableMultipleClocks(XMC_CCU4_MODULE_t *const module, const uint8_t clock_mask) +{ + XMC_ASSERT("XMC_CCU4_EnableMultipleClocks:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + XMC_ASSERT("XMC_CCU4_EnableMultipleClocks:Wrong clock mask", (clock_mask < 16U)); + + module->GIDLC |= (uint32_t) clock_mask; +} + +/** + * @param module Constant pointer to CCU4 module + * @param slice_number Slice for which the clock should be Enabled. + * Range: [0x0 to 0x3] + * @return
+ * None
+ * + * \parDescription:
+ * Enables the slice timer clock, by configuring GIDLC.CS0I, GIDLC.CS1I, GIDLC.CS2I, + * GIDLC.CS3I bits according to the selected \a slice_number.\n\n + * It is possible to enable/disable clock at slice level. This uses the \b slice_number to indicate the + * slice whose clock needs to be enabled. + * + * \parRelated APIs:
+ * XMC_CCU4_DisableClock()
XMC_CCU4_EnableMultipleClocks()
XMC_CCU4_StartPrescaler()
XMC_CCU4_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU4_EnableClock(XMC_CCU4_MODULE_t *const module, const uint8_t slice_number) +{ + XMC_ASSERT("XMC_CCU4_EnableClock:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + XMC_ASSERT("XMC_CCU4_EnableClock:Invalid Slice Number", (slice_number < 4U)); + + module->GIDLC |= ((uint32_t) 1) << slice_number; +} + +/** + * @param module Constant pointer to CCU4 module + * @param slice_number Slice for which the clock should be disabled. + * Range: [0x0 to 0x3] + * @return
+ * None
+ * + * \parDescription:
+ * Disables the slice timer clock, by configuring GIDLS.SS0I, GIDLS.SSS1I, GIDLS.SSS2I, + * GIDLS.SSS3I bits according to the selected \a slice_number .\n\n + * It is possible to disable clock at slice level using the module pointer. + * \b slice_number is used to disable the clock to a given slice of the module. + * Directly accessed Register is GIDLS. + * + * \parRelated APIs:
+ * XMC_CCU4_EnableClock()
XMC_CCU4_EnableMultipleClocks()
XMC_CCU4_StartPrescaler()
XMC_CCU4_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU4_DisableClock(XMC_CCU4_MODULE_t *const module, const uint8_t slice_number) +{ + XMC_ASSERT("XMC_CCU4_DisableClock:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + XMC_ASSERT("XMC_CCU4_DisableClock:Invalid Slice Number", (slice_number < 4U)); + + module->GIDLS |= ((uint32_t) 1) << slice_number; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param compare_init Pointer to slice configuration structure + * @return
+ * None
+ * + * \parDescription:
+ * Initialization of a CC4 slice to compare mode, by configuring CC4yTC, CC4yCMC, CC4yPSC, CC4yDITH, CC4yPSL, + * CC4yFPCS, CC4yCHC registers.\n\n + * CC4 slice is configured with Timer configurations in this routine. + * After initialization user has to explicitly enable the shadow transfer for the required values by calling + * XMC_CCU4_EnableShadowTransfer() with appropriate mask. + * + * \parRelated APIs:
+ * None. + */ +void XMC_CCU4_SLICE_CompareInit(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_COMPARE_CONFIG_t *const compare_init); + +/** + * @param slice Constant pointer to CC4 Slice + * @param capture_init Pointer to slice configuration structure + * @return
+ * None
+ * + * \parDescription:
+ * Initialization of a CC4 slice to capture mode, by configuring CC4yTC, CC4yCMC, CC4yPSC,CC4yFPCS registers.\n\n + * CC4 slice is configured with Capture configurations in this routine.After initialization user has to explicitly + * enable the shadow transfer for the required values by calling XMC_CCU4_EnableShadowTransfer() + * with appropriate mask. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_Capture0Config()
XMC_CCU4_SLICE_Capture1Config(). + */ +void XMC_CCU4_SLICE_CaptureInit(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_CAPTURE_CONFIG_t *const capture_init); + + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the External Start Function + * @param start_mode Behavior of slice when the start function is activated + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Start Function of the slice, by configuring CC4yCMC.ENDS and CC4yTC.ENDM bits.\n\n + * Start function is mapped with one of the 3 events. An external signal can control when a CC4 timer should start. + * Additionally, the behaviour of the slice upon activation of the start function is configured as well. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StopConfig()
XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_StartConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_START_MODE_t start_mode); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the External Stop Function + * @param end_mode Behavior of slice when the stop function is activated + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Stop function for the slice, by configuring CC4yCMC.STRTS and CC4yTC.STRM bits.\n\n + * Stop function is mapped with one of the 3 events. An external signal can control when a CCU4 timer should stop. + * Additionally, the behaviour of the slice upon activation of the stop function is configured as well. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartConfig()
XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_StopConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_END_MODE_t end_mode); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the External load Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Load Function for the slice, by configuring CC4yCMC.LDS bit.\n\n + * Load function is mapped with one of the 3 events. Up on occurrence of the event,\n + * if CC4yTCST.CDIR set to 0,CC4yTIMER register is reloaded with the value from compare register\n + * if CC4yTCST.CDIR set to 1,CC4yTIMER register is reloaded with the value from period register\n + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_LoadConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event); + + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the External Modulation Function + * @param mod_mode Desired Modulation mode + * @param synch_with_pwm Option to synchronize modulation with PWM start + * Pass \b true if the modulation needs to be synchronized with PWM signal. + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Output Modulation Function of the slice, by configuring CCeyCMC.MOS, CC4yTC.EMT and + * CC4yTC.EMS bits.\n\n + * Modulation function is mapped with one of the 3 events. The output signal of the CCU can + * be modulated according to a external input. Additionally, the behaviour of the slice upon activation + * of the modulation function is configured as well. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_ModulationConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_MODULATION_MODE_t mod_mode, + const bool synch_with_pwm); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the External Count Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Count Function of the slice, by configuring CC4yCMC.CNTS bit.\n\n + * Count function is mapped with one of the 3 events. CCU4 slice can take an external + * signal to act as the counting event. The CCU4 slice would count the + * edges present on the \b event selected. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_CountConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the External Gating Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Gating Function of the slice, by configuring CC4yCMC.GATES bit.\n\n + * Gating function is mapped with one of the 3 events. A CCU4 slice can use an input signal that would + * operate as counter gating. If the configured Active level is detected the counter will gate all the pulses. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_GateConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the Capture-0 Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Capture-0 Function of the slice, by configuring CC4yCMC.CAP0S bit.\n\n + * Capture function is mapped with one of the 3 events. A CCU4 slice can be configured into capture-0 mode + * with the selected \b event. In this mode the CCU4 will capture the timer value into CC4yC0V and CC4yC1V. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_Capture0Config(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the Capture-1 Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Capture-1 Function of the slice, by configuring CC4yCMC.CAP1S bit.\n\n + * Capture function is mapped with one of the 3 events. A CCU4 slice can be configured into capture-1 + * mode with the selected \b event. In this mode the CCU4 will capture the timer value into CC4yC2V and CC4yC3V. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_Capture1Config(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * bool would return true if the extended capture read back mode is enabled
+ * + * \parDescription:
+ * Checks if Extended capture mode read is enabled for particular slice or not, by reading CC4yTC.ECM bit.\n\n + * In this mode the there is only one associated read address for all the capture registers. + * Individual capture registers can still be accessed in this mode. + * + * \parRelated APIs:
+ * XMC_CCU4_GetCapturedValueFromFifo(). + */ +__STATIC_INLINE bool XMC_CCU4_SLICE_IsExtendedCapReadEnabled(const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_IsExtendedCapReadEnabled:Invalid Module Pointer", XMC_CCU4_IsValidSlice(slice)); + return((bool)((slice->TC & (uint32_t) CCU4_CC4_TC_ECM_Msk) == (uint32_t)CCU4_CC4_TC_ECM_Msk)); +} + +#if defined(CCU4V1) /* Defined for XMC4500, XMC4400, XMC4200, XMC4100 devices only */ +/** + * @param module Constant pointer to CCU4 module + * @param slice_number to check whether read value belongs to required slice or not + * @return
+ * int32_t Returns -1 if the FIFO value being retrieved is not from the \b slice_number. + * Returns the value captured in the \b slice_number, if captured value is from the correct slice. + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Read captured value from FIFO(ECRD register).\n\n + * This is applicable only in the Capture mode of operation. The signal whose timing characteristics are to be measured + * must be mapped to an event which in turn must be mapped to the capture function. Based on the capture criteria, the + * instant timer values are captured into capture registers. Timing characteristics of the input signal may then be + * derived/inferred from the captured values. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_IsExtendedCapReadEnabled(). + * @note Only available for XMC4500, XMC4400, XMC4200 and XMC4100 series + */ +int32_t XMC_CCU4_GetCapturedValueFromFifo(const XMC_CCU4_MODULE_t *const module, const uint8_t slice_number); +#else +/** + * @param slice Constant pointer to CC4 Slice + * @param set The capture register set from which the captured value is to be retrieved + * @return
+ * uint32_t Returns the value captured in the \b slice_number + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Read captured value from FIFO(CC4yECRD0 and CC4yECRD1).\n\n + * This is applicable only in the Capture mode of operation. The signal whose timing characteristics are to be measured + * must be mapped to an event which in turn must be mapped to the capture function. Based on the capture criteria, the + * instant timer values are captured into capture registers. Timing characteristics of the input signal may then be + * derived/inferred from the captured values. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_IsExtendedCapReadEnabled(). + * @note Defined for XMC4800, XMC4700, XMC4500, XMC4400, XMC4200, XMC4100 devices only. For other devices use XMC_CCU4_GetCapturedValueFromFifo() API + */ +uint32_t XMC_CCU4_SLICE_GetCapturedValueFromFifo(const XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_CAP_REG_SET_t set); +#endif + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the External Count Direction Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Count Direction of the slice, by configuring CC4yCMC.UDS bit.\n\n + * Count direction function is mapped with one of the 3 events. A slice can be configured to change the + * CC4yTIMER count direction depending on an external signal. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_DirectionConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Configures the status bit override Function of the slice, by configuring CC4yCMC.OFS bit.\n\n + * Status bit override function is mapped with one of the 3 events. A slice can be configured to change the + * output of the timer's CC4yST signal depending on an external signal. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent(). + */ +void XMC_CCU4_SLICE_StatusBitOverrideConfig(XMC_CCU4_SLICE_t *const slice); + +/** + * @param slice Constant pointer to CC4 Slice + * @param exit_mode How should a previously logged trap state be exited? + * @param synch_with_pwm Should exit of trap state be synchronized with PWM cycle start? + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Trap Function of the slice, by configuring CC4yCMC.TS, CC4yTC.TRPSE, and CC4yTC.TRPSW bits.\n\n + * Trap function is mapped with Event-2. Criteria for exiting the trap state is configured. + * This trap function allows PWM outputs to react on the state of an input pin. + * Thus PWM output can be forced to inactive state upon detection of a trap. + * It is also possible to synchronize the trap function with the PWM signal using the \b synch_with_pwm. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_TrapConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_TRAP_EXIT_MODE_t exit_mode, + bool synch_with_pwm); + + +/** + * @param slice Constant pointer to CC4 Slice + * @param ev1_config Pointer to event 1 configuration data + * @param ev2_config Pointer to event 2 configuration data + * @return
+ * None
+ * + * + * \parDescription:
+ * Map Status bit override function with an Event1 & Event 2 of the slice and configure CC4yINS register.\n\n + * Details such as the input mapped to the event, event detection criteria and Low Pass filter options are programmed + * by this routine for the events 1 & 2. Event-1 input would be the trigger to override the value. + * Event-2 input would be the override value. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StatusBitOverrideConfig(). + */ +void XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_CONFIG_t *const ev1_config, + const XMC_CCU4_SLICE_EVENT_CONFIG_t *const ev2_config); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event The External Event which needs to be configured. + * @param config Pointer to event configuration data. + * @return
+ * None
+ * + * \parDescription:
+ * Configures an External Event of the slice, by updating CC4yINS register .\n\n + * Details such as the input mapped to the event, event detection criteria and low pass filter + * options are programmed by this routine. The Event \b config will configure the input selection, + * the edge selection, the level selection and the Low pass filter for the event. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartConfig()
XMC_CCU4_SLICE_StopConfig()
XMC_CCU4_SLICE_LoadConfig()
+ * XMC_CCU4_SLICE_ModulationConfig()
XMC_CCU4_SLICE_CountConfig()
XMC_CCU4_SLICE_GateConfig()
+ * XMC_CCU4_SLICE_Capture0Config()
XMC_CCU4_SLICE_Capture1Config()
XMC_CCU4_SLICE_DirectionConfig()
+ * XMC_CCU4_SLICE_StatusBitOverrideConfig()
XMC_CCU4_SLICE_TrapConfig(). + */ +void XMC_CCU4_SLICE_ConfigureEvent(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_EVENT_CONFIG_t *const config); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event The External Event which needs to be configured. + * @param input One of the 16 inputs meant to be mapped to the desired event + * @return
+ * None
+ * + * + * \parDescription:
+ * Selects an input for an external event, by configuring CC4yINS register.\n\n + * It is possible to select one of the possible 16 input signals for a given Event. + * This configures the CC4yINS.EVxIS for the selected event. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartConfig()
XMC_CCU4_SLICE_StopConfig()
XMC_CCU4_SLICE_LoadConfig()
+ * XMC_CCU4_SLICE_ModulationConfig()
XMC_CCU4_SLICE_CountConfig()
XMC_CCU4_SLICE_GateConfig()
+ * XMC_CCU4_SLICE_Capture0Config()
XMC_CCU4_SLICE_Capture1Config()
XMC_CCU4_SLICE_DirectionConfig()
+ * XMC_CCU4_SLICE_StatusBitOverrideConfig()
XMC_CCU4_SLICE_TrapConfig(). + */ +void XMC_CCU4_SLICE_SetInput(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_INPUT_t input); + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Enables the trap feature, by setting CC4yTC.TRAPE0, CC4yTC.TRAPE1, CC4yTC.TRAPE2 and CC4yTC.TRAPE3 bit based on the + * \a out_mask.\n\n + * A particularly useful feature where the PWM output can be forced inactive upon detection of a trap. The trap signal + * can be the output of a sensing element which has just detected an abnormal electrical condition. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_TrapConfig()
XMC_CCU4_SLICE_DisableTrap()
XMC_CCU4_SLICE_ConfigureEvent()
+ * XMC_CCU4_SLICE_SetInput(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_EnableTrap(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_EnableTrap:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TC |= (uint32_t) CCU4_CC4_TC_TRAPE_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Disables the trap feature, by clearing CC4yTC.TRAPE0, CC4yTC.TRAPE1, CC4yTC.TRAPE2 and CC4yTC.TRAPE3 bit based on the + * \a out_mask.\n\n.\n\n + * This API will revert the changes done by XMC_CCU4_SLICE_EnableTrap(). + * This Ensures that the TRAP function has no effect on the output of the CCU4 slice. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableTrap(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableTrap(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableTrap:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TC &= ~((uint32_t) CCU4_CC4_TC_TRAPE_Msk); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * bool returns \b true if the Timer is running else it returns \b false. + * + * \parDescription:
+ * Returns the state of the timer (Either Running or stopped(idle)), by reading CC4yTCST.TRB bit. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartTimer()
XMC_CCU4_SLICE_StopTimer(). + */ +__STATIC_INLINE bool XMC_CCU4_SLICE_IsTimerRunning(const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetTimerStatus:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return (bool)(((slice->TCST) & CCU4_CC4_TCST_TRB_Msk) == CCU4_CC4_TCST_TRB_Msk); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * ::XMC_CCU4_SLICE_TIMER_COUNT_DIR_t returns the direction in which the timer is counting. + * + * \parDescription:
+ * Returns the timer counting direction, by reading CC4yTCST.CDIR bit.\n\n + * This API will return the direction in which the timer is currently + * incrementing(XMC_CCU4_SLICE_TIMER_COUNT_DIR_UP) or decrementing (XMC_CCU4_SLICE_TIMER_COUNT_DIR_DOWN). + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE XMC_CCU4_SLICE_TIMER_COUNT_DIR_t XMC_CCU4_SLICE_GetCountingDir(const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetCountingDir:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return((XMC_CCU4_SLICE_TIMER_COUNT_DIR_t)(((slice->TCST) & CCU4_CC4_TCST_CDIR_Msk) >> CCU4_CC4_TCST_CDIR_Pos)); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Starts the timer counting operation, by setting CC4yTCSET.TRBS bit.\n\n + * It is necessary to have configured the CC4 slice before starting its timer. + * Before the Timer is started ensure that the clock is provided to the slice. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StopTimer(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_StartTimer(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_StartTimer:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TCSET = CCU4_CC4_TCSET_TRBS_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Stops the Timer.
\n + * Timer counting operation can be stopped by invoking this API, by setting CC4yTCCLR.TRBC bit. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartTimer(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_StopTimer(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_StopTimer:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TCCLR = (uint32_t) CCU4_CC4_TCCLR_TRBC_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Resets the timer count to zero, by setting CC4yTCCLR.TCC bit.\n\n + * A timer which has been stopped can still retain the last counted value. + * After invoking this API the timer value will be cleared. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartTimer(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_ClearTimer(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_ClearTimer:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TCCLR = (uint32_t) CCU4_CC4_TCCLR_TCC_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Stops and resets the timer count to zero, by setting CC4yTCCLR.TCC and CC4yTCCLR.TRBC bit.\n\n + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartTimer(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_StopClearTimer(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_StopClearTimer:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TCCLR = CCU4_CC4_TCCLR_TRBC_Msk | CCU4_CC4_TCCLR_TCC_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * ::XMC_CCU4_SLICE_MODE_t returns XMC_CCU4_SLICE_MODE_COMPARE if the slice is operating in compare mode + * returns XMC_CCU4_SLICE_MODE_CAPTURE if the slice is operating in capture mode + * + * \parDescription:
+ * Retrieves the current mode of operation in the slice (either Capture mode or Compare mode), by reading + * CC4yTC.CMOD bit.\n\n + * Ensure that before invoking this API the CCU4 slice should be configured otherwise the output of this API is + * invalid. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE XMC_CCU4_SLICE_MODE_t XMC_CCU4_SLICE_GetSliceMode(const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetSliceMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return((XMC_CCU4_SLICE_MODE_t)(((slice->TC) & CCU4_CC4_TC_CMOD_Msk) >> CCU4_CC4_TC_CMOD_Pos)); +} +/** + * @param slice Constant pointer to CC4 Slice + * @param mode Desired repetition mode (Either single shot or Continuous) + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Timer to either Single shot mode or continuous mode, by configuring CC4yTC.TSSM bit.\n\n + * The timer will count up to the terminal count as specified in the period register and stops immediately if the repeat + * mode has been set to single shot. In the continuous mode of operation, the timer starts counting all over again after + * reaching the terminal count. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_GetTimerRepeatMode(). + */ +void XMC_CCU4_SLICE_SetTimerRepeatMode(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t mode); + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * ::XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t returns XMC_CCU4_SLICE_TIMER_REPEAT_MODE_REPEAT if continuous mode is selected + * returns XMC_CCU4_SLICE_TIMER_REPEAT_MODE_SINGLE if single shot mode is selected + * + * \parDescription:
+ * Retrieves the Timer repeat mode, either Single shot mode or continuous mode, by reading CC4yTC.TSSM bit.\n\n + * The timer will count up to the terminal count as specified in the period register and stops immediately if the repeat + * mode has been set to single shot mode. In the continuous mode of operation, the timer starts counting + * all over again after reaching the terminal count. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetTimerRepeatMode(). + */ +__STATIC_INLINE XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t XMC_CCU4_SLICE_GetTimerRepeatMode( + const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetTimerRepeatMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return((XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t)(((slice->TC) & CCU4_CC4_TC_TSSM_Msk) >> CCU4_CC4_TC_TSSM_Pos)); +} +/** + * @param slice Constant pointer to CC4 Slice + * @param mode Desired counting mode (Either Edge Aligned or Center Aligned) + * @return
+ * None
+ * + * \parDescription:
+ * Configures the timer counting mode either Edge Aligned or Center Aligned, by configuring CC4yTC.TCM bit.\n\n + * In the edge aligned mode, the timer counts from 0 to the terminal count. Once the timer count has reached a preset + * compare value, the timer status output asserts itself. It will now deassert only after the timer count reaches the + * terminal count.\n In the center aligned mode, the timer first counts from 0 to the terminal count and then back to 0. + * During this upward and downward counting, the timer status output stays asserted as long as the timer value is + * greater than the compare value. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_GetTimerCountingMode(). + */ +void XMC_CCU4_SLICE_SetTimerCountingMode(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_TIMER_COUNT_MODE_t mode); + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * ::XMC_CCU4_SLICE_TIMER_COUNT_MODE_t returns XMC_CCU4_SLICE_TIMER_COUNT_MODE_EA if edge aligned mode is selected + * returns XMC_CCU4_SLICE_TIMER_COUNT_MODE_CA if center aligned mode is selected + * + * \parDescription:
+ * Retrieves timer counting mode either Edge aligned or Center Aligned, by reading CC4yTC.TCM bit.\n\n + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetTimerCountingMode(). + */ +__STATIC_INLINE XMC_CCU4_SLICE_TIMER_COUNT_MODE_t XMC_CCU4_SLICE_GetTimerCountingMode( + const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetTimerCountingMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return((XMC_CCU4_SLICE_TIMER_COUNT_MODE_t)(((slice->TC) & CCU4_CC4_TC_TCM_Msk) >> CCU4_CC4_TC_TCM_Pos)); +} +/** + * @param slice Constant pointer to CC4 Slice + * @param period_val Timer period value + * Range: [0x0 to 0xFFFF] + * @return
+ * None
+ * + * \parDescription:
+ * Programs the timer period, by writing CC4yPRS register.\n\n + * The frequency of counting/ PWM frequency is determined by this value. The period value is written to a shadow + * register. Explicitly enable the shadow transfer for the the period value by calling + * XMC_CCU4_EnableShadowTransfer() with appropriate mask. If shadow transfer is enabled and the timer is running, + * a period match transfers the value from the shadow register to the actual period register. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_GetTimerPeriodMatch(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_SetTimerPeriodMatch(XMC_CCU4_SLICE_t *const slice, const uint16_t period_val) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerPeriodMatch:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->PRS = (uint32_t) period_val; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * uint16_t returns the current timer period value + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Retrieves the timer period value currently effective, by reading CC4yPR register.\n\n + * If the timer is active then the value being returned is currently being used for the PWM period. + * + * \parNote:
+ * The XMC_CCU4_SLICE_SetTimerPeriodMatch() would set the new period value to a shadow register. + * This would only transfer the new values into the actual period register if the shadow transfer request + * is enabled and if a period match occurs. Hence a consecutive call to XMC_CCU4_SLICE_GetTimerPeriodMatch() + * would not reflect the new values until the shadow transfer completes. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetTimerPeriodMatch(). + */ +__STATIC_INLINE uint16_t XMC_CCU4_SLICE_GetTimerPeriodMatch(const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerPeriodMatch:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return((uint16_t)slice->PR); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param compare_val Timer compare value + * @return
+ * None
+ * + * \parDescription:
+ * Programs the timer compare value, by writing CC4yCRS register.
\n + * The PWM duty cycle is determined by this value. + * The compare value is written to a shadow register. Explicitly enable the shadow transfer for + * the the period/compare value by calling XMC_CCU4_EnableShadowTransfer() with + * appropriate mask.If shadow transfer is enabled and the timer is running, + * a period match transfers the value from the shadow register to the actual compare register. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_GetTimerPeriodMatch(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_SetTimerCompareMatch(XMC_CCU4_SLICE_t *const slice, const uint16_t compare_val) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerCompareMatch:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->CRS = (uint32_t) compare_val; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * uint16_t returns the current timer compare value + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Retrieves the timer compare value currently effective, by reading CC4yCRS register.\n\n + * If the timer is active then the value being returned is currently being for the PWM duty cycle( timer compare value). + * + * \parNote:
+ * The XMC_CCU4_SLICE_SetTimerCompareMatch() would set the new compare value to a shadow register. + * This would only transfer the new values into the actual compare register if the shadow transfer request + * is enabled and if a period match occurs. Hence a consecutive call to XMC_CCU4_SLICE_GetTimerCompareMatch() + * would not reflect the new values until the shadow transfer completes. + * Directly accessed Register is CC4yCR. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetTimerCompareMatch(). + */ +__STATIC_INLINE uint16_t XMC_CCU4_SLICE_GetTimerCompareMatch(const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetTimerCompareMatch:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return((uint16_t)slice->CR); +} + +/** + * @param module Constant pointer to CCU4 module + * @param shadow_transfer_msk Shadow transfer request mask for various transfers. + * Use ::XMC_CCU4_SHADOW_TRANSFER_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Requests of shadow transfer for Period, Compare, Passive level, dither and prescaler, by configuring + * the GCSS register.\n\n + * The transfer from the shadow registers to the actual registers is done in the immediate next occurrence of the + * shadow transfer trigger after the API is called. + * + * Any call to XMC_CCU4_SLICE_SetTimerPeriodMatch()
XMC_CCU4_SLICE_SetTimerCompareMatch()
+ * XMC_CCU4_SLICE_SetPrescaler()
XMC_CCU4_SLICE_CompareInit()
XMC_CCU4_SLICE_CaptureInit(). + * must be succeeded by this API. + * Directly accessed Register is GCSS. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_CCU4_EnableShadowTransfer(XMC_CCU4_MODULE_t *const module, const uint32_t shadow_transfer_msk) +{ + XMC_ASSERT("XMC_CCU4_EnableShadowTransfer:Invalid Slice Pointer", XMC_CCU4_IsValidModule(module)); + module->GCSS = (uint32_t)shadow_transfer_msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * uint16_t returns the current timer value + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Retrieves the latest timer value, from CC4yTIMER register.\n\n + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetTimerValue(). + */ +__STATIC_INLINE uint16_t XMC_CCU4_SLICE_GetTimerValue(const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetTimerValue:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return((uint16_t)slice->TIMER); +} +/** + * @param slice Constant pointer to CC4 Slice + * @param timer_val The new timer value that has to be loaded into the TIMER register. + * Range: [0x0 to 0xFFFF] + * @return
+ * None
+ * + * \parDescription:
+ * Loads a new timer value, by setting CC4yTIMER register.\n\n + * + * \parNote:
+ * Request to load is ignored if the timer is running. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_GetTimerValue(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_SetTimerValue(XMC_CCU4_SLICE_t *const slice, const uint16_t timer_val) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerValue:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TIMER = (uint32_t) timer_val; +} +/** + * @param slice Constant pointer to CC4 Slice + * @param period_dither Boolean instruction on dithering of period match + * @param duty_dither Boolean instruction on dithering of compare match + * @param spread Dither compare value + * @return
+ * None
+ * + * \parDescription:
+ * Enables dithering of PWM frequency and duty cycle, by configuring CC4yTC.DITHE and CC4yDITS bits.\n\n + * Some control loops are slow in updating PWM frequency and duty cycle. In such a case, a Bresenham style dithering + * can help reduce long term errors. Dithering can be applied to period and duty individually, + * this can be selected using the parameter \b period_dither and \b duty_dither. + * The \b spread would provide the dither compare value. If the dither counter value is less than this \b spread then + * the period/compare values would be dithered according to the dither mode selected. This API would invoke + * XMC_CCU4_SLICE_SetDitherCompareValue(). + * + * \parNote:
+ * After this API call, XMC_CCU4_EnableShadowTransfer() has to be called with appropriate mask + * to transfer the dither value. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_DisableDithering(). + */ +void XMC_CCU4_SLICE_EnableDithering(XMC_CCU4_SLICE_t *const slice, + const bool period_dither, + const bool duty_dither, + const uint8_t spread); + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Disables dithering of PWM frequency and duty cycle, by clearing CC4yTC.DITHE bits.\n\n + * This disables the Dither mode that was set in XMC_CCU4_SLICE_EnableDithering(). + * This API will not clear the dither compare value. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableDithering(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableDithering(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableDithering:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TC &= ~((uint32_t) CCU4_CC4_TC_DITHE_Msk); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Enables the floating prescaler, by setting CC4yTC.FPE bit.\n\n + * The prescaler divider starts with an initial value and increments upon every period match. It keeps incrementing + * until a ceiling (prescaler compare value) is hit and thereafter rolls back to the original prescaler divider value.\n + * It is necessary to have programmed an initial divider value and a compare value before the feature is enabled. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetFloatingPrescalerCompareValue()
XMC_CCU4_SLICE_DisableFloatingPrescaler()
+ * XMC_CCU4_SLICE_SetPrescaler(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_EnableFloatingPrescaler(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_EnableFloatingPrescaler:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TC |= (uint32_t) CCU4_CC4_TC_FPE_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Disables the floating prescaler, by clearing CC4yTC.FPE bit.\n\n + * This would return the prescaler to the normal mode. + * The prescaler that would be applied is the value present in CC4yPSC. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableFloatingPrescaler(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableFloatingPrescaler(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableFloatingPrescaler:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TC &= ~((uint32_t) CCU4_CC4_TC_FPE_Msk); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param comp_val Dither compare value + * Range: [0x0 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Sets the dither spread/compare value, by setting CC4yDITS.DCVS bits.\n\n + * This value is the cornerstone of PWM dithering feature. Dithering is applied/done when the value in the + * dithering counter is less than this compare/spread value. For all dithering counter values greater than + * the spread value, there is no dithering. After setting the value XMC_CCU4_EnableShadowTransfer() has to be + * called with appropriate mask. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableDithering(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_SetDitherCompareValue(XMC_CCU4_SLICE_t *const slice, const uint8_t comp_val) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetDitherCompareValue:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->DITS = comp_val; +} +/** + * @param slice Constant pointer to CC4 Slice + * @param div_val Prescaler divider value + * Range: [0x0 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Programs the slice specific prescaler divider, by configuring the CC4yPSC and CC4yFPC registers.\n\n + * The prescaler divider may only be programmed after the prescaler run bit has been cleared + * by calling XMC_CCU4_StopPrescaler(). + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetFloatingPrescalerCompareValue(). + */ +void XMC_CCU4_SLICE_SetPrescaler(XMC_CCU4_SLICE_t *const slice, const uint8_t div_val); + +/** + * @param slice Constant pointer to CC4 Slice + * @param cmp_val Prescaler divider compare value + * Range: [0x0 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Programs the slice specific prescaler divider compare value, by configuring CC4yFPCS register.\n\n + * The compare value is applicable only in floating mode of operation. The prescaler divider starts with an initial + * value and increments to the compare value steadily upon every period match. Once prescaler divider + * equals the prescaler divider compare value, the value in the former resets back to the PVAL (from FPC). After setting + * the value, XMC_CCU4_EnableShadowTransfer() has to be called with appropriate mask. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetPrescaler(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_SetFloatingPrescalerCompareValue(XMC_CCU4_SLICE_t *const slice, + const uint8_t cmp_val) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetFloatingPrescalerCompareValue:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + /* write to the shadow register */ + slice->FPCS = (uint32_t) cmp_val; +} +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Enables the multichannel mode, by setting CC4yTC.MCME bit.
\n + * The output state of the Timer slices can be controlled in parallel by a single input signal. + * A particularly useful feature in motor control applications where the PWM output of multiple slices of a module can + * be gated and ungated by multi-channel gating inputs connected to the slices. A peripheral like POSIF connected to the + * motor knows exactly which of the power drive switches are to be turned on and off at any instant. It can thus through + * a gating bus (known as multi-channel inputs) control which of the slices output stays gated/ungated. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_DisableMultiChannelMode()
XMC_CCU4_SetMultiChannelShadowTransferMode(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_EnableMultiChannelMode(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_EnableMultiChannelMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TC |= (uint32_t) CCU4_CC4_TC_MCME_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Disables the multichannel mode, by clearing CC4yTC.MCME bit.
\n + * This would return the slices to the normal operation mode. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableMultiChannelMode(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableMultiChannelMode(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableMultiChannelMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TC &= ~((uint32_t) CCU4_CC4_TC_MCME_Msk); +} + +/** + * @param module Constant pointer to CCU4 module + * @param slice_mode_msk Slices for which the configuration has to be applied. + * Use ::XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Enables the Multi-channel shadow transfer request trigger signal either by software or hardware by configuring + * GCTRL.MSE0, GCTRL.MSE1, GCTRL.MSE2, and GCTRL.MSE3 based on the mask.\n\n + * The shadow transfer would take place either if it was requested by software or by the CCU4x.MCSS input. + * + * \parRelated APIs:
+ * None. +*/ +void XMC_CCU4_SetMultiChannelShadowTransferMode(XMC_CCU4_MODULE_t *const module, const uint32_t slice_mode_msk); + +/** + * @param slice Constant pointer to CC4 Slice + * @param reg_num The capture register from which the captured value is to be retrieved + * Range: [0,3] + * @return
+ * uint32_t Returns the Capture register value. + * Range: [0 to 0x1FFFFF] + * + * \parDescription:
+ * Retrieves timer value which has been captured in the Capture registers, by reading CC4yCV[\b reg_num] register.\n\n + * The signal whose timing characteristics are to be measured must be mapped to an event which in turn must be mapped + * to the capture function. Based on the capture criteria, the timer values are captured into capture registers. Timing + * characteristics of the input signal may then be derived/inferred from the captured values. The full flag will help + * to find out if there is a new captured value present. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_GetLastCapturedTimerValue(). + */ +uint32_t XMC_CCU4_SLICE_GetCaptureRegisterValue(const XMC_CCU4_SLICE_t *const slice, const uint8_t reg_num); + +/** + * @param slice Constant pointer to CC4 Slice + * @param set The capture register set, which must be evaluated + * @param val_ptr Out Parameter of the API.Stores the captured timer value into this out parameter. + * @return
+ * ::XMC_CCU4_STATUS_t Returns XMC_CCU4_STATUS_OK if there was new value present in the capture registers. + * returns XMC_CCU4_STATUS_ERROR if there was no new value present in the capture registers. + * + * \parDescription:
+ * Retrieves the latest captured timer value, by reading CC4yCV registers.\n\n + * Retrieve the timer value last stored by the slice. When separate capture events are used, + * users must specify the capture set to evaluate. If single capture event mode is used, all 4 capture registers are + * evaluated.\n + * The lowest register is evaluated first followed by the next higher ordered register and this continues until all + * capture registers have been evaluated. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_GetCaptureRegisterValue(). + */ +XMC_CCU4_STATUS_t XMC_CCU4_SLICE_GetLastCapturedTimerValue(const XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_CAP_REG_SET_t set, + uint32_t *val_ptr); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Event whose assertion can potentially lead to an interrupt + * @return
+ * None
+ * + * \parDescription:
+ * Enables the generation of an interrupt pulse for the event, by configuring CC4yINTE register.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API merely enables the event. Binding with SR is performed by another API. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetInterruptNode()
XMC_CCU4_SLICE_EnableMultipleEvents()
XMC_CCU4_SLICE_DisableEvent()
+ * XMC_CCU4_SLICE_DisableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_EnableEvent(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU4_SLICE_EnableEvent:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_EnableEvent:Invalid SR event", XMC_CCU4_SLICE_CHECK_INTERRUPT(event)); + slice->INTE |= ((uint32_t) 1) << ((uint32_t) event); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param intr_mask Event mask such that multiple events can be enabled. + * Use ::XMC_CCU4_SLICE_MULTI_IRQ_ID_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Enables the generation of an interrupt pulse for the required events, by configuring CC4yINTE register.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API merely enables the events. Binding with SR is performed by another API. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetInterruptNode()
XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_DisableEvent()
+ * XMC_CCU4_SLICE_DisableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_EnableMultipleEvents(XMC_CCU4_SLICE_t *const slice, const uint16_t intr_mask) +{ + XMC_ASSERT("XMC_CCU4_SLICE_EnableMultipleEvents:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->INTE |= (uint32_t)intr_mask; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Event whose assertion can potentially lead to an interrupt + * @return
+ * None
+ * + * \parDescription:
+ * Disables the generation of an interrupt pulse for the event, by clearing CC4yINTE register.\n\n + * Prevents the event from being asserted + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetInterruptNode()
XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_EnableMultipleEvents()
+ * XMC_CCU4_SLICE_DisableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableEvent(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableEvent:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_DisableEvent:Invalid SR event", XMC_CCU4_SLICE_CHECK_INTERRUPT(event)); + slice->INTE &= ~(((uint32_t) 1) << ((uint32_t) event)); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param mask Event mask such that multiple events can be enabled. + * Use ::XMC_CCU4_SLICE_MULTI_IRQ_ID_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Disables the generation of an interrupt pulse for the required events, by clearing CC4yINTE register.\n\n + * Prevents selected events of the slice from being asserted. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetInterruptNode()
XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_EnableMultipleEvents()
+ * XMC_CCU4_SLICE_DisableEvent(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableMultipleEvents(XMC_CCU4_SLICE_t *const slice, const uint16_t mask) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableMultipleEvents:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->INTE &= ~((uint32_t) mask); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Event whose assertion can potentially lead to an interrupt + * @return
+ * None
+ * + * \parDescription:
+ * Manually asserts the requested event, by setting CC4ySWS register.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API manually asserts the requested event. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetInterruptNode()
XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_EnableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_SetEvent(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetEvent:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_SetEvent:Invalid SR event", XMC_CCU4_SLICE_CHECK_INTERRUPT(event)); + slice->SWS |= ((uint32_t) 1) << ((uint32_t) event); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Asserted event which must be acknowledged. + * @return
+ * None
+ * + * \parDescription:
+ * Acknowledges an asserted event, by setting CC4ySWR with respective event flag.\n\n + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_SetEvent()
XMC_CCU4_SLICE_GetEvent(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_ClearEvent(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU4_SLICE_ClearEvent:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_ClearEvent:Invalid SR event", XMC_CCU4_SLICE_CHECK_INTERRUPT(event)); + slice->SWR |= ((uint32_t) 1) << ((uint32_t) event); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Event to be evaluated for assertion + * @return
+ * bool Returns true if event is set else false is returned. + * + * \parDescription:
+ * Evaluates if a given event is asserted or not, by reading CC4yINTS register.\n\n + * Return true if the event is asserted. For a event to be asserted it has to be + * first enabled. Only if that event is enabled the call to this API is valid. + * If the Event is enabled and has not yet occurred then a false is returned. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_SetEvent(). + */ +__STATIC_INLINE bool XMC_CCU4_SLICE_GetEvent(const XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetEvent:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_GetEvent:Invalid SR event", XMC_CCU4_SLICE_CHECK_INTERRUPT(event)); + + return(((uint32_t)(slice->INTS & ((uint32_t)1 << (uint32_t)event))) != 0U); +} +/** + * @param slice Constant pointer to CC4 Slice + * @param event Event which must be bound to a service request line + * @param sr The Service request line which is bound to the \b event + * @return
+ * None
+ * + * \parDescription:
+ * Binds requested event to a service request line, by configuring CC4ySRS register with respective event.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API binds the requested event with the requested service request line(\b sr). + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_SetEvent(). + */ +void XMC_CCU4_SLICE_SetInterruptNode(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_IRQ_ID_t event, + const XMC_CCU4_SLICE_SR_ID_t sr); + +/** + * @param slice Constant pointer to CC4 Slice + * @param level Slice output passive level + * @return
+ * None
+ * + * \parDescription:
+ * Configures the passive level for the slice output, by setting CC4yPSL register.\n\n + * Defines the passive level for the timer slice output pin. Selects either level high is passive + * or level low is passive. This is the level of the output before the compare match is value changes it. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_SetEvent(). + */ +void XMC_CCU4_SLICE_SetPassiveLevel(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_t level); + +#if defined(CCU4V3) || defined(DOXYGEN) /* Defined for XMC1400 devices only */ +/** + * @param slice Constant pointer to CC4 Slice + * + * @return
+ * None
+ * + * \parDescription:
+ * Cascades the shadow transfer operation throughout the CCU4 timer slices, by setting CSE bit in STC register.\n\n + * + * The shadow transfer enable bits needs to be set in all timer slices, that are being used in the cascaded architecture, + * at the same time. The shadow transfer enable bits, also need to be set for all slices even if the shadow values of + * some slices were not updated. It is possible to to cascade with the adjacent slices only. CC40 slice is a + * master to start the operation. + * + * \parNote:
+ * XMC_CCU4_EnableShadowTransfer() must be called to enable the shadow transfer of the all the slices, which needs to be + * cascaded. + * + * \parRelated APIs:
+ * XMC_CCU4_EnableShadowTransfer(), XMC_CCU4_SLICE_DisableCascadedShadowTransfer()
. + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU4_SLICE_EnableCascadedShadowTransfer(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_EnableCascadedShadowTransfer:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->STC |= (uint32_t) CCU4_CC4_STC_CSE_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * + * @return
+ * None
+ * + * \parDescription:
+ * Disables the cascaded the shadow transfer operation, by clearing CSE bit in STC register.\n\n + * + * If in any slice the cascaded mode disabled, other slices from there onwards does not update the values in cascaded mode. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableCascadedShadowTransfer()
. + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableCascadedShadowTransfer(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableCascadedShadowTransfer:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->STC &= ~(uint32_t) CCU4_CC4_STC_CSE_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param shadow_transfer_mode mode to be configured + * Use :: XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_t enum items for mode + * @return
+ * None
+ * + * \parDescription:
+ * Configures when the shadow transfer has to occur, by setting STM bit in STC register.\n\n + * + * After requesting for shadow transfer mode using XMC_CCU4_EnableShadowTransfer(), actual transfer occurs based on the + * selection done using this API (i.e. on period and One match, on Period match only, on One match only). + * + * \parNote:
+ * This is effective when the timer is configured in centre aligned mode. + * + * \parRelated APIs:
+ * XMC_CCU4_EnableShadowTransfer()
+ * @note Only available for XMC1400 series +*/ +__STATIC_INLINE void XMC_CCU4_SLICE_SetShadowTransferMode(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_t shadow_transfer_mode) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetShadowTransferMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->STC = ((slice->STC) & ~(uint32_t)((uint32_t)CCU4_CC4_STC_STM_Msk << (uint32_t)CCU4_CC4_STC_STM_Pos)) | + ((shadow_transfer_mode << CCU4_CC4_STC_STM_Pos) & (uint32_t)CCU4_CC4_STC_STM_Msk); +} + + /** + * @param slice Constant pointer to CC4 Slice + * @param coherent_write specifies for what fields this mode has to be applied + * Use :: XMC_CCU4_SLICE_WRITE_INTO_t enum items to create a mask of choice, using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configures the specified fields shadow value to be updated in synchronous with PWM after shadow transfer request, by + * clearing IRPC, IRCC1, IRCC2, IRLC, IRDC, IRFC bits in STC register.\n\n + * + * When coherent shadow is enabled, after calling XMC_CCU4_EnableShadowTransfer(), the value which are written in the + * respective shadow registers get updated according the configuration done using XMC_CCU4_SLICE_SetShadowTransferMode() + * API. \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU4_EnableShadowTransfer(), XMC_CCU4_SLICE_SetShadowTransferMode()
+ * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU4_SLICE_WriteCoherentlyWithPWMCycle(XMC_CCU4_SLICE_t *const slice, + const uint32_t coherent_write) +{ + XMC_ASSERT("XMC_CCU4_SLICE_WriteCoherentlyWithPWMCycle:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->STC &= ~(uint32_t)coherent_write; +} + + /** + * @param slice Constant pointer to CC4 Slice + * @param immediate_write specifies for what fields this mode has to be applied + * Use :: XMC_CCU4_SLICE_WRITE_INTO_t enum items to create a mask of choice, using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configures the specified fields shadow value to be updated immediately after shadow transfer request, by setting + * IRPC, IRCC1, IRCC2, IRLC, IRDC, IRFC bits in STC register.\n\n + * + * When immediate shadow is enabled, by calling XMC_CCU4_EnableShadowTransfer() the value which are written in the + * shadow registers get updated to the actual registers immediately. \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU4_EnableShadowTransfer()
+ * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU4_SLICE_WriteImmediateAfterShadowTransfer(XMC_CCU4_SLICE_t *const slice, + const uint32_t immediate_write) +{ + XMC_ASSERT("XMC_CCU4_SLICE_WriteImmediateAfterShadowTransfer:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->STC |= immediate_write; +} + + /** + * @param slice Constant pointer to CC4 Slice + * @param automatic_shadow_transfer specify upon which register update, automatic shadow transfer request is generated + * Use :: XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_t enum items to create a mask of choice, using a + * bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configure on which shadow register update, automatic shadow transfer request generation has to be enabled. By setting + * ASPC, ASCC1, ASCC2, ASLC, ASDC, ASFC bits in STC register.\n\n + * + * By updating the configured shadow register, the shadow transfer request is generated to update all the shadow registers. + * \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_DisableAutomaticShadowTransferRequest(). + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU4_SLICE_EnableAutomaticShadowTransferRequest(XMC_CCU4_SLICE_t *const slice, + const uint32_t automatic_shadow_transfer) +{ + XMC_ASSERT("XMC_CCU4_SLICE_EnableAutomaticShadowTransferRequest:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->STC |= automatic_shadow_transfer; +} + + /** + * @param slice Constant pointer to CC4 Slice + * @param automatic_shadow_transfer specify upon which register update, automatic shadow transfer request should not be + * generated + * Use :: XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_t enum items to create a mask of choice, using a + * bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configure on which shadow register update, automatic shadow transfer request generation has to be disabled. By + * clearing ASPC, ASCC1, ASCC2, ASLC, ASDC, ASFC bits in STC register.\n\n + * + * This disables the generation of automatic shadow transfer request for the specified register update. + * \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableAutomaticShadowTransferRequest(). + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableAutomaticShadowTransferRequest(XMC_CCU4_SLICE_t *const slice, + const uint32_t automatic_shadow_transfer) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableAutomaticShadowTransferRequest:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->STC &= ~(uint32_t)automatic_shadow_transfer; +} +#endif +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(CCU40) */ + +#endif /* CCU4_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_ccu8.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_ccu8.h new file mode 100644 index 00000000..8b732444 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_ccu8.h @@ -0,0 +1,2929 @@ +/** + * @file xmc_ccu8.h + * @date 2016-05-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * - Documentation updates
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * - Added XMC_CCU8_SLICE_LoadSelector() API, to select which compare register value has to be loaded + * during external load event. + * + * 2015-07-01: + * - In XMC_CCU8_SLICE_CHECK_INTERRUPT macro, fixed the missing item for compare match down for channel 2.
+ * + * 2015-07-24: + * - XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent() is updated to support XMC14 device.
+ * + * 2015-08-17: + * - XMC_CCU8_SLICE_PRESCALER_t enum is added to set the prescaler divider.
+ * - XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE_t is added for all the devices except XMC45 devices, to set when the + * shadow transfer has to happen.
+ * - XMC_CCU8_SOURCE_OUT0_t, XMC_CCU8_SOURCE_OUT1_t, XMC_CCU8_SOURCE_OUT2_t, XMC_CCU8_SOURCE_OUT3_t enums are added + * to maps one of the ST to OUT0, OUT1, OUT3, OUT4 signals. + * - In XMC_CCU8_SLICE_COMPARE_CONFIG_t structure, selector_out0, selector_out1, selector_out2, selector_out3 are + * added to support XMC14 devices. + * - XMC_CCU8_EnableShadowTransfer() API is made as inline, to improve the speed.
+ * - XMC_CCU8_SLICE_EnableCascadedShadowTransfer(), XMC_CCU8_SLICE_DisableCascadedShadowTransfer(), + * XMC_CCU8_SLICE_SetShadowTransferMode() API are supported for all the devices except XMC45. + * + * 2015-09-29: + * - In XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_t, two more enum items are added to support external count direction + * settings. + * + * 2015-10-07: + * - XMC_CCU8_SLICE_SetTimerCompareMatchChannel1(), XMC_CCU8_SLICE_SetTimerCompareMatchChannel2() inline APIs are + * added to update the respective compare registers directly. + * - XMC_CCU8_SLICE_GetEvent() is made as inline. + * - XMC_CCU8_SLICE_MULTI_IRQ_ID_t is added to support the XMC_CCU8_SLICE_EnableMultipleEvents() and + * XMC_CCU8_SLICE_DisableMultipleEvents() APIs. + * - DOC updates for the newly added APIs. + * + * 2016-03-09: + * - Optimization of write only registers + * + * 2016-05-20: + * - Added XMC_CCU8_SLICE_StopClearTimer() + * - Changed XMC_CCU8_SLICE_StopTimer() and XMC_CCU8_SLICE_ClearTimer() + * + * @endcond + */ + +#ifndef XMC_CCU8_H +#define XMC_CCU8_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include "xmc_common.h" + +#if defined(CCU80) + +#if UC_FAMILY == XMC1 + #include "xmc1_ccu8_map.h" +#endif + +#if UC_FAMILY == XMC4 + #include "xmc4_ccu8_map.h" +#endif + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup CCU8 + * + * @brief Capture Compare Unit 8 (CCU8) low level driver for XMC family of microcontrollers
+ * + * The CCU8 peripheral functions play a major role in applications that need complex Pulse Width Modulation (PWM) signal + * generation, with complementary high side and low side switches, multi phase control. These functions in conjunction + * with a very flexible and programmable signal conditioning scheme, make the CCU8 the must have peripheral for state + * of the art motor control, multi phase and multi level power electronics systems.\n + * Each CCU8 module is comprised of four identical 16 bit Capture/Compare Timer slices, CC8y (where y = [0..4]). Each + * timer slice can work in compare mode or in capture mode. + * + * APIs provided in this file cover the following functional blocks of CCU8: + * -- Timer configuration, Capture configuration, Function/Event configuration, Interrupt configuration + * \par Note: + * 1. SLICE (APIs prefixed with e.g. XMC_CCU8_SLICE_) + * 2. Module (APIs are not having any prefix e.g. XMC_CCU8_) + * + * \par Timer(Compare mode) configuration: + * This section of the LLD provides the configuration structure XMC_CCU8_SLICE_COMPARE_CONFIG_t, + * XMC_CCU8_SLICE_DEAD_TIME_CONFIG_t and the initialization functions XMC_CCU8_SLICE_CompareInit(), XMC_CCU8_SLICE_DeadTimeInit(). + * + * It can be used to: + * -# Start and Stop the timer. (XMC_CCU8_SLICE_StartTimer(), XMC_CCU8_SLICE_StopTimer()) + * -# Update the period, compare, Dither, Prescaler and Passive values. (XMC_CCU8_SLICE_SetTimerPeriodMatch(), + * XMC_CCU8_SLICE_SetTimerCompareMatch(), XMC_CCU8_SLICE_SetPrescaler(), XMC_CCU8_SLICE_SetDitherCompareValue(), + * XMC_CCU8_SLICE_SetPassiveLevel()) + * -# Configure the dead time.(XMC_CCU8_SLICE_SetDeadTimeValue(), XMC_CCU8_SLICE_SetDeadTimePrescaler()) + * -# Enable the slices to support multichannel mode. (XMC_CCU8_SLICE_EnableMultiChannelMode()) + * + * \par Capture configuration: + * This section of the LLD provides the configuration structure XMC_CCU8_SLICE_CAPTURE_CONFIG_t and the initialization + * function XMC_CCU8_SLICE_CaptureInit(). + * + * It can be used to: + * -# Configure the capture functionality. (XMC_CCU8_SLICE_Capture0Config(), XMC_CCU8_SLICE_Capture1Config()) + * -# Read the captured values along with the status, which indicate the value is latest or not. + * (XMC_CCU8_SLICE_GetCaptureRegisterValue()) + * + * \par Function/Event configuration: + * This section of the LLD provides the configuration structure XMC_CCU8_SLICE_EVENT_CONFIG_t. + * + * It can be used to: + * -# Enable and Disable the events. (XMC_CCU8_SLICE_EnableEvent(), XMC_CCU8_SLICE_DisableEvent()) + * -# Configure to start and stop the timer on external events.(XMC_CCU8_SLICE_StartConfig(), XMC_CCU8_SLICE_StopConfig()) + * -# Modulation, external load and Gating of the timer output.(XMC_CCU8_SLICE_ModulationConfig(), + * XMC_CCU8_SLICE_LoadConfig(), XMC_CCU8_SLICE_GateConfig()) + * -# Control the count direction of the timer based on the external event. (XMC_CCU8_SLICE_DirectionConfig()) + * -# Count the external events.(XMC_CCU8_SLICE_CountConfig()) + * -# External Trap. Which can be used as protective feature.(XMC_CCU8_SLICE_EnableTrap(), XMC_CCU8_SLICE_DisableTrap(), + * XMC_CCU8_SLICE_TrapConfig()) + * + * \par Interrupt configuration: + * This section of the LLD provides the function to configure the interrupt node to each event (XMC_CCU8_SLICE_SetInterruptNode()) + * + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_CCU8_SLICE_CHECK_INTERRUPT(interrupt) \ + ((interrupt == XMC_CCU8_SLICE_IRQ_ID_PERIOD_MATCH) || \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_ONE_MATCH) || \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_UP_CH_1) || \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_DOWN_CH_1)|| \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_UP_CH_2) || \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_DOWN_CH_2)|| \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_EVENT0) || \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_EVENT1) || \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_EVENT2) || \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_TRAP)) + +/* Macro to check if the slice ptr passed is valid */ +#define XMC_CCU8_SLICE_CHECK_COMP_CHANNEL(cmp_channel) \ + ((cmp_channel == XMC_CCU8_SLICE_COMPARE_CHANNEL_1) || \ + (cmp_channel == XMC_CCU8_SLICE_COMPARE_CHANNEL_2)) + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/** + * Typedef for CCU8 Global data structure + */ +typedef CCU8_GLOBAL_TypeDef XMC_CCU8_MODULE_t; + +/** + * Typedef for CCU8 Slice data structure + */ +typedef CCU8_CC8_TypeDef XMC_CCU8_SLICE_t; + +/** + * Return Value of an API + */ +typedef enum XMC_CCU8_STATUS +{ + XMC_CCU8_STATUS_OK = 0U, /**< API fulfils request */ + XMC_CCU8_STATUS_ERROR , /**< API cannot fulfil request */ + XMC_CCU8_STATUS_RUNNING , /**< The timer slice is currently running */ + XMC_CCU8_STATUS_IDLE /**< The timer slice is currently idle */ +} XMC_CCU8_STATUS_t; + +/** + * CCU8 module clock + */ +typedef enum XMC_CCU8_CLOCK +{ + XMC_CCU8_CLOCK_SCU = 0U, /**< Select the fCCU as the clock */ + XMC_CCU8_CLOCK_EXTERNAL_A , /**< External clock-A */ + XMC_CCU8_CLOCK_EXTERNAL_B , /**< External clock-B */ + XMC_CCU8_CLOCK_EXTERNAL_C /**< External clock-C */ +} XMC_CCU8_CLOCK_t; + +/** + * CCU8 set the shadow transfer type for multichannel mode + */ +typedef enum XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER +{ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE0 = (uint32_t)0x4000000, /**< Shadow transfer through software + only for slice 0*/ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE0 = (uint32_t)0x4000400, /**< Shadow transfer through software + and hardware for slice 0 */ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE1 = (uint32_t)0x8000000, /**< Shadow transfer through software + only for slice 1*/ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE1 = (uint32_t)0x8000800, /**< Shadow transfer through software + and hardware for slice 1 */ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE2 = (uint32_t)0x10000000, /**< Shadow transfer through software + only for slice 2 */ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE2 = (uint32_t)0x10001000, /**< Shadow transfer through software + and hardware for slice 2 */ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE3 = (uint32_t)0x20000000, /**< Shadow transfer through software + only for slice 3*/ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE3 = (uint32_t)0x20002000 /**< Shadow transfer through software + and hardware for slice 3 */ +} XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_t; + +/** + * Operational modes of CCU8 slice + */ +typedef enum XMC_CCU8_SLICE_MODE +{ + XMC_CCU8_SLICE_MODE_COMPARE = 0U, /**< slice(CC8y) operates in Compare Mode */ + XMC_CCU8_SLICE_MODE_CAPTURE /**< slice(CC8y) operates in Capture Mode */ +} XMC_CCU8_SLICE_MODE_t; + +/** + * Slice Output selection + */ +typedef enum XMC_CCU8_SLICE_OUTPUT +{ + XMC_CCU8_SLICE_OUTPUT_0 = 1U, /**< Slice Output-0 */ + XMC_CCU8_SLICE_OUTPUT_1 = 2U, /**< Slice Output-1 */ + XMC_CCU8_SLICE_OUTPUT_2 = 4U, /**< Slice Output-2 */ + XMC_CCU8_SLICE_OUTPUT_3 = 8U /**< Slice Output-3 */ +} XMC_CCU8_SLICE_OUTPUT_t; + +/** + * Timer counting modes for the slice + */ +typedef enum XMC_CCU8_SLICE_TIMER_COUNT_MODE +{ + XMC_CCU8_SLICE_TIMER_COUNT_MODE_EA = 0U, /**< Edge Aligned Mode */ + XMC_CCU8_SLICE_TIMER_COUNT_MODE_CA /**< Centre Aligned Mode */ +} XMC_CCU8_SLICE_TIMER_COUNT_MODE_t; + +/** + * Timer repetition mode for the slice + */ +typedef enum XMC_CCU8_SLICE_TIMER_REPEAT_MODE +{ + XMC_CCU8_SLICE_TIMER_REPEAT_MODE_REPEAT = 0U, /**< Repetitive mode: continuous mode of operation */ + XMC_CCU8_SLICE_TIMER_REPEAT_MODE_SINGLE /**< Single shot mode: Once a Period match/One match + occurs timer goes to idle state */ +} XMC_CCU8_SLICE_TIMER_REPEAT_MODE_t; + +/** + * Timer counting direction for the CCU8 slice + */ +typedef enum XMC_CCU8_SLICE_TIMER_COUNT_DIR +{ + XMC_CCU8_SLICE_TIMER_COUNT_DIR_UP = 0U, /**< Counting up */ + XMC_CCU8_SLICE_TIMER_COUNT_DIR_DOWN /**< Counting down */ +} XMC_CCU8_SLICE_TIMER_COUNT_DIR_t; + +/** + * Capture mode register sets + */ +typedef enum XMC_CCU8_SLICE_CAP_REG_SET +{ + XMC_CCU8_SLICE_CAP_REG_SET_LOW = 0U, /**< Capture register-0, Capture register-1 used */ + XMC_CCU8_SLICE_CAP_REG_SET_HIGH /**< Capture register-0, Capture register-1 used */ +} XMC_CCU8_SLICE_CAP_REG_SET_t; + +/** + * Prescaler mode + */ +typedef enum XMC_CCU8_SLICE_PRESCALER_MODE +{ + XMC_CCU8_SLICE_PRESCALER_MODE_NORMAL = 0U, /**< Fixed division of module clock */ + XMC_CCU8_SLICE_PRESCALER_MODE_FLOAT /**< Floating divider */ +} XMC_CCU8_SLICE_PRESCALER_MODE_t; + +/** + * Timer output passive level + */ +typedef enum XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL +{ + XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_LOW = 0U, /**< Passive level = Low */ + XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_HIGH /**< Passive level = High */ +} XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_t; + +/** + * Compare Channel selection + */ +typedef enum XMC_CCU8_SLICE_COMPARE_CHANNEL +{ + XMC_CCU8_SLICE_COMPARE_CHANNEL_1 = 0U, /**< Compare Channel-1 */ + XMC_CCU8_SLICE_COMPARE_CHANNEL_2 /**< Compare Channel-2 */ +} XMC_CCU8_SLICE_COMPARE_CHANNEL_t; + +/** + * Timer clock Divider + */ +typedef enum XMC_CCU8_SLICE_PRESCALER +{ + XMC_CCU8_SLICE_PRESCALER_1 = 0U, /**< Slice Clock = fccu8 */ + XMC_CCU8_SLICE_PRESCALER_2 , /**< Slice Clock = fccu8/2 */ + XMC_CCU8_SLICE_PRESCALER_4 , /**< Slice Clock = fccu8/4 */ + XMC_CCU8_SLICE_PRESCALER_8 , /**< Slice Clock = fccu8/8 */ + XMC_CCU8_SLICE_PRESCALER_16 , /**< Slice Clock = fccu8/16 */ + XMC_CCU8_SLICE_PRESCALER_32 , /**< Slice Clock = fccu8/32 */ + XMC_CCU8_SLICE_PRESCALER_64 , /**< Slice Clock = fccu8/64 */ + XMC_CCU8_SLICE_PRESCALER_128 , /**< Slice Clock = fccu8/128 */ + XMC_CCU8_SLICE_PRESCALER_256 , /**< Slice Clock = fccu8/256 */ + XMC_CCU8_SLICE_PRESCALER_512 , /**< Slice Clock = fccu8/512 */ + XMC_CCU8_SLICE_PRESCALER_1024 , /**< Slice Clock = fccu8/1024 */ + XMC_CCU8_SLICE_PRESCALER_2048 , /**< Slice Clock = fccu8/2048 */ + XMC_CCU8_SLICE_PRESCALER_4096 , /**< Slice Clock = fccu8/4096 */ + XMC_CCU8_SLICE_PRESCALER_8192 , /**< Slice Clock = fccu8/8192 */ + XMC_CCU8_SLICE_PRESCALER_16384 , /**< Slice Clock = fccu8/16384 */ + XMC_CCU8_SLICE_PRESCALER_32768 /**< Slice Clock = fccu8/32768 */ +} XMC_CCU8_SLICE_PRESCALER_t; + +/** + * Dead Time Generator Clock Divider + */ +typedef enum XMC_CCU8_SLICE_DTC_DIV +{ + XMC_CCU8_SLICE_DTC_DIV_1 = 0U, /**< DTC clock = Slice Clock */ + XMC_CCU8_SLICE_DTC_DIV_2 , /**< DTC clock = Slice Clock/2 */ + XMC_CCU8_SLICE_DTC_DIV_4 , /**< DTC clock = Slice Clock/4 */ + XMC_CCU8_SLICE_DTC_DIV_8 /**< DTC clock = Slice Clock/8 */ +} XMC_CCU8_SLICE_DTC_DIV_t; + + +/** + * The compare channel output which is routed to the slice output signal(STy). + */ +typedef enum XMC_CCU8_SLICE_STATUS +{ + XMC_CCU8_SLICE_STATUS_CHANNEL_1 = 0U, /**< Channel-1 status connected to Slice Status */ + XMC_CCU8_SLICE_STATUS_CHANNEL_2 , /**< Channel-2 status connected to Slice Status */ + XMC_CCU8_SLICE_STATUS_CHANNEL_1_AND_2 , /**< \b Wired \b AND of Channel-1 and Channel-2 status connected to + Slice status */ +#if ((UC_SERIES == XMC13) || (UC_SERIES == XMC14)) || defined(DOXYGEN) + XMC_CCU8_SLICE_STATUS_CHANNEL_1_OR_2 /**< \b Wired \b OR of Channel-1 and Channel-2 status connected to Slice + status. @note Only available for XMC1300 and XMC1400 series */ +#endif +} XMC_CCU8_SLICE_STATUS_t; + +/** + * Compare channel for which modulation has to be applied + */ +typedef enum XMC_CCU8_SLICE_MODULATION_CHANNEL +{ + XMC_CCU8_SLICE_MODULATION_CHANNEL_NONE = 0U, /**< No modulation */ + XMC_CCU8_SLICE_MODULATION_CHANNEL_1 , /**< Modulation for Compare Channel-1 */ + XMC_CCU8_SLICE_MODULATION_CHANNEL_2 , /**< Modulation for Compare Channel-2 */ + XMC_CCU8_SLICE_MODULATION_CHANNEL_1_AND_2 /**< Modulation for Compare Channel-1 and Compare Channel-2 */ +} XMC_CCU8_SLICE_MODULATION_CHANNEL_t; + +/** + * External Function list + */ +typedef enum XMC_CCU8_SLICE_FUNCTION +{ + XMC_CCU8_SLICE_FUNCTION_START = 0U, /**< Start function */ + XMC_CCU8_SLICE_FUNCTION_STOP , /**< Stop function */ + XMC_CCU8_SLICE_FUNCTION_CAPTURE_EVENT0 , /**< Capture Event-0 function, CCycapt0 signal is used for event + generation */ + XMC_CCU8_SLICE_FUNCTION_CAPTURE_EVENT1 , /**< Capture Event-1 function, CCycapt1 signal is used for event + generation */ + XMC_CCU8_SLICE_FUNCTION_GATING , /**< Gating function */ + XMC_CCU8_SLICE_FUNCTION_DIRECTION , /**< Direction function */ + XMC_CCU8_SLICE_FUNCTION_LOAD , /**< Load function */ + XMC_CCU8_SLICE_FUNCTION_COUNT , /**< Counting function */ + XMC_CCU8_SLICE_FUNCTION_OVERRIDE , /**< Override function */ + XMC_CCU8_SLICE_FUNCTION_MODULATION , /**< Modulation function */ + XMC_CCU8_SLICE_FUNCTION_TRAP /**< Trap function */ +} XMC_CCU8_SLICE_FUNCTION_t; + +/** + * External Event list + */ +typedef enum XMC_CCU8_SLICE_EVENT +{ + XMC_CCU8_SLICE_EVENT_NONE = 0U, /**< None */ + XMC_CCU8_SLICE_EVENT_0 , /**< Event-0 */ + XMC_CCU8_SLICE_EVENT_1 , /**< Event-1 */ + XMC_CCU8_SLICE_EVENT_2 /**< Event-2 */ +} XMC_CCU8_SLICE_EVENT_t; + +/** + * External Event trigger criteria - Edge sensitivity + */ +typedef enum XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY +{ + XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_NONE = 0U, /**< None */ + XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_RISING_EDGE , /**< Rising Edge of the input signal generates + event trigger */ + XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_FALLING_EDGE , /**< Falling Edge of the input signal generates event + trigger */ + XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_DUAL_EDGE /**< Both Rising and Falling edges cause an event trigger */ +} XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_t; + +/** + * External Event trigger criteria - Level sensitivity + */ +typedef enum XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY +{ + XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH = 0U, /**< Level sensitive functions react to a high signal level*/ + XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW = 1U, /**< Level sensitive functions react to a low signal level */ + /* Below enum items can be utilised specific to the functionality */ + XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_COUNT_UP_ON_LOW = 0U, /**< Timer counts up, during Low state of the control signal */ + XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_COUNT_UP_ON_HIGH = 1U /**< Timer counts up, during High state of the control signal */ +} XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_t; + +/** + * Low pass filter Configuration. The External Event input should be stable for a selected number of clock cycles. + */ +typedef enum XMC_CCU8_SLICE_EVENT_FILTER +{ + XMC_CCU8_SLICE_EVENT_FILTER_DISABLED = 0U, /**< No Low Pass Filtering is applied */ + XMC_CCU8_SLICE_EVENT_FILTER_3_CYCLES , /**< Input should be stable for 3 clock cycles */ + XMC_CCU8_SLICE_EVENT_FILTER_5_CYCLES , /**< Input should be stable for 5 clock cycles */ + XMC_CCU8_SLICE_EVENT_FILTER_7_CYCLES /**< Input should be stable for 7 clock cycles */ +} XMC_CCU8_SLICE_EVENT_FILTER_t; + +/** + * External Event Input list. This list depicts the possible input connections to the CCU8 slice. + * Interconnects are specific to each device. + */ +typedef uint8_t XMC_CCU8_SLICE_INPUT_t; + + +/** + * Actions that can be performed upon detection of an external Timer STOP event + */ +typedef enum XMC_CCU8_SLICE_END_MODE +{ + XMC_CCU8_SLICE_END_MODE_TIMER_STOP = 0U, /**< Stops the timer, without clearing TIMER register */ + XMC_CCU8_SLICE_END_MODE_TIMER_CLEAR , /**< Without stopping timer, clears the TIMER register */ + XMC_CCU8_SLICE_END_MODE_TIMER_STOP_CLEAR /**< Stops the timer and clears the TIMER register */ +} XMC_CCU8_SLICE_END_MODE_t; + +/** + * Actions that can be performed upon detection of an external Timer START event + */ +typedef enum XMC_CCU8_SLICE_START_MODE +{ + XMC_CCU8_SLICE_START_MODE_TIMER_START = 0U, /**< Start the timer from the current count of TIMER register */ + XMC_CCU8_SLICE_START_MODE_TIMER_START_CLEAR /**< Clears the TIMER register and start the timer */ +} XMC_CCU8_SLICE_START_MODE_t; + +/** + * Modulation of timer output signals + */ +typedef enum XMC_CCU8_SLICE_MODULATION_MODE +{ + XMC_CCU8_SLICE_MODULATION_MODE_CLEAR_ST_OUT = 0U, /**< Clear ST and OUT signals */ + XMC_CCU8_SLICE_MODULATION_MODE_CLEAR_OUT /**< Clear only the OUT signal */ +} XMC_CCU8_SLICE_MODULATION_MODE_t; + +/** + * Trap exit mode + */ +typedef enum XMC_CCU8_SLICE_TRAP_EXIT_MODE +{ + XMC_CCU8_SLICE_TRAP_EXIT_MODE_AUTOMATIC = 0U, /**< Clear trap state as soon as the trap signal is de-asserted */ + XMC_CCU8_SLICE_TRAP_EXIT_MODE_SW /**< Clear only when acknowledged by software */ +} XMC_CCU8_SLICE_TRAP_EXIT_MODE_t; + +/** + * Timer clear on capture + */ +typedef enum XMC_CCU8_SLICE_TIMER_CLEAR_MODE +{ + XMC_CCU8_SLICE_TIMER_CLEAR_MODE_NEVER = 0U, /**< Never clear the timer on any capture event */ + XMC_CCU8_SLICE_TIMER_CLEAR_MODE_CAP_HIGH , /**< Clear only when timer value has been captured in C3V and C2V */ + XMC_CCU8_SLICE_TIMER_CLEAR_MODE_CAP_LOW , /**< Clear only when timer value has been captured in C1V and C0V */ + XMC_CCU8_SLICE_TIMER_CLEAR_MODE_ALWAYS /**< Always clear the timer upon detection of any capture event */ +} XMC_CCU8_SLICE_TIMER_CLEAR_MODE_t; + +/** + * Multi Channel Shadow transfer request configuration options + */ +typedef enum XMC_CCU8_SLICE_MCMS_ACTION +{ + XMC_CCU8_SLICE_MCMS_ACTION_TRANSFER_PR_CR = 0U, /**< Transfer Compare and Period Shadow register values to + the actual registers upon MCS xfer request */ + XMC_CCU8_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP = 1U, /**< Transfer Compare, Period and Prescaler Compare Shadow + register values to the actual registers upon MCS xfer + request */ + XMC_CCU8_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP_DIT = 3U /**< Transfer Compare, Period ,Prescaler Compare and Dither + Compare register values to the actual registers upon + MCS xfer request */ +} XMC_CCU8_SLICE_MCMS_ACTION_t; + +/** + * Available Interrupt Event Ids + */ +typedef enum XMC_CCU8_SLICE_IRQ_ID +{ + XMC_CCU8_SLICE_IRQ_ID_PERIOD_MATCH = 0U , /**< Period match counting up */ + XMC_CCU8_SLICE_IRQ_ID_ONE_MATCH = 1U , /**< One match counting down */ + XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_UP_CH_1 = 2U , /**< Compare match counting up for channel 1 */ + XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_DOWN_CH_1 = 3U , /**< Compare match counting down for channel 1 */ + XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_UP_CH_2 = 4U , /**< Compare match counting up for channel 2 */ + XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_DOWN_CH_2 = 5U , /**< Compare match counting down for channel 2 */ + XMC_CCU8_SLICE_IRQ_ID_EVENT0 = 8U , /**< Event-0 occurrence */ + XMC_CCU8_SLICE_IRQ_ID_EVENT1 = 9U , /**< Event-1 occurrence */ + XMC_CCU8_SLICE_IRQ_ID_EVENT2 = 10U, /**< Event-2 occurrence */ + XMC_CCU8_SLICE_IRQ_ID_TRAP = 11U /**< Trap occurrence */ +} XMC_CCU8_SLICE_IRQ_ID_t; + +/** + * Available Interrupt Event Ids, which is added to support multi event APIs + */ +typedef enum XMC_CCU8_SLICE_MULTI_IRQ_ID +{ + XMC_CCU8_SLICE_MULTI_IRQ_ID_PERIOD_MATCH = 0x1U, /**< Period match counting up */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_ONE_MATCH = 0x2U, /**< One match counting down */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_COMPARE_MATCH_UP_CH_1 = 0x4U, /**< Compare match counting up for channel 1 */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_COMPARE_MATCH_DOWN_CH_1 = 0x8U, /**< Compare match counting down for channel 1 */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_COMPARE_MATCH_UP_CH_2 = 0x10U, /**< Compare match counting up for channel 2 */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_COMPARE_MATCH_DOWN_CH_2 = 0x20U, /**< Compare match counting down for channel 2 */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_EVENT0 = 0x100U, /**< Event-0 occurrence */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_EVENT1 = 0x200U, /**< Event-1 occurrence */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_EVENT2 = 0x400U, /**< Event-2 occurrence */ +} XMC_CCU8_SLICE_MULTI_IRQ_ID_t; + +/** + * Service Request Lines for CCU8. Event are mapped to these SR lines and these are used to generate the interrupt. + */ +typedef enum XMC_CCU8_SLICE_SR_ID +{ + XMC_CCU8_SLICE_SR_ID_0 = 0U, /**< Service Request Line-0 selected */ + XMC_CCU8_SLICE_SR_ID_1 , /**< Service Request Line-1 selected */ + XMC_CCU8_SLICE_SR_ID_2 , /**< Service Request Line-2 selected */ + XMC_CCU8_SLICE_SR_ID_3 /**< Service Request Line-3 selected */ +} XMC_CCU8_SLICE_SR_ID_t; + + +/** + * Slice shadow transfer options. + */ +typedef enum XMC_CCU8_SHADOW_TRANSFER +{ + XMC_CCU8_SHADOW_TRANSFER_SLICE_0 = CCU8_GCSS_S0SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-0 */ + XMC_CCU8_SHADOW_TRANSFER_DITHER_SLICE_0 = CCU8_GCSS_S0DSE_Msk, /**< Transfer Dither compare shadow register value + to actual register for SLICE-0 */ + XMC_CCU8_SHADOW_TRANSFER_PRESCALER_SLICE_0 = CCU8_GCSS_S0PSE_Msk, /**< Transfer Prescaler shadow register value to + actual register for SLICE-0 */ + XMC_CCU8_SHADOW_TRANSFER_SLICE_1 = CCU8_GCSS_S1SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-1 */ + XMC_CCU8_SHADOW_TRANSFER_DITHER_SLICE_1 = CCU8_GCSS_S1DSE_Msk, /**< Transfer Dither compare shadow register value + to actual registers for SLICE-1 */ + XMC_CCU8_SHADOW_TRANSFER_PRESCALER_SLICE_1 = CCU8_GCSS_S1PSE_Msk, /**< Transfer Prescaler shadow register value to + actual register for SLICE-1 */ + XMC_CCU8_SHADOW_TRANSFER_SLICE_2 = CCU8_GCSS_S2SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-2 */ + XMC_CCU8_SHADOW_TRANSFER_DITHER_SLICE_2 = CCU8_GCSS_S2DSE_Msk, /**< Transfer Dither compare shadow register value + to actual register for SLICE-2 */ + XMC_CCU8_SHADOW_TRANSFER_PRESCALER_SLICE_2 = CCU8_GCSS_S2PSE_Msk, /**< Transfer Prescaler shadow register value to + actual register for SLICE-2 */ + XMC_CCU8_SHADOW_TRANSFER_SLICE_3 = CCU8_GCSS_S3SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-3 */ + XMC_CCU8_SHADOW_TRANSFER_DITHER_SLICE_3 = CCU8_GCSS_S3DSE_Msk, /**< Transfer Dither compare shadow register value + to actual register for SLICE-3 */ + XMC_CCU8_SHADOW_TRANSFER_PRESCALER_SLICE_3 = CCU8_GCSS_S3PSE_Msk /**< Transfer Prescaler shadow register value to + actual register for SLICE-3 */ +} XMC_CCU8_SHADOW_TRANSFER_t; + +#if (UC_SERIES != XMC45) || defined(DOXYGEN) +/** + * Slice shadow transfer mode options. + * @note Not available for XMC4500 series + */ +typedef enum XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE +{ + XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE_IN_PERIOD_MATCH_AND_ONE_MATCH = 0U, /**< Shadow transfer is done in Period Match and + One match. */ + XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE_ONLY_IN_PERIOD_MATCH = 1U, /**< Shadow transfer is done only in Period Match. */ + XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE_ONLY_IN_ONE_MATCH = 2U /**< Shadow transfer is done only in One Match. */ +} XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE_t; +#endif + +#if defined(CCU8V3) || defined(DOXYGEN) /* Defined for XMC1400 devices only */ +/** + * Output sources for OUTy0 signal + * @note Only available for XMC1400 series + */ + typedef enum XMC_CCU8_SOURCE_OUT0 +{ + XMC_CCU8_SOURCE_OUT0_ST1 = (uint32_t)0x0, /**< CCU8yST1 signal path is connected the CCU8x.OUT0 */ + XMC_CCU8_SOURCE_OUT0_INV_ST1 = (uint32_t)0x1, /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT0 */ + XMC_CCU8_SOURCE_OUT0_ST2 = (uint32_t)0x2, /**< CCU8yST2 signal path is connected the CCU8x.OUT0 */ + XMC_CCU8_SOURCE_OUT0_INV_ST2 = (uint32_t)0x3 /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT0 */ +} XMC_CCU8_SOURCE_OUT0_t; + +/** + * Output sources for OUTy1 signal + * @note Only available for XMC1400 series + */ + typedef enum XMC_CCU8_SOURCE_OUT1 +{ + XMC_CCU8_SOURCE_OUT1_ST1 = (uint32_t)0x1, /**< CCU8yST1 signal path is connected the CCU8x.OUT1 */ + XMC_CCU8_SOURCE_OUT1_INV_ST1 = (uint32_t)0x0, /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT1 */ + XMC_CCU8_SOURCE_OUT1_ST2 = (uint32_t)0x3, /**< CCU8yST2 signal path is connected the CCU8x.OUT1 */ + XMC_CCU8_SOURCE_OUT1_INV_ST2 = (uint32_t)0x2 /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT1 */ +} XMC_CCU8_SOURCE_OUT1_t; + +/** + * Output sources for OUTy2 signal + * @note Only available for XMC1400 series + */ + typedef enum XMC_CCU8_SOURCE_OUT2 +{ + XMC_CCU8_SOURCE_OUT2_ST2 = (uint32_t)0x0, /**< CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_SOURCE_OUT2_INV_ST2 = (uint32_t)0x1, /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_SOURCE_OUT2_ST1 = (uint32_t)0x2, /**< CCU8yST1 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_SOURCE_OUT2_INV_ST1 = (uint32_t)0x3 /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT2 */ +} XMC_CCU8_SOURCE_OUT2_t; + +/** + * Output sources for OUTy3 signal + * @note Only available for XMC1400 series + */ + typedef enum XMC_CCU8_SOURCE_OUT3 +{ + XMC_CCU8_SOURCE_OUT3_ST2 = (uint32_t)0x1, /**< CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_SOURCE_OUT3_INV_ST2 = (uint32_t)0x0, /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_SOURCE_OUT3_ST1 = (uint32_t)0x3, /**< CCU8yST1 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_SOURCE_OUT3_INV_ST1 = (uint32_t)0x2 /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT2 */ +} XMC_CCU8_SOURCE_OUT3_t; +#endif + + +/** + * Output selector for CCU8x.OUT0-3 + */ +#if !defined(CCU8V3) /* Defined for all devices except XMC1400 */ +typedef enum XMC_CCU8_OUT_PATH +{ + XMC_CCU8_OUT_PATH_OUT0_ST1 = (uint32_t)0x20000, /**< CCU8yST1 signal path is connected the CCU8x.OUT0 */ + XMC_CCU8_OUT_PATH_OUT0_INV_ST1 = (uint32_t)0x20002, /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT0 */ + XMC_CCU8_OUT_PATH_OUT1_ST1 = (uint32_t)0x40000, /**< CCU8yST1 signal path is connected the CCU8x.OUT1 */ + XMC_CCU8_OUT_PATH_OUT1_INV_ST1 = (uint32_t)0x40004, /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT1 */ + XMC_CCU8_OUT_PATH_OUT2_ST2 = (uint32_t)0x80000, /**< CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_OUT_PATH_OUT2_INV_ST2 = (uint32_t)0x80008, /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_OUT_PATH_OUT3_ST2 = (uint32_t)0x100000,/**< CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_OUT_PATH_OUT3_INV_ST1 = (uint32_t)0x100010 /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT3 */ +} XMC_CCU8_OUT_PATH_t; +#else +typedef enum XMC_CCU8_OUT_PATH +{ + XMC_CCU8_OUT_PATH_OUT0_ST1 = (uint32_t)0x000C0, /**< CCU8yST1 signal path is connected the CCU8x.OUT0 */ + XMC_CCU8_OUT_PATH_OUT0_INV_ST1 = (uint32_t)0x000D0, /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT0 */ + XMC_CCU8_OUT_PATH_OUT0_ST2 = (uint32_t)0x000E0, /**< CCU8yST2 signal path is connected the CCU8x.OUT0. @note Only available for XMC1400 series*/ + XMC_CCU8_OUT_PATH_OUT0_INV_ST2 = (uint32_t)0x000F0, /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT0. @note Only available for XMC1400 series*/ + XMC_CCU8_OUT_PATH_OUT1_ST1 = (uint32_t)0x00D00, /**< CCU8yST1 signal path is connected the CCU8x.OUT1 */ + XMC_CCU8_OUT_PATH_OUT1_INV_ST1 = (uint32_t)0x00C00, /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT1 */ + XMC_CCU8_OUT_PATH_OUT1_ST2 = (uint32_t)0x00F00, /**< CCU8yST2 signal path is connected the CCU8x.OUT1. @note Only available for XMC1400 series*/ + XMC_CCU8_OUT_PATH_OUT1_INV_ST2 = (uint32_t)0x00E00, /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT1. @note Only available for XMC1400 series */ + XMC_CCU8_OUT_PATH_OUT2_ST2 = (uint32_t)0x0C000, /**< CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_OUT_PATH_OUT2_INV_ST2 = (uint32_t)0x0D000, /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_OUT_PATH_OUT2_ST1 = (uint32_t)0x0E000, /**< CCU8yST1 signal path is connected the CCU8x.OUT2. @note Only available for XMC1400 series*/ + XMC_CCU8_OUT_PATH_OUT2_INV_ST1 = (uint32_t)0x0F000, /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT2.@note Only available for XMC1400 series */ + XMC_CCU8_OUT_PATH_OUT3_ST2 = (uint32_t)0xD0000, /**< CCU8yST2 signal path is connected the CCU8x.OUT3 */ + XMC_CCU8_OUT_PATH_OUT3_INV_ST2 = (uint32_t)0xC0000, /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT3.@note Only available for XMC1400 series */ + XMC_CCU8_OUT_PATH_OUT3_ST1 = (uint32_t)0xF0000, /**< CCU8yST1 signal path is connected the CCU8x.OUT3.@note Only available for XMC1400 series */ + XMC_CCU8_OUT_PATH_OUT3_INV_ST1 = (uint32_t)0xE0000 /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT3 */ +} XMC_CCU8_OUT_PATH_t; + +/** + * Immediate write into configuration register + * @note Only available for XMC1400 series + */ +typedef enum XMC_CCU8_SLICE_WRITE_INTO +{ + XMC_CCU8_SLICE_WRITE_INTO_PERIOD_CONFIGURATION = CCU8_CC8_STC_IRPC_Msk, /**< Immediate or Coherent + Write into Period + Configuration */ + XMC_CCU8_SLICE_WRITE_INTO_COMPARE1_CONFIGURATION = CCU8_CC8_STC_IRCC1_Msk, /**< Immediate or Coherent + Write into Compare 1 + Configuration */ + XMC_CCU8_SLICE_WRITE_INTO_COMPARE2_CONFIGURATION = CCU8_CC8_STC_IRCC2_Msk, /**< Immediate or Coherent + Write into Compare 2 + Configuration */ + XMC_CCU8_SLICE_WRITE_INTO_PASSIVE_LEVEL_CONFIGURATION = CCU8_CC8_STC_IRLC_Msk, /**< Immediate or Coherent + Write into Passive Level + Configuration */ + XMC_CCU8_SLICE_WRITE_INTO_DITHER_VALUE_CONFIGURATION = CCU8_CC8_STC_IRDC_Msk, /**< Immediate or Coherent + Write into Dither Value + Configuration */ + XMC_CCU8_SLICE_WRITE_INTO_FLOATING_PRESCALER_VALUE_CONFIGURATION = CCU8_CC8_STC_IRFC_Msk /**< Immediate or Coherent + Write into Floating Prescaler + Value Configuration */ +} XMC_CCU8_SLICE_WRITE_INTO_t; + + +/** + * Automatic Shadow Transfer request when writing into shadow register + * @note Only available for XMC1400 series + */ +typedef enum XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO +{ + XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_PERIOD_SHADOW = CCU8_CC8_STC_ASPC_Msk, /**< Automatic Shadow + Transfer request when + writing into Period + Shadow Register */ + XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_COMPARE1_SHADOW = CCU8_CC8_STC_ASCC1_Msk, /**< Automatic Shadow + transfer request + when writing into + Compare 1 Shadow Register */ + XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_COMPARE2_SHADOW = CCU8_CC8_STC_ASCC2_Msk, /**< Automatic Shadow + transfer request + when writing into + Compare 2 Shadow Register */ + XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_PASSIVE_LEVEL = CCU8_CC8_STC_ASLC_Msk, /**< Automatic Shadow transfer + request when writing + into Passive Level Register*/ + XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_DITHER_SHADOW = CCU8_CC8_STC_ASDC_Msk, /**< Automatic Shadow transfer + request when writing + into Dither Shadow Register */ + XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_FLOATING_PRESCALER_SHADOW = CCU8_CC8_STC_ASFC_Msk /**< Automatic Shadow transfer + request when writing + into Floating Prescaler Shadow + register */ + +} XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_t; +#endif +/** + * CCU8 slice mask which can be used for the APIs as input where multi slice support is available + */ +typedef enum XMC_CCU8_SLICE_MASK +{ + XMC_CCU8_SLICE_MASK_SLICE_0 = 1U , /**< SLICE-0 */ + XMC_CCU8_SLICE_MASK_SLICE_1 = 2U , /**< SLICE-1 */ + XMC_CCU8_SLICE_MASK_SLICE_2 = 4U , /**< SLICE-2 */ + XMC_CCU8_SLICE_MASK_SLICE_3 = 8U /**< SLICE-3 */ +} XMC_CCU8_SLICE_MASK_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/** + * Configuration data structure of an External Event(Event-0/1/2). + * Needed to configure the various aspects of an External Event. + * This structure will not connect the external event with an external function. + */ +typedef struct XMC_CCU8_SLICE_EVENT_CONFIG +{ + XMC_CCU8_SLICE_INPUT_t mapped_input; /**< Required input signal for the Event. */ + XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_t edge; /**< Select the event edge of the input signal. + This is needed for an edge sensitive External function.*/ + XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_t level; /**< Select the event level of the input signal. + This is needed for an level sensitive External function.*/ + XMC_CCU8_SLICE_EVENT_FILTER_t duration; /**< Low Pass filter duration in terms of fCCU clock cycles. */ +} XMC_CCU8_SLICE_EVENT_CONFIG_t; + +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * Dead Time configuration + */ +typedef struct XMC_CCU8_SLICE_DEAD_TIME_CONFIG +{ + union + { + struct + { + uint32_t enable_dead_time_channel1 : 1; /**< Enable dead time for Compare Channel-1 */ + uint32_t enable_dead_time_channel2 : 1; /**< Enable dead time for Compare Channel-2 */ + uint32_t channel1_st_path : 1; /**< Should dead time be applied to ST output of Compare Channel-1? */ + uint32_t channel1_inv_st_path : 1; /**< Should dead time be applied to inverse ST output of + Compare Channel-1? */ + uint32_t channel2_st_path : 1; /**< Should dead time be applied to ST output of Compare Channel-2? */ + uint32_t channel2_inv_st_path : 1; /**< Should dead time be applied to inverse ST output of + Compare Channel-2? */ + uint32_t div : 2; /**< Dead time prescaler divider value. + Accepts enum ::XMC_CCU8_SLICE_DTC_DIV_t*/ + uint32_t : 24; + }; + uint32_t dtc; + }; + union + { + struct + { + uint32_t channel1_st_rising_edge_counter : 8; /**< Contains the delay value that is applied to the rising edge + for compare channel-1. Range: [0x0 to 0xFF] */ + uint32_t channel1_st_falling_edge_counter : 8; /**< Contains the delay value that is applied to the falling edge + for compare channel-1. Range: [0x0 to 0xFF] */ + uint32_t : 16; + }; + uint32_t dc1r; + }; + union + { + struct + { + uint32_t channel2_st_rising_edge_counter : 8; /**< Contains the delay value that is applied to the rising edge + for compare channel-2. Range: [0x0 to 0xFF]*/ + uint32_t channel2_st_falling_edge_counter : 8; /**< Contains the delay value that is applied to the falling edge + for compare channel-2. Range: [0x0 to 0xFF]*/ + uint32_t : 16; + }; + uint32_t dc2r; + }; +} XMC_CCU8_SLICE_DEAD_TIME_CONFIG_t; + +/** + * Configuration data structure for CCU8 slice. Specifically configures the CCU8 slice to compare mode operation. + * This excludes event and function configuration. + */ +typedef struct XMC_CCU8_SLICE_COMPARE_CONFIG +{ + union + { + struct + { + uint32_t timer_mode : 1; /**< Edge aligned or Centre Aligned. + Accepts enum :: XMC_CCU8_SLICE_TIMER_COUNT_MODE_t */ + uint32_t monoshot : 1; /**< Single shot or Continuous mode . + Accepts enum :: XMC_CCU8_SLICE_TIMER_REPEAT_MODE_t */ + uint32_t shadow_xfer_clear : 1; /**< Should PR and CR shadow xfer happen when timer is cleared? */ + uint32_t : 10; + uint32_t dither_timer_period: 1; /**< Can the period of the timer dither? */ + uint32_t dither_duty_cycle : 1; /**< Can the compare match of the timer dither? */ + uint32_t : 1; + uint32_t prescaler_mode: 1; /**< Normal or floating prescaler mode. + Accepts enum :: XMC_CCU8_SLICE_PRESCALER_MODE_t */ + uint32_t : 8; + uint32_t mcm_ch1_enable : 1; /**< Multi-Channel mode for compare channel 1 enable? */ + uint32_t mcm_ch2_enable : 1; /**< Multi-Channel mode for compare channel 2 enable? */ + uint32_t : 2; + uint32_t slice_status : 2; /**< Which of the two channels drives the slice status output. + Accepts enum :: XMC_CCU8_SLICE_STATUS_t*/ + uint32_t : 1; + }; + uint32_t tc; + }; + union + { + struct + { + uint32_t passive_level_out0 : 1; /**< ST and OUT passive levels Configuration for OUT0. + Accepts enum :: XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_t */ + uint32_t passive_level_out1 : 1; /**< ST and OUT passive levels Configuration for OUT1. + Accepts enum :: XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_t */ + uint32_t passive_level_out2 : 1; /**< ST and OUT passive levels Configuration for OUT2. + Accepts enum :: XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_t */ + uint32_t passive_level_out3 : 1; /**< ST and OUT passive levels Configuration for OUT3. + Accepts enum :: XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_t */ + uint32_t : 28; + }; + uint32_t psl; + }; + union + { + struct + { + uint32_t asymmetric_pwm : 1; /**< Should the PWM be a function of the 2 compare channels + rather than period value? */ + #if !defined(CCU8V3) /* Defined for all devices except XMC1400 */ + uint32_t invert_out0 : 1; /**< Should inverted ST of Channel-1 be connected to OUT0? */ + uint32_t invert_out1 : 1; /**< Should inverted ST of Channel-1 be connected to OUT1? */ + uint32_t invert_out2 : 1; /**< Should inverted ST of Channel-2 be connected to OUT2? */ + uint32_t invert_out3 : 1; /**< Should inverted ST of Channel-2 be connected to OUT3? */ + uint32_t : 27; + #else + uint32_t : 3; + uint32_t selector_out0 : 2; /**< Connect ST or inverted ST of Channel-1 or Channel-2 be to OUT0 + Accepts enum :: XMC_CCU8_SOURCE_OUT0_t + refer OCS1 bit-field of CHC register. + @note Only available for XMC1400 series */ + uint32_t : 2; + uint32_t selector_out1 : 2; /**< Connect ST or inverted ST of Channel-1 or Channel-2 be to OUT1 + Accepts enum :: XMC_CCU8_SOURCE_OUT1_t + refer OCS2 bit-field of CHC register. + @note Only available for XMC1400 series */ + uint32_t : 2; + uint32_t selector_out2 : 2; /**< Connect ST or inverted ST of Channel-1 or Channel-2 be to OUT2 + Accepts enum :: XMC_CCU8_SOURCE_OUT2_t + refer OCS3 bit-field of CHC register. + @note Only available for XMC1400 series */ + uint32_t : 2; + uint32_t selector_out3 : 2; /**< Connect ST or inverted ST of Channel-1 or Channel-2 be to OUT3 + Accepts enum :: XMC_CCU8_SOURCE_OUT3_t + refer OCS4 bit-field of CHC register. + @note Only available for XMC1400 series */ + uint32_t : 14; + #endif + }; + uint32_t chc; + }; + uint32_t prescaler_initval : 4; /**< Initial prescaler divider value + Accepts enum :: XMC_CCU8_SLICE_PRESCALER_t */ + uint32_t float_limit : 4; /**< The max value which the prescaler divider can increment to. + Range : [0 to 15] */ + uint32_t dither_limit : 4; /**< The value that determines the spreading of dithering + Range : [0 to 15] */ + uint32_t timer_concatenation : 1; /**< Enables the concatenation of the timer if true*/ +} XMC_CCU8_SLICE_COMPARE_CONFIG_t; + +/** + * Configuration data structure for CCU8 slice. Specifically configures the CCU8 slice to capture mode operation. + * This excludes event and function configuration. + */ +typedef struct XMC_CCU8_SLICE_CAPTURE_CONFIG +{ + union + { + struct + { + uint32_t : 4; + uint32_t fifo_enable : 1; /**< Should the capture registers be setup as a FIFO?(Extended capture mode) */ + uint32_t timer_clear_mode : 2; /**< How should the timer register be cleared upon detection of capture event? + Accepts enum ::XMC_CCU8_SLICE_TIMER_CLEAR_MODE_t */ + uint32_t : 4; + uint32_t same_event : 1; /**< Should the capture event for C1V/C0V and C3V/C2V be same capture edge? */ + uint32_t ignore_full_flag : 1; /**< Should updates to capture registers follow full flag rules? */ + uint32_t : 3; + uint32_t prescaler_mode: 1; /**< Normal or floating prescaler Accepts enum :: XMC_CCU8_SLICE_PRESCALER_MODE_t*/ + uint32_t : 15; + }; + uint32_t tc; + }; + uint32_t prescaler_initval : 4; /**< Prescaler divider value */ + uint32_t float_limit : 4; /**< The max value which the prescaler divider can increment to */ + uint32_t timer_concatenation : 1; /**< Enables the concatenation of the timer */ +} XMC_CCU8_SLICE_CAPTURE_CONFIG_t; +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +__STATIC_INLINE bool XMC_CCU8_IsValidModule(const XMC_CCU8_MODULE_t *const module) +{ + bool tmp = false; + + tmp = (module == CCU80); + +#if defined(CCU81) + tmp = tmp || (module == CCU81); +#endif + + return tmp; +} + +__STATIC_INLINE bool XMC_CCU8_IsValidSlice(const XMC_CCU8_SLICE_t *const slice) +{ + bool tmp = false; + + tmp = (slice == CCU80_CC80); +#if defined(CCU80_CC81) + tmp = tmp || (slice == CCU80_CC81); +#endif +#if defined(CCU80_CC82) + tmp = tmp || (slice == CCU80_CC82); +#endif +#if defined(CCU80_CC83) + tmp = tmp || (slice == CCU80_CC83); +#endif +#if defined(CCU81) + tmp = tmp || (slice == CCU81_CC80); +#if defined(CCU81_CC81) + tmp = tmp || (slice == CCU81_CC81); +#endif +#if defined(CCU81_CC82) + tmp = tmp || (slice == CCU81_CC82); +#endif +#if defined(CCU81_CC83) + tmp = tmp || (slice == CCU81_CC83); +#endif +#endif + + return tmp; +} + +/** + * @param module Constant pointer to CCU8 module + * @param mcs_action multi-channel shadow transfer request configuration + * @return
+ * None
+ * + * \parDescription:
+ * Initialization of global register GCTRL.\n\n + * As part of module initialization, behaviour of the module upon detection + * Multi-Channel Mode trigger is configured. Will also invoke the XMC_CCU8_EnableModule(). + * The API call would bring up the required CCU8 module and also initialize the module for + * the required multi-channel shadow transfer. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_CompareInit()
XMC_CCU8_SLICE_CaptureInit(). + */ +void XMC_CCU8_Init(XMC_CCU8_MODULE_t *const module, const XMC_CCU8_SLICE_MCMS_ACTION_t mcs_action); + +/** + * @param module Constant pointer to CCU8 module + * @return
+ * None
+ * + * \parDescription:
+ * Enables the CCU8 module and brings it to active state.\n\n + * Also disables the gating of the clock signal (if applicable depending on the device being selected). + * Invoke this API before any operations are done on the CCU8 module. Invoked from XMC_CCU8_Init(). + * + * \parRelated APIs:
+ * XMC_CCU8_SetModuleClock()
XMC_CCU8_DisableModule()
XMC_CCU8_StartPrescaler(). + */ +void XMC_CCU8_EnableModule(XMC_CCU8_MODULE_t *const module); + +/** + * @param module Constant pointer to CCU8 module + * @return
+ * None
+ * + * \parDescription:
+ * Brings the CCU8 module to reset state and enables gating of the clock signal(if applicable depending + * on the device being selected).\n\n + * Invoke this API when a CCU8 module needs to be disabled completely. + * Any operation on the CCU8 module will have no effect after this API is called. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableModule()
XMC_CCU8_DisableModule(). + */ +void XMC_CCU8_DisableModule(XMC_CCU8_MODULE_t *const module); + +/** + * @param module Constant pointer to CCU8 module + * @param clock Choice of input clock to the module + * @return
+ * None
+ * + * \parDescription:
+ * Selects the Module Clock by configuring GCTRL.PCIS bits.\n\n + * There are 3 potential clock sources. This API helps to select the required clock source. + * Call to this API is valid after the XMC_CCU8_Init(). + * + * \parRelated APIs:
+ * None.
+ */ +void XMC_CCU8_SetModuleClock(XMC_CCU8_MODULE_t *const module, const XMC_CCU8_CLOCK_t clock); + + +/** + * @param module Constant pointer to CCU8 module + * @return
+ * None
+ * + * \parDescription:
+ * Starts the prescaler and restores clocks to the timer slices, by setting GIDLC.SPRB bit.
\n + * Once the input to the prescaler has been chosen and the prescaler divider of all slices programmed, + * the prescaler itself may be started. Invoke this API after XMC_CCU8_Init() + * (Mandatory to fully initialize the module). + * + * \parRelated APIs:
+ * XMC_CCU8_Init()
XMC_CCU8_EnableClock()
XMC_CCU8_DisableClock()
XMC_CCU8_StartPrescaler()
+ * XMC_CCU8_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU8_StartPrescaler(XMC_CCU8_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU8_StartPrescaler:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + module->GIDLC |= (uint32_t) CCU8_GIDLC_SPRB_Msk; +} + +/** + * @param module Constant pointer to CCU8 module + * @return
+ * None
+ * + * \parDescription:
+ * Stops the prescaler and blocks clocks to the timer slices, by setting GIDLS.CPRB bit.\n\n + * Clears the run bit of the prescaler. Ensures that the module clock is not supplied to + * the slices of the module. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableClock()
XMC_CCU8_DisableClock()
XMC_CCU8_StartPrescaler()
XMC_CCU8_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU8_StopPrescaler(XMC_CCU8_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU8_StopPrescaler:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + module->GIDLS |= (uint32_t) CCU8_GIDLS_CPRB_Msk; +} + +/** + * @param module Constant pointer to CCU8 module + * @return
+ * None
+ * + * \parDescription:
+ * Returns the state of the prescaler, by reading GSTAT.PRB bit.\n\n + * If clock is being supplied to the slices of the module then returns as true. + * + * \parRelated APIs:
+ * XMC_CCU8_StartPrescaler()
XMC_CCU8_StopPrescaler()
XMC_CCU8_EnableClock()
XMC_CCU8_DisableClock(). + */ +__STATIC_INLINE bool XMC_CCU8_IsPrescalerRunning(XMC_CCU8_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU8_IsPrescalerRunning:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + return((bool)((module->GSTAT & (uint32_t) CCU8_GSTAT_PRB_Msk) == CCU8_GSTAT_PRB_Msk)); +} + +/** + * @param module Constant pointer to CCU8 module + * @param clock_mask Slices whose clocks are to be enabled simultaneously. + * Bit location 0/1/2/3 represents slice-0/1/2/3 respectively. + * Range: [0x1 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Enables clocks of multiple slices at a time, by configuring GIDLC.CS0I, GIDLC.CS1I, GIDLC.CS2I, + * GIDLC.CS3I bits.\n\n + * Takes an input clock_mask, which determines the slices that would receive the clock. Bring them out + * of the idle state simultaneously. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableClock()
XMC_CCU8_DisableClock(). + */ +__STATIC_INLINE void XMC_CCU8_EnableMultipleClocks(XMC_CCU8_MODULE_t *const module, const uint8_t clock_mask) +{ + XMC_ASSERT("XMC_CCU8_EnableMultipleClocks:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + XMC_ASSERT("XMC_CCU8_EnableMultipleClocks:Invalid clock mask", (clock_mask < 16U)); + + module->GIDLC |= (uint32_t) clock_mask; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param compare_init Pointer to slice configuration structure + * @return
+ * None
+ * + * \parDescription:
+ * Initialization of a CC8 slice to compare mode, by configuring CC8yTC, CC8yCMC, CC8yPSC, CC8yDITH, CC8yPSL, + * CC8yFPCS, CC8yCHC registers.\n\n + * CC8 slice is configured with Timer configurations in this routine. Timer is stopped before initialization + * by calling XMC_CCU8_SLICE_StopTimer(). After initialization user has to explicitly enable + * the shadow transfer for the required values by calling XMC_CCU8_EnableShadowTransfer() with appropriate mask. + * + * \parRelated APIs:
+ * None. + */ +void XMC_CCU8_SLICE_CompareInit(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CONFIG_t *const compare_init); + +/** + * @param slice Constant pointer to CC8 Slice + * @param capture_init Pointer to slice configuration structure + * @return
+ * None
+ * + * \parDescription:
+ * Initialization of a CC8 slice to capture mode, by configuring CC8yTC, CC8yCMC, CC8yPSC,CC8yFPCS registers.\n\n + * CC8 slice is configured with Capture configurations in this routine. Timer is stopped before initialization + * by calling XMC_CCU8_SLICE_StopTimer(). After initialization user has to explicitly enable the shadow transfer + * for the required values by calling XMC_CCU8_EnableShadowTransfer() with appropriate mask. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_Capture0Config()
XMC_CCU8_SLICE_Capture1Config(). + */ +void XMC_CCU8_SLICE_CaptureInit(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_CAPTURE_CONFIG_t *const capture_init); + +/** + * @param module Constant pointer to CCU8 module + * @param slice_number Slice for which the clock should be Enabled. + * Range: [0x0 to 0x3] + * @return
+ * None
+ * + * \parDescription:
+ * Enables the slice timer clock, by configuring GIDLC.CS0I, GIDLC.CS1I, GIDLC.CS2I, + * GIDLC.CS3I bits according to the selected \a slice_number.\n\n + * It is possible to enable/disable clock at slice level. This uses the \b slice_number to indicate the + * slice whose clock needs to be enabled. Directly accessed register is GIDLC. + * + * \parRelated APIs:
+ * XMC_CCU8_DisableClock()
XMC_CCU8_EnableMultipleClocks()
XMC_CCU8_StartPrescaler()
XMC_CCU8_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU8_EnableClock(XMC_CCU8_MODULE_t *const module, const uint8_t slice_number) +{ + XMC_ASSERT("XMC_CCU8_EnableClock:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + XMC_ASSERT("XMC_CCU8_EnableClock:Invalid Slice Number", (slice_number < 4U)); + + module->GIDLC |= ((uint32_t) 1 << slice_number); +} + +/** + * @param module Constant pointer to CCU8 module + * @param slice_number Slice for which the clock should be disabled. + * Range: [0x0 to 0x3] + * @return
+ * None
+ * + * \parDescription:
+ * Disables the slice timer clock, by configuring GIDLS.SS0I, GIDLS.SSS1I, GIDLS.SSS2I, + * GIDLS.SSS3I bits according to the selected \a slice_number .\n\n + * It is possible to disable clock at slice level using the module pointer. + * \b slice_number is used to disable the clock to a given slice of the module. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableClock()
XMC_CCU8_EnableMultipleClocks()
XMC_CCU8_StartPrescaler()
XMC_CCU8_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU8_DisableClock(XMC_CCU8_MODULE_t *const module, const uint8_t slice_number) +{ + XMC_ASSERT("XMC_CCU8_DisableClock:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + XMC_ASSERT("XMC_CCU8_DisableClock:Invalid Slice Number", (slice_number < 4U)); + + module->GIDLS |= ((uint32_t) 1 << slice_number); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param out_path_msk configuration for output path selection. + * combination of XMC_CCU8_OUT_PATH_t enum items can be used to create a mask. + * + * @return
+ * None
+ * + * \parDescription:
+ * Configure the out the path of the two compare channels with specified ST signal, by configuring the + ^ CC8yCHC register.\n\n + * + * For the two compare channels it is possible to select either direct ST signal or inverted ST signal. + * \b out_path_msk is used to set the required out put path. + * + * \parRelated APIs:
+ * None +*/ +void XMC_CCU8_SLICE_SetOutPath(XMC_CCU8_SLICE_t *const slice, const uint32_t out_path_msk); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the External Start Function + * @param start_mode Behaviour of slice when the start function is activated + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Start Function of the slice, by configuring CC8yCMC.ENDS and CC8yTC.ENDM bits.\n\n + * Start function is mapped with one of the 3 events. An external signal can control when a CC8 timer should start. + * Additionally, the behaviour of the slice upon activation of the start function is configured as well. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StopConfig()
XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_StartConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_START_MODE_t start_mode); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the External Stop Function + * @param end_mode Behaviour of slice when the stop function is activated + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Stop function for the slice, by configuring CC8yCMC.STRTS and CC8yTC.STRM bits.\n\n + * Stop function is mapped with one of the 3 events. An external signal can control when a CCU8 timer should stop. + * Additionally, the behaviour of the slice upon activation of the stop function is configured as well. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StartConfig()
XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_StopConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_END_MODE_t end_mode); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the External load Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Load Function for the slice, by configuring CC8yCMC.LDS bit.\n\n + * Load function is mapped with one of the 3 events. Up on occurrence of the event,\n + * if CC8yTCST.CDIR set to 0,CC8yTIMER register is reloaded with the value from compare channel 1 or + * compare channel 2\n + * if CC8yTCST.CDIR set to 1,CC8yTIMER register is reloaded with the value from period register\n + * + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_LoadConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC8 Slice + * @param ch_num Select which compare channel value has to be loaded to the Timer register during external load event. + * @return
+ * None
+ * + * \parDescription:
+ * Up on occurrence of the external load event, if CC8yTCST.CDIR set to 0, CC8yTIMER register can be reloaded\n + * with the value from compare channel 1 or compare channel 2\n + * If CC8yTC.TLS is 0, compare channel 1 value is loaded to the CC8yTIMER register\n + * If CC8yTC.TLS is 1, compare channel 2 value is loaded to the CC8yTIMER register\n + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_LoadSelector(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_COMPARE_CHANNEL_t ch_num); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the External Modulation Function + * @param mod_mode Desired Modulation mode + * @param channel Specify the channel(s) on which the modulation should be applied. + * @param synch_with_pwm Option to synchronize modulation with PWM start + * Pass \b true if the modulation needs to be synchronized with PWM signal. + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Output Modulation Function of the slice, by configuring CC8yCMC.MOS, CC8yTC.EMT and + * CC8yTC.EMS bits.\n\n + * Modulation function is mapped with one of the 3 events. The output signal of the CCU can + * be modulated according to a external input. Additionally, the behaviour of the slice upon activation + * of the modulation function is configured as well. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_ModulationConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_MODULATION_MODE_t mod_mode, + const XMC_CCU8_SLICE_MODULATION_CHANNEL_t channel, + const bool synch_with_pwm + ); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the External Count Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Count Function of the slice, by configuring CC8yCMC.CNTS bit.\n\n + * Count function is mapped with one of the 3 events. CCU8 slice can take an external + * signal to act as the counting event. The CCU8 slice would count the + * edges present on the \b event selected. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_CountConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the External Gating Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Gating Function of the slice, by configuring CC8yCMC.GATES bit.\n\n + * Gating function is mapped with one of the 3 events. A CCU8 slice can use an input signal that would + * operate as counter gating. If the configured Active level is detected the counter will gate all the pulses. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_GateConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the Capture-0 Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Capture-0 Function of the slice, by configuring CC8yCMC.CAP0S bit.\n\n + * Capture function is mapped with one of the 3 events. A CCU8 slice can be configured into capture-0 mode + * with the selected \b event. In this mode the CCU8 will capture the timer value into CC8yC0V and CC8yC1V. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_Capture0Config(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the Capture-1 Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Capture-1 Function of the slice, by configuring CC8yCMC.CAP1S bit.\n\n + * Capture function is mapped with one of the 3 events. A CCU8 slice can be configured into capture-1 + * mode with the selected \b event. In this mode the CCU8 will capture the timer value into CC8yC2V and CC8yC3V. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_Capture1Config(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * bool would return true if the extended capture read back mode is enabled
+ * + * \parDescription:
+ * Checks if Extended capture mode read is enabled for particular slice or not, by reading CC8yTC.ECM bit.\n\n + * In this mode the there is only one associated read address for all the capture registers. + * Individual capture registers can still be accessed in this mode. + * + * \parRelated APIs:
+ * XMC_CCU8_GetCapturedValueFromFifo(). + */ +__STATIC_INLINE bool XMC_CCU8_SLICE_IsExtendedCapReadEnabled(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_IsPrescalerRunning:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return((bool)((slice->TC & (uint32_t) CCU8_CC8_TC_ECM_Msk) == (uint32_t)CCU8_CC8_TC_ECM_Msk)); +} + +#if defined(CCU8V1) /* Defined for XMC4800, XMC4700, XMC4500, XMC4400, XMC4200, XMC4100 devices only */ +/** + * @param module Constant pointer to CCU8 module + * @param slice_number to check whether read value belongs to required slice or not + * @return
+ * int32_t Returns -1 if the FIFO value being retrieved is not from the \b slice_number. + * Returns the value captured in the \b slice_number, if captured value is from the correct slice. + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Read captured value from FIFO(ECRD register).\n\n + * This is applicable only in the Capture mode of operation. The signal whose timing characteristics are to be measured + * must be mapped to an event which in turn must be mapped to the capture function. Based on the capture criteria, the + * instant timer values are captured into capture registers. Timing characteristics of the input signal may then be + * derived/inferred from the captured values. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_IsExtendedCapReadEnabled(). + */ +int32_t XMC_CCU8_GetCapturedValueFromFifo(const XMC_CCU8_MODULE_t *const module, const uint8_t slice_number); +#else +/** + * @param slice Constant pointer to CC8 Slice + * @param set The capture register set from which the captured value is to be retrieved + * @return
+ * uint32_t Returns the value captured in the \b slice_number + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Read captured value from FIFO(CC8yECRD0 and CC8yECRD1).\n\n + * This is applicable only in the Capture mode of operation. The signal whose timing characteristics are to be measured + * must be mapped to an event which in turn must be mapped to the capture function. Based on the capture criteria, the + * instant timer values are captured into capture registers. Timing characteristics of the input signal may then be + * derived/inferred from the captured values. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_IsExtendedCapReadEnabled(). + * @note Defined for XMC4800, XMC4700, XMC4500, XMC4400, XMC4200, XMC4100 devices only. For other devices use XMC_CCU8_GetCapturedValueFromFifo() API + */ +uint32_t XMC_CCU8_SLICE_GetCapturedValueFromFifo(const XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_CAP_REG_SET_t set); +#endif + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the External Count Direction Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Count Direction of the slice, by configuring CC8yCMC.UDS bit.\n\n + * Count direction function is mapped with one of the 3 events. A slice can be configured to change the + * CC8yTIMER count direction depending on an external signal. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_DirectionConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Configures the status bit override Function of the slice, by configuring CC8yCMC.OFS bit.\n\n + * Status bit override function is mapped with one of the 3 events. A slice can be configured to change the + * output of the timer's CC8yST1 signal depending on an external signal. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent(). + */ +void XMC_CCU8_SLICE_StatusBitOverrideConfig(XMC_CCU8_SLICE_t *const slice); + +/** + * @param slice Constant pointer to CC8 Slice + * @param exit_mode How should a previously logged trap state be exited? + * @param synch_with_pwm Should exit of trap state be synchronized with PWM cycle start? + * @return
+ * None
+ * + * + * \parDescription:
+ * Configures the Trap Function of the slice, by configuring CC8yCMC.TS, CC8yTC.TRPSE, and CC8yTC.TRPSW bits.\n\n + * Trap function is mapped with Event-2. Criteria for exiting the trap state is configured. + * This trap function allows PWM outputs to react on the state of an input pin. + * Thus PWM output can be forced to inactive state upon detection of a trap. + * It is also possible to synchronize the trap function with the PWM signal using the \b synch_with_pwm. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_TrapConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_TRAP_EXIT_MODE_t exit_mode, + bool synch_with_pwm); + +/** + * @param slice Constant pointer to CC8 Slice + * @param ev1_config Pointer to event 1 configuration data + * @param ev2_config Pointer to event 2 configuration data + * @return
+ * None
+ * + * + * \parDescription:
+ * Map Status bit override function with an Event1 & Event 2 of the slice and configure CC8yINS register.\n\n + * Details such as the input mapped to the event, event detection criteria and Low Pass filter options are programmed + * by this routine for the events 1 & 2. Event-1 input would be the trigger to override the value. + * Event-2 input would be the override value. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StatusBitOverrideConfig(). + */ +void XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_CONFIG_t *const ev1_config, + const XMC_CCU8_SLICE_EVENT_CONFIG_t *const ev2_config); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event The External Event which needs to be configured. + * @param config Pointer to event configuration data. + * @return
+ * None
+ * + * \parDescription:
+ * Configures an External Event of the slice, by updating CC8yINS register .\n\n + * Details such as the input mapped to the event, event detection criteria and low pass filter + * options are programmed by this routine. The Event \b config will configure the input selection, + * the edge selection, the level selection and the Low pass filter for the event. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StartConfig()
XMC_CCU8_SLICE_StopConfig()
XMC_CCU8_SLICE_LoadConfig()
+ * XMC_CCU8_SLICE_ModulationConfig()
XMC_CCU8_SLICE_CountConfig()
XMC_CCU8_SLICE_GateConfig()
+ * XMC_CCU8_SLICE_Capture0Config()
XMC_CCU8_SLICE_Capture1Config()
XMC_CCU8_SLICE_DirectionConfig()
+ * XMC_CCU8_SLICE_StatusBitOverrideConfig()
XMC_CCU8_SLICE_TrapConfig(). + */ +void XMC_CCU8_SLICE_ConfigureEvent(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_EVENT_CONFIG_t *config); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event The External Event which needs to be configured. + * @param input One of the 16 inputs meant to be mapped to the desired event + * @return
+ * None
+ * + * + * \parDescription:
+ * Selects an input for an external event, by configuring CC8yINS register.\n\n + * It is possible to select one of the possible 16 input signals for a given Event. + * This configures the CC8yINS.EVxIS for the selected event. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StartConfig()
XMC_CCU8_SLICE_StopConfig()
XMC_CCU8_SLICE_LoadConfig()
+ * XMC_CCU8_SLICE_ModulationConfig()
XMC_CCU8_SLICE_CountConfig()
XMC_CCU8_SLICE_GateConfig()
+ * XMC_CCU8_SLICE_Capture0Config()
XMC_CCU8_SLICE_Capture1Config()
XMC_CCU8_SLICE_DirectionConfig()
+ * XMC_CCU8_SLICE_StatusBitOverrideConfig()
XMC_CCU8_SLICE_TrapConfig(). + */ +void XMC_CCU8_SLICE_SetInput(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_INPUT_t input); + +/** + * @param slice Constant pointer to CC8 Slice + * @param out_mask Output signals for which the Trap function needs to be activated. + * Use ::XMC_CCU8_SLICE_OUTPUT_t enum items to create a mask of choice, + * using a bit wise OR operation + * Range: [0x1 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Enables the trap feature, by setting CC8yTC.TRAPE0, CC8yTC.TRAPE1, CC8yTC.TRAPE2 and CC8yTC.TRAPE3 bit based on the + * \a out_mask.\n\n + * A particularly useful feature where the PWM output can be forced inactive upon detection of a trap. The trap signal + * can be the output of a sensing element which has just detected an abnormal electrical condition. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_TrapConfig()
XMC_CCU8_SLICE_DisableTrap()
XMC_CCU8_SLICE_ConfigureEvent()
+ * XMC_CCU8_SLICE_SetInput(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableTrap(XMC_CCU8_SLICE_t *const slice, const uint32_t out_mask) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableTrap:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TC |= (uint32_t)out_mask << CCU8_CC8_TC_TRAPE0_Pos; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param out_mask Output signals for which the Trap function needs to be deactivated. + * Use ::XMC_CCU8_SLICE_OUTPUT_t enum items to create a mask of choice, + * using a bit wise OR operation. + * Range: [0x1 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Disables the trap feature, by clearing CC8yTC.TRAPE0, CC8yTC.TRAPE1, CC8yTC.TRAPE2 and CC8yTC.TRAPE3 bit based on the + * \a out_mask.\n\n.\n\n + * This API will revert the changes done by XMC_CCU8_SLICE_EnableTrap(). + * This Ensures that the TRAP function has no effect on the output of the CCU8 slice. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableTrap(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableTrap(XMC_CCU8_SLICE_t *const slice, const uint32_t out_mask) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableTrap:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + + slice->TC &= ~((uint32_t)out_mask << CCU8_CC8_TC_TRAPE0_Pos); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * bool returns \b true if the Timer is running else it returns \b false. + * + * \parDescription:
+ * Returns the state of the timer (Either Running or stopped(idle)), by reading CC8yTCST.TRB bit. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StartTimer()
XMC_CCU8_SLICE_StopTimer(). + */ +__STATIC_INLINE bool XMC_CCU8_SLICE_IsTimerRunning(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetTimerStatus:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return(bool)(((slice->TCST) & CCU8_CC8_TCST_TRB_Msk) == (uint32_t)CCU8_CC8_TCST_TRB_Msk); +} + +/** + * @param slice Pointer to an instance of CC8 slice + * @return
+ * bool returns \b true if the dead time counter of Compare channel-1 is running else it returns \b false. + * + * \parDescription:
+ * Returns the state of the Dead time counter 1 (Either Running or stopped(idle)), by reading CC8yTCST.DTR1 bit. + * This returns the state of the dead time counter which is linked to Compare channel-1. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_IsDeadTimeCntr2Running(). + */ +__STATIC_INLINE bool XMC_CCU8_SLICE_IsDeadTimeCntr1Running(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_IsDeadTimeCntr1Running:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return(bool)(((slice->TCST) & CCU8_CC8_TCST_DTR1_Msk) == (uint32_t)CCU8_CC8_TCST_DTR1_Msk); +} + +/** + * @param slice Pointer to an instance of CC8 slice + * @return
+ * bool returns \b true if the dead time counter of Compare channel-2 is running else it returns \b false. + * + * \parDescription:
+ * Returns the state of the Dead time counter 2 (Either Running or stopped(idle)), by reading CC8yTCST.DTR2 bit. + * This returns the state of the dead time counter which is linked to Compare channel-2. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_IsDeadTimeCntr1Running(). + */ +__STATIC_INLINE bool XMC_CCU8_SLICE_IsDeadTimeCntr2Running(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_IsDeadTimeCntr2Running:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return(bool)(((slice->TCST) & CCU8_CC8_TCST_DTR2_Msk) == (uint32_t)CCU8_CC8_TCST_DTR2_Msk); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * ::XMC_CCU8_SLICE_TIMER_COUNT_DIR_t returns the direction in which the timer is counting. + * + * \parDescription:
+ * Returns the timer counting direction, by reading CC8yTCST.CDIR bit.\n\n + * This API will return the direction in which the timer is currently + * incrementing(XMC_CCU8_SLICE_TIMER_COUNT_DIR_UP) or decrementing (XMC_CCU8_SLICE_TIMER_COUNT_DIR_DOWN). + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE XMC_CCU8_SLICE_TIMER_COUNT_DIR_t XMC_CCU8_SLICE_GetCountingDir(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetCountingDir:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return((XMC_CCU8_SLICE_TIMER_COUNT_DIR_t)(((slice->TCST) & CCU8_CC8_TCST_CDIR_Msk) >> CCU8_CC8_TCST_CDIR_Pos)); +} +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Starts the timer counting operation, by setting CC8yTCSET.TRBS bit.\n\n + * It is necessary to have configured the CC8 slice before starting its timer. + * Before the Timer is started ensure that the clock is provided to the slice. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StopTimer(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_StartTimer(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_StartTimer:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TCSET = CCU8_CC8_TCSET_TRBS_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Stops the Timer.\n\n + * Timer counting operation can be stopped by invoking this API, by setting CC8yTCCLR.TRBC bit. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StartTimer(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_StopTimer(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_StopTimer:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TCCLR = (uint32_t) CCU8_CC8_TCCLR_TRBC_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Resets the timer count to zero, by setting CC8yTCCLR.TCC bit.\n\n + * A timer which has been stopped can still retain the last counted value. + * After invoking this API the timer value will be cleared. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StartTimer(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_ClearTimer(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_ClearTimer:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TCCLR = (uint32_t) CCU8_CC8_TCCLR_TCC_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Stops and resets the timer count to zero, by setting CC8yTCCLR.TCC and CC8yTCCLR.TRBC bit.\n\n + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StartTimer(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_StopClearTimer(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_StopClearTimer:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TCCLR = CCU8_CC8_TCCLR_TRBC_Msk | CCU8_CC8_TCCLR_TCC_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * ::XMC_CCU8_SLICE_MODE_t returns XMC_CCU8_SLICE_MODE_COMPARE if the slice is operating in compare mode + * returns XMC_CCU8_SLICE_MODE_CAPTURE if the slice is operating in capture mode + * + * \parDescription:
+ * Retrieves the current mode of operation in the slice (either Capture mode or Compare mode), by reading + * CC8yTC.CMOD bit.\n\n + * Ensure that before invoking this API the CCU8 slice should be configured otherwise the output of this API is + * invalid. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE XMC_CCU8_SLICE_MODE_t XMC_CCU8_SLICE_GetSliceMode(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetSliceMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return((XMC_CCU8_SLICE_MODE_t)(((slice->TC) & CCU8_CC8_TC_CMOD_Msk) >> CCU8_CC8_TC_CMOD_Pos)); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param mode Desired repetition mode (Either single shot or Continuous) + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Timer to either Single shot mode or continuous mode, by configuring CC8yTC.TSSM bit.\n\n + * The timer will count up to the terminal count as specified in the period register and stops immediately if the repeat + * mode has been set to single shot. In the continuous mode of operation, the timer starts counting all over again after + * reaching the terminal count. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_GetTimerRepeatMode(). + */ +void XMC_CCU8_SLICE_SetTimerRepeatMode(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_TIMER_REPEAT_MODE_t mode); + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * ::XMC_CCU8_SLICE_TIMER_REPEAT_MODE_t returns XMC_CCU8_SLICE_TIMER_REPEAT_MODE_REPEAT if continuous mode is selected + * returns XMC_CCU8_SLICE_TIMER_REPEAT_MODE_SINGLE if single shot mode is selected + * + * \parDescription:
+ * Retrieves the Timer repeat mode, either Single shot mode or continuous mode, by reading CC8yTC.TSSM bit.\n\n + * The timer will count upto the terminal count as specified in the period register and stops immediately if the repeat + * mode has been set to single shot mode. In the continuous mode of operation, the timer starts counting + * all over again after reaching the terminal count. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetTimerRepeatMode(). + */ +__STATIC_INLINE XMC_CCU8_SLICE_TIMER_REPEAT_MODE_t XMC_CCU8_SLICE_GetTimerRepeatMode( + const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetTimerRepeatMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return((XMC_CCU8_SLICE_TIMER_REPEAT_MODE_t)(((slice->TC) & CCU8_CC8_TC_TSSM_Msk) >> CCU8_CC8_TC_TSSM_Pos)); +} +/** + * @param slice Constant pointer to CC8 Slice + * @param mode Desired counting mode (Either Edge Aligned or Center Aligned) + * @return
+ * None
+ * + * \parDescription:
+ * Configures the timer counting mode either Edge Aligned or Center Aligned, by configuring CC8yTC.TCM bit.\n\n + * In the edge aligned mode, the timer counts from 0 to the terminal count. Once the timer count has reached a preset + * compare value, the timer status output asserts itself. It will now deassert only after the timer count reaches the + * terminal count.\n In the center aligned mode, the timer first counts from 0 to the terminal count and then back to 0. + * During this upward and downward counting, the timer status output stays asserted as long as the timer value is + * greater than the compare value. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_GetTimerCountingMode(). + */ +void XMC_CCU8_SLICE_SetTimerCountingMode(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_TIMER_COUNT_MODE_t mode); + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * ::XMC_CCU8_SLICE_TIMER_COUNT_MODE_t returns XMC_CCU8_SLICE_TIMER_COUNT_MODE_EA if edge aligned mode is selected + * returns XMC_CCU8_SLICE_TIMER_COUNT_MODE_CA if center aligned mode is selected + * + * \parDescription:
+ * Retrieves timer counting mode either Edge aligned or Center Aligned, by reading CC8yTC.TCM bit.\n\n + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetTimerCountingMode(). + */ +__STATIC_INLINE XMC_CCU8_SLICE_TIMER_COUNT_MODE_t XMC_CCU8_SLICE_GetTimerCountingMode( + const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetTimerCountingMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return((XMC_CCU8_SLICE_TIMER_COUNT_MODE_t)(((slice->TC) & CCU8_CC8_TC_TCM_Msk) >> CCU8_CC8_TC_TCM_Pos)); +} +/** + * @param slice Constant pointer to CC8 Slice + * @param period_val Timer period value + * Range: [0x0 to 0xFFFF] + * @return
+ * None
+ * + * \parDescription:
+ * Programs the timer period, by writing CC8yPRS register.\n\n + * The frequency of counting/ PWM frequency is determined by this value. The period value is written to a shadow + * register. Explicitly enable the shadow transfer for the the period value by calling + * XMC_CCU8_EnableShadowTransfer() with appropriate mask. If shadow transfer is enabled and the timer is running, + * a period match transfers the value from the shadow register to the actual period register. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_GetTimerPeriodMatch(). + */ +void XMC_CCU8_SLICE_SetTimerPeriodMatch(XMC_CCU8_SLICE_t *const slice, const uint16_t period_val); + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * uint16_t returns the current timer period value + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Retrieves the timer period value currently effective, by reading CC8yPR register.\n\n + * If the timer is active then the value being returned is currently being used for the PWM period. + * + * \parNote:
+ * The XMC_CCU8_SLICE_SetTimerPeriodMatch() would set the new period value to a shadow register. + * This would only transfer the new values into the actual period register if the shadow transfer request + * is enabled and if a period match occurs. Hence a consecutive call to XMC_CCU8_SLICE_GetTimerPeriodMatch() + * would not reflect the new values until the shadow transfer completes. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetTimerPeriodMatch(). + */ +__STATIC_INLINE uint16_t XMC_CCU8_SLICE_GetTimerPeriodMatch(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetTimerPeriodMatch:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return((uint16_t) slice->PR); +} +/** + * @param slice Constant pointer to CC8 Slice + * @param channel Select the compare channel to which the \b compare_val has to programmed. + * @param compare_val Timer compare value + * @return
+ * None
+ * + * \parDescription:
+ * Programs the timer compare value, by writing CC8yCR1S and CC8yCR2S registers.\n\n + * The PWM duty cycle is determined by this value.\n\n + * The compare value is written to a shadow register. Explicitly enable the shadow transfer for + * the the period/compare value by calling XMC_CCU8_EnableShadowTransfer() with + * appropriate mask.If shadow transfer is enabled and the timer is running, + * a period match transfers the value from the shadow register to the actual compare register. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableShadowTransfer(). + */ +void XMC_CCU8_SLICE_SetTimerCompareMatch(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t channel, + const uint16_t compare_val); + +/** + * @param slice Constant pointer to CC8 Slice + * @param compare_val Timer compare value + * @return
+ * None
+ * + * \parDescription:
+ * Programs the timer compare1 value, by writing CC8yCR1S register.\n\n + * The PWM duty cycle is determined by this value.\n\n + * The compare value is written to a shadow register. Explicitly enable the shadow transfer for + * the the period/compare value by calling XMC_CCU8_EnableShadowTransfer() with appropriate mask. + * If shadow transfer is enabled and the timer is running, a period match transfers the value from + * the shadow register to the actual compare register. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableShadowTransfer(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_SetTimerCompareMatchChannel1(XMC_CCU8_SLICE_t *const slice, const uint16_t compare_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerCompareMatchChannel1:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->CR1S = (uint32_t) compare_val; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param compare_val Timer compare value + * @return
+ * None
+ * + * \parDescription:
+ * Programs the timer compare2 value, by writing CC8yCR2S register.\n\n + * The PWM duty cycle is determined by this value.\n\n + * The compare value is written to a shadow register. Explicitly enable the shadow transfer for + * the the period/compare value by calling XMC_CCU8_EnableShadowTransfer() with appropriate mask. + * If shadow transfer is enabled and the timer is running, a period match transfers the value from + * the shadow register to the actual compare register. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableShadowTransfer(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_SetTimerCompareMatchChannel2(XMC_CCU8_SLICE_t *const slice, const uint16_t compare_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerCompareMatchChannel2:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->CR2S = (uint32_t) compare_val; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param channel Select the compare channel to retrieve from. + * @return
+ * uint16_t returns the current timer compare value + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Retrieves the timer compare value currently effective, by reading CC8yCR1S and CC8yCR2S registers.\n\n + * If the timer is active then the value being returned is currently being for the PWM duty cycle( timer compare value). + * + * \parNote:
+ * The XMC_CCU8_SLICE_SetTimerCompareMatch() would set the new compare value to a shadow register. + * This would only transfer the new values into the actual compare register if the shadow transfer request + * is enabled and if a period match occurs. Hence a consecutive call to XMC_CCU8_SLICE_GetTimerCompareMatch() + * would not reflect the new values until the shadow transfer completes. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetTimerCompareMatch(). + */ +uint16_t XMC_CCU8_SLICE_GetTimerCompareMatch(const XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t channel); + +/** + * @param module Constant pointer to CCU8 module + * @param shadow_transfer_msk Shadow transfer request mask for various transfers. + * Use ::XMC_CCU8_SHADOW_TRANSFER_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Requests of shadow transfer for Period, Compare, Passive level, dither and prescaler, by configuring + * the GCSS register.\n\n + * The transfer from the shadow registers to the actual registers is done in the immediate next occurrence of the + * shadow transfer trigger after the API is called. + * + * Any call to XMC_CCU8_SLICE_SetTimerPeriodMatch()
XMC_CCU8_SLICE_SetTimerCompareMatch()
+ * XMC_XMC_CCU8_SLICE_SetPrescaler()
XMC_CCU8_SLICE_CompareInit()
XMC_CCU8_SLICE_CaptureInit(). + * must be succeeded by this API. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_CCU8_EnableShadowTransfer(XMC_CCU8_MODULE_t *const module, const uint32_t shadow_transfer_msk) +{ + XMC_ASSERT("XMC_CCU8_EnableShadowTransfer:Invalid module Pointer", XMC_CCU8_IsValidModule(module)); + module->GCSS = (uint32_t)shadow_transfer_msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * uint16_t returns the current timer value + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Retrieves the latest timer value, from CC8yTIMER register.\n\n + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetTimerValue(). + */ +__STATIC_INLINE uint16_t XMC_CCU8_SLICE_GetTimerValue(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetTimerValue:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return((uint16_t) slice->TIMER); +} +/** + * @param slice Constant pointer to CC8 Slice + * @param timer_val The new timer value that has to be loaded into the TIMER register. + * Range: [0x0 to 0xFFFF] + * @return
+ * None
+ * + * \parDescription:
+ * Loads a new timer value, by setting CC8yTIMER register.\n\n + * + * \parNote:
+ * Request to load is ignored if the timer is running. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_GetTimerValue(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_SetTimerValue(XMC_CCU8_SLICE_t *const slice, const uint16_t timer_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerValue:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TIMER = (uint32_t) timer_val; +} +/** + * @param slice Constant pointer to CC8 Slice + * @param period_dither Boolean instruction on dithering of period match + * @param duty_dither Boolean instruction on dithering of compare match + * @param spread Dither compare value + * @return
+ * None
+ * + * \parDescription:
+ * Enables dithering of PWM frequency and duty cycle, by configuring CC8yTC.DITHE and CC8yDITS bits.\n\n + * Some control loops are slow in updating PWM frequency and duty cycle. In such a case, a Bresenham style dithering + * can help reduce long term errors. Dithering can be applied to period and duty individually, + * this can be selected using the parameter \b period_dither and \b duty_dither. + * The \b spread would provide the dither compare value. If the dither counter value is less than this \b spread then + * the period/compare values would be dithered according to the dither mode selected. This API would invoke + * XMC_CCU8_SLICE_SetDitherCompareValue(). + * + * \parNote:
+ * After this API call, XMC_CCU8_EnableShadowTransfer() has to be called with appropriate mask + * to transfer the dither value. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_DisableDithering(). + */ +void XMC_CCU8_SLICE_EnableDithering(XMC_CCU8_SLICE_t *const slice, + const bool period_dither, + const bool duty_dither, + const uint8_t spread); + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Disables dithering of PWM frequency and duty cycle, by clearing CC8yTC.DITHE bits.\n\n + * This disables the Dither mode that was set in XMC_CCU8_SLICE_EnableDithering(). + * This API will not clear the dither compare value. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableDithering(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableDithering(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableDithering:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TC &= ~((uint32_t) CCU8_CC8_TC_DITHE_Msk); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Enables the floating prescaler, by setting CC8yTC.FPE bit.\n\n + * The prescaler divider starts with an initial value and increments upon every period match. It keeps incrementing + * until a ceiling (prescaler compare value) is hit and thereafter rolls back to the original prescaler divider value.\n + * It is necessary to have programmed an initial divider value and a compare value before the feature is enabled. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetFloatingPrescalerCompareValue()
XMC_CCU8_SLICE_DisableFloatingPrescaler()
+ * XMC_XMC_CCU8_SLICE_SetPrescaler(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableFloatingPrescaler(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableFloatingPrescaler:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TC |= (uint32_t) CCU8_CC8_TC_FPE_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Disables the floating prescaler, by clearing CC8yTC.FPE bit.\n\n + * This would return the prescaler to the normal mode. + * The prescaler that would be applied is the value present in CC8yPSC. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableFloatingPrescaler(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableFloatingPrescaler(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableFloatingPrescaler:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TC &= ~((uint32_t) CCU8_CC8_TC_FPE_Msk); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param comp_val Dither compare value + * Range: [0x0 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Sets the dither spread/compare value, by setting CC8yDITS.DCVS bits.\n\n + * This value is the cornerstone of PWM dithering feature. Dithering is applied/done when the value in the + * dithering counter is less than this compare/spread value. For all dithering counter values greater than + * the spread value, there is no dithering. After setting the value XMC_CCU8_EnableShadowTransfer() has to be + * called with appropriate mask. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableDithering(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_SetDitherCompareValue(XMC_CCU8_SLICE_t *const slice, const uint8_t comp_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetDitherCompareValue:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetDitherCompareValue:Invalid Dither compare value", (comp_val <= 15U)); + + slice->DITS = comp_val; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param div_val Prescaler divider value + * Range: [0x0 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Programs the slice specific prescaler divider, by configuring the CC8yPSC and CC8yFPC registers.\n\n + * The prescaler divider may only be programmed after the prescaler run bit has been cleared + * by calling XMC_CCU8_StopPrescaler(). + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetFloatingPrescalerCompareValue(). + */ +void XMC_CCU8_SLICE_SetPrescaler(XMC_CCU8_SLICE_t *const slice, const uint8_t div_val); + +/** + * @param slice Constant pointer to CC8 Slice + * @param cmp_val Prescaler divider compare value + * Range: [0x0 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Programs the slice specific prescaler divider compare value, by configuring CC8yFPCS register.\n\n + * The compare value is applicable only in floating mode of operation. The prescaler divider starts with an initial + * value and increments to the compare value steadily upon every period match. Once prescaler divider + * equals the prescaler divider compare value, the value in the former resets back to the PVAL (from FPC). After setting + * the value, XMC_CCU8_EnableShadowTransfer() has to be called with appropriate mask. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetPrescaler(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_SetFloatingPrescalerCompareValue(XMC_CCU8_SLICE_t *const slice, + const uint8_t cmp_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetFloatingPrescalerCompareValue:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + /* First, write to the shadow register */ + slice->FPCS = (uint32_t) cmp_val; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param ch_num Compare channel for which the multi-channel mode is needed. + * @return
+ * None
+ * + * \parDescription:
+ * Enables the multichannel mode, by setting CC8yTC.MCME1 or CC8yTC.MCME1 bits based on the \a ch_num.\n\n + * The output state of the Timer slices can be controlled in parallel by a single input signal. + * A particularly useful feature in motor control applications where the PWM output of multiple slices of a module can + * be gated and ungated by multi-channel gating inputs connected to the slices. A peripheral like POSIF connected to the + * motor knows exactly which of the power drive switches are to be turned on and off at any instant. It can thus through + * a gating bus (known as multi-channel inputs) control which of the slices output stays gated/ungated. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_DisableMultiChannelMode()
XMC_CCU8_SetMultiChannelShadowTransferMode(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableMultiChannelMode(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t ch_num) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableMultiChannelMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_EnableMultiChannelMode:Invalid Channel", XMC_CCU8_SLICE_CHECK_COMP_CHANNEL(ch_num)); + + slice->TC |= (uint32_t)CCU8_CC8_TC_MCME1_Msk << ch_num; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param ch_num Compare channel for which the multi-channel mode needs to be disabled. + * @return
+ * None
+ * + * \parDescription:
+ * Disables the multichannel mode, by clearing CC8yTC.MCME1 or CC8yTC.MCME1 bits based on the \a ch_num.\n\n + * Returns the slices to the normal operation mode. This takes the slice number as input and + * configures the multi channel mode for it. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableMultiChannelMode(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableMultiChannelMode(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t ch_num) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableMultiChannelMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_DisableMultiChannelMode:Invalid Channel", XMC_CCU8_SLICE_CHECK_COMP_CHANNEL(ch_num)); + + slice->TC &= ~((uint32_t)CCU8_CC8_TC_MCME1_Msk << ch_num); +} + +/** + * @param module Constant pointer to CCU8 module + * @param slice_mode_msk Slices for which the configuration has to be applied. + * Use ::XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Enables the Multi-channel shadow transfer request trigger signal either by software or hardware by configuring + * GCTRL.MSE0, GCTRL.MSE1, GCTRL.MSE2, and GCTRL.MSE3 based on the mask.\n\n + * The shadow transfer would take place either if it was requested by software or by the CCU8x.MCSS input. + * + * \parRelated APIs:
+ * None. +*/ +void XMC_CCU8_SetMultiChannelShadowTransferMode(XMC_CCU8_MODULE_t *const module, const uint32_t slice_mode_msk); + +/** + * @param slice Constant pointer to CC8 Slice + * @param reg_num The capture register from which the captured value is to be retrieved + * Range: [0,3] + * @return
+ * uint32_t Returns the Capture register value. + * Range: [0 to 0x1FFFFF] + * + * \parDescription:
+ * Retrieves timer value which has been captured in the Capture registers, by reading CC8yCV[\b reg_num] register.\n\n + * The signal whose timing characteristics are to be measured must be mapped to an event which in turn must be mapped + * to the capture function. Based on the capture criteria, the timer values are captured into capture registers. Timing + * characteristics of the input signal may then be derived/inferred from the captured values. The full flag will help + * to find out if there is a new captured value present. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_GetLastCapturedTimerValue(). + */ +uint32_t XMC_CCU8_SLICE_GetCaptureRegisterValue(const XMC_CCU8_SLICE_t *const slice, const uint8_t reg_num); + +/** + * @param slice Constant pointer to CC8 Slice + * @param set The capture register set, which must be evaluated + * @param val_ptr Out Parameter of the API.Stores the captured timer value into this out parameter. + * @return
+ * ::XMC_CCU8_STATUS_t Returns XMC_CCU8_STATUS_OK if there was new value present in the capture registers. + * returns XMC_CCU8_STATUS_ERROR if there was no new value present in the capture registers. + * + * \parDescription:
+ * Retrieves the latest captured timer value, by reading CC8yCV registers.\n\n + * Retrieve the timer value last stored by the slice. When separate capture events are used, + * users must specify the capture set to evaluate. If single capture event mode is used, all 8 capture registers are + * evaluated.\n + * The lowest register is evaluated first followed by the next higher ordered register and this continues until all + * capture registers have been evaluated. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_GetCaptureregisterValue(). + */ +XMC_CCU8_STATUS_t XMC_CCU8_SLICE_GetLastCapturedTimerValue(const XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_CAP_REG_SET_t set, + uint32_t *val_ptr); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Event whose assertion can potentially lead to an interrupt + * @return
+ * None
+ * + * \parDescription:
+ * Enables the generation of an interrupt pulse for the event, by configuring CC8yINTE register.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API merely enables the event. Binding with SR is performed by another API. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetInterruptNode()
XMC_CCU8_SLICE_EnableMultipleEvents()
XMC_CCU8_SLICE_DisableEvent()
+ * XMC_CCU8_SLICE_DisableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableEvent(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableEvent:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_EnableEvent:Invalid SR event", XMC_CCU8_SLICE_CHECK_INTERRUPT(event)); + + slice->INTE |= ((uint32_t) 1) << ((uint32_t) event); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param mask Event mask such that multiple events can be enabled. + * Use ::XMC_CCU8_SLICE_MULTI_IRQ_ID_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Enables the generation of an interrupt pulse for the required events, by configuring CC8yINTE register.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API merely enables the events. Binding with SR is performed by another API. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetInterruptNode()
XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_DisableEvent()
+ * XMC_CCU8_SLICE_DisableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableMultipleEvents(XMC_CCU8_SLICE_t *const slice, const uint16_t mask) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableMultipleEvents:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->INTE = (uint32_t) mask; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Event whose assertion can potentially lead to an interrupt + * @return
+ * None
+ * + * \parDescription:
+ * Disables the generation of an interrupt pulse for the event, by clearing CC8yINTE register.\n\n + * Prevents the event from being asserted. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetInterruptNode()
XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_EnableMultipleEvents()
+ * XMC_CCU8_SLICE_DisableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableEvent(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableEvent:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_DisableEvent:Invalid SR event", XMC_CCU8_SLICE_CHECK_INTERRUPT(event)); + + slice->INTE &= ~(((uint32_t) 1) << ((uint32_t) event)); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param mask Event mask such that multiple events can be enabled. + * Use ::XMC_CCU8_SLICE_MULTI_IRQ_ID_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Disables the generation of an interrupt pulse for the required events, by clearing CC8yINTE register.\n\n + * Prevents selected events of the slice from being asserted. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetInterruptNode()
XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_EnableMultipleEvents()
+ * XMC_CCU8_SLICE_DisableEvent(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableMultipleEvents(XMC_CCU8_SLICE_t *const slice, const uint16_t mask) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableMultipleEvents:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->INTE &= ~((uint32_t) mask); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Event whose assertion can potentially lead to an interrupt + * @return
+ * None
+ * + * \parDescription:
+ * Manually asserts the requested event, by setting CC8ySWS register.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API manually asserts the requested event. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetInterruptNode()
XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_EnableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_SetEvent(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetEvent:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetEvent:Invalid SR event", XMC_CCU8_SLICE_CHECK_INTERRUPT(event)); + + slice->SWS |= ((uint32_t) 1) << ((uint32_t) event); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Asserted event which must be acknowledged. + * @return
+ * None
+ * + * \parDescription:
+ * Acknowledges an asserted event, by setting CC8ySWR with respective event flag.\n\n + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_SetEvent()
XMC_CCU8_SLICE_GetEvent(). + * + */ +__STATIC_INLINE void XMC_CCU8_SLICE_ClearEvent(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU8_SLICE_ClearEvent:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_ClearEvent:Invalid SR event", XMC_CCU8_SLICE_CHECK_INTERRUPT(event)); + slice->SWR |= ((uint32_t) 1) << ((uint32_t) event); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Event to be evaluated for assertion + * @return
+ * bool Returns true if event is set else false is returned. + * + * \parDescription:
+ * Evaluates if a given event is asserted or not, by reading CC8yINTS register.\n\n + * Return true if the event is asserted. For a event to be asserted it has to be + * first enabled. Only if that event is enabled the call to this API is valid. + * If the Event is enabled and has not yet occurred then a false is returned. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_SetEvent(). + */ +__STATIC_INLINE bool XMC_CCU8_SLICE_GetEvent(const XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetEvent:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_GetEvent:Invalid SR event", XMC_CCU8_SLICE_CHECK_INTERRUPT(event)); + return(((uint32_t)(slice->INTS & ((uint32_t)1 << event))) != 0U); + } + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Event which must be bound to a service request line + * @param sr The Service request line which is bound to the \b event + * @return
+ * None
+ * + * \parDescription:
+ * Binds requested event to a service request line, by configuring CC8ySRS register with respective event.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API binds the requested event with the requested service request line(\b sr). + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_SetEvent(). + * + */ +void XMC_CCU8_SLICE_SetInterruptNode(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_IRQ_ID_t event, + const XMC_CCU8_SLICE_SR_ID_t sr); + +/** + * @param slice Constant pointer to CC8 Slice + * @param out Output signal for which the passive level needs to be set. + * @param level Output passive level for the \b out signal + * @return
+ * None
+ * + * \parDescription:
+ * Configures the passive level for the slice output, by setting CC8yPSL register.\n\n + * Defines the passive level for the timer slice output pin. Selects either level high is passive + * or level low is passive. This is the level of the output before the compare match is value changes it. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_SetEvent(). + */ +void XMC_CCU8_SLICE_SetPassiveLevel(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_OUTPUT_t out, + const XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_t level); + +/** + * @param slice Constant pointer to CC8 Slice + * @param config Pointer to dead time configuration data + * @return
+ * None
+ * + * \parDescription:
+ * Initializes Dead time configuration for the slice outputs, by configuring CC8yDC1R, CC8yDC2R, CC8yDTC registers.\n\n + * This routine programs dead time delays (rising & falling) and dead time clock prescaler. + * Details such as the choice of dead time for channel1, channel2, ST1, Inverted ST1, ST2, Inverted ST2, are also + * programmed by this routine. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureDeadTime()
XMC_CCU8_SLICE_SetDeadTimeValue()
XMC_CCU8_SLICE_SetDeadTimePrescaler()
+ * XMC_CCU8_SLICE_IsDeadTimeCntr1Running()
XMC_CCU8_SLICE_IsDeadTimeCntr2Running(). + */ +void XMC_CCU8_SLICE_DeadTimeInit(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_DEAD_TIME_CONFIG_t *const config); + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Configures the slice to generate PWM in asymmetric compare mode, by setting CC8yCHC.ASE bit.\n\n + * In asymmetric compare mode, the compare channels 1 & 2 are grouped to generate the PWM.This would + * generate an inverted PWM at OUT0 & OUT1. + * In Edge Aligned mode (counting up), the Status bit is set when a compare match of + * Compare channel-1 occurs and cleared when a compare match event of Compare channel-2 occurs.\n + * In Center Aligned mode, the status bit is set when a compare match event of Compare channel-1 occurs while + * counting up and cleared when a compare match event of Compare channel-2 occurs while counting down. + * + * \parNote:
+ * External count direction function is enabled then the asymmetric mode of operation is not possible. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableSymmetricCompareMode()
+ */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableAsymmetricCompareMode(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableAsymmetricCompareMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->CHC |= (uint32_t) CCU8_CC8_CHC_ASE_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Configures the slice to generate PWM in symmetric(standard) compare mode, by clearing CC8yCHC.ASE bit.\n\n + * In symmetric compare mode, the compare channels 1 & 2 are independent of each other & each channel generates the + * PWM & inverted PWM at OUT0, OUT1, OUT2 & OUT3. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableAsymmetricCompareMode(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableSymmetricCompareMode(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableSymmetricCompareMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->CHC &= ~((uint32_t) CCU8_CC8_CHC_ASE_Msk); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param mask The Dead Time configuration mask. + * Do a bitwise OR operation on the following values depending on the need. + * Value 0x1: Dead Time Enable for Compare Channel 1 + * Value 0x2: Dead Time Enable for Compare Channel 2 + * Value 0x4: Dead Time Enable for CC8yST1 path is enabled. + * Value 0x8: Dead Time Enable for Inverted CC8yST1 path is enabled. + * Value 0x10: Dead Time Enable for CC8yST2 path is enabled. + * Value 0x20: Dead Time Enable for Inverted CC8yST2 path is enabled. + * Range: [0x0 to 0x3F] + * + * \parDescription:
+ * Activates or deactivates dead time for compare channel and ST path, by configuring CC8y.DC1R, CC8y.DC1R and + * CC8y.DTC registers.\n\n + * Use the provided masks to enable/disable the dead time for the compare channels and the ST signals. It is possible + * to deactivate the dead time for all the options by passing a 0x0 as the mask. + * Details such as the choice of dead time for channel1, channel2, ST1, Inverted ST1, ST2, Inverted ST2, are + * programmed by this routine. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_DeadTimeInit()
XMC_CCU8_SLICE_SetDeadTimeValue()
XMC_CCU8_SLICE_SetDeadTimePrescaler()
+ * XMC_CCU8_SLICE_IsDeadTimeCntr1Running()
XMC_CCU8_SLICE_IsDeadTimeCntr2Running(). + */ +void XMC_CCU8_SLICE_ConfigureDeadTime(XMC_CCU8_SLICE_t *const slice, const uint8_t mask); + +/** + * @param slice Constant pointer to CC8 Slice + * @param channel Compare channel number + * @param rise_value Programs rising edge delay + * Range: [0x0 to 0xFF] + * @param fall_value Programs falling edge delay + * Range: [0x0 to 0xFF] + * @return
+ * None
+ * + * \parDescription:
+ * Configures the dead time for rising and falling edges, by updating CC8y.DC1R, CC8y.DC1R registers.\n\n + * This API will Configure the delay that is need either when the value changes from 0 to 1 (rising edge) or + * value changes from 1 to 0(falling edge). Directly accessed registers are CC8yDC1R, CC8yDC2R. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_DeadTimeInit()
XMC_CCU8_SLICE_SetDeadTimeValue()
XMC_CCU8_SLICE_ConfigureDeadTime()
+ * XMC_CCU8_SLICE_IsDeadTimeCntr1Running()
XMC_CCU8_SLICE_IsDeadTimeCntr2Running(). + */ +void XMC_CCU8_SLICE_SetDeadTimeValue(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t channel, + const uint8_t rise_value, + const uint8_t fall_value); + +/** + * @param slice Pointer to an instance of CC8 slice + * @param div_val Prescaler divider value + * @return
+ * None
+ * + * \parDescription:
+ * Configures clock division factor for dead time generator, by configuring CC8yDTC.DTCC bit. + * The Clock divider works on the timer clock. It is possible to scale the timer clock for the dead time + * generator by a factor of 1/2/4/8. This selection is passed as an argument to the API. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_DeadTimeInit()
XMC_CCU8_SLICE_SetDeadTimeValue()
XMC_CCU8_SLICE_ConfigureDeadTime()
+ * XMC_CCU8_SLICE_IsDeadTimeCntr1Running()
XMC_CCU8_SLICE_IsDeadTimeCntr2Running(). + */ +void XMC_CCU8_SLICE_SetDeadTimePrescaler(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_DTC_DIV_t div_val); + +/** + * @param slice Constant pointer to CC8 Slice + * @param channel which channel status has to be give as out + * @return
+ * None
+ * + * \parDescription:
+ * Configures status ST1, ST2 mapping to STy, by configuring CC8yTC.STOS bits.\n\n + * This routine defines the output STy as a function of ST1 or ST2 or both ST1 & ST2. + * It is possible to make the CCU8x.STy signal to reflect the CC8y.ST1/CC8y.ST2 or a function of the 2 signals. + * + * \parRelated APIs:
+ * None. + */ +void XMC_CCU8_SLICE_ConfigureStatusBitOutput(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_STATUS_t channel); + +#if (UC_SERIES != XMC45) || defined(DOXYGEN) +/** + * @param slice Constant pointer to CC8 Slice + * + * @return
+ * None
+ * + * \parDescription:
+ * Cascades the shadow transfer operation throughout the CCU8 timer slices, by setting CSE bit in STC register.\n\n + * + * The shadow transfer enable bits needs to be set in all timer slices, that are being used in the cascaded architecture, + * at the same time. The shadow transfer enable bits, also need to be set for all slices even if the shadow values of + * some slices were not updated. It is possible to to cascade with the adjacent slices only. CC80 slice is a + * master to start the operation. + * + * \parNote:
+ * XMC_CCU8_EnableShadowTransfer() must be called to enable the shadow transfer of the all the slices, which needs to be + * cascaded. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableShadowTransfer(), XMC_CCU8_SLICE_DisableCascadedShadowTransfer()
. + * @note Not available for XMC4500 series + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableCascadedShadowTransfer(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableCascadedShadowTransfer:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->STC |= (uint32_t) CCU8_CC8_STC_CSE_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * + * @return
+ * None
+ * + * \parDescription:
+ * Disables the cascaded the shadow transfer operation, by clearing CSE bit in STC register.\n\n + * + * If in any slice the cascaded mode disabled, other slices from there onwards does not update the values in cascaded mode. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableCascadedShadowTransfer()
. + * @note Not available for XMC4500 series + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableCascadedShadowTransfer(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableCascadedShadowTransfer:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->STC &= ~(uint32_t) CCU8_CC8_STC_CSE_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param shadow_transfer_mode mode to be configured + * Use :: XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE_t enum items for mode + * @return
+ * None
+ * + * \parDescription:
+ * Configures when the shadow transfer has to occur, by setting STM bit in STC register.\n\n + * + * After requesting for shadow transfer mode using XMC_CCU8_EnableShadowTransfer(), actual transfer occurs based on the + * selection done using this API (i.e. on period and One match, on Period match only, on One match only). + * + * \parNote:
+ * This is effective when the timer is configured in centre aligned mode. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableShadowTransfer()
+ * @note Not available for XMC4500 series + */ +__STATIC_INLINE void XMC_CCU8_SLICE_SetShadowTransferMode(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE_t shadow_transfer_mode) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetShadowTransferMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->STC = ((slice->STC) & ~(uint32_t)((uint32_t)CCU8_CC8_STC_STM_Msk << (uint32_t)CCU8_CC8_STC_STM_Pos)) | + ((shadow_transfer_mode << CCU8_CC8_STC_STM_Pos) & (uint32_t)CCU8_CC8_STC_STM_Msk); +} +#endif + +#if defined(CCU8V3) || defined(DOXYGEN)/* Defined for XMC1400 devices only */ + /** + * @param slice Constant pointer to CC8 Slice + * @param immediate_write specifies for what fields this mode has to be applied + * Use :: XMC_CCU8_SLICE_WRITE_INTO_t enum items to create a mask of choice, using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configures the specified fields shadow value to be updated immediately after shadow transfer request, by setting + * IRPC, IRCC1, IRCC2, IRLC, IRDC, IRFC bits in STC register.\n\n + * + * When immediate shadow is enabled, by calling XMC_CCU8_EnableShadowTransfer() the value which are written in the + * shadow registers get updated to the actual registers immediately. \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU8_EnableShadowTransfer()
+ * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU8_SLICE_WriteImmediateAfterShadowTransfer(XMC_CCU8_SLICE_t *const slice, + const uint32_t immediate_write) +{ + XMC_ASSERT("XMC_CCU8_SLICE_WriteImmediateAfterShadowTransfer:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->STC |= immediate_write; +} + + /** + * @param slice Constant pointer to CC8 Slice + * @param coherent_write specifies for what fields this mode has to be applied + * Use :: XMC_CCU8_SLICE_WRITE_INTO_t enum items to create a mask of choice, using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configures the specified fields shadow value to be updated in synchronous with PWM after shadow transfer request, by + * clearing IRPC, IRCC1, IRCC2, IRLC, IRDC, IRFC bits in STC register.\n\n + * + * When coherent shadow is enabled, after calling XMC_CCU8_EnableShadowTransfer(), the value which are written in the + * respective shadow registers get updated according the configuration done using XMC_CCU8_SLICE_SetShadowTransferMode() + * API. \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU8_EnableShadowTransfer(), XMC_CCU8_SLICE_SetShadowTransferMode()
+ * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU8_SLICE_WriteCoherentlyWithPWMCycle(XMC_CCU8_SLICE_t *const slice, + const uint32_t coherent_write) +{ + XMC_ASSERT("XMC_CCU8_SLICE_WriteCoherentlyWithPWMCycle:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->STC &= ~(uint32_t)coherent_write; +} + + /** + * @param slice Constant pointer to CC8 Slice + * @param automatic_shadow_transfer specify upon which register update, automatic shadow transfer request is generated + * Use :: XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_t enum items to create a mask of choice, using a + * bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configure on which shadow register update, automatic shadow transfer request generation has to be enabled. By setting + * ASPC, ASCC1, ASCC2, ASLC, ASDC, ASFC bits in STC register.\n\n + * + * By updating the configured shadow register, the shadow transfer request is generated to update all the shadow registers. + * \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_DisableAutomaticShadowTransferRequest(). + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableAutomaticShadowTransferRequest(XMC_CCU8_SLICE_t *const slice, + const uint32_t automatic_shadow_transfer) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableAutomaticShadowTransferRequest:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->STC |= automatic_shadow_transfer; +} + + /** + * @param slice Constant pointer to CC8 Slice + * @param automatic_shadow_transfer specify upon which register update, automatic shadow transfer request should not be + * generated + * Use :: XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_t enum items to create a mask of choice, using a + * bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configure on which shadow register update, automatic shadow transfer request generation has to be disabled. By + * clearing ASPC, ASCC1, ASCC2, ASLC, ASDC, ASFC bits in STC register.\n\n + * + * This disables the generation of automatic shadow transfer request for the specified register update. + * \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableAutomaticShadowTransferRequest(). + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableAutomaticShadowTransferRequest(XMC_CCU8_SLICE_t *const slice, + const uint32_t automatic_shadow_transfer) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableAutomaticShadowTransferRequest:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->STC &= ~(uint32_t)automatic_shadow_transfer; +} +#endif +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(CCU80) */ + +#endif /* XMC_CCU8_H */ + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_common.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_common.h new file mode 100644 index 00000000..77ff7e07 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_common.h @@ -0,0 +1,285 @@ +/** + * @file xmc_common.h + * @date 2017-04-04 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-06-20: + * - Initial + * - Brief section updated + * - Added XMC_LIB_VERSION macro + * + * 2016-02-26: + * - Updated XMC_LIB_VERSION macro to v2.1.6 + * + * 2016-05-30: + * - Updated XMC_LIB_VERSION macro to v2.1.8 + * + * 2016-11-18: + * - Updated XMC_LIB_VERSION macro to v2.1.10 + * - Changed type of size in XMC_PRIOARRAY_t to fix compilation warnings + * + * 2017-04-04: + * - Updated XMC_LIB_VERSION macro to v2.1.12 + * + * @endcond + * + */ + +#ifndef XMC_COMMON_H +#define XMC_COMMON_H + +#include +#include +#include +#include + +#include "xmc_device.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup COMMON + * @brief Common APIs to all peripherals for XMC microcontroller family + * @{ + */ + +/********************************************************************************************************************** + * MACROS + *********************************************************************************************************************/ +#define XMC_LIB_MAJOR_VERSION (2U) +#define XMC_LIB_MINOR_VERSION (1U) +#define XMC_LIB_PATCH_VERSION (12U) + +#define XMC_LIB_VERSION ((XMC_LIB_MAJOR_VERSION << 16U) + (XMC_LIB_MINOR_VERSION << 8U) + XMC_LIB_PATCH_VERSION) + +/* Define WEAK attribute */ +#if !defined(__WEAK) +#if defined ( __CC_ARM ) +#define __WEAK __attribute__ ((weak)) +#elif defined ( __ICCARM__ ) +#define __WEAK __weak +#elif defined ( __GNUC__ ) +#define __WEAK __attribute__ ((weak)) +#elif defined ( __TASKING__ ) +#define __WEAK __attribute__ ((weak)) +#endif +#endif + +#ifdef XMC_ASSERT_ENABLE + #define XMC_ASSERT(msg, exp) { if(!(exp)) {XMC_AssertHandler(msg, __FILE__, __LINE__);} } +#else + #define XMC_ASSERT(msg, exp) { ; } +#endif + +#ifdef XMC_DEBUG_ENABLE + #include + #define XMC_DEBUG(...) { printf(__VA_ARGS__); } +#else + #define XMC_DEBUG(...) { ; } +#endif + +#define XMC_UNUSED_ARG(x) (void)x + +#define XMC_STRUCT_INIT(m) memset(&m, 0, sizeof(m)) + +#define XMC_PRIOARRAY_DEF(name, size) \ +XMC_PRIOARRAY_ITEM_t prioarray_m_##name[size + 2]; \ +XMC_PRIOARRAY_t prioarray_def_##name = {(size), (prioarray_m_##name)}; + +#define XMC_PRIOARRAY(name) \ +&prioarray_def_##name + +/********************************************************************************************************************** + * DATA STRUCTURES + *********************************************************************************************************************/ +/* + * + */ +typedef struct XMC_DRIVER_VERSION +{ + uint8_t major; + uint8_t minor; + uint8_t patch; +} XMC_DRIVER_VERSION_t; + +/* + * + */ +typedef void *XMC_LIST_t; + +/* + * + */ +typedef struct XMC_PRIOARRAY_ITEM +{ + int32_t priority; + int32_t previous; + int32_t next; +} XMC_PRIOARRAY_ITEM_t; + +/* + * + */ +typedef struct XMC_PRIOARRAY +{ + int32_t size; + XMC_PRIOARRAY_ITEM_t *items; +} XMC_PRIOARRAY_t; + +/********************************************************************************************************************** + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * + */ +void XMC_AssertHandler(const char *const msg, const char *const file, uint32_t line); + +/* + * + */ +void XMC_LIST_Init(XMC_LIST_t *list); + +/* + * + */ +void XMC_LIST_Add(XMC_LIST_t *list, void *const item); + +/* + * + */ +void XMC_LIST_Remove(XMC_LIST_t *list, void *const item); + +/* + * + */ +uint32_t XMC_LIST_GetLength(XMC_LIST_t *list); + +/* + * + */ +void *XMC_LIST_GetHead(XMC_LIST_t *list); + +/* + * + */ +void *XMC_LIST_GetTail(XMC_LIST_t *list); + +/* + * + */ +void XMC_LIST_Insert(XMC_LIST_t *list, void *prev_item, void *new_item); + +/* + * + */ +void XMC_PRIOARRAY_Init(XMC_PRIOARRAY_t *prioarray); + +/* + * + */ +void XMC_PRIOARRAY_Add(XMC_PRIOARRAY_t *prioarray, int32_t item, int32_t priority); + +/* + * + */ +void XMC_PRIOARRAY_Remove(XMC_PRIOARRAY_t *prioarray, int32_t item); + +/* + * + */ +__STATIC_INLINE int32_t XMC_PRIOARRAY_GetHead(XMC_PRIOARRAY_t *prioarray) +{ + XMC_ASSERT("XMC_PRIOARRAY_Init: NULL pointer", prioarray != NULL); + return prioarray->items[prioarray->size].next; +} + +/* + * + */ +__STATIC_INLINE int32_t XMC_PRIOARRAY_GetTail(XMC_PRIOARRAY_t *prioarray) +{ + XMC_ASSERT("XMC_PRIOARRAY_Init: NULL pointer", prioarray != NULL); + return prioarray->items[prioarray->size + 1].previous; +} + +/* + * + */ +__STATIC_INLINE int32_t XMC_PRIOARRAY_GetItemPriority(XMC_PRIOARRAY_t *prioarray, int32_t item) +{ + XMC_ASSERT("XMC_PRIOARRAY_GetItemPriority: item out of range", (item >= 0) && (item < prioarray->size)); + return prioarray->items[item].priority; +} + +/* + * + */ +__STATIC_INLINE int32_t XMC_PRIOARRAY_GetItemNext(XMC_PRIOARRAY_t *prioarray, int32_t item) +{ + XMC_ASSERT("XMC_PRIOARRAY_GetItemNext: item out of range", (item >= 0) && (item < prioarray->size)); + return prioarray->items[item].next; +} + +/* + * + */ +__STATIC_INLINE int32_t XMC_PRIOARRAY_GetItemPrevious(XMC_PRIOARRAY_t *prioarray, int32_t item) +{ + XMC_ASSERT("XMC_PRIOARRAY_GetItemPrevious: item out of range", (item >= 0) && (item < prioarray->size)); + return prioarray->items[item].previous; +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* XMC_COMMON_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_device.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_device.h new file mode 100644 index 00000000..fe346210 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_device.h @@ -0,0 +1,1514 @@ +/** + * @file xmc_device.h + * @date 2016-07-21 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-06-20: + * - Initial version + * + * 2015-09-23: + * - Added XMC14 and XMC48/47 + * + * 2015-11-19: + * - Added XMC43 + * + * 2016-02-26: + * - Fixed CCU8 version for XMC43/47/48 + * + * 2016-06-14: + * - Added XMC1201_T028x0016, XMC1202_T016x0064, XMC1301_T016x0032, XMC1302_Q040x0200, + * XMC1302_T028x0016, XMC1402_T038x0032, XMC1402_T038x0064, XMC1402_T038x0128, + * XMC1403_Q040x0064, XMC1403_Q040x0128, XMC1403_Q040x0200, XMC1402_T038x0200 + * XMC1402_Q040x0200, XMC1402_Q048x0200, XMC1201_T028x0032 + * @endcond + * + */ + +#ifndef XMC_DEVICE_H +#define XMC_DEVICE_H + +/* Family definitions */ +#define XMC4 (4) +#define XMC1 (1) + +/* Series definitions */ +#define XMC48 (48) +#define XMC47 (47) +#define XMC45 (45) +#define XMC44 (44) +#define XMC43 (43) +#define XMC42 (42) +#define XMC41 (41) +#define XMC14 (14) +#define XMC13 (13) +#define XMC12 (12) +#define XMC11 (11) + +/* Device definitions */ +#define XMC4800 (4800) +#define XMC4700 (4700) +#define XMC4500 (4500) +#define XMC4502 (4502) +#define XMC4504 (4504) +#define XMC4400 (4400) +#define XMC4402 (4402) +#define XMC4300 (4300) +#define XMC4200 (4200) +#define XMC4100 (4100) +#define XMC4104 (4104) +#define XMC4108 (4108) +#define XMC1401 (1401) +#define XMC1402 (1402) +#define XMC1403 (1403) +#define XMC1404 (1404) +#define XMC1300 (1300) +#define XMC1301 (1301) +#define XMC1302 (1302) +#define XMC1200 (1200) +#define XMC1201 (1201) +#define XMC1202 (1202) +#define XMC1203 (1203) +#define XMC1100 (1100) + +/* Package definitions */ +#define BGA144 (1) +#define LQFP144 (2) +#define LQFP100 (3) +#define BGA64 (4) +#define LQFP64 (5) +#define VQFN48 (6) +#define TSSOP38 (7) +#define TSSOP28 (8) +#define TSSOP16 (9) +#define VQFN24 (10) +#define VQFN40 (11) +#define VQFN64 (12) +#define BGA196 (13) + +#if defined(XMC4800_E196x2048) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE BGA196 +#define UC_FLASH (2048UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_F144x2048) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (2048UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_F100x2048) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (2048UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_E196x1536) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE BGA196 +#define UC_FLASH (1536UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_F144x1536) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (1536UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_F100x1536) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (1536UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_E196x1024) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE BGA196 +#define UC_FLASH (1024UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_F144x1024) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (1024UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_F100x1024) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (1024UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4700_E196x2048) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC47 +#define UC_DEVICE XMC4700 +#define UC_PACKAGE BGA196 +#define UC_FLASH (2048UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4700_F144x2048) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC47 +#define UC_DEVICE XMC4700 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (2048UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4700_F100x2048) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC47 +#define UC_DEVICE XMC4700 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (2048UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4700_E196x1536) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC47 +#define UC_DEVICE XMC4700 +#define UC_PACKAGE BGA196 +#define UC_FLASH (1536UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4700_F144x1536) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC47 +#define UC_DEVICE XMC4700 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (1536UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4700_F100x1536) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC47 +#define UC_DEVICE XMC4700 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (1536UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4500_E144x1024) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4500 +#define UC_PACKAGE BGA144 +#define UC_FLASH (1024UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4500_F144x1024) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4500 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (1024UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4500_F100x1024) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4500 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (1024UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4500_F144x768) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4500 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (768UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4500_F100x768) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4500 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (768UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4502_F100x768) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4502 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (768UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4504_F100x512) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4504 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (512UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4504_F144x512) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4504 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (512UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4400_F100x512) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC44 +#define UC_DEVICE XMC4400 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (512UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4400_F64x512) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC44 +#define UC_DEVICE XMC4400 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (512UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4400_F100x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC44 +#define UC_DEVICE XMC4400 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (256UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4400_F64x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC44 +#define UC_DEVICE XMC4400 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (256UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4402_F100x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC44 +#define UC_DEVICE XMC4402 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (256UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4402_F64x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC44 +#define UC_DEVICE XMC4402 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (256UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4300_F100x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC43 +#define UC_DEVICE XMC4300 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (256UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4200_E64x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC42 +#define UC_DEVICE XMC4200 +#define UC_PACKAGE BGA64 +#define UC_FLASH (256UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4200_F64x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC42 +#define UC_DEVICE XMC4200 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (256UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4200_Q48x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC42 +#define UC_DEVICE XMC4200 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (256UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4100_E64x128) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4100 +#define UC_PACKAGE BGA64 +#define UC_FLASH (128UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4100_F64x128) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4100 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (128UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4100_Q48x128) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4100 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (128UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4104_E64x64) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4104 +#define UC_PACKAGE BGA64 +#define UC_FLASH (64UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4104_F64x64) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4104 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (64UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4104_Q48x64) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4104 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (64UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4104_E64x128) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4104 +#define UC_PACKAGE BGA64 +#define UC_FLASH (128UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4104_F64x128) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4104 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (128UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4104_Q48x128) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4104 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (128UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4108_Q48x64) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4108 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (64UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4108_F64x64) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4108 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (64UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC1100_Q024x0008) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (8UL) +#define CCU4V2 + +#elif defined(XMC1100_Q024x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1100_Q024x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1100_Q024x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1100_Q040x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1100_Q040x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1100_Q040x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1100_T016x0008) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (8UL) +#define CCU4V2 + +#elif defined(XMC1100_T016x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1100_T016x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1100_T016x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1100_T038x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1100_T038x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1100_T038x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1201_Q040x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1201_Q040x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1201_Q040x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1201_Q040x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (128UL) +#define CCU4V2 + +#elif defined(XMC1201_Q040x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (200UL) +#define CCU4V2 + +#elif defined(XMC1201_T038x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1201_T038x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1201_T038x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1201_T038x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (128UL) +#define CCU4V2 + +#elif defined(XMC1201_T038x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (200UL) +#define CCU4V2 + +#elif defined(XMC1201_T028x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE TSSOP28 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1201_T028x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE TSSOP28 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1202_Q024x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1202_Q024x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1202_Q040x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1202_Q040x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1202_T016x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1202_T016x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1202_T016x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1202_T028x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE TSSOP28 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1202_T028x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE TSSOP28 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1202_T028x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE TSSOP28 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1200_T038x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1200 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (200UL) +#define CCU4V2 + +#elif defined(XMC1301_Q024x0008) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (8UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_Q024x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_Q040x0008) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (8UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_Q040x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_Q040x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (32UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_T016x0008) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (8UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_T016x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_T016x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (32UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_T038x0008) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (8UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_T038x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_T038x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (32UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_T038x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (64UL) + +#elif defined(XMC1302_Q024x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_Q024x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (32UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_Q024x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (64UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_Q040x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_Q040x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (32UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_Q040x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (64UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_Q040x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (128UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_Q040x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (200UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T038x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T038x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (32UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T038x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (64UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T038x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (128UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T038x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (200UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T028x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP28 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T016x0008) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (8UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T016x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T016x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (32UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1401_Q048x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1401 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (64UL) +#define CCU4V3 + +#elif defined(XMC1401_Q048x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1401 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (128UL) +#define CCU4V3 + +#elif defined(XMC1401_F064x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1401 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (64UL) +#define CCU4V3 + +#elif defined(XMC1401_F064x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1401 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (128UL) +#define CCU4V3 + +#elif defined(XMC1402_T038x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (32UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_T038x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (64UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_T038x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (128UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_T038x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (200UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q040x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (32UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q040x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (64UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q040x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (128UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q040x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (200UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q048x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (32UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q048x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (64UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q048x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (128UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q048x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (200UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q064x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (64UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q064x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (128UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q064x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (200UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_F064x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (64UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_F064x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (128UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_F064x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (200UL) +#define CCU4V3 +#define CCU8V3 + + +#elif defined(XMC1403_Q048x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (64UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q048x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (128UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q048x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (200UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q040x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (64UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q040x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (128UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q040x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (200UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q064x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (64UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q064x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (128UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q064x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (200UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1404_Q048x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (64UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_Q048x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (128UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_Q048x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (200UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_Q064x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (64UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_Q064x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (128UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_Q064x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (200UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_F064x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (64UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_F064x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (128UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_F064x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (200UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#else +#error "xmc_device.h: device not supported" +#endif + +#if UC_SERIES == XMC45 +#include "XMC4500.h" +#define PERIPHERAL_RESET_SUPPORTED +#define USB_OTG_SUPPORTED + +#elif UC_SERIES == XMC44 +#include "XMC4400.h" +#define CLOCK_GATING_SUPPORTED +#define PERIPHERAL_RESET_SUPPORTED +#define USB_OTG_SUPPORTED + +#elif UC_SERIES == XMC43 +#include "XMC4300.h" +#define CLOCK_GATING_SUPPORTED +#define PERIPHERAL_RESET_SUPPORTED +#define USB_OTG_SUPPORTED + +#elif UC_SERIES == XMC42 +#include "XMC4200.h" +#define CLOCK_GATING_SUPPORTED +#define PERIPHERAL_RESET_SUPPORTED + +#elif UC_SERIES == XMC41 +#include "XMC4100.h" +#define CLOCK_GATING_SUPPORTED +#define PERIPHERAL_RESET_SUPPORTED + +#elif UC_SERIES == XMC47 +#include "XMC4700.h" +#define CLOCK_GATING_SUPPORTED +#define PERIPHERAL_RESET_SUPPORTED +#define USB_OTG_SUPPORTED + +#elif UC_SERIES == XMC48 +#include "XMC4800.h" +#define CLOCK_GATING_SUPPORTED +#define PERIPHERAL_RESET_SUPPORTED +#define USB_OTG_SUPPORTED + +#elif UC_SERIES == XMC11 +#include "XMC1100.h" +#define CLOCK_GATING_SUPPORTED + +#elif UC_SERIES == XMC12 +#include "XMC1200.h" +#define CLOCK_GATING_SUPPORTED + +#elif UC_SERIES == XMC13 +#include "XMC1300.h" +#define CLOCK_GATING_SUPPORTED + +#elif UC_SERIES == XMC14 +#include "XMC1400.h" +#define CLOCK_GATING_SUPPORTED +#endif + +#endif /* XMC_DEVICE_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_eru.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_eru.h new file mode 100644 index 00000000..e5c04096 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_eru.h @@ -0,0 +1,884 @@ +/** + * @file xmc_eru.h + * @date 2016-03-10 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * - Documentation updates
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-10-07: + * - Doc update for XMC_ERU_ETL_CONFIG_t field
+ * + * 2016-03-10: + * - XMC_ERU_ETL_GetEdgeDetection() API is added to get the configured edge for event generation.
+ * + * @endcond + */ + +#ifndef XMC_ERU_H +#define XMC_ERU_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ + +#include "xmc_common.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup ERU + * @brief Event Request Unit (ERU) driver for the XMC microcontroller family. + * + * The Event Request Unit (ERU) is a versatile multiple input event detection and processing unit. + * The ERU module can be used to expand the P-to-P connections of the device: ports-to-peripherals, + * peripherals-to-peripherals and ports-to-ports. It also offers configurable logic, that allows the generation of + * triggers, pattern detection and real-time signal monitoring. + * + * @image html "eru_overview.png" + * + * The driver is divided into two sections: + * \par Event trigger logic (ERU_ETL): + * This section of the LLD provides the configuration structure XMC_ERU_ETL_CONFIG_t and the initialization function + * XMC_ERU_ETL_Init().\n + * It can be used to: + * -# Select one out of two inputs (A and B). For each of these two inputs, a vector of 4 possible signals is available. + * (XMC_ERU_ETL_SetSource()) + * -# Logically combine the two input signals to a common trigger. (XMC_ERU_ETL_SetSource()) + * -# Define the transition (edge selection, or by software) that leads to a trigger event and can also store this status. + * (XMC_ERU_ETL_SetEdgeDetection() and XMC_ERU_ETL_SetStatusFlag()) + * -# Distribute the events and status flags to the output channels. (XMC_ERU_ETL_EnableOutputTrigger()) + * + * \par Output gating unit (ERU_OGU): + * This section of the LLD provides the provides the configuration structure XMC_ERU_OGU_CONFIG_t and the initialization + * function XMC_ERU_ETL_OGU_Init(). + * It can be used to: + * -# Combine the trigger events and status information and gates the output depending on a gating signal. + * (XMC_ERU_OGU_EnablePatternDetection(), XMC_ERU_OGU_DisablePeripheralTrigger(), XMC_ERU_OGU_SetServiceRequestMode()) + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +#if defined(ERU0) +#define XMC_ERU0 ((XMC_ERU_t *) ERU0_BASE) /**< ERU module 0 */ +#endif + +#if defined(ERU1) +#define XMC_ERU1 ((XMC_ERU_t *) ERU1_BASE) /**< ERU module 1, only available in XMC4 family */ +#endif + +#if UC_FAMILY == XMC1 + #include "xmc1_eru_map.h" +#endif + +#if UC_FAMILY == XMC4 + #include "xmc4_eru_map.h" +#endif + +#if defined(XMC_ERU0) && defined(XMC_ERU1) +#define XMC_ERU_CHECK_MODULE_PTR(PTR) (((PTR)== XMC_ERU0) | ((PTR)== XMC_ERU1)) +#elif defined(XMC_ERU0) +#define XMC_ERU_CHECK_MODULE_PTR(PTR) (((PTR)== XMC_ERU0)) +#elif defined(XMC_ERU1) +#define XMC_ERU_CHECK_MODULE_PTR(PTR) (((PTR)== XMC_ERU0)) +#endif + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/** + * Defines input signal for path A of ERSx(Event request source, x = [0 to 3]) unit. + * @image html "eru_input_a.png" "ETLx Input A selection" +*/ +typedef enum XMC_ERU_ETL_INPUT_A +{ + XMC_ERU_ETL_INPUT_A0 = 0x0U, /**< input A0 is selected */ + XMC_ERU_ETL_INPUT_A1 = 0x1U, /**< input A1 is selected */ + XMC_ERU_ETL_INPUT_A2 = 0x2U, /**< input A2 is selected */ + XMC_ERU_ETL_INPUT_A3 = 0x3U /**< input A3 is selected */ +} XMC_ERU_ETL_INPUT_A_t; + +/** + * Defines input signal for path B of ERSx(Event request source, x = [0 to 3]) unit. + * @image html "eru_input_b.png" "ETLx Input B selection" + */ +typedef enum XMC_ERU_ETL_INPUT_B +{ + XMC_ERU_ETL_INPUT_B0 = 0x0U, /**< input B0 is selected */ + XMC_ERU_ETL_INPUT_B1 = 0x1U, /**< input B1 is selected */ + XMC_ERU_ETL_INPUT_B2 = 0x2U, /**< input B2 is selected */ + XMC_ERU_ETL_INPUT_B3 = 0x3U /**< input B3 is selected */ +} XMC_ERU_ETL_INPUT_B_t; + +/** + * Defines input path combination along with polarity for event generation by ERSx(Event request source) unit to + * ETLx(Event trigger logic),x = [0 to 3] unit. + * @image html "eru_input_trigger.png" "ETLx input trigger signal generation" + */ +typedef enum XMC_ERU_ETL_SOURCE +{ + XMC_ERU_ETL_SOURCE_A = 0x0U, /**< select (A) path as a event source */ + XMC_ERU_ETL_SOURCE_B = 0x1U, /**< select (B) path as a event source */ + XMC_ERU_ETL_SOURCE_A_OR_B = 0x2U, /**< select (A OR B) path as a event source */ + XMC_ERU_ETL_SOURCE_A_AND_B = 0x3U, /**< select (A AND B) path as a event source */ + XMC_ERU_ETL_SOURCE_NOT_A = 0x4U, /**< select (inverted A) path as a event source */ + XMC_ERU_ETL_SOURCE_NOT_A_OR_B = 0x6U, /**< select (inverted A OR B) path as a event source */ + XMC_ERU_ETL_SOURCE_NOT_A_AND_B = 0x7U, /**< select (inverted A AND B) path as a event source */ + XMC_ERU_ETL_SOURCE_NOT_B = 0x9U, /**< select (inverted B) path as a event source */ + XMC_ERU_ETL_SOURCE_A_OR_NOT_B = 0xaU, /**< select (A OR inverted B) path as a event source */ + XMC_ERU_ETL_SOURCE_A_AND_NOT_B = 0xbU, /**< select (A AND inverted B) path as a event source */ + XMC_ERU_ETL_SOURCE_NOT_A_OR_NOT_B = 0xeU, /**< select (inverted A OR inverted B) path as a event + source */ + XMC_ERU_ETL_SOURCE_NOT_A_AND_NOT_B = 0xfU /**< select (inverted A AND inverted B) path as a event + source */ +} XMC_ERU_ETL_SOURCE_t; + +/** + * Defines trigger edge for the event generation by ETLx (Event Trigger Logic, x = [0 to 3]) unit, by getting the signal + * from ERSx(Event request source, x = [0 to 3]) unit. + */ +typedef enum XMC_ERU_ETL_EDGE_DETECTION +{ + XMC_ERU_ETL_EDGE_DETECTION_DISABLED = 0U, /**< no event enabled */ + XMC_ERU_ETL_EDGE_DETECTION_RISING = 1U, /**< detection of rising edge generates the event */ + XMC_ERU_ETL_EDGE_DETECTION_FALLING = 2U, /**< detection of falling edge generates the event */ + XMC_ERU_ETL_EDGE_DETECTION_BOTH = 3U /**< detection of either edges generates the event */ +} XMC_ERU_ETL_EDGE_DETECTION_t; + +/** + * Defines Output Channel of OGUy(Output gating unit y = [0 to 3]) to be mapped by the trigger pulse generated by + * ETLx(Event Trigger Logic, x = [0 to 3]) unit. + * @note Generation of output trigger pulse need to be enabled @ref XMC_ERU_OGU_PERIPHERAL_TRIGGER_t + * @image html "eru_connection_matrix.png" "ERU_ETL ERU_OGU Connection matrix" + */ +typedef enum XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL +{ + XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL0 = 0U, /**< Event from input ETLx triggers output OGU0 */ + XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL1 = 1U, /**< Event from input ETLx triggers output OGU1 */ + XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL2 = 2U, /**< Event from input ETLx triggers output OGU2 */ + XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL3 = 3U, /**< Event from input ETLx triggers output OGU3 */ +} XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL_t; + +/** + * Defines generation of the trigger pulse by ETLx(Event Trigger Logic, x = [0 to 3]) unit. + * Use type XMC_ERU_ETL_OUTPUT_TRIGGER_t for this enum. + */ +typedef enum XMC_ERU_ETL_OUTPUT_TRIGGER +{ + XMC_ERU_ETL_OUTPUT_TRIGGER_DISABLED = 0U, /**< trigger pulse generation disabled */ + XMC_ERU_ETL_OUTPUT_TRIGGER_ENABLED = 1U /**< trigger pulse generation enabled */ +} XMC_ERU_ETL_OUTPUT_TRIGGER_t; + +/** + * Defines status flag reset mode generated by ETLx(Event Trigger Logic, x = [0 to 3]) unit. + * Use type XMC_ERU_ETL_STATUS_FLAG_MODE_t for this enum. + */ +typedef enum XMC_ERU_ETL_STATUS_FLAG_MODE +{ + XMC_ERU_ETL_STATUS_FLAG_MODE_SWCTRL = 0U, /**< Status flag is in sticky mode. Retain the same state until + cleared by software. In case of pattern match this mode + is used. */ + XMC_ERU_ETL_STATUS_FLAG_MODE_HWCTRL = 1U /**< Status flag is in non-sticky mode. Automatically cleared by + the opposite edge detection.\n + eg. if positive edge is selected as trigger event, for the + negative edge event the status flag is cleared. */ +} XMC_ERU_ETL_STATUS_FLAG_MODE_t; + +/** + * Defines pattern detection feature to be enabled or not in OGUy(Output gating unit, y = [0 to 3]). + * + */ +typedef enum XMC_ERU_OGU_PATTERN_DETECTION +{ + XMC_ERU_OGU_PATTERN_DETECTION_DISABLED = 0U, /**< Pattern match is disabled */ + XMC_ERU_OGU_PATTERN_DETECTION_ENABLED = 1U /**< Pattern match is enabled, the selected status flags of + ETLx(Event Trigger Logic, x = [0 to 3]) unit, are + used in pattern detection. */ +} XMC_ERU_OGU_PATTERN_DETECTION_t; + +/** + * Defines the inputs for Pattern detection. The configured status flag signal from the ETLx(Event Trigger Logic, + * x = [0 to 3]) unit indicates the pattern to be detected. + */ +typedef enum XMC_ERU_OGU_PATTERN_DETECTION_INPUT +{ + XMC_ERU_OGU_PATTERN_DETECTION_INPUT0 = 1U, /**< Status flag ETL0, participating in pattern match */ + XMC_ERU_OGU_PATTERN_DETECTION_INPUT1 = 2U, /**< Status flag ETL1, participating in pattern match */ + XMC_ERU_OGU_PATTERN_DETECTION_INPUT2 = 4U, /**< Status flag ETL0, participating in pattern match */ + XMC_ERU_OGU_PATTERN_DETECTION_INPUT3 = 8U /**< Status flag ETL0, participating in pattern match */ +} XMC_ERU_OGU_PATTERN_DETECTION_INPUT_t; + +/** + * Defines peripheral trigger signal for event generation. Based on the selected peripheral for event generation, + * the trigger signal is mapped. + */ +typedef enum XMC_ERU_OGU_PERIPHERAL_TRIGGER +{ + XMC_ERU_OGU_PERIPHERAL_TRIGGER1 = 1U, /**< OGUy1 signal is mapped for event generation */ + XMC_ERU_OGU_PERIPHERAL_TRIGGER2 = 2U, /**< OGUy2 signal is mapped for event generation */ + XMC_ERU_OGU_PERIPHERAL_TRIGGER3 = 3U /**< OGUy3 signal is mapped for event generation */ +} XMC_ERU_OGU_PERIPHERAL_TRIGGER_t; + +/** + * Defines the gating scheme for service request generation. In later stage of the OGUy(Output gating unit, + * y = [0 to 3]) based on the gating scheme selected ERU_GOUTy(gated output signal) output is defined. + * @image html "interrupt_gating_signal.png" "Interrupt gating signal" + */ +typedef enum XMC_ERU_OGU_SERVICE_REQUEST +{ + XMC_ERU_OGU_SERVICE_REQUEST_DISABLED = 0U, /**< Service request blocked, ERUx_GOUTy = 0 */ + XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER = 1U, /**< Service request generated enabled, ERUx_GOUTy = 1 */ + XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER_AND_PATTERN_MATCH = 2U, /**< Service request generated on trigger + event and input pattern match, + ERUx_GOUTy = ~pattern matching result*/ + XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER_AND_PATTERN_MISMATCH = 3U/**< Service request generated on trigger + event and input pattern mismatch, + ERUx_GOUTy = pattern matching result*/ +} XMC_ERU_OGU_SERVICE_REQUEST_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * ERU module + */ +typedef struct { + union { + __IO uint32_t EXISEL; + + struct { + __IO uint32_t EXS0A : 2; + __IO uint32_t EXS0B : 2; + __IO uint32_t EXS1A : 2; + __IO uint32_t EXS1B : 2; + __IO uint32_t EXS2A : 2; + __IO uint32_t EXS2B : 2; + __IO uint32_t EXS3A : 2; + __IO uint32_t EXS3B : 2; + } EXISEL_b; + }; + __I uint32_t RESERVED0[3]; + + union { + __IO uint32_t EXICON[4]; + + struct { + __IO uint32_t PE : 1; + __IO uint32_t LD : 1; + __IO uint32_t ED : 2; + __IO uint32_t OCS : 3; + __IO uint32_t FL : 1; + __IO uint32_t SS : 4; + __I uint32_t RESERVED1 : 20; + } EXICON_b[4]; + }; + + union { + __IO uint32_t EXOCON[4]; + + struct { + __IO uint32_t ISS : 2; + __IO uint32_t GEEN : 1; + __I uint32_t PDR : 1; + __IO uint32_t GP : 2; + uint32_t : 6; + __IO uint32_t IPEN : 4; + __I uint32_t RESERVED2 : 16; + } EXOCON_b[4]; + }; +} XMC_ERU_t; + +/** + * \if XMC4 + * Structure for initializing ERUx_ETLy (x = [0..1], y = [0..4]) module. + * \endif + * \if XMC1 + * Structure for initializing ERUx_ETLy (x = [0], y = [0..4]) module. + * \endif + */ +typedef struct XMC_ERU_ETL_CONFIG +{ + union + { + uint32_t input; /**< While configuring the bit fields, the values have to be shifted according to the position */ + struct + { + uint32_t input_a: 2; /**< Configures input A. Refer @ref XMC_ERU_ETL_INPUT_A_t for valid values */ + uint32_t input_b: 2; /**< Configures input B. Refer @ref XMC_ERU_ETL_INPUT_B_t for valid values */ + uint32_t : 28; + }; + }; + + union + { + uint32_t raw; + struct + { + uint32_t enable_output_trigger: 1; /**< Enables the generation of trigger pulse(PE), for the configured edge + detection. This accepts boolean values as input. */ + uint32_t status_flag_mode: 1; /**< Enables the status flag auto clear(LD), for the opposite edge of the + configured event edge. This accepts boolean values as input. */ + uint32_t edge_detection: 2; /**< Configure the event trigger edge(FE, RE). + Refer @ref XMC_ERU_ETL_EDGE_DETECTION_t for valid values. */ + uint32_t output_trigger_channel: 3; /**< Output channel select(OCS) for ETLx output trigger pulse. + Refer @ref XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL_t for valid values. */ + uint32_t : 1; + uint32_t source: 4; /**< Input path combination along with polarity for event generation. + Refer @ref XMC_ERU_ETL_SOURCE_t for valid values. */ + uint32_t : 20; + }; + }; +} XMC_ERU_ETL_CONFIG_t; + +/** + * \if XMC4 + * Structure for initializing ERUx_OGUy (x = [0..1], y = [0..4]) module. + * \endif + * \if XMC1 + * Structure for initializing ERUx_OGUy (x = [0], y = [0..4]) module. + * \endif + */ +typedef union XMC_ERU_OGU_CONFIG +{ + uint32_t raw; + + struct + { + uint32_t peripheral_trigger: 2; /**< peripheral trigger(ISS) input selection. + Refer @ref XMC_ERU_OGU_PERIPHERAL_TRIGGER_t for valid values. */ + uint32_t enable_pattern_detection: 1; /**< Enable generation of(GEEN) event for pattern detection result change. + This accepts boolean values as input. */ + uint32_t : 1; + uint32_t service_request: 2; /**< Gating(GP) on service request generation for pattern detection result. + Refer @ref XMC_ERU_OGU_SERVICE_REQUEST_t for valid values. */ + uint32_t : 6; + uint32_t pattern_detection_input: 4; /**< Enable input for the pattern detection(IPENx, x = [0 to 3]). + Refer @ref XMC_ERU_OGU_PATTERN_DETECTION_INPUT_t for valid values. + OR combination of the enum items given as input */ + uint32_t : 16; + }; +} XMC_ERU_OGU_CONFIG_t; + +/*Anonymous structure/union guard end */ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif +/********************************************************************************************************************* + * API PROTOTYPES + ********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * + * @return None + * + * \parDescription:
+ * \if XMC4 + * If ERU1 module is selected, it enables clock and releases reset.
+ * \endif + * \if XMC1 + * Abstract API, not mandatory to call.
+ * \endif + * \par + * This API is called by XMC_ERU_ETL_Init() or XMC_ERU_OGU_Init() and therefore no need to call it explicitly during + * initialization sequence. Call this API to enable ERU1 module once again if the module is disabled by calling + * XMC_ERU_Disable(). For ERU0 module clock gating and reset features are not available. + * + * \parNote:
+ * \if XMC4 + * 1. Required to configure ERU1 module again after calling XMC_ERU_Disable(). Since the all the registers are + * reset with default values. + * \endif + * \parRelated APIs:
+ * XMC_ERU_ETL_Init(), XMC_ERU_OGU_Init(), XMC_ERU_Disable(). + */ +void XMC_ERU_Enable(XMC_ERU_t *const eru); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * + * @return None + * + * \parDescription:
+ * \if XMC4 + * Disables clock and releases reset for ERU1 module.
+ * \endif + * \if XMC1 + * Abstract API, not mandatory to call.
+ * \endif + * + * \parNote:
+ * \if XMC4 + * 1. Required to configure ERU1 module again after calling XMC_ERU_ETL_Init() or XMC_ERU_OGU_Init(). Since the all the + * registers are reset with default values. + * \endif + * \parRelated APIs:
+ * XMC_ERU_Enable() + */ +void XMC_ERU_Disable(XMC_ERU_t *const eru); + +/* ERU_ETL APIs */ + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_ETLx(Event trigger logic unit) channel + * Range : [0 to 3] + * @param config pointer to a constant ERU_ETLx configuration data structure. + * Refer data structure XMC_ERU_ETL_CONFIG_t for detail. + * + * @return None + * + * Description:
+ * Initializes the selected ERU_ETLx \a channel with the \a config structure.
+ * + * Invokes XMC_ERU_Enable() to enable \a eru module clock. Then configures + *
    + *
  • Input signal for path A and Path B,
  • + *
  • Trigger pulse generation,
  • + *
  • status flag clear mode,
  • + *
  • Event Trigger edge,
  • + *
  • Output Channel of OGUy(Output gating unit y = [0 to 3]) to be mapped by the trigger pulse,
  • + *
  • input path combination along with polarity for event generation
  • + *
. + */ +void XMC_ERU_ETL_Init(XMC_ERU_t *const eru, const uint8_t channel, const XMC_ERU_ETL_CONFIG_t *const config); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3] + * @param input_a input signal for path A of ERSx(Event request source, x = [0 to 3]) unit.\n + * Refer XMC_ERU_ETL_INPUT_A_t for valid value or xmc1_eru_map.h/xmc4_eru_map.h file where the mapping of + * the input is done based on selected signal.\n + * e.g: ERU0_ETL3_INPUTA_P2_7. + * @param input_b input signal for path B of ERSx(Event request source, x = [0 to 3]) unit.\n + * Refer XMC_ERU_ETL_INPUT_B_t for valid value or xmc1_eru_map.h/xmc4_eru_map.h file where the mapping of + * the input is done based on selected signal.\n + * e.g: ERU0_ETL0_INPUTB_P2_0. + * + * @return None + * + * \parDescription:
+ * Configures the event source for path A and path B in with selected \a input_a and \a input_b respectively.
+ * \par + * These values are set during initialization in XMC_ERU_ETL_Init(). Call this to change the input, as needed later in + * the program. According to the ports/peripheral selected, the event source has to be changed. + */ +void XMC_ERU_ETL_SetInput(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_INPUT_A_t input_a, + const XMC_ERU_ETL_INPUT_B_t input_b); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3] + * @param source input path combination along with polarity for event generation by ERSx(Event request source) unit. + * Refer @ref XMC_ERU_ETL_SOURCE_t enum for valid input values. + * + * @return None + * + * \parDescription:
+ * Select input path combination along with polarity for event generation by setting (SS, NA, NB) bits in + * ERSx(Event request source) unit
+ * \par + * The signal ERSxO is generated from the selection and this is connected to ETLx(Event trigger logic, + * x = [0 to 3]) for further action. These values are set during initialization in XMC_ERU_ETL_Init(). Call this to + * change the source, as needed later in the program. + */ +void XMC_ERU_ETL_SetSource(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_SOURCE_t source); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3] + * @param edge_detection event trigger edge. + * Refer @ref XMC_ERU_ETL_EDGE_DETECTION_t enum for valid values. + * + * @return None + * + * \parDescription:
+ * Configure event trigger edge/s by setting (RE, FE) bits of EXICONx(x = [0 to 3]) register.
+ * \par + * Rising edge, falling edge or either edges can be selected to generate the event.These values are set during + * initialization in XMC_ERU_ETL_Init(). Call this to change the trigger edge, as needed later in the program. + */ +void XMC_ERU_ETL_SetEdgeDetection(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_EDGE_DETECTION_t edge_detection); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3] + * + * @return XMC_ERU_ETL_EDGE_DETECTION_t indicate which egde/s is configured for event generation + * + * \parDescription:
+ * Return event trigger edge/s by reading (RE, FE) bits of EXICONx(x = [0 to 3]) register.
+ * \par + * Rising edge, falling edge or either edges can be selected to generate the event. + * Call this to get the configured trigger edge. */ +XMC_ERU_ETL_EDGE_DETECTION_t XMC_ERU_ETL_GetEdgeDetection(XMC_ERU_t *const eru, + const uint8_t channel); +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3] + * + * @return None + * + * \parDescription:
+ * Set the status flag bit(FL) in EXICONx(x = [0 to 3]).
+ * \par + * The status flag indicates that the configured event has occurred. This status flag is used in Pattern match detection + * by OGUy(Output gating unit, y = [0 to 3]). + * \par + * \parRelated APIs:
+ * XMC_ERU_ETL_ClearStatusFlag(), XMC_ERU_ETL_GetStatusFlag() + */ +__STATIC_INLINE void XMC_ERU_ETL_SetStatusFlag(XMC_ERU_t *const eru, const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_ETL_SetStatusFlag:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_SetStatusFlag:Invalid Channel Number", (channel < 4U)); + + eru->EXICON_b[channel].FL = true; +} + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3] + * + * @return None + * + * \parDescription:
+ * Set the status flag bit(FL) in EXICONx(x = [0 to 3]).
+ * \par + * If auto clear of the status flag is not enabled by detection of the opposite edge of the event edge, this API clears + * the Flag. SO that next event is considered as new event. + * \parRelated APIs:
+ * XMC_ERU_ETL_SetStatusFlag(), XMC_ERU_ETL_GetStatusFlag() + */ +__STATIC_INLINE void XMC_ERU_ETL_ClearStatusFlag(XMC_ERU_t *const eru, const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_ETL_ClearStatusFlag:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_ClearStatusFlag:Invalid Channel Number", (channel < 4U)); + + eru->EXICON_b[channel].FL = false; +} + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3]. + * + * @return uint32_t Current state of the status flag bit(FL). Result is in 32-bit format. + * + * \parDescription:
+ * Returns status flag state of \a channel. + * \par + * The function can typically be used to clear the status flag using software, when auto clear is not enabled. + * + * \parRelated APIs:
+ * XMC_ERU_ETL_SetStatusFlag(), XMC_ERU_ETL_ClearStatusFlag() + */ +__STATIC_INLINE uint32_t XMC_ERU_ETL_GetStatusFlag(XMC_ERU_t *const eru, const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_ETL_GetStatusFlag:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_GetStatusFlag:Invalid Channel Number", (channel < 4U)); + + return (uint32_t)eru->EXICON_b[channel].FL; +} + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3]. + * @param mode Set whether status flag has to be cleared by software or hardware. + * Refer @ref XMC_ERU_ETL_STATUS_FLAG_MODE_t for valid value. + * + * @return None + * + * \parDescription:
+ * Set the mode for status flag mode by setting (LD) bit in EXICONx(x = \a channel) register.
+ * \par + * If SWCTRL is selected, status flag has to be cleared by software. This is typically used for pattern match detection. + * If HWCTRL is selected, status flag is cleared by hardware. If Positive edge is selected as event edge, for negative + * edge status flag is cleared and vice versa.This is typically used for continuous event detection.These values are set + * during initialization in XMC_ERU_ETL_Init(). Call this to change the trigger edge, as needed later in the program. + * + * \parRelated APIs:
+ * XMC_ERU_ETL_ClearStatusFlag(), XMC_ERU_ETL_GetStatusFlag() + */ +void XMC_ERU_ETL_SetStatusFlagMode(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_STATUS_FLAG_MODE_t mode); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3]. + * @param trigger Output Channel of OGUy(Output gating unit y = [0 to 3]) to be mapped by the trigger pulse + * Refer @ref XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL_t for valid value. + * + * @return None + * + * \parDescription:
+ * Configure which Channel of OGUy(Output gating unit y = [0 to 3]) to be mapped by the trigger pulse generated by + * ETLx(Event Trigger Logic, x = \a channel) by setting (OCS and PE) bit fields. + * \par + * The trigger pulse is generated for one clock pulse along with the flag status update. This is typically used to + * trigger the ISR for the external events. The configured OGUy(Output gating unit y = [0 to 3]), generates the event + * based on the trigger pulse.If output trigger pulse generation is disabled by XMC_ERU_ETL_DisableOutputTrigger(), + * XMC_ERU_ETL_EnableOutputTrigger() can called to reconfigure. These values are set during initialization in + * XMC_ERU_ETL_Init(). Call this to change the trigger edge, as needed later in the program. + * + * \parRelated APIs:
+ * XMC_ERU_ETL_DisableOutputTrigger() + */ +void XMC_ERU_ETL_EnableOutputTrigger(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL_t trigger); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3]. + * + * @return None + * + * \parDescription:
+ * Disables the trigger pulse generation by clearing the (PE) of the EXICONx(x = \a channel). + * \par + * Typically this can used when only pattern match is being used for event generation. + * + * \parRelated APIs:
+ * XMC_ERU_ETL_EnableOutputTrigger() + */ +void XMC_ERU_ETL_DisableOutputTrigger(XMC_ERU_t *const eru, const uint8_t channel); + +/* ERU_OGU APIs */ + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_OGUy(Output gating unit) channel + * Range : [0 to 3] + * @param config pointer to constant ERU_OGUy configuration data structure. + * Refer data structure XMC_ERU_OGU_CONFIG_t for detail. + * + * @return None + * + * Description:
+ * Initializes the selected ERU_OGUy \a channel with the \a config structure.
+ * + * Invokes XMC_ERU_Enable() to enable \a eru module clock. Then configures + *
    + *
  • Pattern detection,
  • + *
  • Peripheral trigger input,
  • + *
  • Gating for service request generation
  • + *
. + */ +void XMC_ERU_OGU_Init(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_CONFIG_t *const config); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_OGUy(Output gating unit) channel + * Range : [0 to 3] + * @param input ERU_ETLx(x = [0 to 3]), for pattern match detection. + * Refer @ref XMC_ERU_OGU_PATTERN_DETECTION_INPUT_t for valid values. Logical OR combination of the + * enum items can be passed as the input. + * + * @return None + * + * \parDescription:
+ * Configures ERU_ETLx(x = [0 to 3]) for pattern match detection by setting IPENx(x = [0 to 3]) and GEEN bits. + * \par + * These bits are dedicated to each channel of the ERU_ETLx(x = [0 to 3]). These values are set during initialization in + * XMC_ERU_OGU_Init(). Call this to change the pattern, as needed later in the program. + * + * \parRelated APIs:
+ * XMC_ERU_OGU_DisablePatternDetection(), XMC_ERU_OGU_GetPatternDetectionStatus() + */ +void XMC_ERU_OGU_EnablePatternDetection(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_PATTERN_DETECTION_INPUT_t input); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_OGUy(Output gating unit) channel + * Range : [0 to 3] + * + * @return None + * + * \parDescription:
+ * Disable the pattern detection by clearing (GEEN) bit. + * \par + * Typically XMC_ERU_OGU_DisablePatternDetection is used when events has to be generated peripheral triggers. + * + * \parRelated APIs:
+ * XMC_ERU_OGU_EnablePatternDetection(), XMC_ERU_OGU_GetPatternDetectionStatus() + */ +void XMC_ERU_OGU_DisablePatternDetection(XMC_ERU_t *const eru, const uint8_t channel); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_OGUy(Output gating unit) channel + * Range : [0 to 3] + * + * @return uint32_t returns the pattern match result. Result is in 32-bit format. + * + * \parDescription:
+ * This API returns the pattern match result by reading (PDR) bit. + * \par + * \parRelated APIs:
+ * XMC_ERU_OGU_EnablePatternDetection(), XMC_ERU_OGU_DisablePatternDetection() + */ +__STATIC_INLINE uint32_t XMC_ERU_OGU_GetPatternDetectionStatus(XMC_ERU_t *const eru, + const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_OGU_GetPatternDetectionStatus:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_OGU_GetPatternDetectionStatus:Invalid Channel Number", (channel < 4U)); + + return (uint32_t)eru->EXOCON_b[channel].PDR; +} + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_OGUy(Output gating unit) channel + * Range : [0 to 3] + * @param peripheral_trigger which peripheral trigger signal is used for event generation. + * Refer @ref XMC_ERU_OGU_PERIPHERAL_TRIGGER_t for the valid values, or + xmc1_eru_map.h/xmc4_eru_map.h file where the mapping of the peripheral input is done based + on input. e.g: ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0. + * + * @return None + * + * \parDescription:
+ * Configures peripheral trigger input, by setting (ISS) bit. + * \par + * Based on the peripheral the input signal has to be selected. These values are set during initialization in + * XMC_ERU_OGU_Init(). Call this to change the input, as needed later in the program. + * + * \parRelated APIs:
+ * XMC_ERU_OGU_DisablePeripheralTrigger() + */ +void XMC_ERU_OGU_EnablePeripheralTrigger(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_PERIPHERAL_TRIGGER_t peripheral_trigger); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_OGUy(Output gating unit) channel + * Range : [0 to 3] + * + * @return None + * + * \parDescription:
+ * Disables event generation based on peripheral trigger by clearing (ISS) bit. + * \par + * This is typically used when peripheral trigger is no longer need. After calling + * XMC_ERU_OGU_DisablePeripheralTrigger(), XMC_ERU_OGU_EnablePeripheralTrigger() has to be called to reconfigure the + * signals again. + * + * \parRelated APIs:
+ * XMC_ERU_OGU_EnablePeripheralTrigger() + */ +void XMC_ERU_OGU_DisablePeripheralTrigger(XMC_ERU_t *const eru, + const uint8_t channel); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_OGUy(Output gating unit) channel + * Range : [0 to 3] + * @param mode gating scheme for service request generation. + * Refer @ref XMC_ERU_OGU_SERVICE_REQUEST_t for valid values. + * + * @return None + * + * \parDescription:
+ * Configures the gating scheme for service request generation by setting (GP) bit.
+ * \par + * Typically this function is used to change the service request generation scheme. These values are set during + * initialization in XMC_ERU_OGU_Init(). Call this to change the gating mode, as needed later in the program. + * + */ +void XMC_ERU_OGU_SetServiceRequestMode(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_SERVICE_REQUEST_t mode); + +#ifdef __cplusplus +} +#endif + +/** + * @} (end addtogroup ERU) + */ + +/** + * @} (end addtogroup XMClib) + */ + +#endif /* XMC_ERU_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_flash.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_flash.h new file mode 100644 index 00000000..355dc3b5 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_flash.h @@ -0,0 +1,276 @@ +/** + * @file xmc_flash.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2014-12-10: + * - Initial
+ * 2015-02-20: + * - Updated for Documentation related changes
+ * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * @endcond + * + */ + + +#ifndef XMC_FLASH_H +#define XMC_FLASH_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ + +#include "xmc_common.h" + +#if UC_FAMILY == XMC1 + #include "xmc1_flash.h" +#endif + +#if UC_FAMILY == XMC4 + #include "xmc4_flash.h" +#endif + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup FLASH + * @brief Flash driver for XMC microcontroller family. + * + * Flash is a non volatile memory module used to store instruction code or constant data. + * The flash low level driver provides support to the following functionalities of flash memory.
+ *
    + * \if XMC4 + *
  1. Provides function to program a page. ( XMC_FLASH_ProgramPage() )

  2. + *
  3. Provides functions to support read and write protection. ( XMC_FLASH_InstallProtection(), + * XMC_FLASH_ConfirmProtection(), XMC_FLASH_VerifyReadProtection(), XMC_FLASH_VerifyWriteProtection() )

  4. + *
  5. Provides function to erase sector. ( XMC_FLASH_EraseSector() )

  6. + * \endif + * \if XMC1 + *
  7. Provides functions to program and verify pages. ( XMC_FLASH_ProgramPage(), XMC_FLASH_ProgramPages() + * XMC_FLASH_ProgramVerifyPage() )

  8. + *
  9. Provides functions to write and verify blocks. ( XMC_FLASH_WriteBlocks(), XMC_FLASH_VerifyBlocks() )

  10. + *
  11. Provides functions to read data in terms of word and blocks. ( XMC_FLASH_ReadBlocks(), XMC_FLASH_ReadWord() ) + *

  12. + *
  13. Provides function to erase page. ( XMC_FLASH_ErasePage() )

  14. + * \endif + *
+ * @{ + */ + +/******************************************************************************* + * API PROTOTYPE + *******************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * + * @param None + * + * @return None + * + * \parDescription:
+ * \if XMC1 + * Clears the previous error status by reseting the ECC and VERR error status bits of NVMSTATUS register.\n\n + * Call this API before starting any flash programming / erase related APIs to ensure all previous errors are cleared. + * \endif + * \if XMC4 + * Clears the previous error status by reseting the FSR status register.\n\n Call this API before starting any flash + * programming / erase related APIs to ensure all previous errors are cleared. + * \endif + * + * \parRelated APIs:
+ * None + * + */ +void XMC_FLASH_ClearStatus(void); + +/** + * + * @param None + * + * @return uint32_t Status of the previous flash operation. + * + * \parDescription:
+ * \if XMC1 + * Informs the status of flash by reading the NVMSTATUS register.\n\n It indicates the ECC, VERR(verification error), + * WRPERR (Write protocol error) errors as well as the current flash state. After calling the flash read/write/erase + * operation related APIs, call this API to get the verification status. The return value of this API shall be checked + * against the members of @ref XMC_FLASH_STATUS_t enumeration to get the relevant status. + * \endif + * \if XMC4 + * Informs the status of flash by reading the FSR register.\n\n It indicates the error status such as PFOPER, SQER, + * PROER, PFDBER, ORIER, VER errors as well as the current flash state. After calling the flash read/write/erase + * operation related APIs, call this API to verify flash status. The return value of this API shall be checked against + * the members of @ref XMC_FLASH_STATUS_t enumeration to get the relevant status. + * \endif + * + * \parRelated APIs:
+ * None + * + */ +uint32_t XMC_FLASH_GetStatus(void); + +/** + * + * @param event_msk ORed values of @ref XMC_FLASH_EVENT_t enumeration + * + * @return None + * + * \parDescription:
+ * Enables the particular flash events as specified in the input parameter.\n + * + * \parRelated APIs:
+ * XMC_FLASH_DisableEvent()\n\n\n + * + */ +void XMC_FLASH_EnableEvent(const uint32_t event_msk); + +/** + * + * @param event_msk ORed values of @ref XMC_FLASH_EVENT_t enumeration + * + * @return None + * + * \parDescription:
+ * Disables the particular flash events as specified in the input parameter.\n + * + * \parRelated APIs:
+ * XMC_FLASH_EnableEvent()\n\n\n + * + */ +void XMC_FLASH_DisableEvent(const uint32_t event_msk); + +/** + * + * @param address Pointer to the starting address of flash page from where the programming starts. + * @param data Pointer to the source address where targeted data is located. + * + * @return None + * + * \parDescription:
+ * \if XMC1 + * Programs a single flash page associated with the specified \a address.\n\n XMC1000 Flash can be programmed with one + * page (256 bytes) using this API. It calls the Flash Firmware routine \a XMC1000_NvmProgVerify(unsigned long pageAddr) + * to perform the programming. Refer XMC1000 reference manual of for more details on flash firmware routines + * (Section 25.3). Call XMC_FLASH_GetStatus() API after calling this API, to verify the programming operation. + * \endif + * \if XMC4 + * Programs a single flash page associated with the specified \a address.\n\n XMC4000 flash can be programmed with a + * granularity of 256 bytes page using this API. Before entering into page write process, it clears the error status + * bits inside status register. It starts the write process by issuing the page mode command followed by the load page + * command which loads the targeted \a data blocks into internal assembly buffer. Finally, it issues the write page + * command which programs the \a data into flash. Call XMC_FLASH_GetStatus() API after calling this API, to verify the + * programming operation.\n + * \endif + * + * \parNote:
+ * Flash will be busy state during write is ongoing, hence no operations allowed until it completes. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_FLASH_ProgramPage(uint32_t *address, const uint32_t *data); + +/** + * + * @param address Pointer to the starting address of the page to be erased. + * + * @return None + * + * \parDescription:
+ * \if XMC1 + * Erases a complete sector starting from the \a address specified.\n\n XMC1000 Flash can be erased with granularity + * of one page = 16 blocks of 16 Bytes = 256 Bytes using this API. It internally calls XMC_FLASH_ErasePages API 16 + * times starting from the first page of the sector.. Call XMC_FLASH_GetStatus() API after calling this API, + * to verify the erase operation.\n + * \endif + * + * \if XMC4 + * Erases a sector associated with the specified \a address.\n\n Before erase, it clears the error status bits inside + * FSR status register. Issues the erase sector command sequence with the specified starting \a address to start flash + * erase process. Call XMC_FLASH_GetStatus() API after calling this API, to verify the erase operation.\n + * \endif + * \if XMC1 + * \parRelated APIs:
+ * XMC_FLASH_ErasePages() \n\n\n + * \endif + * \if XMC4 + * \parRelated APIs:
+ * None + * \endif + */ +void XMC_FLASH_EraseSector(uint32_t *address); + +/** + * + * @param None + * + * @return true if flash is in busy state else returns \a false. + * + * \parDescription:
+ * Checks whether flash is in busy state or not.\n\n It is checked by calling the XMC_FLASH_GetStatus() API internally. + * Refer XMC_FLASH_GetStatus() for more details.\n + * + * \parRelated APIs:
+ * XMC_FLASH_GetStatus()\n\n\n + * + */ +__STATIC_INLINE bool XMC_FLASH_IsBusy(void) +{ + return (bool)(XMC_FLASH_GetStatus() & XMC_FLASH_STATUS_BUSY); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_gpio.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_gpio.h new file mode 100644 index 00000000..671cdc0b --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_gpio.h @@ -0,0 +1,478 @@ +/** + * @file xmc_gpio.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * - Documentation improved
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * @endcond + * + */ + +#ifndef XMC_GPIO_H +#define XMC_GPIO_H + +/********************************************************************************************************************** + * HEADER FILES + *********************************************************************************************************************/ + +#include "xmc_common.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup GPIO + * @brief General Purpose Input Output (GPIO) driver for the XMC microcontroller family. + * + * GPIO driver provide a generic and very flexible software interface for all standard digital I/O port pins. + * Each port slice has individual interfaces for the operation as General Purpose I/O and it further provides the + * connectivity to the on-chip periphery and the control for the pad characteristics. + * + * The driver is divided into Input and Output mode. + * + * Input mode features: + * -# Configuration structure XMC_GPIO_CONFIG_t and initialization function XMC_GPIO_Init() + * -# Allows the selection of weak pull-up or pull-down device. Configuration structure XMC_GPIO_MODE_t and function XMC_GPIO_SetMode() + * \if XMC1 + * -# Allows the selection of input hysteresis. XMC_GPIO_SetInputHysteresis() + * \endif + * + * + * Output mode features: + * -# Allows the selection of push pull/open drain and Alternate output. Configuration structure XMC_GPIO_MODE_t and function XMC_GPIO_SetMode() + * \if XMC4 + * -# Allows the selection of pad driver strength. Configuration structure XMC_GPIO_OUTPUT_STRENGTH_t and function XMC_GPIO_SetOutputStrength() + * \endif + * + * -# Allows the selection of initial output level. Configuration structure XMC_GPIO_OUTPUT_LEVEL_t and function XMC_GPIO_SetOutputLevel() + * + *@{ + */ + +/********************************************************************************************************************** + * MACROS + *********************************************************************************************************************/ + +#define PORT_IOCR_PC_Pos PORT0_IOCR0_PC0_Pos +#define PORT_IOCR_PC_Msk PORT0_IOCR0_PC0_Msk + +#define PORT_IOCR_PC_Size (8U) + + +#define XMC_GPIO_CHECK_OUTPUT_LEVEL(level) ((level == XMC_GPIO_OUTPUT_LEVEL_LOW) || \ + (level == XMC_GPIO_OUTPUT_LEVEL_HIGH)) + +#define XMC_GPIO_CHECK_HWCTRL(hwctrl) ((hwctrl == XMC_GPIO_HWCTRL_DISABLED) || \ + (hwctrl == XMC_GPIO_HWCTRL_PERIPHERAL1) || \ + (hwctrl == XMC_GPIO_HWCTRL_PERIPHERAL2)) + +/********************************************************************************************************************** + * ENUMS + *********************************************************************************************************************/ + + +/** + * Defines output level of a pin. Use type \a XMC_GPIO_OUTPUT_LEVEL_t for this enum. + */ +typedef enum XMC_GPIO_OUTPUT_LEVEL +{ + XMC_GPIO_OUTPUT_LEVEL_LOW = 0x10000U, /**< Reset bit */ + XMC_GPIO_OUTPUT_LEVEL_HIGH = 0x1U, /**< Set bit */ +} XMC_GPIO_OUTPUT_LEVEL_t; + +/** + * Defines direct hardware control characteristics of the pin . Use type \a XMC_GPIO_HWCTRL_t for this enum. + */ +typedef enum XMC_GPIO_HWCTRL +{ + XMC_GPIO_HWCTRL_DISABLED = 0x0U, /**< Software control only */ + XMC_GPIO_HWCTRL_PERIPHERAL1 = 0x1U, /**< HWI0/HWO0 control path can override the software configuration */ + XMC_GPIO_HWCTRL_PERIPHERAL2 = 0x2U /**< HWI1/HWO1 control path can override the software configuration */ +} XMC_GPIO_HWCTRL_t; + +/********************************************************************************************************************** + * DEVICE FAMILY EXTENSIONS + *********************************************************************************************************************/ + + #if UC_FAMILY == XMC1 +#include "xmc1_gpio.h" +#elif UC_FAMILY == XMC4 +#include "xmc4_gpio.h" +#else +#error "xmc_gpio.h: family device not supported" +#endif + +/********************************************************************************************************************** + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @param port Constant pointer pointing to GPIO port, to access port registers like Pn_OUT,Pn_OMR,Pn_IOCR etc. + * @param pin Port pin number. + * @param config GPIO configuration data structure. Refer data structure @ref XMC_GPIO_CONFIG_t for details. + * + * @return None + * + * \parDescription:
+ * \if XMC1 + * Initializes input / output mode settings like, pull up / pull down devices,hysteresis, push pull /open drain. + * Also configures alternate function outputs and clears hardware port control for a selected \a port \a and \a pin. + * \a config provides selected I/O settings. It configures hardware registers Pn_IOCR,Pn_OUT, Pn_OMR,Pn_PDISC and Pn_PHCR. + * \endif + * \if XMC4 + * Initializes input / output mode settings like, pull up / pull down devices,push pull /open drain, and pad driver mode. + * Also configures alternate function outputs and clears hardware port control for selected \a port and \a pin . + * It configures hardware registers Pn_IOCR,Pn_OUT,Pn_OMR,Pn_PDISC and Pn_PDR.\n + * \endif + * + * \parRelated APIs:
+ * None + * + * \parNote:
+ * This API is called in definition of DAVE_init by code generation and therefore should not be explicitly called + * for the normal operation. Use other APIs only after DAVE_init is called successfully (returns DAVE_STATUS_SUCCESS). + * + * + */ + + +void XMC_GPIO_Init(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_CONFIG_t *const config); + +/** + * + * @param port Constant pointer pointing to GPIO port, to access hardware register Pn_IOCR. + * @param pin Port pin number. + * @param mode input / output functionality selection. Refer @ref XMC_GPIO_MODE_t for valid values. + * + * @return None + * + * \parDescription:
+ * Sets digital input and output driver functionality and characteristics of a GPIO port pin. It configures hardware + * registers Pn_IOCR. \a mode is initially configured during initialization in XMC_GPIO_Init(). Call this API to alter + * the port direction functionality as needed later in the program. + * + * \parRelated APIs:
+ * None + * + */ + +void XMC_GPIO_SetMode(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_MODE_t mode); + + +/** + * + * @param port Constant pointer pointing to GPIO port, to access hardware register Pn_OMR. + * @param pin Port pin number. + * @param level output level selection. Refer @ref XMC_GPIO_OUTPUT_LEVEL_t for valid values. + * + * @return None + * + * \parDescription:
+ * Set port pin output level to high or low.It configures hardware registers Pn_OMR.\a level is initially + * configured during initialization in XMC_GPIO_Init(). Call this API to alter output level as needed later in the program. + * + * \parRelated APIs:
+ * XMC_GPIO_SetOutputHigh(), XMC_GPIO_SetOutputLow(). + * + * \parNote:
+ * Prior to this api, user has to configure port pin to output mode using XMC_GPIO_SetMode(). + * + */ + + +__STATIC_INLINE void XMC_GPIO_SetOutputLevel(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_OUTPUT_LEVEL_t level) +{ + XMC_ASSERT("XMC_GPIO_SetOutputLevel: Invalid port", XMC_GPIO_CHECK_OUTPUT_PORT(port)); + XMC_ASSERT("XMC_GPIO_SetOutputLevel: Invalid output level", XMC_GPIO_CHECK_OUTPUT_LEVEL(level)); + + port->OMR = (uint32_t)level << pin; +} + + +/** + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_OMR. + * @param pin Port pin number. + * + * @return None + * + * \parDescription:
+ * Sets port pin output to high. It configures hardware registers Pn_OMR. + * + * \parRelated APIs:
+ * XMC_GPIO_SetOutputLow() + * + * \parNote:
+ * Prior to this api, user has to configure port pin to output mode using XMC_GPIO_SetMode().\n + * Register Pn_OMR is virtual and does not contain any flip-flop. A read action delivers the value of 0. + * + */ + +__STATIC_INLINE void XMC_GPIO_SetOutputHigh(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_SetOutputHigh: Invalid port", XMC_GPIO_CHECK_OUTPUT_PORT(port)); + + port->OMR = (uint32_t)0x1U << pin; +} + +/** + * + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_OMR. + * @param pin port pin number. + * + * @return None + * + *\parDescription:
+ * Sets port pin output to low. It configures hardware registers Pn_OMR.\n + * + * \parRelated APIs:
> + * XMC_GPIO_SetOutputHigh() + * + *\parNote:
+ * Prior to this api, user has to configure port pin to output mode using XMC_GPIO_SetMode(). + * Register Pn_OMR is virtual and does not contain any flip-flop. A read action delivers the value of 0.\n + * + */ + +__STATIC_INLINE void XMC_GPIO_SetOutputLow(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_SetOutputLow: Invalid port", XMC_GPIO_CHECK_OUTPUT_PORT(port)); + + port->OMR = 0x10000U << pin; +} + +/** + * + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_OMR. + * @param pin port pin number. + * + * @return None + * + * \parDescription:
+ * Configures port pin output to Toggle. It configures hardware registers Pn_OMR. + * + * \parRelated APIs:
+ * XMC_GPIO_SetOutputHigh(), XMC_GPIO_SetOutputLow(). + * + * \parNote:
+ * Prior to this api, user has to configure port pin to output mode using XMC_GPIO_SetMode(). Register Pn_OMR is virtual + * and does not contain any flip-flop. A read action delivers the value of 0. + * + */ + +__STATIC_INLINE void XMC_GPIO_ToggleOutput(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_ToggleOutput: Invalid port", XMC_GPIO_CHECK_OUTPUT_PORT(port)); + + port->OMR = 0x10001U << pin; +} + +/** + * + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_IN. + * @param pin Port pin number. + * + * @return uint32_t pin logic level status. + * + *\parDescription:
+ * Reads the Pn_IN register and returns the current logical value at the GPIO pin. + * + * \parRelated APIs:
+ * None + * + * \parNote:
+ * Prior to this api, user has to configure port pin to input mode using XMC_GPIO_SetMode(). + * + */ + +__STATIC_INLINE uint32_t XMC_GPIO_GetInput(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_GetInput: Invalid port", XMC_GPIO_CHECK_PORT(port)); + + return (((port->IN) >> pin) & 0x1U); +} + +/** + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_PPS. + * @param pin port pin number. + * + * @return None + * + * \parDescription:
+ * Enables pin power save mode and configures Pn_PPS register.This configuration is useful when the controller enters + * Deep Sleep mode.Port pin enabled with power save mode option are set to a defined state and the input Schmitt-Trigger + * as well as the output driver stage are switched off. By default port pin does not react to power save mode request. + * + * \parRelated APIs:
+ * XMC_GPIO_DisablePowerSaveMode() + * + * Note:
+ * Do not enable the Pin Power Save function for pins configured for Hardware Control (Pn_HWSEL.HWx != 00B). Doing so + * may result in an undefined behavior of the pin when the device enters the Deep Sleep state. + * + */ + + +__STATIC_INLINE void XMC_GPIO_EnablePowerSaveMode(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_EnablePowerSaveMode: Invalid port", XMC_GPIO_CHECK_PORT(port)); + + port->PPS |= (uint32_t)0x1U << pin; +} + + +/** + * + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_PPS. + * @param pin port pin number. + * + * @return None + * + * \parDescription:
+ * Disables pin power save mode and configures Pn_PPS register.This configuration is useful when the controller enters + * Deep Sleep mode. This configuration enables input Schmitt-Trigger and output driver stage(if pin is enabled power + * save mode previously). By default port \a pin does not react to power save mode request. + * + * \parRelated APIs:
+ * XMC_GPIO_EnablePowerSaveMode() + * + *\parNote:
+ * Do not enable the Pin Power Save function for pins configured for Hardware Control (Pn_HWSEL.HWx != 00B). Doing so + * may result in an undefined behavior of the pin when the device enters the Deep Sleep state. + * + */ + +__STATIC_INLINE void XMC_GPIO_DisablePowerSaveMode(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_DisablePowerSaveMode: Invalid port", XMC_GPIO_CHECK_PORT(port)); + + port->PPS &= ~(uint32_t)((uint32_t)0x1U << pin); +} + + +/** + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_HWSEL. + * @param pin port pin number. + * @param hwctrl direct hardware control selection. Refer @ref XMC_GPIO_HWCTRL_t for valid values. + * + * @return None + * + * \parDescription:
+ * Selects direct hard ware control and configures Pn_HWSEL register.This configuration is useful for the port pins + * overlaid with peripheral functions for which the connected peripheral needs hardware control. + * + * \parRelated APIs:
+ * None + * + *\parNote:
+ * Do not enable the Pin Power Save function for pins configured for Hardware Control (Pn_HWSEL.HWx != 00B). + * Doing so may result in an undefined behavior of the pin when the device enters the Deep Sleep state. + * + */ + +void XMC_GPIO_SetHardwareControl(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_HWCTRL_t hwctrl); + + +/** + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_PDISC. + * @param pin port pin number. + * + * @return None + * + * \parRelated APIs:
+ * None + * + * \parDescription:
+ * Enable digital input path for analog pins and configures Pn_PDISC register.This configuration is applicable only for + * analog port pins. + * + */ +__STATIC_INLINE void XMC_GPIO_EnableDigitalInput(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_EnableDigitalInput: Invalid analog port", XMC_GPIO_CHECK_ANALOG_PORT(port)); + + port->PDISC &= ~(uint32_t)((uint32_t)0x1U << pin); +} + + +/** + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_PDISC. + * @param pin port pin number. + * + * @return None + * + * \parRelated APIs:
+ * None + * + * \parDescription:
+ * Disable digital input path for analog pins and configures Pn_PDISC register.This configuration is applicable only + * for analog port pins. + * + */ + +__STATIC_INLINE void XMC_GPIO_DisableDigitalInput(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_EnableDigitalInput: Invalid analog port", XMC_GPIO_CHECK_ANALOG_PORT(port)); + + port->PDISC |= (uint32_t)0x1U << pin; +} + +#ifdef __cplusplus +} +#endif + +/** + * @} (end addtogroup GPIO) + */ + +/** + * @} (end addtogroup XMClib) + */ + +#endif /* XMC_GPIO_H */ + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_i2c.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_i2c.h new file mode 100644 index 00000000..78ffb946 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_i2c.h @@ -0,0 +1,782 @@ +/** + * @file xmc_i2c.h + * @date 2016-05-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-05-20: + * - Description updated
+ * - Added XMC_I2C_CH_TriggerServiceRequest() and XMC_I2C_CH_SelectInterruptNodePointer()
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-08-27: + * - Added APIs for external input for BRG configuration:XMC_I2C_CH_ConfigExternalInputSignalToBRG()
+ * + * 2015-09-01: + * - Added APIs for enabling or disabling the ACK response to a 0x00 slave address: XMC_I2C_CH_EnableSlaveAcknowledgeTo00() and + * XMC_I2C_CH_DisableSlaveAcknowledgeTo00().
+ * - Modified XMC_I2C_CH_SetInputSource() API for avoiding complete DXCR register overwriting.
+ * - Modified XMC_I2C_CH_EVENT_t enum for supporting XMC_I2C_CH_EnableEvent() and XMC_I2C_CH_DisableEvent() + * for supporting multiple events configuration
+ * + * 2015-10-02: + * - Fix 10bit addressing + * + * 2015-10-07: + * - Fix register access in XMC_I2C_CH_EnableSlaveAcknowledgeTo00() and XMC_I2C_CH_DisableSlaveAcknowledgeTo00() APIs. + * - Naming of APIs modified: from XMC_I2C_CH_EnableSlaveAcknowledgeTo00() to XMC_I2C_CH_EnableAcknowledgeAddress0() + * and from XMC_I2C_CH_DisableSlaveAcknowledgeTo00() to XMC_I2C_CH_DisableAcknowledgeAddress0(). + * + * 2016-05-20: + * - Added XMC_I2C_CH_EnableDataTransmission() and XMC_I2C_CH_DisableDataTransmission() + * + * 2016-08-17: + * - Improved documentation of slave address passing + * + * @endcond + * + */ + +#ifndef XMC_I2C_H +#define XMC_I2C_H + +/******************************************************************************* + * HEADER FILES + *******************************************************************************/ + +#include "xmc_usic.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup I2C + * @brief Inter Integrated Circuit(IIC) driver for the XMC microcontroller family. + * + * USIC IIC Features:
+ * * Two-wire interface, with one line for shift clock transfer and synchronization (shift clock SCL), the other one for the data transfer (shift data SDA)
+ * * Communication in standard mode (100 kBit/s) or in fast mode (up to 400 kBit/s)
+ * * Support of 7-bit addressing, as well as 10-bit addressing
+ * * Master mode operation, where the IIC controls the bus transactions and provides the clock signal.
+ * * Slave mode operation, where an external master controls the bus transactions and provides the clock signal.
+ * * Multi-master mode operation, where several masters can be connected to the bus and bus arbitration can take place, i.e. the IIC module can be master or slave.
+ The master/slave operation of an IIC bus participant can change from frame to frame.
+ * * Efficient frame handling (low software effort), also allowing DMA transfers
+ * * Powerful interrupt handling due to multitude of indication flags
+ * @{ + */ + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +#if defined(USIC0) +#define XMC_I2C0_CH0 XMC_USIC0_CH0 /**< USIC0 channel 0 base address */ +#define XMC_I2C0_CH1 XMC_USIC0_CH1 /**< USIC0 channel 1 base address */ +#endif + +#if defined(USIC1) +#define XMC_I2C1_CH0 XMC_USIC1_CH0 /**< USIC1 channel 0 base address */ +#define XMC_I2C1_CH1 XMC_USIC1_CH1 /**< USIC1 channel 1 base address */ +#endif + +#if defined(USIC2) +#define XMC_I2C2_CH0 XMC_USIC2_CH0 /**< USIC2 channel 0 base address */ +#define XMC_I2C2_CH1 XMC_USIC2_CH1 /**< USIC2 channel 1 base address */ +#endif + +#define XMC_I2C_10BIT_ADDR_GROUP (0x7800U) /**< Value to verify the address is 10-bit or not */ + +/******************************************************************************* + * ENUMS + *******************************************************************************/ + +/** + * @brief I2C Status + */ +typedef enum XMC_I2C_CH_STATUS +{ + XMC_I2C_CH_STATUS_OK, /**< Status OK */ + XMC_I2C_CH_STATUS_ERROR, /**< Status ERROR */ + XMC_I2C_CH_STATUS_BUSY /**< Status BUSY */ +} XMC_I2C_CH_STATUS_t; + +/** + * @brief I2C status + */ +typedef enum XMC_I2C_CH_STATUS_FLAG +{ + XMC_I2C_CH_STATUS_FLAG_SLAVE_SELECT = USIC_CH_PSR_IICMode_SLSEL_Msk, /**< Slave select status */ + XMC_I2C_CH_STATUS_FLAG_WRONG_TDF_CODE_FOUND = USIC_CH_PSR_IICMode_WTDF_Msk, /**< Wrong TDF status */ + XMC_I2C_CH_STATUS_FLAG_START_CONDITION_RECEIVED = USIC_CH_PSR_IICMode_SCR_Msk, /**< Start condition received status */ + XMC_I2C_CH_STATUS_FLAG_REPEATED_START_CONDITION_RECEIVED = USIC_CH_PSR_IICMode_RSCR_Msk, /**< Repeated start condition received status */ + XMC_I2C_CH_STATUS_FLAG_STOP_CONDITION_RECEIVED = USIC_CH_PSR_IICMode_PCR_Msk, /**< Stop condition received status */ + XMC_I2C_CH_STATUS_FLAG_NACK_RECEIVED = USIC_CH_PSR_IICMode_NACK_Msk, /**< NACK received status */ + XMC_I2C_CH_STATUS_FLAG_ARBITRATION_LOST = USIC_CH_PSR_IICMode_ARL_Msk, /**< Arbitration lost status */ + XMC_I2C_CH_STATUS_FLAG_SLAVE_READ_REQUESTED = USIC_CH_PSR_IICMode_SRR_Msk, /**< Slave read requested status */ + XMC_I2C_CH_STATUS_FLAG_ERROR = USIC_CH_PSR_IICMode_ERR_Msk, /**< Error status */ + XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED = USIC_CH_PSR_IICMode_ACK_Msk, /**< ACK received status */ + XMC_I2C_CH_STATUS_FLAG_RECEIVER_START_INDICATION = USIC_CH_PSR_IICMode_RSIF_Msk, /**< Receive start indication status */ + XMC_I2C_CH_STATUS_FLAG_DATA_LOST_INDICATION = USIC_CH_PSR_IICMode_DLIF_Msk, /**< Data lost indication status */ + XMC_I2C_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION = USIC_CH_PSR_IICMode_TSIF_Msk, /**< Transmit shift indication status */ + XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION = USIC_CH_PSR_IICMode_TBIF_Msk, /**< Transmit buffer indication status */ + XMC_I2C_CH_STATUS_FLAG_RECEIVE_INDICATION = USIC_CH_PSR_IICMode_RIF_Msk, /**< Receive indication status */ + XMC_I2C_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION = USIC_CH_PSR_IICMode_AIF_Msk, /**< Alternate receive indication status */ + XMC_I2C_CH_STATUS_FLAG_BAUD_RATE_GENERATOR_INDICATION = USIC_CH_PSR_IICMode_BRGIF_Msk /**< Baud rate generator indication status */ +} XMC_I2C_CH_STATUS_FLAG_t; + +/** + * @brief I2C receiver status. The received data byte is available at the bit + * positions RBUF[7:0], whereas the additional information is monitored at the bit positions +* RBUF[12:8]. + */ +typedef enum XMC_I2C_CH_RECEIVER_STATUS_FLAG +{ + XMC_I2C_CH_RECEIVER_STATUS_FLAG_ACK = 0x1U, /**< Bit 8: Value of Received Acknowledgement bit */ + XMC_I2C_CH_RECEIVER_STATUS_FLAG_FIN = 0x2U, /**< Bit 9: A 1 at this bit position indicates that after a (repeated) start condition + followed by the address reception the first data byte of a new frame has + been received. A 0 at this bit position indicates further data bytes */ + XMC_I2C_CH_RECEIVER_STATUS_FLAG_MODE = 0x4U, /**< Bit 10: A 0 at this bit position indicates that the data byte has been received + when the device has been in slave mode, whereas a 1 indicates a reception in master mode */ + XMC_I2C_CH_RECEIVER_STATUS_FLAG_ERR = 0x8U, /**< Bit 11: A 1 at this bit position indicates an incomplete/erroneous + data byte in the receive buffer */ + XMC_I2C_CH_RECEIVER_STATUS_FLAG_ADR = 0x10 /**< Bit 12: A 0 at this bit position indicates that the programmed address + has been received. A 1 indicates a general call address. */ +} XMC_I2C_CH_RECEIVER_STATUS_FLAG_t; + +/** + * @brief I2C commands + */ +typedef enum XMC_I2C_CH_CMD +{ + XMC_I2C_CH_CMD_WRITE, /**< I2C Command Write */ + XMC_I2C_CH_CMD_READ /**< I2C Command Read */ +} XMC_I2C_CH_CMD_t; + +/** + * @brief I2C events + */ +typedef enum XMC_I2C_CH_EVENT +{ + XMC_I2C_CH_EVENT_RECEIVE_START = USIC_CH_CCR_RSIEN_Msk, /**< Receive start event */ + XMC_I2C_CH_EVENT_DATA_LOST = USIC_CH_CCR_DLIEN_Msk, /**< Data lost event */ + XMC_I2C_CH_EVENT_TRANSMIT_SHIFT = USIC_CH_CCR_TSIEN_Msk, /**< Transmit shift event */ + XMC_I2C_CH_EVENT_TRANSMIT_BUFFER = USIC_CH_CCR_TBIEN_Msk, /**< Transmit buffer event */ + XMC_I2C_CH_EVENT_STANDARD_RECEIVE = USIC_CH_CCR_RIEN_Msk, /**< Receive event */ + XMC_I2C_CH_EVENT_ALTERNATIVE_RECEIVE = USIC_CH_CCR_AIEN_Msk, /**< Alternate receive event */ + XMC_I2C_CH_EVENT_BAUD_RATE_GENERATOR = USIC_CH_CCR_BRGIEN_Msk, /**< Baudrate generator event */ + + XMC_I2C_CH_EVENT_START_CONDITION_RECEIVED = USIC_CH_PCR_IICMode_SCRIEN_Msk, /**< Start condition received event */ + XMC_I2C_CH_EVENT_REPEATED_START_CONDITION_RECEIVED = USIC_CH_PCR_IICMode_RSCRIEN_Msk, /**< Repeated start condition received event */ + XMC_I2C_CH_EVENT_STOP_CONDITION_RECEIVED = USIC_CH_PCR_IICMode_PCRIEN_Msk, /**< Stop condition received event */ + XMC_I2C_CH_EVENT_NACK = USIC_CH_PCR_IICMode_NACKIEN_Msk, /**< NACK received event */ + XMC_I2C_CH_EVENT_ARBITRATION_LOST = USIC_CH_PCR_IICMode_ARLIEN_Msk, /**< Arbitration lost event */ + XMC_I2C_CH_EVENT_SLAVE_READ_REQUEST = USIC_CH_PCR_IICMode_SRRIEN_Msk, /**< Slave read request event */ + XMC_I2C_CH_EVENT_ERROR = USIC_CH_PCR_IICMode_ERRIEN_Msk, /**< Error condition event */ + XMC_I2C_CH_EVENT_ACK = USIC_CH_PCR_IICMode_ACKIEN_Msk /**< ACK received event */ +} XMC_I2C_CH_EVENT_t; + +/** + * @brief I2C input stage selection + */ +typedef enum XMC_I2C_CH_INPUT +{ + XMC_I2C_CH_INPUT_SDA = 0U, /**< selection of sda input stage */ +#if UC_FAMILY == XMC1 + XMC_I2C_CH_INPUT_SDA1 = 3U, + XMC_I2C_CH_INPUT_SDA2 = 5U, +#endif + XMC_I2C_CH_INPUT_SCL = 1U, /**< selection of scl input stage */ +#if UC_FAMILY == XMC1 + XMC_I2C_CH_INPUT_SCL1 = 4U +#endif +} XMC_I2C_CH_INPUT_t; + +/** + * I2C channel interrupt node pointers + */ +typedef enum XMC_I2C_CH_INTERRUPT_NODE_POINTER +{ + XMC_I2C_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, /**< Node pointer for transmit shift interrupt */ + XMC_I2C_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER, /**< Node pointer for transmit buffer interrupt */ + XMC_I2C_CH_INTERRUPT_NODE_POINTER_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_RECEIVE, /**< Node pointer for receive interrupt */ + XMC_I2C_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE, /**< Node pointer for alternate receive interrupt */ + XMC_I2C_CH_INTERRUPT_NODE_POINTER_PROTOCOL = XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL /**< Node pointer for protocol related interrupts */ +} XMC_I2C_CH_INTERRUPT_NODE_POINTER_t; + +/******************************************************************************* + * DATA STRUCTURES + *******************************************************************************/ +/** + * @brief I2C_CH configuration structure + */ +typedef struct XMC_I2C_CH_CONFIG +{ + uint32_t baudrate; /**< baud rate configuration upto max of 400KHz */ + uint16_t address; /**< slave address + A 7-bit address needs to be left shifted it by 1. + A 10-bit address needs to be ORed with XMC_I2C_10BIT_ADDR_GROUP. */ +} XMC_I2C_CH_CONFIG_t; + +/******************************************************************************* + * API PROTOTYPES + *******************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param config Constant pointer to I2C channel config structure of type @ref XMC_I2C_CH_CONFIG_t + * + * @return None
+ * + * \parDescription:
+ * Initializes the I2C \a channel.
+ * + * \par + * Configures the data format in SCTR register. Sets the slave address, baud rate. Enables transmit data valid, clears status flags + * and disables parity generation.
+ * + * \parRelated APIs:
+ * XMC_USIC_CH_Enable()\n\n + */ + +void XMC_I2C_CH_Init(XMC_USIC_CH_t *const channel, const XMC_I2C_CH_CONFIG_t *const config); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param rate baud rate of I2C channel + * + * @return None
+ * + * \parDescription:
+ * Sets the rate of I2C \a channel. + * + * \parNote:
+ * Standard over sampling is considered if rate <= 100KHz and fast over sampling is considered if rate > 100KHz.
+ * + * \parRelated APIs:
+ * XMC_USIC_CH_SetBaudrate()\n\n + */ +XMC_I2C_CH_STATUS_t XMC_I2C_CH_SetBaudrate(XMC_USIC_CH_t *const channel, const uint32_t rate); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * + * @return None
+ * + * \parDescription:
+ * Starts the I2C \a channel. + * + * \par + * Sets the USIC input operation mode to I2C mode using CCR register. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetMode()\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_Start(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetMode(channel, XMC_USIC_CH_OPERATING_MODE_I2C); +} + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * + * @return @ref XMC_I2C_CH_STATUS_t
+ * + * \parDescription:
+ * Stops the I2C \a channel.
+ * + * \par + * Sets the USIC input operation to IDLE mode using CCR register. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetMode()\n\n + */ +XMC_I2C_CH_STATUS_t XMC_I2C_CH_Stop(XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param service_request Service request number in the range of 0-5 + * @return None
+ * + * \parDescription:
+ * Sets the interrupt node for protocol interrupt.
+ * + * \par + * To generate interrupt for an event, node pointer should be configured with service request number(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so.
+ * + * \parNote:
+ * NVIC node should be separately enabled to generate the interrupt. After setting the node pointer, desired event must be enabled. + * + * \parRelated APIs:
+ * XMC_I2C_CH_EnableEvent(), NVIC_SetPriority(), NVIC_EnableIRQ(), XMC_I2C_CH_SetInputSource()
+ */ +__STATIC_INLINE void XMC_I2C_CH_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const uint8_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL, service_request); +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2C0_CH0, @ref XMC_I2C0_CH1,@ref XMC_I2C1_CH0,@ref XMC_I2C1_CH1,@ref XMC_I2C2_CH0,@ref XMC_I2C2_CH1 @note Availability of I2C1 and I2C2 depends on device selection + * @param interrupt_node Interrupt node pointer to be configured. \n + * \b Range: @ref XMC_I2C_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, + * @ref XMC_I2C_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER etc. + * @param service_request Service request number.\n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets the interrupt node for USIC channel events. \n\n + * For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so.
+ * Note: NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_I2C_CH_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_SelectInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_I2C_CH_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, (XMC_USIC_CH_INTERRUPT_NODE_POINTER_t)interrupt_node, + (uint32_t)service_request); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2C0_CH0, @ref XMC_I2C0_CH1,@ref XMC_I2C1_CH0,@ref XMC_I2C1_CH1,@ref XMC_I2C2_CH0,@ref XMC_I2C2_CH1 @note Availability of I2C1 and I2C2 depends on device selection + * @param service_request_line service request number of the event to be triggered. \n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Trigger a I2C interrupt service request.\n\n + * When the I2C service request is triggered, the NVIC interrupt associated with it will be + * generated if enabled. + * + * \parRelated APIs:
+ * XMC_I2C_CH_SelectInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_TriggerServiceRequest(XMC_USIC_CH_t *const channel, const uint32_t service_request_line) +{ + XMC_USIC_CH_TriggerServiceRequest(channel, (uint32_t)service_request_line); +} + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param input I2C channel input stage of type @ref XMC_I2C_CH_INPUT_t + * @param source Input source select for the input stage(0->DX0A, 1->DX1A, .. 7->DX7G) + * @return None
+ * + * \parDescription:
+ * Sets the input source for I2C \a channel.
+ * Defines the input stage for the corresponding input line. + * + * @note After configuring the input source for corresponding channel, interrupt node pointer is set. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetInptSource(), XMC_USIC_CH_SetInterruptNodePointer() + * + */ +__STATIC_INLINE void XMC_I2C_CH_SetInputSource(XMC_USIC_CH_t *const channel, const XMC_I2C_CH_INPUT_t input, const uint8_t source) +{ + channel->DXCR[input] = (uint32_t)(channel->DXCR[input] & (~USIC_CH_DX0CR_INSW_Msk)) | USIC_CH_DX0CR_DSEN_Msk; + XMC_USIC_CH_SetInputSource(channel, (XMC_USIC_CH_INPUT_t)input, source); +} + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param address I2C slave address + * @return None
+ * + * \parDescription:
+ * Sets the I2C \a channel slave address.
+ * + * \par + * Address is set in PCR_IICMode register by checking if it is in 10-bit address group or 7-bit address group. + * (If first five bits of address are assigned with 0xF0, then address mode is 10-bit mode otherwise it is 7-bit mode)\n + * @note A 7-bit address should include an additional bit at the LSB for read/write indication. For example, address 0x05 should + * be provided as 0x0a. A 10-bit address should be provided with the identifier 0b11110xx at the most significant bits. For example, + * address 0x305 should be provided as 0x7b05(bitwise OR with 0x7800). + * + * \parRelated APIs:
+ * XMC_I2C_CH_GetSlaveAddress()\n\n + */ +void XMC_I2C_CH_SetSlaveAddress(XMC_USIC_CH_t *const channel, const uint16_t address); + +/** + * @param channel Constant pointer to USIC channel handler of type @ref XMC_USIC_CH_t + * @return uint16_t Slave address
+ * + * \parDescription:
+ * Gets the I2C \a channel slave address.
+ * + * \par + * Returns the address using PCR_IICMode register by checking if it is in 10-bit address group or 7-bit address group.
+ * (If first five bits of address are assigned with 0xF0, then address mode is considered as 10-bit mode otherwise it is 7-bit mode)\n + * @note A 7-bit address will include an additional bit at the LSB. For example, address 0x05 will be returned as 0x0a. + * 10-bit address will not include the 10-bit address identifier 0b11110xx at the most signifcant bits. + * + * \parRelated APIs:
+ * XMC_I2C_CH_SetSlaveAddress()\n\n + */ +uint16_t XMC_I2C_CH_GetSlaveAddress(const XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param addr I2C master address + * @param command read/write command + * @return None
+ * + * \parDescription:
+ * Starts the I2C master \a channel.
+ * + * \par + * Sends the Start condition with read/write command by updating IN/TBUF register based on FIFO/non-FIFO modes.\n + * @note Address(addr) should reserve an additional bit at the LSB for read/write indication. For example, address 0x05 should + * be provided as 0x0a. If the address is 10-bit, only most significant bits with the 10-bit identifier should be sent using this function. + * For example, if the 10-bit address is 0x305, the address should be provided as 0xf6(prepend with 0b11110, upper two bits of address 0b11, + * followed by 1-bit field for read/write). + * + * \parRelated APIs:
+ * XMC_I2C_CH_MasterTransmit(), XMC_USIC_CH_GetTransmitBufferStatus()\n\n + */ +void XMC_I2C_CH_MasterStart(XMC_USIC_CH_t *const channel, const uint16_t addr, const XMC_I2C_CH_CMD_t command); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param addr I2C master address + * @param command read/write command + * @return None
+ * + * \parDescription:
+ * Sends the repeated start condition from I2C master \a channel.
+ * + * \par + * Sends the repeated start condition with read/write command by updating IN/TBUF register based on FIFO/non-FIFO modes.\n + * @note Address(addr) should reserve an additional bit at the LSB for read/write indication. For example, address 0x05 should + * be provided as 0x0a. If the address is 10-bit, only most significant bits with the 10-bit identifier should be sent using this function. + * For example, if the 10-bit address is 0x305, the address should be provided as 0xf6(prepend with 0b11110, upper two bits of address 0b11, + * followed by 1-bit field for read/write). + * + * \parRelated APIs:
+ * XMC_I2C_CH_MasterTransmit(), XMC_USIC_CH_GetTransmitBufferStatus()\n\n + */ +void XMC_I2C_CH_MasterRepeatedStart(XMC_USIC_CH_t *const channel, const uint16_t addr, const XMC_I2C_CH_CMD_t command); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return None
+ * + * \parDescription:
+ * Stops the I2C master \a channel.
+ * + * \par + * Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Stop command. + * + * \parRelated APIs:
+ * XMC_I2C_CH_MasterTransmit(), XMC_USIC_CH_GetTransmitBufferStatus()\n\n + */ +void XMC_I2C_CH_MasterStop(XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param data data to transmit from I2C \a channel + * @return None
+ * + * \parDescription:
+ * Transmit the data from the I2C master \a channel.
+ * + * \par + * Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Master Send command. + * + * \parRelated APIs:
+ * XMC_USIC_CH_GetTransmitBufferStatus()\n\n + */ +void XMC_I2C_CH_MasterTransmit(XMC_USIC_CH_t *const channel, const uint8_t data); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param data data to transmit from I2C \a channel + * @return None
+ * + * \parDescription:
+ * Transmit the data from the I2C slave \a channel.
+ * + * \par + * Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Slave Send command. + * + * \parRelated APIs:
+ * XMC_USIC_CH_GetTransmitBufferStatus(),XMC_I2C_CH_ClearStatusFlag()\n\n + */ +void XMC_I2C_CH_SlaveTransmit(XMC_USIC_CH_t *const channel, const uint8_t data); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return None
+ * + * \parDescription:
+ * Sends the Ack request from I2C master \a channel.
+ * + * \par +* Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Master Receive Ack command. + * + * \parRelated APIs:
+ * XMC_I2C_CH_MasterTransmit()\n\n + */ +void XMC_I2C_CH_MasterReceiveAck(XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return None
+ * + * \parDescription:
+ * Sends the Nack request from I2C master \a channel.
+ * + * \par + * Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Master Receive Nack command. + * + * \parRelated APIs:
+ * XMC_I2C_CH_MasterTransmit()\n\n + */ +void XMC_I2C_CH_MasterReceiveNack(XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return uint8_t OUTR/RBUF register data
+ * + * \parDescription:
+ * Reads the data from I2C \a channel.
+ * + * \par + * Data is read by using OUTR/RBUF register based on FIFO/non-FIFO modes. + * + * \parRelated APIs:
+ * XMC_I2C_CH_MasterTransmit()\n\n + */ +uint8_t XMC_I2C_CH_GetReceivedData(const XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return uint8_t Receiver status flag
+ * + * \parDescription:
+ * Gets the receiver status of I2C \a channel using RBUF register of bits 8-12 which gives information about receiver status. + * + * \parRelated APIs:
+ * XMC_I2C_CH_MasterTransmit()\n\n + */ +__STATIC_INLINE uint8_t XMC_I2C_CH_GetReceiverStatusFlag(XMC_USIC_CH_t *const channel) +{ + return((uint8_t)((channel->RBUF) >> 8U)); +} + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param event ORed values of @ref XMC_I2C_CH_EVENT_t enum + * @return None
+ * + * \parDescription:
+ * Enables the input parameter @ref XMC_I2C_CH_EVENT_t event using PCR_IICMode register. + * + * \parRelated APIs:
+ * XMC_I2C_CH_DisableEvent()\n\n + */ +void XMC_I2C_CH_EnableEvent(XMC_USIC_CH_t *const channel, uint32_t event); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param event ORed values of @ref XMC_I2C_CH_EVENT_t enum + * @return None
+ * + * \parDescription:
+ * Disables the input parameter @ref XMC_I2C_CH_EVENT_t event using PCR_IICMode register. + * + * \parRelated APIs:
+ * XMC_I2C_CH_EnableEvent()\n\n + */ +void XMC_I2C_CH_DisableEvent(XMC_USIC_CH_t *const channel, uint32_t event); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return uint32_t Status byte
+ * + * \parDescription:
+ * Retrieves the status byte of I2C \a channel using PSR_IICMode register.\n + * + * \parRelated APIs:
+ * XMC_I2C_CH_ClearStatusFlag()\n\n + */ +__STATIC_INLINE uint32_t XMC_I2C_CH_GetStatusFlag(XMC_USIC_CH_t *const channel) +{ + return (channel->PSR_IICMode); +} + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param flag Status flag + * @return None
+ * + * \parDescription:
+ * Clears the status flag of I2C \a channel by setting the input parameter \a flag in PSCR register. + * + * \parRelated APIs:
+ * XMC_I2C_CH_GetStatusFlag()\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_ClearStatusFlag(XMC_USIC_CH_t *const channel, uint32_t flag) +{ + channel->PSCR |= flag; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2C0_CH0, @ref XMC_I2C0_CH1,@ref XMC_I2C1_CH0,@ref XMC_I2C1_CH1,@ref XMC_I2C2_CH0,@ref XMC_I2C2_CH1 @note Availability of I2C1 and I2C2 depends on device selection + * @param pdiv Desired divider for the external frequency input. \b Range: minimum value = 1, maximum value = 1024 \n + * @param oversampling Required oversampling. The value indicates the number of time quanta for one symbol of data. \n + * This can be related to the number of samples for each logic state of the data signal. \n + * \b Range: 1 to 32. Value should be chosen based on the protocol used. + * @param combination_mode USIC channel input combination mode \n + * + * @return None + * + * \parDescription
+ * Enables the external frequency input for the Baudrate Generator and configures the divider, oversampling and + * the combination mode of the USIC channel. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetBRGInputClockSource(), XMC_USIC_CH_SetInputTriggerCombinationMode() \n\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_ConfigExternalInputSignalToBRG(XMC_USIC_CH_t *const channel, + const uint16_t pdiv, + const uint32_t oversampling, + const XMC_USIC_CH_INPUT_COMBINATION_MODE_t combination_mode) +{ + XMC_USIC_CH_ConfigExternalInputSignalToBRG(channel,pdiv,oversampling,combination_mode); +} + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return None + * + * \parDescription:
+ * Retrieves the status byte of I2C \a channel using PSR_IICMode register.\n + * + * \parRelated APIs:
+ * XMC_I2C_CH_DisableAcknowledgeAddress0()\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_EnableAcknowledgeAddress0(XMC_USIC_CH_t *const channel) +{ + channel->PCR_IICMode |= USIC_CH_PCR_IICMode_ACK00_Msk; +} + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return None + * + * \parDescription:
+ * This bit defines that slave device should not be sensitive to the slave address 00H.\n + * + * \parRelated APIs:
+ * XMC_I2C_CH_EnableAcknowledgeAddress0()\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_DisableAcknowledgeAddress0(XMC_USIC_CH_t *const channel) +{ + channel->PCR_IICMode &= ~USIC_CH_PCR_IICMode_ACK00_Msk; +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2C0_CH0, @ref XMC_I2C0_CH1,@ref XMC_I2C1_CH0,@ref XMC_I2C1_CH1,@ref XMC_I2C2_CH0,@ref XMC_I2C2_CH1 @note Availability of I2C1 and I2C2 depends on device selection + * @return None + * + * \parDescription
+ * Enable data transmission.\n\n + * Use this function in combination with XMC_I2C_CH_DisableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * @note If you need more control over the start of transmission use XMC_USIC_CH_SetStartTransmisionMode() + * + * \parRelated APIs:
+ * XMC_I2C_CH_DisableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_EnableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_ON_TDV); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2C0_CH0, @ref XMC_I2C0_CH1,@ref XMC_I2C1_CH0,@ref XMC_I2C1_CH1,@ref XMC_I2C2_CH0,@ref XMC_I2C2_CH1 @note Availability of I2C1 and I2C2 depends on device selection + * @return None + * + * \parDescription
+ * Disable data transmission.\n\n + * Use this function in combination with XMC_I2C_CH_EnableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * + * \parRelated APIs:
+ * XMC_I2C_CH_EnableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_DisableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_DISABLED); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_i2s.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_i2s.h new file mode 100644 index 00000000..60808167 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_i2s.h @@ -0,0 +1,837 @@ +/** + * @file xmc_i2s.h + * @date 2016-06-30 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-08-21: + * - Initial
+ * + * 2015-08-24: + * - Added APIs for enabling/disabling delay compensation XMC_I2S_CH_DisableDelayCompensation() and + * XMC_I2S_CH_EnableDelayCompensation()
+ * + * 2015-09-01: + * - Modified XMC_I2S_CH_SetInputSource() for avoiding complete DXCR register overwriting.
+ * - Modified XMC_I2S_CH_EVENT_t enum for supporting XMC_I2S_CH_EnableEvent() and XMC_I2S_CH_DisableEvent()
+ * for supporting multiple events configuration
+ * + * 2015-09-14: + * - Modified XMC_I2S_CH_SetSystemWordLength for supporting up to 63 system word length
+ * + * 2016-05-20: + * - Added XMC_I2S_CH_EnableDataTransmission() and XMC_I2S_CH_DisableDataTransmission() + * + * 2016-06-30: + * - Documentation updates. + * + * @endcond + * + */ + +#ifndef XMC_I2S_H_ +#define XMC_I2S_H_ + +/********************************************************************************************************************** + * HEADER FILES + *********************************************************************************************************************/ +#include "xmc_usic.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup I2S + * @brief (IIS) driver for the XMC microcontroller family. + * + * USIC IIS Features:
+ * @{ + */ + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +#if defined(USIC0) +#define XMC_I2S0_CH0 XMC_USIC0_CH0 /**< USIC0 channel 0 base address */ +#define XMC_I2S0_CH1 XMC_USIC0_CH1 /**< USIC0 channel 1 base address */ +#endif + +#if defined(USIC1) +#define XMC_I2S1_CH0 XMC_USIC1_CH0 /**< USIC1 channel 0 base address */ +#define XMC_I2S1_CH1 XMC_USIC1_CH1 /**< USIC1 channel 1 base address */ +#endif + +#if defined(USIC2) +#define XMC_I2S2_CH0 XMC_USIC2_CH0 /**< USIC2 channel 0 base address */ +#define XMC_I2S2_CH1 XMC_USIC2_CH1 /**< USIC2 channel 1 base address */ +#endif +/******************************************************************************* + * ENUMS + *******************************************************************************/ + +/** + * @brief I2S Status + */ +typedef enum XMC_I2S_CH_STATUS +{ + XMC_I2S_CH_STATUS_OK, /**< Status OK */ + XMC_I2S_CH_STATUS_ERROR, /**< Status ERROR */ + XMC_I2S_CH_STATUS_BUSY /**< Status BUSY */ +} XMC_I2S_CH_STATUS_t; + +/** + * @brief I2S status flag + */ +typedef enum XMC_I2S_CH_STATUS_FLAG +{ + XMC_I2S_CH_STATUS_FLAG_WORD_ADDRESS = USIC_CH_PSR_IISMode_WA_Msk, /**< Word Address status */ + XMC_I2S_CH_STATUS_FLAG_DX2S = USIC_CH_PSR_IISMode_DX2S_Msk, /**< Status of WA input(DX2) signal*/ + XMC_I2S_CH_STATUS_FLAG_DX2T_EVENT_DETECTED = USIC_CH_PSR_IISMode_DX2TEV_Msk, /**< Status for WA input signal transition */ + XMC_I2S_CH_STATUS_FLAG_WA_FALLING_EDGE_EVENT = USIC_CH_PSR_IISMode_WAFE_Msk, /**< Falling edge of the WA output + signal has been generated */ + XMC_I2S_CH_STATUS_FLAG_WA_RISING_EDGE_EVENT = USIC_CH_PSR_IISMode_WARE_Msk, /**< Rising edge of the WA output + signal has been generated */ + XMC_I2S_CH_STATUS_FLAG_WA_GENERATION_END = USIC_CH_PSR_IISMode_END_Msk, /**< The WA generation has ended */ + XMC_I2S_CH_STATUS_FLAG_RECEIVER_START_INDICATION = USIC_CH_PSR_IISMode_RSIF_Msk, /**< Receive start indication status */ + XMC_I2S_CH_STATUS_FLAG_DATA_LOST_INDICATION = USIC_CH_PSR_IISMode_DLIF_Msk, /**< Data lost indication status */ + XMC_I2S_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION = USIC_CH_PSR_IISMode_TSIF_Msk, /**< Transmit shift indication status */ + XMC_I2S_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION = USIC_CH_PSR_IISMode_TBIF_Msk, /**< Transmit buffer indication status */ + XMC_I2S_CH_STATUS_FLAG_RECEIVE_INDICATION = USIC_CH_PSR_IISMode_RIF_Msk, /**< Receive indication status */ + XMC_I2S_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION = USIC_CH_PSR_IISMode_AIF_Msk, /**< Alternate receive indication status */ + XMC_I2S_CH_STATUS_FLAG_BAUD_RATE_GENERATOR_INDICATION = USIC_CH_PSR_IISMode_BRGIF_Msk /**< Baud rate generator indication status */ +} XMC_I2S_CH_STATUS_FLAG_t; + +/** + * @brief I2S Baudrate Generator shift clock output +*/ +typedef enum XMC_I2S_CH_BRG_SHIFT_CLOCK_OUTPUT +{ + XMC_I2S_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK = XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK, /**< Baudrate Generator shift clock output: SCLK*/ + XMC_I2S_CH_BRG_SHIFT_CLOCK_OUTPUT_DX1 = XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_DX1 /**< Clock obtained as input from master: DX1*/ +} XMC_I2S_CH_BRG_SHIFT_CLOCK_OUTPUT_t; + +/** + * @brief I2S channel interrupt node pointers + */ +typedef enum XMC_I2S_CH_INTERRUPT_NODE_POINTER +{ + XMC_I2S_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, /**< Node pointer for transmit shift interrupt */ + XMC_I2S_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER, /**< Node pointer for transmit buffer interrupt */ + XMC_I2S_CH_INTERRUPT_NODE_POINTER_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_RECEIVE, /**< Node pointer for receive interrupt */ + XMC_I2S_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE, /**< Node pointer for alternate receive interrupt */ + XMC_I2S_CH_INTERRUPT_NODE_POINTER_PROTOCOL = XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL /**< Node pointer for protocol related interrupts */ +} XMC_I2S_CH_INTERRUPT_NODE_POINTER_t; + +/** + * @brief I2S events + */ +typedef enum XMC_I2S_CH_EVENT +{ + XMC_I2S_CH_EVENT_RECEIVE_START = USIC_CH_CCR_RSIEN_Msk, /**< Receive start event */ + XMC_I2S_CH_EVENT_DATA_LOST = USIC_CH_CCR_DLIEN_Msk, /**< Data lost event */ + XMC_I2S_CH_EVENT_TRANSMIT_SHIFT = USIC_CH_CCR_TSIEN_Msk, /**< Transmit shift event */ + XMC_I2S_CH_EVENT_TRANSMIT_BUFFER = USIC_CH_CCR_TBIEN_Msk, /**< Transmit buffer event */ + XMC_I2S_CH_EVENT_STANDARD_RECEIVE = USIC_CH_CCR_RIEN_Msk, /**< Receive event */ + XMC_I2S_CH_EVENT_ALTERNATIVE_RECEIVE = USIC_CH_CCR_AIEN_Msk, /**< Alternate receive event */ + XMC_I2S_CH_EVENT_BAUD_RATE_GENERATOR = USIC_CH_CCR_BRGIEN_Msk, /**< Baudrate generator event */ + + XMC_I2S_CH_EVENT_WA_FALLING_EDGE = USIC_CH_PCR_IISMode_WAFEIEN_Msk << 2U, /**< WA falling edge event */ + XMC_I2S_CH_EVENT_WA_RISING_EDGE = USIC_CH_PCR_IISMode_WAREIEN_Msk << 2U, /**< WA rising edge event */ + XMC_I2S_CH_EVENT_WA_GENERATION_END = USIC_CH_PCR_IISMode_ENDIEN_Msk << 2U, /**< END event */ + XMC_I2S_CH_EVENT_DX2TIEN_ACTIVATED = USIC_CH_PCR_IISMode_DX2TIEN_Msk << 2U /**< WA input signal transition event*/ +} XMC_I2S_CH_EVENT_t; + +/** + * @brief Defines the Polarity of the WA in the SELO output lines in relation to the internal WA signal. + */ +typedef enum XMC_I2S_CH_WA_POLARITY +{ + XMC_I2S_CH_WA_POLARITY_DIRECT = 0x0UL, /**< The SELO outputs have the same polarity + as the WA signal (active high) */ + XMC_I2S_CH_WA_POLARITY_INVERTED = 0x1UL << USIC_CH_PCR_IISMode_SELINV_Pos /**< The SELO outputs have the inverted + polarity to the WA signal (active low)*/ +} XMC_I2S_CH_WA_POLARITY_t; + +/** + * @brief Defines the Polarity of the WA in the SELO output lines in relation to the internal WA signal. + */ +typedef enum XMC_I2S_CH_CHANNEL +{ + XMC_I2S_CH_CHANNEL_1_LEFT = 0U, /**< Channel 1 (left) */ + XMC_I2S_CH_CHANNEL_2_RIGHT = 1U /**< Channel 2 (right) */ +} XMC_I2S_CH_CHANNEL_t; + +/** + * @brief I2S input stage selection + */ +typedef enum XMC_I2S_CH_INPUT +{ + XMC_I2S_CH_INPUT_DIN0 = 0UL, /**< Data input stage 0 */ + XMC_I2S_CH_INPUT_SLAVE_SCLKIN = 1UL, /**< Clock input stage */ + XMC_I2S_CH_INPUT_SLAVE_WA = 2UL, /**< WA input stage */ +#if UC_FAMILY == XMC1 + XMC_I2S_CH_INPUT_DIN1 = 3UL, /**< Data input stage 1 */ + XMC_I2S_CH_INPUT_DIN2 = 4UL, /**< Data input stage 2 */ + XMC_I2S_CH_INPUT_DIN3 = 5UL /**< Data input stage 3 */ +#endif +} XMC_I2S_CH_INPUT_t; + +/** + * @brief Defines the I2S bus mode + */ +typedef enum XMC_I2S_CH_BUS_MODE +{ + XMC_I2S_CH_BUS_MODE_MASTER, /**< I2S Master */ + XMC_I2S_CH_BUS_MODE_SLAVE /**< I2S Slave */ +} XMC_I2S_CH_BUS_MODE_t; + +/******************************************************************************* + * DATA STRUCTURES + *******************************************************************************/ +/** + * @brief I2S_CH configuration structure + */ +typedef struct XMC_I2S_CH_CONFIG +{ + uint32_t baudrate; /**< Module baud rate for communication */ + uint8_t data_bits; /**< Data word length. A data frame can consists of several data words. \n + Value configured as USIC channel word length. \n + \b Range: minimum= 1, maximum= 16*/ + uint8_t frame_length; /**< Number of data bits transferred after a change of signal WA (data frame). \n + Configured as USIC channel frame length. \n + \b Range: minimum= 1, maximum= 63*/ + uint8_t data_delayed_sclk_periods; /**< Data delay defined in sclk periods */ + XMC_I2S_CH_WA_POLARITY_t wa_inversion; /**< Enable inversion of Slave select signal relative to the internal WA */ + XMC_I2S_CH_BUS_MODE_t bus_mode; /**< Bus mode MASTER/SLAVE */ +} XMC_I2S_CH_CONFIG_t; + +/******************************************************************************* + * API PROTOTYPES + *******************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2S0_CH0, XMC_I2S0_CH1,XMC_I2S1_CH0, XMC_I2S1_CH1,XMC_I2S2_CH0, XMC_I2S2_CH1 @note Availability of I2S1 and I2S2 depends on device selection + * @param config Constant pointer to I2S configuration structure of type @ref XMC_I2S_CH_CONFIG_t. + * @return XMC_I2S_CH_STATUS_t Status of initializing the USIC channel for I2S protocol.\n + * \b Range: @ref XMC_I2S_CH_STATUS_OK if initialization is successful.\n + * @ref XMC_I2S_CH_STATUS_ERROR if configuration of baudrate failed. + * + * \parDescription
+ * Initializes the USIC channel for I2S protocol.\n\n + * During the initialization, USIC channel is enabled and baudrate is configured. + * After each change of the WA signal, a complete data frame is intended to be transferred (frame length <= system word length). + * The number of data bits transferred after a change of signal WA is defined by config->frame_length. + * A data frame can consist of several data words with a data word length defined by config->data_bits. + * The changes of signal WA define the system word length as the number of SCLK cycles between two changes of WA. + * The system word length is set by default to the frame length defined by config->frame_length. + * + * XMC_I2S_CH_Start() should be invoked after the initialization to enable the channel. + * + * \parRelated APIs:
+ * XMC_I2S_CH_Start(), XMC_I2S_CH_Stop(), XMC_I2S_CH_Transmit(), XMC_I2S_CH_SetSystemWordLength()\n\n\n + */ +void XMC_I2S_CH_Init(XMC_USIC_CH_t *const channel, const XMC_I2S_CH_CONFIG_t *const config); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Set the selected USIC channel to operate in I2S mode, by setting CCR.MODE bits.\n\n + * It should be executed after XMC_I2S_CH_Init() during initialization. By invoking XMC_I2S_CH_Stop(), the MODE is set + * to IDLE state. Call XMC_I2S_CH_Start() to set the I2S mode again, as needed later in the program. + * + * \parRelated APIs:
+ * XMC_I2S_CH_Init(), XMC_I2S_CH_Stop() + */ +__STATIC_INLINE void XMC_I2S_CH_Start(XMC_USIC_CH_t *const channel) +{ + /* USIC channel in I2S mode */ + XMC_USIC_CH_SetMode(channel, XMC_USIC_CH_OPERATING_MODE_I2S); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return XMC_I2S_CH_STATUS_t Status of the I2S driver after the request for stopping is processed. \n + * XMC_I2S_CH_STATUS_OK- If the USIC channel is successfully put to IDLE mode. \n + * XMC_I2S_CH_STATUS_BUSY- If the USIC channel is busy transmitting data. + * + * \parDescription:
+ * Set the selected I2S channel to IDLE mode, by clearing CCR.MODE bits.\n\n + * After calling XMC_I2S_CH_Stop, channel is IDLE mode. So no communication is supported. XMC_I2S_CH_Start() has to be + * invoked to start the communication again. + * + * \parRelated APIs:
+ * XMC_I2S_CH_Start() + */ +XMC_I2S_CH_STATUS_t XMC_I2S_CH_Stop(XMC_USIC_CH_t *const channel); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param rate Bus speed in bits per second + * + * @return XMC_I2S_CH_STATUS_t Status of the I2S driver after the request for setting baudrate is processed. \n + * XMC_I2S_CH_STATUS_OK- If the baudrate is successfully changed. \n + * XMC_I2S_CH_STATUS_ERROR- If the new baudrate value is out of range. + * + * \parDescription:
+ * Sets the bus speed in bits per second + * + * \parRelated APIs:
+ * XMC_I2S_CH_Init(), XMC_I2S_CH_Stop() + */ +XMC_I2S_CH_STATUS_t XMC_I2S_CH_SetBaudrate(XMC_USIC_CH_t *const channel, const uint32_t rate); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param sclk_cycles_system_word_length system word length in terms of sclk clock cycles. + * + * @return None + * + * \parDescription:
+ * Configures the system word length by setting BRG.DCTQ bit field.\n\n + * This value has to be always higher than 1U and lower than the data with (SCTR.FLE) + * + */ +void XMC_I2S_CH_SetSystemWordLength(XMC_USIC_CH_t *const channel,uint32_t sclk_cycles_system_word_length); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param data Data to be transmitted + * @param channel_number Communication output channel of the I2S, based on this channel selection TCI(Transmit control information)is updated.\n + * Refer @ref XMC_I2S_CH_CHANNEL_t for valid values. + * + * @return None + * + * \parDescription:
+ * Puts the data into FIFO, if FIFO mode is enabled or else into standard buffer, by setting the proper mode.\n\n + * TCI(Transmit Control Information) allows dynamic control of output channel during data transfers. To support this auto + * update, TCSR.WAMD(Automatic WA mode) will be enabled during the initialization using XMC_I2S_CH_Init() for all modes. + * + * + * \parRelated APIs:
+ * XMC_I2S_CH_Receive() + */ +void XMC_I2S_CH_Transmit(XMC_USIC_CH_t *const channel, const uint16_t data, const XMC_I2S_CH_CHANNEL_t channel_number); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param channel_number Communication output channel of the I2S, based on this mode TCI(Transmit control information)is updated.\n + * Refer @ref XMC_I2S_CH_CHANNEL_t for valid values. + * + * @return None + * + * \parDescription:
+ * Transmits a dummy data(FFFFH) to provide clock for slave and receives the data from the slave.\n\n + * XMC_I2S_CH_Receive() receives the data and places it into buffer based on the FIFO selection. After reception of data + * XMC_I2S_CH_GetReceivedData() can be invoked to read the data from the buffers. + * + * \parRelated APIs:
+ * XMC_I2S_CH_GetReceivedData() + */ +__STATIC_INLINE void XMC_I2S_CH_Receive(XMC_USIC_CH_t *const channel, const XMC_I2S_CH_CHANNEL_t channel_number) +{ + /* Transmit dummy data */ + XMC_I2S_CH_Transmit(channel, (uint16_t)0xffffU , channel_number); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return uint16_t Data read from the receive buffer. + * + * \parDescription:
+ * Reads data from the receive buffer based on the FIFO selection.\n\n + * Invocation of XMC_I2S_CH_Receive() receives the data and place it into receive buffer. After receiving the data + * XMC_I2S_CH_GetReceivedData() can be used to read the data from the buffer. + * + * \parRelated APIs:
+ * XMC_I2S_CH_Receive() + */ +uint16_t XMC_I2S_CH_GetReceivedData(XMC_USIC_CH_t *const channel); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Set the order of data transfer from LSB to MSB, by clearing SCTR.SDIR bit.\n\n + * This is typically based on the slave settings. Invoke XMC_I2S_CH_SetBitOrderLsbFirst() to set direction as needed in + * the program. + * + * \parRelated APIs:
+ * XMC_I2S_CH_SetBitOrderMsbFirst() + */ +__STATIC_INLINE void XMC_I2S_CH_SetBitOrderLsbFirst(XMC_USIC_CH_t *const channel) +{ + channel->SCTR &= (uint32_t)~USIC_CH_SCTR_SDIR_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Set the order of data transfer from MSB to LSB, by setting SCTR.SDIR bit.\n\n + * This is typically based on the slave settings. This is not set during XMC_I2S_CH_Init(). + * Invoke XMC_I2S_CH_SetBitOrderMsbFirst() to set direction as needed in the program. + * + * \parRelated APIs:
+ * XMC_I2S_CH_SetBitOrderLsbFirst() + */ +__STATIC_INLINE void XMC_I2S_CH_SetBitOrderMsbFirst(XMC_USIC_CH_t *const channel) +{ + channel->SCTR |= (uint32_t)USIC_CH_SCTR_SDIR_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param event Protocol events which have to be enabled. + * Refer @ XMC_I2S_CH_EVENT_t for valid values. OR combinations of these enum items can be used + * as input. + * + * @return None + * + * \parDescription:
+ * Enables the I2S protocol specific events, by configuring PCR register.\n\n + * Events can be enabled as needed using XMC_I2S_CH_EnableEvent(). + * XMC_I2S_CH_DisableEvent() can be used to disable the events. + * + * \parRelated APIs:
+ * XMC_I2S_CH_DisableEvent() + */ +void XMC_I2S_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param event Protocol events which have to be disabled. + * Refer @ XMC_I2S_CH_EVENT_t for valid values. OR combinations of these enum item can be used + * as input. + * + * @return None + * + * \parDescription:
+ * Disables the I2S protocol specific events, by configuring PCR register.\n\n + * After disabling the events, XMC_I2S_CH_EnableEvent() has to be invoked to re-enable the events. + * + * \parRelated APIs:
+ * XMC_I2S_CH_EnableEvent() + */ +void XMC_I2S_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return uint32_t Status of I2S protocol events. + * + * \parDescription:
+ * Returns the status of the events, by reading PSR register.\n\n + * This indicates the status of the all the events, for I2S communication. + * + * \parRelated APIs:
+ * XMC_I2S_CH_ClearStatusFlag() + */ +__STATIC_INLINE uint32_t XMC_I2S_CH_GetStatusFlag(XMC_USIC_CH_t *const channel) +{ + return channel->PSR_IISMode; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param flag Protocol event status to be cleared for detection of next occurence. + * Refer @ XMC_I2S_CH_STATUS_FLAG_t for valid values. OR combinations of these enum item can be used + * as input. + * @return None + * + * \parDescription:
+ * Clears the events specified, by setting PSCR register.\n\n + * During communication the events occurred have to be cleared to detect their next occurence.\n + * e.g: During transmission Transmit buffer event occurs to indicating data word transfer has started. This + * event has to be cleared after transmission of each data word. Otherwise next event cannot be recognized. + * + * \parRelated APIs:
+ * XMC_I2S_CH_GetStatusFlag() + */ +__STATIC_INLINE void XMC_I2S_CH_ClearStatusFlag(XMC_USIC_CH_t *const channel, const uint32_t flag) +{ + channel->PSCR |= flag; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Enables the generation of Master clock by setting PCR.MCLK bit.\n\n + * This clock can be used as a clock reference for external devices. This is not enabled during initialization in + * XMC_I2S_CH_Init(). Invoke XMC_I2S_CH_EnableMasterClock() to enable as needed in the program, or if it is disabled by + * XMC_I2S_CH_DisableMasterClock(). + * + * \parRelated APIs:
+ * XMC_I2S_CH_DisableMasterClock() + */ +__STATIC_INLINE void XMC_I2S_CH_EnableMasterClock(XMC_USIC_CH_t *const channel) +{ + channel->PCR_IISMode |= (uint32_t)USIC_CH_PCR_IISMode_MCLK_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Disables the generation of Master clock by clearing PCR.MCLK bit.\n\n + * This clock can be enabled by invoking XMC_I2S_CH_EnableMasterClock() as needed in the program. + * + * \parRelated APIs:
+ * XMC_I2S_CH_EnableMasterClock() + */ +__STATIC_INLINE void XMC_I2S_CH_DisableMasterClock(XMC_USIC_CH_t *const channel) +{ + channel->PCR_IISMode &= (uint32_t)~USIC_CH_PCR_IISMode_MCLK_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param clock_output shift clock source.\n + * Refer @ref XMC_I2S_CH_BRG_SHIFT_CLOCK_OUTPUT_t for valid inputs. + * + * @return None + * + * \parDescription:
+ * Configures the shift clock source by setting BRG.SCLKOSEL.\n\n + * In Master mode operation, shift clock is generated by the internal baud rate generator. This SCLK is made available + * for external slave devices by SCLKOUT signal.\n + * In Slave mode, the signal is received from the external master. So the DX1(input) stage has to be connected to input.\n + */ +__STATIC_INLINE void XMC_I2S_CH_ConfigureShiftClockOutput(XMC_USIC_CH_t *const channel, + const XMC_I2S_CH_BRG_SHIFT_CLOCK_OUTPUT_t clock_output) +{ + XMC_USIC_CH_ConfigureShiftClockOutput(channel, (XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t)0U, + (XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_t)clock_output); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param word_length Number of bits to be configured for a data word. \n + * \b Range: 1 to 16. + * + * @return None + * + * \parDescription
+ * Defines the data word length.\n\n + * Sets the number of bits to represent a data word. Frame length should be a multiple of word length. + * + * \parRelated APIs:
+ * XMC_I2S_CH_SetFrameLength() + */ +__STATIC_INLINE void XMC_I2S_CH_SetWordLength(XMC_USIC_CH_t *const channel, const uint8_t word_length) +{ + XMC_USIC_CH_SetWordLength(channel, word_length); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param frame_length Number of bits in a frame. \n + * \b Range: 1 to 64. + * + * @return None + * + * \parDescription
+ * Define the data frame length.\n\n + * Set the number of bits to be serially transmitted in a frame. + * The frame length should be multiples of word length. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetWordLength() + */ +__STATIC_INLINE void XMC_I2S_CH_SetFrameLength(XMC_USIC_CH_t *const channel, const uint8_t frame_length) +{ + XMC_USIC_CH_SetFrameLength(channel, frame_length); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param input I2S channel input stage.\n + * Refer @ref XMC_I2S_CH_INPUT_t for valid values + * @param source Input source select for the input stage. + * Range : [0 to 7] + * + * @return None + * + * \parDescription
+ * Selects the data source for I2S input stage, by configuring DXCR.DSEL bits.\n\n + * Selects the input data signal source among DXnA, DXnB.. DXnG for the input stage. The API can be used for all the + * input stages like DX0CR, DX1CR etc. This is not done during initialization. This has to be configured before starting + * the I2S communication. + */ +__STATIC_INLINE void XMC_I2S_CH_SetInputSource(XMC_USIC_CH_t *const channel, + const XMC_I2S_CH_INPUT_t input, + const uint8_t source) +{ + channel->DXCR[input] = (uint32_t)(channel->DXCR[input] & (~USIC_CH_DX0CR_DSEN_Msk)) | USIC_CH_DX0CR_INSW_Msk; + XMC_USIC_CH_SetInputSource(channel, (XMC_USIC_CH_INPUT_t)input, source); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param wa_inversion Polarity of the word address signal.\n + * Refer @ref XMC_I2S_CH_WA_POLARITY_t for valid values + * + * @return None + * + * \parDescription
+ * Set the polarity of the word address signal, by configuring PCR.SELINV bit.\n\n + * Normally WA signal is active low level signal. This is configured + * in XMC_I2S_CH_Init() during initialization. Invoke XMC_I2S_CH_WordAddressSignalPolarity() with desired settings as + * needed later in the program. + */ +__STATIC_INLINE void XMC_I2S_CH_WordAddressSignalPolarity(XMC_USIC_CH_t *const channel, + const XMC_I2S_CH_WA_POLARITY_t wa_inversion) +{ + /* Configuration of Protocol Control Register */ + channel->PCR_IISMode = (uint32_t)((channel->PCR_IISMode & (~USIC_CH_PCR_IISMode_SELINV_Msk)) | (uint32_t)wa_inversion); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param input I2S channel input stage.\n + * Refer @ref XMC_I2S_CH_INPUT_t for valid inputs. + * + * @return None + * + * \parDescription
+ * Enables the polarity inversion of input data signal, by setting DXyCR.DPOL(where y = \a input).\n\n + * This is not set in XMC_I2S_CH_Init(). Invoke XMC_I2S_CH_EnableInputInversion() as needed later in the program. To + * disable the inversion XMC_I2S_CH_DisableInputInversion() can be invoked. + * + * \parRelated APIs:
+ * XMC_I2S_CH_DisableInputInversion() + */ +__STATIC_INLINE void XMC_I2S_CH_EnableInputInversion(XMC_USIC_CH_t *const channel, + const XMC_I2S_CH_INPUT_t input) +{ + XMC_USIC_CH_EnableInputInversion(channel, (XMC_USIC_CH_INPUT_t)input); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param input I2S channel input stage.\n + * Refer @ref XMC_I2S_CH_INPUT_t for valid inputs. + * + * @return None + * + * \parDescription
+ * Disables the polarity inversion of input data signal, by clearing DXyCR.DPOL(where y = \a input).\n\n + * Resets the input data polarity. Invoke XMC_I2S_CH_EnableInputInversion() to apply inversion. + * + * \parRelated APIs:
+ * XMC_I2S_CH_EnableInputInversion() + */ +__STATIC_INLINE void XMC_I2S_CH_DisableInputInversion(XMC_USIC_CH_t *const channel, + const XMC_I2S_CH_INPUT_t input) +{ + XMC_USIC_CH_DisableInputInversion(channel, (XMC_USIC_CH_INPUT_t)input); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param service_request Service request number. + Range: [0 to 5] + * + * @return None + * + * \parDescription
+ * Sets the interrupt node for I2S channel events.\n\n + * For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so. This is not configured in XMC_I2S_CH_Init() during + * initialization. + * + * \parNote::
+ * 1. NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableEvent() + */ +__STATIC_INLINE void XMC_I2S_CH_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const uint8_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL, (uint32_t)service_request); +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2S0_CH0, @ref XMC_I2S0_CH1,@ref XMC_I2S1_CH0,@ref XMC_I2S1_CH1,@ref XMC_I2S2_CH0,@ref XMC_I2S2_CH1 @note Availability of I2S1 and I2S2 depends on device selection + * @param interrupt_node Interrupt node pointer to be configured. \n + * \b Range: @ref XMC_I2S_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, + * @ref XMC_I2S_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER etc. + * @param service_request Service request number.\n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets the interrupt node for USIC channel events. \n\n + * For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so.
+ * Note: NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_I2S_CH_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_I2S_CH_SelectInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_I2S_CH_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, (XMC_USIC_CH_INTERRUPT_NODE_POINTER_t)interrupt_node, + (uint32_t)service_request); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2S0_CH0, @ref XMC_I2S0_CH1,@ref XMC_I2S1_CH0,@ref XMC_I2S1_CH1,@ref XMC_I2S2_CH0,@ref XMC_I2S2_CH1 @note Availability of I2S1 and I2S2 depends on device selection + * @param service_request_line service request number of the event to be triggered. \n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Trigger a I2S interrupt service request.\n\n + * When the I2S service request is triggered, the NVIC interrupt associated with it will be + * generated if enabled. + * + * \parRelated APIs:
+ * XMC_I2S_CH_SelectInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_I2S_CH_TriggerServiceRequest(XMC_USIC_CH_t *const channel, const uint32_t service_request_line) +{ + XMC_USIC_CH_TriggerServiceRequest(channel, (uint32_t)service_request_line); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2S0_CH0, @ref XMC_I2S0_CH1,@ref XMC_I2S1_CH0,@ref XMC_I2S1_CH1,@ref XMC_I2S2_CH0,@ref XMC_I2S2_CH1 @note Availability of I2S1 and I2S2 depends on device selection + * @return None + * + * \parDescription
+ * Enables delay compensation. \n\n + * + * Delay compensation can be applied to the receive path. + * \parRelated APIs:
+ * XMC_I2S_CH_DisableDelayCompensation()\n\n\n + */ +__STATIC_INLINE void XMC_I2S_CH_EnableDelayCompensation(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_EnableDelayCompensation(channel); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2S0_CH0, @ref XMC_I2S0_CH1,@ref XMC_I2S1_CH0,@ref XMC_I2S1_CH1,@ref XMC_I2S2_CH0,@ref XMC_I2S2_CH1 @note Availability of I2S1 and I2S2 depends on device selection + * @return None + * + * \parDescription
+ * Disables delay compensation.. \n\n + * + * \parRelated APIs:
+ * XMC_I2S_CH_EnableDelayCompensation()\n\n\n + */ +__STATIC_INLINE void XMC_I2S_CH_DisableDelayCompensation(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_DisableDelayCompensation(channel); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2S0_CH0, @ref XMC_I2S0_CH1,@ref XMC_I2S1_CH0,@ref XMC_I2S1_CH1,@ref XMC_I2S2_CH0,@ref XMC_I2S2_CH1 @note Availability of I2S1 and I2S2 depends on device selection + * @return None + * + * \parDescription
+ * Enable data transmission.\n\n + * Use this function in combination with XMC_I2S_CH_DisableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * @note If you need more control over the start of transmission use XMC_USIC_CH_SetStartTransmisionMode() + * + * \parRelated APIs:
+ * XMC_I2S_CH_DisableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_I2S_CH_EnableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_ON_TDV); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2S0_CH0, @ref XMC_I2S0_CH1,@ref XMC_I2S1_CH0,@ref XMC_I2S1_CH1,@ref XMC_I2S2_CH0,@ref XMC_I2S2_CH1 @note Availability of I2S1 and I2S2 depends on device selection + * @return None + * + * \parDescription
+ * Disable data transmission.\n\n + * Use this function in combination with XMC_I2S_CH_EnableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * + * \parRelated APIs:
+ * XMC_I2S_CH_EnableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_I2S_CH_DisableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_DISABLED); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ +#endif /* XMC_I2S_H_ */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_ledts.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_ledts.h new file mode 100644 index 00000000..0934eda6 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_ledts.h @@ -0,0 +1,1052 @@ +/** + * @file xmc_ledts.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * - Documentation improved
+ * - New API added: XMC_LEDTS_SetActivePADNo()
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * @endcond + * + */ + +#ifndef XMC_LEDTS_H +#define XMC_LEDTS_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +#if defined(LEDTS0) +#include "xmc_scu.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup LEDTS + * @brief LED and Touch-Sense control(LEDTS) driver for the XMC controller family. + * + * The LED and Touch-Sense (LEDTS) drives LEDs and controls touch pads used as human-machine interface (HMI) in an + * application. The LEDTS can measure the capacitance of up to 8 touch pads, can also drive up to 64 LEDs in an LED matrix. + * Touch pads and LEDs can share pins to minimize the number of pins needed for such applications, this is realized by + * the module controlling the touch pads and driving the LEDs in a time-division multiplexed manner. + * + * This device contains LEDTS kernel that has an LED driving function and a touch-sensing function. + * + * It is recommended to set up all configurations for the LEDTS in all Special Function Registers(SFR) before + * enabling and starting LED and/or touch-sense function(s). + * + * This Low Level Driver(LLD) provides APIs to configure and control LED functionality, Touch-Sense functionality and + * features common to both functionalities. + * + * LED features: + * -# Configuration structure to configure LED functionality (XMC_LEDTS_LED_CONFIG_t) and initialization funtion + * (XMC_LEDTS_InitLED()). + * -# Selection of number of LED columns, active column level and enabling LED funtionality (XMC_LEDTS_InitLED()). + * -# Setting line pattern to be displayed on LED column (XMC_LEDTS_SetLEDLinePattern()). + * -# Brightness control of LED column (XMC_LEDTS_SetColumnBrightness()). + * -# Setting number of columns to be activated (XMC_LEDTS_SetNumOfLEDColumns()). + * + * Touch-Sense features: + * -# Configuration structure to perform basic Touch-Sense functionality (XMC_LEDTS_TS_CONFIG_BASIC_t) settings and + * initialization funtion (XMC_LEDTS_InitTSBasic()). + * -# Configuration structure to perform advanced Touch-Sense functionality (XMC_LEDTS_TS_CONFIG_ADVANCED_t) settings + * and initialization function (XMC_LEDTS_InitTSAdvanced()). + * -# Setting number of touch inputs and acculumate count on touch input (XMC_LEDTS_InitTSBasic()). + * -# Enabling/disabling of common compare, Touch-Sense counter auto reset and Touch-Sense funtionality. + * (XMC_LEDTS_InitTSBasic()). + * -# Set number of mask bits for time frame validation and first touch input to be active. (XMC_LEDTS_InitTSAdvanced()). + * -# Enable/disable time frame interrupt, external pull-up on touch pin and hardware or software control of + * pad turn (XMC_LEDTS_InitTSAdvanced()). + * -# Setting size of common oscillation window for all touch-sense inputs (XMC_LEDTS_SetCommonOscillationWindow()). + * -# Setting size of oscillation window for a touch-sense input (XMC_LEDTS_SetOscillationWindow()). + * + * Common features: + * -# Global configuration structure XMC_LEDTS_GLOBAL_CONFIG_t and initialization function XMC_LEDTS_InitGlobal(). + * -# Selection of Clock source for LEDTS module (XMC_LEDTS_InitGlobal()). + * -# Kick-start and stop of LEDTS module (XMC_LEDTS_StartCounter() / XMC_LEDTS_StopCounter()). + * -# Read and clear of interrupt status flags (XMC_LEDTS_ReadInterruptFlag() / XMC_LEDTS_ClearInterruptFlag()). + * -# Reading of previous active column number (XMC_LEDTS_ReadFNCOL()). + * -# Enable/Disable Interrupts(XMC_LEDTS_EnableInterrupt() / XMC_LEDTS_DisableInterrupt()). + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +#if defined(LEDTS0) +#define XMC_LEDTS0 ((XMC_LEDTS_GLOBAL_t *) LEDTS0) /**< Typedef for LEDTS kernel0*/ +#define XMC_LEDTS_CHECK_LEDTS0(PTR) (PTR == XMC_LEDTS0) +#else +#define XMC_LEDTS_CHECK_LEDTS0(PTR) 0 +#endif + +#if defined(LEDTS1) +#define XMC_LEDTS1 ((XMC_LEDTS_GLOBAL_t *) LEDTS1) /**< Typedef for LEDTS kernel1*/ +#define XMC_LEDTS_CHECK_LEDTS1(PTR) (PTR == XMC_LEDTS1) +#else +#define XMC_LEDTS_CHECK_LEDTS1(PTR) 0 +#endif + +#if defined(LEDTS2) +#define XMC_LEDTS2 ((XMC_LEDTS_GLOBAL_t *) LEDTS2) /**< Typedef for LEDTS kernel2*/ +#define XMC_LEDTS_CHECK_LEDTS2(PTR) (PTR == XMC_LEDTS2) +#else +#define XMC_LEDTS_CHECK_LEDTS2(PTR) 0 +#endif + +#define XMC_LEDTS_CHECK_KERNEL_PTR(PTR) (XMC_LEDTS_CHECK_LEDTS0(PTR) || \ + XMC_LEDTS_CHECK_LEDTS1(PTR) || \ + XMC_LEDTS_CHECK_LEDTS2(PTR)) + +/** + * Defines LEDTS module structure. This holds data and configuration registers of LEDTS modules. Use type + * XMC_LEDTS_GLOBAL_t for this data structure.\n + */ +typedef struct XMC_LEDTS_GLOBAL{ /*!< (@ 0x50020000) LEDTS Structure */ + __I uint32_t ID; /*!< (@ 0x50020000) Module Identification Register */ + __IO uint32_t GLOBCTL; /*!< (@ 0x50020004) Global Control Register */ + __IO uint32_t FNCTL; /*!< (@ 0x50020008) Function Control Register */ + __O uint32_t EVFR; /*!< (@ 0x5002000C) Event Flag Register */ + __IO uint32_t TSVAL; /*!< (@ 0x50020010) Touch-sense TS-Counter Value */ + __IO uint32_t LINE[2]; /*!< (@ 0x50020014) Line Pattern Register 0 */ + __IO uint32_t LDCMP[2]; /*!< (@ 0x5002001C) LED Compare Register 0 */ + __IO uint32_t TSCMP[2]; /*!< (@ 0x50020024) Touch-sense Compare Register 0 */ + } XMC_LEDTS_GLOBAL_t; + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +/** + * Defines typedef for LEDTS Global data structure. Use type XMC_LEDTS_t for this data structure.\n + */ +typedef XMC_LEDTS_GLOBAL_t XMC_LEDTS_t; + +#if defined(LEDTS0) +#define XMC_LEDTS0 ((XMC_LEDTS_GLOBAL_t *) LEDTS0) /**< Typedef for LEDTS kernel0*/ +#endif + +#if defined(LEDTS1) +#define XMC_LEDTS1 ((XMC_LEDTS_GLOBAL_t *) LEDTS1) /**< Typedef for LEDTS kernel1*/ +#endif + + +/** + * Defines return value of an API. Use type XMC_LEDTS_STATUS_t for this enum. + */ +typedef enum XMC_LEDTS_STATUS +{ + XMC_LEDTS_STATUS_SUCCESS = 0, /**< API fulfills request */ + XMC_LEDTS_STATUS_RUNNING = 1, /**< The kernel-counter is currently running */ + XMC_LEDTS_STATUS_ERROR = 2, /**< API cannot fulfill request */ + XMC_LEDTS_STATUS_IDLE = 3 /**< The kernel-counter is currently idle */ +} XMC_LEDTS_STATUS_t; + +/** + * Defines return value for checking interrupt flag. Use type XMC_LEDTS_FLAG_STATUS_t for this enum. + */ +typedef enum XMC_LEDTS_FLAG_STATUS +{ + XMC_LEDTS_FLAG_STATUS_NO = 0, /**< Flag not raised */ + XMC_LEDTS_FLAG_STATUS_YES = 1 /**< Flag is raised */ +} XMC_LEDTS_FLAG_STATUS_t; + +/** + * Defines Touch-Sense function enable/disable. Use type XMC_LEDTS_TS_FUNC_t for this enum. + */ +typedef enum XMC_LEDTS_TS_FUNC +{ + XMC_LEDTS_TS_FUNC_DISABLE = 0, /**< Disable touch-sense function */ + XMC_LEDTS_TS_FUNC_ENABLE = 1 /**< Enable touch-sense function */ +} XMC_LEDTS_TS_FUNC_t; + +/** + * Defines LED function enable/disable. Use type XMC_LEDTS_LED_FUNC_t for this enum. + */ +typedef enum XMC_LEDTS_LED_FUNC +{ + XMC_LEDTS_LED_FUNC_DISABLE = 0, /**< Disable LED function */ + XMC_LEDTS_LED_FUNC_ENABLE = 1 /**< Enable LED function */ +} XMC_LEDTS_LED_FUNC_t; + +/** + * Defines Clock master enable/disable. Use type for XMC_LEDTS_CLOCK_TYPE_t for this enum. + */ +typedef enum XMC_LEDTS_CLOCK_TYPE +{ + XMC_LEDTS_CLOCK_TYPE_MASTER = 0, /**< Kernel generates its own clock */ + XMC_LEDTS_CLOCK_TYPE_SLAVE = 1 /**< Clock is taken from another master kernel */ +} XMC_LEDTS_CLOCK_TYPE_t; + +/** + * Defines enable/disable of autoscan time period synchronization. Use type XMC_LEDTS_TP_SYNC_t for this enum. + */ +typedef enum XMC_LEDTS_TP_SYNC +{ + XMC_LEDTS_TP_SYNC_DISABLE = 0, /**< Synchronization is disabled */ + XMC_LEDTS_TP_SYNC_ENABLE = 1 /**< Synchronization enabled on Kernel0 autoscan time period */ +} XMC_LEDTS_TP_SYNC_t; + +/** + * Defines Suspend request configuration. Use type XMC_LEDTS_SUSPEND_t for this enum. + */ +typedef enum XMC_LEDTS_SUSPEND +{ + XMC_LEDTS_SUSPEND_DISABLE = 0, /**< Ignore suspend request */ + XMC_LEDTS_SUSPEND_ENABLE = 1 /**< Enable suspend according to request */ +} XMC_LEDTS_SUSPEND_t; + +/** + * Defines number of bits to mask for time frame event validation. Use type XMC_LEDTS_TS_COUNTER_MASK_t for this enum. + */ +typedef enum XMC_LEDTS_TS_COUNTER_MASK +{ + XMC_LEDTS_TS_COUNTER_MASK_1_LSB = 0, /**< Mask LSB bit only */ + XMC_LEDTS_TS_COUNTER_MASK_2_LSB = 1, /**< Mask 2 LSB bits */ + XMC_LEDTS_TS_COUNTER_MASK_3_LSB = 2, /**< Mask 3 LSB bits */ + XMC_LEDTS_TS_COUNTER_MASK_4_LSB = 3, /**< Mask 4 LSB bits */ + XMC_LEDTS_TS_COUNTER_MASK_5_LSB = 4, /**< Mask 5 LSB bits */ + XMC_LEDTS_TS_COUNTER_MASK_6_LSB = 5, /**< Mask 6 LSB bits */ + XMC_LEDTS_TS_COUNTER_MASK_7_LSB = 6, /**< Mask 7 LSB bits */ + XMC_LEDTS_TS_COUNTER_MASK_8_LSB = 7 /**< Mask 8 LSB bits */ +} XMC_LEDTS_TS_COUNTER_MASK_t; + +/** + * Defines Enable/disable of (extended) time frame validation. Use type XMC_LEDTS_TF_VALIDATION_t for this enum. + */ +typedef enum XMC_LEDTS_TF_VALIDATION +{ + XMC_LEDTS_TF_VALIDATION_DISABLE = 0, /**< Disable time frame validation */ + XMC_LEDTS_TF_VALIDATION_ENABLE = 1 /**< Enable time frame validation */ +} XMC_LEDTS_TF_VALIDATION_t; + +/** + * Defines Enable or disable interrupts. Use type XMC_LEDTS_INTERRUPT_t for this enum. + */ +typedef enum XMC_LEDTS_INTERRUPT +{ + XMC_LEDTS_INTERRUPT_TIMESLICE = LEDTS_GLOBCTL_ITS_EN_Msk, /**< Enable or Disable time slice interrupt */ + XMC_LEDTS_INTERRUPT_TIMEFRAME = LEDTS_GLOBCTL_ITF_EN_Msk, /**< Enable or Disable time frame interrupt */ + XMC_LEDTS_INTERRUPT_TIMEPERIOD = LEDTS_GLOBCTL_ITP_EN_Msk /**< Enable or Disable autoscan time period interrupt */ +} XMC_LEDTS_INTERRUPT_t; + +/** + * Defines Touch-Sense TSIN pad turn. Use type XMC_LEDTS_PAD_TURN_t for this enum. + */ +typedef enum XMC_LEDTS_PAD_TURN +{ + XMC_LEDTS_PAD_TURN_0 = 0, /**< TSIN0 is next or currently active */ + XMC_LEDTS_PAD_TURN_1 = 1, /**< TSIN1 is next or currently active */ + XMC_LEDTS_PAD_TURN_2 = 2, /**< TSIN2 is next or currently active */ + XMC_LEDTS_PAD_TURN_3 = 3, /**< TSIN3 is next or currently active */ + XMC_LEDTS_PAD_TURN_4 = 4, /**< TSIN4 is next or currently active */ + XMC_LEDTS_PAD_TURN_5 = 5, /**< TSIN5 is next or currently active */ + XMC_LEDTS_PAD_TURN_6 = 6, /**< TSIN6 is next or currently active */ + XMC_LEDTS_PAD_TURN_7 = 7 /**< TSIN7 is next or currently active */ +} XMC_LEDTS_PAD_TURN_t; + +/** + * Defines software control for Touch-Sense pad turn. Use type XMC_LEDTS_PAD_TURN_SW_CONTROL_t for this enum. + */ +typedef enum XMC_LEDTS_PAD_TURN_SW_CONTROL +{ + XMC_LEDTS_SW_CONTROL_DISABLE = 0, /**< Disable software control. Auto hardware control */ + XMC_LEDTS_SW_CONTROL_ENABLE = 1 /**< Enable software control for pad turn */ +} XMC_LEDTS_PAD_TURN_SW_CONTROL_t; + +/** + * Defines External pull-up on touch-sense pin. Use type XMC_LEDTS_EXT_PULLUP_COLA_t for this enum. + */ +typedef enum XMC_LEDTS_EXT_PULLUP_COLA +{ + XMC_LEDTS_EXT_PULLUP_COLA_DISABLE = 0, /**< Disable external pull-up. Internal pull-up is active */ + XMC_LEDTS_EXT_PULLUP_COLA_ENABLE = 1 /**< Enable external pull-up */ +} XMC_LEDTS_EXT_PULLUP_COLA_t; + +/** + * Defines number of accumulation counts on Touch-Sense input. Use type XMC_LEDTS_ACCUMULATION_COUNT_t for this enum. + */ +typedef enum XMC_LEDTS_ACCUMULATION_COUNT +{ + XMC_LEDTS_ACCUMULATION_COUNT_1_TIME = 0, /**< Accumulate once */ + XMC_LEDTS_ACCUMULATION_COUNT_2_TIMES = 1, /**< Accumulate twice */ + XMC_LEDTS_ACCUMULATION_COUNT_3_TIMES = 2, /**< Accumulate thrice */ + XMC_LEDTS_ACCUMULATION_COUNT_4_TIMES = 3, /**< Accumulate 4 times */ + XMC_LEDTS_ACCUMULATION_COUNT_5_TIMES = 4, /**< Accumulate 5 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_6_TIMES = 5, /**< Accumulate 6 times */ + XMC_LEDTS_ACCUMULATION_COUNT_7_TIMES = 6, /**< Accumulate 7 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_8_TIMES = 7, /**< Accumulate 8 times */ + XMC_LEDTS_ACCUMULATION_COUNT_9_TIMES = 8, /**< Accumulate 9 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_10_TIMES = 9, /**< Accumulate 10 times */ + XMC_LEDTS_ACCUMULATION_COUNT_11_TIMES = 10, /**< Accumulate 11 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_12_TIMES = 11, /**< Accumulate 12 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_13_TIMES = 12, /**< Accumulate 13 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_14_TIMES = 13, /**< Accumulate 14 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_15_TIMES = 14, /**< Accumulate 15 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_16_TIMES = 15 /**< Accumulate 16 times*/ +} XMC_LEDTS_ACCUMULATION_COUNT_t; + +/** + * Defines enable/disable of common compare configuration for Touch-Sense. Use type XMC_LEDTS_COMMON_COMPARE_t + * for this enum. + */ +typedef enum XMC_LEDTS_COMMON_COMPARE +{ + XMC_LEDTS_COMMON_COMPARE_DISABLE = 0, /**< Disable common compare for touch-sense */ + XMC_LEDTS_COMMON_COMPARE_ENABLE = 1 /**< Enable common compare for touch-sense */ +} XMC_LEDTS_COMMON_COMPARE_t; + +/** + * Defines extended Touch-Sense output for pin-low-level. Use type XMC_LEDTS_EXTEND_TS_OUTPUT_t for this enum. + */ +typedef enum XMC_LEDTS_EXTEND_TS_OUTPUT +{ + XMC_LEDTS_EXTEND_TS_OUTPUT_BY_1_CLK = 0, /**< Extend Touch-Sense output for pin-low-level by 1 ledts_clk */ + XMC_LEDTS_EXTEND_TS_OUTPUT_BY_4_CLK = 1, /**< Extend Touch-Sense output for pin-low-level by 4 ledts_clk */ + XMC_LEDTS_EXTEND_TS_OUTPUT_BY_8_CLK = 2, /**< Extend Touch-Sense output for pin-low-level by 8 ledts_clk */ + XMC_LEDTS_EXTEND_TS_OUTPUT_BY_16_CLK = 3 /**< Extend Touch-Sense output for pin-low-level by 16 ledts_clk */ +} XMC_LEDTS_EXTEND_TS_OUTPUT_t; + +/** + * Defines enable/disable of Touch-Sense counter auto reset configuration. Use type XMC_LEDTS_TS_COUNTER_AUTO_RESET_t + * for this enum. + */ +typedef enum XMC_LEDTS_TS_COUNTER_AUTO_RESET +{ + XMC_LEDTS_TS_COUNTER_AUTO_RESET_DISABLE = 0, /**< Disable Touch-Sense counter automatic reset */ + XMC_LEDTS_TS_COUNTER_AUTO_RESET_ENABLE = 1 /**< Enable Touch-Sense counter automatic reset to 0x00 */ +} XMC_LEDTS_TS_COUNTER_AUTO_RESET_t; + +/** + * Defines enable/disable of Touch-Sense counter saturation configuration. Use type XMC_LEDTS_TS_COUNTER_SATURATION_t + * for this enum. + */ +typedef enum XMC_LEDTS_TS_COUNTER_SATURATION +{ + XMC_LEDTS_TS_COUNTER_SATURATION_DISABLE = 0, /**< Disabled. Touch-Sense counter overflows when it reaches 0xFF */ + XMC_LEDTS_TS_COUNTER_SATURATION_ENABLE = 1 /**< Enabled. Touch-Sense counter stops counting when it reaches 0xFF */ +} XMC_LEDTS_TS_COUNTER_SATURATION_t; + +/** + * Defines number of Touch-Sense Input (for HW pad turn control). Use type XMC_LEDTS_NUMBER_TS_INPUT_t for this enum. + */ +typedef enum XMC_LEDTS_NUMBER_TS_INPUT +{ + XMC_LEDTS_NUMBER_TS_INPUT_1 = 0, /**< Only TSIN0 is used */ + XMC_LEDTS_NUMBER_TS_INPUT_2 = 1, /**< TSIN0 & TSIN1 are used */ + XMC_LEDTS_NUMBER_TS_INPUT_3 = 2, /**< TSIN0-TSIN2 are used */ + XMC_LEDTS_NUMBER_TS_INPUT_4 = 3, /**< TSIN0-TSIN3 are used */ + XMC_LEDTS_NUMBER_TS_INPUT_5 = 4, /**< TSIN0-TSIN4 are used */ + XMC_LEDTS_NUMBER_TS_INPUT_6 = 5, /**< TSIN0-TSIN5 are used */ + XMC_LEDTS_NUMBER_TS_INPUT_7 = 6, /**< TSIN0-TSIN6 are used */ + XMC_LEDTS_NUMBER_TS_INPUT_8 = 7 /**< TSIN0-TSIN7 are used */ +} XMC_LEDTS_NUMBER_TS_INPUT_t; + +/** + * Defines level of LED column when active. Use type XMC_LEDTS_ACTIVE_LEVEL_LED_COL_t for this enum. + */ +typedef enum XMC_LEDTS_ACTIVE_LEVEL_LED_COL +{ + XMC_LEDTS_ACTIVE_LEVEL_LED_COL_LOW = 0, /**< LED column pins output low when active */ + XMC_LEDTS_ACTIVE_LEVEL_LED_COL_HIGH = 1 /**< LED column pins output high when active */ +} XMC_LEDTS_ACTIVE_LEVEL_LED_COL_t; + +/** + * Defines Number of LED columns. Use type XMC_LEDTS_NUMBER_LED_COLUMNS_t for this enum. + */ +typedef enum XMC_LEDTS_NUMBER_LED_COLUMNS +{ + XMC_LEDTS_NUMBER_LED_COLUMNS_1 = 0, /**< COLA only if TS is enabled, else COL0 only */ + XMC_LEDTS_NUMBER_LED_COLUMNS_2 = 1, /**< COLA,COL0 if TS is enabled, else COL0-1 */ + XMC_LEDTS_NUMBER_LED_COLUMNS_3 = 2, /**< COLA,COL0-1 if TS is enabled, else COL0-2 */ + XMC_LEDTS_NUMBER_LED_COLUMNS_4 = 3, /**< COLA,COL0-2 if TS is enabled, else COL0-3 */ + XMC_LEDTS_NUMBER_LED_COLUMNS_5 = 4, /**< COLA,COL0-3 if TS is enabled, else COL0-4 */ + XMC_LEDTS_NUMBER_LED_COLUMNS_6 = 5, /**< COLA,COL0-4 if TS is enabled, else COL0-5 */ + XMC_LEDTS_NUMBER_LED_COLUMNS_7 = 6, /**< COLA,COL0-5 if TS is enabled, else COL0-6 */ + XMC_LEDTS_NUMBER_LED_COLUMNS_8 = 7 /**< Only possible if TS is disabled; COLA,COL0-6 used */ +} XMC_LEDTS_NUMBER_LED_COLUMNS_t; + +/** + * Defines Interrupt flag status. Use type XMC_LEDTS_TS_INTERRUPT_FLAG_t for this enum. + */ +typedef enum XMC_LEDTS_INTERRUPT_FLAG +{ + XMC_LEDTS_INTERRUPT_FLAG_TIMESLICE = LEDTS_EVFR_TSF_Msk, /**< Time slice interrupt flag status */ + XMC_LEDTS_INTERRUPT_FLAG_TIMEFRAME = LEDTS_EVFR_TFF_Msk, /**< Time frame interrupt flag status */ + XMC_LEDTS_INTERRUPT_FLAG_TIMEPERIOD = LEDTS_EVFR_TPF_Msk, /**< Time period interrupt flag status */ + XMC_LEDTS_INTERRUPT_FLAG_TSCOUNTER_OVERFLOW = LEDTS_EVFR_TSCTROVF_Msk, /**< TS counter overflow flag status */ +} XMC_LEDTS_TS_INTERRUPT_FLAG_t; + +/** + * Defines (Extended) Time frame interrupt flag status. Use type XMC_LEDTS_TF_INTERRUPT_FLAG_t for this enum. + */ +typedef enum XMC_LEDTS_TF_INTERRUPT_FLAG +{ + XMC_LEDTS_TF_INTERRUPT_FLAG_INACTIVE = 0, /**< (Extended) Time frame interrupt not active */ + XMC_LEDTS_TF_INTERRUPT_FLAG_ACTIVE = 1 /**< (Extended) Time frame interrupt active */ +} XMC_LEDTS_TF_INTERRUPT_FLAG_t; + +/** + * Defines Autoscan time period interrupt flag status. Use type XMC_LEDTS_AUTOSCAN_INTERRUPT_FLAG_t for this enum. + */ +typedef enum XMC_LEDTS_AUTOSCAN_INTERRUPT_FLAG +{ + XMC_LEDTS_AUTOSCAN_INTERRUPT_FLAG_INACTIVE = 0, /**< Autoscan time period interrupt not active */ + XMC_LEDTS_AUTOSCAN_INTERRUPT_FLAG_ACTIVE = 1 /**< Autoscan time period interrupt active */ +} XMC_LEDTS_AUTOSCAN_INTERRUPT_FLAG_t; + +/** + * Defines Touch-Sense counter overflow indication. Use type XMC_LEDTS_TS_COUNTER_OVERLOW_FLAG_t for this enum. + */ +typedef enum XMC_LEDTS_TS_COUNTER_OVERLOW_FLAG +{ + XMC_LEDTS_TS_COUNTER_OVERLOW_FLAG_NO = 0, /**< Touch-sense counter has not overflowed */ + XMC_LEDTS_TS_COUNTER_OVERLOW_FLAG_YES = 1 /**< Touch-sense counter has overflowed at least once */ +} XMC_LEDTS_TS_COUNTER_OVERLOW_FLAG_t; + +/** + * Defines available LED columns. Use type XMC_LEDTS_LED_COLUMN_t for this enum. + */ +typedef enum XMC_LEDTS_LED_COLUMN +{ + XMC_LEDTS_LED_COLUMN_0 = 0, /**< Denotes LED Column 0 */ + XMC_LEDTS_LED_COLUMN_1 = 1, /**< Denotes LED Column 1 */ + XMC_LEDTS_LED_COLUMN_2 = 2, /**< Denotes LED Column 2 */ + XMC_LEDTS_LED_COLUMN_3 = 3, /**< Denotes LED Column 3 */ + XMC_LEDTS_LED_COLUMN_4 = 4, /**< Denotes LED Column 4 */ + XMC_LEDTS_LED_COLUMN_5 = 5, /**< Denotes LED Column 5 */ + XMC_LEDTS_LED_COLUMN_6 = 6, /**< Denotes LED Column 6 */ + XMC_LEDTS_LED_COLUMN_A = 7 /**< Denotes LED Column A */ +} XMC_LEDTS_LED_COLUMN_t; + +/** + * Defines available Touch-Sense inputs. Use type XMC_LEDTS_TS_INPUT_t for this enum. + */ +typedef enum XMC_LEDTS_TS_INPUT +{ + XMC_LEDTS_TS_INPUT_0 = 0, /**< TSIN0 - Denotes touch-sense line 1 */ + XMC_LEDTS_TS_INPUT_1 = 1, /**< TSIN1 - Denotes touch-sense line 2 */ + XMC_LEDTS_TS_INPUT_2 = 2, /**< TSIN2 - Denotes touch-sense line 3*/ + XMC_LEDTS_TS_INPUT_3 = 3, /**< TSIN3 - Denotes touch-sense line 4*/ + XMC_LEDTS_TS_INPUT_4 = 4, /**< TSIN4 - Denotes touch-sense line 5*/ + XMC_LEDTS_TS_INPUT_5 = 5, /**< TSIN5 - Denotes touch-sense line 6*/ + XMC_LEDTS_TS_INPUT_6 = 6, /**< TSIN6 - Denotes touch-sense line 7*/ + XMC_LEDTS_TS_INPUT_7 = 7 /**< TSIN7 - Denotes touch-sense line 8*/ +} XMC_LEDTS_TS_INPUT_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + /*Anonymous structure/union guard start*/ + #if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * Data structure for initialization of global features common to LED and touch-sense function. Use + * type XMC_LEDTS_GLOBAL_CONFIG_t for this structure. + */ +typedef struct XMC_LEDTS_GLOBAL_CONFIG +{ + union + { + struct + { + uint32_t : 2; + uint32_t clock_generation:1; /**< When this bit is set LEDTS counter takes its clock from another master + kernel. Kernel generates its own clock when this bit is not set (CMTR). + Refer @ref XMC_LEDTS_CLOCK_TYPE_t enum for possible values. */ + + uint32_t autoscan_synchronization:1; /**< Set this bit to synchronize start of autoscan time period with master + kernel(ENSYNC). Refer @ref XMC_LEDTS_TP_SYNC_t enum for possible values. */ + uint32_t : 4; + uint32_t suspend_response:1; /**< Suspend request configuration(SUSCFG). + Refer @ref XMC_LEDTS_SUSPEND_t enum for possible values.*/ + }; + uint32_t globctl; + }; +}XMC_LEDTS_GLOBAL_CONFIG_t; + +/** + * Data structure for LED function initialization. Use type XMC_LEDTS_LED_CONFIG_t for this structure. + */ +typedef struct XMC_LEDTS_LED_CONFIG +{ + union + { + struct + { + uint32_t : 28; + uint32_t column_active_level:1; /**< When this bit is set LED column level is active high, otherwise column + level is active low(COLLEV). Refer @ref XMC_LEDTS_ACTIVE_LEVEL_LED_COL_t + enum for possible values.*/ + + uint32_t no_of_led_columns:3; /**< Defines number of LED columns(NR_LEDCOL). Range 0 - 7. + Refer @ref XMC_LEDTS_NUMBER_LED_COLUMNS_t enum for possible values. */ + }; + uint32_t fnctl; + }; +}XMC_LEDTS_LED_CONFIG_t; + +/** + * Data structure for basic Touch-Sense function initialization. Use type XMC_LEDTS_TS_CONFIG_BASIC_t for + * this structure. + */ +typedef struct XMC_LEDTS_TS_CONFIG_BASIC +{ + union + { + struct + { + uint32_t : 16; + uint32_t no_of_accumulation:4; /**< Defines number of times touch-sense input pin is enabled in touch-sense + time slice of consecutive frames(ACCCNT). Range 0 - 15. + Refer @ref XMC_LEDTS_ACCUMULATION_COUNT_t enum type for possible values. */ + + uint32_t common_compare:1; /**< When this bit is set it enables common compare for all touch sense inputs. + Disables common compare when not set(TSCCMP). + Refer @ref XMC_LEDTS_COMMON_COMPARE_t enum for possible values.*/ + uint32_t : 2; + uint32_t counter_auto_reset:1; /**< When this bit is set TS-counter is automatically reset to 00H on first pad + turn of a new touch-sense pin(TSCTRR). + Refer @ref XMC_LEDTS_TS_COUNTER_AUTO_RESET_t enum for possible values.*/ + + uint32_t counter_saturation:1; /**< When this bit is set TS-counter stops counting in the touch-sense time slice + of the same frame when it reaches FFH (TSCTRSAT). + Refer @ref XMC_LEDTS_TS_COUNTER_SATURATION_t enum for possible values. */ + + uint32_t no_of_touch_inputs:3; /**< Defines number of touch-sense inputs (NR_TSIN). Range 0 - 7. + Refer @ref XMC_LEDTS_NUMBER_TS_INPUT_t enum for possible values. */ + }; + uint32_t fnctl; + }; +}XMC_LEDTS_TS_CONFIG_BASIC_t; + +/** + * Data structure for advanced Touch-Sense function initialization. Use type XMC_LEDTS_TS_CONFIG_ADVANCED_t + * for this structure. + */ +typedef struct XMC_LEDTS_TS_CONFIG_ADVANCED +{ + union + { + struct + { + uint32_t : 9; + uint32_t validation_mask:3; /**< This bit-field defines number of LSB bits to mask for TS counter and shadow + TS counter comparison when Time Frame validation is enabled(MASKVAL). + Refer @ref XMC_LEDTS_TS_COUNTER_MASK_t enum for possible values.*/ + + uint32_t time_frame_validation:1; /**< Disable or enable (extended) time frame validation(FENVAL). + when validation fails time frame interrupt is not triggered. + Refer @ref XMC_LEDTS_TF_VALIDATION_t enum for possible values.*/ + uint32_t : 1; + uint32_t : 1; + }; + uint32_t globctl; + }; + union + { + struct + { + uint32_t first_pad_turn:3; /**< This bit-field denotes TSIN[x] pin on which oscillations are measured + currently/next(PADT). Refer @ref XMC_LEDTS_PAD_TURN_t enum for possible + values.*/ + + uint32_t pad_turn_control:1; /**< Control pad turn via HW or SW(PADTSW). + Refer @ref XMC_LEDTS_PAD_TURN_SW_CONTROL_t enum for possible values. */ + + uint32_t external_pullup:1; /**< Disable or enable external pull-up on touch pin(EPULL). + Refer @ref XMC_LEDTS_EXT_PULLUP_COLA_t enum for possible values. */ + uint32_t : 16; + uint32_t pin_low_extend:2; /**< This bit extends touch-sense output for pin-low-level configuration for + adjustment of oscillation per user system. + Refer @ref XMC_LEDTS_EXTEND_TS_OUTPUT_t enum for possible values. */ + }; + uint32_t fnctl; + }; +}XMC_LEDTS_TS_CONFIG_ADVANCED_t; + +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif + +#ifdef __cplusplus +extern "C" { +#endif +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param config Pointer to constant LEDTS Global configuration structure. Refer @ref XMC_LEDTS_GLOBAL_CONFIG_t + * data structure.
+ * + * @return + * XMC_LEDTS_STATUS_SUCCESS - on success.
+ * XMC_LEDTS_STATUS_RUNNING - LEDTS module currently active. Refer @ref XMC_LEDTS_STATUS_t enum type.
+ * + * \parDescription
+ * Initializes and configures GLOBCTL register of \a ledts with configuration data pointed by \a config. + * \par + * This API selects clock source (GLOBCTL.CMTR), enables/disables auto scan sync(GLOBCTL.ENSYNC) & + * suspend config(GLOBCTL.SUSCFG).
+ * Call this API to initialize global register fields common to both LED and touch-sense(TS).\n + * + * \parNote
+ * LEDTS should be stopped by using XMC_LEDTS_StopCounter()before calling this API.\n + * + * \parRelated API's
+ * XMC_LEDTS_StopCounter()\n + * + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitGlobal(XMC_LEDTS_t *const ledts, const XMC_LEDTS_GLOBAL_CONFIG_t *config); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param config Pointer to constant LEDTS LED configuration structure. Refer @ref XMC_LEDTS_LED_CONFIG_t + * data structure.
+ * + * @return + * XMC_LEDTS_STATUS_SUCCESS - on success.
+ * XMC_LEDTS_STATUS_RUNNING - LEDTS module currently active/running. Refer @ref XMC_LEDTS_STATUS_t enum type.
+ * + * \parDescription
+ * Configures FNCTL register of \a ledts with configuration data pointed by \a config and enables LED functionality. + * \par + * This API sets number of LED columns(FNCTL.NR_LEDCOL), column level(FNCTL.COLLEV) and enables LED + * functionality(GLOBCTL.LD_EN). + * \par + * Call this API to Configure \a FNCTL & \a GLOBCTL registers for LED-driving function. Global initialization of + * LEDTS module should be done by calling XMC_LEDTS_InitGlobal() prior to calling this API.\n + * + * \parNote
+ * LEDTS should be stopped by using XMC_LEDTS_StopCounter() before calling this API.\n + * + * \parRelated API's
+ * XMC_LEDTS_StopCounter() XMC_LEDTS_InitGlobal()\n + * + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitLED(XMC_LEDTS_t *const ledts, const XMC_LEDTS_LED_CONFIG_t *config); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param config Pointer to constant LEDTS TS basic configuration structure. Refer @ref XMC_LEDTS_TS_CONFIG_BASIC_t + * data structure.
+ * + * @return + * XMC_LEDTS_STATUS_SUCCESS - on success.
+ * XMC_LEDTS_STATUS_RUNNING - LEDTS module currently active/running. Refer @ref XMC_LEDTS_STATUS_t enum type.
+ * + * \parDescription
+ * Configures FNCTL register of \a ledts for basic touch sense functionality with configuration data pointed by \a config + * and enables TS functionality. + * \par + * This API sets number of touch inputs(FNCTL.NR_TSIN), accumulate count on touch input(FNCTL.ACCCNT). + * \par + * This API Enables/disables common compare(FNCTL.TSCCMP), TS counter auto reset(FNCTL.TSCTRR), counter + * saturation(FNCTL.TSCTRSAT) and enables TS functionality(GLOBCTL.TS_EN). + * \par + * Call this API to configure \a FNCTL & \a GLOBCTL registers for basic touch sense function. Global initialization + * of LEDTS module should be done by calling XMC_LEDTS_InitGlobal() prior to calling this API.\n + * + * \parNote
+ * LEDTS should be stopped by using XMC_LEDTS_StopCounter() before calling this API.\n + * + * \parRelated API's
+ * XMC_LEDTS_StopCounter() XMC_LEDTS_InitGlobal()\n + * + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitTSBasic(XMC_LEDTS_t *const ledts, const XMC_LEDTS_TS_CONFIG_BASIC_t *config); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param config Pointer to constant LEDTS TS advanced configuration structure. + * Refer @ref XMC_LEDTS_TS_CONFIG_ADVANCED_t data structure.
+ * + * @return + * XMC_LEDTS_STATUS_SUCCESS - on success.
+ * XMC_LEDTS_STATUS_RUNNING - LEDTS module currently active/running. Refer @ref XMC_LEDTS_STATUS_t enum type.
+ * + * \parDescription
+ * Configures FNCTL register of \a ledts for advanced touch sense functionality with configuration data pointed by + * \a config. + * \par + * This API sets number of mask-bits for time frame validation(GLOBCTL.MASKVAL) & first touch input to be active(if + * pad turn control is set to S/W)(FNCTL.PADT). + * \par + * Enables/disables time frame interrupt(GLOBCTL.ITF_EN), external pull up on touch pin(FNCTL.EPULL) & H/W or S/W + * control of pad turn(if set to H/W, touch input activation is done in round-robin sequence, starting from TSIN0) + * (FNCTL.PADTSW). + * \par + * Call this API to initialize registers for advanced touch sense function. Before calling this API Call + * XMC_LEDTS_InitGlobal() to do Global initialization and XMC_LEDTS_InitTSBasic() to do basic init of touch-sense.\n + * + * \parNote
+ * LEDTS should be stopped by using XMC_LEDTS_StopCounter() before calling this API.\n + * + * \parRelated API's
+ * XMC_LEDTS_StopCounter(), XMC_LEDTS_InitTSBasic().\n + * + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitTSAdvanced (XMC_LEDTS_t *const ledts, const XMC_LEDTS_TS_CONFIG_ADVANCED_t *config); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param prescaler Constant prescaler value. Range: 0H to FFFFH.
+ * + * @return + * None.
+ * + * \parDescription
+ * Kick-starts the LEDTS module by programming CLK_PS bit field of GLOBCTL register with \a prescaler value to start + * the LEDTS-counter. + * \par + * To set LEDTS counter at least one of the touch-sense or LED function should be enabled. + * Call this API to start LEDTS counter.\n + * + * \parNote
+ * This should be called after all used modules have been initialized.\n + * + * \parRelated API's
+ * XMC_LEDTS_StopCounter(), XMC_LEDTS_InitLED(), XMC_LEDTS_InitTSBasic(), XMC_LEDTS_InitTSAdvanced().\n + * + */ +void XMC_LEDTS_StartCounter(XMC_LEDTS_t *const ledts, const uint16_t prescaler); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * + * @return + * None.
+ * + * \parDescription
+ * Stops the LEDTS module by programming the CLK_PS bit field(with value = 0) of GLOBCTL register.
+ * This could be done when it is required to change some module configuration which requires the LEDTS-counter + * to be stopped before the register bit/bit field can be programmed.
Call this API to stop LEDTS counter.\n + * + * \parRelated API's
+ * XMC_LEDTS_StartCounter(), XMC_LEDTS_InitLED(), XMC_LEDTS_InitTSBasic(), XMC_LEDTS_InitTSAdvanced().\n + * + */ +void XMC_LEDTS_StopCounter(XMC_LEDTS_t *const ledts); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param interrupt_mask mask value of @ref XMC_LEDTS_INTERRUPT_t enum type.
+ * + * @return + * None.
+ * + * \parDescription
+ * Enables requested interrupt type by configuring GLOBCTL register with masked value \a interrupt_mask.
+ * \par + * This API can be used to enable time slice(GLOBCTL.ITS_EN) or time frame(GLOBCTL.ITF_EN )or time period + * (GLOBCTL.ITP_EN)interrupt or any combination of these interrupts by passing appropriate bitwise ORed mask value.\n + * + * \parRelated API's
+ * XMC_LEDTS_DisableInterrupt().\n + * + */ +__STATIC_INLINE void XMC_LEDTS_EnableInterrupt(XMC_LEDTS_t *const ledts, uint32_t interrupt_mask) +{ + XMC_ASSERT("XMC_LEDTS_EnableInterrupt:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + ledts->GLOBCTL |= interrupt_mask; +} + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param interrupt_mask mask value of @ref XMC_LEDTS_INTERRUPT_t enum type.
+ * + * @return + * None.
+ * + * \parDescription
+ * Disables requested interrupt type by configuring GLOBCTL register with masked value \a interrupt_mask.
+ * \par + * This API can be used to disable time slice(GLOBCTL.ITS_EN) or time frame(GLOBCTL.ITF_EN )or time period + * (GLOBCTL.ITP_EN)interrupt or any combination of these interrupts by passing appropriate bitwise ORed mask value.\n + * + * \parRelated API's
+ * XMC_LEDTS_EnableInterrupt().\n + * + */ +__STATIC_INLINE void XMC_LEDTS_DisableInterrupt(XMC_LEDTS_t *const ledts, uint32_t interrupt_mask) +{ + XMC_ASSERT("XMC_LEDTS_DisableInterrupt:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + ledts->GLOBCTL &= ~interrupt_mask; +} + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * + * @return + * Status flags for events. Possible event flags are 0x01(time slice), 0x02(time frame), + 0x04(time period), 0x08(TS counter overflow).
+ * + * \parDescription
+ * Returns interrupt status flag by reading TSF(time slice), TFF(time frame), TPF(time period), TSCTROVF + * (touch sense counter overflow) fields of EVFR register.
+ * Typically used in interrupt handler to find out which event has triggered the interrupt.\n + * + * \parNote
+ * These flags are set on event regardless of corresponding interrupt is enabled or not.\n + * + * \parRelated API's
+ * XMC_LEDTS_ClearInterruptFlag().\n + * + */ +uint32_t XMC_LEDTS_ReadInterruptFlag(XMC_LEDTS_t *const ledts); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param interrupt_mask mask value of @ref XMC_LEDTS_INTERRUPT_t enum type.
+ * + * @return + * None.
+ * + * \parDescription
+ * Clears interrupt status flags in EVFR register as indicated by mask value \a interrupt_mask.
+ * This API sets EVFR.CTSF, EVFR.CTFF, EVFR.CTPF bit fields to clear time slice, time frame or time period interrupts + * respectively. + * \par + * Typically used along with XMC_LEDTS_ReadInterruptFlag() to figure out which event triggered the interrupt.\n + * + * \parNote
+ * Calling this API moves interrupt from pending/active state to inactive state. If the interrupt is pulsed, + * failing to clear the event bit might cause CPU to immediately re-enter the interrupt service routine(ISR).\n + * + * \parRelated API's
+ * XMC_LEDTS_ReadInterruptFlag().\n + * + */ +void XMC_LEDTS_ClearInterruptFlag(XMC_LEDTS_t *const ledts, uint32_t interrupt_mask); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param pad_num Pad number. Range refer @ref XMC_LEDTS_NUMBER_TS_INPUT_t enum type.
+ * + * @return + * None.
+ * + * \parDescription
+ * Sets TSIN[x] (where x corresponds to \a active pad number to be set) field of TSIN[x](x = 0-7) .
+ * This is the TSIN[x] pin that is next or currently active in pad turn.
+ * Call this API to set the active pad turn. + * \par + * Touch sense functionality should be initialized and configured before calling this API.\n + * + */ +void XMC_LEDTS_SetActivePADNo(XMC_LEDTS_t *const ledts, XMC_LEDTS_NUMBER_TS_INPUT_t pad_num); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param column Column number. Range refer @ref XMC_LEDTS_LED_COLUMN_t enum type.
+ * @param pattern Pattern to be displayed. Range: 0H to FFH.
+ * + * @return + * None.
+ * + * \parDescription
+ * Sets LINE_x (where x corresponds to \a column number) field of LINEx(x = 0-1) register to \a pattern value.
+ * This value is output on LINE_x when LED \a column x is active.
Call this API to set desired LED pattern. + * \par + * LED functionality should be initialized and configured before calling this API.\n + * + */ +void XMC_LEDTS_SetLEDLinePattern(XMC_LEDTS_t *const ledts, XMC_LEDTS_LED_COLUMN_t column, const uint8_t pattern); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param column Column number. Range refer @ref XMC_LEDTS_LED_COLUMN_t enum type.
+ * @param brightness LED brightness level. Range: 0H(min brightness) to FFH(max brightness).
+ * + * @return + * None.
+ * + * \parDescription
+ * Programs CMP_LDx (where x denotes \a column number) field of LDCMPx(x = 0-1)register to the requested \a brightness + * level. + * \par + * The LDCMPx registers hold the COMPARE values for their respective LED columns. These values are used for LED + * brightness control. Call this API to control brightness level of the LED. + * \par + * LED functionality should be initialized and configured before calling this API.\n + * + */ +void XMC_LEDTS_SetColumnBrightness(XMC_LEDTS_t *const ledts, XMC_LEDTS_LED_COLUMN_t column, const uint8_t brightness); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param common_size Requested common oscillation window width. Range: FFH(min) to 00H.(max)
+ * + * @return + * None.
+ * + * \parDescription
+ * Programs the respective LDCMP1 register bit field CMP_LDA_TSCOM with \a common_size. + * \par + * Call this API to adjust the size of the common oscillation window to increase/decrease the number of recorded + * number of oscillation counts for all touch-sense inputs.\n + * + */ +void XMC_LEDTS_SetCommonOscillationWindow(XMC_LEDTS_t *const ledts, const uint8_t common_size); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * + * @return + * uint32_t Previous active LED column number. Range: 0 to 7.
+ * + * \parDescription
+ * Returns active LED column number in previous time-slice by reading FNCOL bit field of FNCTL register. + * Call this API to figure out active column during previous time slice.\n + * + */ +uint32_t XMC_LEDTS_ReadFNCOL(XMC_LEDTS_t *const ledts); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure
+ * @param count Number of LED columns to be enabled. Range: 0 to 7.
+ * + * @return + * None.
+ * + * \parDescription
+ * Sets \a count number of LED columns active by programming NR_LEDCOL bit field of FNCTL register.
+ * \par + * Call this API to set desired number of LED columns active.\n + * + * \parNote
+ * NR_LEDCOL bit field can only be modified when LEDTS counter is not running, use XMC_LEDTS_StopCounter() + * to stop LEDTS module before calling this API.\n + * + * \parRelated API's
+ * XMC_LEDTS_StopCounter().\n + */ +void XMC_LEDTS_SetNumOfLEDColumns(XMC_LEDTS_t *const ledts, uint8_t count); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * + * @return + * uint16_t Shadow touch sense counter value. Range: 0H to FFFFH.
+ * + * \parDescription
+ * Returns latched touch sense counter value by reading the TSCTRVALR field of TSVAL register.
+ * \par + * This API is typically called in time frame(TF) event handler to get oscillation count of the touch-sense input + * active in previous time frame.\n + * + * \parNote
+ * This is the latched value of the TS-counter(on every extended time frame event).\n + * + * \parRelated API's
+ * XMC_LEDTS_ReadInterruptFlag().\n + */ +uint16_t XMC_LEDTS_ReadTSVAL(XMC_LEDTS_t *const ledts); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param touchpad Touch-sense input pad number. Range refer @ref XMC_LEDTS_NUMBER_TS_INPUT_t enum type.
+ * @param size Requested oscillation window width. Range: 0H(max) to FFH(min).
+ * + * @return + * None.
+ * + * \parDescription
+ * Sets the size of \a touchpad touch sense oscillation window to \a size. + * \par + * This API programs the respective CMP_TSx(where x is \a touchpad number) bit fields of TSCMPx(x = 0-1) register. + * \a size value determines the size of the pad oscillation window for each pad input lines during their pad turn. + * \par + * Call this API to increase/decrease recorded number of oscillation counts for the requested touch-sense input.\n + * + */ +void XMC_LEDTS_SetOscillationWindow(XMC_LEDTS_t *const ledts, XMC_LEDTS_NUMBER_TS_INPUT_t touchpad, const uint8_t size); + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* LEDTS0 */ + +#endif /* XMC_LEDTS_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_math.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_math.h new file mode 100644 index 00000000..7fcfd150 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_math.h @@ -0,0 +1,1088 @@ +/** + * @file xmc_math.h + * @date 2015-10-08 + * + * @cond + ********************************************************************************** + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification,are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share + * modifications, enhancements or bug fixes with Infineon Technologies AG + * dave@infineon.com). + ********************************************************************************** + * + * Change History + * -------------- + * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * - Updated copyright and change history section. + * + * 2015-08-25: + * - XMC_MATH_ClearEvent() API is updated to set the event clear flag bit.
+ * + * 2015-09-23: + * - Added SQRT functions + * + * 2015-10-08: + * - Return values for sin(), cos(), sinh(), cosh(), arctan() are corrected. + * + * @endcond + * + */ + +#ifndef XMC_MATH_H +#define XMC_MATH_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +#if defined(MATH) +#include + +/** + * @addtogroup XMClib + * @{ + */ + +/** + * @addtogroup MATH + * @{ + * @brief MATH Coprocessor (MATH) driver for the XMC1302 microcontroller family
+ * + * The MATH Coprocessor (MATH) module comprises of two independent sub-blocks to support the CPU in math-intensive + * computations: a Divider Unit (DIV) for signed and unsigned 32-bit division operations and a CORDIC + * (COrdinate Rotation DIgital Computer) Coprocessor for computation of trigonometric, linear or hyperbolic functions.
+ * + * MATH driver features: + * -# CORDIC Coprocessor is used for computation of trigonometric and hyperbolic functions + * -# Supports result chaining between the Divider Unit and CORDIC Coprocessor + * -# All MATH APIs are available in Blocking and non-blocking modes. Non-blocking APIs are suffixed with NB. + * -# 32bit signed and unsigned division implementations available for __aeabi_uidiv(), __aeabi_idiv(), __aeabi_uidivmod(), __aeabi_idivmod() + * -# Divider and CORDIC unit busy status can be checked by XMC_MATH_DIV_IsBusy() and XMC_MATH_CORDIC_IsBusy() + * -# Individual APIs available to return the result of each non-blocking MATH function + * + * Note:
+ * All non-blocking MATH APIs are not atomic and hence occurence of interrupts during the normal execution of + * these APIs may lead to erroneous results. User has to exercise caution while using these APIs. + * + * Example: + * Execution of divide instruction (/) in an ISR during the normal execution of non-blocking APIs may give erroneous results. + * + */ + + +/********************************************************************************************************************* + * TYPE DEFINITIONS + ********************************************************************************************************************/ +/** + * @brief This typedef is used for Input and Output Data representation in blocking & non-blocking functions. + * XMC_MATH_Q0_23_t => 1 Signed bit, 0 Integer bits, 23 fraction bits. + */ +typedef int32_t XMC_MATH_Q0_23_t; + +/** + * @brief This typedef is used for Input Data representation in blocking & non-blocking functions. + * XMC_MATH_Q8_15_t => 1 Signed bit, 8 Integer bits, 15 fraction bits. + */ +typedef int32_t XMC_MATH_Q8_15_t; + +/** + * @brief This typedef is used for Output Data representation in blocking & non-blocking functions. + * XMC_MATH_Q1_22_t => 1 Signed bit, 1 Integer bits, 22 fraction bits. + */ +typedef int32_t XMC_MATH_Q1_22_t; + +/** + * @brief This typedef is used for Output Data representation in blocking & non-blocking functions. + * XMC_MATH_Q0_11_t => 1 Signed bit, 0 Integer bits, 11 fraction bits. + */ +typedef int32_t XMC_MATH_Q0_11_t; + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +/* Utility macros */ +#define XMC_MATH_Q0_23(x) ((XMC_MATH_Q0_23_t)(((x) >= 0) ? ((x) * (1 << 23) + 0.5) : ((x) * (1 << 23) - 0.5))) /**< Converts the given number to XMC_MATH_Q0_23_t format */ +#define XMC_MATH_Q0_11(x) ((XMC_MATH_Q0_11_t)(((x) >= 0) ? ((x) * (1 << 11) + 0.5) : ((x) * (1 << 11) - 0.5))) /**< Converts the given number to XMC_MATH_Q0_11_t format */ + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/** + * @brief Service request events for the DIV and CORDIC modules + */ +typedef enum XMC_MATH_EVENT +{ + XMC_MATH_EVENT_DIV_END_OF_CALC = 1U, /**< Divider end of calculation event */ + XMC_MATH_EVENT_DIV_ERROR = 2U, /**< Divider error event */ + XMC_MATH_EVENT_CORDIC_END_OF_CALC = 4U, /**< CORDIC end of calculation event */ + XMC_MATH_EVENT_CORDIC_ERROR = 8U /**< CORDIC error event */ +} XMC_MATH_EVENT_t; + +/** + * @brief Dividend Register Result Chaining + */ +typedef enum XMC_MATH_DIV_DVDRC +{ + XMC_MATH_DIV_DVDRC_DISABLED = 0U << MATH_GLBCON_DVDRC_Pos, /**< No result chaining is selected */ + XMC_MATH_DIV_DVDRC_QUOT_IS_SOURCE = 1U << MATH_GLBCON_DVDRC_Pos, /**< QUOT register is the selected source */ + XMC_MATH_DIV_DVDRC_RMD_IS_SOURCE = 2U << MATH_GLBCON_DVDRC_Pos, /**< RMD register is the selected source */ + XMC_MATH_DIV_DVDRC_CORRX_IS_SOURCE = 3U << MATH_GLBCON_DVDRC_Pos, /**< CORRX is the selected source */ + XMC_MATH_DIV_DVDRC_CORRY_IS_SOURCE = 4U << MATH_GLBCON_DVDRC_Pos, /**< CORRY is the selected source */ + XMC_MATH_DIV_DVDRC_CORRZ_IS_SOURCE = 5U << MATH_GLBCON_DVDRC_Pos /**< CORRZ is the selected source */ +} XMC_MATH_DIV_DVDRC_t; + +/** + * @brief Divisor Register Result Chaining + */ +typedef enum XMC_MATH_DIV_DVSRC +{ + XMC_MATH_DIV_DVSRC_DISABLED = 0U << MATH_GLBCON_DVSRC_Pos, /**< No result chaining is selected */ + XMC_MATH_DIV_DVSRC_QUOT_IS_SOURCE = 1U << MATH_GLBCON_DVSRC_Pos, /**< QUOT register is the selected source */ + XMC_MATH_DIV_DVSRC_RMD_IS_SOURCE = 2U << MATH_GLBCON_DVSRC_Pos, /**< RMD register is the selected source */ + XMC_MATH_DIV_DVSRC_CORRX_IS_SOURCE = 3U << MATH_GLBCON_DVSRC_Pos, /**< CORRX is the selected source */ + XMC_MATH_DIV_DVSRC_CORRY_IS_SOURCE = 4U << MATH_GLBCON_DVSRC_Pos, /**< CORRY is the selected source */ + XMC_MATH_DIV_DVSRC_CORRZ_IS_SOURCE = 5U << MATH_GLBCON_DVSRC_Pos /**< CORRZ is the selected source */ +} XMC_MATH_DIV_DVSRC_t; + +/** + * @brief CORDX Register Result Chaining + */ +typedef enum XMC_MATH_CORDIC_CORDXRC +{ + XMC_MATH_CORDIC_CORDXRC_DISABLED = 0U << MATH_GLBCON_CORDXRC_Pos, /**< No result chaining is selected */ + XMC_MATH_CORDIC_CORDXRC_QUOT_IS_SOURCE = 1U << MATH_GLBCON_CORDXRC_Pos, /**< QUOT register is the selected source */ + XMC_MATH_CORDIC_CORDXRC_RMD_IS_SOURCE = 2U << MATH_GLBCON_CORDXRC_Pos /**< RMD register is the selected source */ +} XMC_MATH_CORDIC_CORDXRC_t; + +/** + * @brief CORDY Register Result Chaining + */ +typedef enum XMC_MATH_CORDIC_CORDYRC +{ + XMC_MATH_CORDIC_CORDYRC_DISABLED = 0U << MATH_GLBCON_CORDYRC_Pos, /**< No result chaining is selected */ + XMC_MATH_CORDIC_CORDYRC_QUOT_IS_SOURCE = 1U << MATH_GLBCON_CORDYRC_Pos, /**< QUOT register is the selected source */ + XMC_MATH_CORDIC_CORDYRC_RMD_IS_SOURCE = 2U << MATH_GLBCON_CORDYRC_Pos /**< RMD register is the selected source */ +} XMC_MATH_CORDIC_CORDYRC_t; + +/** + * @brief CORDZ Register Result Chaining + */ +typedef enum XMC_MATH_CORDIC_CORDZRC +{ + XMC_MATH_CORDIC_CORDZRC_DISABLED = 0U << MATH_GLBCON_CORDZRC_Pos, /**< No result chaining is selected */ + XMC_MATH_CORDIC_CORDZRC_QUOT_IS_SOURCE = 1U << MATH_GLBCON_CORDZRC_Pos, /**< QUOT register is the selected source */ + XMC_MATH_CORDIC_CORDZRC_RMD_IS_SOURCE = 2U << MATH_GLBCON_CORDZRC_Pos /**< RMD register is the selected source */ +} XMC_MATH_CORDIC_CORDZRC_t; +/** + * @brief CORDIC operating mode + */ +typedef enum XMC_MATH_CORDIC_OPERATING_MODE +{ + XMC_MATH_CORDIC_OPERATING_MODE_LINEAR = 0U << MATH_CON_MODE_Pos, /**< Linear mode */ + XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR = 1U << MATH_CON_MODE_Pos, /**< Circular mode */ + XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC = 3U << MATH_CON_MODE_Pos /**< Hyperbolic mode */ +} XMC_MATH_CORDIC_OPERATING_MODE_t; + +/** + * @brief Rotation vectoring selection + */ +typedef enum XMC_MATH_CORDIC_ROTVEC_MODE +{ + XMC_MATH_CORDIC_ROTVEC_MODE_VECTORING = 0U << MATH_CON_ROTVEC_Pos, /**< Vectoring mode */ + XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION = 1U << MATH_CON_ROTVEC_Pos /**< Rotation mode */ +} XMC_MATH_CORDIC_ROTVEC_MODE_t; + +/** + * @brief Calculated value of CORRX and CORRY are each divided by this factor to yield the result. + */ +typedef enum XMC_MATH_CORDIC_MAGNITUDE +{ + XMC_MATH_CORDIC_MAGNITUDE_DIVBY1 = 0U << MATH_CON_MPS_Pos, /**< Divide by 1 */ + XMC_MATH_CORDIC_MAGNITUDE_DIVBY2 = 1U << MATH_CON_MPS_Pos, /**< Divide by 2 */ + XMC_MATH_CORDIC_MAGNITUDE_DIVBY4 = 2U << MATH_CON_MPS_Pos, /**< Divide by 4 */ +} XMC_MATH_CORDIC_MAGNITUDE_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * API Prototypes - General + ********************************************************************************************************************/ + +/** + * + * @return None + * + * \parDescription:
+ * Enables the Math module by un-gating the clock. + * + * \par + * MATH coprocessor's clock is enabled by setting \a MATH bit of \a CGATCLR0 register. + * + * \parRelated APIs:
+ * XMC_MATH_Disable()\n\n\n + * + */ +__STATIC_INLINE void XMC_MATH_Enable(void) +{ + /* Un-gates clock to the MATH kernel */ + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_MATH); +} + +/** + * + * @return None + * + * \parDescription:
+ * Disables the Math module by gating the clock. + * + * \par + * MATH coprocessor's clock is disabled by setting \a MATH bit of \a CGATSET0 register. + * + * \parRelated APIs:
+ * XMC_MATH_Disable()\n\n\n + * + */ +__STATIC_INLINE void XMC_MATH_Disable(void) +{ + /* Gates clock to the MATH kernel */ + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_MATH); +} + +/** + * + * @return bool \n + * true - if DIV unit is busy + * false - if DIV unit is not busy + * + * \parDescription:
+ * Utility function to check if the DIV unit is busy. + * + * \par + * Divider unit status is determined by reading \a BSY bit of \a DIVST register. + * + */ +bool XMC_MATH_DIV_IsBusy(void); + +/** + * + * @return bool \n + * true - if CORDIC unit is busy\n + * false - if CORDIC unit is not busy + * + * \parDescription:
+ * Utility function to check if the DIV unit is busy. + * + * \par + * CORDIC coprocessor's status is determined by reading \a BSY bit of \a STATC register. + * + */ +bool XMC_MATH_CORDIC_IsBusy(void); + +/** + * @param event Event of type XMC_MATH_EVENT_t + * + * @return bool\n + * true - if status is set\n + * false - if status is not set + * + * \parDescription:
+ * Returns the status of the requested event. + * + * \par + * Status of DIV & CORDIC unit's event (end of calculation & error) status is determined by reading \a EVFR register. + * + * \parRelated APIs:
+ * XMC_MATH_EnableEvent(), XMC_MATH_DisableEvent(), XMC_MATH_SetEvent(), XMC_MATH_ClearEvent()\n\n\n + * + */ +bool XMC_MATH_GetEventStatus(const XMC_MATH_EVENT_t event); + +/** + * @param event Event of type XMC_MATH_EVENT_t + * + * @return None + * + * \parDescription:
+ * Enables the requested event. + * + * \par + * DIV & CORDIC unit's event (end of calculation & error) is enabled by setting bit-fields of \a EVIER register. + * + * \parRelated APIs:
+ * XMC_MATH_GetEventStatus(), XMC_MATH_DisableEvent()\n\n\n + * + */ +__STATIC_INLINE void XMC_MATH_EnableEvent(const XMC_MATH_EVENT_t event) +{ + MATH->EVIER |= (uint32_t) event; +} + +/** + * @param event Event of type XMC_MATH_EVENT_t + * + * @return None + * + * \parDescription:
+ * Disables the requested event. + * + * \par + * DIV & CORDIC unit's event (end of calculation & error) is disabled by clearing bit-fields of \a EVIER register. + * + * \parRelated APIs:
+ * XMC_MATH_GetEventStatus(), XMC_MATH_EnableEvent()\n\n\n + * + */ +__STATIC_INLINE void XMC_MATH_DisableEvent(const XMC_MATH_EVENT_t event) +{ + MATH->EVIER &= ~((uint32_t) event); +} + +/** + * @param event Event of type XMC_MATH_EVENT_t + * + * @return None + * + * \parDescription:
+ * Sets the requested event. This is a software setting for the event. + * + * \par + * DIV & CORDIC unit's event (end of calculation & error) is set by setting bit-fields of \a EVFSR register. + * + * \parRelated APIs:
+ * XMC_MATH_ClearEvent()\n\n\n + * + */ +__STATIC_INLINE void XMC_MATH_SetEvent(const XMC_MATH_EVENT_t event) +{ + MATH->EVFSR |= (uint32_t) event; +} + +/** + * @param event Event of type XMC_MATH_EVENT_t + * + * @return None + * + * \parDescription:
+ * Clears the requested event. + * + * \par + * DIV & CORDIC unit's event (end of calculation & error) is cleared by setting bit-fields of \a EVFCR register. + * + * \parRelated APIs:
+ * XMC_MATH_SetEvent()\n\n\n + * + */ +__STATIC_INLINE void XMC_MATH_ClearEvent(const XMC_MATH_EVENT_t event) +{ + MATH->EVFCR |= (uint32_t) event; +} + +/** + * @return XMC_MATH_Q0_23_t + * + * \parDescription:
+ * Returns result of a Cosine operation. + * + * \par + * Most significant 24 bits of \a CORRX register returns the result of Cosine operation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_CosNB()\n\n\n + * + */ +__STATIC_INLINE XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetCosResult(void) +{ + return ((XMC_MATH_Q0_23_t) (((int32_t)MATH->CORRX) >> MATH_CORRX_RESULT_Pos)); +} + +/** + * @return XMC_MATH_Q0_23_t + * + * \parDescription:
+ * Returns result of a Sine operation. + * + * \par + * Most significant 24 bits of \a CORRY register returns the result of Sine operation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_SinNB()\n\n\n + * + */ +__STATIC_INLINE XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetSinResult(void) +{ + return ((XMC_MATH_Q0_23_t) (((int32_t)MATH->CORRY) >> MATH_CORRY_RESULT_Pos)); +} + +/** + * @return XMC_MATH_Q0_11_t + * + * \parDescription:
+ * Returns result of a Tangent operation. + * + * \par + * \a QUOT register returns the result of Tangent operation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_TanNB()\n\n\n + * + */ +__STATIC_INLINE XMC_MATH_Q0_11_t XMC_MATH_CORDIC_GetTanResult(void) +{ + return ((XMC_MATH_Q0_11_t) MATH->QUOT); +} + +/** + * @return XMC_MATH_Q0_23_t + * + * \parDescription:
+ * Returns result of a Arc Tangent operation. + * + * \par + * Most significant 24 bits of \a CORRZ register returns the result of Arc Tangent operation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_ArcTanNB()\n\n\n + * + */ +__STATIC_INLINE XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetArcTanResult(void) +{ + return ((XMC_MATH_Q0_23_t) (((int32_t)MATH->CORRZ) >> MATH_CORRZ_RESULT_Pos)); +} + +/** + * @return XMC_MATH_Q1_22_t + * + * \parDescription:
+ * Returns result of a Hyperbolic Cosine operation. + * + * \par + * Most significant 24 bits of \a CORRX register returns the result of Hyperbolic Cosine operation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_CoshNB()\n\n\n + * + */ +__STATIC_INLINE XMC_MATH_Q1_22_t XMC_MATH_CORDIC_GetCoshResult(void) +{ + return ((XMC_MATH_Q1_22_t) (((int32_t)MATH->CORRX) >> MATH_CORRX_RESULT_Pos)); +} + +/** + * @return XMC_MATH_Q1_22_t + * + * \parDescription:
+ * Returns result of a Hyperbolic Sine operation. + * + * \par + * Most significant 24 bits of \a CORRY register returns the result of Hyperbolic Sine operation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_SinhNB()\n\n\n + * + */ +__STATIC_INLINE XMC_MATH_Q1_22_t XMC_MATH_CORDIC_GetSinhResult(void) +{ + return ((XMC_MATH_Q1_22_t) (((int32_t)MATH->CORRY) >> MATH_CORRY_RESULT_Pos)); +} + +/** + * @return XMC_MATH_Q0_11_t + * + * \parDescription:
+ * Returns result of a Hyperbolic Tangent operation. + * + * \par + * \a QUOT register returns the result of Hyperbolic Tangent operation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_TanhNB()\n\n\n + * + */ +__STATIC_INLINE XMC_MATH_Q0_11_t XMC_MATH_CORDIC_GetTanhResult(void) +{ + return ((XMC_MATH_Q0_11_t) MATH->QUOT); +} + +/** + * @return uint32_t + * + * \parDescription:
+ * Returns result of a Unsigned Division operation. + * + * \par + * \a QUOT register returns the result of Unsigned Division operation. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_UnsignedDivNB()\n\n\n + * + */ +__STATIC_INLINE uint32_t XMC_MATH_DIV_GetUnsignedDivResult(void) +{ + return ((uint32_t) MATH->QUOT); +} + +/** + * @return uint32_t + * + * \parDescription:
+ * Returns result of a Unsigned Modulo operation. + * + * \par + * \a RMD register returns the result of Unsigned Modulo operation. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_UnsignedModNB()\n\n\n + * + */ +__STATIC_INLINE uint32_t XMC_MATH_DIV_GetUnsignedModResult(void) +{ + return ((uint32_t) MATH->RMD); +} + +/** + * @return int32_t + * + * \parDescription:
+ * Returns result of a Signed Division operation. + * + * \par + * \a QUOT register returns the result of Signed Division operation. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_SignedDivNB()\n\n\n + * + */ +__STATIC_INLINE int32_t XMC_MATH_DIV_GetSignedDivResult(void) +{ + return ((int32_t) MATH->QUOT); +} + +/** + * @return int32_t + * + * \parDescription:
+ * Returns result of a Signed Modulo operation. + * + * \par + * \a RMD register returns the result of Signed Modulo operation. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_SignedModNB()\n\n\n + * + */ +__STATIC_INLINE int32_t XMC_MATH_DIV_GetSignedModResult(void) +{ + return ((int32_t) MATH->RMD); +} + +/*********************************************************************************************************************** + * API Prototypes - Blocking functions + **********************************************************************************************************************/ +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return XMC_MATH_Q0_23_t
+ * + * \parDescription:
+ * Computes the cosine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * + * \par + * This function programs CORDIC to rotation & circular mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. + * Most significant 24 bits of \a CORRX register returns the result of the operation. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_Sin(), XMC_MATH_CORDIC_Tan()\n\n\n + * + */ +XMC_MATH_Q0_23_t XMC_MATH_CORDIC_Cos(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return XMC_MATH_Q0_23_t
+ * + * \parDescription:
+ * Computes the sine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * + * \par + * This function programs CORDIC to rotation & circular mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. + * Most significant 24 bits of \a CORRY register returns the result of the operation. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_Cos(), XMC_MATH_CORDIC_Tan()\n\n\n + * + */ +XMC_MATH_Q0_23_t XMC_MATH_CORDIC_Sin(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return XMC_MATH_Q0_11_t
+ * + * \parDescription:
+ * Computes the tangent for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * + * \par + * This function programs CORDIC to rotation & circular mode. + * Chains the results of Cosine (\a CORRX) and Sine (\a CORRY) as a dividend and divisor by configuring \a GLBCON register. + * \a CORDZ register is programmed with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. + * Most significant 24 bits of \a CORRY register returns the result of the operation. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_Sin(), XMC_MATH_CORDIC_Cos()\n\n\n + * + */ +XMC_MATH_Q0_11_t XMC_MATH_CORDIC_Tan(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * + * @param x Value representing the proportion of the x-coordinate (XMC_MATH_Q8_15_t format) + * @param y Value representing the proportion of the y-coordinate (XMC_MATH_Q8_15_t format) + * + * @return XMC_MATH_Q0_23_t
+ * + * \parDescription:
+ * Computes the principal value arc tangent of an angle of y/x expressed in radians. + * The input radians must be in XMC_MATH_Q8_15_t format. + * + * \par + * This function programs CORDIC as circular mode. + * \a CORDY register is programmed with input \a y and \a CORDX register is programmed with input \a x. + * Most significant 24 bits of \a CORRZ register returns the result of the operation. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + */ +XMC_MATH_Q0_23_t XMC_MATH_CORDIC_ArcTan(XMC_MATH_Q8_15_t x, XMC_MATH_Q8_15_t y); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return XMC_MATH_Q1_22_t
+ * + * \parDescription:
+ * Computes the hyperbolic cosine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * + * \par + * This function programs CORDIC to rotation & hyperbolic mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. + * Most significant 24 bits of \a CORRX register returns the result of the operation. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_Sinh(), XMC_MATH_CORDIC_Tanh()\n\n\n + * + */ +XMC_MATH_Q1_22_t XMC_MATH_CORDIC_Cosh(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return XMC_MATH_Q1_22_t
+ * + * \parDescription:
+ * Computes the hyperbolic sine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * + * \par + * This function programs CORDIC to rotation & hyperbolic mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. + * Most significant 24 bits of \a CORRY register returns the result of the operation. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_Cosh(), XMC_MATH_CORDIC_Tanh()\n\n\n + * + */ +XMC_MATH_Q1_22_t XMC_MATH_CORDIC_Sinh(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return XMC_MATH_Q0_11_t
+ * + * \parDescription:
+ * Computes the hyperbolic tangent for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * + * \par + * This function programs CORDIC to rotation & hyperbolic mode. + * Chains the results of Cosine (\a CORRX) and Sine (\a CORRY) as a dividend and divisor by configuring \a GLBCON register. + * \a CORDZ register is programmed with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. + * \a QUOT register returns the result of the operation. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_Sinh(), XMC_MATH_CORDIC_Cosh()()\n\n\n + * + */ +XMC_MATH_Q0_11_t XMC_MATH_CORDIC_Tanh(XMC_MATH_Q0_23_t angle_in_radians); + +/*********************************************************************************************************************** + * API Prototypes - Non blocking functions + **********************************************************************************************************************/ +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return None
+ * + * \parDescription:
+ * Computes the cosine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * Call XMC_MATH_CORDIC_GetCosResult() API to get the result. + * + * \par + * This function programs CORDIC to rotation & circular mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_GetCosResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_CORDIC_CosNB(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return None
+ * + * \parDescription:
+ * Computes the sine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * Call XMC_MATH_CORDIC_GetSinResult() API to get the result. + * + * \par + * This function programs CORDIC to rotation & circular mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_GetSinResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_CORDIC_SinNB(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return None
+ * + * \parDescription:
+ * Computes the tangent for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * Call XMC_MATH_CORDIC_GetTanResult() API to get the result. + * + * \par + * This function programs CORDIC to rotation & circular mode. + * Chains the results of Cosine (\a CORRX) and Sine (\a CORRY) as a dividend and divisor by configuring \a GLBCON register. + * \a CORDZ register is programmed with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_GetTanResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_CORDIC_TanNB(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * + * @param x Value representing the proportion of the x-coordinate (XMC_MATH_Q8_15_t format) + * @param y Value representing the proportion of the y-coordinate (XMC_MATH_Q8_15_t format) + * + * @return None
+ * + * \parDescription:
+ * Computes the principal value arc tangent of an angle of y/x expressed in radians. + * The input radians must be in XMC_MATH_Q8_15_t format. + * Call XMC_MATH_CORDIC_GetArcTanResult() API to get the result. + * + * \par + * This function programs CORDIC as circular mode. + * \a CORDY register is programmed with input \a y and \a CORDX register is programmed with input \a x. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_GetArcTanResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_CORDIC_ArcTanNB(XMC_MATH_Q8_15_t x, XMC_MATH_Q8_15_t y); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return None
+ * + * \parDescription:
+ * Computes the hyperbolic cosine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * Call XMC_MATH_CORDIC_GetCoshResult() API to get the result. + * + * \par + * This function programs CORDIC to rotation & hyperbolic mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_GetCoshResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_CORDIC_CoshNB(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return None
+ * + * \parDescription:
+ * Computes the hyperbolic sine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * Call XMC_MATH_CORDIC_GetSinhResult() API to get the result. + * + * \par + * This function programs CORDIC to rotation & hyperbolic mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_GetSinhResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_CORDIC_SinhNB(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return None
+ * + * \parDescription:
+ * Computes the hyperbolic tangent for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * Call XMC_MATH_CORDIC_GetTanhResult() API to get the result. + * + * \par + * This function programs CORDIC to rotation & hyperbolic mode. + * Chains the results of Cosine (\a CORRX) and Sine (\a CORRY) as a dividend and divisor by configuring \a GLBCON register. + * \a CORDZ register is programmed with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_GetTanhResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_CORDIC_TanhNB(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param dividend - Dividend + * @param divisor - Divisor + * + * @return None
+ * + * \parDescription:
+ * Performs unsigned integer division and computes quotient of the division. + * Call XMC_MATH_DIV_GetUnsignedDivResult() API to get the result. + * + * \par + * Divider unit is configured for unsigned division. + * \a DVD & \a DVS registers are programmed with \a dividend and \a divisor values. + * The division is started with the write to DVS register. + * + * \parNote:
+ * Ensure \e divisor is smaller than \e dividend. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_GetUnsignedDivResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_DIV_UnsignedDivNB(uint32_t dividend, uint32_t divisor); + +/** + * @param dividend - Dividend + * @param divisor - Divisor + * + * @return None
+ * + * \parDescription:
+ * Performs signed integer division and computes quotient of the division. + * Call XMC_MATH_DIV_GetSignedDivResult() API to get the result. + * + * \par + * Divider unit is configured for signed division. + * \a DVD & \a DVS registers are programmed with \a dividend and \a divisor values. + * The division is started with the write to DVS register. + * + * \parNote:
+ * Ensure \e divisor is smaller than \e dividend. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_GetSignedDivResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_DIV_SignedDivNB(int32_t dividend, int32_t divisor); + +/** + * @param dividend - Dividend + * @param divisor - Divisor + * + * @return None
+ * + * \parDescription:
+ * Performs unsigned modulo operation and computes remainder of the division. + * Call XMC_MATH_DIV_GetUnsignedModResult() API to get the result. + * + * \par + * Divider unit is configured for unsigned division. + * \a DVD & \a DVS registers are programmed with \a dividend and \a divisor values. + * The division is started with the write to DVS register. + * + * \parNote:
+ * Ensure \e divisor is smaller than \e dividend. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_GetUnsignedModResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_DIV_UnsignedModNB(uint32_t dividend, uint32_t divisor); + +/** + * @param dividend - Dividend + * @param divisor - Divisor + * + * @return None
+ * + * \parDescription:
+ * Performs signed modulo operation and computes remainder of the division. + * Call XMC_MATH_DIV_GetSignedModResult() API to get the result. + * + * \par + * Divider unit is configured for signed division. + * \a DVD & \a DVS registers are programmed with \a dividend and \a divisor values. + * The division is started with the write to DVS register. + * + * \parNote:
+ * Ensure \e divisor is smaller than \e dividend. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_GetSignedModResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_DIV_SignedModNB(int32_t dividend, int32_t divisor); + +/** + * @param x - Value whose square root is computed + * + * @return Square root of x
+ * + * \parDescription:
+ * Computes square root of Q15 number + * + * \parNote:
+ * x > 0 + * + */ +int16_t XMC_MATH_CORDIC_Q15_Sqrt(int16_t x); + +/** + * @param x - Value whose square root is computed + * + * @return Square root of x
+ * + * \parDescription:
+ * Computes square root of Q31 number + * + * \parNote:
+ * x > 0 + * + */ +int32_t XMC_MATH_CORDIC_Q31_Sqrt(int32_t x); +/** + * @} + */ + +/** + * @} + */ + +#endif /* end of #if defined(MATH) */ + +#ifdef __cplusplus +} +#endif + +#endif /* XMC_MATH_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_pau.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_pau.h new file mode 100644 index 00000000..446a5b5a --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_pau.h @@ -0,0 +1,396 @@ +/** + * @file xmc_pau.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial version + * + * 2015-05-20: + * - Documentation updated + * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * @endcond + * + */ + +#ifndef XMC_PAU_H +#define XMC_PAU_H + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ + +#include "xmc_common.h" + +#if defined(PAU) + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup PAU + * @brief Peripheral Access Unit (PAU) driver for the XMC1000 microcontroller family + * + * The Peripheral Access Unit (PAU) supports access control of memories and peripherals. + * It allows user application to enable/disable the access to the registers of a peripheral. + * It generates a HardFault exception when there is an access to a disabled or unassigned + * address location. It also provides information on the availability of peripherals and + * sizes of memories. + * + * The PAU low level driver provides functions to check the availability of peripherals + * and to enable/disable peripheral access. + * @{ + */ + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ + +/** + * A convenient symbol for the PAU peripheral base address + */ +#define XMC_PAU ((XMC_PAU_t *) PAU_BASE) + +/* + * This macro is used in the LLD for assertion checks (XMC_ASSERT) + */ +#define XMC_PAU_CHECK_MODULE_PTR(p) ((p) == XMC_PAU) + +/********************************************************************************************************************* + * ENUMS + *********************************************************************************************************************/ + +/** + * Status return values for PAU low level driver + */ +typedef enum XMC_PAU_STATUS +{ + XMC_PAU_STATUS_OK = 0U, /**< Operation successful */ + XMC_PAU_STATUS_BUSY = 1U, /**< Busy with a previous request */ + XMC_PAU_STATUS_ERROR = 2U /**< Operation unsuccessful */ +} XMC_PAU_STATUS_t; + +/** + * PAU peripheral select + */ +typedef enum XMC_PAU_PERIPHERAL +{ + XMC_PAU_PERIPHERAL_FLASH = PAU_PRIVDIS0_PDIS2_Msk, /**< Flash SFRs Privilege Disable Flag */ + XMC_PAU_PERIPHERAL_RAM_BLOCK1 = PAU_PRIVDIS0_PDIS5_Msk, /**< RAM Block 1 Privilege Disable Flag */ + XMC_PAU_PERIPHERAL_RAM_BLOCK2 = PAU_PRIVDIS0_PDIS6_Msk, /**< RAM Block 2 Privilege Disable Flag */ + XMC_PAU_PERIPHERAL_RAM_BLOCK3 = PAU_PRIVDIS0_PDIS7_Msk, /**< RAM Block 3 Privilege Disable Flag */ + #if defined(WDT) + XMC_PAU_PERIPHERAL_WDT = PAU_PRIVDIS0_PDIS19_Msk, /**< WDT Privilege Disable Flag */ + #endif + #if defined(MATH) + XMC_PAU_PERIPHERAL_MATH_GLOBAL_AND_DIV = PAU_PRIVDIS0_PDIS20_Msk, /**< MATH Global SFRs and Divider Privilege Disable Flag */ + #endif + #if defined(MATH) + XMC_PAU_PERIPHERAL_MATH_CORDIC = PAU_PRIVDIS0_PDIS21_Msk, /**< MATH CORDIC Privilege Disable Flag */ + #endif + #if defined(PORT0) + XMC_PAU_PERIPHERAL_PORT0 = PAU_PRIVDIS0_PDIS22_Msk, /**< Port 0 Privilege Disable Flag */ + #endif + #if defined(PORT1) + XMC_PAU_PERIPHERAL_PORT1 = PAU_PRIVDIS0_PDIS23_Msk, /**< Port 1 Privilege Disable Flag */ + #endif + #if defined(PORT2) + XMC_PAU_PERIPHERAL_PORT2 = PAU_PRIVDIS0_PDIS24_Msk, /**< Port 2 Privilege Disable Flag */ +#endif +#if defined(PORT3) + XMC_PAU_PERIPHERAL_PORT3 = PAU_PRIVDIS0_PDIS25_Msk, /**< Port 3 Privilege Disable Flag */ +#endif +#if defined(PORT4) + XMC_PAU_PERIPHERAL_PORT4 = PAU_PRIVDIS0_PDIS26_Msk, /**< Port 4 Privilege Disable Flag */ +#endif +#if defined(USIC0) + XMC_PAU_PERIPHERAL_USIC0_CH0 = PAU_PRIVDIS1_PDIS0_Msk | 0x10000000U, /**< USIC0 Channel 0 Privilege Disable Flag */ + XMC_PAU_PERIPHERAL_USIC0_CH1 = PAU_PRIVDIS1_PDIS1_Msk | 0x10000000U, /**< USIC0 Channel 1 Privilege Disable Flag */ +#endif +#if defined(USIC1) + XMC_PAU_PERIPHERAL_USIC1_CH0 = PAU_PRIVDIS1_PDIS16_Msk | 0x10000000U, /**< USIC1 Channel 0 Privilege Disable Flag */ + XMC_PAU_PERIPHERAL_USIC1_CH1 = PAU_PRIVDIS1_PDIS17_Msk | 0x10000000U, /**< USIC1 Channel 1 Privilege Disable Flag */ +#endif +#if defined(PRNG) + XMC_PAU_PERIPHERAL_PRNG = PAU_AVAIL1_AVAIL4_Msk | 0x10000000U, /**< PRNG Availability Flag*/ +#endif +#if defined(VADC) + XMC_PAU_PERIPHERAL_VADC_GLOBAL = PAU_PRIVDIS1_PDIS5_Msk | 0x10000000U, /**< VADC0 Basic SFRs Privilege Disable Flag */ +#if defined(VADC_G0) + XMC_PAU_PERIPHERAL_VADC_GROUP0 = PAU_PRIVDIS1_PDIS6_Msk | 0x10000000U, /**< VADC0 Group 0 SFRs Privilege Disable Flag */ +#endif +#if defined(VADC_G1) + XMC_PAU_PERIPHERAL_VADC_GROUP1 = PAU_PRIVDIS1_PDIS7_Msk | 0x10000000U, /**< VADC0 Group 1 SFRs Privilege Disable Flag */ +#endif +#endif +#if defined(SHS0) + XMC_PAU_PERIPHERAL_VADC_SHS0 = PAU_PRIVDIS1_PDIS8_Msk | 0x10000000U, /**< SHS0 Privilege Disable Flag */ +#endif +#if defined(CCU40) + XMC_PAU_PERIPHERAL_CCU40_CC40_AND_GLOBAL = PAU_PRIVDIS1_PDIS9_Msk | 0x10000000U, /**< CCU40_CC40 and CCU40 Kernel SFRs Privilege Disable Flag */ +#if defined(CCU40_CC41) + XMC_PAU_PERIPHERAL_CCU40_CC41 = PAU_PRIVDIS1_PDIS10_Msk | 0x10000000U, /**< CCU40_CC41 Privilege Disable Flag */ +#endif +#if defined(CCU40_CC42) + XMC_PAU_PERIPHERAL_CCU40_CC42 = PAU_PRIVDIS1_PDIS11_Msk | 0x10000000U, /**< CCU40_CC42 Privilege Disable Flag */ +#endif +#if defined(CCU40_CC43) + XMC_PAU_PERIPHERAL_CCU40_CC43 = PAU_PRIVDIS1_PDIS12_Msk | 0x10000000U, /**< CCU40_CC43 Privilege Disable Flag */ +#endif +#endif +#if defined(CCU41) + XMC_PAU_PERIPHERAL_CCU41_CC40_AND_GLOBAL = PAU_PRIVDIS1_PDIS25_Msk | 0x10000000U, /**< CCU41_CC40 and CCU41 Kernel SFRs Privilege Disable Flag */ +#if defined(CCU41_CC41) + XMC_PAU_PERIPHERAL_CCU41_CC41 = PAU_PRIVDIS1_PDIS26_Msk | 0x10000000U, /**< CCU41_CC41 Privilege Disable Flag */ +#endif +#if defined(CCU41_CC42) + XMC_PAU_PERIPHERAL_CCU41_CC42 = PAU_PRIVDIS1_PDIS27_Msk | 0x10000000U, /**< CCU41_CC42 Privilege Disable Flag */ +#endif +#if defined(CCU41_CC43) + XMC_PAU_PERIPHERAL_CCU41_CC43 = PAU_PRIVDIS1_PDIS28_Msk | 0x10000000U, /**< CCU41_CC43 Privilege Disable Flag */ +#endif +#endif +#if defined(CCU80) + XMC_PAU_PERIPHERAL_CCU80_CC80_AND_GLOBAL = PAU_PRIVDIS2_PDIS0_Msk | 0x20000000U, /**< CCU80_CC80 and CCU80 Kernel SFRs Privilege Disable Flag */ +#if defined(CCU80_CC81) + XMC_PAU_PERIPHERAL_CCU80_CC81 = PAU_PRIVDIS2_PDIS1_Msk | 0x20000000U, /**< CCU80_CC81 Privilege Disable Flag */ +#endif +#if defined(CCU80_CC82) + XMC_PAU_PERIPHERAL_CCU80_CC82 = PAU_PRIVDIS2_PDIS2_Msk | 0x20000000U, /**< CCU80_CC82 Privilege Disable Flag */ +#endif +#if defined(CCU80_CC83) + XMC_PAU_PERIPHERAL_CCU80_CC83 = PAU_PRIVDIS2_PDIS3_Msk | 0x20000000U, /**< CCU80_CC83 Privilege Disable Flag */ +#endif +#endif +#if defined(CCU81) + XMC_PAU_PERIPHERAL_CCU81_CC80_AND_GLOBAL = PAU_PRIVDIS2_PDIS16_Msk | 0x20000000U, /**< CCU81_CC80 and CCU81 Kernel SFRs Privilege Disable Flag */ +#if defined(CCU81_CC81) + XMC_PAU_PERIPHERAL_CCU81_CC81 = PAU_PRIVDIS2_PDIS17_Msk | 0x20000000U, /**< CCU81_CC81 Privilege Disable Flag */ +#endif +#if defined(CCU81_CC82) + XMC_PAU_PERIPHERAL_CCU81_CC82 = PAU_PRIVDIS2_PDIS18_Msk | 0x20000000U, /**< CCU81_CC82 Privilege Disable Flag */ +#endif +#if defined(CCU81_CC83) + XMC_PAU_PERIPHERAL_CCU81_CC83 = PAU_PRIVDIS2_PDIS19_Msk | 0x20000000U, /**< CCU81_CC83 Privilege Disable Flag */ +#endif +#endif +#if defined(POSIF0) + XMC_PAU_PERIPHERAL_POSIF0 = PAU_PRIVDIS2_PDIS12_Msk | 0x20000000U, /**< POSIF0 Privilege Disable Flag */ +#endif +#if defined(POSIF1) + XMC_PAU_PERIPHERAL_POSIF1 = PAU_PRIVDIS2_PDIS28_Msk | 0x20000000U, /**< POSIF1 Privilege Disable Flag */ +#endif +#if defined(LEDTS0) + XMC_PAU_PERIPHERAL_LEDTS0 = PAU_PRIVDIS2_PDIS13_Msk | 0x20000000U, /**< LEDTS0 Privilege Disable Flag */ +#endif +#if defined(LEDTS1) + XMC_PAU_PERIPHERAL_LEDTS1 = PAU_PRIVDIS2_PDIS14_Msk | 0x20000000U, /**< LEDTS1 Privilege Disable Flag */ +#endif +#if defined(LEDTS2) + XMC_PAU_PERIPHERAL_LEDTS2 = PAU_PRIVDIS2_PDIS29_Msk | 0x20000000U, /**< LEDTS2 Privilege Disable Flag */ +#endif +#if defined(BCCU0) + XMC_PAU_PERIPHERAL_BCCU0 = PAU_PRIVDIS2_PDIS15_Msk | 0x20000000U, /**< BCCU0 Privilege Disable Flag */ +#endif +#if defined(CAN) +#if defined(CAN_NODE0) + XMC_PAU_PERIPHERAL_MCAN_NODE0_AND_GLOBAL = PAU_PRIVDIS2_PDIS21_Msk | 0x20000000U, /**< MCAN NODE0 and Global SFRs Privilege */ +#endif +#if defined(CAN_NODE1) + XMC_PAU_PERIPHERAL_MCAN_NODE1_AND_GLOBAL = PAU_PRIVDIS2_PDIS23_Msk | 0x20000000U, /**< MCAN NODE1 Privilege Disable Flag */ +#endif + XMC_PAU_PERIPHERAL_MCAN_OBJECTS = PAU_PRIVDIS2_PDIS28_Msk | 0x20000000U, /**< MCAN Message Objects Privilege Disable Flag */ +#endif +} XMC_PAU_PERIPHERAL_t; + + +/********************************************************************************************************************* + * DATA STRUCTURES + *********************************************************************************************************************/ + + +/** + * External Peripheral Access Unit (PAU) device structure
+ * + * The structure represents a collection of all hardware registers + * used to configure the PAU peripheral on the XMC microcontroller. + * The registers can be accessed with ::XMC_PAU. + */ +typedef struct +{ + __I uint32_t RESERVED0[16]; + __I uint32_t AVAIL[3]; + __I uint32_t RESERVED1[13]; + __IO uint32_t PRIVDIS[3]; + __I uint32_t RESERVED2[221]; + __I uint32_t ROMSIZE; + __I uint32_t FLSIZE; + __I uint32_t RESERVED3[2]; + __I uint32_t RAM0SIZE; +} XMC_PAU_t; + +/********************************************************************************************************************* + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param peripheral Peripheral of type ::XMC_PAU_PERIPHERAL_t for which access needs to be enabled + * @return None + * + * \parDescription:
+ * Enable the peripheral access
+ * + * \par + * The function resets the PRIVDISx.PDISy bit to enable the access to the registers of a peripheral + * during run time. + * + * \parRelated APIs:
+ * XMC_PAU_DisablePeripheralAccess() + */ +void XMC_PAU_EnablePeripheralAccess(XMC_PAU_PERIPHERAL_t peripheral); + +/** + * @param peripheral Peripheral of type ::XMC_PAU_PERIPHERAL_t for which access needs to be disabled + * @return None + * + * \parDescription:
+ * Disable the peripheral access
+ * + * \par + * The function sets the PRIVDISx.PDISy bit to disable the access to the registers of a peripheral + * during run time. An access to a disabled or unassigned address location generates a hardfault + * exception. + * + * \parRelated APIs:
+ * XMC_PAU_EnablePeripheralAccess() + */ +void XMC_PAU_DisablePeripheralAccess(XMC_PAU_PERIPHERAL_t peripheral); + +/** + * @param peripheral Peripheral of type ::XMC_PAU_PERIPHERAL_t for which access enabled status to be checked + * @return bool "false" if peripheral access is enabled, "true" otherwise + * + * \parDescription:
+ * Checks if the peripheral access is enabled or not
+ * + * \par + * The function checks the PRIVDISx.PDISy bit to know whether the access to the registers of a peripheral + * during run time is enabled or not. + * + * \parRelated APIs:
+ * XMC_PAU_DisablePeripheralAccess(), XMC_PAU_EnablePeripheralAccess() + */ +bool XMC_PAU_IsPeripheralAccessEnabled(XMC_PAU_PERIPHERAL_t peripheral); + +/** + * @param peripheral Peripheral of type ::XMC_PAU_PERIPHERAL_t for which access needs to be disabled + * @return bool Returns "true" if peripheral is available, "false" otherwise + * + * \parDescription:
+ * Checks if a peripheral is available or not
+ * + * \par + * The function checks the AVAILx.AVAILy bit to know whether the peripheral + * is available or not for the particular device variant. + */ +bool XMC_PAU_IsPeripheralAvailable(XMC_PAU_PERIPHERAL_t peripheral); + +/** + * @return uint32_t Returns ROM size + * + * \parDescription:
+ * Gets the ROM size
+ * + * \par + * The function checks the ROMSIZE.ADDR bitfield to indicate the available size of ROM in the device in bytes. + */ +__STATIC_INLINE uint32_t XMC_PAU_GetROMSize(void) +{ + return (uint32_t)(((XMC_PAU->ROMSIZE & PAU_ROMSIZE_ADDR_Msk) >> PAU_ROMSIZE_ADDR_Pos) * 256U); +} + +/** + * @return uint32_t Returns flash size + * + * \parDescription:
+ * Gets the flash size
+ * + * \par + * The function checks the FLSIZE.ADDR bitfield to indicate the available size of FLASH in the device in Kbytes. + */ +__STATIC_INLINE uint32_t XMC_PAU_GetFlashSize(void) +{ + return (uint32_t)((((XMC_PAU->FLSIZE & PAU_FLSIZE_ADDR_Msk) >> PAU_FLSIZE_ADDR_Pos) - 1U) * 4U); +} + +/** + * @return uint32_t Returns RAM size + * + * \parDescription:
+ * Gets RAM size
+ * + * \par + * The function checks the RAM0SIZE.ADDR bitfield to indicate the available size of RAM in the device in bytes. + */ +__STATIC_INLINE uint32_t XMC_PAU_GetRAMSize(void) +{ + return (uint32_t)(((XMC_PAU->RAM0SIZE & PAU_RAM0SIZE_ADDR_Msk) >> PAU_RAM0SIZE_ADDR_Pos) * 256U); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(PAU) */ + +#endif /* XMC_PAU_H */ + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_posif.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_posif.h new file mode 100644 index 00000000..2cbab878 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_posif.h @@ -0,0 +1,1046 @@ +/** + * @file xmc_posif.h + * @date 2016-03-09 + * + * @cond + ********************************************************************************** + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification,are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share + * modifications, enhancements or bug fixes with Infineon Technologies AG + * dave@infineon.com). + ********************************************************************************** + * + * Change History + * -------------- + * + * 2015-02-18: + * - Initial version + * + * 2015-02-20: + * - Driver description added
+ * + * 2015-06-19: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-07-02: + * - Updated XMC_POSIF_QD_GetDirection API + * + * 2016-03-09: + * - Optimization of write only registers + * + * @endcond + * + */ + + +#ifndef XMC_POSIF_H +#define XMC_POSIF_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +#if defined(POSIF0) +#include + +/** + * @addtogroup XMClib + * @{ + */ + +/** + * @addtogroup POSIF + * @{ + * @brief Position Interface Unit (POSIF) driver for the XMC microcontroller family
+ * + * The POSIF unit is a flexible and powerful component for motor control systems that use + * rotary encoders or hall sensors as feedback loop. It provides interface for motor position and velocity measurement. + * POSIF unit works with CCU4 and CCU8 to enable position and velocity measurement and to control PWM outputs using multi channel pattern.
+ * + * Driver is divided in three POSIF functional blocks - Hall Sensor Control (POSIF_HSC), Quadrature Decoder (POSIF_QD) and + * MultiChannel Mode (POSIF_MCM).
+ * + * POSIF driver features: + * -# Configuration structure XMC_POSIF_CONFIG_t and initialization function XMC_POSIF_Init() to configure global settings + * -# Allows to change the operating mode using XMC_POSIF_SetMode() + * -# Allows the selection of one of the four inputs (A, B, C or D) using XMC_POSIF_SelectInputSource(). In hall sensor control, inputs are + * hall0, hall1 and hall2 signals. For quadrature decoder mode, inputs are phase A, phase B and index signals. + * -# Hall Sensor Control (APIs prefixed with XMC_POSIF_HSC_)
+ * - Configuration structure XMC_POSIF_HSC_CONFIG_t and initialization function XMC_POSIF_HSC_Init() + * - Update current and expected hall pattern in shadow register using XMC_POSIF_HSC_SetHallPatterns() + * - Allows immediate shadow transfer using XMC_POSIF_HSC_UpdateHallPattern() + * -# Quadrature Decoder (APIs prefixed with XMC_POSIF_QD_)
+ * - Configuration structure XMC_POSIF_QD_CONFIG_t and initialization function XMC_POSIF_QD_Init() + * - Get direction of rotation using XMC_POSIF_QD_GetDirection() + * -# MultiChannel Mode (APIs prefixed with XMC_POSIF_MCM_)
+ * - Configuration structure XMC_POSIF_MCM_CONFIG_t and initialization function XMC_POSIF_MCM_Init() + * - Update multichannel pattern in shadow register using XMC_POSIF_MCM_SetMultiChannelPattern() + * - Allows immediate shadow transfer using XMC_POSIF_MCM_UpdateMultiChannelPattern() + * -# User need to call respective init functions to configure POSIF operating mode. e.g to configure POSIF in hall sensor control with multichannel mode + * call both XMC_POSIF_HSC_Init() and XMC_POSIF_MCM_Init(). + * -# Allows to enable and disable interrupt sources and assign to service request node using XMC_POSIF_EnableEvent(), XMC_POSIF_DisableEvent() and XMC_POSIF_SetInterruptNode() + + */ +/* POSIF is not available on XMC11 and XMC12 devices */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_POSIF_PCONF_INSEL_Msk (0x3fUL << POSIF_PCONF_INSEL0_Pos) /*< Mask for input pins selection */ +#define XMC_POSIF_INSEL_MAX (4U) /*< Maximum possible input selector */ +#define XMC_POSIF_HALPS_HALLPAT_Msk (0x3FUL) + +#if ((UC_SERIES == XMC45) || (UC_SERIES == XMC44) || (UC_SERIES == XMC47) || (UC_SERIES == XMC48) || (UC_SERIES == XMC14)) +#define XMC_POSIF_CHECK_MODULE_PTR(PTR) ( ((PTR)== POSIF0) || ((PTR)== POSIF1) ) /*< Check for valid module pointer */ +#else +#define XMC_POSIF_CHECK_MODULE_PTR(PTR) ( ((PTR)== POSIF0)) /*< Check for valid module pointer */ +#endif + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +/** + * Defines the return status, to verify the POSIF related API calls. Use type @ref XMC_POSIF_STATUS_t for this enum. + */ +typedef enum XMC_POSIF_STATUS +{ + XMC_POSIF_STATUS_OK = 0U, /**< API fulfills request */ + XMC_POSIF_STATUS_ERROR /**< API cannot fulfill request */ +} XMC_POSIF_STATUS_t; + +/** + * Defines POSIF configurable modes.Use type @ref XMC_POSIF_MODE_t for this enum. + * The members defines the function selector(FSEL) bitfields of \a PCONF register. + */ +typedef enum XMC_POSIF_MODE +{ + XMC_POSIF_MODE_HALL_SENSOR = 0U, /**< Hall sensor mode */ + XMC_POSIF_MODE_QD , /**< Quadrature Decoder mode */ + XMC_POSIF_MODE_MCM , /**< Standalone Multichannel mode */ + XMC_POSIF_MODE_MCM_QD /**< Quadrature Decoder + Standalone Multichannel mode */ +} XMC_POSIF_MODE_t; + +/** + * Defines POSIF configurable input ports.Use type @ref XMC_POSIF_INPUT_PORT_t for this enum. + * The member defines the respective input selector(INSELX) bitfields of \a PCONF register. + * It selects, which input is used for the phase or Hall input function (depending on the module is set for + * Quadrature Decoder or Hall Sensor Mode). Same enum can be used to configure pattern update signal select by configuring + * \a PCONF register's \a MSETS bit field. + */ +typedef enum XMC_POSIF_INPUT_PORT +{ + XMC_POSIF_INPUT_PORT_A = 0U, /**< INPUT-A */ + XMC_POSIF_INPUT_PORT_B , /**< INPUT-B */ + XMC_POSIF_INPUT_PORT_C , /**< INPUT-C */ + XMC_POSIF_INPUT_PORT_D , /**< INPUT-D */ + XMC_POSIF_INPUT_PORT_E , /**< INPUT-E */ + XMC_POSIF_INPUT_PORT_F , /**< INPUT-F */ + XMC_POSIF_INPUT_PORT_G , /**< INPUT-G */ + XMC_POSIF_INPUT_PORT_H /**< INPUT-H */ +} XMC_POSIF_INPUT_PORT_t; + +/** + * Defines active level of an input signal.Use type @ref XMC_POSIF_INPUT_ACTIVE_LEVEL_t for this enum. + */ +typedef enum XMC_POSIF_INPUT_ACTIVE_LEVEL +{ + XMC_POSIF_INPUT_ACTIVE_LEVEL_HIGH = 0U, /**< Input - Active High */ + XMC_POSIF_INPUT_ACTIVE_LEVEL_LOW /**< Input - Active Low */ +} XMC_POSIF_INPUT_ACTIVE_LEVEL_t; + +/** + * Defines POSIF input debounce filter configuration.POSIF inputs are connected to low pass filter and + * this enum is used to configure low pass filters cut off frequency. + * Use type @ref XMC_POSIF_FILTER_t for this enum. + * The member defines the low pass filter configuration(LPC) bitfield of \a PCONF register. + */ +typedef enum XMC_POSIF_FILTER +{ + XMC_POSIF_FILTER_DISABLED = 0U, /**< No filtering */ + XMC_POSIF_FILTER_1_CLOCK_CYCLE , /**< Filter of 1 Clock Cycle */ + XMC_POSIF_FILTER_2_CLOCK_CYCLE , /**< Filter of 2 Clock Cycles */ + XMC_POSIF_FILTER_4_CLOCK_CYCLE , /**< Filter of 4 Clock Cycles */ + XMC_POSIF_FILTER_8_CLOCK_CYCLE , /**< Filter of 8 Clock Cycles */ + XMC_POSIF_FILTER_16_CLOCK_CYCLE , /**< Filter of 16 Clock Cycles */ + XMC_POSIF_FILTER_32_CLOCK_CYCLE , /**< Filter of 32 Clock Cycles */ + XMC_POSIF_FILTER_64_CLOCK_CYCLE /**< Filter of 64 Clock Cycles */ +} XMC_POSIF_FILTER_t; + +/** + * Defines POSIF events.Use type @ref XMC_POSIF_IRQ_EVENT_t for this enum. + * The member defines available event sources.It is used to configure which event to be used for + * interrupt generation using \a PFLGE register. [ PFLG,SPFLG,RPFLG] + */ +typedef enum XMC_POSIF_IRQ_EVENT +{ + XMC_POSIF_IRQ_EVENT_CHE = 0U, /**< Hall Mode : Correct Hall Event */ + XMC_POSIF_IRQ_EVENT_WHE = 1U, /**< Hall Mode : Wrong Hall Event */ + XMC_POSIF_IRQ_EVENT_HALL_INPUT = 2U, /**< Hall Mode : Hall Input update */ + XMC_POSIF_IRQ_EVENT_MCP_SHADOW_TRANSFER = 4U, /**< Hall Mode + MCM Mode : MC Pattern shadow transfer */ + XMC_POSIF_IRQ_EVENT_INDX = 8U, /**< Quadrature Mode : Index event detection */ + XMC_POSIF_IRQ_EVENT_ERR = 9U, /**< Quadrature Mode : Quadrature Phase Error */ + XMC_POSIF_IRQ_EVENT_CNT = 10U, /**< Quadrature Mode : Quadrature Clock event */ + XMC_POSIF_IRQ_EVENT_DIR = 11U, /**< Quadrature Mode : Quadrature Direction change event */ + XMC_POSIF_IRQ_EVENT_PCLK = 12U /**< Quadrature Mode : Quadrature period clock generation event */ +} XMC_POSIF_IRQ_EVENT_t; + +/** + * Defines POSIF service request lines.Use type @ref XMC_POSIF_SR_ID_t for this enum. + * It used to connect POSIF event to required service request line. + * in \a PFLGE register for interrupt generation. + */ +typedef enum XMC_POSIF_SR_ID +{ + XMC_POSIF_SR_ID_0 = 0U, /**< SR-0 */ + XMC_POSIF_SR_ID_1 /**< SR-1 */ +} XMC_POSIF_SR_ID_t; + +/** + * Defines position decoder mode selection.Use type @ref XMC_POSIF_QD_MODE_t for this enum. + * The member defines configuration for the operation of the quadrature decoder mode. + * It used to configure \a QDC register. + */ +typedef enum XMC_POSIF_QD_MODE +{ + XMC_POSIF_QD_MODE_QUADRATURE = 0U, /**< Standard Quadrature Mode */ + XMC_POSIF_QD_MODE_DIRECTION_COUNT /**< Direction Count Mode */ +} XMC_POSIF_QD_MODE_t; + +/** + * Defines motor rotation direction.Use type @ref XMC_POSIF_QD_DIR_t for this enum. + * The member defines the direction in quadrature mode. + */ +typedef enum XMC_POSIF_QD_DIR +{ + XMC_POSIF_QD_DIR_COUNTERCLOCKWISE = 0U, /**< Counter Clockwise */ + XMC_POSIF_QD_DIR_CLOCKWISE /**< Clockwise */ +} XMC_POSIF_QD_DIR_t; + +/** + * Defines frequency of index signal generation.Use type @ref XMC_POSIF_QD_INDEX_GENERATION_t for this enum. + * Member represents available configuration for index marker generation using \a ICM bit field in \a QDC register. + */ +typedef enum XMC_POSIF_QD_INDEX_GENERATION +{ + XMC_POSIF_QD_INDEX_GENERATION_NEVER = 0U, /**< Never generate the index marker signal */ + XMC_POSIF_QD_INDEX_GENERATION_ONCE , /**< Generate only once after the first revolution */ + XMC_POSIF_QD_INDEX_GENERATION_ALWAYS /**< Index marker generated upon every revolution */ +} XMC_POSIF_QD_INDEX_GENERATION_t; + +/** + * Defines trigger edge in hall sensor mode.Use type @ref XMC_POSIF_HSC_TRIGGER_EDGE_t for this enum. + * It can be used to configure \a PCONF register's \a SPES and \a MSES bit fields. + */ +typedef enum XMC_POSIF_HSC_TRIGGER_EDGE +{ + XMC_POSIF_HSC_TRIGGER_EDGE_RISING = 0U, /**< Rising edge */ + XMC_POSIF_HSC_TRIGGER_EDGE_FALLING /**< Falling edge */ +} XMC_POSIF_HSC_TRIGGER_EDGE_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * + * Defines POSIF peripheral register structure.Use type @ref XMC_POSIF_t for this data structure. + */ +typedef POSIF_GLOBAL_TypeDef XMC_POSIF_t; + +/** + * Defines POSIF quadrature decoder initialization data structure. + * Use type @ref XMC_POSIF_QD_CONFIG_t for this data structure. + * It used to configure Quadrature mode using \a QDC register. + */ +typedef struct XMC_POSIF_QD_CONFIG +{ + XMC_POSIF_QD_MODE_t mode; /**< Operational Mode of the quadrature encoder and decoder */ + union + { + struct + { + uint32_t phase_a: 1; /**< Phase-A active level configuration */ + uint32_t phase_b: 1; /**< Phase-B active level configuration */ + uint32_t phase_leader: 1; /**< Which of the two phase signals[Phase A or Phase B] leads the other? */ + uint32_t : 1; + uint32_t index: 2; /**< Index signal generation control. Use @ref XMC_POSIF_QD_INDEX_GENERATION_t to configure this field.*/ + uint32_t : 26; + }; + uint32_t qdc; + }; +} XMC_POSIF_QD_CONFIG_t; + +/** + * Defines POSIF hall sensor control initialization data structure. + * Use type @ref XMC_POSIF_HSC_CONFIG_t for this data structure. + * It used to initialize hall sensor mode configuration using \a PCONF register. + */ +typedef struct XMC_POSIF_HSC_CONFIG +{ + union + { + struct + { + uint32_t : 4; + uint32_t disable_idle_signal: 1; /**< Should idle signal be disabled upon wrong hall event? */ + uint32_t : 11; + uint32_t sampling_trigger: 1; /**< Of HSDA and HSDB, which one is to be used to trigger POSIF to sample hall pattern? */ + uint32_t sampling_trigger_edge: 1; /**< Which edge of the sampling trigger signal is to be considered? */ + uint32_t : 6; + uint32_t external_error_port: 2; /**< Of the 4 external error ports, which one is to be considered? */ + uint32_t external_error_enable: 1; /**< Should external errors lead to Wrong Hall event? */ + uint32_t external_error_level: 1; /**< What should be the active level of external error signal? */ + uint32_t: 4; + }; + uint32_t hall_config; + }; +} XMC_POSIF_HSC_CONFIG_t; + +/** + * Defines POSIF multi-channel mode initialization data structure. + * Use type @ref XMC_POSIF_MCM_CONFIG_t for this data structure. + * It used to initialize multi channel mode configuration using \a PCONF register. + */ +typedef struct XMC_POSIF_MCM_CONFIG +{ + union + { + struct + { + uint32_t : 5; + uint32_t pattern_sw_update: 1; /**< should multi channel pattern updated by SW ? */ + uint32_t : 12; + uint32_t pattern_update_trigger: 3; /**< Of the 8 update triggers, which one is to be considered? */ + uint32_t pattern_trigger_edge: 1; /**< Which edge of the pattern update trigger is to be considered? */ + uint32_t pwm_sync: 2; /**< Of the 4 pwm sync inputs, which one is to be considered? */ + uint32_t : 8; + }; + uint32_t mcm_config; + }; +}XMC_POSIF_MCM_CONFIG_t; + +/** + * Defines POSIF module initialization data structure. + * Use type @ref XMC_POSIF_CONFIG_t for this data structure. + * It is used to initialize POSIF module using \a PCONF register. + */ +typedef struct XMC_POSIF_CONFIG +{ + union + { + struct + { + uint32_t mode: 2; /**< POSIF Operational mode. Use @ref XMC_POSIF_MODE_t to configure */ + uint32_t :6; + uint32_t input0: 2; /**< Choice of input for Input-1 */ + uint32_t input1: 2; /**< Choice of input for Input-2 */ + uint32_t input2: 2; /**< Choice of input for Input-3 */ + uint32_t :14; + uint32_t filter: 3; /**< Input filter configuration */ + uint32_t: 1; + }; + uint32_t pconf; + }; +} XMC_POSIF_CONFIG_t; + +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif + +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param peripheral Pointer to an instance of POSIF module of type @ref XMC_POSIF_t + * @retval None + * + * \parDescription
+ * De-asserts the POSIF module from reset and enables the clock.\n + * Configures \a PRCLR0 register's \a POSIF0RS or \a POSIF1RS bit field depends upon \a peripheral. + * If running on other than XMC45 device then it will ungate the peripheral clock. + * + * \parNote
+ * This is the first API which application must invoke to configure POSIF. + * It is internally called by XMC_POSIF_Init(). + * + * \parRelated APIs:
+ * XMC_POSIF_Disable(),XMC_POSIF_Init() \n\n\n + */ +void XMC_POSIF_Enable(XMC_POSIF_t *const peripheral); + +/** + * @param peripheral Pointer to an instance of POSIF module of type @ref XMC_POSIF_t + * @retval None + * + * \parDescription
+ * Asserts the POSIF module into reset and disables the clock.\n + * If running on other than XMC45 device then in addition it will gate the peripheral clock. + * Configures \a PRCLR0 register's \a POSIF0RS or \a POSIF1RS bitfield depends upon \a peripheral. + * + * \parRelated APIs:
+ * XMC_POSIF_Enable()\n\n\n + */ +void XMC_POSIF_Disable(XMC_POSIF_t *const peripheral); + +/** + * @param peripheral Pointer to an instance of POSIF module of type @ref XMC_POSIF_t + * @param config Pointer to POSIF configuration data(operation mode,input selection and filter configuration) + * @retval None + * + * \parDescription
+ * Initialize POSIF module with \a config.\n + * Configures POSIF global registers.This is the first API which application must invoke to configure POSIF. + * It sets up parameters common to all the POSIF modes - hall sensor,quadrature decoder and multi-channel modes of operation. + * Configures \a PCONF register with mode of operation,input selection and filter configuration. + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_Init(),XMC_POSIF_QD_Init(),XMC_POSIF_MCM_Init() \n\n\n +*/ +void XMC_POSIF_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_CONFIG_t * const config); + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param config Pointer to hall sensor control initialization data of type @ref XMC_POSIF_HSC_CONFIG_t + * @retval XMC_POSIF_STATUS_t Returns @ref XMC_POSIF_STATUS_OK if configured in Hall Sensor Mode + * else return @ref XMC_POSIF_STATUS_ERROR. + * + * \parDescription
+ * Initializes hall sensor control mode.\n + * Configures \a PCONF register with which POSIF input trigger to be used for + * sampling hall pattern.Configures \a PCONF register for idle signal generation for wrong hall event. + * + * \parNote
+ * It is necessary to have called XMC_POSIF_Init first with Hall sensor mode before invocation of this API. + * + * \parRelated APIs:
+ * XMC_POSIF_Init() \n\n\n + */ +XMC_POSIF_STATUS_t XMC_POSIF_HSC_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_HSC_CONFIG_t * const config); + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param config Pointer to quadrature decoder initialization data + * @retval XMC_POSIF_STATUS_t Returns quadrature mode initialization status of type @ref XMC_POSIF_STATUS_t + * + * \parDescription
+ * Initializes quadrature decoder control mode.\n + * Configures \a PCONF register with quadrature mode using @ref XMC_POSIF_QD_MODE_t data structure. + * Initializes \a QDC register with quadrature mode configuration using @ref XMC_POSIF_QD_CONFIG_t structure. + * + * \parNote
+ * It is necessary to have called XMC_POSIF_Init first with Quadrature decoder mode before invocation of this API. + * + * \parRelated APIs:
+ * XMC_POSIF_Init() \n\n\n + */ +XMC_POSIF_STATUS_t XMC_POSIF_QD_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_QD_CONFIG_t * const config); + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param config Pointer to quadrature decoder initialization data + * @retval XMC_POSIF_STATUS_t Returns multi channel pattern initialization status of type @ref XMC_POSIF_STATUS_t + * + * \parDescription
+ * Initializes multi channel mode in Hall mode, standalone multi-channel mode and quadrature with multi-channel mode.\n + * Configures \a PCONF register with multi channel mode using @ref XMC_POSIF_MCM_CONFIG_t data structure. + * + * \parNote
+ * It is necessary to call XMC_POSIF_Init first before invocation of this API. + * For XMC_POSIF_MODE_HALL_SENSOR, it is necessary to have called XMC_POSIF_HSC_Init before invocation of this API. + * For XMC_POSIF_MODE_MCM_QD, it is necessary to have called XMC_POSIF_QD_Init before invocation of this API. + * + * \parRelated APIs:
+ * XMC_POSIF_Init(),XMC_POSIF_HSC_Init(),XMC_POSIF_QD_Init() \n\n\n + */ +XMC_POSIF_STATUS_t XMC_POSIF_MCM_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_MCM_CONFIG_t * const config); + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param mode POSIF operating mode of type @ref XMC_POSIF_MODE_t + * @retval None + * + * \parDescription
+ * Configures POSIF module for \a mode.\n + * Configures \a PCONF register's a\ FSEL bitfield with \a mode. + * Refer @ref XMC_POSIF_MODE_t for available options. + * + * \parNote
+ * POSIF module should be in stopped state while changing the operating mode. + * + * \parRelated APIs:
+ * XMC_POSIF_Stop() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_SetMode(XMC_POSIF_t *const peripheral, const XMC_POSIF_MODE_t mode) +{ + peripheral->PCONF = ((peripheral->PCONF & ~(uint32_t)(POSIF_PCONF_FSEL_Msk)) | + (((uint32_t)mode << POSIF_PCONF_FSEL_Pos) & (uint32_t)POSIF_PCONF_FSEL_Msk)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param input0 Choice of input for input 0 [0-3] + * @param input1 Choice of input for input 1 [0-3] + * @param input2 Choice of input for input 2 [0-3] + * @retval None + * + * \parDescription
+ * Configures which input to be connected to POSIF module. \n + * Configures \a PCONF register's INSEL0,INSEL1,INSEL2 bit fields with source for the input connection for \a input0 + * \a input1, \a input2 respectively. + * + * \parNote
+ * Configures which input is used for the Phase X or Hall input X function depending upon the module is + * set for Quadrature Decoder or Hall Sensor Mode. + * + * \parRelated APIs:
+ * XMC_POSIF_Init() \n\n\n + */ +void XMC_POSIF_SelectInputSource(XMC_POSIF_t *const peripheral, const XMC_POSIF_INPUT_PORT_t input0, + const XMC_POSIF_INPUT_PORT_t input1, const XMC_POSIF_INPUT_PORT_t input2); + + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval None + * + * \parDescription
+ * Starts POSIF \a peripheral functional state machine.\n + * Starts POSIF state machine for \a peripheral.Configures \a PRUNS register's \a SRB bit field with 1. + * + * \parNote
+ * Global properties of POSIF along with mode specific properties should have been initialized before starting of POSIF + * FSM. + * + * \parRelated APIs:
+ * XMC_POSIF_Stop(),XMC_POSIF_IsRunning() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_Start(XMC_POSIF_t *const peripheral) +{ + peripheral->PRUNS = (uint32_t)POSIF_PRUNS_SRB_Msk; +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval None + * + * \parDescription
+ * Stops POSIF \a peripheral functional state machine.\n + * Stop POSIF functional state machine and clears current internal status of the \a peripheral. + * Configures \a PRUNC register's \a CRB bit field with 1. + * + * \parRelated APIs:
+ * XMC_POSIF_Start(),XMC_POSIF_IsRunning() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_Stop(XMC_POSIF_t *const peripheral) +{ + peripheral->PRUNC = (uint32_t)(POSIF_PRUNC_CRB_Msk | POSIF_PRUNC_CSM_Msk); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval bool Returns false: IDLE, true:RUNNING + * + * \parDescription
+ * Returns the status of POSIF module - Running or IDLE.\n + * Retrieves the status from \a PRUN register's \a SRB bit. + * + * \parRelated APIs:
+ * XMC_POSIF_Start(),XMC_POSIF_Stop() \n\n\n + */ +__STATIC_INLINE bool XMC_POSIF_IsRunning(XMC_POSIF_t *const peripheral) +{ + return ((bool)peripheral->PRUN); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint8_t Returns last sampled hall sensor pattern. Range : [0-7] + * + * \parDescription
+ * Returns last sampled hall sensor pattern of \a peripheral.\n + * Retrieves the last sampled hall sensor pattern from \a PDBG register's \a HSP bit field of \a peripheral. + * Applications can at any point in time retrieve the last sampled hall sensor pattern by invoking this API. + * + * \parNote
+ * This is applicable only to the hall sensor mode of operation. + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_GetCurrentPattern(),XMC_POSIF_HSC_GetExpectedPattern() \n\n\n + */ +__STATIC_INLINE uint8_t XMC_POSIF_HSC_GetLastSampledPattern(XMC_POSIF_t *const peripheral) +{ + return ((uint8_t)((peripheral->PDBG) & POSIF_PDBG_HSP_Msk) >> POSIF_PDBG_HSP_Pos); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint8_t Returns current hall sensor pattern. Range : [0-7] + * + * \parDescription
+ * Returns current sampled hall sensor pattern of \a peripheral.\n + * Retrieves the current hall sensor pattern from \a HALP register's \a HCP bit field of \a peripheral. + * Applications can at any point in time retrieve the current hall sensor pattern by invoking this API. + * + * \parNote
+ * This is applicable only to the hall sensor mode of operation. + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_GetLastSampledPattern(),XMC_POSIF_HSC_GetExpectedPattern() \n\n\n + */ +__STATIC_INLINE uint8_t XMC_POSIF_HSC_GetCurrentPattern(XMC_POSIF_t *const peripheral) +{ + return ((uint8_t)((peripheral->HALP & POSIF_HALP_HCP_Msk) >> POSIF_HALP_HCP_Pos)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint8_t Returns expected hall sensor pattern. Range : [0-7] + * + * \parDescription
+ * Returns expected hall sensor pattern of \a peripheral.\n + * Retrieves the expected hall sensor pattern from \a HALP register's \a HEP bit field of \a peripheral. + * Applications can at any point in time retrieve the expected hall sensor pattern by invoking this API. + * + * \parNote
+ * This is applicable only to the hall sensor mode of operation. + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_GetLastSampledPattern(),XMC_POSIF_HSC_GetCurrentPattern() \n\n\n + */ +__STATIC_INLINE uint8_t XMC_POSIF_HSC_GetExpectedPattern(XMC_POSIF_t *const peripheral) +{ + return ((uint8_t)((peripheral->HALP & POSIF_HALP_HEP_Msk) >> POSIF_HALP_HEP_Pos)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param pattern The hall sensor pattern to be programmed into current pattern [0-7] + * @retval None + * + * \parDescription
+ * Configures current Hall sensor \a pattern of \a peripheral.\n + * Configures the Current hall sensor pattern on \a HALPS shadow register's \a HCPS bit field of \a peripheral. + * Applications can set at any point in time program the current hall sensor pattern by invoking this API. + * + * \parNote
+ * This is applicable only to the hall sensor mode of operation. It may be noted that the pattern is merely + * written to the shadow register. Transfer from the shadow register is based on a hardware transfer trigger + * or software trigger through API @ref XMC_POSIF_HSC_UpdateHallPattern(). + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_GetCurrentPattern(),XMC_POSIF_HSC_SetExpectedPattern() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_HSC_SetCurrentPattern(XMC_POSIF_t *const peripheral, const uint8_t pattern) +{ + peripheral->HALPS = ((peripheral->HALPS & ~(uint32_t)(POSIF_HALPS_HCPS_Msk)) | + (((uint32_t)pattern << POSIF_HALPS_HCPS_Pos) & (uint32_t)POSIF_HALPS_HCPS_Msk)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param pattern The hall sensor pattern to be programmed into expected pattern [0-7] + * @retval None + * + * \parDescription
+ * Configures the expected hall sensor \a pattern of \a peripheral.\n + * Applications can set at any point in time program the hall sensor expected patterns by invoking this API. + * Configures the expected hall sensor pattern on \a HALPS shadow register's \a HEPS bit field of \a peripheral. + * + * \parNote
+ * This is applicable only to the hall sensor mode of operation.It may be noted that the pattern is merely + * written to the shadow register. Transfer from the shadow register is based on a hardware transfer trigger + * or software trigger through API @ref XMC_POSIF_HSC_UpdateHallPattern(). + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_GetExpectedPattern() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_HSC_SetExpectedPattern(XMC_POSIF_t *const peripheral, const uint8_t pattern) +{ + peripheral->HALPS = ((peripheral->HALPS & ~(uint32_t)(POSIF_HALPS_HEPS_Msk)) | + (((uint32_t)pattern << POSIF_HALPS_HEPS_Pos) & (uint32_t)POSIF_HALPS_HEPS_Msk)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param pattern_mask The hall sensor pattern mask [0-63] Format of mask: (expected_pattern << 3) | (current_pattern) + * @retval None + * + * \parDescription
+ * Configures current and expected hall pattern of \a peripheral. \n + * Configures \a HALPS register with the Current and Expected hall sensor patterns in one operation. + * Applications can at any point in time program the current and expected hall sensor pattern by invoking this API. + * + * \parNote
+ * This is applicable only to the hall sensor mode of operation. It may be noted that the pattern is merely + * written to the shadow register. Transfer from the shadow register is based on a hardware transfer trigger + * or software trigger through API @ref XMC_POSIF_HSC_UpdateHallPattern(). + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_SetExpectedPattern(),XMC_POSIF_HSC_SetCurrentPattern() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_HSC_SetHallPatterns(XMC_POSIF_t *const peripheral, const uint8_t pattern_mask) +{ + peripheral->HALPS = (uint32_t)(pattern_mask & (POSIF_HALPS_HCPS_Msk | POSIF_HALPS_HEPS_Msk)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval None + * + * \parDescription
+ * Manually performs shadow transfer of hall sensor patterns.\n + * Configures \a MCMS register's \a STHR bit field with 1. + * Setting this bit to 1 leads to an immediate update of the fields \a HALP.HCP(Current pattern) and \a HALP.HEP(Expected pattern). + * + * \parNote
+ * The transfer of hall sensor pattern shadow registers content to the sensor pattern register happens under two + * conditions. A hardware trigger starts the shadow transfer. Alternatively, the shadow transfer can be initiated + * by application software by means of invocation of this API. + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_SetHallPatterns() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_HSC_UpdateHallPattern(XMC_POSIF_t *const peripheral) +{ + peripheral->MCMS = (uint32_t)POSIF_MCMS_STHR_Msk; +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param pattern The 16b multi-channel pattern [0-65535] + * @retval None + * + * \parDescription
+ * Configures \a MCSM register with Multi-Channel Pattern.\n + * This 16b multi-channel pattern which controls the 16 outputs of all slices of a CCU8 module. + * Transfer from the shadow register is based on a hardware transfer trigger + * or software trigger through API @ref XMC_POSIF_MCM_UpdateMultiChannelPattern(). + * Every time that a Multi-Channel pattern transfer is triggered, this value is passed into the field \a MCM.MCMP of \a peripheral + * + * \parNote
+ * It may be noted that the pattern is merely written to the shadow register. + * + * \parRelated APIs:
+ * XMC_POSIF_MCM_GetMultiChannelPattern() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_MCM_SetMultiChannelPattern(XMC_POSIF_t *const peripheral, const uint16_t pattern) +{ + peripheral->MCSM = pattern; +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint16_t Returns configured multi channel pattern + * + * \parDescription
+ * Returns configured multi channel pattern of \a peripheral. \n + * Retrieves the Multi-Channel Pattern from \a MCM register's MCMP bit field of \a peripheral + * Applications can at any point in time retrieve the multi-channel pattern by invoking this API. + * + * \parRelated APIs:
+ * XMC_POSIF_MCM_SetMultiChannelPattern() \n\n\n + */ +__STATIC_INLINE uint16_t XMC_POSIF_MCM_GetMultiChannelPattern(XMC_POSIF_t *const peripheral) +{ + return ((uint16_t)(peripheral->MCM & (uint32_t)POSIF_MCM_MCMP_Msk)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint16_t Returns configured multi channel pattern present in shadow transfer register + * + * \parDescription
+ * Returns configured multi channel pattern in shadow register of \a peripheral. \n + * Retrieves the Multi-Channel Pattern from \a MCSM shadow register's \a MCMPS bit field. + * Applications can at any point in time retrieve the multi-channel pattern by invoking this API. + * + * It can be used when MCM is enabled. + * + * \parRelated APIs:
+ * XMC_POSIF_MCM_SetMultiChannelPattern() \n\n\n + */ +__STATIC_INLINE uint16_t XMC_POSIF_MCM_GetShadowMultiChannelPattern(XMC_POSIF_t *const peripheral) +{ + return ((uint16_t)(peripheral->MCSM & (uint32_t)POSIF_MCSM_MCMPS_Msk)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval None + * + * \parDescription
+ * Performs shadow transfer of the Multi-Channel Pattern register by configuring \a MCMS register's \a STMR bit field. + * + * \parNote
+ * Transfer multi-channel pattern shadow registers content to the actual pattern register of \a peripheral. \n + * The transfer of multi-channel pattern shadow registers content to the actual pattern register happens under two + * conditions. A hardware trigger starts the shadow transfer. Alternatively, the shadow transfer can be initiated + * by application software by means of invocation of this API. + * + * \parRelated APIs:
+ * XMC_POSIF_MCM_SetMultiChannelPattern() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_MCM_UpdateMultiChannelPattern(XMC_POSIF_t *const peripheral) +{ + peripheral->MCMS |= (uint32_t)POSIF_MCMS_STMR_Msk; +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval None + * + * \parDescription
+ * Enables update of the Multi-Channel Pattern by software in standalone multi-channel mode.\n + * Enabling update of multi-channel pattern happens under two conditions. A hardware trigger enables this update. + * Alternatively, this can be enabled by software by means of invocation of this API. + * + * \parNote
+ * The update is not done immediately due to the fact that the trigger that synchronizes the update with the PWM is + * still needed. + * + * \parRelated APIs:
+ * XMC_POSIF_MCM_UpdateMultiChannelPattern() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_MCM_EnableMultiChannelPatternUpdate(XMC_POSIF_t *const peripheral) +{ + peripheral->MCMS |= (uint32_t)POSIF_MCMS_MNPS_Msk; +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval XMC_POSIF_QD_DIR_t Return direction of revolution of the motor of type @ref XMC_POSIF_QD_DIR_t + * + * \parDescription
+ * Returns the direction of revolution of the motor.\n + * Retrieves direction from \a QDC register's \a DVAL bit field in quadrature mode. + * Applications can at any point in time retrieve the direction of rotation by invoking this API. + * + * \parNote
+ * This is applicable only to the quadrature decoder mode of operation. + * + */ +__STATIC_INLINE XMC_POSIF_QD_DIR_t XMC_POSIF_QD_GetDirection(XMC_POSIF_t *const peripheral) +{ + return ((XMC_POSIF_QD_DIR_t)((peripheral->QDC & POSIF_QDC_DVAL_Msk) >> POSIF_QDC_DVAL_Pos)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint8_t Returns current state of quadrature decoder[Phase B,Phase A] + * + * \parDescription
+ * Returns the current state of phase signals in quadrature decoder mode of \a peripheral. \n + * Retrieves current state of the quadrature decoder from \a PDBG register's \a QCSV bit fields. + * Applications can at any point in time retrieve the current state of Phase A and Phase B signals + * by invoking this API. + * + * \parNote
+ * This is applicable only to the quadrature decoder mode of operation. + * + * \parRelated APIs:
+ * XMC_POSIF_QD_GetPreviousState() \n\n\n + */ +__STATIC_INLINE uint8_t XMC_POSIF_QD_GetCurrentState(XMC_POSIF_t *const peripheral) +{ + return ((uint8_t)((peripheral->PDBG & POSIF_PDBG_QCSV_Msk) >> POSIF_PDBG_QCSV_Pos)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint8_t Returns previous state of quadrature decoder[Phase B,Phase A] + * + * \parDescription
+ * Returns the previous state of phase signals in quadrature decoder mode of \a peripheral. \n + * Retrieves previous state of the quadrature decoder from \a PDBG register's \a QPSV bit fields. + * Applications can at any point in time retrieve the previous state of Phase A and Phase B signals + * by invoking this API. + * + * \parNote
+ * This is applicable only to the quadrature decoder mode of operation. + * + * \parRelated APIs:
+ * XMC_POSIF_QD_GetCurrentState() \n\n\n + */ +__STATIC_INLINE uint8_t XMC_POSIF_QD_GetPreviousState(XMC_POSIF_t *const peripheral) +{ + return ((uint8_t)((peripheral->PDBG & POSIF_PDBG_QPSV_Msk) >> POSIF_PDBG_QPSV_Pos)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint8_t Returns the index value.[1 - New rotation started, 0 - In-between] + * + * \parDescription
+ * Returns the current index value in quadrature decoder mode of \a peripheral. \n + * Retrieves current index signal value of the quadrature decoder from \a PDBG register's \a IVAL bit field. + * Applications can at any point in time retrieve the current index signal value of the quadrature decoder by + * invoking this API. + * + * \parNote
+ * This is applicable only to the quadrature decoder mode of operation. + * + */ +__STATIC_INLINE uint8_t XMC_POSIF_QD_GetCurrentIndexValue(XMC_POSIF_t *const peripheral) +{ + return ((uint8_t)((peripheral->PDBG & POSIF_PDBG_IVAL_Msk) >> POSIF_PDBG_IVAL_Pos)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param event Event to be enabled + * @retval None + * + * \parDescription
+ * Enables \a event generation of \a peripheral. \n + * Enables an IRQ generation capable \a event by configuring 1 to \a PFLGE register's \a event bit field. + * + * \parRelated APIs:
+ * XMC_POSIF_DisableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_EnableEvent(XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) +{ + peripheral->PFLGE |= (uint32_t)1 << (uint8_t)event; +} + +/** + * @brief Disables an IRQ generation capable event + * @param peripheral Pointer to an instance of POSIF module + * @param event Event to be disabled + * @retval None + * + * \parDescription
+ * Disables \a event generation of \a peripheral.\n + * Disables an IRQ generation capable \a event by configuring 0 to \a PFLGE register's \a event bit field. + * + * \parRelated APIs:
+ * XMC_POSIF_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_DisableEvent(XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) +{ + peripheral->PFLGE &= ~((uint32_t)1 << (uint8_t)event); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param event Event to be manually asserted + * @retval None + * + * \parDescription
+ * Manually generates \a event of \a peripheral. \n + * Manually asserts an IRQ generation capable event by configuring 1 to \a SPFLG register's \a event bit field. + * + * \parRelated APIs:
+ * XMC_POSIF_ClearEvent() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_SetEvent(XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) +{ + peripheral->SPFLG = (uint32_t)1 << (uint8_t)event; +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param event Event to be acknowledged + * @retval None + * + * \parDescription
+ * Clears \a event by acknowledgment of \a peripheral. \n + * Acknowledges an IRQ event by configuring 1 to \a RPFLG register's \a event bit field. + * + * \parRelated APIs:
+ * XMC_POSIF_SetEvent() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_ClearEvent(XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) +{ + peripheral->RPFLG = (uint32_t)1 << (uint8_t)event; +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param event Event ID to be checked for status + * @retval uint8_t Returns event status + * + * \parDescription
+ * Returns \a event status of \a peripheral. \n + * Determines if IRQ event is asserted by retrieving data from \a PFLG register's \a event bit field. + * + * \parRelated APIs:
+ * XMC_POSIF_SetEvent(),XMC_POSIF_ClearEvent() \n\n\n + */ +__STATIC_INLINE uint8_t XMC_POSIF_GetEventStatus(XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) +{ + return ((uint8_t)((peripheral->PFLG >> (uint8_t)event) & 1U)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param event Event to be acknowledged of type @ref XMC_POSIF_IRQ_EVENT_t + * @param sr Service request line of type @ref XMC_POSIF_SR_ID_t + * @retval None + * + * \parDescription
+ * Configures \a event to generate \a sr (service request) of \a peripheral. \n + * Binds an IRQ event to a service request line by configuring \a PFLGE register's \a event bit field. + */ +void XMC_POSIF_SetInterruptNode(XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event, const XMC_POSIF_SR_ID_t sr); + +#ifdef __cplusplus +} +#endif /* #if defined(POSIF0) */ + +/** + * @} + */ + +/** + * @} + */ + +#endif + +#endif /* XMC_POSIF_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_prng.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_prng.h new file mode 100644 index 00000000..4b8dce2a --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_prng.h @@ -0,0 +1,285 @@ + +/** + * @file xmc_prng.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * - Documentation updates
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * @endcond + */ + +#ifndef XMC_PRNG_H +#define XMC_PRNG_H + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ + +#include "xmc_common.h" + +#if defined (PRNG) + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup PRNG + * @brief Pseudo Random Number Generator (PRNG) driver for XMC1000 microcontroller family + * + * The pseudo random bit generator (PRNG) provides random data with fast generation times. + * PRNG has to be initialized by the user software before use. The initialization consists + * of two basic phases: key-loading and warm-up. + * + * The PRNG low level driver provides functions to configure and initialize the PRNG hardware + * peripheral. + * @{ + */ + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ + +/** + * Byte mask value for random data block size + */ +#define XMC_PRNG_RDBS_BYTE_READ_MASK (0x00FFU) + +/********************************************************************************************************************* + * ENUMS + *********************************************************************************************************************/ + +/** + * PRNG key load operation modes + */ +typedef enum XMC_PRNG_KEY_LOAD_OP_MODE { + XMC_PRNG_STRM_MODE = 0U, /**< Streaming mode (default) */ + XMC_PRNG_KLD_MODE = 1U /**< Loading mode */ +} XMC_PRNG_KEY_LOAD_OP_MODE_t; + +/** + * PRNG data block size + */ +typedef enum XMC_PRNG_DATA_BLOCK_SIZE { + XMC_PRNG_RDBS_RESET = 0U, /**< Reset state (no random data block size defined) */ + XMC_PRNG_RDBS_BYTE = 1U, /**< BYTE (8-bit) */ + XMC_PRNG_RDBS_WORD = 2U /**< WORD (16-bit) */ +} XMC_PRNG_DATA_BLOCK_SIZE_t; + +/** + * PRNG driver initialization status + */ +typedef enum XMC_PRNG_INIT_STATUS { + XMC_PRNG_NOT_INITIALIZED = 0U, /**< Reset state or Non-initialized state (Same as XMC_PRNG_RDBS_RESET) */ + XMC_PRNG_INITIALIZED = 1U /**< Initialized state */ +} XMC_PRNG_INIT_STATUS_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + *********************************************************************************************************************/ + +/** + * Key words and data block size configuration values of PRNG
+ * + * The structure presents a convenient way to set/obtain the key word and data block configuration + * values of PRNG. + * The XMC_PRNG_Init() can be used to populate the structure with the key word and data block + * configuration values of the PRNG module. + */ +typedef struct XMC_PRNG_INIT +{ + uint16_t key_words[5]; /**< Keywords */ + XMC_PRNG_DATA_BLOCK_SIZE_t block_size; /**< Block size */ +} XMC_PRNG_INIT_t; + +/********************************************************************************************************************* + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param prng Pointer to a constant instance of ::XMC_PRNG_INIT_t, pointing to + * the initialization configuration. + * @return XMC_PRNG_INIT_STATUS_t XMC_PRNG_INITIALIZED if initialized, + * XMC_PRNG_NOT_INITIALIZED otherwise. + * + * \parDescription:
+ * Initialize the PRNG peripheral with the configured key words and block size
+ * + * \par + * The function configures block size for key loading mode, enables key loading mode, + * loads key words (80 bits) and wait till RDV is set, enables the streaming mode and + * waits for warmup phase. This function programmes the CTRL and WORD registers. + */ +XMC_PRNG_INIT_STATUS_t XMC_PRNG_Init(const XMC_PRNG_INIT_t *prng); + + + +/** + * @param block_size Block size of type ::XMC_PRNG_DATA_BLOCK_SIZE_t for read access + * @return None + * + * \parDescription:
+ * Programming Random Block Size
+ * + * \par + * The function sets the random data block size as byte or word by programming CTRL.RDBS bitfield. + * block_size = 0 for Reset state, block_size = 1 for 'byte' and block_size = 2 for 'word'. + */ +__STATIC_INLINE void XMC_PRNG_SetRandomDataBlockSize(XMC_PRNG_DATA_BLOCK_SIZE_t block_size) +{ + PRNG->CTRL = (uint16_t)((PRNG->CTRL & (uint32_t)~PRNG_CTRL_RDBS_Msk) | + ((uint32_t)block_size << (uint32_t)PRNG_CTRL_RDBS_Pos)); +} + +/** + * @return None + * + * \parDescription:
+ * Checks the validity (CHK.RDV bit) of the generated random data
+ * + * \par + * The function checks the validity (CHK.RDV bit) of the generated random data. + * In key loading mode, this value indicates if the next partial key word can be written + * to PRNG_WORD or not. + */ +__STATIC_INLINE uint16_t XMC_PRNG_CheckValidStatus(void) +{ + return (PRNG->CHK & PRNG_CHK_RDV_Msk); +} + +/** + * @return None + * + * \parDescription:
+ * Enables the PRNG key loading mode
+ * + * \par + * The function initializes the key loading by setting the bit CTRL.KLD. In this mode, Register WORD + * acts as always as a 16 bit destination register. After the complete key has been loaded, the CTRL.KLD + * must be set to '0' to prepare the following warmup phase. + * + * \parRelated APIs:
+ * XMC_PRNG_EnableStreamingMode() + */ +__STATIC_INLINE void XMC_PRNG_EnableKeyLoadingMode(void) +{ + PRNG->CTRL |= (uint16_t)PRNG_CTRL_KLD_Msk; +} + +/** + * @return None + * + * \parDescription:
+ * Enables the Streaming mode
+ * + * \par + * The function enables the streaming mode and disables the PRNG key loading mode by resetting the + * CTRL.KLD bit. + * + * \parRelated APIs:
+ * XMC_PRNG_EnableKeyLoadingMode() + */ +__STATIC_INLINE void XMC_PRNG_EnableStreamingMode(void) +{ + PRNG->CTRL &= (uint16_t)~PRNG_CTRL_KLD_Msk; +} + +/** + * @param key Key word to load into PRNG WORD register + * @return None + * + * \parDescription:
+ * Loads a partial key word to the PRNG WORD register
+ * + * \par + * The function loads partial key word to WORD registr. These partial + * words are sequentially written and loading a key word will take 16 clock + * cycles. The CHK.RDV bit is set to '0' while loading is in progress. '1' indicates + * that the next partial key word can be written to WORD register. + */ +__STATIC_INLINE void XMC_PRNG_LoadKeyWords(uint16_t key) +{ + PRNG->WORD = key; +} + +/** + * @param None + * @return uint16_t Generated random number + * + * \parDescription:
+ * Gets the generated random number
+ * + * \par + * The function gives the generated random number by returning the content of WORD + * register. Before reading the WORD register to get the generated random number it is + * required to check the bit CHK.RDV is set which indicates that the next random data block + * can be read from WORD register. After a word has been read the bit CHK.RDV is reset + * by the hardware and generation of new random bits starts. + * + * \parRelated APIs:
+ * XMC_PRNG_CheckValidStatus() + */ +__STATIC_INLINE uint16_t XMC_PRNG_GetPseudoRandomNumber(void) +{ + return PRNG->WORD; +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* #if defined (PRNG) */ + +#endif /* XMC_PRNG_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_rtc.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_rtc.h new file mode 100644 index 00000000..f0b7d3a5 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_rtc.h @@ -0,0 +1,683 @@ +/** + * @file xmc_rtc.h + * @date 2016-05-19 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial + * + * 2015-05-20: + * - Documentation updates
+ * - In xmc1_rtc file XMC_RTC_Init function + * is modified by adding the RTC running condition check + * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * 2016-05-19: + * - Added XMC_RTC_SetTimeStdFormat() and XMC_RTC_SetAlarmStdFormat() + * + * @endcond + * + */ + +#ifndef XMC_RTC_H +#define XMC_RTC_H + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ + +#include +#include + +/** + * + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup RTC + * @brief RTC driver for XMC microcontroller family. + * + * Real-time clock (RTC) is a clock that keeps track of the current time. Precise + * real time keeping is with a 32.768 KHz external crystal clock or a 32.768 KHz + * high precision internal clock. It provides a periodic time based interrupt and + * a programmable alarm interrupt on time match. It also supports wakeup from + * hibernate. + * + * The RTC low level driver provides functions to configure and initialize the RTC + * hardware peripheral. + * + * @{ + */ + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************* + * ENUMS + *********************************************************************************************************************/ + +/** + * Status return values for RTC low level driver + */ +typedef enum XMC_RTC_STATUS +{ + XMC_RTC_STATUS_OK = 0U, /**< Operation successful */ + XMC_RTC_STATUS_ERROR = 1U, /**< Operation unsuccessful */ + XMC_RTC_STATUS_BUSY = 2U /**< Busy with a previous request */ +} XMC_RTC_STATUS_t; + +/** + * Events which enables interrupt request generation + */ +typedef enum XMC_RTC_EVENT +{ + XMC_RTC_EVENT_PERIODIC_SECONDS = RTC_MSKSR_MPSE_Msk, /**< Mask value to enable an event on periodic seconds */ + XMC_RTC_EVENT_PERIODIC_MINUTES = RTC_MSKSR_MPMI_Msk, /**< Mask value to enable an event on periodic seconds */ + XMC_RTC_EVENT_PERIODIC_HOURS = RTC_MSKSR_MPHO_Msk, /**< Mask value to enable an event on periodic seconds */ + XMC_RTC_EVENT_PERIODIC_DAYS = RTC_MSKSR_MPDA_Msk, /**< Mask value to enable an event on periodic seconds */ + XMC_RTC_EVENT_PERIODIC_MONTHS = RTC_MSKSR_MPMO_Msk, /**< Mask value to enable an event on periodic seconds */ + XMC_RTC_EVENT_PERIODIC_YEARS = RTC_MSKSR_MPYE_Msk, /**< Mask value to enable an event on periodic seconds */ + XMC_RTC_EVENT_ALARM = RTC_MSKSR_MAI_Msk /**< Mask value to enable an event on periodic seconds */ +} XMC_RTC_EVENT_t; + +/** + * Months used to program the date + */ +typedef enum XMC_RTC_MONTH +{ + XMC_RTC_MONTH_JANUARY = 0U, + XMC_RTC_MONTH_FEBRUARY = 1U, + XMC_RTC_MONTH_MARCH = 2U, + XMC_RTC_MONTH_APRIL = 3U, + XMC_RTC_MONTH_MAY = 4U, + XMC_RTC_MONTH_JUNE = 5U, + XMC_RTC_MONTH_JULY = 6U, + XMC_RTC_MONTH_AUGUST = 7U, + XMC_RTC_MONTH_SEPTEMBER = 8U, + XMC_RTC_MONTH_OCTOBER = 9U, + XMC_RTC_MONTH_NOVEMBER = 10U, + XMC_RTC_MONTH_DECEMBER = 11U +} XMC_RTC_MONTH_t; + +/** + * Week days used program the date + */ +typedef enum XMC_RTC_WEEKDAY +{ + XMC_RTC_WEEKDAY_SUNDAY = 0U, + XMC_RTC_WEEKDAY_MONDAY = 1U, + XMC_RTC_WEEKDAY_TUESDAY = 2U, + XMC_RTC_WEEKDAY_WEDNESDAY = 3U, + XMC_RTC_WEEKDAY_THURSDAY = 4U, + XMC_RTC_WEEKDAY_FRIDAY = 5U, + XMC_RTC_WEEKDAY_SATURDAY = 6U +} XMC_RTC_WEEKDAY_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + *********************************************************************************************************************/ +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + + +/** + * Alarm time values of RTC
+ * + * The structure presents a convenient way to set/obtain the + * alarm time values for seconds, minutes, hours, days, month and year of RTC. + * The XMC_RTC_SetAlarm() and XMC_RTC_GetAlarm() can be + * used to populate the structure with the alarm time value of + * RTC + */ +typedef struct XMC_RTC_ALARM +{ + union + { + uint32_t raw0; + struct + { + uint32_t seconds : 6; /**< Alarm seconds compare value (0-59: Above this causes this bitfield to be set with 0)*/ + uint32_t : 2; + uint32_t minutes : 6; /**< Alarm minutes compare value (0-59: Above this causes this bitfield to be set with 0)*/ + uint32_t : 2; + uint32_t hours : 5; /**< Alarm hours compare value (0-23: Above this causes this bitfield to be set with 0)*/ + uint32_t : 3; + uint32_t days : 5; /**< Alarm days compare value (0-Actual days of month: Above this causes this bitfield to be set with 0)*/ + uint32_t : 3; + }; + }; + + union + { + uint32_t raw1; + struct + { + uint32_t : 8; + uint32_t month : 4; /**< Alarm month compare value (0-11: Above this causes this bitfield to be set with 0) */ + uint32_t : 4; + uint32_t year : 16; /**< Alarm year compare value */ + }; + }; +} XMC_RTC_ALARM_t; + +/** + * Time values of RTC
+ * + * The structure presents a convenient way to set/obtain the + * time values for seconds, minutes, hours, days, month and year of RTC. + * The XMC_RTC_SetTime() and XMC_RTC_GetTime() can be + * used to populate the structure with the time value of + * RTC + */ +typedef struct XMC_RTC_TIME +{ + union + { + uint32_t raw0; + struct + { + uint32_t seconds : 6; /**< Seconds time value (0-59: Above this causes this bitfield to be set with 0) */ + uint32_t : 2; + uint32_t minutes : 6; /**< Minutes time value (0-59: Above this causes this bitfield to be set with 0) */ + uint32_t : 2; + uint32_t hours : 5; /**< Hours time value (0-23: Above this causes this bitfield to be set with 0) */ + uint32_t : 3; + uint32_t days : 5; /**< Days time value (0-Actual days of month: Above this causes this bitfield to be set with 0)*/ + uint32_t : 3; + }; + }; + + union + { + uint32_t raw1; + struct + { + uint32_t daysofweek : 3; /**< Days of week time value (0-6: Above this causes this bitfield to be set with 0) */ + uint32_t : 5; + uint32_t month : 4; /**< Month time value (0-11: Above this causes this bitfield to be set with 0) */ + uint32_t : 4; + uint32_t year : 16; /**< Year time value */ + }; + }; +} XMC_RTC_TIME_t; +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif + +/** + * RTC initialization with time, alarm and clock divider(prescaler) configurations
+ * + * The structure presents a convenient way to set/obtain the time and alarm configurations + * for RTC. The XMC_RTC_Init() can be used to populate the structure with the time and alarm + * values of RTC. + */ +typedef struct XMC_RTC_CONFIG +{ + XMC_RTC_TIME_t time; + XMC_RTC_ALARM_t alarm; + uint16_t prescaler; +} XMC_RTC_CONFIG_t; + +/******************************************************************************* + * EXTENSIONS + *******************************************************************************/ + +#if UC_FAMILY == XMC1 +#include "xmc1_rtc.h" +#endif + +#if UC_FAMILY == XMC4 +#include "xmc4_rtc.h" +#endif + +/******************************************************************************* + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param config Constant pointer to a constant ::XMC_RTC_CONFIG_t structure containing the + * time, alarm time and clock divider(prescaler) configuration. + * @return XMC_RTC_STATUS_t Always returns XMC_RTC_STATUS_OK (It contains only register assignment statements) + * + * \parDescription:
+ * Initialize the RTC peripheral
+ * + * \par \if XMC4 + * The function enables the hibernate domain for accessing RTC peripheral registers, configures + * internal clock divider, time and alarm values by writing to the CTR.DIV, TIM0, TIM1, ATIM0 and + * ATIM1 registers. + * \endif + * + * \if XMC1 + * The function ungates the peripheral clock for RTC, configures + * internal clock divider, time and alarm values by writing to the CTR.DIV, TIM0, TIM1, ATIM0 and + * ATIM1 registers. + * \endif + */ +XMC_RTC_STATUS_t XMC_RTC_Init(const XMC_RTC_CONFIG_t *const config); + +/** + * @return None + * + * \parDescription
+ * Enables RTC peripheral for programming its registers
+ * + * \par \if XMC4 + * Enables the hibernate domain for accessing RTC peripheral registers. + * \endif + * + * \if XMC1 + * Ungates the peripheral clock. + * \endif + * + * \parRelated APIs:
+ * XMC_RTC_Disable(), XMC_SCU_RESET_DeassertPeripheralReset() + */ +void XMC_RTC_Enable(void); + +/** + * @return None + * + * \parDescription
+ * Disables RTC peripheral for programming its registers
+ * + * \par \if XMC4 + * Empty function (Hibernate domain is not disabled). + * \endif + * + * \if XMC1 + * Gates the peripheral clock. + * \endif + * + * \parRelated APIs:
+ * XMC_RTC_Enable(), XMC_SCU_RESET_AssertPeripheralReset() + */ +void XMC_RTC_Disable(void); + +/** + * @return None + * + * \parDescription
+ * Checks RTC peripheral is enabled for programming its registers
+ * + * \par \if XMC4 + * Checks the hibernate domain is enabled or not. + * \endif + * + * \if XMC1 + * Checks peripheral clock is ungated or not. + * \endif + * + * \parRelated APIs:
+ * XMC_RTC_Enable(), XMC_RTC_Disable(), XMC_SCU_RESET_DeassertPeripheralReset(), + * XMC_SCU_RESET_AssertPeripheralReset() + */ +bool XMC_RTC_IsEnabled(void); + +/** + * @return None + * + * \parDescription
+ * Enables RTC peripheral to start counting time
+ * + * \par + * The function starts the RTC for counting time by setting + * CTR.ENB bit. Before starting the RTC, it should not be in + * running mode and also hibernate domain should be enabled. + * + * \parRelated APIs:
+ * XMC_RTC_Enable(), XMC_RTC_Stop(), XMC_SCU_RESET_DeassertPeripheralReset() + */ +void XMC_RTC_Start(void); + +/** + * @return None + * + * \parDescription
+ * Disables RTC peripheral to start counting time
+ * + * \par + * The function stops the RTC for counting time by resetting + * CTR.ENB. Before stopping the RTC, hibernate domain should be enabled. + * + * \parRelated APIs:
+ * XMC_RTC_Enable(), XMC_RTC_Start(), XMC_SCU_RESET_AssertPeripheralReset() + */ +void XMC_RTC_Stop(void); + +/** + * @param prescaler Prescaler value to be set + * @return None + * + * \parDescription:
+ * Sets the RTC module prescaler value
+ * + * \par + * The function sets the CTR.DIV bitfield to configure the prescalar value. + * The default value for the prescalar with the 32.768kHz crystal (or the internal clock) + * is 7FFFH for a time interval of 1 sec. Before setting the prescaler value RTC should be + * in stop mode and hibernate domain should be enabled. + * + * \parRelated APIs:
+ * XMC_RTC_Stop(), XMC_RTC_Enable(), XMC_RTC_GetPrescaler() + */ +void XMC_RTC_SetPrescaler(uint16_t prescaler); + +/** + * @return None + * + * \parDescription:
+ * Gets the RTC module prescaler value
+ * + * \par + * The function reads the CTR.DIV bitfield to get the prescalar value. The default value + * for the prescalar with the 32.768kHz crystal (or the internal clock) is 7FFFH for a + * time interval of 1 sec. + * + * \parRelated APIs:
+ * XMC_RTC_SetPrescaler() + */ +__STATIC_INLINE uint32_t XMC_RTC_GetPrescaler(void) +{ + return (uint32_t)(((uint32_t)RTC->CTR & (uint32_t)RTC_CTR_DIV_Msk) >> (uint32_t)RTC_CTR_DIV_Pos); +} + +/** + * @param timeval Contstant pointer to a constant ::XMC_RTC_TIME_t structure containing the + * time parameters seconds, minutes, hours, days, daysofweek, month and year. + * @return None + * + * \parDescription:
+ * Sets the RTC module time values
+ * + * \par + * The function sets the TIM0, TIM1 registers with time values. + * The values can only be written when RTC is disabled. + * See the structure ::XMC_RTC_TIME_t for the valid range of time value parameters.
+ * + * \parRelated APIs:
+ * XMC_RTC_GetTime(), XMC_RTC_Stop() + */ +void XMC_RTC_SetTime(const XMC_RTC_TIME_t *const timeval); + +/** + * @param time Pointer to a constant ::XMC_RTC_TIME_t structure containing the time parameters + * seconds, minutes, hours, days, daysofweek, month and year. + * @return None + * + * \parDescription:
+ * Gets the RTC module time value
+ * + * \par + * The function gets the time values from TIM0, TIM1 registers. + * See the structure ::XMC_RTC_TIME_t for the valid range of time value parameters.
+ * + * \parRelated APIs:
+ * XMC_RTC_SetTime() + */ +void XMC_RTC_GetTime(XMC_RTC_TIME_t *const time); + +/** + * @param stdtime Pointer to a ::tm structure containing the time parameters seconds, + * minutes, hours, days, daysofweek, month, year(since 1900) and days in a + * year in standard format. + * @return None + * + * \parDescription:
+ * Sets the RTC module time value in standard format
+ * + * \par + * The function sets the time values from TIM0, TIM1 registers. + * + * \parRelated APIs:
+ * XMC_RTC_SetTime(), XMC_RTC_GetTime() + */ +void XMC_RTC_SetTimeStdFormat(const struct tm *const stdtime); + +/** + * @param stdtime Pointer to a constant ::tm structure containing the time parameters seconds, + * minutes, hours, days, daysofweek, month, year(since 1900) and days in a + * year in standard format. + * @return None + * + * \parDescription:
+ * Gets the RTC module time value in standard format
+ * + * \par + * The function gets the time values from TIM0, TIM1 registers. + * See the structure ::XMC_RTC_TIME_t for the valid range of time value parameters.
+ * For days the valid range is (1 - Actual days of month), year (since 1900) and + * daysinyear (0 -365). + * + * \parRelated APIs:
+ * XMC_RTC_SetTime(), XMC_RTC_GetTime() + */ +void XMC_RTC_GetTimeStdFormat(struct tm *const stdtime); + +/** + * @param alarm Constant pointer to a constant ::XMC_RTC_ALARM_t structure containing the + * alarm time parameters alarm seconds, alarm minutes, alarm hours, alarm days, + * alarm daysofweek, alarm month and alarm year. + * @return None + * + * \parDescription:
+ * Sets the RTC module alarm time value
+ * + * \par + * The function sets the ATIM0, ATIM1 registers with alarm time values. + * See the structure ::XMC_RTC_ALARM_t for the valid range of alarm time value parameters.
+ * + * \parRelated APIs:
+ * XMC_RTC_GetAlarm() + */ +void XMC_RTC_SetAlarm(const XMC_RTC_ALARM_t *const alarm); + +/** + * @param alarm Pointer to a constant ::XMC_RTC_ALARM_t structure containing the + * time parameters alarm seconds, alarm minutes, alarm hours, alarm days, + * alarm daysofweek, alarm month and alarm year. + * @return None + * + * \parDescription:
+ * Gets the RTC module alarm time value
+ * + * \par + * The function gets the alarm time values from ATIM0, ATIM1 registers. + * See the structure ::XMC_RTC_ALARM_t for the valid range of alarm time value parameters.
+ * + * \parRelated APIs:
+ * XMC_RTC_SetAlarm() + */ +void XMC_RTC_GetAlarm(XMC_RTC_ALARM_t *const alarm); + +/** + * @param stdtime Pointer to a ::tm structure containing the time parameters alarm seconds, + * alarm minutes, alarm hours, alarm days, alarm daysofweek, alarm month, + * alarm year(since 1900) and alarm days in a year in standard format. + * @return None + * + * \parDescription:
+ * Sets the RTC module alarm time value in standard format
+ * + * \par + * The function sets the alarm time values from ATIM0, ATIM1 registers. + * + * \parRelated APIs:
+ * XMC_RTC_SetAlarm(), XMC_RTC_GetAlarm() + */ +void XMC_RTC_SetAlarmStdFormat(const struct tm *const stdtime); + +/** + * @param stdtime Pointer to a constant ::tm structure containing the time parameters alarm seconds, + * alarm minutes, alarm hours, alarm days, alarm daysofweek, alarm month, + * alarm year(since 1900) and alarm days in a year in standard format. + * @return None + * + * \parDescription:
+ * Gets the RTC module alarm time value in standard format
+ * + * \par + * The function gets the alarm time values from ATIM0, ATIM1 registers. + * See the structure ::XMC_RTC_ALARM_t for the valid range of alarm time value parameters.
+ * For days the valid range is (1 - Actual days of month), year (since 1900) and + * daysinyear (0 -365). + * + * \parRelated APIs:
+ * XMC_RTC_SetAlarm(), XMC_RTC_GetAlarm() + */ +void XMC_RTC_GetAlarmStdFormat(struct tm *const stdtime); + +/** + * @param event A valid RTC event (::XMC_RTC_EVENT_t) or a valid combination of + * logically OR'd events + * @return None + * + * \parDescription:
+ * Enable RTC periodic and alarm event(s)
+ * + * \par + * The function sets the bitfields of MSKSR register to enable interrupt generation + * for requested RTC event(s). + * Setting the masking value for the event(s) containing in the ::XMC_RTC_EVENT_t leads + * to a generation of the interrupt. + * + * \parRelated APIs:
+ * XMC_RTC_DisableEvent() + */ +void XMC_RTC_EnableEvent(const uint32_t event); + +/** + * @param event A valid RTC event (::XMC_RTC_EVENT_t) or a valid combination of + * logically OR'd events + * @return None + * + * \parDescription:
+ * Disable RTC periodic and alarm event(s)
+ * + * \par + * The function resets the bitfields of MSKSR register to disable interrupt generation + * for requested RTC event(s). + * Resetting the masking value for the the event(s) containing in the ::XMC_RTC_EVENT_t blocks + * the generation of the interrupt. + * + * \parRelated APIs:
+ * XMC_RTC_EnableEvent() + */ +void XMC_RTC_DisableEvent(const uint32_t event); + +/** + * @param event A valid RTC event (::XMC_RTC_EVENT_t) or a valid combination of + * logically OR'd events + * @return None + * + * \parDescription:
+ * Clears periodic and alarm event(s) status
+ * + * \par + * The function sets the bitfields of CLRSR register to clear status bits in RAWSTAT and STSSR registers. + * Setting the value for the the RTC event(s) containing in the ::XMC_RTC_EVENT_t clears the + * corresponding status bits in RAWSTAT and STSSR registers. + * + * \parRelated APIs:
+ * XMC_RTC_GetEventStatus() + */ +void XMC_RTC_ClearEvent(const uint32_t event); + +/** + * @return None + * + * \parDescription:
+ * Gets the RTC periodic and alarm event(s) status
+ * + * \par + * The function reads the bitfields of STSSR register + * to get the status of RTC events. + * Reading the value of the register STSSR gives the status of the event(s) containing in the ::XMC_RTC_EVENT_t. + * + * \parRelated APIs:
+ * XMC_RTC_ClearEvent() + */ +uint32_t XMC_RTC_GetEventStatus(void); + +/** + * @return bool true if RTC is running + * false if RTC is not running + * + * \parDescription:
+ * Checks the running status of the RTC
+ * + * \par + * The function reads the bitfield ENB of CTR register + * to get the running status of RTC. + * + * \parRelated APIs:
+ * XMC_RTC_Start(), XMC_RTC_Stop() + */ +__STATIC_INLINE bool XMC_RTC_IsRunning(void) +{ + return (bool)(RTC->CTR & RTC_CTR_ENB_Msk); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* XMC_RTC_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_scu.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_scu.h new file mode 100644 index 00000000..cacb0cf2 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_scu.h @@ -0,0 +1,598 @@ +/** + * @file xmc_scu.h + * @date 2016-03-09 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-05-20: + * - Documentation improved
+ * - XMC_ASSERT() hanging issues have fixed for XMC4 devices.
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * - Removed STATIC_INLINE property for the below APIs and declared as void + * XMC_SCU_INTERRUPT_EnableEvent, XMC_SCU_INTERRUPT_DisableEvent, + * XMC_SCU_INTERRUPT_TriggerEvent, XMC_SCU_INTERUPT_GetEventStatus, + * XMC_SCU_INTERUPT_ClearEventStatus + * + * 2015-11-30: + * - Documentation improved
+ * + * 2016-03-09: + * - Optimization of write only registers + * + * @endcond + * + */ +#ifndef XMC_SCU_H +#define XMC_SCU_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup SCU + * @brief System Control Unit(SCU) driver for XMC microcontroller family. + * + * System control unit is the SoC power, reset and a clock manager with additional responsibility of + * providing system stability protection and other auxiliary functions.
+ * SCU provides the following features, + * -# Power control + \if XMC4 + * -# Hibernate control + \endif + * -# Reset control + * -# Clock control + * -# Miscellaneous control(boot mode, system interrupts etc.)

+ * + * The SCU driver is divided in to clock control logic, reset control logic, system interrupt control logic + \if XMC4 + * , hibernate control logic, trap control logic, parity control logic + \endif + * and miscellaneous control logic.
+ * + * Clock driver features: + * -# Allows clock configuration using the structure XMC_SCU_CLOCK_CONFIG_t and API XMC_SCU_CLOCK_Init() + \if XMC4 + * -# Provides structure XMC_SCU_CLOCK_SYSPLL_CONFIG_t for configuring the system PLL + * -# Allows selection of clock source for system PLL, XMC_SCU_CLOCK_GetSystemPllClockSource() + * -# Provides APIs for configuring different module clock frequencies XMC_SCU_CLOCK_SetWdtClockDivider(), XMC_SCU_CLOCK_SetUsbClockDivider() + * -# Allows selection of clock source for external output, XMC_SCU_CLOCK_SetExternalOutputClockSource() + * -# Provides APIs for enabling external high power oscillator and ultra low power oscillator, XMC_SCU_CLOCK_EnableHighPerformanceOscillator(), XMC_SCU_CLOCK_EnableLowPowerOscillator() + * -# Provides APIs for getting various clock frequencies XMC_SCU_CLOCK_GetPeripheralClockFrequency(), + XMC_SCU_CLOCK_GetCpuClockFrequency(), XMC_SCU_CLOCK_GetSystemClockFrequency()
+ \endif + \if XMC1 + * -# Allows selection of peripheral clock frequency, XMC_SCU_CLOCK_SetFastPeripheralClockSource() + * -# Provides API to get the peripheral clock frequency, XMC_SCU_CLOCK_GetFastPeripheralClockFrequency() + \endif + * + * Reset driver features: + \if XMC4 + * -# Allows to handle peripheral reset XMC_SCU_RESET_AssertPeripheralReset(), XMC_SCU_RESET_DeassertPeripheralReset() + * -# Allows configuration of NMI generation for selected events, XMC_SCU_INTERRUPT_EnableNmiRequest() + \endif + \if XMC1 + * -# Allows to trigger device reset XMC_SCU_RESET_AssertMasterReset() + * -# Allows to configure multiple sources for reset, XMC_SCU_RESET_EnableResetRequest() + \endif
+ * + * Interrupt driver features: + * -# Provides APIs for enabling/ disabling interrupt event generation XMC_SCU_INTERRUPT_EnableEvent(), + XMC_SCU_INTERRUPT_DisableEvent() + * -# Provides API for registering callback function for events XMC_SCU_INTERRUPT_SetEventHandler()
+ * + \if XMC4 + * Hibernate driver features: + * -# Allows configuration of hibernate domain XMC_SCU_HIB_EnableHibernateDomain(), XMC_SCU_HIB_DisableHibernateDomain() + * -# Allows selection of standby clock source, XMC_SCU_HIB_SetStandbyClockSource() + * -# Allows selection of RTC clock source, XMC_SCU_HIB_SetRtcClockSource() + * -# Provides API for enabling slow internal clock used for backup clock, XMC_SCU_HIB_EnableInternalSlowClock()
+ * + * Trap driver features: + * -# Allows handling of trap XMC_SCU_TRAP_Enable(), XMC_SCU_TRAP_GetStatus(), XMC_SCU_TRAP_Trigger()
+ * + * Parity driver features: + * -# Parity error generated by on-chip RAM can be monitored, XMC_SCU_PARITY_Enable(), XMC_SCU_PARITY_GetStatus() + * -# Allows configuration of trap generation on detection of parity error, XMC_SCU_PARITY_EnableTrapGeneration() + * + * Power driver features: + * -# Allows to power the USB module XMC_SCU_POWER_EnableUsb(), XMC_SCU_POWER_DisableUsb() + \endif + * + * Miscellaneous features: + * -# Allows to trigger multiple capture compare unit(CCU) channels to be started together XMC_SCU_SetCcuTriggerHigh() + \if XMC4 + * -# Enables configuration of out of range comparator (ORC) XMC_SCU_EnableOutOfRangeComparator() + * -# Enables configuration of die temperature sensor XMC_SCU_EnableTemperatureSensor(), XMC_SCU_CalibrateTemperatureSensor() + * -# Enables configuration of device boot mode XMC_SCU_SetBootMode()
+ \endif + \if XMC1 + * -# Enables configuration of die temperature sensor XMC_SCU_StartTempMeasurement(), XMC_SCU_SetRawTempLimits() + * -# Allows configuring supply monitor unit using the structure XMC_SCU_SUPPLYMONITOR_t and API XMC_SCU_SupplyMonitorInit() + * -# Allows handling of protected bits XMC_SCU_LockProtectedBits(), XMC_SCU_UnlockProtectedBits()
+ \endif + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +/** + * Defines the status of SCU API execution, used to verify the SCU related API calls. + */ +typedef enum XMC_SCU_STATUS +{ + XMC_SCU_STATUS_OK = 0UL, /**< SCU related operation successfully completed.*/ + XMC_SCU_STATUS_ERROR, /**< SCU related operation failed. When API cannot fulfill request, this value is returned. */ + XMC_SCU_STATUS_BUSY, /**< Cannot execute the SCU related operation request because + another operation is in progress. \a XMC_SCU_STATUS_BUSY is returned when API is busy + processing another request. */ +} XMC_SCU_STATUS_t; + + +/********************************************************************************************************************* + * DATA TYPES + ********************************************************************************************************************/ + +/** + * Function pointer type used for registering callback functions on SCU event occurrence. + */ +typedef void (*XMC_SCU_INTERRUPT_EVENT_HANDLER_t)(void); + +/********************************************************************************************************************* + * DEVICE EXTENSIONS + ********************************************************************************************************************/ + +#if (UC_FAMILY == XMC1) +#include +#elif (UC_FAMILY == XMC4) +#include +#else +#error "Unspecified chipset" +#endif + +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * + * @param trigger CCU slices to be triggered synchronously via software. The value is a bitmask of CCU slice bits + * in the register CCUCON.
+ * \b Range: Use type @ref XMC_SCU_CCU_TRIGGER_t for bitmask of individual CCU slices. Multiple slices can be + * combined using \a OR operation. + * + * @return None + * + * \parDescription
+ * Generates active edge(low to high) trigger for multiple CCU units at the same time.\n\n + * Before executing this API, all the required CCU timers should configure external start. + * The edge of the start signal should be selected as active edge. + * The input signal for the CCU slice should be selected as SCU input. + * The above mentioned configurations can be made using the CCU LLD API XMC_CCU4_SLICE_StartConfig(). + * CCU timer slice should be started using XMC_CCU4_SLICE_StartTimer() before triggering + * the timer using this API.
+ * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartConfig(), XMC_CCU4_SLICE_SetInput(), XMC_SCU_SetCcuTriggerLow()\n\n\n + */ +__STATIC_INLINE void XMC_SCU_SetCcuTriggerHigh(const uint32_t trigger) +{ + SCU_GENERAL->CCUCON |= (uint32_t)trigger; +} + +/** + * + * @param trigger CCU slices to be triggered synchronously via software. The value is a bitmask of CCU slice bits + * in the register CCUCON.
+ * \b Range: Use type @ref XMC_SCU_CCU_TRIGGER_t for bitmask of individual CCU slices. Multiple slices can be + * combined using \a OR operation. + * + * @return None + * + * \parDescription
+ * Generates passive edge(high to low) trigger for multiple CCU units at the same time.\n\n + * Before executing this API, all the required CCU timers should configure external start. + * The edge of the start signal should be selected as passive edge. + * The input signal for the CCU slice should be selected as SCU input. + * The above mentioned configurations can be made using the CCU LLD API XMC_CCU4_SLICE_StartConfig(). + * CCU timer slice should be started using XMC_CCU4_SLICE_StartTimer() before triggering + * the timer using this API.
+ * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartConfig(), XMC_CCU4_SLICE_SetInput(), XMC_SCU_SetCcuTriggerHigh()\n\n\n + */ +__STATIC_INLINE void XMC_SCU_SetCcuTriggerLow(const uint32_t trigger) +{ + SCU_GENERAL->CCUCON &= (uint32_t)~trigger; +} + +/** + * + * @param config Pointer to structure holding the clock prescaler values and divider values for + * configuring clock generators and clock tree.\n + * \b Range: Configure the members of structure @ref XMC_SCU_CLOCK_CONFIG_t for various + * parameters of clock setup. + * + * @return None + * + * \parDescription
+ * Initializes clock generators and clock tree.\n\n + * \if XMC1 + * Peripheral clock and system clock are configured based on the input configuration \a config. + * The system clock frequency is tuned by configuring the FDIV and IDIV values of CLKCR register. + * The values of FDIV and IDIV can be provided as part of input configuration. + * The PCLK divider determines the ratio of peripheral clock to the system clock. + * The source of RTC clock is set based on the input configuration. + * \a SystemCoreClock variable will be updated with the value of + * system clock frequency. Access to protected bit fields are handled internally. + * \endif + * \if XMC4 + * Enables the high precision oscillator(fOHP) input and configures the system and peripheral clock frequencies. + * Based on the system clock source selected in \a config, either fPLL or fOFI will be chosen as system clock. + * Based on PLL mode(normal or prescaler mode) used, PLL ramps up in steps to achieve target frequency. + * The clock dividers for CPU, CCU and peripheral clocks will be set based on the input configuration. + * The \a SystemCoreClock variable is set with the value of system clock frequency. + * \endif + * \parRelated APIs:
+ * XMC_SCU_CLOCK_GetPeripheralClockFrequency(), XMC_SCU_CLOCK_GetCpuClockFrequency() \n\n\n + */ +void XMC_SCU_CLOCK_Init(const XMC_SCU_CLOCK_CONFIG_t *const config); + +/** + * + * @param event Bit mask of the event to enable. \b Range: Use type @ref XMC_SCU_INTERRUPT_EVENT_t + * for providing the input value. Multiple events can be combined using the \a OR operation. + * + * @return None + * + * \parDescription
+ * Enables the generation of interrupt for the input events.\n\n + * The events are enabled by setting the respective bit fields in the SRMSK register. \n + * Note: User should separately enable the NVIC node responsible for handling the SCU interrupt. + * The interrupt will be generated when the respective event occurs. + * \parRelated APIs:
+ * NVIC_EnableIRQ(), XMC_SCU_INTERRUPT_DisableEvent()\n\n\n + */ +void XMC_SCU_INTERRUPT_EnableEvent(const XMC_SCU_INTERRUPT_EVENT_t event); + + +/** + * + * @param event Bit mask of the event to disable. \b Range: Use type @ref XMC_SCU_INTERRUPT_EVENT_t + * for providing the input value. Multiple events can be combined using the \a OR operation. + * + * @return None + * + * \parDescription
+ * Disables generation of interrupt on occurrence of the input event.\n\n + * The events are disabled by resetting the respective bit fields in the SRMSK register. \n + * \parRelated APIs:
+ * NVIC_DisableIRQ(), XMC_SCU_INTERRUPT_EnableEvent()\n\n\n + */ +void XMC_SCU_INTERRUPT_DisableEvent(const XMC_SCU_INTERRUPT_EVENT_t event); + +/** + * + * @param event Bit mask of the event to be triggered. \b Range: Use type @ref XMC_SCU_INTERRUPT_EVENT_t + * for providing the input value. Multiple events can be combined using the \a OR operation. + * + * @return None + * + * \parDescription
+ * Triggers the event as if the hardware raised it.\n\n + * Event will be triggered by setting the respective bitfield in the SRSET register.\n + * Note: User should enable the NVIC node that handles the respective event for interrupt generation. + * \parRelated APIs:
+ * NVIC_EnableIRQ(), XMC_SCU_INTERUPT_GetEventStatus(), XMC_SCU_INTERRUPT_ClearEventStatus() \n\n\n + */ +void XMC_SCU_INTERRUPT_TriggerEvent(const XMC_SCU_INTERRUPT_EVENT_t event); + +/** + * @return uint32_t Status of the SCU events. + * + * \parDescription
+ * Provides the status of all SCU events.\n\n + * The status is read from the SRRAW register. To check the status of a particular + * event, the returned value should be masked with the bit mask of the event. The bitmask + * of events can be obtained using the type @ref XMC_SCU_INTERRUPT_EVENT_t. Multiple events' + * status can be checked by combining the bit masks using \a OR operation. + * After detecting the event, the event status should be cleared using software to detect the event again. + * \parRelated APIs:
+ * XMC_SCU_INTERRUPT_ClearEventStatus(), XMC_SCU_INTERRUPT_TriggerEvent(), XMC_SCU_INTERRUPT_SetEventHandler() \n\n\n + */ +XMC_SCU_INTERRUPT_EVENT_t XMC_SCU_INTERUPT_GetEventStatus(void); + +/** + * + * @param event Bit mask of the events to clear. \b Range: Use type @ref XMC_SCU_INTERRUPT_EVENT_t + * for providing the input value. Multiple events can be combined using the \a OR operation. + * + * @return None + * + * \parDescription
+ * Clears the event status bit in SRRAW register.\n\n + * The events are cleared by writing value 1 to their bit positions in the SRCLR register. + * The API can be used when polling method is used. After detecting the event, the event status + * should be cleared using software to detect the event again. + * + * \parRelated APIs:
+ * XMC_SCU_INTERUPT_GetEventStatus(), XMC_SCU_INTERRUPT_TriggerEvent() \n\n\n + */ +void XMC_SCU_INTERRUPT_ClearEventStatus(const XMC_SCU_INTERRUPT_EVENT_t event); + +/** + * + * @return uint32_t Status representing the reason for device reset. + * + * \parDescription
+ * Provides the value representing the reason for device reset.\n\n + * The return value is an encoded word, which can indicate multiple reasons for the last reset. Each bit position of the + * returned word is representative of a last reset cause. The returned value should be appropriately masked to check + * the cause of reset. + * The cause of the last reset gets automatically stored in + * the \a SCU_RSTSTAT register. The reset status shall be reset after each + * startup in order to ensure consistent source indication after the next reset. + * \b Range: The type @ref XMC_SCU_RESET_REASON_t can be used to get the bit masks of the reset cause. + * + * \parRelated APIs:
+ * XMC_SCU_RESET_ClearDeviceResetReason() \n\n\n + */ +__STATIC_INLINE uint32_t XMC_SCU_RESET_GetDeviceResetReason(void) +{ + return ((SCU_RESET->RSTSTAT) & SCU_RESET_RSTSTAT_RSTSTAT_Msk); +} +/** + * @return None + * + * \parDescription
+ * Clears the reset reason bits in the reset status register. \n\n + * Clearing of the reset status information in the \a SCU_RSTSTAT register via register bit \a RSTCLR.RSCLR is strongly + * recommended to ensure a clear indication of the cause of next reset. + * + * \parRelated APIs:
+ * XMC_SCU_RESET_GetDeviceResetReason() \n\n\n + */ +__STATIC_INLINE void XMC_SCU_RESET_ClearDeviceResetReason(void) +{ + /* Clear RSTSTAT.RSTSTAT bitfield */ + SCU_RESET->RSTCLR = (uint32_t)SCU_RESET_RSTCLR_RSCLR_Msk; +} + +/** + * @return uint32_t Value of CPU clock frequency. + * + * \parDescription
+ * Provides the vlaue of CPU clock frequency.\n\n + * The value is stored in a global variable \a \b SystemCoreClock. + * It is updated when the clock configuration is done using the SCU LLD APIs. + * The value represents the frequency of clock used for CPU operation. + * \b Range: Value is of type uint32_t, and gives the value of frequency in Hertz. + * + * \parRelated APIs:
+ * XMC_SCU_CLOCK_GetPeripheralClockFrequency(), XMC_SCU_CLOCK_GatePeripheralClock() \n\n\n + */ +__STATIC_INLINE uint32_t XMC_SCU_CLOCK_GetCpuClockFrequency(void) +{ + return SystemCoreClock; +} + +/** + * @return uint32_t Value of peripheral clock frequency in Hertz. + * + * \parDescription
+ * Provides the vlaue of clock frequency at which the peripherals are working.\n\n + * The value is derived from the CPU frequency. \b Range: Value is of type uint32_t. It is represented in Hertz. + * \parRelated APIs:
+ * XMC_SCU_CLOCK_GetCpuClockFrequency(),XMC_SCU_CLOCK_GatePeripheralClock() \n\n\n + */ +uint32_t XMC_SCU_CLOCK_GetPeripheralClockFrequency(void); + +#if(UC_SERIES != XMC45) + +/** + * + * @param peripheral The peripheral for which the clock has to be gated. \b Range: Use type @ref XMC_SCU_PERIPHERAL_CLOCK_t + * to identify the peripheral clock to be gated. + * + * @return None + * + * \parDescription
+ * Blocks the supply of clock to the selected peripheral.\n\n + * Clock gating helps in reducing the power consumption. User can selectively gate the clocks of unused peripherals. + * \if XMC1 + * fPCLK is the source of clock to various peripherals. Some peripherals support clock gate. Such a gate blocks + * the clock supply for the selected peripheral. + * Software can request for individual gating of such peripheral clocks by enabling the \a SCU_CGATSET0 + * register bit field. Every bit in \a SCU_CGATSET0 register is protected by the bit protection scheme. Access to protected + * bit fields are handled internally. + * \endif + * \if XMC4 + * fPERI is the source of clock to various peripherals. Some peripherals support clock gate. Such a gate blocks + * the clock supply for the selected peripheral. + * Software can request for individual gating of such peripheral clocks by enabling one of the \a + * SCU_CGATSET0, \a SCU_CGATSET1 or \a SCU_CGATSET2 register bitfields. + * + * \endif + * Note: Clock gating shall not be activated unless the module is in reset state. So use \a + * XMC_SCU_CLOCK_IsPeripheralClockGated() API before enabling the gating of any peripheral. + * \parRelated APIs:
+ * XMC_SCU_CLOCK_IsPeripheralClockGated(), XMC_SCU_CLOCK_UngatePeripheralClock() \n\n\n + */ +void XMC_SCU_CLOCK_GatePeripheralClock(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral); + +/** + * + * @param peripheral The peripheral for which the clock has to be ungated. \b Range: Use type @ref XMC_SCU_PERIPHERAL_CLOCK_t + * to identify the peripheral. + * + * @return None + * + * \parDescription
+ * Enables the supply of clock to the selected peripheral.\n\n + * By default when the device powers on, the peripheral clock will be gated for the + * peripherals that support clock gating. + * The peripheral clock should be enabled before using it for any functionality. + * \if XMC1 + * fPCLK is the source of clock to various peripherals. Some peripherals support clock gate. + * Software can request for individual ungating of such peripheral clocks by setting respective bits + * in the \a SCU_CGATCLR0 register. + * \endif + * \if XMC4 + * fPERI is the source of clock to various peripherals. Some peripherals support clock gate. + * Software can request for individual ungating of such peripheral clocks by setting the respective bits in one of \a + * SCU_CGATCLR0, \a SCU_CGATCLR1 or \a SCU_CGATCLR2 registers. + * \endif + * + * \parRelated APIs:
+ * XMC_SCU_CLOCK_IsPeripheralClockGated(), XMC_SCU_CLOCK_GatePeripheralClock() \n\n\n + */ +void XMC_SCU_CLOCK_UngatePeripheralClock(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral); + +/** + * + * @param peripheral The peripheral for which the check for clock gating has to be done. + * \b Range: Use type @ref XMC_SCU_PERIPHERAL_CLOCK_t to identify the peripheral. + * + * @return bool Status of the peripheral clock gating. \b Range: true if the peripheral clock is gated. + * false if the peripheral clock ungated(gate de-asserted). + * + * \parDescription
+ * Gives the status of peripheral clock gating.\n\n + * \if XMC1 + * Checks the status of peripheral clock gating using the register CGATSTAT0. + * \endif + * \if XMC4 + * Checks the status of peripheral clock gating using one of CGATSTAT0, CGATSTAT1 or CGATSTAT2 registers. + * \endif + * It is recommended to use this API before + * enabling the gating of any peripherals through \a XMC_SCU_CLOCK_GatePeripheralClock() API. + * + * \parRelated APIs:
+ * XMC_SCU_CLOCK_UngatePeripheralClock(), XMC_SCU_CLOCK_GatePeripheralClock() \n\n\n + */ +bool XMC_SCU_CLOCK_IsPeripheralClockGated(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral); +#endif + + +/** + * @return uint32_t Status of the register mirror update.\n + * \b Range: Use the bit mask of the SCU_GENERAL_MIRRSTS register for the mirror update event of + * interest. e.g.: SCU_GENERAL_MIRRSTS_RTC_CTR_Msk. Multiple update events can be combined + * using \a OR operation. + * + * \parDescription
+ * Provides the status of hibernate domain register update, when the respective mirror registers are changed. \n\n + * The hibernate domain is connected to the core domain via SPI serial communication. MIRRSTS is a status register + * representing the communication of changed value of a mirror register to its corresponding register in the + * hibernate domain. The bit fields of the register indicate + * that a corresponding register of the hibernate domain is ready to accept a write or that the communication interface + * is busy with executing the previous operation.\n + * Note: There is no hibernate domain in XMC1x devices. This register is retained for legacy purpose. + */ +__STATIC_INLINE uint32_t XMC_SCU_GetMirrorStatus(void) +{ + return(SCU_GENERAL->MIRRSTS); +} + +/** + * @param event The event for which the interrupt handler is to be configured. \n + * \b Range: Use type @ref XMC_SCU_INTERRUPT_EVENT_t for identifying the event. + * @param handler Name of the function to be executed when the event if detected. \n + * \b Range: The function accepts no arguments and returns no value. + * @return XMC_SCU_STATUS_t Status of configuring the event handler function for the selected event.\n + * \b Range: \a XMC_SCU_STATUS_OK if the event handler is successfully configured.\n + * \a XMC_SCU_STATUS_ERROR if the input event is invalid.\n + * \parDescription
+ * Assigns the event handler function to be executed on occurrence of the selected event.\n\n + * If the input event is valid, the handler function will be assigned to a table to be executed + * when the interrupt is generated and the event status is set in the event status register. By using this API, + * polling for a particular event can be avoided. This way the CPU utilization will be optimized. Multiple SCU events + * can generate a common interrupt. When the interrupt is generated, a common interrupt service routine is executed. + * It checks for status flags of events which can generate the interrupt. The handler function will be executed if the + * event flag is set. + * + * \parRelated APIs:
+ * XMC_SCU_INTERRUPT_TriggerEvent(), XMC_SCU_INTERUPT_GetEventStatus() \n\n\n + */ +XMC_SCU_STATUS_t XMC_SCU_INTERRUPT_SetEventHandler(const XMC_SCU_INTERRUPT_EVENT_t event, const XMC_SCU_INTERRUPT_EVENT_HANDLER_t handler); + +/** + * @param sr_num Service request number identifying the SCU interrupt generated.\n + * \b Range: 0 to 2. XMC4x devices have one common SCU interrupt, so the value should be 0.\n + * But XMC1x devices support 3 interrupt nodes. + * @return None + * \parDescription
+ * A common function to execute callback functions for multiple events.\n\n + * It checks for the status of events which can generate the interrupt with the selected service request. + * If the event is set, the corresponding callback function will be executed. It also clears the event status bit.\n + * \b Note: This is an internal function. It should not be called by the user application. + * + * \parRelated APIs:
+ * XMC_SCU_INTERRUPT_SetEventHandler() \n\n\n + */ +void XMC_SCU_IRQHandler(uint32_t sr_num); + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* SCU_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_spi.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_spi.h new file mode 100644 index 00000000..ec1de7e8 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_spi.h @@ -0,0 +1,1279 @@ +/** + * @file xmc_spi.h + * @date 2016-05-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial + * + * 2015-05-20: + * - Documentation improved
+ * - Added XMC_SPI_CH_SetSlaveSelectDelay(), XMC_SPI_CH_TriggerServiceRequest() and + * XMC_SPI_CH_SelectInterruptNodePointer()
+ * - Added XMC_SPI_CH_SetInterwordDelaySCLK()
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-08-24: + * - Added APIs for enabling/disabling delay compensation XMC_SPI_CH_DisableDelayCompensation() and + * XMC_SPI_CH_EnableDelayCompensation()
+ * + * 2015-08-27: + * - Added APIs for external input for BRG configuration:XMC_SPI_CH_ConfigExternalInputSignalToBRG()
+ * + * 2015-09-01: + * - Modified XMC_SPI_CH_SetInputSource() for avoiding complete DXCR register overwriting.
+ * - Modified XMC_SPI_CH_EVENT_t enum for supporting XMC_SPI_CH_EnableEvent() and XMC_SPI_CH_DisableEvent() + * for supporting multiple events configuration
+ * + * 2015-09-08: + * - Adding API for configuring the receiving clock phase in the slave:XMC_SPI_CH_DataLatchedInTrailingEdge() and XMC_SPI_CH_DataLatchedInLeadingEdge()
+ * + * 2016-04-10: + * - Added an API for configuring the transmit mode:XMC_SPI_CH_SetTransmitMode()
+ * + * 2016-05-20: + * - Added XMC_SPI_CH_EnableDataTransmission() and XMC_SPI_CH_DisableDataTransmission() + * + * @endcond + * + */ + +#ifndef XMC_SPI_H +#define XMC_SPI_H + +/********************************************************************************************************************** + * HEADER FILES + *********************************************************************************************************************/ +#include "xmc_usic.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup SPI + * @brief Synchronous serial channel driver for SPI-like communication. + * + * The SPI driver uses Universal Serial Interface Channel(USIC) module. + * The USIC module supports multiple data lines for SPI communication. \n + * -# Full duplex communication with 2 separate lines for transmission and reception. + * -# Half duplex communication with 1 common line shared for transmission and reception. + * -# Dual mode communication with 2 common lines shared for transmission and reception. + * -# Quad mode communication with 4 common lines shared for transmission and reception.

+ * + * SPI driver provides structures, enumerations and APIs for configuring the USIC channel for SPI communication + * and also for data transaction.
+ * SPI driver features: + * -# Configuration structure XMC_SPI_CH_CONFIG_t and SPI initialization function XMC_SPI_CH_Init() + * -# Allows configuration of protocol word and frame length using XMC_SPI_CH_SetWordLength(), XMC_SPI_CH_SetFrameLength() + * -# Allows manipulation of data frame at runtime using XMC_SPI_CH_EnableSOF(), XMC_SPI_CH_EnableEOF(), + XMC_SPI_CH_EnableSlaveSelect(), XMC_SPI_CH_DisableSlaveSelect() + * -# Provides APIs for transmitting data and receiving data using XMC_SPI_CH_Transmit(), XMC_SPI_CH_Receive(), XMC_SPI_CH_GetReceivedData() + * -# Allows configuration of shift clock using XMC_SPI_CH_ConfigureShiftClockOutput() + * -# Provides enumeration of SPI protocol events using @ref XMC_SPI_CH_STATUS_FLAG_t + * @{ + */ + +/*********************************************************************************************************************** + * MACROS + **********************************************************************************************************************/ + +#if defined(USIC0) +#define XMC_SPI0_CH0 XMC_USIC0_CH0 /**< SPI0 channel 0 base address */ +#define XMC_SPI0_CH1 XMC_USIC0_CH1 /**< SPI0 channel 1 base address */ +#endif + +#if defined(USIC1) +#define XMC_SPI1_CH0 XMC_USIC1_CH0 /**< SPI1 channel 0 base address */ +#define XMC_SPI1_CH1 XMC_USIC1_CH1 /**< SPI1 channel 1 base address */ +#endif + +#if defined(USIC2) +#define XMC_SPI2_CH0 XMC_USIC2_CH0 /**< SPI2 channel 0 base address */ +#define XMC_SPI2_CH1 XMC_USIC2_CH1 /**< SPI2 channel 1 base address */ +#endif + +/*********************************************************************************************************************** + * ENUMS + ***********************************************************************************************************************/ + +/** + * Defines return status of SPI driver APIs + */ +typedef enum XMC_SPI_CH_STATUS +{ + XMC_SPI_CH_STATUS_OK, /**< Status of the Module: OK */ + XMC_SPI_CH_STATUS_ERROR, /**< Status of the Module: ERROR */ + XMC_SPI_CH_STATUS_BUSY /**< The Module is busy */ +} XMC_SPI_CH_STATUS_t; +/** + * Defines the SPI bus mode + */ +typedef enum XMC_SPI_CH_BUS_MODE +{ + XMC_SPI_CH_BUS_MODE_MASTER, /**< SPI Master */ + XMC_SPI_CH_BUS_MODE_SLAVE /**< SPI Slave */ +} XMC_SPI_CH_BUS_MODE_t; + +/** + * Defines the Polarity of the slave select signals SELO[7:0] in relation to the master slave select signal MSLS. + */ +typedef enum XMC_SPI_CH_SLAVE_SEL_MSLS_INV +{ + XMC_SPI_CH_SLAVE_SEL_SAME_AS_MSLS = 0x0UL, /**< The SELO outputs have the same polarity as the MSLS signal + (active high) */ + XMC_SPI_CH_SLAVE_SEL_INV_TO_MSLS = 0x1UL << USIC_CH_PCR_SSCMode_SELINV_Pos /**< The SELO outputs have the inverted + polarity to the MSLS signal + (active low)*/ +} XMC_SPI_CH_SLAVE_SEL_MSLS_INV_t; + +/** + * Defines the Polarity of the data inputs. + */ +typedef enum XMC_SPI_CH_DATA_POLARITY +{ + XMC_SPI_CH_DATA_POLARITY_DIRECT = 0x0UL, /**< The polarity of the data line is not inverted */ + XMC_SPI_CH_DATA_POLARITY_INVERT = 0x1UL << USIC_CH_DX2CR_DPOL_Pos /**< The polarity of the data line is inverted */ +} XMC_SPI_CH_DATA_POLARITY_t; + +/** + * Defines Slave Select lines + */ +typedef enum XMC_SPI_CH_SLAVE_SELECT +{ + XMC_SPI_CH_SLAVE_SELECT_0 = 1UL << USIC_CH_PCR_SSCMode_SELO_Pos, /**< Slave Select line 0 */ + XMC_SPI_CH_SLAVE_SELECT_1 = 2UL << USIC_CH_PCR_SSCMode_SELO_Pos, /**< Slave Select line 1 */ + XMC_SPI_CH_SLAVE_SELECT_2 = 4UL << USIC_CH_PCR_SSCMode_SELO_Pos, /**< Slave Select line 2 */ + XMC_SPI_CH_SLAVE_SELECT_3 = 8UL << USIC_CH_PCR_SSCMode_SELO_Pos, /**< Slave Select line 3 */ + XMC_SPI_CH_SLAVE_SELECT_4 = 16UL << USIC_CH_PCR_SSCMode_SELO_Pos, /**< Slave Select line 4 */ + XMC_SPI_CH_SLAVE_SELECT_5 = 32UL << USIC_CH_PCR_SSCMode_SELO_Pos, /**< Slave Select line 5 */ + XMC_SPI_CH_SLAVE_SELECT_6 = 64UL << USIC_CH_PCR_SSCMode_SELO_Pos, /**< Slave Select line 6 */ + XMC_SPI_CH_SLAVE_SELECT_7 = 128UL << USIC_CH_PCR_SSCMode_SELO_Pos /**< Slave Select line 7 */ +} XMC_SPI_CH_SLAVE_SELECT_t; + +/** + * Defines SPI specific events + */ +typedef enum XMC_SPI_CH_EVENT +{ + XMC_SPI_CH_EVENT_RECEIVE_START = USIC_CH_CCR_RSIEN_Msk, /**< Receive start event */ + XMC_SPI_CH_EVENT_DATA_LOST = USIC_CH_CCR_DLIEN_Msk, /**< Data lost event */ + XMC_SPI_CH_EVENT_TRANSMIT_SHIFT = USIC_CH_CCR_TSIEN_Msk, /**< Transmit shift event */ + XMC_SPI_CH_EVENT_TRANSMIT_BUFFER = USIC_CH_CCR_TBIEN_Msk, /**< Transmit buffer event */ + XMC_SPI_CH_EVENT_STANDARD_RECEIVE = USIC_CH_CCR_RIEN_Msk, /**< Receive event */ + XMC_SPI_CH_EVENT_ALTERNATIVE_RECEIVE = USIC_CH_CCR_AIEN_Msk, /**< Alternate receive event */ + XMC_SPI_CH_EVENT_BAUD_RATE_GENERATOR = USIC_CH_CCR_BRGIEN_Msk, /**< Baudrate generator event */ + + XMC_SPI_CH_EVENT_PARITY_ERROR = USIC_CH_PCR_SSCMode_PARIEN_Msk >> 13U, /**< Parity error event */ + XMC_SPI_CH_EVENT_MSLS_CHANGE = USIC_CH_PCR_SSCMode_MSLSIEN_Msk >> 13U, /**< Master slave select(MSLS) output transition event*/ + XMC_SPI_CH_EVENT_DX2TIEN_ACTIVATED = USIC_CH_PCR_SSCMode_DX2TIEN_Msk >> 13U /**< Slave select input signal transition event*/ +} XMC_SPI_CH_EVENT_t; + +/** + * Defines SPI event status + */ +typedef enum XMC_SPI_CH_STATUS_FLAG +{ + XMC_SPI_CH_STATUS_FLAG_MSLS = USIC_CH_PSR_SSCMode_MSLS_Msk, /**< Status of Master slave + select(MSLS) signal */ + XMC_SPI_CH_STATUS_FLAG_DX2S = USIC_CH_PSR_SSCMode_DX2S_Msk, /**< Status of slave select + input(DX2) signal*/ + XMC_SPI_CH_STATUS_FLAG_MSLS_EVENT_DETECTED = USIC_CH_PSR_SSCMode_MSLSEV_Msk, /**< Status for master slave select + output signal transition*/ + XMC_SPI_CH_STATUS_FLAG_DX2T_EVENT_DETECTED = USIC_CH_PSR_SSCMode_DX2TEV_Msk, /**< Status for slave select + input signal transition */ + XMC_SPI_CH_STATUS_FLAG_PARITY_ERROR_EVENT_DETECTED = USIC_CH_PSR_SSCMode_PARERR_Msk, /**< Indicates status of the + parity error */ + XMC_SPI_CH_STATUS_FLAG_RECEIVER_START_INDICATION = USIC_CH_PSR_SSCMode_RSIF_Msk, /**< Status for receive start + event */ + XMC_SPI_CH_STATUS_FLAG_DATA_LOST_INDICATION = USIC_CH_PSR_SSCMode_DLIF_Msk, /**< Status for data lost event*/ + XMC_SPI_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION = USIC_CH_PSR_SSCMode_TSIF_Msk, /**< Status for transmit shift + event */ + XMC_SPI_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION = USIC_CH_PSR_SSCMode_TBIF_Msk, /**< Status for transmit buffer + event */ + XMC_SPI_CH_STATUS_FLAG_RECEIVE_INDICATION = USIC_CH_PSR_SSCMode_RIF_Msk, /**< Status for receive event */ + XMC_SPI_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION = USIC_CH_PSR_SSCMode_AIF_Msk, /**< Status for alternative + receive event */ + XMC_SPI_CH_STATUS_FLAG_BAUD_RATE_GENERATOR_INDICATION = USIC_CH_PSR_SSCMode_BRGIF_Msk/**< Status for baud rate + generation error event */ +} XMC_SPI_CH_STATUS_FLAG_t; + +/** + * Defines input frequency sources for slave select signal delay configuration. + */ +typedef enum XMC_SPI_CH_INPUT_FREQ_SLAVE_SELECT_DELAY +{ + XMC_SPI_CH_INPUT_FREQ_SLAVE_SELECT_DELAY_FPDIV = 0x0UL, /**< Output of PDIV divider: FPDIV */ + XMC_SPI_CH_INPUT_FREQ_SLAVE_SELECT_DELAY_FPPP = 0x1UL << USIC_CH_PCR_SSCMode_CTQSEL1_Pos, /**< Peripheral clock: FPPP */ + XMC_SPI_CH_INPUT_FREQ_SLAVE_SELECT_DELAY_FSCLK = 0x2UL << USIC_CH_PCR_SSCMode_CTQSEL1_Pos, /**< Shift clock: FSCLK */ + XMC_SPI_CH_INPUT_FREQ_SLAVE_SELECT_DELAY_FMCLK = 0x3UL << USIC_CH_PCR_SSCMode_CTQSEL1_Pos /**< Master clock: FMCLK */ +} XMC_SPI_CH_INPUT_FREQ_SLAVE_SELECT_DELAY_t; + +/** + * Define data and clock input stages + */ +typedef enum XMC_SPI_CH_INPUT +{ + XMC_SPI_CH_INPUT_DIN0 = 0UL, /**< Data input stage 0 */ + XMC_SPI_CH_INPUT_SLAVE_SCLKIN = 1UL, /**< Clock input stage */ + XMC_SPI_CH_INPUT_SLAVE_SELIN = 2UL, /**< Slave select input stage */ + XMC_SPI_CH_INPUT_DIN1 = 3UL, /**< Data input stage 1 */ + XMC_SPI_CH_INPUT_DIN2 = 4UL, /**< Data input stage 2 */ + XMC_SPI_CH_INPUT_DIN3 = 5UL /**< Data input stage 3 */ +} XMC_SPI_CH_INPUT_t; + +/** + * Define SPI data transfer mode + */ +typedef enum XMC_SPI_CH_MODE +{ + XMC_SPI_CH_MODE_STANDARD = 0UL, /**< SPI standard full duplex mode */ + XMC_SPI_CH_MODE_STANDARD_HALFDUPLEX = 4UL, /**< SPI standard half duplex mode */ + XMC_SPI_CH_MODE_DUAL= 6UL, /**< SPI half duplex mode with dual data lines */ + XMC_SPI_CH_MODE_QUAD= 7UL /**< SPI half duplex mode with quad data lines */ +} XMC_SPI_CH_MODE_t; + + +/** + * SPI Baudrate Generator shift clock passive level + */ +typedef enum XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL +{ + /**< Passive clock level 0, delay disabled */ + XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_DISABLED = XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_DISABLED, + /**< Passive clock level 1, delay disabled */ + XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_DISABLED = XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_DISABLED, + /**< Passive clock level 0, delay enabled */ + XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_ENABLED = XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_ENABLED, + /**< Passive clock level 1, delay enabled */ + XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_ENABLED = XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_ENABLED +} XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t; + +/** + * SPI Baudrate Generator shift clock output +*/ +typedef enum XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT +{ + XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK = XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK, /**< Baudrate Generator shift clock output: SCLK*/ + XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT_DX1 = XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_DX1 /**< Clock obtained as input from master: DX1*/ +} XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT_t; + +/** + * SPI channel interrupt node pointers + */ +typedef enum XMC_SPI_CH_INTERRUPT_NODE_POINTER +{ + XMC_SPI_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, /**< Node pointer for transmit shift interrupt */ + XMC_SPI_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER, /**< Node pointer for transmit buffer interrupt */ + XMC_SPI_CH_INTERRUPT_NODE_POINTER_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_RECEIVE, /**< Node pointer for receive interrupt */ + XMC_SPI_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE, /**< Node pointer for alternate receive interrupt */ + XMC_SPI_CH_INTERRUPT_NODE_POINTER_PROTOCOL = XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL /**< Node pointer for protocol related interrupts */ +} XMC_SPI_CH_INTERRUPT_NODE_POINTER_t; + +/********************************************************************************************************************** + * DATA STRUCTURES +**********************************************************************************************************************/ + +/** + * Structure for initializing SPI channel. + */ +typedef struct XMC_SPI_CH_CONFIG +{ + uint32_t baudrate; /**< Module baud rate for communication */ + XMC_SPI_CH_BUS_MODE_t bus_mode; /**< Bus mode: Master/Slave */ + XMC_SPI_CH_SLAVE_SEL_MSLS_INV_t selo_inversion; /**< Enable inversion of Slave select signal relative to the internal + MSLS signal */ + XMC_USIC_CH_PARITY_MODE_t parity_mode; /**< Enable parity check for transmit and received data */ +} XMC_SPI_CH_CONFIG_t; + +/********************************************************************************************************************** + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param config pointer to constant SPI channel configuration data structure.\n + * Refer data structure @ref XMC_SPI_CH_CONFIG_t for detail. + * + * @return None + * + * \parDescription:
+ * Initializes the selected SPI \a channel with the \a config structure.\n\n + * Enable SPI channel by calling XMC_USIC_CH_Enable() and then configures + *
    + *
  • Baudrate,
  • + *
  • Passive data level as active high,
  • + *
  • Shift control signal as active high,
  • + *
  • Frame length as 64U,
  • + *
  • Word length as 8U,
  • + *
  • Enable Hardware port control mode,
  • + *
  • Enable transmission of data TDV(Transmit data valid) bit is set to 1,
  • + *
  • Enable invalidation of data in TBUF once loaded into shift register,
  • + *
  • Parity mode settings
  • + *
+ * And if master mode is selected, + *
    + *
  • Enables MSLS signal generation,
  • + *
  • configures slave selection as normal mode,
  • + *
  • Set polarity for the Slave signal,
  • + *
  • Enable Frame end mode(MSLS signal is kept active after transmission of a frame)
  • + *
+ */ +void XMC_SPI_CH_Init(XMC_USIC_CH_t *const channel, const XMC_SPI_CH_CONFIG_t *const config); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Set the selected USIC channel to operate in SPI mode, by setting CCR.MODE bits.\n\n + * It should be executed after XMC_SPI_CH_Init() during initialization. By invoking XMC_SPI_CH_Stop(), the MODE is set + * to IDLE state. Call XMC_SPI_CH_Start() to set the SPI mode again, as needed later in the program. + * + * \parRelated APIs:
+ * XMC_SPI_CH_Init(), XMC_SPI_CH_Stop() + */ +__STATIC_INLINE void XMC_SPI_CH_Start(XMC_USIC_CH_t *const channel) +{ + /* USIC channel in SPI mode */ + XMC_USIC_CH_SetMode(channel, XMC_USIC_CH_OPERATING_MODE_SPI); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return XMC_SPI_CH_STATUS_t Status of the SPI driver after the request for stopping is processed. \n + * XMC_SPI_CH_STATUS_OK- If the USIC channel is successfully put to IDLE mode. \n + * XMC_SPI_CH_STATUS_BUSY- If the USIC channel is busy transmitting data. + * + * \parDescription:
+ * Set the selected SPI channel to IDLE mode, by clearing CCR.MODE bits.\n\n + * After calling XMC_SPI_CH_Stop, channel is IDLE mode. So no communication is supported. XMC_SPI_CH_Start() has to be + * invoked to start the communication again. + * + * \parRelated APIs:
+ * XMC_SPI_CH_Start() + */ +XMC_SPI_CH_STATUS_t XMC_SPI_CH_Stop(XMC_USIC_CH_t *const channel); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param rate Bus speed in bits per second + * + * @return XMC_SPI_CH_STATUS_t Status of the SPI driver after the request for setting baudrate is processed. \n + * XMC_SPI_CH_STATUS_OK- If the baudrate is successfully changed. \n + * XMC_SPI_CH_STATUS_ERROR- If the new baudrate value is out of range. + * + * \parDescription:
+ * Sets the bus speed in bits per second + * + * \parRelated APIs:
+ * XMC_SPI_CH_Init(), XMC_SPI_CH_Stop() + */ +XMC_SPI_CH_STATUS_t XMC_SPI_CH_SetBaudrate(XMC_USIC_CH_t *const channel, const uint32_t rate); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param slave Slave select signal.\n + * Refer @ref XMC_SPI_CH_SLAVE_SELECT_t for valid values. + * + * @return None + * + * \parDescription:
+ * Enable the selected slave signal by setting PCR.SELO bits.\n\n + * Each slave is connected with one slave select signal. This is not configured in XMC_SPI_CH_Init(). Invoke + * XMC_SPI_CH_EnableSlaveSelect() with required \a slave to to start the communication. After finishing the + * communication XMC_SPI_CH_DisableSlaveSelect() can be invoked to disable the slaves. + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableSlaveSelect() + */ +void XMC_SPI_CH_EnableSlaveSelect(XMC_USIC_CH_t *const channel, const XMC_SPI_CH_SLAVE_SELECT_t slave); + +/** + * @param channel A constant ponter to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Disable all the slave signals by clearing PCR.SELO bits.\n\n + * XMC_SPI_CH_EnableSlaveSelect() has to be invoked to start the communication with the desired slave again. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableSlaveSelect() + */ +void XMC_SPI_CH_DisableSlaveSelect(XMC_USIC_CH_t *const channel); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param mode Communication mode of the SPI, based on this mode TCI(Transmit control information)is updated.\n + * Refer @ref XMC_SPI_CH_MODE_t for valid values. + * + * @return None + * + * \parDescription:
+ * In Dual and Quad modes, hardware port control(CCR.HPCEN) mode is enabled. \n\n + * By enabling this the direction of the data pin is updated by hardware itself. Before transmitting the data set the + * mode to ensure the proper communication. + * + * \parRelated APIs:
+ * XMC_SPI_CH_Transmit() + */ +__STATIC_INLINE void XMC_SPI_CH_SetTransmitMode(XMC_USIC_CH_t *const channel, const XMC_SPI_CH_MODE_t mode) +{ + channel->CCR = (channel->CCR & (uint32_t)(~USIC_CH_CCR_HPCEN_Msk)) | + (((uint32_t) mode << USIC_CH_CCR_HPCEN_Pos) & (uint32_t)USIC_CH_CCR_HPCEN_Msk); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param data Data to be transmitted + * @param mode Communication mode of the SPI, based on this mode TCI(Transmit control information)is updated.\n + * Refer @ref XMC_SPI_CH_MODE_t for valid values. + * + * @return None + * + * \parDescription:
+ * Puts the data into FIFO, if FIFO mode is enabled or else into standard buffer, by setting the proper mode.\n\n + * In Dual and Quad modes, hardware port control(CCR.HPCEN) mode is enabled. By enabling this the direction of the data + * pin is updated by hardware itself. TCI(Transmit Control Information) allows dynamic control of both the data shift mode + * and pin direction during data transfers by writing to SCTR.DSM and SCTR.HPCDIR bit fields. To support this auto + * update, TCSR.HPCMD(Hardware Port control) will be enabled during the initialization using XMC_SPI_CH_Init() for all modes. + * + * + * \parRelated APIs:
+ * XMC_SPI_CH_Receive() + */ +void XMC_SPI_CH_Transmit(XMC_USIC_CH_t *const channel, const uint16_t data, const XMC_SPI_CH_MODE_t mode); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param mode Communication mode of the SPI, based on this mode TCI(Transmit control information)is updated.\n + * Refer @ref XMC_SPI_CH_MODE_t for valid values. + * + * @return None + * + * \parDescription:
+ * Transmits a dummy data(FFFFH) to provide clock for slave and receives the data from the slave.\n\n + * XMC_SPI_CH_Receive() receives the data and places it into buffer based on the FIFO selection. After reception of data + * XMC_SPI_CH_GetReceivedData() can be invoked to read the data from the buffers. + * + * \parRelated APIs:
+ * XMC_SPI_CH_GetReceivedDaa() + */ +__STATIC_INLINE void XMC_SPI_CH_Receive(XMC_USIC_CH_t *const channel, const XMC_SPI_CH_MODE_t mode) +{ + /* Transmit dummy data */ + XMC_SPI_CH_Transmit(channel, (uint16_t)0xffffU, (XMC_SPI_CH_MODE_t)((uint16_t)mode & 0xfffbU)); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return uint16_t Data read from the receive buffer. + * + * \parDescription:
+ * Reads data from the receive buffer based on the FIFO selection.\n\n + * Invocation of XMC_SPI_CH_Receive() receives the data and place it into receive buffer. After receiving the data + * XMC_SPI_CH_GetReceivedData() can be used to read the data from the buffer. + * + * \parRelated APIs:
+ * XMC_SPI_CH_Receive() + */ +uint16_t XMC_SPI_CH_GetReceivedData(XMC_USIC_CH_t *const channel); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Set the order of data transfer from LSB to MSB, by clearing SCTR.SDIR bit.\n\n + * This is typically based on the slave settings. Invoke XMC_SPI_CH_SetBitOrderLsbFirst() to set direction as needed in + * the program. + * + * \parRelated APIs:
+ * XMC_SPI_CH_SetBitOrderMsbFirst() + */ +__STATIC_INLINE void XMC_SPI_CH_SetBitOrderLsbFirst(XMC_USIC_CH_t *const channel) +{ + channel->SCTR &= (uint32_t)~USIC_CH_SCTR_SDIR_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Set the order of data transfer from MSB to LSB, by setting SCTR.SDIR bit.\n\n + * This is typically based on the slave settings. This is not set during XMC_SPI_CH_Init(). + * Invoke XMC_SPI_CH_SetBitOrderMsbFirst() to set direction as needed in the program. + * + * \parRelated APIs:
+ * XMC_SPI_CH_SetBitOrderLsbFirst() + */ +__STATIC_INLINE void XMC_SPI_CH_SetBitOrderMsbFirst(XMC_USIC_CH_t *const channel) +{ + channel->SCTR |= (uint32_t)USIC_CH_SCTR_SDIR_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param event Protocol events which have to be enabled. + * Refer @ XMC_SPI_CH_EVENT_t for valid values. OR combinations of these enum items can be used + * as input. + * + * @return None + * + * \parDescription:
+ * Enables the SPI protocol specific events, by configuring PCR register.\n\n + * Events can be enabled as needed using XMC_SPI_CH_EnableEvent(). + * XMC_SPI_CH_DisableEvent() can be used to disable the events. + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableEvent() + */ +void XMC_SPI_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param event Protocol events which have to be disabled. + * Refer @ XMC_SPI_CH_EVENT_t for valid values. OR combinations of these enum item can be used + * as input. + * + * @return None + * + * \parDescription:
+ * Disables the SPI protocol specific events, by configuring PCR register.\n\n + * After disabling the events, XMC_SPI_CH_EnableEvent() has to be invoked to re-enable the events. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableEvent() + */ +void XMC_SPI_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return uint32_t Status of SPI protocol events. + * + * \parDescription:
+ * Returns the status of the events, by reading PSR register.\n\n + * This indicates the status of the all the events, for SPI communication. + * + * \parRelated APIs:
+ * XMC_SPI_CH_ClearStatusFlag() + */ +__STATIC_INLINE uint32_t XMC_SPI_CH_GetStatusFlag(XMC_USIC_CH_t *const channel) +{ + return channel->PSR_SSCMode; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param flag Protocol event status to be cleared for detection of next occurence. + * Refer @ XMC_SPI_CH_STATUS_FLAG_t for valid values. OR combinations of these enum item can be used + * as input. + * @return None + * + * \parDescription:
+ * Clears the events specified, by setting PSCR register.\n\n + * During communication the events occurred have to be cleared to detect their next occurence.\n + * e.g: During transmission Transmit buffer event occurs to indicating data word transfer has started. This + * event has to be cleared after transmission of each data word. Otherwise next event cannot be recognized. + * + * \parRelated APIs:
+ * XMC_SPI_CH_GetStatusFlag() + */ +__STATIC_INLINE void XMC_SPI_CH_ClearStatusFlag(XMC_USIC_CH_t *const channel, const uint32_t flag) +{ + channel->PSCR |= flag; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Enables the generation of Master clock by setting PCR.MCLK bit.\n\n + * This clock can be used as a clock reference for external devices. This is not enabled during initialization in + * XMC_SPI_CH_Init(). Invoke XMC_SPI_CH_EnableMasterClock() to enable as needed in the program, or if it is disabled by + * XMC_SPI_CH_DisableMasterClock(). + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableMasterClock() + */ +__STATIC_INLINE void XMC_SPI_CH_EnableMasterClock(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode |= (uint32_t)USIC_CH_PCR_SSCMode_MCLK_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Disables the generation of Master clock by clearing PCR.MCLK bit.\n\n + * This clock can be enabled by invoking XMC_SPI_CH_EnableMasterClock() as needed in the program. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableMasterClock() + */ +__STATIC_INLINE void XMC_SPI_CH_DisableMasterClock(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode &= (uint32_t)~USIC_CH_PCR_SSCMode_MCLK_Msk; +} +#ifdef USIC_CH_PCR_SSCMode_SLPHSEL_Msk +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Data bits are shifted out with the leading edge of the shift clock signal and latched in with the trailing edge. + * + * \parRelated APIs:
+ * XMC_SPI_CH_DataLatchedInLeadingEdge() + */ +__STATIC_INLINE void XMC_SPI_CH_DataLatchedInTrailingEdge(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode &= (uint32_t)~USIC_CH_PCR_SSCMode_SLPHSEL_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * The first data bit is shifted out when the data shift unit receives a low to high transition from the DX2 + * stage. Subsequent bits are shifted out with the trailing edge of the shift clock signal. Data bits are + * always latched in with the leading edge. + * + * \parRelated APIs:
+ * XMC_SPI_CH_DataLatchedInTrailingEdge() + */ +__STATIC_INLINE void XMC_SPI_CH_DataLatchedInLeadingEdge(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode |= USIC_CH_PCR_SSCMode_SLPHSEL_Msk; +} +#endif +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Enables the delay after each word, by setting PCR.TIWEN bit.\n\n + * The inter word delay starts at the end of last SCLK cycle of data word. During this time no clock pulses are + * generated and MSLS signal stays active. If inter word delay is not enabled, last data bit of a data word is directly + * followed by the first data bit of the next data word. This is not enabled in XMC_SPI_CH_Init(). To enable + * XMC_SPI_CH_EnableInterwordDelay() has to be invoked as needed in the program. And can be disabled by invoking + * XMC_SPI_CH_DisableInterwordDelay(). + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableInterwordDelay() + */ +__STATIC_INLINE void XMC_SPI_CH_EnableInterwordDelay(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode |= (uint32_t)USIC_CH_PCR_SSCMode_TIWEN_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Disables the delay after after each word, by clearing PCR.TIWEN bit.\n\n + * So the last data bit of a data word is directly followed by the first data bit of the next data word. If needed can + * be enabled by invoking XMC_SPI_CH_EnableInterwordDelay(). + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableInterwordDelay() + */ +__STATIC_INLINE void XMC_SPI_CH_DisableInterwordDelay(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode &= (uint32_t)~USIC_CH_PCR_SSCMode_TIWEN_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param tinterword_delay_ns delay in terms of nano seconds. + * + * @return None + * + * \parDescription:
+ * Configures the inter word delay by setting PCR.PCTQ1, PCR.DCTQ1 bit fields.\n\n + * The inter word delay is dependent on the peripheral clock. The maximum possible value is calculated by using the + * below formula\n + * Maximum inter word delay = ((1 + PCTQ1_max)(1 + DCTQ1_max)) / peripheral clock\n + * where PCTQ1_max = 3 and DCTQ1_max = 31\n + * After configuring the inter word delay, this has to be enabled by invoking XMC_SPI_CH_EnableInterwordDelay(). + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableInterwordDelay(),XMC_SPI_CH_SetInterwordDelaySCLK() + */ +void XMC_SPI_CH_SetInterwordDelay(XMC_USIC_CH_t *const channel,uint32_t tinterword_delay_ns); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param sclk_period in terms of clk cycles. + * + * @return None + * + * \parDescription:
+ * Configures the inter word delay by setting PCR.DCTQ1 bit fields.\n\n + * This delay is dependent on the peripheral clock. The maximum possible value supported by this API + * is 32 clock cycles. + * After configuring the inter word delay, this has to be enabled by invoking XMC_SPI_CH_EnableInterwordDelay(). + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableInterwordDelay(),XMC_SPI_CH_EnableInterwordDelay() + */ +__STATIC_INLINE void XMC_SPI_CH_SetInterwordDelaySCLK(XMC_USIC_CH_t *const channel,uint32_t sclk_period) +{ + channel->PCR_SSCMode = (uint32_t)((channel->PCR_SSCMode) & (~(USIC_CH_PCR_SSCMode_DCTQ1_Msk | + USIC_CH_PCR_SSCMode_PCTQ1_Msk | + USIC_CH_PCR_SSCMode_CTQSEL1_Msk))) | + (((sclk_period - 1U) << USIC_CH_PCR_SSCMode_DCTQ1_Pos) | + (0x02U << USIC_CH_PCR_SSCMode_CTQSEL1_Pos)); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param sclk_period delay in terms of sclk clock cycles. + * + * @return None + * + * \parDescription:
+ * Configures the leading/trailing delay by setting BRG.DCTQ bit field.\n\n + * This delay is dependent on the peripheral clock. The maximum possible value supported by this API + * is 30 clock cycles. + * + */ +__STATIC_INLINE void XMC_SPI_CH_SetSlaveSelectDelay(XMC_USIC_CH_t *const channel,uint32_t sclk_period) +{ + + channel->BRG = (channel->BRG & ~(USIC_CH_BRG_DCTQ_Msk | + USIC_CH_BRG_PCTQ_Msk)) | + (((sclk_period - 1U) << USIC_CH_BRG_DCTQ_Pos) | (0x01U << USIC_CH_BRG_PCTQ_Pos)); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * + * Configure to keep MSLS(Slave select signal) active even after finishing the current data frame, + * by setting PCR.FEM bit.\n\n + * This is typically used during the transmission of multi-data word frames, where there is possibility of delay in + * delivering the data. Frame end mode is enabled in XMC_SPI_CH_Init() during initialization. To disable + * XMC_SPI_CH_DisableFEM() can be invoked as needed in the program. + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableFEM() + */ +__STATIC_INLINE void XMC_SPI_CH_EnableFEM(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode |= (uint32_t)USIC_CH_PCR_SSCMode_FEM_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Configure to disable the MSLS(Slave select signal) if the current data frame is considered as finished, + * by setting PCR.FEM bit.\n\n + * + * When the last bit of a data word has been sent out and the transmit buffer TBUF does not contain new data, is + * considered as frame is ended and MSLS(Slave select signal) is disabled. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableFEM() + */ +__STATIC_INLINE void XMC_SPI_CH_DisableFEM(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode &= (uint32_t)~USIC_CH_PCR_SSCMode_FEM_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param passive_level polarity and delay of the selected shift clock.\n + * Refer @ref XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t for valid inputs. + * @param clock_output shift clock source.\n + * Refer @ref XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT_t for valid inputs. + * + * @return None + * + * \parDescription:
+ * Configures the shift clock source with the selected polarity and delay by setting BRG.SCLKOSEL and BRG.SCLKCFG.\n\n + * In Master mode operation, shift clock is generated by the internal baud rate generator. This SCLK is made available + * for external slave devices by SCLKOUT signal.\n + * In Slave mode, the signal is received from the external master. So the DX1(input) stage has to be connected to input.\n + * The shift clock output(SCLKOUT) signal polarity can be set relative to SCLK, with the delay of half the shift clock + * period. These settings are applicable only in master mode. + */ +__STATIC_INLINE void XMC_SPI_CH_ConfigureShiftClockOutput(XMC_USIC_CH_t *const channel, + const XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t passive_level, + const XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT_t clock_output) +{ + XMC_USIC_CH_ConfigureShiftClockOutput(channel, (XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t)passive_level, + (XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_t)clock_output); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param word_length Number of bits to be configured for a data word. \n + * \b Range: 1 to 16. + * + * @return None + * + * \parDescription
+ * Defines the data word length.\n\n + * Sets the number of bits to represent a data word. Frame length should be a multiple of word length. + * + * \parRelated APIs:
+ * XMC_SPI_CH_SetFrameLength() + */ +__STATIC_INLINE void XMC_SPI_CH_SetWordLength(XMC_USIC_CH_t *const channel, const uint8_t word_length) +{ + XMC_USIC_CH_SetWordLength(channel, word_length); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param frame_length Number of bits in a frame. \n + * \b Range: 1 to 64. If the value 64 is configured, then the frame does not + * automatically end. User should explicitly end the frame. + * + * @return None + * + * \parDescription
+ * Define the data frame length.\n\n + * Set the number of bits to be serially transmitted in a frame. + * The frame length should be multiples of word length. If the value is set to 64, the frame does not + * automatically end. Use XMC_SPI_CH_DisableSlaveSelect() to end the frame after all the data + * is transmitted. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetWordLength(), XMC_USIC_CH_EnableFrameLengthControl(), XMC_SPI_CH_DisableSlaveSelect() + */ +__STATIC_INLINE void XMC_SPI_CH_SetFrameLength(XMC_USIC_CH_t *const channel, const uint8_t frame_length) +{ + XMC_USIC_CH_SetFrameLength(channel, frame_length); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription
+ * Configure the handling of start of frame through software, by setting TCSR.SOF bit.\n\n + * This can be used if the software handles the TBUF data without FIFO. If SOF is set, a valid content of the TBUF is + * considered as first word of a new frame by finishing the currently running frame. For software handling of SOF bit, + * it is recommended to configure TCSR.WLEMD as 0. This is not configured during initialization. XMC_SPI_CH_EnableSOF() + * can be called as needed in the program and can be disabled by XMC_SPI_CH_DisableSOF(). + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableSOF() + */ +__STATIC_INLINE void XMC_SPI_CH_EnableSOF(XMC_USIC_CH_t *const channel) +{ + channel->TCSR |= (uint32_t)USIC_CH_TCSR_SOF_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription
+ * Set the control of the handling start of frame through hardware, by clearing TCSR.SOF bit.\n\n + * Typically this can be disabled, where the transmission control is done by the hardware. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableSOF() + */ +__STATIC_INLINE void XMC_SPI_CH_DisableSOF(XMC_USIC_CH_t *const channel) +{ + channel->TCSR &= (uint32_t)~USIC_CH_TCSR_SOF_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription
+ * Configure the handling of end of frame through software, by setting TCSR.EOF bit.\n\n + * This can be used if the software handles the TBUF data without FIFO. If EOF is set, a valid content of the TBUF is + * considered as last word of a frame. After transfer of the last word, MSLS signal becomes inactive. For software + * handling of EOF bit, it is recommended to configure TCSR.WLEMD as 0. \n + * \b Note: The API should be called before putting the last data word of the frame to TBUF. + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableEOF() + */ +__STATIC_INLINE void XMC_SPI_CH_EnableEOF(XMC_USIC_CH_t *const channel) +{ + channel->TCSR |= (uint32_t)USIC_CH_TCSR_EOF_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription
+ * Configure the handling of end of frame through hardware, by clearing TCSR.EOF bit.\n\n + * Typically this can be disabled, where the transmission control is done by the hardware. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableEOF() + */ +__STATIC_INLINE void XMC_SPI_CH_DisableEOF(XMC_USIC_CH_t *const channel) +{ + channel->TCSR &= (uint32_t)~USIC_CH_TCSR_EOF_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param input SPI channel input stage.\n + * Refer @ref XMC_SPI_CH_INPUT_t for valid values + * @param source Input source select for the input stage. + * Range : [0 to 7] + * + * @return None + * + * \parDescription
+ * Selects the data source for SPI input stage, by configuring DXCR.DSEL bits.\n\n + * Selects the input data signal source among DXnA, DXnB.. DXnG for the input stage. The API can be used for all the + * input stages like DX0CR, DX1CR etc. This is not done during initialization. This has to be configured before starting + * the SPI communication. + */ +__STATIC_INLINE void XMC_SPI_CH_SetInputSource(XMC_USIC_CH_t *const channel, + const XMC_SPI_CH_INPUT_t input, + const uint8_t source) +{ + channel->DXCR[input] = (uint32_t)(channel->DXCR[input] & (~USIC_CH_DX0CR_DSEN_Msk)) | USIC_CH_DX0CR_INSW_Msk; + XMC_USIC_CH_SetInputSource(channel, (XMC_USIC_CH_INPUT_t)input, source); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param selo_inversion Polarity of the slave select signal relative to the MSLS signal.\n + * Refer @ref XMC_SPI_CH_SLAVE_SEL_MSLS_INV_t for valid values + * + * @return None + * + * \parDescription
+ * Set the polarity of the slave select signal, by configuring PCR.SELINV bit.\n\n + * Normally MSLS signal is active low level signal. SO based on the slave inversion has to be applied. This is configured + * in XMC_SPI_CH_Init() during initialization. Invoke XMC_SPI_CH_SetSlaveSelectPolarity() with desired settings as + * needed later in the program. + */ +__STATIC_INLINE void XMC_SPI_CH_SetSlaveSelectPolarity(XMC_USIC_CH_t *const channel, + const XMC_SPI_CH_SLAVE_SEL_MSLS_INV_t selo_inversion) +{ + /* Configuration of Protocol Control Register */ + channel->PCR_SSCMode = (uint32_t)((channel->PCR_SSCMode & (~USIC_CH_PCR_SSCMode_SELINV_Msk)) | (uint32_t)selo_inversion); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param input SPI channel input stage.\n + * Refer @ref XMC_SPI_CH_INPUT_t for valid inputs. + * + * @return None + * + * \parDescription
+ * Enables the polarity inversion of input data signal, by setting DXyCR.DPOL(where y = \a input).\n\n + * This is not set in XMC_SPI_CH_Init(). Invoke XMC_SPI_CH_EnableInputInversion() as needed later in the program. To + * disable the inversion XMC_SPI_CH_DisableInputInversion() can be invoked. + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableInputInversion() + */ +__STATIC_INLINE void XMC_SPI_CH_EnableInputInversion(XMC_USIC_CH_t *const channel, + const XMC_SPI_CH_INPUT_t input) +{ + XMC_USIC_CH_EnableInputInversion(channel, (XMC_USIC_CH_INPUT_t)input); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param input SPI channel input stage.\n + * Refer @ref XMC_SPI_CH_INPUT_t for valid inputs. + * + * @return None + * + * \parDescription
+ * Disables the polarity inversion of input data signal, by clearing DXyCR.DPOL(where y = \a input).\n\n + * Resets the input data polarity. Invoke XMC_SPI_CH_EnableInputInversion() to apply inversion. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableInputInversion() + */ +__STATIC_INLINE void XMC_SPI_CH_DisableInputInversion(XMC_USIC_CH_t *const channel, + const XMC_SPI_CH_INPUT_t input) +{ + XMC_USIC_CH_DisableInputInversion(channel, (XMC_USIC_CH_INPUT_t)input); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param service_request Service request number. + Range: [0 to 5] + * + * @return None + * + * \parDescription
+ * Sets the interrupt node for SPI channel events.\n\n + * For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so. This is not configured in XMC_SPI_CH_Init() during + * initialization. + * + * \parNote::
+ * 1. NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableEvent() + */ +__STATIC_INLINE void XMC_SPI_CH_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const uint8_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL, (uint32_t)service_request); +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_SPI0_CH0, @ref XMC_SPI0_CH1,@ref XMC_SPI1_CH0,@ref XMC_SPI1_CH1,@ref XMC_SPI2_CH0,@ref XMC_SPI2_CH1 @note Availability of SPI1 and SPI2 depends on device selection + * @param interrupt_node Interrupt node pointer to be configured. \n + * \b Range: @ref XMC_SPI_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, + * @ref XMC_SPI_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER etc. + * @param service_request Service request number.\n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets the interrupt node for USIC channel events. \n\n + * For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so.
+ * Note: NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_SPI_CH_SelectInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_SPI_CH_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, (XMC_USIC_CH_INTERRUPT_NODE_POINTER_t)interrupt_node, + (uint32_t)service_request); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_SPI0_CH0, @ref XMC_SPI0_CH1,@ref XMC_SPI1_CH0,@ref XMC_SPI1_CH1,@ref XMC_SPI2_CH0,@ref XMC_SPI2_CH1 @note Availability of SPI1 and SPI2 depends on device selection + * @param service_request_line service request number of the event to be triggered. \n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Trigger a SPI interrupt service request.\n\n + * When the SPI service request is triggered, the NVIC interrupt associated with it will be + * generated if enabled. + * + * \parRelated APIs:
+ * XMC_SPI_CH_SelectInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_SPI_CH_TriggerServiceRequest(XMC_USIC_CH_t *const channel, const uint32_t service_request_line) +{ + XMC_USIC_CH_TriggerServiceRequest(channel, (uint32_t)service_request_line); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_SPI0_CH0, @ref XMC_SPI0_CH1,@ref XMC_SPI1_CH0,@ref XMC_SPI1_CH1,@ref XMC_SPI2_CH0,@ref XMC_SPI2_CH1 @note Availability of SPI1 and SPI2 depends on device selection + * @return None + * + * \parDescription
+ * Enables delay compensation. \n\n + * + * Delay compensation can be applied to the receive path. + * \parRelated APIs:
+ * XMC_SPI_CH_DisableDelayCompensation()\n\n\n + */ +__STATIC_INLINE void XMC_SPI_CH_EnableDelayCompensation(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_EnableDelayCompensation(channel); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_SPI0_CH0, @ref XMC_SPI0_CH1,@ref XMC_SPI1_CH0,@ref XMC_SPI1_CH1,@ref XMC_SPI2_CH0,@ref XMC_SPI2_CH1 @note Availability of SPI1 and SPI2 depends on device selection + * @return None + * + * \parDescription
+ * Disables delay compensation.. \n\n + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableDelayCompensation()\n\n\n + */ +__STATIC_INLINE void XMC_SPI_CH_DisableDelayCompensation(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_DisableDelayCompensation(channel); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_SPI0_CH0, @ref XMC_SPI0_CH1,@ref XMC_SPI1_CH0,@ref XMC_SPI1_CH1,@ref XMC_SPI2_CH0,@ref XMC_SPI2_CH1 @note Availability of SPI1 and SPI2 depends on device selection + * @param pdiv Desired divider for the external frequency input. \b Range: minimum value = 1, maximum value = 1024 \n + * @param combination_mode USIC channel input combination mode \n + * + * @return None + * + * \parDescription
+ * Enables the external frequency input for the Baudrate Generator and configures the divider, oversampling and + * the combination mode of the USIC channel. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetBRGInputClockSource(), XMC_USIC_CH_SetInputTriggerCombinationMode() \n\n\n + */ +__STATIC_INLINE void XMC_SPI_CH_ConfigExternalInputSignalToBRG(XMC_USIC_CH_t *const channel, + const uint16_t pdiv, + const XMC_USIC_CH_INPUT_COMBINATION_MODE_t combination_mode) +{ + XMC_USIC_CH_ConfigExternalInputSignalToBRG(channel,pdiv,2U,combination_mode); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription
+ * The SELOx lines (with x = 1-7) can be used as addresses for an external address + * decoder to increase the number of external slave devices. + */ +__STATIC_INLINE void XMC_SPI_CH_EnableSlaveSelectCodedMode(XMC_USIC_CH_t *const channel) +{ + /* Configuration of Protocol Control Register */ + channel->PCR_SSCMode = (uint32_t)(channel->PCR_SSCMode & (~USIC_CH_PCR_SSCMode_SELCTR_Msk)); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription
+ * Each SELOx line (with x = 0-7) can be directly connected to an external slave device. + */ +__STATIC_INLINE void XMC_SPI_CH_DisableSlaveSelectCodedMode(XMC_USIC_CH_t *const channel) +{ + /* Configuration of Protocol Control Register */ + channel->PCR_SSCMode |= (uint32_t)USIC_CH_PCR_SSCMode_SELCTR_Msk; +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_SPI0_CH0, @ref XMC_SPI0_CH1,@ref XMC_SPI1_CH0,@ref XMC_SPI1_CH1,@ref XMC_SPI2_CH0,@ref XMC_SPI2_CH1 @note Availability of SPI1 and SPI2 depends on device selection + * @return None + * + * \parDescription
+ * Enable data transmission.\n\n + * Use this function in combination with XMC_SPI_CH_DisableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * @note If you need more control over the start of transmission use XMC_USIC_CH_SetStartTransmisionMode() + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_SPI_CH_EnableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_ON_TDV); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_SPI0_CH0, @ref XMC_SPI0_CH1,@ref XMC_SPI1_CH0,@ref XMC_SPI1_CH1,@ref XMC_SPI2_CH0,@ref XMC_SPI2_CH1 @note Availability of SPI1 and SPI2 depends on device selection + * @return None + * + * \parDescription
+ * Disable data transmission.\n\n + * Use this function in combination with XMC_SPI_CH_EnableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_SPI_CH_DisableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_DISABLED); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_uart.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_uart.h new file mode 100644 index 00000000..387be642 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_uart.h @@ -0,0 +1,810 @@ + /** + * @file xmc_uart.h + * @date 2016-05-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial + * + * 2015-05-20: + * - Description updated
+ * - Added XMC_UART_CH_TriggerServiceRequest() and XMC_UART_CH_SelectInterruptNodePointer
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-09-01: + * - Modified XMC_UART_CH_SetInputSource() for avoiding complete DXCR register overwriting.
+ * - Modified XMC_UART_CH_EVENT_t enum for supporting XMC_UART_CH_EnableEvent() and XMC_UART_CH_DisableEvent() + * for supporting multiple events configuration
+ * + * 2016-05-20: + * - Added XMC_UART_CH_EnableDataTransmission() and XMC_UART_CH_DisableDataTransmission() + * + * @endcond + * + */ + +#ifndef XMC_UART_H +#define XMC_UART_H + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ + +#include "xmc_usic.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup UART + * @brief Universal Asynchronous Receiver/Transmitter (UART) driver for XMC microcontroller family. + * + * The UART driver uses Universal Serial Interface Channel(USIC) module to implement UART protocol. + * It provides APIs to configure USIC channel for UART communication. The driver enables the user + * in getting the status of UART protocol events, configuring interrupt service requests, protocol + * related parameter configuration etc. + * + * UART driver features: + * -# Configuration structure XMC_UART_CH_CONFIG_t and initialization function XMC_UART_CH_Init() + * -# Enumeration of events with their bit masks @ref XMC_UART_CH_EVENT_t, @ref XMC_UART_CH_STATUS_FLAG_t + * -# Allows the selection of input source for the DX0 input stage using the API XMC_UART_CH_SetInputSource() + * -# Allows configuration of baudrate using XMC_UART_CH_SetBaudrate() and configuration of data length using + XMC_UART_CH_SetWordLength() and XMC_UART_CH_SetFrameLength() + * -# Provides the status of UART protocol events, XMC_UART_CH_GetStatusFlag() + * -# Allows transmission of data using XMC_UART_CH_Transmit() and gets received data using XMC_UART_CH_GetReceivedData() + * + * @{ + */ + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ + +#if defined(USIC0) +#define XMC_UART0_CH0 XMC_USIC0_CH0 /**< USIC0 channel 0 base address */ +#define XMC_UART0_CH1 XMC_USIC0_CH1 /**< USIC0 channel 1 base address */ +#endif + +#if defined(USIC1) +#define XMC_UART1_CH0 XMC_USIC1_CH0 /**< USIC1 channel 0 base address */ +#define XMC_UART1_CH1 XMC_USIC1_CH1 /**< USIC1 channel 1 base address */ +#endif + +#if defined(USIC2) +#define XMC_UART2_CH0 XMC_USIC2_CH0 /**< USIC2 channel 0 base address */ +#define XMC_UART2_CH1 XMC_USIC2_CH1 /**< USIC2 channel 1 base address */ +#endif + +/********************************************************************************************************************* + * ENUMS + *********************************************************************************************************************/ + +/** + * UART driver status + */ +typedef enum XMC_UART_CH_STATUS +{ + XMC_UART_CH_STATUS_OK, /**< UART driver status : OK*/ + XMC_UART_CH_STATUS_ERROR, /**< UART driver status : ERROR */ + XMC_UART_CH_STATUS_BUSY /**< UART driver status : BUSY */ +} XMC_UART_CH_STATUS_t; + +/** +* UART portocol status. The enum values can be used for getting the status of UART channel. +* +*/ +typedef enum XMC_UART_CH_STATUS_FLAG +{ + XMC_UART_CH_STATUS_FLAG_TRANSMISSION_IDLE = USIC_CH_PSR_ASCMode_TXIDLE_Msk, /**< UART Protocol Status transmit IDLE*/ + XMC_UART_CH_STATUS_FLAG_RECEPTION_IDLE = USIC_CH_PSR_ASCMode_RXIDLE_Msk, /**< UART Protocol Status receive IDLE*/ + XMC_UART_CH_STATUS_FLAG_SYNCHRONIZATION_BREAK_DETECTED = USIC_CH_PSR_ASCMode_SBD_Msk, /**< UART Protocol Status synchronization break detected*/ + XMC_UART_CH_STATUS_FLAG_COLLISION_DETECTED = USIC_CH_PSR_ASCMode_COL_Msk, /**< UART Protocol Status collision detected*/ + XMC_UART_CH_STATUS_FLAG_RECEIVER_NOISE_DETECTED = USIC_CH_PSR_ASCMode_RNS_Msk, /**< UART Protocol Status receiver noise detected */ + XMC_UART_CH_STATUS_FLAG_FORMAT_ERROR_IN_STOP_BIT_0 = USIC_CH_PSR_ASCMode_FER0_Msk, /**< UART Protocol Status format error in stop bit 0 */ + XMC_UART_CH_STATUS_FLAG_FORMAT_ERROR_IN_STOP_BIT_1 = USIC_CH_PSR_ASCMode_FER1_Msk, /**< UART Protocol Status format error in stop bit 1 */ + XMC_UART_CH_STATUS_FLAG_RECEIVE_FRAME_FINISHED = USIC_CH_PSR_ASCMode_RFF_Msk, /**< UART Protocol Status receive frame finished */ + XMC_UART_CH_STATUS_FLAG_TRANSMITTER_FRAME_FINISHED = USIC_CH_PSR_ASCMode_TFF_Msk, /**< UART Protocol Status transmit frame finished */ + XMC_UART_CH_STATUS_FLAG_TRANSFER_STATUS_BUSY = USIC_CH_PSR_ASCMode_BUSY_Msk, /**< UART Protocol Status transfer status busy */ + XMC_UART_CH_STATUS_FLAG_RECEIVER_START_INDICATION = USIC_CH_PSR_ASCMode_RSIF_Msk, /**< UART Protocol Status receive start indication flag*/ + XMC_UART_CH_STATUS_FLAG_DATA_LOST_INDICATION = USIC_CH_PSR_ASCMode_DLIF_Msk, /**< UART Protocol Status data lost indication flag*/ + XMC_UART_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION = USIC_CH_PSR_ASCMode_TSIF_Msk, /**< UART Protocol Status transmit shift indication flag*/ + XMC_UART_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION = USIC_CH_PSR_ASCMode_TBIF_Msk, /**< UART Protocol Status transmit buffer indication flag*/ + XMC_UART_CH_STATUS_FLAG_RECEIVE_INDICATION = USIC_CH_PSR_ASCMode_RIF_Msk, /**< UART Protocol Status receive indication flag*/ + XMC_UART_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION = USIC_CH_PSR_ASCMode_AIF_Msk, /**< UART Protocol Status alternative receive indication flag*/ + XMC_UART_CH_STATUS_FLAG_BAUD_RATE_GENERATOR_INDICATION = USIC_CH_PSR_ASCMode_BRGIF_Msk /**< UART Protocol Status baudrate generator indication flag*/ +} XMC_UART_CH_STATUS_FLAG_t; + +/** +* UART configuration events. The enums can be used for configuring events using the CCR register. +*/ +typedef enum XMC_CH_UART_EVENT +{ + XMC_UART_CH_EVENT_RECEIVE_START = USIC_CH_CCR_RSIEN_Msk, /**< Receive start event */ + XMC_UART_CH_EVENT_DATA_LOST = USIC_CH_CCR_DLIEN_Msk, /**< Data lost event */ + XMC_UART_CH_EVENT_TRANSMIT_SHIFT = USIC_CH_CCR_TSIEN_Msk, /**< Transmit shift event */ + XMC_UART_CH_EVENT_TRANSMIT_BUFFER = USIC_CH_CCR_TBIEN_Msk, /**< Transmit buffer event */ + XMC_UART_CH_EVENT_STANDARD_RECEIVE = USIC_CH_CCR_RIEN_Msk, /**< Receive event */ + XMC_UART_CH_EVENT_ALTERNATIVE_RECEIVE = USIC_CH_CCR_AIEN_Msk, /**< Alternate receive event */ + XMC_UART_CH_EVENT_BAUD_RATE_GENERATOR = USIC_CH_CCR_BRGIEN_Msk, /**< Baudrate generator event */ + + XMC_UART_CH_EVENT_SYNCHRONIZATION_BREAK = USIC_CH_PCR_ASCMode_SBIEN_Msk, /**< Event synchronization break */ + XMC_UART_CH_EVENT_COLLISION = USIC_CH_PCR_ASCMode_CDEN_Msk, /**< Event collision */ + XMC_UART_CH_EVENT_RECEIVER_NOISE = USIC_CH_PCR_ASCMode_RNIEN_Msk, /**< Event receiver noise */ + XMC_UART_CH_EVENT_FORMAT_ERROR = USIC_CH_PCR_ASCMode_FEIEN_Msk, /**< Event format error */ + XMC_UART_CH_EVENT_FRAME_FINISHED = USIC_CH_PCR_ASCMode_FFIEN_Msk /**< Event frame finished */ +} XMC_UART_CH_EVENT_t; + +/** + * UART Input sampling frequency options + */ +typedef enum XMC_UART_CH_INPUT_SAMPLING_FREQ +{ + XMC_UART_CH_INPUT_SAMPLING_FREQ_FPERIPH = XMC_USIC_CH_INPUT_SAMPLING_FREQ_FPERIPH, /**< Sampling frequency input fperiph*/ + XMC_UART_CH_INPUT_SAMPLING_FREQ_FRACTIONAL_DIVIDER = XMC_USIC_CH_INPUT_SAMPLING_FREQ_FRACTIONAL_DIVIDER /**< Sampling frequency input fractional divider*/ +} XMC_UART_CH_INPUT_SAMPLING_FREQ_t; + +/** + * UART input stages + */ +typedef enum XMC_UART_CH_INPUT +{ + XMC_UART_CH_INPUT_RXD = 0UL /**< UART input stage DX0*/ +#if UC_FAMILY == XMC1 + , + XMC_UART_CH_INPUT_RXD1 = 3UL, /**< UART input stage DX3*/ + XMC_UART_CH_INPUT_RXD2 = 5UL /**< UART input stage DX5*/ +#endif +} XMC_UART_CH_INPUT_t; + + +/** + * UART channel interrupt node pointers + */ +typedef enum XMC_UART_CH_INTERRUPT_NODE_POINTER +{ + XMC_UART_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, /**< Node pointer for transmit shift interrupt */ + XMC_UART_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER, /**< Node pointer for transmit buffer interrupt */ + XMC_UART_CH_INTERRUPT_NODE_POINTER_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_RECEIVE, /**< Node pointer for receive interrupt */ + XMC_UART_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE, /**< Node pointer for alternate receive interrupt */ + XMC_UART_CH_INTERRUPT_NODE_POINTER_PROTOCOL = XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL /**< Node pointer for protocol related interrupts */ +} XMC_UART_CH_INTERRUPT_NODE_POINTER_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + *********************************************************************************************************************/ + +/** + * UART initialization structure +*/ +typedef struct XMC_UART_CH_CONFIG +{ + uint32_t baudrate; /**< Desired baudrate. \b Range: minimum= 100, maximum= (fPERIPH * 1023)/(1024 * oversampling) */ + uint8_t data_bits; /**< Number of bits for the data field. Value configured as USIC channel word length. \n + \b Range: minimum= 1, maximum= 16*/ + uint8_t frame_length; /**< Indicates nmber of bits in a frame. Configured as USIC channel frame length. \n + \b Range: minimum= 1, maximum= 63*/ + uint8_t stop_bits; /**< Number of stop bits. \b Range: minimum= 1, maximum= 2 */ + uint8_t oversampling; /**< Number of samples for a symbol(DCTQ).\b Range: minimum= 1, maximum= 32*/ + XMC_USIC_CH_PARITY_MODE_t parity_mode; /**< Parity mode. \b Range: @ref XMC_USIC_CH_PARITY_MODE_NONE, @ref XMC_USIC_CH_PARITY_MODE_EVEN, \n + @ref XMC_USIC_CH_PARITY_MODE_ODD*/ +} XMC_UART_CH_CONFIG_t; + +/********************************************************************************************************************* + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0, XMC_UART1_CH1,XMC_UART2_CH0, XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param config Constant pointer to UART configuration structure of type @ref XMC_UART_CH_CONFIG_t. + * @return XMC_UART_CH_STATUS_t Status of initializing the USIC channel for UART protocol.\n + * \b Range: @ref XMC_UART_CH_STATUS_OK if initialization is successful.\n + * @ref XMC_UART_CH_STATUS_ERROR if configuration of baudrate failed. + * + * \parDescription
+ * Initializes the USIC channel for UART protocol.\n\n + * During the initialization, USIC channel is enabled, baudrate is configured with the defined oversampling value + * in the intialization structure. If the oversampling value is set to 0 in the structure, the default oversampling of 16 + * is considered. Sampling point for each symbol is configured at the half of sampling period. Symbol value is decided by the + * majority decision among 3 samples. + * Word length is configured with the number of data bits. If the value of \a frame_length is 0, then USIC channel frame length + * is set to the same value as word length. If \a frame_length is greater than 0, it is set as the USIC channel frame length. + * Parity mode is set to the value configured for \a parity_mode. + * The USIC channel should be set to UART mode by calling the XMC_UART_CH_Start() API after the initialization. + * + * \parRelated APIs:
+ * XMC_UART_CH_Start(), XMC_UART_CH_Stop(), XMC_UART_CH_Transmit()\n\n\n + */ +void XMC_UART_CH_Init(XMC_USIC_CH_t *const channel, const XMC_UART_CH_CONFIG_t *const config); + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @return None + * + * \parDescription
+ * Sets the USIC channel operation mode to UART mode.\n\n + * CCR register bitfield \a Mode is set to 2(UART mode). This API should be called after configuring + * the USIC channel. Transmission and reception can happen only when the UART mode is set. + * This is an inline function. + * + * \parRelated APIs:
+ * XMC_UART_CH_Stop(), XMC_UART_CH_Transmit()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_Start(XMC_USIC_CH_t *const channel) +{ + channel->CCR = (uint32_t)(((channel->CCR) & (~USIC_CH_CCR_MODE_Msk)) | (uint32_t)XMC_USIC_CH_OPERATING_MODE_UART); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @return XMC_UART_CH_STATUS_t Status to indicate if the communication channel is stopped successfully.\n + * @ref XMC_UART_CH_STATUS_OK if the communication channel is stopped. + * @ref XMC_UART_CH_STATUS_BUSY if the communication channel is busy. + * + * \parDescription
+ * Stops the UART communication.\n\n + * CCR register bitfield \a Mode is reset. This disables the communication. + * Before starting the communication again, the channel has to be reconfigured. + * + * \parRelated APIs:
+ * XMC_UART_CH_Init() \n\n\n + */ +XMC_UART_CH_STATUS_t XMC_UART_CH_Stop(XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, XMC_UART0_CH1 ,XMC_UART1_CH0, XMC_UART1_CH1, XMC_UART2_CH0, XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param rate Desired baudrate. \n + * \b Range: minimum value = 100, maximum value depends on the peripheral clock frequency\n + * and \a oversampling. Maximum baudrate can be derived using the formula: (fperiph * 1023)/(1024 * oversampling) + * @param oversampling Required oversampling. The value indicates the number of time quanta for one symbol of data.\n + * This can be related to the number of samples for each logic state of the data signal.\n + * \b Range: 4 to 32. Value should be chosen based on the protocol used. + * @return XMC_UART_CH_STATUS_t Status indicating the baudrate configuration.\n + * \b Range: @ref XMC_USIC_CH_STATUS_OK if baudrate is successfully configured, + * @ref XMC_USIC_CH_STATUS_ERROR if desired baudrate or oversampling is invalid. + * + * \parDescription:
+ * Sets the bus speed in bits per second.\n\n + * Derives the values of \a STEP and PDIV to arrive at the optimum realistic speed possible. + * \a oversampling is the number of samples to be taken for each symbol of UART protocol. + * Default \a oversampling of 16 is considered if the input \a oversampling is less than 4. It is recommended to keep + * a minimum oversampling of 4 for UART. + * + * \parRelated APIs:
+ * XMC_UART_CH_Init(), XMC_UART_CH_Stop() + */ +XMC_UART_CH_STATUS_t XMC_UART_CH_SetBaudrate(XMC_USIC_CH_t *const channel, uint32_t rate, uint32_t oversampling); + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param data Data to be transmitted. \n + * \b Range: 16 bit unsigned data within the range 0 to 65535. Actual size of + * data transmitted depends on the configured number of bits for the UART protocol in the register SCTR. + * @return None + * + * \parDescription
+ * Transmits data over serial communication channel using UART protocol.\n\n + * Based on the channel configuration, data is either put to the transmit FIFO or to TBUF register. + * Before putting data to TBUF, the API waits for TBUF to finish shifting its contents to shift register. + * So user can continuously execute the API without checking for TBUF busy status. Based on the number of + * data bits configured, the lower significant bits will be extracted for transmission. + * + * Note: When FIFO is not configured, the API waits for the TBUF to be available. + * This makes the execution a blocking call. + * + * \parRelated APIs:
+ * XMC_UART_CH_GetReceivedData() \n\n\n + */ +void XMC_UART_CH_Transmit(XMC_USIC_CH_t *const channel, const uint16_t data); + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @return uint16_t Received data over UART communication channel. + * \parDescription
+ * Provides one word of data received over UART communication channel.\n\n + * Based on the channel configuration, data is either read from the receive FIFO or RBUF register. + * Before returning the value, there is no check for data validity. User should check the appropriate + * data receive flags(standard receive/alternative receive/FIFO standard receive/FIFO alternative receive) + * before executing the API. Reading from an empty receive FIFO can generate a receive error event. + * + * \parRelated APIs:
+ * XMC_UART_CH_GetStatusFlag(), XMC_UART_CH_Transmit() \n\n\n + */ +uint16_t XMC_UART_CH_GetReceivedData(XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param word_length Data word length. \n + * \b Range: minimum= 1, maximum= 16. + * @return None + * + * \parDescription
+ * Sets the data word length in number of bits.\n\n + * Word length can range from 1 to 16. It indicates the number of data bits in a data word. + * The value of \a word_length will be decremented by 1 before setting the value to \a SCTR register. + * If the UART data bits is more than 16, then the frame length should be set to the actual number of bits and + * word length should be configured with the number of bits expected in each transaction. For example, if number of data bits + * for UART communication is 20 bits, then the frame length should be set as 20. Word length can be set based on the + * transmit and receive handling. If data is stored as 8bit array, then the word length can be set to 8. In this case, + * a full message of UART data should be transmitted/ received as 3 data words. + * + * \parRelated APIs:
+ * XMC_UART_CH_SetFrameLength() \n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_SetWordLength(XMC_USIC_CH_t *const channel, const uint8_t word_length) +{ + XMC_USIC_CH_SetWordLength(channel, word_length); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param frame_length Number of data bits in each UART frame. \n + * \b Range: minimum= 1, maximum= 64. + * @return None + * + * \parDescription
+ * Sets the number of data bits for UART communication.\n\n + * The frame length is configured by setting the input value to \a SCTR register. + * The value of \a frame_length will be decremented by 1, before setting it to the register. + * Frame length should not be set to 64 for UART communication. + * + * \parRelated APIs:
+ * XMC_UART_CH_SetWordLength() \n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_SetFrameLength(XMC_USIC_CH_t *const channel, const uint8_t frame_length) +{ + XMC_USIC_CH_SetFrameLength(channel, frame_length); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param event Event bitmasks to enable. Use the type @ref XMC_UART_CH_EVENT_t for naming events. \n + * \b Range: @ref XMC_UART_CH_EVENT_RECEIVE_START, @ref XMC_UART_CH_EVENT_DATA_LOST, + * @ref XMC_UART_CH_EVENT_TRANSMIT_SHIFT, @ref XMC_UART_CH_EVENT_TRANSMIT_BUFFER, + * etc. + * @return None + * + * \parDescription
+ * Enables interrupt events for UART communication.\n\n + * Multiple events can be combined using the bitwise OR operation and configured in one function call. + * @ref XMC_UART_CH_EVENT_t enumerates multiple event bitmasks. These enumerations can be used as input to the API. + * Events are configured by setting bits in the CCR register. + * \parRelated APIs:
+ * XMC_UART_CH_DisableEvent(), XMC_UART_CH_SetInterruptNodePointer(), XMC_UART_CH_GetStatusFlag() \n\n\n + */ +void XMC_UART_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event); + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param event Bitmask of events to disable. Use the type @ref XMC_UART_CH_EVENT_t for naming events.\n + * \b Range: @ref XMC_UART_CH_EVENT_RECEIVE_START, @ref XMC_UART_CH_EVENT_DATA_LOST, + * @ref XMC_UART_CH_EVENT_TRANSMIT_SHIFT, @ref XMC_UART_CH_EVENT_TRANSMIT_BUFFER, + * etc. + * @return None + * + * \parDescription
+ * Disables the interrupt events by clearing the bits in CCR register.\n\n + * Multiple events can be combined using the bitwise OR operation and configured in one function call. + * XMC_UART_CH_EVENT_FLAG_t enumerates multiple event bitmasks. These enumerations can be used as input to the API. + * + * \parRelated APIs:
+ * XMC_UART_CH_ClearStatusFlag(), XMC_UART_CH_EnableEvent() \n\n\n + */ +void XMC_UART_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event); + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param service_request Service request number for generating protocol interrupts.\n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets the interrupt node for UART channel protocol events.\n\n + * For all the protocol events enlisted in the enumeration XMC_UART_CH_EVENT_t, one common + * interrupt gets generated. The service request connects the interrupt node to the UART + * protocol events. + * Note: NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const uint8_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL, + (uint32_t)service_request); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param interrupt_node Interrupt node pointer to be configured. \n + * \b Range: @ref XMC_UART_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, + * @ref XMC_UART_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER etc. + * @param service_request Service request number.\n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets the interrupt node for USIC channel events. \n\n + * For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so.
+ * Note: NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_SelectInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_UART_CH_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, (XMC_USIC_CH_INTERRUPT_NODE_POINTER_t)interrupt_node, + (uint32_t)service_request); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param service_request_line service request number of the event to be triggered. \n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Trigger a UART interrupt service request.\n\n + * When the UART service request is triggered, the NVIC interrupt associated with it will be + * generated if enabled. + * + * \parRelated APIs:
+ * XMC_UART_CH_SelectInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_TriggerServiceRequest(XMC_USIC_CH_t *const channel, const uint32_t service_request_line) +{ + XMC_USIC_CH_TriggerServiceRequest(channel, (uint32_t)service_request_line); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @return Status of UART channel events. \n + * \b Range: Use @ref XMC_UART_CH_STATUS_FLAG_t enumerations for + * event bitmasks. @ref XMC_UART_CH_STATUS_FLAG_TRANSMISSION_IDLE, @ref XMC_UART_CH_STATUS_FLAG_RECEPTION_IDLE, + * @ref XMC_UART_CH_STATUS_FLAG_SYNCHRONIZATION_BREAK_DETECTED etc. + * + * \parDescription
+ * Provides the status of UART channel events.\n\n + * Status provided by the API represents the status of multiple events at their bit positions. The bitmasks can be + * obtained using the enumeration XMC_UART_CH_STATUS_FLAG_t. Event status is obtained by reading + * the register PSR_ASCMode. + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableEvent(), XMC_UART_CH_ClearStatusFlag()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_UART_CH_GetStatusFlag(XMC_USIC_CH_t *const channel) +{ + return channel->PSR_ASCMode; +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param flag UART events to be cleared. \n + * \b Range: Use @ref XMC_UART_CH_STATUS_FLAG_t enumerations for + * event bitmasks. @ref XMC_UART_CH_STATUS_FLAG_TRANSMISSION_IDLE, @ref XMC_UART_CH_STATUS_FLAG_RECEPTION_IDLE, + * @ref XMC_UART_CH_STATUS_FLAG_SYNCHRONIZATION_BREAK_DETECTED etc. + * @return None + * + * \parDescription
+ * Clears the status of UART channel events.\n\n + * Multiple events can be combined using the bitwise OR operation and configured in one function call. + * XMC_UART_CH_STATUS_FLAG_t enumerates multiple event bitmasks. These enumerations can be used as input to the API. + * Events are cleared by setting the bitmask to the PSCR register. + * + * \parRelated APIs:
+ * XMC_UART_CH_DisableEvent(), XMC_UART_CH_GetStatusFlag()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_ClearStatusFlag(XMC_USIC_CH_t *const channel, const uint32_t flag) +{ + channel->PSCR = flag; +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @param source Input source select for the input stage. The table provided below maps the decimal value with the input source. + * + * + *
0DXnA
1DXnB
2DXnC
3DXnD
4DXnE
5DXnF
6DXnG
7Always 1
+ * @return None + * + * \parDescription
+ * Sets input soource for the UART communication.\n\n + * It is used for configuring the input stage for data reception. + * Selects the input data signal source among DXnA, DXnB.. DXnG for the input stage. + * The API can be used for the input stages DX0, DX3 and DX5. + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableInputInversion() \n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_SetInputSource(XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input, const uint8_t source) +{ + channel->DXCR[input] = (uint32_t)(channel->DXCR[input] & (~(USIC_CH_DX0CR_INSW_Msk|USIC_CH_DX0CR_DSEN_Msk))); + XMC_USIC_CH_SetInputSource(channel, (XMC_USIC_CH_INPUT_t)input, source); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param pulse_length Length of the zero pulse in number of time quanta. \n + * \b Range: 0 to 7. + * @return None + * + * \parDescription
+ * Sets the length of zero pulse in number of time quanta. Value 0 indicates one time quanta.\n\n + * Maximum possible is 8 time quanta with the value configured as 7.\n + * The value is set to PCR_ASCMode register. + * \parRelated APIs:
+ * XMC_UART_CH_EnableInputInversion(), XMC_UART_CH_SetSamplePoint() \n\n\n + * +*/ +__STATIC_INLINE void XMC_UART_CH_SetPulseLength(XMC_USIC_CH_t *const channel, const uint8_t pulse_length) +{ + channel->PCR_ASCMode = (uint32_t)(channel->PCR_ASCMode & (~USIC_CH_PCR_ASCMode_PL_Msk)) | + ((uint32_t)pulse_length << USIC_CH_PCR_ASCMode_PL_Pos); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param sample_point Sample point among the number of samples. \n + * \b Range: minimum= 0, maximum= \a oversampling (DCTQ). + * @return None + * + * \parDescription
+ * Sets the sample point among the multiple samples for each UART symbol.\n\n + * The sample point is the one sample among number of samples set as oversampling. The value should be less than + * the oversampling value. XMC_UART_CH_Init() sets the sample point to the sample at the centre. For + * example if the oversampling is 16, then the sample point is set to 9. + * \parRelated APIs:
+ * XMC_UART_CH_EnableInputInversion(), XMC_UART_CH_SetSamplePoint() \n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_SetSamplePoint(XMC_USIC_CH_t *const channel, const uint32_t sample_point) +{ + channel->PCR_ASCMode = (uint32_t)((channel->PCR_ASCMode & (uint32_t)(~USIC_CH_PCR_ASCMode_SP_Msk)) | + (sample_point << USIC_CH_PCR_ASCMode_SP_Pos)); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @return None + * + * \parDescription
+ * Enables input inversion for UART input data signal.\n\n + * Polarity of the input source can be changed to provide inverted data input. + * \parRelated APIs:
+ * XMC_UART_CH_DisableInputInversion()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_EnableInputInversion(XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input) +{ + XMC_USIC_CH_EnableInputInversion(channel, (XMC_USIC_CH_INPUT_t)input); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @return None + * + * \parDescription
+ * Disables input inversion for UART input data signal.\n\n + * Resets the input data polarity for the UART input data signal. + * \parRelated APIs:
+ * XMC_UART_CH_EnableInputInversion()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_DisableInputInversion(XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input) +{ + XMC_USIC_CH_DisableInputInversion(channel, (XMC_USIC_CH_INPUT_t)input); +} +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @return None + * + * \parDescription
+ * Enables the digital filter for UART input stage.\n\n + * + * \parRelated APIs:
+ * XMC_UART_CH_DisableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_EnableInputDigitalFilter(XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input) +{ + XMC_USIC_CH_EnableInputDigitalFilter(channel, (XMC_USIC_CH_INPUT_t)input); +} +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @return None + * + * \parDescription
+ * Disables the digital filter for UART input stage.\n\n + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_DisableInputDigitalFilter(XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input) +{ + XMC_USIC_CH_DisableInputDigitalFilter(channel, (XMC_USIC_CH_INPUT_t)input); +} +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @return None + * \parDescription
+ * Enables synchronous input for the UART input stage.\n\n + * + * \parRelated APIs:
+ * XMC_UART_CH_DisableInputSync(), XMC_UART_CH_EnableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_EnableInputSync(XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input) +{ + XMC_USIC_CH_EnableInputSync(channel, (XMC_USIC_CH_INPUT_t)input); +} +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @return None + * + * \parDescription
+ * Disables synchronous input for the UART input stage.\n\n + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableInputSync(), XMC_UART_CH_EnableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_DisableInputSync(XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input) +{ + XMC_USIC_CH_DisableInputSync(channel, (XMC_USIC_CH_INPUT_t)input); +} +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @param sampling_freq Input sampling frequency. \n + * \b Range: @ref XMC_UART_CH_INPUT_SAMPLING_FREQ_FPERIPH, @ref XMC_UART_CH_INPUT_SAMPLING_FREQ_FRACTIONAL_DIVIDER. + * @return None + * + * \parDescription
+ * Sets the sampling frequency for the UART input stage.\n\n + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableInputSync(), XMC_UART_CH_EnableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_SetInputSamplingFreq(XMC_USIC_CH_t *const channel, + const XMC_UART_CH_INPUT_t input, + const XMC_UART_CH_INPUT_SAMPLING_FREQ_t sampling_freq) +{ + XMC_USIC_CH_SetInputSamplingFreq(channel, (XMC_USIC_CH_INPUT_t)input, (XMC_USIC_CH_INPUT_SAMPLING_FREQ_t)sampling_freq); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @return None + * + * \parDescription
+ * Enable data transmission.\n\n + * Use this function in combination with XMC_UART_CH_DisableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * @note If you need more control over the start of transmission use XMC_USIC_CH_SetStartTransmisionMode() + * + * \parRelated APIs:
+ * XMC_UART_CH_DisableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_EnableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_ON_TDV); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @return None + * + * \parDescription
+ * Disable data transmission.\n\n + * Use this function in combination with XMC_UART_CH_EnableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_DisableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_DISABLED); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_usic.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_usic.h new file mode 100644 index 00000000..6eeb2daa --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_usic.h @@ -0,0 +1,2089 @@ +/** + * @file xmc_usic.h + * @date 2017-02-10 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * - Documentation improved
+ * + * 2015-05-08: + * - Added XMC_USIC_CH_SetInputTriggerCombinationMode() and XMC_USIC_CH_SetTransmitBufferStatus()
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * 2015-08-17: + * - Bug fixed in XMC_USIC_CH_SetTransmitBufferStatus API. OR operator removed. + * + * 2015-08-24: + * - Added APIs for enabling/disabling delay compensation XMC_USIC_CH_DisableDelayCompensation() and + * XMC_USIC_CH_DisableDelayCompensation() + * + * 2015-08-25: + * - Added APIs for defining if the data shift unit input is derived + * from the input data path DXn or from the selected protocol pre-processors: XMC_USIC_CH_ConnectInputDataShiftToPPP() + * and XMC_USIC_CH_ConnectInputDataShiftToDataInput() + * + * 2015-08-27: + * - Fixed bug in XMC_USIC_CH_BRG_CLOCK_SOURCE_DX1T value. + * - Added APIs for direct TBUF access: XMC_USIC_CH_WriteToTBUF() and XMC_USIC_CH_WriteToTBUFTCI() + * - Added APIs for external input for BRG configuration:XMC_USIC_CH_ConfigExternalInputSignalToBRG() and XMC_USIC_CH_SetBRGInputClockSource() + * + * 2015-08-28: + * - Added API for enabling the transfer trigger unit to set bit TCSR.TE if the trigger signal DX2T becomes active. Feature used for RS-232 + * Clear to Send (CTS) signal: XMC_USIC_CH_EnableTBUFDataValidTrigger() and XMC_USIC_CH_DisableTBUFDataValidTrigger(). + * + * 2016-03-09: + * - Optimization of write only registers + * + * 2016-04-10: + * - Added an API to put the data into FIFO when hardware port control is enabled: XMC_USIC_CH_TXFIFO_PutDataHPCMode()
+ * + * 2017-02-10: + * - Added XMC_USIC_CH_SetShiftDirection() to allow selection of shift direction of the data words for transmision and reception + * - Added XMC_USIC_CH_GetCaptureTimerValue() and XMC_USIC_CH_SetFractionalDivider() + * + * @endcond + * + */ + +#ifndef XMC_USIC_H +#define XMC_USIC_H +/******************************************************************************* + * HEADER FILES + *******************************************************************************/ + +#include "xmc_common.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup USIC + * @brief Universal Serial Interface Channel(USIC) driver for serial communication. + * + * The Universal Serial Interface Channel(USIC) module is a flexible interface module + * covering several serial communication protocols. A USIC module contains two + * independent communication channels named USICx_CH0 and USICx_CH1, with x + * being the number of the USIC module. The user can program, during run-time, which protocol will be handled + * by each communication channel and which pins are used. + * The driver provides APIs, configuration structures and enumerations to configure common features of multiple serial + * communication protocols. + * + * USIC driver features: + * -# Allows configuration of FIFO for transmit and receive functions. + * -# Provides a structure type XMC_USIC_CH_t to represent the USIC channel registers in a programmer + friendly format. + * -# Allows configuration of automatic update for frame length, word length, slave select or slave address. + * -# Allows transmission of data to FIFO using XMC_USIC_CH_TXFIFO_PutData() and XMC_USIC_CH_TXFIFO_PutDataFLEMode() + * -# Allows reading of received data in FIFO using XMC_USIC_CH_RXFIFO_GetData() + * -# Allows configuration of baudrate using XMC_USIC_CH_SetBaudrate() + * -# Provides API to trigger interrupts using XMC_USIC_CH_TriggerServiceRequest() + * @{ + */ + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +#define XMC_USIC0 ((XMC_USIC_t *)USIC0_BASE) /**< USIC0 module base address */ +#define XMC_USIC0_CH0 ((XMC_USIC_CH_t *)USIC0_CH0_BASE) /**< USIC0 channel 0 base address */ +#define XMC_USIC0_CH1 ((XMC_USIC_CH_t *)USIC0_CH1_BASE) /**< USIC0 channel 1 base address */ + +#if defined(USIC1) +#define XMC_USIC1 ((XMC_USIC_t *)USIC1_BASE) /**< USIC1 module base address */ +#define XMC_USIC1_CH0 ((XMC_USIC_CH_t *)USIC1_CH0_BASE) /**< USIC1 channel 0 base address */ +#define XMC_USIC1_CH1 ((XMC_USIC_CH_t *)USIC1_CH1_BASE) /**< USIC1 channel 1 base address */ +#endif + +#if defined(USIC2) +#define XMC_USIC2 ((XMC_USIC_t *)USIC2_BASE) /**< USIC2 module base address */ +#define XMC_USIC2_CH0 ((XMC_USIC_CH_t *)USIC2_CH0_BASE) /**< USIC2 channel 0 base address */ +#define XMC_USIC2_CH1 ((XMC_USIC_CH_t *)USIC2_CH1_BASE) /**< USIC2 channel 1 base address */ +#endif + +#define USIC_CH_DXCR_DSEL_Msk USIC_CH_DX0CR_DSEL_Msk /**< Common mask for DSEL bitfield mask in DXnCR register */ +#define USIC_CH_DXCR_DSEL_Pos USIC_CH_DX0CR_DSEL_Pos /**< Common mask for DSEL bitfield position in DXnCR register */ +#define USIC_CH_DXCR_SFSEL_Pos USIC_CH_DX0CR_SFSEL_Pos /**< Common mask for SFSEL bitfield position in DXnCR register */ +#define USIC_CH_DXCR_SFSEL_Msk USIC_CH_DX0CR_SFSEL_Msk /**< Common mask for SFSEL bitfield mask in DXnCR register */ +#define USIC_CH_DXCR_DPOL_Msk USIC_CH_DX0CR_DPOL_Msk /**< Common mask for DPOL bitfield mask in DXnCR register */ +#define USIC_CH_DXCR_DFEN_Msk USIC_CH_DX0CR_DFEN_Msk /**< Common mask for DFEN bitfield mask in DXnCR register */ +#define USIC_CH_DXCR_DSEN_Msk USIC_CH_DX0CR_DSEN_Msk /**< Common mask for DSEN bitfield mask in DXnCR register */ +#define USIC_CH_DXCR_CM_Pos USIC_CH_DX0CR_CM_Pos /**< Common mask for CM bitfield position in DXnCR register */ +#define USIC_CH_DXCR_CM_Msk USIC_CH_DX0CR_CM_Msk /**< Common mask for CM bitfield mask in DXnCR register */ +#define USIC_CH_DXCR_INSW_Msk USIC_CH_DX0CR_INSW_Msk /**< Common mask for INSW bitfield mask in DXnCR register */ +#define USIC_CH_DXCR_INSW_pos USIC_CH_DX0CR_INSW_Pos /**< Common mask for INSW bitfield position in DXnCR register */ + +#if UC_FAMILY == XMC1 + #include "xmc1_usic_map.h" +#endif + +#if UC_FAMILY == XMC4 + #include "xmc4_usic_map.h" +#endif + +/******************************************************************************* + * ENUMS + *******************************************************************************/ + +/** + * USIC channel driver status + */ +typedef enum XMC_USIC_CH_STATUS +{ + XMC_USIC_CH_STATUS_OK, /**< USIC driver status : OK */ + XMC_USIC_CH_STATUS_ERROR, /**< USIC driver status : ERROR */ + XMC_USIC_CH_STATUS_BUSY /**< USIC driver status : BUSY */ +} XMC_USIC_CH_STATUS_t; + +/** +* USIC channel kernel mode +*/ +typedef enum XMC_USIC_CH_KERNEL_MODE +{ + XMC_USIC_CH_KERNEL_MODE_RUN_0 = 0x0UL, /**< Run mode 0 (transmission and reception possible)*/ + XMC_USIC_CH_KERNEL_MODE_RUN_1 = 0x1UL << USIC_CH_KSCFG_NOMCFG_Pos, /**< Run mode 1 (transmission and reception possible)*/ + XMC_USIC_CH_KERNEL_MODE_STOP_0 = 0x2UL << USIC_CH_KSCFG_NOMCFG_Pos, /**< Stop mode 0 (no transmission, but reception possible)*/ + XMC_USIC_CH_KERNEL_MODE_STOP_1 = 0x3UL << USIC_CH_KSCFG_NOMCFG_Pos /**< Stop mode 1 (both transmission and reception not possible)*/ +} XMC_USIC_CH_KERNEL_MODE_t; + +/** + * USIC channel operating mode + */ +typedef enum XMC_USIC_CH_OPERATING_MODE +{ + XMC_USIC_CH_OPERATING_MODE_IDLE = 0x0UL, /**< USIC channel idle */ + XMC_USIC_CH_OPERATING_MODE_SPI = 0x1UL << USIC_CH_CCR_MODE_Pos, /**< SPI mode */ + XMC_USIC_CH_OPERATING_MODE_UART = 0x2UL << USIC_CH_CCR_MODE_Pos, /**< UART mode */ + XMC_USIC_CH_OPERATING_MODE_I2S = 0x3UL << USIC_CH_CCR_MODE_Pos, /**< I2S mode */ + XMC_USIC_CH_OPERATING_MODE_I2C = 0x4UL << USIC_CH_CCR_MODE_Pos /**< I2C mode */ +} XMC_USIC_CH_OPERATING_MODE_t; + +/** + * USIC channel inputs + */ +typedef enum XMC_USIC_CH_INPUT +{ + XMC_USIC_CH_INPUT_DX0, /**< DX0 input */ + XMC_USIC_CH_INPUT_DX1, /**< DX1 input */ + XMC_USIC_CH_INPUT_DX2, /**< DX2 input */ + XMC_USIC_CH_INPUT_DX3, /**< DX3 input */ + XMC_USIC_CH_INPUT_DX4, /**< DX4 input */ + XMC_USIC_CH_INPUT_DX5 /**< DX5 input */ +} XMC_USIC_CH_INPUT_t; + +/** + * USIC channel input source sampling frequency + */ +typedef enum XMC_USIC_CH_INPUT_SAMPLING_FREQ +{ + XMC_USIC_CH_INPUT_SAMPLING_FREQ_FPERIPH = 0x0UL, /**< Use fperiph frequency for input source sampling*/ + XMC_USIC_CH_INPUT_SAMPLING_FREQ_FRACTIONAL_DIVIDER = 0x1UL << USIC_CH_DXCR_SFSEL_Pos /**< Use fFD(fractional divider) frequency for input source sampling*/ +} XMC_USIC_CH_INPUT_SAMPLING_FREQ_t; + +/** + * USIC channel input combination mode + */ +typedef enum XMC_USIC_CH_INPUT_COMBINATION_MODE +{ + XMC_USIC_CH_INPUT_COMBINATION_MODE_TRIGGER_DISABLED = 0x0UL, /**< The trigger activation is disabled.*/ + XMC_USIC_CH_INPUT_COMBINATION_MODE_RISING_EDGE = 0x1UL, /**< A rising edge activates DXnT*/ + XMC_USIC_CH_INPUT_COMBINATION_MODE_FALLING_EDGE = 0x2UL, /**< A falling edge activates DXnT*/ + XMC_USIC_CH_INPUT_COMBINATION_MODE_BOTH_EDGES = 0x3UL, /**< Both edges activate DXnT*/ +} XMC_USIC_CH_INPUT_COMBINATION_MODE_t; + +/** + * USIC channel data transmission start modes. + * Data shifted out of the transmit pin depends on the value configured for the + * TDEN bitfield of the TCSR register. Following enum values are used for configuring + * the TCSR->TDEN bitfield. + */ +typedef enum XMC_USIC_CH_START_TRANSMISION_MODE +{ + XMC_USIC_CH_START_TRANSMISION_DISABLED = 0x0U, /**< Passive data level is sent out on transmission. */ + XMC_USIC_CH_START_TRANSMISION_ON_TDV = 0x1UL << USIC_CH_TCSR_TDEN_Pos, /**< Transmission of the data word in TBUF can be started if TDV = 1 */ + XMC_USIC_CH_START_TRANSMISION_ON_TDV_DX2S_0 = 0x2UL << USIC_CH_TCSR_TDEN_Pos, /**< Transmission of the data word in TBUF can be started if TDV = 1 while DX2S_0 */ + XMC_USIC_CH_START_TRANSMISION_ON_TDV_DX2S_1 = 0x3UL << USIC_CH_TCSR_TDEN_Pos /**< Transmission of the data word in TBUF can be started if TDV = 1 while DX2S_1 */ +} XMC_USIC_CH_START_TRANSMISION_MODE_t; + +/** + * USIC channel interrupt node pointers + */ +typedef enum XMC_USIC_CH_INTERRUPT_NODE_POINTER +{ + XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT = USIC_CH_INPR_TSINP_Pos, /**< Node pointer for transmit shift interrupt */ + XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER = USIC_CH_INPR_TBINP_Pos, /**< Node pointer for transmit buffer interrupt */ + XMC_USIC_CH_INTERRUPT_NODE_POINTER_RECEIVE = USIC_CH_INPR_RINP_Pos, /**< Node pointer for receive interrupt */ + XMC_USIC_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE = USIC_CH_INPR_AINP_Pos, /**< Node pointer for alternate receive interrupt */ + XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL = USIC_CH_INPR_PINP_Pos /**< Node pointer for protocol related interrupts */ +} XMC_USIC_CH_INTERRUPT_NODE_POINTER_t; + +/** + * USIC channel events + */ +typedef enum XMC_USIC_CH_EVENT +{ + XMC_USIC_CH_EVENT_RECEIVE_START = USIC_CH_CCR_RSIEN_Msk, /**< Receive start event */ + XMC_USIC_CH_EVENT_DATA_LOST = USIC_CH_CCR_DLIEN_Msk, /**< Data lost event */ + XMC_USIC_CH_EVENT_TRANSMIT_SHIFT = USIC_CH_CCR_TSIEN_Msk, /**< Transmit shift event */ + XMC_USIC_CH_EVENT_TRANSMIT_BUFFER = USIC_CH_CCR_TBIEN_Msk, /**< Transmit buffer event */ + XMC_USIC_CH_EVENT_STANDARD_RECEIVE = USIC_CH_CCR_RIEN_Msk, /**< Receive event */ + XMC_USIC_CH_EVENT_ALTERNATIVE_RECEIVE = USIC_CH_CCR_AIEN_Msk, /**< Alternate receive event */ + XMC_USIC_CH_EVENT_BAUD_RATE_GENERATOR = USIC_CH_CCR_BRGIEN_Msk /**< Baudrate generator event */ +} XMC_USIC_CH_EVENT_t; + +/** +* USIC channel parity mode +*/ +typedef enum XMC_USIC_CH_PARITY_MODE +{ + XMC_USIC_CH_PARITY_MODE_NONE = 0x0UL, /**< Disable parity mode */ + XMC_USIC_CH_PARITY_MODE_EVEN = 0x2UL << USIC_CH_CCR_PM_Pos, /**< Enable even parity mode */ + XMC_USIC_CH_PARITY_MODE_ODD = 0x3UL << USIC_CH_CCR_PM_Pos /**< Enable odd parity mode */ +} XMC_USIC_CH_PARITY_MODE_t; + +/** +* USIC channel data output mode +*/ +typedef enum XMC_USIC_CH_DATA_OUTPUT_MODE +{ + XMC_USIC_CH_DATA_OUTPUT_MODE_NORMAL = 0x0UL, /**< Data output normal mode */ + XMC_USIC_CH_DATA_OUTPUT_MODE_INVERTED = 0x1UL << USIC_CH_SCTR_DOCFG_Pos /**< Data output inverted mode */ +} XMC_USIC_CH_DATA_OUTPUT_MODE_t; + +/** +* USIC channel data transmit buffer status +*/ +typedef enum XMC_USIC_CH_TBUF_STATUS +{ + XMC_USIC_CH_TBUF_STATUS_IDLE = 0x0UL, /**< Transfer buffer is currently idle*/ + XMC_USIC_CH_TBUF_STATUS_BUSY = USIC_CH_TCSR_TDV_Msk /**< Transfer buffer is currently busy*/ +} XMC_USIC_CH_TBUF_STATUS_t; + + + +/** +* USIC channel data transmit buffer status modification +*/ +typedef enum XMC_USIC_CH_TBUF_STATUS_SET +{ + XMC_USIC_CH_TBUF_STATUS_SET_BUSY = 0x1UL, /**< Set Transfer buffer status to busy*/ + XMC_USIC_CH_TBUF_STATUS_SET_IDLE = 0x2UL /**< Set Transfer buffer status to idle*/ +} XMC_USIC_CH_TBUF_STATUS_SET_t; + +/** +* USIC channel receive buffer status +*/ +typedef enum XMC_USIC_CH_RBUF_STATUS +{ + XMC_USIC_CH_RBUF_STATUS_DATA_VALID0 = USIC_CH_RBUFSR_RDV0_Msk, /**< RBUF0 data has not yet been read out*/ + XMC_USIC_CH_RBUF_STATUS_DATA_VALID1 = USIC_CH_RBUFSR_RDV1_Msk /**< RBUF1 data has not yet been read out*/ +} XMC_USIC_CH_RBUF_STATUS_t; + +/** + * USIC channel output signal passive data level +*/ +typedef enum XMC_USCI_CH_PASSIVE_DATA_LEVEL +{ + XMC_USIC_CH_PASSIVE_DATA_LEVEL0 = 0x0UL, /**< Passive level(idle mode signal level) 0 */ + XMC_USIC_CH_PASSIVE_DATA_LEVEL1 = 0x1UL << USIC_CH_SCTR_PDL_Pos /**< Passive level(idle mode signal level) 1 */ +} XMC_USIC_CH_PASSIVE_DATA_LEVEL_t; + +/** +* USIC channel receive FIFO size +*/ +typedef enum XMC_USIC_CH_FIFO_SIZE +{ + XMC_USIC_CH_FIFO_DISABLED = 0x0U, /**< FIFO Disabled */ + XMC_USIC_CH_FIFO_SIZE_2WORDS = 0x1U, /**< FIFO size: 2 words */ + XMC_USIC_CH_FIFO_SIZE_4WORDS = 0x2U, /**< FIFO size: 4 words */ + XMC_USIC_CH_FIFO_SIZE_8WORDS = 0x3U, /**< FIFO size: 8 words */ + XMC_USIC_CH_FIFO_SIZE_16WORDS = 0x4U, /**< FIFO size: 16 words */ + XMC_USIC_CH_FIFO_SIZE_32WORDS = 0x5U, /**< FIFO size: 32 words */ + XMC_USIC_CH_FIFO_SIZE_64WORDS = 0x6U /**< FIFO size: 64 words */ +} XMC_USIC_CH_FIFO_SIZE_t; + +/** +* USIC channel transmit FIFO interrupt node pointers +*/ +typedef enum XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER +{ + XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER_STANDARD = USIC_CH_TBCTR_STBINP_Pos, /**< Node pointer for FIFO standard transmit interrupt */ + XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER_ALTERNATE = USIC_CH_TBCTR_ATBINP_Pos /**< Node pointer for transmit FIFO error interrupt */ +} XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER_t; + +/** +* USIC channel transmit FIFO event configuration +*/ +typedef enum XMC_USIC_CH_TXFIFO_EVENT_CONF +{ + XMC_USIC_CH_TXFIFO_EVENT_CONF_STANDARD = USIC_CH_TBCTR_STBIEN_Msk, /**< Enable FIFO standard transmit interrupt */ + XMC_USIC_CH_TXFIFO_EVENT_CONF_ERROR = (int32_t)USIC_CH_TBCTR_TBERIEN_Msk /**< Enable transmit FIFO error interrupt */ +} XMC_USIC_CH_TXFIFO_EVENT_CONF_t; + +/** +* USIC channel transmit FIFO status +*/ +typedef enum XMC_USIC_CH_TXFIFO_EVENT +{ + XMC_USIC_CH_TXFIFO_EVENT_STANDARD = USIC_CH_TRBSR_STBI_Msk, /**< Transmit FIFO status: Standard event */ + XMC_USIC_CH_TXFIFO_EVENT_ERROR = USIC_CH_TRBSR_TBERI_Msk /**< Transmit FIFO status: Error event */ +} XMC_USIC_CH_TXFIFO_EVENT_t; + +/** +* USIC channel receive FIFO interrupt node pointers +*/ +typedef enum XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER +{ + XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_STANDARD = USIC_CH_RBCTR_SRBINP_Pos, /**< Node pointer for FIFO standard receive interrupt */ + XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_ALTERNATE = USIC_CH_RBCTR_ARBINP_Pos /**< Node pointer for FIFO alternative receive interrupt */ +} XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_t; + +/** +* USIC channel receive FIFO event configuration +*/ +typedef enum XMC_USIC_CH_RXFIFO_EVENT_CONF +{ + XMC_USIC_CH_RXFIFO_EVENT_CONF_STANDARD = USIC_CH_RBCTR_SRBIEN_Msk, /**< Enable FIFO standard receive interrupt */ + XMC_USIC_CH_RXFIFO_EVENT_CONF_ERROR = (int32_t)USIC_CH_RBCTR_RBERIEN_Msk, /**< Enable receive FIFO error interrupt */ + XMC_USIC_CH_RXFIFO_EVENT_CONF_ALTERNATE = USIC_CH_RBCTR_ARBIEN_Msk /**< Enable FIFO alternative receive interrupt */ +} XMC_USIC_CH_RXFIFO_EVENT_CONF_t; + +/** +* USIC channel receive FIFO status +*/ +typedef enum XMC_USIC_CH_RXFIFO_EVENT +{ + XMC_USIC_CH_RXFIFO_EVENT_STANDARD = USIC_CH_TRBSR_SRBI_Msk, /**< Receive FIFO status: Standard event */ + XMC_USIC_CH_RXFIFO_EVENT_ERROR = USIC_CH_TRBSR_RBERI_Msk, /**< Receive FIFO status: Error event */ + XMC_USIC_CH_RXFIFO_EVENT_ALTERNATE = USIC_CH_TRBSR_ARBI_Msk /**< Receive FIFO status: Alternative event */ +} XMC_USIC_CH_RXFIFO_EVENT_t; + +/** +* USIC channel baudrate generator clock source +*/ +typedef enum XMC_USIC_CH_BRG_CLOCK_SOURCE +{ + XMC_USIC_CH_BRG_CLOCK_SOURCE_DIVIDER = 0x0UL, /**< Baudrate generator clock source : Source divider. (Internal clock source)*/ + XMC_USIC_CH_BRG_CLOCK_SOURCE_DX1T = 0x2UL << USIC_CH_BRG_CLKSEL_Pos /**< Baudrate generator clock source : DX1T. (External clock source) */ +} XMC_USIC_CH_BRG_CLOCK_SOURCE_t; + +/** +* USIC channel baudrate generator divider mode +*/ +typedef enum XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE +{ + XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_DISABLED = 0x0UL, /**< Baudrate generator clock divider: Disabled */ + XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_NORMAL = 0x1UL << USIC_CH_FDR_DM_Pos, /**< Baudrate generator clock divider: Normal mode */ + XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_FRACTIONAL = 0x2UL << USIC_CH_FDR_DM_Pos /**< Baudrate generator clock divider: Fractional mode */ +} XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_t; + +/** +* USIC channel baudrate generator master clock passive level +*/ +typedef enum XMC_USIC_CH_BRG_MASTER_CLOCK_PASSIVE_LEVEL +{ + XMC_USIC_CH_BRG_MASTER_CLOCK_PASSIVE_LEVEL_0 = 0x0UL, /**< Baudrate generator master clock passive level(idle mode signal level) 0*/ + XMC_USIC_CH_BRG_MASTER_CLOCK_PASSIVE_LEVEL_1 = 0x1UL << USIC_CH_BRG_MCLKCFG_Pos /**< Baudrate generator master clock passive level((idle mode signal level)) 1*/ +} XMC_USIC_CH_BRG_MASTER_CLOCK_PASSIVE_LEVEL_t; + +/** +* USIC channel baudrate generator shift clock passive level +*/ +typedef enum XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL +{ + XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_DISABLED = 0x0UL, /**< Shift clock passive level 0, delay disabled */ + XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_DISABLED = 0x1UL << USIC_CH_BRG_SCLKCFG_Pos, /**< Shift clock passive level 1, delay disabled */ + XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_ENABLED = (int32_t)(0x2UL << USIC_CH_BRG_SCLKCFG_Pos), /**< Shift clock passive level 0, delay enabled */ + XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_ENABLED = (int32_t)(0x3UL << USIC_CH_BRG_SCLKCFG_Pos) /**< Shift clock passive level 1, delay enabled */ +} XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t; + +/** +* USIC channel baudrate generator shift clock output +*/ +typedef enum XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT +{ + XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK = 0x0UL, /**< Baudrate generator shift clock output: SCL.(Internally generated shift clock)*/ + XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_DX1 = 0x1UL << USIC_CH_BRG_SCLKOSEL_Pos /**< Baudrate generator shift clock output: DX1. (External input shift clock)*/ +} XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_t; + +/** +* USIC channel shift direction. +* Defines the shift direction of the data words for transmission and reception +*/ +typedef enum XMC_USIC_CH_SHIFT_DIRECTION +{ + XMC_USIC_CH_SHIFT_DIRECTION_LSB_FIRST = 0x0UL, /**< Shift LSB first. The first data bit of a data word is located at bit position 0. */ + XMC_USIC_CH_SHIFT_DIRECTION_MSB_FIRST = 0x1UL << USIC_CH_SCTR_SDIR_Msk /**< Shift MSB first. The first data bit of a data word is located at the bit position given by the configured word length. */ +} XMC_USIC_CH_SHIFT_DIRECTION_t; + + +/******************************************************************************* + * DATA STRUCTURES + *******************************************************************************/ + +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * USIC module structure + */ +typedef USIC_GLOBAL_TypeDef XMC_USIC_t; + +/** + * USIC channel structure.
The members of the structure are same as in the device header file, + * except for some registers. + * DX0CR, DX1CR, DX2CR, DX3CR, DX4CR and DX5CR are replaced with the array DXCR[6]. + * TBUF0 to TBUF31 are replaced with TBUF[32]. + * IN0 to IN31 are replaced with IN[32]. + */ +typedef struct XMC_USIC_CH +{ + __I uint32_t RESERVED0; + __I uint32_t CCFG; /**< Channel configuration register*/ + __I uint32_t RESERVED1; + __IO uint32_t KSCFG; /**< Kernel state configuration register*/ + __IO uint32_t FDR; /**< Fractional divider configuration register*/ + __IO uint32_t BRG; /**< Baud rate generator register*/ + __IO uint32_t INPR; /**< Interrupt node pointer register*/ + __IO uint32_t DXCR[6]; /**< Input control registers DX0 to DX5.*/ + __IO uint32_t SCTR; /**< Shift control register*/ + __IO uint32_t TCSR; + + union { + __IO uint32_t PCR_IICMode; /**< I2C protocol configuration register*/ + __IO uint32_t PCR_IISMode; /**< I2S protocol configuration register*/ + __IO uint32_t PCR_SSCMode; /**< SPI protocol configuration register*/ + __IO uint32_t PCR; /**< Protocol configuration register*/ + __IO uint32_t PCR_ASCMode; /**< UART protocol configuration register*/ + }; + __IO uint32_t CCR; /**< Channel control register*/ + __IO uint32_t CMTR; /**< Capture mode timer register*/ + + union { + __IO uint32_t PSR_IICMode; /**< I2C protocol status register*/ + __IO uint32_t PSR_IISMode; /**< I2S protocol status register*/ + __IO uint32_t PSR_SSCMode; /**< SPI protocol status register*/ + __IO uint32_t PSR; /**< Protocol status register*/ + __IO uint32_t PSR_ASCMode; /**< UART protocol status register*/ + }; + __O uint32_t PSCR; /**< Protocol status clear register*/ + __I uint32_t RBUFSR; /**< Receive buffer status register*/ + __I uint32_t RBUF; /**< Receive buffer register*/ + __I uint32_t RBUFD; /**< Debug mode receive buffer register*/ + __I uint32_t RBUF0; /**< Receive buffer 0*/ + __I uint32_t RBUF1; /**< Receive buffer 1*/ + __I uint32_t RBUF01SR; /**< Receive buffer status register*/ + __O uint32_t FMR; /**< Flag modification register*/ + __I uint32_t RESERVED2[5]; + __IO uint32_t TBUF[32]; /**< Tranmsit buffer registers*/ + __IO uint32_t BYP; /**< FIFO bypass register*/ + __IO uint32_t BYPCR; /**< FIFO bypass control register*/ + __IO uint32_t TBCTR; /**< Transmit FIFO control register*/ + __IO uint32_t RBCTR; /**< Receive FIFO control register*/ + __I uint32_t TRBPTR; /**< Transmit/recive buffer pointer register*/ + __IO uint32_t TRBSR; /**< Transmit/receive buffer status register*/ + __O uint32_t TRBSCR; /**< Transmit/receive buffer status clear register*/ + __I uint32_t OUTR; /**< Receive FIFO output register*/ + __I uint32_t OUTDR; /**< Receive FIFO debug output register*/ + __I uint32_t RESERVED3[23]; + __O uint32_t IN[32]; /**< Transmit FIFO input register*/ +} XMC_USIC_CH_t; + + +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif + +/******************************************************************************* + * API PROTOTYPES + ******************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +__STATIC_INLINE bool XMC_USIC_IsModuleValid(const XMC_USIC_t *const module) +{ + bool tmp; + + tmp = (module == XMC_USIC0); +#if defined(XMC_USIC1) + tmp = tmp || (module == XMC_USIC1); +#endif +#if defined(XMC_USIC2) + tmp = tmp || (module == XMC_USIC2); +#endif + + return tmp; +} + +__STATIC_INLINE bool XMC_USIC_IsChannelValid(const XMC_USIC_CH_t *const channel) +{ + bool tmp; + + tmp = ((channel == XMC_USIC0_CH0) || (channel == XMC_USIC0_CH1)); +#if defined(XMC_USIC1) + tmp = tmp || ((channel == XMC_USIC1_CH0) || (channel == XMC_USIC1_CH1)); +#endif +#if defined(XMC_USIC2) + tmp = tmp || ((channel == XMC_USIC2_CH0) || (channel == XMC_USIC2_CH1)); +#endif + + return tmp; +} + +/* Common APIs */ + +/** + * @param usic Pointer to USIC module handler of type @ref XMC_USIC_t.\n + * \b Range: @ref XMC_USIC0 to @ref XMC_USIC2 based on device support. + * @return None + * + * \parDescription
+ * Enables the USIC module.\n\n + * Enables the clock for the USIC module by following the + * clock enabling sequence for the selected device. + * + * \parRelated APIs:
+ * XMC_USIC_CH_Enable(), XMC_USIC_Disable() \n\n\n + */ +void XMC_USIC_Enable(XMC_USIC_t *const usic); +/** + * @param usic Pointer to USIC module handler of type @ref XMC_USIC_t.\n + * \b Range: @ref XMC_USIC0 to @ref XMC_USIC2 based on device support. + * @return None + * + * \parDescription
+ * Disables the USIC module.\n\n + * Disables the clock for the USIC module by following the clock + * disabling sequence for the selected device. + * + * \parRelated APIs:
+ * XMC_USIC_CH_Disable(), XMC_USIC_Enable() \n\n\n + */ +void XMC_USIC_Disable(XMC_USIC_t *const usic); +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Enables the USIC channel. \n\n + * USIC channel is enabled by setting the module enable bit in KSCFG register bitfield MODEN. + * On enabling, the channel is set to idle mode. + * + * \parRelated APIs:
+ * XMC_USIC_CH_Disable(), XMC_USIC_Enable() \n\n\n + */ +void XMC_USIC_CH_Enable(XMC_USIC_CH_t *const channel); +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Disables the USIC channel.\n\n + * USIC channel is disabled by setting the module enable bit(MDEN) to 0 in the register KSCFG. + * + * \parRelated APIs:
+ * XMC_USIC_CH_Enable(), XMC_USIC_Disable() \n\n\n + */ +void XMC_USIC_CH_Disable(XMC_USIC_CH_t *const channel); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param rate Desired baudrate. \b Range: minimum value = 100, maximum value depends on the peripheral clock frequency \n + * and \a oversampling. Maximum baudrate can be derived using the formula: (fperiph * 1023)/(1024 * oversampling) + * @param oversampling Required oversampling. The value indicates the number of time quanta for one symbol of data. \n + * This can be related to the number of samples for each logic state of the data signal. \n + * \b Range: 1 to 32. Value should be chosen based on the protocol used. + * @return Status indicating the baudrate configuration.\n + * \b Range: @ref XMC_USIC_CH_STATUS_OK if baudrate is successfully configured, + * @ref XMC_USIC_CH_STATUS_ERROR if desired baudrate or oversampling is invalid. + * + * \parDescription
+ * Configures the baudrate of the USIC channel. \n\n + * Baudrate is configured by considering the peripheral frequency and the desired baudrate. + * Optimum values of FDR->STEP and BRG->PDIV are calulated and used for generating the desired + * baudrate. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetStartTransmisionMode(), XMC_USIC_CH_SetInputSource() \n\n\n + */ +XMC_USIC_CH_STATUS_t XMC_USIC_CH_SetBaudrate(XMC_USIC_CH_t *const channel, uint32_t rate, uint32_t oversampling); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param pdiv Desired divider for the external frequency input. \b Range: minimum value = 1, maximum value = 1024 \n + * @param oversampling Required oversampling. The value indicates the number of time quanta for one symbol of data. \n + * This can be related to the number of samples for each logic state of the data signal. \n + * \b Range: 1 to 32. Value should be chosen based on the protocol used. + * @param combination_mode Selects which edge of the synchronized(and optionally filtered) signal DXnS actives the trigger + * output DXnT of the input stage. + * + * @return None + * + * \parDescription
+ * Enables the external frequency input for the Baudrate Generator and configures the divider, oversampling and + * the combination mode of the USIC channel. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetBRGInputClockSource(), XMC_USIC_CH_SetInputTriggerCombinationMode() \n\n\n + */ +void XMC_USIC_CH_ConfigExternalInputSignalToBRG(XMC_USIC_CH_t *const channel, + const uint16_t pdiv, + const uint32_t oversampling, + const XMC_USIC_CH_INPUT_COMBINATION_MODE_t combination_mode); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @param source Input source select for the input stage. The table below maps the enum value with the input channel. + * + * + *
0DXnA
1DXnB
2DXnC
3DXnD
4DXnE
5DXnF
6DXnG
7Always 1
+ * @return None + * + * \parDescription
+ * Selects the data source for USIC input stage.\n\n + * Selects the input data signal source among DXnA, DXnB.. DXnG for the input stage. The API can be used for all the input stages + * like DX0CR, DX1CR etc. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableInputInversion(), XMC_USIC_CH_EnableInputDigitalFilter(), XMC_USIC_CH_EnableInputSync(), + * XMC_USIC_CH_SetInputSamplingFreq()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetInputSource(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input, const uint8_t source) +{ + channel->DXCR[input] = (uint32_t)((channel->DXCR[input] & (uint32_t)(~USIC_CH_DXCR_DSEL_Msk)) | + ((uint32_t)source << USIC_CH_DXCR_DSEL_Pos)); +} +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * The input of the data shift unit is controlled by the + * protocol pre-processor. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_ConnectInputDataShiftToDataInput()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_ConnectInputDataShiftToPPP(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] &=(uint32_t)~USIC_CH_DXCR_INSW_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * The input of the data shift unit is connected to + * the selected data input line. \n\n + * + * This setting is used + * if the signals are directly derived from an input + * pin without treatment by the protocol preprocessor. + * \parRelated APIs:
+ * XMC_USIC_CH_ConnectInputDataShiftToPPP()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_ConnectInputDataShiftToDataInput(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] |= USIC_CH_DXCR_INSW_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * Enables input inversion for USIC channel input data signal. \n\n + * + * Polarity of the input source can be changed to provide inverted data input. + * \parRelated APIs:
+ * XMC_USIC_CH_DisableInputInversion()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableInputInversion(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] |= USIC_CH_DXCR_DPOL_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * Disables input inversion for USIC channel. \n\n + * + * Resets the input data polarity for the USIC channel input data signal. + * \parRelated APIs:
+ * XMC_USIC_CH_EnableInputInversion()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_DisableInputInversion(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] &=(uint32_t)~USIC_CH_DXCR_DPOL_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Enables delay compensation. \n\n + * + * Delay compensation can be applied to the receive path. + * \parRelated APIs:
+ * XMC_USIC_CH_DisableDelayCompensation()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableDelayCompensation(XMC_USIC_CH_t *const channel) +{ + channel->DXCR[1U] |= USIC_CH_DX1CR_DCEN_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Disables delay compensation.. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableDelayCompensation()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_DisableDelayCompensation(XMC_USIC_CH_t *const channel) +{ + channel->DXCR[1U] &=(uint32_t)~USIC_CH_DX1CR_DCEN_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * Enables the input digital filter for USIC channel input data signal. \n\n + * Input data signal from the selected multiplexer will be digitally filtered. + * + * \parRelated APIs:
+ * XMC_USIC_CH_DisableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableInputDigitalFilter(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] |= (uint32_t)USIC_CH_DXCR_DFEN_Msk; +} +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * Disables the input digital filter for USIC channel input data signal. \n\n + * Input data signal from the selected multiplexer will not be digitally filtered. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_DisableInputDigitalFilter(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] &=(uint32_t)~USIC_CH_DXCR_DFEN_Msk; +} +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * Enables input synchronization for the USIC channel input data signal. \n\n + * Input data signal from the selected multiplexer will be synchronized with fPERIPH. + * A noisy signal can be synchronized and filtered by enabling the digital filter. + * + * \parRelated APIs:
+ * XMC_USIC_CH_DisableInputSync(), XMC_USIC_CH_EnableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableInputSync(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] |=(uint32_t)USIC_CH_DXCR_DSEN_Msk; +} +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * Disables input synchronization for the USIC channel input data signal. \n\n + * Input data signal from the selected multiplexer will not be synchronized. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableInputSync(), XMC_USIC_CH_DisableInputDigitalFilter() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_DisableInputSync(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] &=(uint32_t)~USIC_CH_DXCR_DSEN_Msk; +} +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support.. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @param sampling_freq Sampling frequency value of type \a XMC_USIC_CH_INPUT_SAMPLING_FREQ_t. + * @return None + * + * \parDescription
+ * Sets sampling frequency for USIC channel input data signal. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetInputSource(), XMC_USIC_CH_EnableInputSync(), XMC_USIC_CH_EnableInputDigitalFilter() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetInputSamplingFreq(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_INPUT_t input, + const XMC_USIC_CH_INPUT_SAMPLING_FREQ_t sampling_freq) +{ + channel->DXCR[input] = (uint32_t)(channel->DXCR[input] & (~USIC_CH_DXCR_SFSEL_Msk)) | + ((uint32_t)sampling_freq); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support.. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @param combination_mode Combination mode value of type \a XMC_USIC_CH_INPUT_COMBINATION_MODE_t. + * @return None + * + * \parDescription
+ * Selects which edge of the synchronized signal DXnS activates the trigger output DXnT of the input stage. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetInputSource(), XMC_USIC_CH_EnableInputSync(), XMC_USIC_CH_EnableInputDigitalFilter() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetInputTriggerCombinationMode(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_INPUT_t input, + const XMC_USIC_CH_INPUT_COMBINATION_MODE_t combination_mode) +{ + channel->DXCR[input] = (uint32_t)(channel->DXCR[input] & (~USIC_CH_DXCR_CM_Msk)) | + ((uint32_t)combination_mode << USIC_CH_DXCR_CM_Pos); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param clock_source clock source for the BRG. + * @return None + * + * \parDescription
+ * Sets the clock source for the BRG. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetInputTriggerCombinationMode(), XMC_USIC_CH_SetExternalClockBRGDivider()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetBRGInputClockSource(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_BRG_CLOCK_SOURCE_t clock_source) +{ + channel->BRG = (uint32_t)(channel->BRG & (~USIC_CH_BRG_CLKSEL_Msk)) | (uint32_t)(clock_source); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data Data to be transmitted. \n + * \b Range: 16bit unsigned data. minimum= 0, maximum= 65535 + * @return None + * + * \parDescription
+ * Writes data into the transmit buffer. \n\n + * The data provided is placed in TBUF[0U]. + * + * + * \parRelated APIs:
+ * XMC_USIC_CH_WriteToTBUFTCI() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_WriteToTBUF(XMC_USIC_CH_t *const channel, const uint16_t data) +{ + channel->TBUF[0U] = data; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data Data to be transmitted. + * @param transmit_control_information transmit control information to be configured while transmitting the data. \n + * \b Range: minimum= 0, maximum= 31. + * @return None + * + * \parDescription
+ * Writes data to the transmit buffer in a control mode. \n\n + * When the respective control mode is enabled , this API can be used. + * + * + * \parRelated APIs:
+ * XMC_USIC_CH_WriteToTBUF() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_WriteToTBUFTCI(XMC_USIC_CH_t *const channel, + const uint16_t data, + const uint32_t transmit_control_information) +{ + channel->TBUF[transmit_control_information] = data; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param word_length Number of bits to be configured for a data word. \n + * \b Range: minimum= 1, maximum= 16. \n + * e.g: For word length of 8, \a word_length should be provided as 8. + * @return None + * + * \parDescription
+ * Sets the data word length in number of bits. \n\n + * Sets the number of bits to represent a data word. Frame length should be a multiple of word length. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetFrameLength()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetWordLength(XMC_USIC_CH_t *const channel, const uint8_t word_length) +{ + channel->SCTR = (uint32_t)(channel->SCTR & (~USIC_CH_SCTR_WLE_Msk)) | + (uint32_t)(((uint32_t)word_length - 1UL) << USIC_CH_SCTR_WLE_Pos); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param word_length Number of bits to be configured for a data word. \n + * \b Range: minimum= 1, maximum= 16. \n + * e.g: For word length of 8, \a word_length should be provided as 8. + * @return None + * + * \parDescription
+ * Sets the data word length in number of bits. \n\n + * Sets the number of bits to represent a data word. Frame length should be a multiple of word length. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetFrameLength()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetShiftDirection(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_SHIFT_DIRECTION_t shift_direction) +{ + channel->SCTR = (uint32_t)(channel->SCTR & (~USIC_CH_SCTR_SDIR_Msk)) | (uint32_t)shift_direction; +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Captured counter value + * + * + * \parDescription
+ * The value of the counter is captured if one of the trigger signals DX0T or DX1T are activated by the corresponding input stage. + */ +__STATIC_INLINE uint32_t XMC_USIC_CH_GetCaptureTimerValue(const XMC_USIC_CH_t *const channel) +{ + return channel->CMTR; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param mode divider mode ::XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_t \n + * @param step divider \n + * \b XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_NORMAL resulting divider = 1023 - step \n + * \b XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_FRACTIONAL resulting divider = 1023 / step \n + * + * @return None + * + * \parDescription
+ * The fractional divider generates its output frequency fFD by either dividing the input frequency fPERIPH by an integer factor n or by multiplication of n/1024. + * + */ +__STATIC_INLINE void XMC_USIC_CH_SetFractionalDivider(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_t mode, const uint16_t step) +{ + channel->FDR = mode | step; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param frame_length Number of bits in a frame. \n + * \b Range: minimum= 1, maximum= 0x3f. The maximum value for fixed frame size is 0x3f. \n + * e.g: For a frame length of 16, \a frame_length should be provided as 16. + * @return None + * + * \parDescription
+ * Define the data frame length.\n\n + * Set the number of bits to be serially transmitted in a frame. + * The frame length should be multiples of word length. If the value is set to 0x40, the frame length + * has to be controlled explicitly. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetWordLength(), XMC_USIC_CH_EnableFrameLengthControl() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetFrameLength(XMC_USIC_CH_t *const channel, const uint8_t frame_length) +{ + channel->SCTR = (uint32_t)(channel->SCTR & (~USIC_CH_SCTR_FLE_Msk)) | + (((uint32_t)frame_length - 0x1U) << USIC_CH_SCTR_FLE_Pos); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Bit mask of the channel events to be enabled. Use @ref XMC_USIC_CH_EVENT_t for the bit masks. \n + * \b Range: @ref XMC_USIC_CH_EVENT_RECEIVE_START, @ref XMC_USIC_CH_EVENT_DATA_LOST etc. Multiple events + * can be combined using \a OR operation. + * @return None + * + * \parDescription
+ * Enable the channel interrupt events.\n\n + * Common channel events related to serial communication can be configured using this API. + * Multiple events can be combined using the bitwise OR operation and configured in one function call. + * XMC_USIC_CH_EVENT_t enumerates multiple protocol event bitmasks. These enumerations can be used as input to the API. + * + * \parRelated APIs:
+ * XMC_USIC_CH_DisableEvent(), XMC_USIC_CH_SetInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR |= event; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Bit mask of the channel events to be disabled. Use @ref XMC_USIC_CH_EVENT_t for the bit masks. \n + * \b Range: @ref XMC_USIC_CH_EVENT_RECEIVE_START, @ref XMC_USIC_CH_EVENT_DATA_LOST etc. Multiple events + * can be combined using \a OR operation. + * @return None + * + * \parDescription
+ * Disable the channel interrupt events. \n\n + * Multiple events can be combined using the bitwise OR operation and configured in one function call. + * XMC_USIC_CH_EVENT_t enumerates multiple protocol event bitmasks. These enumerations can be used as input to the API. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableEvent(), XMC_USIC_CH_SetInterruptNodePointer() \n\n\n +*/ +__STATIC_INLINE void XMC_USIC_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR &= (uint32_t)~event; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param interrupt_node Interrupt node pointer to be configured. \n + * \b Range: @ref XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, + * @ref XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER etc. + * @param service_request Service request number.\n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets the interrupt node for USIC channel events. \n\n + * For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so.
+ * Note: NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableEvent() \n\n\n + */ +void XMC_USIC_CH_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Stataus @ref XMC_USIC_CH_TBUF_STATUS_IDLE if transmit buffer is free, + * @ref XMC_USIC_CH_TBUF_STATUS_BUSY if transmit buffer is busy. + * + * \parDescription
+ * Gets transmit buffer status. \n\n + * Status indicates whether the transmit buffer is free, or busy transmitting data. + * The status depends on the value of TDV flag in TCSR register. + * This status can be used while transmitting data. Transmit data when the transmit buffer + * status is @ref XMC_USIC_CH_TBUF_STATUS_IDLE. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetDataOutputMode() \n\n\n + */ +__STATIC_INLINE XMC_USIC_CH_TBUF_STATUS_t XMC_USIC_CH_GetTransmitBufferStatus(XMC_USIC_CH_t *const channel) +{ + return (XMC_USIC_CH_TBUF_STATUS_t)(channel->TCSR & USIC_CH_TCSR_TDV_Msk); +} + +/** + * @brief API to get receive buffer status + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Status of data validity check for RBUF0 and RBUF1. \n + * Returned value should be masked with RDV0 and RDV1 bits to know the status. \n + * \b Range: @ref XMC_USIC_CH_RBUF_STATUS_DATA_VALID0, @ref XMC_USIC_CH_RBUF_STATUS_DATA_VALID1. + * + * \parDescription
+ * Checks if RBUF0 and RBUF1 have valid unread data. \n\n + * It checks the bits RDV0 and RDV1 of the RBUFSR register. + * Returns the value of RBUFSR masked with bitmasks of RDV0 and RDV1. + * It can be used to decide whether 2bytes has to be read from RBUF or 1 byte. + * If both bitmasks XMC_USIC_CH_RBUF_STATUS_DATA_VALID0 and XMC_USIC_CH_RBUF_STATUS_DATA_VALID1 + * are set, then 2 bytes can be read from RBUF. If only either of them is set, then only one byte + * can be read from RBUF. + * \parRelated APIs:
+ * XMC_USIC_CH_GetTransmitBufferStatus() \n\n\n + */ +__STATIC_INLINE uint32_t XMC_USIC_CH_GetReceiveBufferStatus(XMC_USIC_CH_t *const channel) +{ + return ((uint32_t) (channel->RBUFSR & (USIC_CH_RBUFSR_RDV0_Msk | USIC_CH_RBUFSR_RDV1_Msk))); +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param start_transmision_mode Transmission mode to be enabled. \n + * \b Range: @ref XMC_USIC_CH_START_TRANSMISION_DISABLED, + * @ref XMC_USIC_CH_START_TRANSMISION_ON_TDV, @ref XMC_USIC_CH_START_TRANSMISION_ON_TDV_DX2S_0, + * @ref XMC_USIC_CH_START_TRANSMISION_ON_TDV_DX2S_1 + * + * @return None + * + * \parDescription
+ * Configures data transmission. \n\n + * The configuration affects the data shifted on the DOUT0 pin. + * + * \parRelated APIs:
+ * XMC_USIC_CH_GetTransmitBufferStatus(), XMC_USIC_CH_SetDataOutputMode() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetStartTransmisionMode(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_START_TRANSMISION_MODE_t start_transmision_mode) +{ + channel->TCSR = (uint32_t)(channel->TCSR & (~USIC_CH_TCSR_TDEN_Msk)) | (uint32_t)start_transmision_mode; +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data_output_mode Data output mode. \n + * \b Range: @ref XMC_USIC_CH_DATA_OUTPUT_MODE_NORMAL, @ref XMC_USIC_CH_DATA_OUTPUT_MODE_INVERTED + * @return None + * + * \parDescription
+ * Configures the mode for data output. \n\n + * USIC channel can be configured to shift inverted data or direct data based on the input to the API. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetStartTransmisionMode() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetDataOutputMode(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_DATA_OUTPUT_MODE_t data_output_mode) +{ + channel->SCTR = (uint32_t)(channel->SCTR & (~USIC_CH_SCTR_DOCFG_Msk)) | (uint32_t)data_output_mode; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Enables automatic update of frame length. \n\n + * When the automatic update of frame length is enabled, frame length is configured based on the + * index of the TBUF[]/IN[] register array. When the data is written to TBUF[x], frame length is configured + * with the mask value of \a x at the last 5 bit positions. Same logic is applicable if data is written to + * IN[x] register. + * + * \parRelated APIs:
+ * XMC_USIC_CH_DisableFrameLengthControl(), XMC_USIC_CH_TXFIFO_PutDataFLEMode() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableFrameLengthControl(XMC_USIC_CH_t *const channel) +{ + channel->TCSR = (uint32_t)(channel->TCSR & (~(USIC_CH_TCSR_WLEMD_Msk | + USIC_CH_TCSR_SELMD_Msk | + USIC_CH_TCSR_WAMD_Msk | + USIC_CH_TCSR_HPCMD_Msk))) | + (uint32_t)USIC_CH_TCSR_FLEMD_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Disables automatic update of frame length. \n\n + * When automatic update of frame length is disabled, frame length has to configured explicitly. + * Frame length remains fixed until it is changed again. + * + * \parRelated APIs:
+ * XMC_USIC_CH_DisableFrameLengthControl(), XMC_USIC_CH_SetFrameLength() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_DisableFrameLengthControl(XMC_USIC_CH_t *const channel) +{ + channel->TCSR &= (uint32_t)~USIC_CH_TCSR_FLEMD_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Bit TCSR.TE is set if DX2T becomes active while TDV = 1. \n\n + * Enables the transfer trigger unit to set bit TCSR.TE if the trigger signal DX2T becomes active + * for event driven transfer starts. + * + * \parRelated APIs:
+ * XMC_USIC_CH_DisableTBUFDataValidTrigger()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableTBUFDataValidTrigger(XMC_USIC_CH_t *const channel) +{ + channel->TCSR |= (uint32_t)USIC_CH_TCSR_TDVTR_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Disables the trigger of TDV depending on DX2T signal. \n\n + * Bit TCSR.TE is permanently set. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableTBUFDataValidTrigger() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_DisableTBUFDataValidTrigger(XMC_USIC_CH_t *const channel) +{ + channel->TCSR &= (uint32_t)~USIC_CH_TCSR_TDVTR_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param service_request_line service request number of the event to be triggered. \n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Trigger a USIC interrupt service request.\n\n + * When the USIC service request is triggered, the NVIC interrupt associated with it will be + * generated if enabled. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TriggerServiceRequest(XMC_USIC_CH_t *const channel, const uint32_t service_request_line) +{ + channel->FMR = (uint32_t)(USIC_CH_FMR_SIO0_Msk << service_request_line); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param transmit_buffer_status clearing or setting the TDV flag. \n + * + * @return None + * + * \parDescription
+ * Modify TCSR.TDV and TCSR.TE to control the start of a data word transmission by software. + * + * \parRelated APIs:
+ * XMC_USIC_CH_GetTransmitBufferStatus() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetTransmitBufferStatus(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_TBUF_STATUS_SET_t transmit_buffer_status) +{ + channel->FMR = (uint32_t)transmit_buffer_status; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param passive_level Value of passive level for the channel. \n + * \b Range: @ref XMC_USIC_CH_PASSIVE_DATA_LEVEL0, @ref XMC_USIC_CH_PASSIVE_DATA_LEVEL1 + * @return None + * + * \parDescription
+ * Set the passive data level of the output signal. \n\n + * When the USIC channel transmit stage is idle, the output signal level stays at the + * configured passive level. + * + * \parRelated APIs:
+ * XMC_USIC_CH_GetTransmitBufferStatus(), XMC_USIC_CH_SetStartTransmisionMode() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetPassiveDataLevel(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_PASSIVE_DATA_LEVEL_t passive_level) +{ + channel->SCTR &= (~USIC_CH_SCTR_PDL_Msk); + channel->SCTR |= (uint32_t)passive_level; +} + +/* TX FIFO APIs */ +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data_pointer Start position inside the FIFO buffer. \n + * \b Range: 0 to 63. + * @param size Required size of the transmit FIFO. \n + * \b Range: @ref XMC_USIC_CH_FIFO_DISABLED, @ref XMC_USIC_CH_FIFO_SIZE_2WORDS.. @ref XMC_USIC_CH_FIFO_SIZE_64WORDS + * @param limit Threshold of transmit FIFO filling level to be considered for generating events. \n + * \b Range: 0 to \a size -1. + * @return None + * + * \parDescription
+ * Initializes the transmit FIFO. \n\n + * Transmit FIFO is a subset of a common FIFO sized 64 words. This FIFO is shared between 2 channels of the USIC module. + * Each channel can share the FIFO for transmission and reception. \a data_pointer represents the start index in the common FIFO, + * from where transmit data can be put, for the selected USIC channel. \a size represents the size of transmit FIFO as a multiple of + * 2. Since the FIFO is shared between 2 USIC channels, FIFO size should be carefully selected. A FIFO standard transmit buffer + * event is generated when the FIFO filling level falls below the \a limit value. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_EnableEvent(), XMC_USIC_CH_TXFIFO_SetInterruptNodePointer() \n\n\n + */ +void XMC_USIC_CH_TXFIFO_Configure(XMC_USIC_CH_t *const channel, + const uint32_t data_pointer, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param size Required size of the transmit FIFO. \n + * \b Range: @ref XMC_USIC_CH_FIFO_DISABLED, @ref XMC_USIC_CH_FIFO_SIZE_2WORDS.. @ref XMC_USIC_CH_FIFO_SIZE_64WORDS + * @param limit Threshold for transmit FIFO filling level to be considered for generating events. \n + * \b Range: 0 to \a size -1. + * @return None + * + * \parDescription
+ * Sets the size and trigger limit for the transmit FIFO. \n\n + * The API is not to be called for initializing the transmit FIFO. The API shall be used for the + * runtime change of transmit FIFO trigger limit. FIFO start position will not be affected on execution. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_SetSizeTriggerLimit() \n\n\n + */ +void XMC_USIC_CH_TXFIFO_SetSizeTriggerLimit(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit); + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Events to be enabled. Multiple events can be bitwise OR combined. @ref XMC_USIC_CH_TXFIFO_EVENT_CONF_t \n + * @return None + * + * \parDescription
+ * Enables the interrupt events related to transmit FIFO. \n\n + * Event bitmasks can be constructed using the enumeration @ref XMC_USIC_CH_TXFIFO_EVENT_CONF_t. + * Multiple events can be enabled by providing multiple events in a single call. For providing + * multiple events, combine the events using bitwise OR operation. Events are configured in the TBCTR register.
+ * + * Note: API only enables the events. For interrupt generation, interrupt node must be configured and NVIC node + * must be enabled. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_SetInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TXFIFO_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->TBCTR |= event; +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Events to be disabled. @ref XMC_USIC_CH_TXFIFO_EVENT_CONF_t \n + * @return None + * + * \parDescription
+ * Disables the interrupt events related to transmit FIFO. \n\n + * By disabling the interrupt events, generation of interrupt is stopped. User can poll the event + * flags from the status register using the API XMC_USIC_CH_TXFIFO_GetEvent(). + * Event bitmasks can be constructed using the enumeration @ref XMC_USIC_CH_TXFIFO_EVENT_CONF_t. For providing + * multiple events, combine the events using bitwise OR operation. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_GetEvent(), XMC_USIC_CH_TXFIFO_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TXFIFO_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->TBCTR &= (uint32_t)~event; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param interrupt_node Node pointer representing the transmit FIFO events. \n + * \b Range: @ref XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER_STANDARD, + * @ref XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER_ALTERNATE + * @param service_request The service request to be used for interrupt generation. \n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets an interrupt node for the transmit FIFO events.\n\n + * A node pointer represents one or more interrupt events. Service request represents the interrupt node to be used + * among the 6 interrupt nodes available for USIC module. + * API configures the service request to be used for interrupt generation for the events selected. + * A transmit FIFO event can generate an interrupt only if the interrupt node is configured for the event and + * the interrupt generation is enabled for the event. For example, transmit FIFO standard transmit buffer + * interrupt is generated if the interrupt node for the same is set and interrupt is enabled.
+ * + * Note: NVIC node should be explicitly enabled for the interrupt generation. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_EnableEvent() \n\n\n + */ +void XMC_USIC_CH_TXFIFO_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data Data to be transmitted. \n + * \b Range: 16bit unsigned data. minimum= 0, maximum= 65535 + * @return None + * + * \parDescription
+ * Writes data into the transmit FIFO. \n\n + * The data provided is placed in the transmit FIFO. + * The transmit FIFO should be configured before calling this API. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TXFIFO_PutData(XMC_USIC_CH_t *const channel, const uint16_t data) +{ + channel->IN[0] = data; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data Data to be transmitted. + * @param frame_length Frame length to be configured while transmitting the data. \n + * \b Range: minimum= 0, maximum= 31. e.g: For a frame length of 16, set \a frame_length as 15. + * @return None + * + * \parDescription
+ * Writes data to the transmit FIFO in frame length control mode. \n\n + * When frame length control is enabled for dynamic update of frame length, this API can be used. + * \a frame_length represents the frame length to be updated by the peripheral. + * \a frame_length is used as index for the IN[] register array. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableFrameLengthControl() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TXFIFO_PutDataFLEMode(XMC_USIC_CH_t *const channel, + const uint16_t data, + const uint32_t frame_length) +{ + channel->IN[frame_length] = data; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data Data to be transmitted. + * @param frame_length Frame length to be configured while transmitting the data. \n + * \b Range: minimum= 0, maximum= 31. e.g: For a frame length of 16, set \a frame_length as 15. + * @return None + * + * \parDescription
+ * Writes data to the transmit FIFO in hardware port control mode. \n\n + * When hardware port control is enabled for dynamic update of frame length, this API can be used. + * \a frame_length represents the frame length to be updated by the peripheral. + * \a frame_length is used as index for the IN[] register array. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableFrameLengthControl() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TXFIFO_PutDataHPCMode(XMC_USIC_CH_t *const channel, + const uint16_t data, + const uint32_t frame_length) +{ + channel->IN[frame_length] = data; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Clears the contents of transmit FIFO. \n\n + * Transmit FIFO contents will be cleared and the filling level will be reset to 0. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_GetLevel() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TXFIFO_Flush(XMC_USIC_CH_t *const channel) +{ + channel->TRBSCR = (uint32_t)USIC_CH_TRBSCR_FLUSHTB_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Status \a true if transmit FIFO is full + * \a false if transmit FIFO is not full. + * + * \parDescription
+ * Checks if transmit FIFO is full. \n\n + * When the transmit FIFO filling level reaches the configured size, FIFO full flag is set. + * User should not write to the FIFO when the transmit FIFO is full. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_IsEmpty(), XMC_USIC_CH_TXFIFO_Flush() \n\n\n + */ +__STATIC_INLINE bool XMC_USIC_CH_TXFIFO_IsFull(XMC_USIC_CH_t *const channel) +{ + return (bool)(channel->TRBSR & USIC_CH_TRBSR_TFULL_Msk); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Status \a true if transmit FIFO is empty + * \a false if transmit FIFO has some data. + * + * \parDescription
+ * Checks if transmit FIFO is empty. \n\n + * When the transmit FIFO is empty, data can be written to FIFO. + * When the last written word to the transmit FIFO is transmitted out of the FIFO, + * FIFO empty flag is set. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_Flush(), XMC_USIC_CH_TXFIFO_PutData() \n\n\n + */ +__STATIC_INLINE bool XMC_USIC_CH_TXFIFO_IsEmpty(XMC_USIC_CH_t *const channel) +{ + return (bool)(channel->TRBSR & USIC_CH_TRBSR_TEMPTY_Msk); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Transmit FIFO filling level. \n + * \b Range: minimum= 0(FIFO empty), maximum= transmit FIFO size. + * + * \parDescription
+ * Gets the transmit FIFO filling level. \n\n + * For every word written to the FIFO, filling level is updated. The API gives the value + * of this filling level. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_Flush(), XMC_USIC_CH_TXFIFO_PutData() \n\n\n + */ +__STATIC_INLINE uint32_t XMC_USIC_CH_TXFIFO_GetLevel(XMC_USIC_CH_t *const channel) +{ + return ((uint32_t)(channel->TRBSR & USIC_CH_TRBSR_TBFLVL_Msk) >> USIC_CH_TRBSR_TBFLVL_Pos); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Status of standard transmit and transmit buffer error events. @ref XMC_USIC_CH_TXFIFO_EVENT_t \n + * + * \parDescription
+ * Gets the transmit FIFO event status. \n\n + * Gives the status of transmit FIFO standard transmit buffer event and transmit buffer error event. + * The status bits are located at their bit positions in the TRBSR register in the returned value. + * User can make use of the @ref XMC_USIC_CH_TXFIFO_EVENT_t enumeration for checking the status of return value. + * The status can be found by using the bitwise AND operation on the returned value with the enumerated value.
+ * + * Note: Event status flags should be cleared by the user explicitly. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_ClearEvent() \n\n\n + */ +__STATIC_INLINE uint32_t XMC_USIC_CH_TXFIFO_GetEvent(XMC_USIC_CH_t *const channel) +{ + return (uint32_t)((channel->TRBSR) & (USIC_CH_TRBSR_STBI_Msk | + USIC_CH_TRBSR_TBERI_Msk)); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Transmit FIFO events to be cleared. \n + * \b Range: @ref XMC_USIC_CH_TXFIFO_EVENT_STANDARD, @ref XMC_USIC_CH_TXFIFO_EVENT_ERROR. + * @return None + * + * \parDescription
+ * Clears the transmit FIFO event flags in the status register. \n\n + * USIC channel peripheral does not clear the event flags after they are read. + * This API clears the events provided in the \a mask value. + * XMC_USIC_CH_TXFIFO_EVENT enumeration can be used as input. Multiple events + * can be cleared by providing a mask value obtained by bitwise OR operation of + * multiple event enumerations. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_GetEvent() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TXFIFO_ClearEvent(XMC_USIC_CH_t *const channel, + const uint32_t event) +{ + channel->TRBSCR = event; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data_pointer Start position inside the FIFO buffer. \n + * \b Range: 0 to 63. + * @param size Required size of the receive FIFO. \n + * \b Range: @ref XMC_USIC_CH_FIFO_DISABLED, @ref XMC_USIC_CH_FIFO_SIZE_2WORDS.. @ref XMC_USIC_CH_FIFO_SIZE_64WORDS + * @param limit Threshold of receive FIFO filling level to be considered for generating events. \n + * \b Range: 0 to \a size -1. + * @return None + * + * \parDescription
+ * Configures the receive FIFO. \n\n + * Receive FIFO is the subset of a common FIFO sized 64 words. This FIFO is shared between 2 channels of the USIC module. + * Each channel can share the FIFO for transmission and reception. \a data_pointer represents the start index in the common FIFO, + * from where received data can be put. \a size represents the size of receive FIFO as a multiple of 2. + * Since the FIFO is shared between 2 USIC channels, FIFO size should be carefully selected. A FIFO standard receive buffer + * event or alternative receive buffer event is generated when the FIFO filling level exceeds the \a limit value. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_EnableEvent(), XMC_USIC_CH_RXFIFO_SetInterruptNodePointer() \n\n\n +*/ +void XMC_USIC_CH_RXFIFO_Configure(XMC_USIC_CH_t *const channel, + const uint32_t data_pointer, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param size Required size of the receive FIFO. \n + * \b Range: @ref XMC_USIC_CH_FIFO_DISABLED, @ref XMC_USIC_CH_FIFO_SIZE_2WORDS.. @ref XMC_USIC_CH_FIFO_SIZE_64WORDS + * @param limit Threshold for receive FIFO filling level to be considered for generating events. \n + * \b Range: 0 to \a size -1. + * @return None + * + * \parDescription
+ * Sets the size and trigger limit for the receive FIFO. \n\n + * The API is not to be called for initializing the receive FIFO. The API shall be used for the + * runtime change of receive FIFO trigger limit. FIFO start position will not be affected on execution. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_SetSizeTriggerLimit()\ n\n\n + */ +void XMC_USIC_CH_RXFIFO_SetSizeTriggerLimit(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Events to be enabled. Multiple events can be bitwise OR combined. @ref XMC_USIC_CH_RXFIFO_EVENT_CONF_t\n + * @return None + * + * \parDescription
+ * Enables the interrupt events related to transmit FIFO. \n\n + * Event bitmasks can be constructed using the enumeration @ref XMC_USIC_CH_RXFIFO_EVENT_CONF_t. + * Multiple events can be enabled by providing multiple events in a single call. For providing + * multiple events, combine the events using bitwise OR operation.
+ * + * Note: API only enables the events. For interrupt generation, interrupt node must be configured and NVIC node + * must be enabled. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_SetInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_RXFIFO_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->RBCTR |= event; +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Events to be disabled. \n + * \b Range: @ref XMC_USIC_CH_RXFIFO_EVENT_CONF_STANDARD, @ref XMC_USIC_CH_RXFIFO_EVENT_CONF_ERROR, + * @ref XMC_USIC_CH_RXFIFO_EVENT_CONF_ALTERNATE. + * @return None + * + * \parDescription
+ * Disables the selected interrupt events related to receive FIFO. \n\n + * By disabling the interrupt events, generation of interrupt is stopped. User can poll the event + * flags from the status register using the API XMC_USIC_CH_RXFIFO_GetEvent(). + * Event bitmasks can be constructed using the enumeration \a XMC_USIC_CH_RXFIFO_EVENT_CONF. For providing + * multiple events, combine the events using bitwise OR operation. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_GetEvent(), XMC_USIC_CH_RXFIFO_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_RXFIFO_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->RBCTR &= (uint32_t)~event; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param interrupt_node Node pointer representing the receive FIFO events. \n + * \b Range: @ref XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_STANDARD, + * @ref XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_ALTERNATE + * @param service_request The service request to be used for interrupt generation.\n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets an interrupt node for the receive FIFO events. \n\n + * A node pointer represents one or more interrupt events. Service request represents the interrupt node to be used + * among the 6 interrupt nodes available for USIC module. + * API configures the service request to be used for interrupt generation for the events selected. + * A receive FIFO event can generate an interrupt only if the interrupt node is configured for the event and + * the interrupt generation is enabled for the event. For example, transmit FIFO standard transmit buffer + * interrupt is generated if the interrupt node for the same is set and interrupt is enabled.
+ * + * Note: NVIC node should be explicitly enabled for the interrupt generation. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_EnableEvent() \n\n\n + */ +void XMC_USIC_CH_RXFIFO_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Value read from the receive FIFO. \n + * \b Range: 16bit data. Length of data depends on the word length configuration. + * + * \parDescription
+ * Gets data from the receive FIFO. \n\n + * Receive FIFO should be read only if data is availble in the FIFO. This can be checked using + * the API XMC_USIC_CH_RXFIFO_IsEmpty(). Receive FIFO error flag will be set if an attempt is made + * to read from an empty receive FIFO. To read all the received data, user should keep reading data + * until receive FIFO is empty. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_ClearEvent() \n\n\n + */ +__STATIC_INLINE uint16_t XMC_USIC_CH_RXFIFO_GetData(XMC_USIC_CH_t *const channel) +{ + return (uint16_t)(channel->OUTR); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Clears the contents of receive FIFO. \n\n + * Receive FIFO contents will be cleared and the filling level will be reset to 0. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_GetLevel() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_RXFIFO_Flush(XMC_USIC_CH_t *const channel) +{ + channel->TRBSCR = (uint32_t)USIC_CH_TRBSCR_FLUSHRB_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Status \a true if receive FIFO is full + * \a false if receive FIFO is not full. + * + * \parDescription
+ * Checks if receive FIFO is full. \n\n + * When the receive FIFO filling level reaches the configured size, FIFO full flag is set. + * Any data received when the receive FIFO is full, is lost. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_IsEmpty(), XMC_USIC_CH_RXFIFO_Flush() \n\n\n + */ +__STATIC_INLINE bool XMC_USIC_CH_RXFIFO_IsFull(XMC_USIC_CH_t *const channel) +{ + return (bool)(channel->TRBSR & USIC_CH_TRBSR_RFULL_Msk); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Status \a true if receive FIFO is empty, + * \a false if receive FIFO has some data. + * + * \parDescription
+ * Checks if receive FIFO is empty. \n\n + * When the receive FIFO is empty, received data will be put in receive FIFO. + * When the last received word in the FIFO is read, FIFO empty flag is set. Any attempt + * to read from an empty receive FIFO will set the receive FIFO error flag. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_Flush(), XMC_USIC_CH_RXFIFO_PutData() \n\n\n + */ +__STATIC_INLINE bool XMC_USIC_CH_RXFIFO_IsEmpty(XMC_USIC_CH_t *const channel) +{ + return (bool)(channel->TRBSR & USIC_CH_TRBSR_REMPTY_Msk); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return uint32_t Receive FIFO filling level. \n + * \b Range: minimum= 0(FIFO empty), maximum= receive FIFO size. + * + * \parDescription
+ * Gets the receive FIFO filling level. \n\n + * For every word received, the filling level is incremented. The API gives the value + * of this filling level. The filling level is decremented when the data is read out of the + * receive FIFO. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_Flush(), XMC_USIC_CH_RXFIFO_PutData() \n\n\n + */ +__STATIC_INLINE uint32_t XMC_USIC_CH_RXFIFO_GetLevel(XMC_USIC_CH_t *const channel) +{ + return ((uint32_t)(channel->TRBSR & USIC_CH_TRBSR_RBFLVL_Msk) >> USIC_CH_TRBSR_RBFLVL_Pos); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Status of standard receive buffer, alternative receive buffer and receive buffer error events. \n + * \b Range: @ref XMC_USIC_CH_RXFIFO_EVENT_STANDARD, @ref XMC_USIC_CH_RXFIFO_EVENT_ERROR, + * @ref XMC_USIC_CH_RXFIFO_EVENT_ALTERNATE. + * + * \parDescription
+ * Gets the receive FIFO events' status. \n\n + * Gives the status of receive FIFO standard receive buffer event, alternative receive buffer event and receive buffer error event. + * The status bits are located at their bitpositions in the TRBSR register in the returned value. + * User can make use of the XMC_USIC_CH_RXFIFO_EVENT enumeration for checking the status of return value. + * The status can be found by using the bitwise AND operation on the returned value with the enumerated value.
+ * + * Note: Event status flags should be cleared by the user explicitly. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_ClearEvent()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_USIC_CH_RXFIFO_GetEvent(XMC_USIC_CH_t *const channel) +{ + return (uint32_t)((channel->TRBSR) & (USIC_CH_TRBSR_SRBI_Msk | + USIC_CH_TRBSR_RBERI_Msk | + USIC_CH_TRBSR_ARBI_Msk)); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Receive FIFO events to be cleared. \n + * \b Range: @ref XMC_USIC_CH_RXFIFO_EVENT_STANDARD, @ref XMC_USIC_CH_RXFIFO_EVENT_ERROR, + * @ref XMC_USIC_CH_RXFIFO_EVENT_ALTERNATE. + * @return None + * + * \parDescription
+ * Clears the receive FIFO event flags in the status register. \n\n + * USIC channel peripheral does not clear the event flags after they are read. + * This API clears the events provided in the \a mask value. + * XMC_USIC_CH_RXFIFO_EVENT enumeration can be used as input. Multiple events + * can be cleared by providing a mask value obtained by bitwise OR operation of + * multiple event enumerations. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_GetEvent() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_RXFIFO_ClearEvent(XMC_USIC_CH_t *const channel, + const uint32_t event) +{ + channel->TRBSCR = event; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Enables time measurement using the capture mode timer. \n\n + * Time measurement is enabled by setting the timer enable flag in BRG register. + * + * \parRelated APIs:
+ * XMC_USIC_CH_DisableTimeMeasurement() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableTimeMeasurement(XMC_USIC_CH_t *const channel) +{ + channel->BRG |= (uint32_t)USIC_CH_BRG_TMEN_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Disables time measurement using the capture mode timer. \n\n + * Time measurement is disabled by clearing the timer enable flag in BRG register. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableTimeMeasurement() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_DisableTimeMeasurement(XMC_USIC_CH_t *const channel) +{ + channel->BRG &= (uint32_t)~USIC_CH_BRG_TMEN_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param passive_level Passive level for the master clock output. \n + * \b Range: @ref XMC_USIC_CH_BRG_MASTER_CLOCK_PASSIVE_LEVEL_0, @ref XMC_USIC_CH_BRG_MASTER_CLOCK_PASSIVE_LEVEL_1. + * @return None + * + * \parDescription
+ * Sets the idle mode pin level for the master clock output. \n + */ +__STATIC_INLINE void XMC_USIC_CH_SetMclkOutputPassiveLevel(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_BRG_MASTER_CLOCK_PASSIVE_LEVEL_t passive_level) +{ + channel->BRG = (uint32_t)(channel->BRG & (~USIC_CH_BRG_MCLKCFG_Msk)) | (uint32_t)passive_level; +} +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param passive_level Passive level for the clock output. \n + * \b Range: @ref XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_DISABLED, + * @ref XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_ENABLED, + * @ref XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_DISABLED, + * @ref XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_ENABLED, + * @param clock_output Shift clock source selection. \n + * \b Range: Use @ref XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK, + * @ref XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_DX1 + * @return None + * + * \parDescription
+ * Sets the idle mode shift clock output level and selects the shift clock source. \n\n + * Shift clock idle mode output level can be set to logic high or low. Shift clock output can be configured to have a + * delay of half shift clock period. Both the configurations are available as enumeration values defined with type + * @ref XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t. + * This value should be configured based on the slave device requirement. + * Shift clock source can be selected between internal clock(master) and external input(slave). + * + */ +__STATIC_INLINE void XMC_USIC_CH_ConfigureShiftClockOutput(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t passive_level, + const XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_t clock_output) +{ + channel->BRG = (uint32_t)(channel->BRG & (~(USIC_CH_BRG_SCLKCFG_Msk | + USIC_CH_BRG_SCLKOSEL_Msk))) | + (uint32_t)passive_level | + (uint32_t)clock_output; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param mode USIC channel operation mode. \n + * \b Range: @ref XMC_USIC_CH_OPERATING_MODE_IDLE, @ref XMC_USIC_CH_OPERATING_MODE_SPI, + * @ref XMC_USIC_CH_OPERATING_MODE_UART, @ref XMC_USIC_CH_OPERATING_MODE_I2S, + * @ref XMC_USIC_CH_OPERATING_MODE_I2C. + * @return None + * + * \parDescription
+ * Sets the USIC channel operation mode.\n\n + * A USIC channel can support multiple serial communication protocols like UART, SPI, I2C and I2S. + * The API sets the input operation mode to the USIC channel. + * + * \parRelated APIs:
+ * XMC_USIC_Enable(), XMC_USIC_CH_Enable() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetMode(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_OPERATING_MODE_t mode) +{ + channel->CCR = (uint32_t)(channel->CCR & (~(USIC_CH_CCR_MODE_Msk))) | (uint32_t)mode; +} +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_vadc.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_vadc.h new file mode 100644 index 00000000..dc963068 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_vadc.h @@ -0,0 +1,4962 @@ +/** + * @file xmc_vadc.h + * @date 2017-02-06 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-15: + * - Initial
+ * + * 2015-02-20: + * - Revised for XMC1201 device.
+ * + * 2015-04-27: + * - Added new APIs for SHS.
+ * - Added New APIs for trigger edge selection.
+ * - Added new APIs for Queue flush entries, boundary selection, Boundary node pointer.
+ * - Revised GatingMode APIs and EMUX Control Init API.
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * 2015-06-25: + * - BFL configuration in channel initialization fixed. + * + * 2015-07-28: + * - CLOCK_GATING_SUPPORTED and PERIPHERAL_RESET_SUPPORTED macros used + * - Clubbed the macro definitions for XMC13 XMC12 and XMC14 + * - Clubbed the macro definitions for XMC44 XMC47 and XMC48 + * - New APIs Created. + * - XMC_VADC_GLOBAL_SetIndividualBoundary + * - XMC_VADC_GROUP_SetIndividualBoundary + * - XMC_VADC_GROUP_GetAlias + * - XMC_VADC_GROUP_GetInputClass + * - XMC_VADC_GROUP_ChannelSetIclass + * - XMC_VADC_GROUP_ChannelGetResultAlignment + * - XMC_VADC_GROUP_ChannelGetInputClass + * - XMC_VADC_GROUP_SetResultSubtractionValue + * + * 2015-12-01: + * - Added: + * - XMC4300 device supported + * + * - Fixed: + * - XMC_VADC_GLOBAL_TriggerEvent API updated. OR operation removed. + * - XMC_VADC_GLOBAL_ClearEvent API updated. Multiple events triggering on clearing the event is fixed. + * - Wrong MACRO name defined in xmc_vadc_map.h file corrected for XMC4200/4100 devices. + * XMC_VADC_G3_SAMPLE renamed to XMC_VADC_G1_SAMPLE + * + * 2015-12-01: + * - New APIs Created. + * - XMC_VADC_GROUP_ScanIsArbitrationSlotEnabled + * - XMC_VADC_GROUP_QueueIsArbitrationSlotEnabled + * - Fixed the analog calibration voltage for XMC1100 to external reference upper supply range. + * - Fixed the XMC_VADC_GLOBAL_StartupCalibration() for XMC1100. + * + * 2016-03-09: + * - Optimization of write only registers + * + * 2016-03-18: + * - Fixed XMC_VADC_GLOBAL_SHS_IsConverterReady(): API checks the STEPCFG register for the ready bit instead of + * SHSCFG SFR. + * + * 2016-06-17: + * - New macros added XMC_VADC_SHS_FULL_SET_REG, XMC_VADC_RESULT_PRIORITY_AVAILABLE + * - New Enum added XMC_VADC_SHS_GAIN_LEVEL_t and XMC_VADC_SYNCTR_EVAL_t + * - New APIs added are: + * - XMC_VADC_GROUP_SetSyncSlaveReadySignal + * - XMC_VADC_GROUP_ChannelGetAssertedEvents + * - XMC_VADC_GROUP_GetAssertedResultEvents + * - XMC_VADC_GROUP_SetResultRegPriority + * - XMC_VADC_GROUP_SetSyncReadySignal + * - XMC_VADC_GROUP_GetSyncReadySignal + * - XMC_VADC_GROUP_GetResultRegPriority + * + * 2017-02-06: + * - Added new functions to remove channels from background request source, XMC_VADC_GLOBAL_BackgroundRemoveChannelFromSequence() and XMC_VADC_GLOBAL_BackgndRemoveMultipleChannels() + * + * @endcond + * + */ + +#ifndef XMC_VADC_H +#define XMC_VADC_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include +#include +#include + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup VADC + * @brief Versatile Analog to Digital Converter (VADC) driver for XMC microcontroller family. + * + * The XMC microcontroller provides a series of analog input channels connected to a cluster of Analog/Digital + * Converters using the Successive Approximation Register (SAR) principle to convert analog input values (voltages) + * to discrete digital values. + * \if XMC1 + * The XMC1x is based on Sample & Hold converters, where a cluster contains 2 Sample&Hold units which share a common + * converter. + * \endif + * + * Each converter of the ADC cluster can operate independent of the others, controlled by a dedicated set of + * registers and triggered by a dedicated group request source. The results of each channel can be stored in a + * dedicated channel-specific result register or in a group-specific result register.
+ * + * The Versatile Analog to Digital Converter module (VADC) of the XMC comprises a set of converter blocks that + * can be operated either independently or via a common request source that emulates a background converter. + * Each converter block is equipped with a dedicated input multiplexer and dedicated request sources, + * which together build separate groups. + * + * \if XMC4 + * @image html "vadc_overview_xmc4x.png" + * \else + * @image html "vadc_overview_xmc1x.png" + * \endif + * + * The VADC LLD is split into GLOBAL and GROUP related APIs.
+ * GLOBAL:
+ *
    + *
  • Global APIs act on the entire ADC module. Configures global configuration registers
  • + *
  • Allows configuration of the background request source of the VADC.
  • + *
  • The clock related configurations for the VADC module are configured in the Global APIs/
  • + *
  • The Global API names are prefixed by the \b XMC_VADC_GLOBAL_ and they accept ::XMC_VADC_GLOBAL_t as + * one of its arguments.
  • + *
  • Configures the background request source of the VADC. The APIs which act on the background related registers + * are prefixed by \b XMC_VADC_GLOBAL_Background
  • + *
  • Configures the sample and hold unit of the VADC. The APIs which act on the SHS related registers + * are prefixed by \b XMC_VADC_GLOBAL_SHS_
  • + *

+ * + * GROUP:
+ *
    + *
  • Group APIs act on a VADC group. Configures the group configuration registers
  • + *
  • Configures the queue request source of the VADC. The APIs which act on the queue related registers + * are prefixed by \b XMC_VADC_GROUP_Queue
  • + *
  • Configures the scan request source of the VADC. The APIs which act on the scan related registers + * are prefixed by \b XMC_VADC_GROUP_Scan
  • + *
  • Configuration of the channels of each group are done by the API which have a prefix as + * \b XMC_VADC_GROUP_Channel.
  • + *
  • The Group API names are prefixed by the \b XMC_VADC_GROUP_ and they accept ::XMC_VADC_GROUP_t as + * one of its arguments.
  • + *

+ * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +#if ((UC_SERIES == XMC42)||(UC_SERIES == XMC41) || (UC_SERIES == XMC43)) +#define XMC_VADC_GROUP_AVAILABLE (1U) /* Defines the availability of group resource in a device*/ +#define XMC_VADC_GSCAN_AVAILABLE (1U) /* Defines the availability of scan request resource in a device*/ +#define XMC_VADC_QUEUE_AVAILABLE (1U) /* Defines the availability of queue request resource in a device*/ +#define XMC_VADC_EMUX_AVAILABLE (1U) /* Defines the availability of external multiplexer support in a + device*/ +#define XMC_VADC_BOUNDARY_AVAILABLE (1U) /* Defines the availability of boundary check support in a device*/ +#define XMC_VADC_MULTIPLE_SLAVEGROUPS (1U) /* Defines the availability of synchronous request source in device*/ +#define XMC_VADC_MAXIMUM_NUM_GROUPS (2U) /* Defines the maximum number of groups available in a device*/ +#define XMC_VADC_BOUNDARY_FLAG_SELECT (1U) /* Defines the availability of boundary flags in a device*/ +#define XMC_VADC_EMUX_CH_SEL_STYLE (1U) /* Defines the external multiplexer channel selection mode of + operation for a particular device*/ +#define XMC_VADC_SHS_AVAILABLE (0U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_SHS_FULL_SET_REG (0U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_GROUP_SRCREG_AVAILABLE (1U) /* Define the availability of a source specific result register */ +#define XMC_VADC_RESULT_PRIORITY_AVAILABLE (0U) /* Define the availability of a priority for result register */ +#endif + +#if (UC_SERIES == XMC44 || UC_SERIES == XMC47 || UC_SERIES == XMC48) +#define XMC_VADC_GROUP_AVAILABLE (1U) /* Defines the availability of group resource in a device*/ +#define XMC_VADC_GSCAN_AVAILABLE (1U) /* Defines the availability of scan request resource in a device*/ +#define XMC_VADC_QUEUE_AVAILABLE (1U) /* Defines the availability of queue request resource in a device*/ +#define XMC_VADC_EMUX_AVAILABLE (1U) /* Defines the availability of external multiplexer support in a + device*/ +#define XMC_VADC_BOUNDARY_AVAILABLE (1U) /* Defines the availability of boundary check support in a device*/ +#define XMC_VADC_MULTIPLE_SLAVEGROUPS (1U) /* Defines the availability of synchronous request source in device*/ +#define XMC_VADC_MAXIMUM_NUM_GROUPS (4U) /* Defines the maximum number of groups available in a device*/ +#define XMC_VADC_BOUNDARY_FLAG_SELECT (1U) /* Defines the availability of boundary flags in a device*/ +#define XMC_VADC_EMUX_CH_SEL_STYLE (1U) /* Defines the external multiplexer channel selection mode of + operation for a particular device*/ +#define XMC_VADC_SHS_AVAILABLE (0U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_SHS_FULL_SET_REG (0U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_GROUP_SRCREG_AVAILABLE (1U) /* Define the availability of a source specific result register */ +#define XMC_VADC_RESULT_PRIORITY_AVAILABLE (0U) /* Define the availability of a priority for result register */ +#endif + +#if (UC_SERIES == XMC45) +#define XMC_VADC_GROUP_AVAILABLE (1U) /* Defines the availability of group resource in a device*/ +#define XMC_VADC_GSCAN_AVAILABLE (1U) /* Defines the availability of scan request resource in a device*/ +#define XMC_VADC_QUEUE_AVAILABLE (1U) /* Defines the availability of queue request resource in a device*/ +#define XMC_VADC_EMUX_AVAILABLE (1U) /* Defines the availability of external multiplexer support in a + device*/ +#define XMC_VADC_BOUNDARY_AVAILABLE (1U) /* Defines the availability of boundary check support in a device*/ +#define XMC_VADC_MULTIPLE_SLAVEGROUPS (1U) /* Defines the availability of synchronous request source in device*/ +#define XMC_VADC_MAXIMUM_NUM_GROUPS (4U) /* Defines the maximum number of groups available in a device*/ +#define XMC_VADC_BOUNDARY_FLAG_SELECT (0U) /* Defines the availability of boundary flags in a device*/ +#define XMC_VADC_EMUX_CH_SEL_STYLE (0U) /* Defines the external multiplexer channel selection mode of + operation for a particular device*/ +#define XMC_VADC_SHS_AVAILABLE (0U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_SHS_FULL_SET_REG (0U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_GROUP_SRCREG_AVAILABLE (0U) /* Define the availability of a source specific result register */ +#define XMC_VADC_RESULT_PRIORITY_AVAILABLE (0U) /* Define the availability of a priority for result register */ +#endif + +#if (UC_SERIES == XMC14 || UC_SERIES == XMC13 || UC_SERIES == XMC12) +#define XMC_VADC_GROUP_AVAILABLE (1U) /* Defines the availability of group resource in a device*/ +#define XMC_VADC_GSCAN_AVAILABLE (1U) /* Defines the availability of scan request resource in a device*/ +#define XMC_VADC_QUEUE_AVAILABLE (1U) /* Defines the availability of queue request resource in a device*/ +#define XMC_VADC_EMUX_AVAILABLE (1U) /* Defines the availability of external multiplexer support in a + device*/ +#define XMC_VADC_BOUNDARY_AVAILABLE (1U) /* Defines the availability of boundary check support in a device*/ +#define XMC_VADC_MULTIPLE_SLAVEGROUPS (1U) /* Defines the availability of synchronous request source in device*/ +#define XMC_VADC_MAXIMUM_NUM_GROUPS (2U) /* Defines the maximum number of groups available in a device*/ +#define XMC_VADC_BOUNDARY_FLAG_SELECT (1U) /* Defines the availability of boundary flags in a device*/ +#define XMC_VADC_EMUX_CH_SEL_STYLE (1U) /* Defines the external multiplexer channel selection mode of + operation for a particular device*/ +#define XMC_VADC_SHS_AVAILABLE (1U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_SHS_FULL_SET_REG (1U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_GROUP_SRCREG_AVAILABLE (1U) /* Define the availability of a source specific result register */ +#define XMC_VADC_RESULT_PRIORITY_AVAILABLE (1U) /* Define the availability of a priority for result register */ +#endif + +#if (UC_SERIES == XMC11) +#define XMC_VADC_GROUP_AVAILABLE (0U) /* Defines the availability of group resource in a device*/ +#define XMC_VADC_GSCAN_AVAILABLE (0U) /* Defines the availability of scan request resource in a device*/ +#define XMC_VADC_QUEUE_AVAILABLE (0U) /* Defines the availability of queue request resource in a device*/ +#define XMC_VADC_EMUX_AVAILABLE (0U) /* Defines the availability of external multiplexer support in a + device*/ +#define XMC_VADC_BOUNDARY_AVAILABLE (0U) /* Defines the availability of boundary check support in a device*/ +#define XMC_VADC_MULTIPLE_SLAVEGROUPS (0U) /* Defines the availability of synchronous request source in device*/ +#define XMC_VADC_MAXIMUM_NUM_GROUPS (2U) /* Defines the maximum number of groups available in a device*/ +#define XMC_VADC_BOUNDARY_FLAG_SELECT (0U) /* Defines the availability of boundary flags in a device*/ +#define XMC_VADC_SHS_START_UP_CAL_ACTIVE (3U) /* Defines the need for SHS startup calibration activation for + XMC1100 devices */ +#define XMC_VADC_CONV_ENABLE_FOR_XMC11 (*(uint32_t*) 0x40010500UL) /* Defines the additional errata setting for + XMC1100 device for effective working*/ +#define XMC_VADC_EMUX_CH_SEL_STYLE (0U) /* Defines the external multiplexer channel selection mode of + operation for a particular device*/ +#define XMC_VADC_SHS_AVAILABLE (1U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_SHS_FULL_SET_REG (0U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_GROUP_SRCREG_AVAILABLE (0U) /* Define the availability of a source specific result register */ +#define XMC_VADC_RESULT_PRIORITY_AVAILABLE (0U) /* Define the availability of a priority for result register */ +#endif + +#define XMC_VADC_NUM_PORTS (16U) /* Defines the number of hardware ports that can be configured + as triggers and gating signals */ + +#define XMC_VADC_NUM_RESULT_REGISTERS (16U) /* Defines the number of result holding registers per ADC group */ + +#define XMC_VADC_NUM_CHANNELS_PER_GROUP (8U) /**< Defines the number of ADC channels per group */ + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +typedef uint16_t XMC_VADC_RESULT_SIZE_t; /**< Type defined the converted result size to unsigned 16 bit integer */ +typedef VADC_GLOBAL_TypeDef XMC_VADC_GLOBAL_t; /**< Type defined the device header file vadc global register structure + type to VADC type*/ + +#if(XMC_VADC_GROUP_AVAILABLE == 1U) +typedef VADC_G_TypeDef XMC_VADC_GROUP_t; /**< Type defined the device header file vadc group register structure + type to VADC Group type*/ +#endif + +#if(XMC_VADC_SHS_AVAILABLE == 1U) +typedef SHS_Type XMC_VADC_GLOBAL_SHS_t; /**< Type defined the sample and hold register structure*/ +#endif +/** + * Defines the return status after execution of VADC specific API's. Use @ref XMC_VADC_STATUS_t for this enumeration. + */ +typedef enum XMC_VADC_STATUS +{ + XMC_VADC_STATUS_SUCCESS = 0, /**< Returned when the API has been able to fulfill the callers request */ + XMC_VADC_STATUS_ERROR /**< Returned when the API cannot fulfill the request */ +} XMC_VADC_STATUS_t; + +/** + * Defines the various service requests lines. Each group can raise up to 4 service requests independently. While + * all groups together have the possibility of raising 4 module wide service requests. Use @ref XMC_VADC_SR_t for this + * enumeration. + */ +typedef enum XMC_VADC_SR +{ + XMC_VADC_SR_GROUP_SR0 = 0, /**< Group specific Service Request-0 */ + XMC_VADC_SR_GROUP_SR1, /**< Group specific Service Request-1 */ + XMC_VADC_SR_GROUP_SR2, /**< Group specific Service Request-2 */ + XMC_VADC_SR_GROUP_SR3, /**< Group specific Service Request-3 */ + XMC_VADC_SR_SHARED_SR0, /**< Module Wide Common Service Request-0 */ + XMC_VADC_SR_SHARED_SR1, /**< Module Wide Common Service Request-1 */ + XMC_VADC_SR_SHARED_SR2, /**< Module Wide Common Service Request-2 */ + XMC_VADC_SR_SHARED_SR3 /**< Module Wide Common Service Request-3 */ +} XMC_VADC_SR_t; + +/** + * Defines the mode of operation of a channel, when an ongoing conversion gets interrupted in between. + * Use @ref XMC_VADC_STARTMODE_t for this enumeration. + */ +typedef enum XMC_VADC_STARTMODE +{ + XMC_VADC_STARTMODE_WFS = 0, /**< An ongoing conversion completes without interruption */ + XMC_VADC_STARTMODE_CIR, /**< An ongoing conversion can be interrupted and resumed later*/ + XMC_VADC_STARTMODE_CNR /**< An ongoing conversion can be interrupted and never resumed */ +} XMC_VADC_STARTMODE_t; + +/** + * Defines the edge sensitivity of the trigger signal which can assert a conversion. + * Use @ref XMC_VADC_TRIGGER_EDGE_t for this enumeration. + */ +typedef enum XMC_VADC_TRIGGER_EDGE +{ + XMC_VADC_TRIGGER_EDGE_NONE = 0, /**< No external trigger. Conversion request can be asserted by software */ + XMC_VADC_TRIGGER_EDGE_FALLING, /**< The falling edge of the external trigger can assert conversion request */ + XMC_VADC_TRIGGER_EDGE_RISING, /**< The rising edge of the external trigger can assert conversion request */ + XMC_VADC_TRIGGER_EDGE_ANY /**< Both the edges can assert conversion request */ +} XMC_VADC_TRIGGER_EDGE_t; + +/** + * Defines the external trigger input selection possibilities, to assert a conversion. Refer the VADC interconnects + * section of the reference manual for details of peripherals which can be used. Also refer xmc_vadc_map.h file for + * detailed definitions of the peripherals which can take the control of these enumeration items. + * Use @ref XMC_VADC_TRIGGER_INPUT_SELECT_t for this enumeration. + */ +typedef enum XMC_VADC_TRIGGER_INPUT_SELECT +{ + XMC_VADC_REQ_TR_A = 0, /**< Trigger select signal A */ + XMC_VADC_REQ_TR_B, /**< Trigger select signal B */ + XMC_VADC_REQ_TR_C, /**< Trigger select signal C */ + XMC_VADC_REQ_TR_D, /**< Trigger select signal D */ + XMC_VADC_REQ_TR_E, /**< Trigger select signal E */ + XMC_VADC_REQ_TR_F, /**< Trigger select signal F */ + XMC_VADC_REQ_TR_G, /**< Trigger select signal G */ + XMC_VADC_REQ_TR_H, /**< Trigger select signal H */ + XMC_VADC_REQ_TR_I, /**< Trigger select signal I */ + XMC_VADC_REQ_TR_J, /**< Trigger select signal J */ + XMC_VADC_REQ_TR_K, /**< Trigger select signal K */ + XMC_VADC_REQ_TR_L, /**< Trigger select signal L */ + XMC_VADC_REQ_TR_M, /**< Trigger select signal M */ + XMC_VADC_REQ_TR_N, /**< Trigger select signal N */ + XMC_VADC_REQ_TR_O, /**< Trigger select signal O */ + XMC_VADC_REQ_TR_P /**< Trigger select signal P */ + +} XMC_VADC_TRIGGER_INPUT_SELECT_t; + +/** + * Defines the external gating input selection possibilities, to gate the conversion requests. Refer the VADC + * interconnects section of the reference manual for details of peripherals which can be used. Also refer + * xmc_vadc_map.h file for detailed definitions of the peripherals which can take the control of these enumeration + * items. Use @ref XMC_VADC_GATE_INPUT_SELECT_t for this enumeration. + */ +typedef enum XMC_VADC_GATE_INPUT_SELECT +{ + XMC_VADC_REQ_GT_A = 0, /**< Gating select signal A */ + XMC_VADC_REQ_GT_B, /**< Gating select signal B */ + XMC_VADC_REQ_GT_C, /**< Gating select signal C */ + XMC_VADC_REQ_GT_D, /**< Gating select signal D */ + XMC_VADC_REQ_GT_E, /**< Gating select signal E */ + XMC_VADC_REQ_GT_F, /**< Gating select signal F */ + XMC_VADC_REQ_GT_G, /**< Gating select signal G */ + XMC_VADC_REQ_GT_H, /**< Gating select signal H */ + XMC_VADC_REQ_GT_I, /**< Gating select signal I */ + XMC_VADC_REQ_GT_J, /**< Gating select signal J */ + XMC_VADC_REQ_GT_K, /**< Gating select signal K */ + XMC_VADC_REQ_GT_L, /**< Gating select signal L */ + XMC_VADC_REQ_GT_M, /**< Gating select signal M */ + XMC_VADC_REQ_GT_N, /**< Gating select signal N */ + XMC_VADC_REQ_GT_O, /**< Gating select signal O */ + XMC_VADC_REQ_GT_P /**< Gating select signal P */ + +} XMC_VADC_GATE_INPUT_SELECT_t; + +/** + * Defines the condition for gating the conversion requests. It can be used to set the ENGT field + * of ASMR/BSMR/QMR register respectively for auto_scan/background_scan/queue request sources. + * Use @ref XMC_VADC_GATEMODE_t for this enumeration. + */ +typedef enum XMC_VADC_GATEMODE +{ + XMC_VADC_GATEMODE_BLOCK = 0, /**< External triggers are permanently blocked */ + XMC_VADC_GATEMODE_IGNORE, /**< External triggers are unconditionally passed */ + XMC_VADC_GATEMODE_ACTIVEHIGH, /**< External trigger is passed only if the gate signal is high */ + XMC_VADC_GATEMODE_ACTIVELOW /**< External trigger is passed only if the gate signal is low */ +} XMC_VADC_GATEMODE_t; + +/** + * Defines the conversion result handling mode. Use @ref XMC_VADC_DMM_t for this enumeration. + */ +typedef enum XMC_VADC_DMM +{ + XMC_VADC_DMM_REDUCTION_MODE = 0, /**< Standard Data reduction mode*/ + XMC_VADC_DMM_FILTERING_MODE, /**< Provide option to select Finite Impulse Response Filter (FIR) or + Infinite Impulse Response Filter (IIR)*/ + XMC_VADC_DMM_DIFFERENCE_MODE, /**< Difference mode is selected*/ +} XMC_VADC_DMM_t; + +/** + * Defines the conversion mode. It defines the resolution of conversion. Use XMC_VADC_CONVMODE_t for this enumeration. + */ +typedef enum XMC_VADC_CONVMODE +{ + XMC_VADC_CONVMODE_12BIT = 0, /**< Results of conversion are 12bits wide */ + XMC_VADC_CONVMODE_10BIT = 1, /**< Results of conversion are 10bits wide */ + XMC_VADC_CONVMODE_8BIT = 2, /**< Results of conversion are 8bits wide */ + XMC_VADC_CONVMODE_FASTCOMPARE = 5 /**< Input signal compared with a preset range */ +} XMC_VADC_CONVMODE_t; + +/** + * Defines the output of a fast compare mode. Use @ref XMC_VADC_FAST_COMPARE_t for + * this enumeration. + */ +typedef enum XMC_VADC_FAST_COMPARE +{ + XMC_VADC_FAST_COMPARE_LOW = 0, /**< Input lower than than programmed reference */ + XMC_VADC_FAST_COMPARE_HIGH , /**< Input higher than than programmed reference */ + XMC_VADC_FAST_COMPARE_UNKNOWN /**< Unknown, Conversion probably still ongoing */ +} XMC_VADC_FAST_COMPARE_t; + +/** + * Defines the type of scan request source to be used. It can choose between auto scan and background scan request + * source methods. Use @ref XMC_VADC_SCAN_TYPE_t for this enumeration. + */ +typedef enum XMC_VADC_SCAN_TYPE +{ + XMC_VADC_SCAN_TYPE_GROUPSCAN = 0, /**< Auto scan mode of operation selected. Also called as Group scan*/ + XMC_VADC_SCAN_TYPE_BACKGROUND /**< Background scan mode of operation selected. Also called as Global scan*/ +} XMC_VADC_SCAN_TYPE_t; + +/** + * Defines the behavior of load event for the scan request source. Use @ref XMC_VADC_SCAN_LOAD_t for this enumeration. + */ +typedef enum XMC_VADC_SCAN_LOAD +{ + XMC_VADC_SCAN_LOAD_OVERWRITE = 0, /**< The old set of channels is discarded in favor of the new set + awaiting conversion */ + XMC_VADC_SCAN_LOAD_COMBINE /**< The new set of channels are combined with the pending channels from + previous set */ +} XMC_VADC_SCAN_LOAD_t; + +/** + * Defines the conversion classes that can be selected for each channel. The enumeration members holds the group or + * global classes. The conversion classes decides the properties of conversion, like resolution, sampling time etc + * Use @ref XMC_VADC_CHANNEL_CONV_t for this enumeration. + */ + +typedef enum XMC_VADC_CHANNEL_CONV +{ + XMC_VADC_CHANNEL_CONV_GROUP_CLASS0 = 0, /**< Conversion property set-0 specific to the group */ + XMC_VADC_CHANNEL_CONV_GROUP_CLASS1, /**< Conversion property set-1 specific to the group */ + XMC_VADC_CHANNEL_CONV_GLOBAL_CLASS0, /**< Conversion property set-0, Module wide */ + XMC_VADC_CHANNEL_CONV_GLOBAL_CLASS1 /**< Conversion property set-1, Module wide */ +} XMC_VADC_CHANNEL_CONV_t; + +/** + * Defines the references to boundary values used for limit checking feature. Each of these can be assigned as + * either an upper bound or a lower bound. Use @ref XMC_VADC_CHANNEL_BOUNDARY_t for this enumeration. + */ + +typedef enum XMC_VADC_CHANNEL_BOUNDARY +{ + XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND0 = 0, /**< Group specific Boundary-0 value */ + XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND1, /**< Group specific Boundary-1 value */ + XMC_VADC_CHANNEL_BOUNDARY_GLOBAL_BOUND0, /**< Module wide Boundary-0 value */ + XMC_VADC_CHANNEL_BOUNDARY_GLOBAL_BOUND1 /**< Module wide Boundary-1 value */ +} XMC_VADC_CHANNEL_BOUNDARY_t; + +/** + * Defines the voltage which the capacitor is charged to. Used in Broken wire detection feature. Use + * @ref XMC_VADC_CHANNEL_BWDCH_t for this enumeration. + */ +typedef enum XMC_VADC_CHANNEL_BWDCH +{ + XMC_VADC_CHANNEL_BWDCH_VAGND = 0, /**< Capacitor pre-charged to ground*/ + XMC_VADC_CHANNEL_BWDCH_VAREF /**< Capacitor pre-charged to reference voltage*/ +} XMC_VADC_CHANNEL_BWDCH_t; + +/** + * Defines the criteria for event generation by the channel. Use @ref XMC_VADC_CHANNEL_EVGEN_t for this enumeration. + */ +typedef enum XMC_VADC_CHANNEL_EVGEN +{ + XMC_VADC_CHANNEL_EVGEN_NEVER = 0, /**< No event generated */ + XMC_VADC_CHANNEL_EVGEN_INBOUND = 1U, /**< Event generated when the result is within the normal range */ + XMC_VADC_CHANNEL_EVGEN_COMPHIGH = 1U, /**< Event generated when the result of fast compare operation is high */ + XMC_VADC_CHANNEL_EVGEN_OUTBOUND = 2U, /**< Event generated when the result is outside the normal range */ + XMC_VADC_CHANNEL_EVGEN_COMPLOW = 2U, /**< Event generated when the result result of fast compare operation is low */ + XMC_VADC_CHANNEL_EVGEN_ALWAYS = 3U /**< Event generated always after conversion - unconditionally */ +} XMC_VADC_CHANNEL_EVGEN_t; + +/** + * Defines the reference voltage selection for conversion. Use @ref XMC_VADC_CHANNEL_REF_t for this enumeration. + */ +typedef enum XMC_VADC_CHANNEL_REF +{ + XMC_VADC_CHANNEL_REF_INTREF = 0, /**< Internal VARef */ + XMC_VADC_CHANNEL_REF_ALT_CH0 /**< External voltage available on Channel-0 of the perticular group */ +} XMC_VADC_CHANNEL_REF_t; + +/** + * Defines the criteria for boundary flag assertion. Use @ref XMC_VADC_CHANNEL_BOUNDARY_CONDITION_t for this + * enumeration. + */ +typedef enum XMC_VADC_CHANNEL_BOUNDARY_CONDITION +{ + XMC_VADC_CHANNEL_BOUNDARY_CONDITION_ABOVE_BAND = 0, /**< Set Boundary condition criteria to assert above the band */ + XMC_VADC_CHANNEL_BOUNDARY_CONDITION_BELOW_BAND /**< Set Boundary condition criteria to assert below the band */ +} XMC_VADC_CHANNEL_BOUNDARY_CONDITION_t; + +/** + * Defines the event which can lead to a global service request assertion. Use @ref XMC_VADC_GLOBAL_EVENT_t for this + * enumeration. + */ +typedef enum XMC_VADC_GLOBAL_EVENT +{ + XMC_VADC_GLOBAL_EVENT_BKGNDSOURCE = VADC_GLOBEFLAG_SEVGLB_Msk, /**< Background scan request source event */ + XMC_VADC_GLOBAL_EVENT_RESULT = VADC_GLOBEFLAG_REVGLB_Msk /**< Global result event */ +} XMC_VADC_GLOBAL_EVENT_t; + +/** + * Defines the power modes of a VADC Group. Use @ref XMC_VADC_GROUP_POWERMODE_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_POWERMODE +{ + XMC_VADC_GROUP_POWERMODE_OFF = 0, /**< Group is powered down */ + XMC_VADC_GROUP_POWERMODE_RESERVED1, /**< Reserved */ + XMC_VADC_GROUP_POWERMODE_RESERVED2, /**< Reserved */ + XMC_VADC_GROUP_POWERMODE_NORMAL /**< Group is powered up */ +} XMC_VADC_GROUP_POWERMODE_t; + +/** + * Defines the status of a VADC group (also known as kernel). Use @ref XMC_VADC_GROUP_STATE_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_STATE +{ + XMC_VADC_GROUP_STATE_IDLE = 0, /**< Idle and can convert if requested */ + XMC_VADC_GROUP_STATE_BUSY /**< Busy with an ongoing conversion */ +} XMC_VADC_GROUP_STATE_t; + +/** + * Defines the reference to sample time and conversion mode settings. Use @ref XMC_VADC_GROUP_CONV_t for this + * enumeration. + */ +typedef enum XMC_VADC_GROUP_CONV +{ + XMC_VADC_GROUP_CONV_STD = 0, /**< Settings pertaining to channels directly attached to VADC module */ + XMC_VADC_GROUP_CONV_EMUX /**< Settings pertaining to channels connected to VADC via EMUX */ +} XMC_VADC_GROUP_CONV_t; + +/** + * Defines the request source arbiter behavior. Use @ref XMC_VADC_GROUP_ARBMODE_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_ARBMODE +{ + XMC_VADC_GROUP_ARBMODE_ALWAYS = 0, /**< Arbiter runs all the time */ + XMC_VADC_GROUP_ARBMODE_ONDEMAND /**< Arbiter runs only if a conversion request is asserted by any of the + request sources */ +} XMC_VADC_GROUP_ARBMODE_t; + +/** + * Defines the EMUX mode of operation. Use @ref XMC_VADC_GROUP_EMUXMODE_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_EMUXMODE +{ + XMC_VADC_GROUP_EMUXMODE_SWCTRL = 0, /**< Perform EMUX in Software control mode*/ + XMC_VADC_GROUP_EMUXMODE_STEADYMODE, /**< Perform EMUX in Steady mode (Use EMUX set value)*/ + XMC_VADC_GROUP_EMUXMODE_SINGLEMODE, /**< Perform EMUX in Single step mode*/ + XMC_VADC_GROUP_EMUXMODE_SEQUENCEMODE, /**< Perform EMUX in Sequence mode*/ +} XMC_VADC_GROUP_EMUXMODE_t; + +/** + * Defines the EMUX channel selection encoding scheme. Use @ref XMC_VADC_GROUP_EMUXCODE_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_EMUXCODE +{ + XMC_VADC_GROUP_EMUXCODE_BINARY = 0, /**< A linearly incrementing code serves are MUX-SEL */ + XMC_VADC_GROUP_EMUXCODE_GRAY /**< The MUX-SEL is gray encoded */ +} XMC_VADC_GROUP_EMUXCODE_t; + +/** + * Defines the service request set used. Use @ref XMC_VADC_GROUP_IRQ_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_IRQ +{ + XMC_VADC_GROUP_IRQ_KERNEL = 0, /**< Refers to Group specific service request */ + XMC_VADC_GROUP_IRQ_SHARED /**< Refers to Module wide service request */ +} XMC_VADC_GROUP_IRQ_t; + +/** + * Defines the alignment of the converted result. Use @ref XMC_VADC_RESULT_ALIGN_t for this enumeration. + */ +typedef enum XMC_VADC_RESULT_ALIGN +{ + XMC_VADC_RESULT_ALIGN_LEFT = 0, /**< Always align result to left */ + XMC_VADC_RESULT_ALIGN_RIGHT /**< Always align result to right */ +} XMC_VADC_RESULT_ALIGN_t; + +typedef enum XMC_VADC_RESULT_SUBTRATION +{ + XMC_VADC_RESULT_SUBTRATION_12BIT_LEFT_ALIGN = 0U, /**< Always align result to left */ + XMC_VADC_RESULT_SUBTRATION_12BIT_RIGHT_ALIGN = 0U, /**< Always align result to right */ + XMC_VADC_RESULT_SUBTRATION_10BIT_LEFT_ALIGN = 2U, /**< Always align result to left */ + XMC_VADC_RESULT_SUBTRATION_10BIT_RIGHT_ALIGN = 0U, /**< Always align result to right */ + XMC_VADC_RESULT_SUBTRATION_8BIT_LEFT_ALIGN = 4U, /**< Always align result to left */ + XMC_VADC_RESULT_SUBTRATION_8BIT_RIGHT_ALIGN = 0U, /**< Always align result to right */ +} XMC_VADC_RESULT_SUBTRATION_t; + +/** + * Defines the request source arbitration priority. Use @ref XMC_VADC_GROUP_RS_PRIORITY_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_RS_PRIORITY +{ + XMC_VADC_GROUP_RS_PRIORITY_0 = 0, /**< Lowest priority for the request source*/ + XMC_VADC_GROUP_RS_PRIORITY_1, /**< Second lowest priority for the request source*/ + XMC_VADC_GROUP_RS_PRIORITY_2, /**< Second highest priority for the request source*/ + XMC_VADC_GROUP_RS_PRIORITY_3, /**< Highest priority for the request source*/ +}XMC_VADC_GROUP_RS_PRIORITY_t; + +/** + * Defines the various modes for the boundary flag. Use @ref XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_BOUNDARY_FLAG_MODE +{ + XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_DISABLED = 0, /**< Disable boundary flag*/ + XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_ENABLED, /**< Always enable boundary*/ + XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_ENABLED_ACTIVE_LOW, /**< Enable boundary flag when gate level is 0*/ + XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_ENABLED_ACTIVE_HIGH /**< Enable boundary flag when gate level is 1*/ +}XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_t; + + +/** + * Defines the boundary select for Channel. Use @ref XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_t for this enumeration. + */ +typedef enum XMC_VADC_BOUNDARY_SELECT +{ + XMC_VADC_BOUNDARY_SELECT_LOWER_BOUND = 0U, /**< Select the lower boundary*/ + XMC_VADC_BOUNDARY_SELECT_UPPER_BOUND = 2U /**< Selects the upper boundary*/ +}XMC_VADC_BOUNDARY_SELECT_t; + + +/** + * Defines the group indices. Use @ref XMC_VADC_GROUP_INDEX_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_INDEX +{ + XMC_VADC_GROUP_INDEX_0 = 0, + XMC_VADC_GROUP_INDEX_1, +#if (XMC_VADC_MAXIMUM_NUM_GROUPS > 2U) + XMC_VADC_GROUP_INDEX_2, + XMC_VADC_GROUP_INDEX_3 +#endif +}XMC_VADC_GROUP_INDEX_t; + +/** +* Defines channel alias. +* All enum items are available for channels 0 and 1. Other Channels can accept only XMC_VADC_CHANNEL_ALIAS_DISABLED. +*/ +typedef enum XMC_VADC_CHANNEL_ALIAS +{ + XMC_VADC_CHANNEL_ALIAS_DISABLED = -1, + XMC_VADC_CHANNEL_ALIAS_CH0 = 0, + XMC_VADC_CHANNEL_ALIAS_CH1 = 1, + XMC_VADC_CHANNEL_ALIAS_CH2 = 2, + XMC_VADC_CHANNEL_ALIAS_CH3 = 3, + XMC_VADC_CHANNEL_ALIAS_CH4 = 4, + XMC_VADC_CHANNEL_ALIAS_CH5 = 5, + XMC_VADC_CHANNEL_ALIAS_CH6 = 6, + XMC_VADC_CHANNEL_ALIAS_CH7 = 7 +} XMC_VADC_CHANNEL_ALIAS_t; + +#if(XMC_VADC_SHS_AVAILABLE == 1U) + +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) +/** + * Defines the gain calibration selection. + */ +typedef enum XMC_VADC_SHS_GAIN_LEVEL +{ + XMC_VADC_SHS_GAIN_LEVEL_0 = SHS_CALOC0_CALOFFVAL0_Pos, /**< Select the calibration value for gain level 0 */ + XMC_VADC_SHS_GAIN_LEVEL_1 = SHS_CALOC0_CALOFFVAL1_Pos, /**< Select the calibration value for gain level 1 */ + XMC_VADC_SHS_GAIN_LEVEL_2 = SHS_CALOC0_CALOFFVAL2_Pos, /**< Select the calibration value for gain level 2 */ + XMC_VADC_SHS_GAIN_LEVEL_3 = SHS_CALOC0_CALOFFVAL3_Pos /**< Select the calibration value for gain level 3 */ +}XMC_VADC_SHS_GAIN_LEVEL_t; +#endif + +/** + * Defines the Delta sigma loop. + */ +typedef enum XMC_VADC_SHS_LOOP_CH +{ + XMC_VADC_SHS_LOOP_CH_0 = SHS_LOOP_LPCH0_Pos, /**< Select Delta-sigma loop 0*/ + XMC_VADC_SHS_LOOP_CH_1 = SHS_LOOP_LPCH1_Pos /**< Select Delta-sigma loop 1*/ +}XMC_VADC_SHS_LOOP_CH_t; + +/** + * Provides the order in which the SHS should do the calibration + */ +typedef enum XMC_VADC_GLOBAL_SHS_CALIBRATION_ORDER +{ + XMC_VADC_GLOBAL_SHS_CALIBRATION_ORDER_POST_CONV = 0, /**< Calibration occur after conversion takes place */ + XMC_VADC_GLOBAL_SHS_CALIBRATION_ORDER_PRE_CONV /**< Calibration occur before conversion takes place */ +}XMC_VADC_GLOBAL_SHS_CALIBRATION_ORDER_t; +#endif + +#if (XMC_VADC_BOUNDARY_FLAG_SELECT == 1U) +/** + * Provides possible routing values for the boundary flag. + */ +typedef enum XMC_VADC_BOUNDARY_NODE +{ + XMC_VADC_BOUNDARY_NODE_COMMON_BOUNDARY_FLAG_0 = 0U, /** 2U) + XMC_VADC_SYNCTR_EVAL_2 = VADC_G_SYNCTR_EVALR2_Msk, /**Range:[0x0 to 0x7] */ + uint32_t refill_needed : 1; /**< Conversion completed channel gets inserted back into the queue */ + uint32_t generate_interrupt : 1; /**< Generates a queue request source event */ + uint32_t external_trigger : 1; /**< Conversion requests are raised on an external trigger. */ + uint32_t : 24; + + }; + uint32_t qinr0; + }; +} XMC_VADC_QUEUE_ENTRY_t; + +/** + * Structure initializing a VADC queue request source. Use type @ref XMC_VADC_QUEUE_CONFIG_t. + */ +typedef struct XMC_VADC_QUEUE_CONFIG +{ + uint32_t conv_start_mode : 2; /**< One converter is shared between the queue and scan request sources of the same + group. This field determines how queue request source would request for + conversion. Uses @ref XMC_VADC_STARTMODE_t */ + uint32_t req_src_priority : 2; /**< Request source priority for the arbiter.Uses @ref XMC_VADC_GROUP_RS_PRIORITY_t */ + union + { + struct + { +#if(XMC_VADC_GROUP_SRCREG_AVAILABLE == (1U)) + uint32_t src_specific_result_reg : 4; /**< Uses any one Group related result register as the destination + for all conversions results. To use the individual result register + from each channel configuration, configure this field with 0x0 */ +#else + uint32_t : 4; +#endif + uint32_t : 4; + uint32_t trigger_signal : 4; /**< Select one of the 16 possibilities for trigger. + Uses @ref XMC_VADC_TRIGGER_INPUT_SELECT_t */ + uint32_t : 1; + uint32_t trigger_edge : 2; /**< Edge selection for trigger signal. + Uses @ref XMC_VADC_TRIGGER_EDGE_t */ + uint32_t : 1; + uint32_t gate_signal : 4; /**< Select one of the 16 possibilities for gating. + Uses @ref XMC_VADC_GATE_INPUT_SELECT_t */ + uint32_t : 8; + uint32_t timer_mode : 1; /**< Timer mode for equi-distant sampling shall be activated or not? */ + uint32_t : 3; + }; + uint32_t qctrl0; + }; + union + { + struct + { + uint32_t : 2; + uint32_t external_trigger : 1; /**< Are external triggers supported? */ + uint32_t : 29; + }; + uint32_t qmr0; + }; +} XMC_VADC_QUEUE_CONFIG_t; + + +/** + * Structure to initialize the global input class configuration. Configured parameters are sample time and + * conversion Mode. + */ +typedef struct XMC_VADC_GLOBAL_CLASS +{ + union + { + struct + { + uint32_t sample_time_std_conv : 5; /**< Sample time for channels directly connected to VADC +
Range: [0x0 to 0x1F] */ + uint32_t : 3; + uint32_t conversion_mode_standard : 3; /**< Conversion mode for channels directly connected to VADC. + Uses @ref XMC_VADC_CONVMODE_t */ + uint32_t : 5; +#if(XMC_VADC_EMUX_AVAILABLE == 1U) + uint32_t sampling_phase_emux_channel : 5; /**< Sample time for channels connected via EMUX +
Range: [0x0 to 0x1F] */ + uint32_t : 3; + uint32_t conversion_mode_emux : 3; /**< Conversion mode for channels connected via EMUX to VADC. + Uses @ref XMC_VADC_CONVMODE_t */ + uint32_t : 5; +#else + uint32_t : 16; +#endif + }; + uint32_t globiclass; + }; +} XMC_VADC_GLOBAL_CLASS_t; + +#if (XMC_VADC_GROUP_AVAILABLE != 0U) +/** + * Structure to initialize converter and arbiter clock configuration + */ +typedef struct XMC_VADC_GLOBAL_CLOCK +{ + union + { + struct + { + + uint32_t analog_clock_divider : 5; /**< Clock for the converter.
Range: [0x0 to 0x1F] */ + uint32_t : 2; + uint32_t msb_conversion_clock : 1; /**< Additional clock cycle for analog converter */ + uint32_t arbiter_clock_divider : 2; /**< Request source arbiter clock divider.
Range: [0x0 to 0x3] */ + uint32_t : 5; + uint32_t : 17; + }; + uint32_t globcfg; + }; +} XMC_VADC_GLOBAL_CLOCK_t; +#endif + + +/** + * Structure to initialize the VADC Global functions + */ +typedef struct XMC_VADC_GLOBAL_CONFIG +{ + union + { + struct + { + uint32_t boundary0 : 12; /**< Boundary value for results comparison*/ + uint32_t : 4; + uint32_t boundary1 : 12; /**< Boundary value for results comparison*/ + uint32_t : 4; + }; + uint32_t globbound; + }; +#if (XMC_VADC_GROUP_AVAILABLE != 0U) + XMC_VADC_GLOBAL_CLOCK_t clock_config; /**< ADC clock configurations*/ +#endif + XMC_VADC_GLOBAL_CLASS_t class0; /**< ADC input conversion configurations for GLOBICLASS[0]*/ + XMC_VADC_GLOBAL_CLASS_t class1; /**< ADC input conversion configurations for GLOBICLASS[1]*/ + union + { + struct + { + uint32_t : 16; + uint32_t data_reduction_control : 4; /**< Data reduction stages */ + uint32_t : 4; + uint32_t wait_for_read_mode : 1; /**< Results of the next conversion will not be overwritten in the + result register until the previous value is read*/ + uint32_t : 6; + uint32_t event_gen_enable : 1; /**< Generates an event on availability of new result. */ + }; + uint32_t globrcr; + }; + union + { + struct + { + uint32_t module_disable : 1; /**< Disables the module clock.*/ + uint32_t : 2; + uint32_t disable_sleep_mode_control : 1; /**< Set it to true in order to disable the Sleep mode */ + uint32_t : 28; + }; + uint32_t clc; + }; +} XMC_VADC_GLOBAL_CONFIG_t; + + +/** + * Structure to initialize the group input class configuration. Configured parameters are sample time and + * conversion Mode. + */ +typedef struct XMC_VADC_GROUP_CLASS +{ + union + { + struct + { + uint32_t sample_time_std_conv : 5; /**< Sample time for channels directly connected to VADC +
Range: [0x0 to 0x1F] */ + uint32_t : 3; + uint32_t conversion_mode_standard : 3; /**< Conversion mode for channels directly connected to VADC. + Uses @ref XMC_VADC_CONVMODE_t */ + uint32_t : 5; + uint32_t sampling_phase_emux_channel : 5; /**< Sample time for channels connected via EMUX +
Range: [0x0 to 0x1F] */ + uint32_t : 3; + uint32_t conversion_mode_emux : 3; /**< Conversion mode for channels connected via EMUX to VADC. + Uses @ref XMC_VADC_CONVMODE_t */ + uint32_t : 5; + }; + uint32_t g_iclass0; + }; +} XMC_VADC_GROUP_CLASS_t; + + +/** + * EMUX related configuration structure. + */ +typedef struct XMC_VADC_GROUP_EMUXCFG +{ + union + { + struct + { + uint32_t starting_external_channel : 3; /**< External channel number to which the VADC will + generate a control signal (needed to select the analog input in + the analog multiplexer)*/ + uint32_t : 13; +#if (XMC_VADC_EMUX_CH_SEL_STYLE == 1U) + uint32_t connected_channel : 10; /**< The Channel to which the EMUX is connected. */ +#else + uint32_t connected_channel : 5; /**< The Channel to which the EMUX is connected. */ + uint32_t : 5; +#endif + uint32_t emux_mode : 2; /**< Selects the external multiplexer modes: Steady, Single Mode, step etc + Uses @ref XMC_VADC_GROUP_EMUXMODE_t*/ + uint32_t emux_coding : 1; /**< Select Binary or Gray coding. Uses @ref XMC_VADC_GROUP_EMUXCODE_t*/ + uint32_t stce_usage : 1; /**< Use STCE for each conversion of an external channel */ +#if (XMC_VADC_EMUX_CH_SEL_STYLE == 1U) + uint32_t emux_channel_select_style : 1; /**< Selects the style of configuring the \b connected_channel + (Each bit represents the channel or entire field represents the channel number ) */ + uint32_t : 1; +#else + uint32_t : 2; +#endif + }; + uint32_t g_emuxctr; + }; +} XMC_VADC_GROUP_EMUXCFG_t; + + +/** + * Group Configuration Data Structures + */ + +typedef struct XMC_VADC_GROUP_CONFIG +{ + XMC_VADC_GROUP_EMUXCFG_t emux_config; /**< External multiplexer related configurations */ + XMC_VADC_GROUP_CLASS_t class0; /**< ADC input conversion configurations for GxICLASS[0]*/ + XMC_VADC_GROUP_CLASS_t class1; /**< ADC input conversion configurations for GxICLASS[1]*/ + union + { + struct + { + uint32_t boundary0 : 12; /**< Boundary value for results comparison*/ + uint32_t : 4; + uint32_t boundary1 : 12; /**< Boundary value for results comparison*/ + uint32_t : 4; + }; + uint32_t g_bound; + }; + union + { + struct + { + uint32_t : 4; + uint32_t arbitration_round_length : 2; /**< Number of arbiter slots to be considered */ + uint32_t : 1; + uint32_t arbiter_mode : 1; /**< Arbiter mode - Select either Continuous mode or Demand based. + Uses @ref XMC_VADC_GROUP_ARBMODE_t */ + uint32_t : 24; + }; + uint32_t g_arbcfg; + }; +} XMC_VADC_GROUP_CONFIG_t; + +/** + * Structure to initialize VADC Group result register. + */ + +typedef struct XMC_VADC_RESULT_CONFIG +{ + union + { + struct + { + uint32_t : 16; + uint32_t data_reduction_control : 4; /**< Configures the data reduction stages */ + uint32_t post_processing_mode : 2; /**< Result data processing mode. Uses @ref XMC_VADC_DMM_t + For normal operation select + XMC_VADC_DMM_t::XMC_VADC_DMM_REDUCTION_MODE + and data_reduction_control as 0*/ + uint32_t : 2; + uint32_t wait_for_read_mode : 1; /**< Allow the conversion only after previous results are read*/ + uint32_t part_of_fifo : 2; /**< Make the result register a part of Result FIFO? */ + uint32_t : 4; + uint32_t event_gen_enable : 1; /**< Generates an event on availability of new result. */ + }; + uint32_t g_rcr; + }; +} XMC_VADC_RESULT_CONFIG_t; + +#if(XMC_VADC_SHS_AVAILABLE == 1U) +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) +/** + * Structure to initialize the Stepper configurations + */ +typedef struct XMC_VADC_GLOBAL_SHS_STEP_CONFIG +{ + union + { + struct + { + uint32_t sh_unit_step0 :3; /**< Select a Sample and hold unit for the stepper's step number 0. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step0 :1; /**< Should the step be added to the sequence */ + uint32_t sh_unit_step1 :3; /**< Select a Sample and hold unit for the stepper's step number 1. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step1 :1; /**< Should the step be added to the sequence */ + uint32_t sh_unit_step2 :3; /**< Select a Sample and hold unit for the stepper's step number 2. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step2 :1; /**< Should the step be added to the sequence */ + uint32_t sh_unit_step3 :3; /**< Select a Sample and hold unit for the stepper's step number 3. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step3 :1; /**< Should the step be added to the sequence */ + uint32_t sh_unit_step4 :3; /**< Select a Sample and hold unit for the stepper's step number 4. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step4 :1; /**< Should the step be added to the sequence */ + uint32_t sh_unit_step5 :3; /**< Select a Sample and hold unit for the stepper's step number 5. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step5 :1; /**< Should the step be added to the sequence */ + uint32_t sh_unit_step6 :3; /**< Select a Sample and hold unit for the stepper's step number 6. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step6 :1; /**< Should the step be added to the sequence */ + uint32_t sh_unit_step7 :3; /**< Select a Sample and hold unit for the stepper's step number 7. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step7 :1; /**< Should the step be added to the sequence */ + + }; + uint32_t stepcfg; + }; +}XMC_VADC_GLOBAL_SHS_STEP_CONFIG_t; +#endif +/** + * Sample and hold Initialization structure + */ +typedef struct XMC_VADC_GLOBAL_SHS_CONFIG +{ + union + { + struct + { + uint32_t shs_clock_divider :4; /**< The divider value for the SHS clock. Range: [0x0 to 0xF]*/ + uint32_t :6; + uint32_t analog_reference_select :2; /**< It is possible to different reference voltage for the SHS module + */ + uint32_t :20; + }; + uint32_t shscfg; + }; +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) + XMC_VADC_GLOBAL_SHS_CALIBRATION_ORDER_t calibration_order; /**< order in which the calibration should be taken up*/ +#endif +}XMC_VADC_GLOBAL_SHS_CONFIG_t; + +#endif +/** + * Detailed result structure + */ + typedef struct XMC_VADC_DETAILED_RESULT +{ + union + { + struct + { + uint32_t result :16; /**< Result of the Analog to digital conversion*/ + uint32_t data_reduction_counter :4; /**< Results reduction counter value*/ + uint32_t channel_number :5; /**< Converted channel number*/ + uint32_t emux_channel_number :3; /**< Converted external multiplexer channel number. + Only applicable for GxRES[0] result register*/ + uint32_t converted_request_source :2; /**< Converted request source*/ + uint32_t fast_compare_result :1; /**< Fast compare result if conversion mode is fast compare mode.*/ + uint32_t vaild_result :1; /**< Valid flag is set when a new result is available*/ + }; + uint32_t res; + }; +}XMC_VADC_DETAILED_RESULT_t; + + +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif +/********************************************************************************************************************* + * static inline functions + ********************************************************************************************************************/ + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) +__STATIC_INLINE bool XMC_VADC_CHECK_GROUP_PTR(XMC_VADC_GROUP_t *const group_ptr) +{ +#if (XMC_VADC_MAXIMUM_NUM_GROUPS == 4U) + return((group_ptr == VADC_G0) || (group_ptr == VADC_G1) || (group_ptr == VADC_G2) || (group_ptr == VADC_G3)); +#else + return((group_ptr == VADC_G0) || (group_ptr == VADC_G1)); +#endif +} +#endif +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * Enables the VADC module.
\n + * This API would ungate the clock to the VADC module (if applicable). Also this API would bring + * the VADC module out of reset state(if applicable), by asserting the appropriate registers. + * This API would invoke XMC_SCU_CLOCK_UngatePeripheralClock() and XMC_SCU_RESET_DeassertPeripheralReset() + * if needed. Directly accessed register is COMPARATOR.ORCCTRL (Refer to the errata for XMC1100). + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_DisableModule(). + */ +void XMC_VADC_GLOBAL_EnableModule(void); + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * Disables the VADC module.
\n + * This API would gate the clock to the VADC module (if applicable). Also this API would put + * the VADC module into the reset state(if applicable) by asserting the appropriate registers. + * This API would invoke XMC_SCU_CLOCK_GatePeripheralClock() and XMC_SCU_RESET_AssertPeripheralReset() if needed. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_EnableModule(). + */ +void XMC_VADC_GLOBAL_DisableModule(void); + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * @param config Pointer to initialization data structure + * + * @return None + * + * \parDescription:
+ * Initializes the VADC global module with the associated configuration structure pointed by \a config.\n\n It + * enables the global access to registers by configuring reset and clock un-gating for selected devices. It + * initializes global class, boundary , result resources by setting GLOBICLASS,GLOBBOUND,GLOBRCR registers. It also + * configures the global analog and digital clock dividers by setting GLOBCFG register. Refer related API's to change + * the configurations later in the program. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_ClockInit()
+ */ +void XMC_VADC_GLOBAL_Init(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_GLOBAL_CONFIG_t *config); + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return None + * + * \parDescription:
+ * Enables the VADC module clock.\n\n Call this API before any further configuration of VADC. It sets the DISR bit of CLC + * register to enable. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_Init() + * + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_EnableModuleClock(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_Enable:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->CLC &= ~((uint32_t)VADC_CLC_DISR_Msk); +} + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return None + * + * \parDescription:
+ * Disables the VADC module clock.\n\n After this API call, no conversion will occur. Call + * XMC_VADC_GLOBAL_EnableModuleClock() to enable the VADC module later in the program. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_Init() + * + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_DisableModuleClock(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_Disable:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->CLC |= (uint32_t) ((uint32_t)1 << VADC_CLC_DISR_Pos); +} + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return None + * + * \parDescription:
+ * Enables VADC module to sleep if a sleep request comes.\n\n + * It resets the EDIS bit of CLC register for enabling the sleep mode. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_DisableSleepMode(). + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_EnableSleepMode(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_EnableSleepMode:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->CLC &= ~((uint32_t)VADC_CLC_EDIS_Msk); +} + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return None + * + * \parDescription:
+ * Ignores the sleep mode request for the VADC.\n\n + * With the sleep feature enabled, the module will respond to sleep + * requests by going into a low power mode. It resets the EDIS bit of CLC register for enabling the sleep mode. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_EnableSleepMode(). + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_DisableSleepMode(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_DisableSleepMode:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->CLC |= (uint32_t) ((uint32_t)1 << VADC_CLC_EDIS_Pos); +} + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) +/** + * + * @param global_ptr Constant pointer to the VADC module. + * @param config Pointer to the data structure containing clock configuration data + * + * @return None + * + * \parDescription:
+ * Configures the VADC clock.
\n + * Sets up the clock configuration of the VADC module using the config structure pointed by \a config. + * The clock to the analog converter and to the request source arbiter is configured by setting the GLOBCFG register. + * + * \parRelated APIs:
+ * None + * + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_ClockInit(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_GLOBAL_CLOCK_t *config) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_ClockInit:Wrong Module Pointer", (global_ptr == VADC)) + + /* Write the Clock configuration into the GLOBCFG register */ + global_ptr->GLOBCFG = (uint32_t)(config->globcfg | (VADC_GLOBCFG_DIVWC_Msk)); +} +#endif + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * @param config Conversion class parameter structure + * @param conv_type configure the input call for either standard conversion or EMUX related conversion. + * @param set_num Conversion class set
+ * Range: [0x0, 0x1] + * + * \parDescription:
+ * Configures the ADC conversion settings like sample time and resolution.
\n + * Sets up the conversion settings for vadc global resource associated with \a config structure. It configures the + * conversion class properties like sampling time and resolution for selected \a conv_type channels. It initializes + * the GLOBALICLASS register specified by \a set_num with the required settings. + * + * + * \parRelated APIs:
+ * None + * + */ + +void XMC_VADC_GLOBAL_InputClassInit(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_GLOBAL_CLASS_t config, + const XMC_VADC_GROUP_CONV_t conv_type, const uint32_t set_num); + +/** + * + * @param global_ptr Constant pointer to the VADC global module + * @param config Pointer to result configuration data structure + * + * @return None + * + * \parDescription:
+ * Initializes global result register.
\n + * Initializes Global Result Register with specified settings configured in the \a config structure.\n\n This API + * results in configuration of GLOBRCR register. This helps in configuring the Data reduction mode, global result event + * , wait for read mode on the GLOBRES register. + * + * + * \parRelated APIs:
+ * None + * + */ + + __STATIC_INLINE void XMC_VADC_GLOBAL_ResultInit(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_RESULT_CONFIG_t *config) + { + XMC_ASSERT("XMC_VADC_GLOBAL_ResultInit:Wrong Module Pointer", (global_ptr == VADC)) + + /* Configure GLOBRCR*/ + global_ptr->GLOBRCR = config->g_rcr; + } + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return None + * + * \parDescription:
+ * Enables the startup calibration feature of the VADC module.\n\n It configures the SUCAL bit of GLOBCFG register to + * enable the startup calibration feature. After turning it on, it loops until all active groups finish calibration. + * Call XMC_VADC_GLOBAL_Enable() and XMC_VADC_GLOBAL_ClockInit() before calling this API in sequence. Calling the API + * XMC_VADC_GLOBAL_DisableStartupCalibration() can disable the calibration feature at runtime. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_Enable()
+ * XMC_VADC_GLOBAL_ClockInit()
+ * None + */ +void XMC_VADC_GLOBAL_StartupCalibration(XMC_VADC_GLOBAL_t *const global_ptr); + + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return None + * + * \parDescription:
+ * Disables the startup calibration feature of the VADC module.\n\n It configures the SUCAL bit of GLOBCFG register to + * disable the startup calibration feature. Calling the API XMC_VADC_GLOBAL_EnsableStartupCalibration() can enable the + * calibration feature at runtime. + * + * \parRelated APIs:
+ * None + */ + +__STATIC_INLINE void XMC_VADC_GLOBAL_DisableStartupCalibration(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_DisableStartupCalibration:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->GLOBCFG &= ~((uint32_t)VADC_GLOBCFG_SUCAL_Msk); +} + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param group_number group number whose post calibration feature is to be disabled.
+ * Range[0x0 to 0x3] Accepts the enum ::XMC_VADC_GROUP_INDEX_t + * + * @return None + * + * \parDescription:
+ * Disables the post calibration for a particular group specified as \a group_number.\n\n It configures the DPCAL0 bit + * of GLOBCFG register to disable the post calibration feature. Call XMC_VADC_GLOBAL_Enable() and + * XMC_VADC_GLOBAL_ClockInit() before calling this API in sequence. Calling the API + * XMC_VADC_GLOBAL_EnablePostCalibration() can enable back the calibration feature at runtime. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_Enable()
+ * XMC_VADC_GLOBAL_ClockInit()
+ * XMC_VADC_GLOBAL_DisablePostCalibration()
+ * None + */ + +__STATIC_INLINE void XMC_VADC_GLOBAL_DisablePostCalibration(XMC_VADC_GLOBAL_t *const global_ptr, uint32_t group_number) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_DisablePostCalibration:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->GLOBCFG |= (uint32_t)((uint32_t)1 << ((uint32_t)VADC_GLOBCFG_DPCAL0_Pos + group_number)); +} + +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param group_number group number whose post calibration feature is to be enabled.
+ * Range[0x0 to 0x3] Accepts the enum ::XMC_VADC_GROUP_INDEX_t + * + * @return None + * + * \parDescription:
+ * Enables the post calibration for a particular group specified as \a group_number.\n\n It configures the DPCAL0 bit + * of GLOBCFG register to enable the post calibration feature. Calling the API XMC_VADC_GLOBAL_DisablePostCalibration() + * can disable the calibration feature at runtime. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_DisablePostCalibration()
+ * None + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_EnablePostCalibration(XMC_VADC_GLOBAL_t *const global_ptr, uint32_t group_number) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_EnablePostCalibration:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->GLOBCFG &= (~ (uint32_t)((uint32_t)1 << ((uint32_t)VADC_GLOBCFG_DPCAL0_Pos + group_number))); +} +#endif + +#if (XMC_VADC_BOUNDARY_AVAILABLE == 1U) +/** + * + * @param global_ptr Constant pointer to the VADC module. + * @param boundary0 Boundary-0 Value
Range[0 - 4095] + * @param boundary1 Boundary-1 Value
Range[0 - 4095] + * + * @return None + * + * \parDescription:
+ * Programs the boundaries with \a boundary0 and boundary1 for result comparison.\n\n These two boundaries can serve as + * absolute boundaries. They define a range against which the result of a conversion can be compared. In the + * fast compare mode, the two boundaries provide hysteresis capability to a compare value. In any case, these boundary + * values entered here form a boundary pallete. There are dedicated upper and lower boundary registers GLOBBOUND0 and + * GLOBBOUND1 who will derive their values from this palette. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_VADC_GLOBAL_SetBoundaries(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t boundary0, const uint32_t boundary1); + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * @param selection The boundary value selected for \b boundary_value. + * @param boundary_value Boundary Value
Range[0 - 4095] + * + * @return None + * + * \parDescription:
+ * Programs either the boundary 0 or boundary 1 for result comparison.\n\n This defines a range against which + * the result of a conversion can be compared. In the fast compare mode, the two boundaries provide hysteresis + * capability to a compare value. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_VADC_GLOBAL_SetIndividualBoundary(XMC_VADC_GLOBAL_t *const global_ptr, + const XMC_VADC_CHANNEL_BOUNDARY_t selection, + const uint16_t boundary_value); +#endif + +#if (XMC_VADC_EMUX_AVAILABLE== 1U) +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param emuxif The EMUX interface
Range[0x0 - 0x1] + * @param group The VADC group which must be bound to the desired emux + * + * @return None + * + * \parDescription:
+ * Binds a VADC \a group to an EMUX interface specified in \a emuxif.
\n + * Selects which group's scan request source will control the EMUX interface (set of control select lines for the EMUX). + * By passing \b group it would configure that group's scan request source to control the EMUX select lines of the set + * \b emuxif. + * + * \parRelated APIs:
+ * None + */ +void XMC_VADC_GLOBAL_BindGroupToEMux(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t emuxif, const uint32_t group); +#endif + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return uint32_t Complete global result register value GLOBRES + * + * \parDescription:
+ * Retrieves the complete result from the global result register associated with the \a global_ptr.\n\n This API audits + * the result register GLOBRES for the validity of the data. If the validity is assured, data is first read + * the global result register, cached locally next and subsequently returned to the caller. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_GetResult() + */ +__STATIC_INLINE uint32_t XMC_VADC_GLOBAL_GetDetailedResult(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_GetDetailedResult:Wrong Module Pointer", (global_ptr == VADC)) + + return(global_ptr->GLOBRES); +} + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return XMC_VADC_RESULT_SIZE_t 16 bit result register value.
+ * Range[0x0 - 0X0FFF] + * + * \parDescription:
+ * Retrieves the conversion result from the global result register associated with the \a global_ptr.\n\n This is a + * lightweight version of XMC_VADC_GLOBAL_GetDetailedResult(). The behavior is exactly the same, just that it is + * only the 16 bit numeric result returned back to the application instead of the complete GLOBRES register value. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_GetDetailedResult() + */ +__STATIC_INLINE XMC_VADC_RESULT_SIZE_t XMC_VADC_GLOBAL_GetResult(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_GetResult:Wrong Module Pointer", (global_ptr == VADC)) + + return ((XMC_VADC_RESULT_SIZE_t)global_ptr->GLOBRES); +} + +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param compare_val Compare value which the result of a conversion will be compared against. + *
Range[0x0 - 0X0FFF] + * + * @return None + * + * \parDescription:
+ * Set compare value in the global result register for fast compare mode.\n\n The result of a conversion will directly + * be compared to the compare value entered as part of \a compare_val. The prerequisite is that the channel associated + * with this global register must select an ICLASS which has the conversion mode configured as fast compare mode. Call + * @ref XMC_VADC_GLOBAL_GetCompareResult() after this API to + * + * \parRelated APIs:
+ * None + */ +void XMC_VADC_GLOBAL_SetCompareValue(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_RESULT_SIZE_t compare_val); + +/** + * + * @param global_ptr Constant pointer to the VADC module + * @return compare high or low. Refer @ref XMC_VADC_FAST_COMPARE_t enum + * + * @return None + * + * \parDescription:
+ * Determines the result of fast compare operation.\n\n This API returns the result of fast compare operation provided + * the valid flag in the global result register GLOBRES is set. + * + * \parRelated APIs:
+ * None + */ +XMC_VADC_FAST_COMPARE_t XMC_VADC_GLOBAL_GetCompareResult(XMC_VADC_GLOBAL_t *const global_ptr); + +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param event_type Desired event that must be manually asserted + * Use the enum ::XMC_VADC_GLOBAL_EVENT_t to create a mask to be used with this argument + * @return None + * + * \parDescription:
+ * Manually asserts an event that can lead to an interrupt.\n\n This API manually asserts the requested event + * (Background request source event or a global result event) by setting the GLOBEVFLAG register with the specified + * \a event_type. + * + * \parRelated APIs:
+ * None + */ + +__STATIC_INLINE void XMC_VADC_GLOBAL_TriggerEvent(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t event_type) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_TriggerEvent:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_TriggerEvent:Wrong Global Event", + ((XMC_VADC_GLOBAL_EVENT_BKGNDSOURCE == event_type) || (XMC_VADC_GLOBAL_EVENT_RESULT == event_type))) + + global_ptr->GLOBEFLAG = event_type; +} + +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param event_type Event that must be acknowledged + * Use the enum ::XMC_VADC_GLOBAL_EVENT_t to create a mask to be used with this argument + * + * @return None + * + * \parDescription:
+ * Acknowledges an event that has been asserted manually or automatically.\n\n This API acknowledges the requested event + * by clearing GLOBEFLAG sticky flag. + * + * \parRelated APIs:
+ * None + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_ClearEvent(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t event_type) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_ClearEvent:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_ClearEvent:Wrong Global Event", + ((XMC_VADC_GLOBAL_EVENT_BKGNDSOURCE == event_type) || (XMC_VADC_GLOBAL_EVENT_RESULT == event_type))) + + global_ptr->GLOBEFLAG = ((uint32_t)(event_type << (uint32_t)16)); +} + +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param sr The service request to which the global result event is connected. Refer @ref XMC_VADC_SR_t enum + * + * @return None + * + * \parDescription:
+ * Binds the global result event to one of the 4 shared service requests.\n\n This API binds the global result event + * to one of the 4 module wide shared service requests .Sets GLOBEVNP register with the corresponding \a sr line. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode() + */ +void XMC_VADC_GLOBAL_SetResultEventInterruptNode(XMC_VADC_GLOBAL_t *const global_ptr, XMC_VADC_SR_t sr); + +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param sr The service request to which the global request source event is connected. Refer @ref XMC_VADC_SR_t enum + * + * @return None + * + * \parDescription:
+ * Binds the background request source event to one of the 4 shared service requests.\n\n This API binds the background + * request source event to one of the 4 module wide shared service requests. Sets GLOBEVNP register with the + * corresponding \a sr line. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SetResultEventInterruptNode() + */ +void XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode(XMC_VADC_GLOBAL_t *const global_ptr, XMC_VADC_SR_t sr); + +#if(XMC_VADC_SHS_AVAILABLE == 1U) +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param config Struct consisting of various SHS related configurations. + * + * @return None + * + * \parDescription:
+ * Configure the basic SHS parameters.
\n + * API would initialize the clock divider configuration, the analog reference selection and + * the calibration order for the Sample and Hold unit. + * + * \parRelated APIs:
+ * None. + */ + void XMC_VADC_GLOBAL_SHS_Init(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, const XMC_VADC_GLOBAL_SHS_CONFIG_t *config); + +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) + /** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param config Struct consisting of various step configurations. + * + * @return None + * + * \parDescription:
+ * Configures the stepper sequence for the converter.
\n + * Stepper of the SHS can be configured to take up a specific sequence of groups for conversion. + * The stepper sequence is configured using this API. + * + * \parRelated APIs:
+ * None. + */ + __STATIC_INLINE void XMC_VADC_GLOBAL_SHS_SetStepperSequence(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + const XMC_VADC_GLOBAL_SHS_STEP_CONFIG_t *config) + { + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_StepperInit:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_StepperInit:Wrong config pointer", + (config == (XMC_VADC_GLOBAL_SHS_STEP_CONFIG_t*)NULL)) + + shs_ptr->STEPCFG = (uint32_t) config->stepcfg; + } +#endif + + /** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * + * @return bool returns true if the analog converter is operable + * returns false if the analog converter is powered down + * + * \parDescription:
+ * Returns the converter status.
\n + * Returns the ANRDY bit field of the SHSCFG register. + * + * \parRelated APIs:
+ * None. + */ + __STATIC_INLINE bool XMC_VADC_GLOBAL_SHS_IsConverterReady(XMC_VADC_GLOBAL_SHS_t *const shs_ptr) + { + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_IsConverterReady:Wrong SHS Pointer",(shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + + return((bool)((shs_ptr->SHSCFG >> (uint32_t)SHS_SHSCFG_ANRDY_Pos) & (uint32_t)0x1)); + } + +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num group number for which the accelerated mode needs to be enabled.
Range: [0x0 to 0x1] + * + * @return None + * + * \parDescription:
+ * Enables the Accelerated timing mode.
\n + * This API is needed when a switch from compatible mode to accelerated mode of conversion is needed. In + * this mode the ADC module will convert the input depending on the value stored in the SST bit of the SHS0_TIMCFGx. + * This API would configure the accelerated mode in the SHS0_TIMCFG0 and SHS0_TIMCFG1 registers. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GLOBAL_SHS_EnableAcceleratedMode(XMC_VADC_GLOBAL_SHS_t *const shs_ptr,XMC_VADC_GROUP_INDEX_t group_num); + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num group number for which the accelerated mode needs to be disabled.
Range: [0x0 to 0x1] + * + * @return None + * + * \parDescription:
+ * Enables the Accelerated timing mode.
\n + * This API is needed when a switch from accelerated mode to compatible mode of conversion is needed. + * This API would clear the accelerated mode in the SHS0_TIMCFG0 and SHS0_TIMCFG1 registers. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GLOBAL_SHS_DisableAcceleratedMode(XMC_VADC_GLOBAL_SHS_t *const shs_ptr,XMC_VADC_GROUP_INDEX_t group_num); + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num group number for which the accelerated mode needs to be enabled.
Range: [0x0 to 0x1] + * @param sst_value Value of short sample time that needs to be configured.
+ * Range: [0x0 to 0x3F] + * + * @return None + * + * \parDescription:
+ * Configures the Accelerated timing mode sample time.
\n + * This API is needed when a switch from compatible mode to accelerated mode of conversion is needed. In + * Accelerated mode the ADC module will convert the input depending on the value stored in the SST bit of the + * SHS0_TIMCFGx. This API would configure the shot sample time either in SHS0_TIMCFG0.SST or SHS0_TIMCFG1.SST . + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GLOBAL_SHS_SetShortSampleTime(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + uint8_t sst_value); + +#endif +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param divs_value The clock divider value that is possible + *
Range:[0x0 to 0xF] + * @return None + * + * \parDescription:
+ * Configure Sample and hold clock divider value.
\n + * API would initialize the clock divider configuration. This determines the frequency of conversion + * of the Sample and hold converter. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_SHS_SetClockDivider(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, uint8_t divs_value) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetClockDivider:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetClockDivider:Wrong divide factor selected", + (divs_value < (uint32_t)0x10)) + + shs_ptr->SHSCFG = (shs_ptr->SHSCFG & (~(uint32_t)SHS_SHSCFG_DIVS_Msk)) | (uint32_t)SHS_SHSCFG_SCWC_Msk; + shs_ptr->SHSCFG |= ((uint32_t)divs_value << SHS_SHSCFG_DIVS_Pos) | (uint32_t)SHS_SHSCFG_SCWC_Msk; +} + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param gain_value gain value possible + * Range:[0x0 to 0x3] + * @param group_num The Group number for which the configurations applies + * @param ch_num The channel number for which the gain has to be configured + * @return None + * + * \parDescription:
+ * Configure the gain value for SHS.
\n + * API would set the gain factor for a selected channel. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GLOBAL_SHS_SetGainFactor(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + uint8_t gain_value, + XMC_VADC_GROUP_INDEX_t group_num, + uint8_t ch_num); + +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param max_calibration_time calibration time + * Range:[0x0 to 0x3F] + * @return None + * + * \parDescription:
+ * Configure the Maximum calibration timing.
\n + * API would initialize the Maximum time after which the calibration should occur. If no adc conversion + * occur during this duration then the calibration would run irrespective of conversions. The max time the + * converter can go without a calibration is set in this API. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_SHS_SetMaxCalTime(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + uint32_t max_calibration_time) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetMaxCalTime:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + + shs_ptr->CALCTR &= ~((uint32_t)SHS_CALCTR_CALMAX_Msk); + shs_ptr->CALCTR |= ((uint32_t)max_calibration_time << SHS_CALCTR_CALMAX_Pos); +} + + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num The Group number for which the configurations applies + * @return None + * + * \parDescription:
+ * Enable the Gain and offset calibration.
\n + * Enable the gain and offset calibration for all the Sample and hold units. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SHS_DisableGainAndOffsetCalibrations()
. + */ +void XMC_VADC_GLOBAL_SHS_EnableGainAndOffsetCalibrations(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num); + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num The Group number for which the configurations applies + * @return None + * + * \parDescription:
+ * Disable the Gain and offset calibration.
\n + * Disable the gain and offset calibration for all the Sample and hold units. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SHS_EnableGainAndOffsetCalibrations()
. + */ +void XMC_VADC_GLOBAL_SHS_DisableGainAndOffsetCalibrations(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num); + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num The Group number for which the configurations applies + * @param gain_level The gain level whose calibration value has to read. + * @return None + * + * \parDescription:
+ * Read the calibration value for the selected gain level.
\n + * Each gain value has a offset calibration value, this API would return the offset calibration value of the + * selected gain level. This is applicable for all the channels in the group that use the particular gain level. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SHS_SetOffsetCalibrationValue()
. + */ +uint8_t XMC_VADC_GLOBAL_SHS_GetOffsetCalibrationValue(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + XMC_VADC_SHS_GAIN_LEVEL_t gain_level); + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num The Group number for which the configurations applies + * @param gain_level The gain level whose calibration value has to read. + * @param offset_calibration_value The offset calibration value to be set. + * @return None + * + * \parDescription:
+ * Set the calibration value for the selected gain level.
\n + * Each gain value has a offset calibration value, this API would set the offset value of the selected gain level. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SHS_GetOffsetCalibrationValue()
. + */ +void XMC_VADC_GLOBAL_SHS_SetOffsetCalibrationValue(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + XMC_VADC_SHS_GAIN_LEVEL_t gain_level, + uint8_t offset_calibration_value); +#endif + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num The Group number for which the configurations applies + * @param loop_select The delta sigma loop number for which the configurations applies + * @param ch_num Channel number for which the configurations applies + * @return None + * + * \parDescription:
+ * Configures the delta sigma loop of the SHS.
\n + * There are 2 Delta-Sigma loops that can be configured. This API would configure the loop (loop_select) + * with the appropriate group_num and channel_num. + * Configures the SHS_LOOP bit fields. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SHS_EnableSigmaDeltaLoop()
. + */ +void XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + XMC_VADC_SHS_LOOP_CH_t loop_select, + uint8_t ch_num); + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param loop_select The delta sigma loop number for which the configurations applies + * @return None + * + * \parDescription:
+ * Enable the selected Delta-Sigma loop.
\n + * Configures the SHS_LOOP.LPENx bit field. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop()
. + * XMC_VADC_GLOBAL_SHS_EnableGainAndOffsetCalibrations()
. + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_SHS_EnableSigmaDeltaLoop(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_SHS_LOOP_CH_t loop_select) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_EnableSigmaDeltaLoop:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_EnableSigmaDeltaLoop:Wrong Delta sigma loop selected", + (loop_select == XMC_VADC_SHS_LOOP_CH_0)||(loop_select == XMC_VADC_SHS_LOOP_CH_1)) + + shs_ptr->LOOP |= (uint32_t)SHS_LOOP_LPEN0_Msk << (uint32_t)loop_select; +} + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param loop_select The delta sigma loop number for which the configurations applies + * @return None + * + * \parDescription:
+ * Disable the selected delta sigma loop.
\n + * Configures the SHS_LOOP.LPENx bit field. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop()
. + * XMC_VADC_GLOBAL_SHS_EnableGainAndOffsetCalibrations()
. + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_SHS_DisableSigmaDeltaLoop(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_SHS_LOOP_CH_t loop_select) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_DisableSigmaDeltaLoop:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_DisableSigmaDeltaLoop:Wrong Delta sigma loop selected", + (loop_select == XMC_VADC_SHS_LOOP_CH_0)||(loop_select == XMC_VADC_SHS_LOOP_CH_1)) + + shs_ptr->LOOP &= ~((uint32_t)SHS_LOOP_LPEN0_Msk << (uint32_t)loop_select); + +} + +#endif +#if (XMC_VADC_GROUP_AVAILABLE == 1U) +/** + * + * @param group_ptr Constant pointer to the VADC group. + * @param config Pointer to the initialization data structure + * + * @return None + * + * \parDescription:
+ * Initializes the VADC group module with the associated configuration structure pointed by \a config.\n\n It + * initializes the group specified as part of the \a group_ptr. It initializes group conversion class, arbiter + * configuration , boundary configuration by setting GxICLASS,GxARBCFG,GxBOUND, registers. It also + * configures the EMUX control register if applicable. Refer related API's to change the configurations later in the + * program. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_InputClassInit()
+ * XMC_VADC_GROUP_SetPowerMode()
+ * XMC_VADC_GROUP_SetBoundaries()
+ * XMC_VADC_GROUP_ExternalMuxControlInit()
+ */ +void XMC_VADC_GROUP_Init(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GROUP_CONFIG_t *config); + +/** + * + * @param group_ptr Constant pointer to the VADC group. + * @param config group related conversion class parameter structure + * @param conv_type Use direct channels or EMUX channels. Refer @ref XMC_VADC_GROUP_CONV_t enum + * @param set_num Conversion class set
+ * Range[0x0, 0x1] + * + * @return None + * + * \parDescription:
+ * Sets up the conversion settings for vadc group resource associated with \a config structure. It configures the + * conversion class properties like sampling time and resolution for selected \a conv_type channels. It initializes + * the G_ICLASS register specified by \a set_num with the required settings. + * + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_Init() + * + */ +void XMC_VADC_GROUP_InputClassInit(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GROUP_CLASS_t config, + const XMC_VADC_GROUP_CONV_t conv_type, const uint32_t set_num); + +/** + * + * @param group_ptr Constant pointer to the VADC Group which must be set as a slave + * @param master_grp The master group number
+ * Range: [0x0 - 0x3] + * @param slave_group The slave group number
+ * Range: [0x0 - 0x3] + * + * @return None + * + * \parDescription:
+ * Configures a VADC Group as a slave group.\n\n Conversion of identically numbered channels across groups can be + * synchronized. For example, when the trigger to convert CH-1 of Group-2 is received, it is possible to + * simultaneously request conversion of CH-1 of Group-0 and Group-3. Group-2 in this example is therefore the + * master group while Groups-0 and 3 are the slave groups. It uses the SYNCCTR register for the configuration settings. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_SetSyncMaster()
+ * XMC_VADC_GROUP_CheckSlaveReadiness()
+ * XMC_VADC_GROUP_EnableChannelSyncRequest()
+ * + */ +void XMC_VADC_GROUP_SetSyncSlave(XMC_VADC_GROUP_t *const group_ptr, uint32_t master_grp, uint32_t slave_group); + +/** + * + * @param group_ptr Constant pointer to the VADC Group. + * @param power_mode Desired power mode + * + * @return None + * + * \parDescription:
+ * Configures the power mode of a VADC group.\n\n For a VADC group to actually convert an analog signal, its analog + * converter must be turned on. + * + * \parRelated APIs:
+ * None + */ +void XMC_VADC_GROUP_SetPowerMode(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GROUP_POWERMODE_t power_mode); + +/** + * + * @param group_ptr Constant pointer to the VADC group. + * + * @return None + * + * \parDescription:
+ * Configures a VADC Group as a master group.
\n + * Conversion of identically numbered channels across groups can be + * synchronized. For example, when the trigger to convert CH-1 of Group-2 is received, it is possible to simultaneously + * request conversion of CH-1 of Group-0 and Group-3. Group-2 in this example is therefore the master group while + * Groups-0 and 3 are the slave groups. + * + * \parRelated APIs:
+ * None + */ +void XMC_VADC_GROUP_SetSyncMaster(XMC_VADC_GROUP_t *const group_ptr); + +/** + + * @param group_ptr Pointer to the master VADC Group + * @param slave_group The slave VADC Group number + *
Range: [0x0 to 0x3] + * @return None + * + * \parDescription:
+ * Configures the ready signal for master group.
\n + * This API would read the \b slave_group number and determine which EVAL configuration to apply for the given master + * slave set. Checks the readiness of slaves in synchronized conversions. Conversion of identically numbered channels + * across groups can be synchronized. For example, when the trigger to convert CH-1 of Group-2 is received, it is + * possible to simultaneously request conversion of CH-1 of Group-0 and Group-3. Group-2 in this example is + * therefore the master group while Groups-0 and 3 are the slave groups. Before the master can request its slaves + * for synchronized conversion, it has the option of checking the readiness of the slaves. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_IgnoreSlaveReadiness()
XMC_VADC_GROUP_SetSyncMaster() + */ +void XMC_VADC_GROUP_CheckSlaveReadiness(XMC_VADC_GROUP_t *const group_ptr, uint32_t slave_group); + +/** + * + * @param group_ptr Constant Pointer to the master VADC Group + * @param slave_group The slave VADC Group number + * @return None + * + * \parDescription:
+ * Clears the ready signal for master group.
\n + * Ignores the readiness of slaves in synchronized conversions.This API would read the \b slave_group number and + * determine which EVAL configuration to apply for the given master slave set. Then clears the configuration if present. + * This API is called when the master should issue the conversion request without waiting for the slave to + * assert a ready signal. The ready signal is asserted by the slave group(s) when the conversion is completed + * in these channels. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_CheckSlaveReadiness()
XMC_VADC_GROUP_SetSyncMaster()
+ */ +void XMC_VADC_GROUP_IgnoreSlaveReadiness(XMC_VADC_GROUP_t *const group_ptr, uint32_t slave_group); + +/** + * + * @param group_ptr Constant Pointer to the VADC Group waiting for ready signal + * @param eval_waiting_group The VADC Group which expects a ready signal to start it's conversion. + * @param eval_origin_group The VADC Group from which the eval_waiting_group will expect a ready signal + * @return None + * + * \parDescription:
+ * Sets the ready signal in the eval_waiting_group .
\n + * For Synchronized conversion all the slaves participating need to configure the ready signal. + * A slave group will also need to configure the ready signals coming from the other slave groups. + * A call to this API would configure the Sync.slave's EVAL Bits (GxSYNCTR.EVALy). + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_CheckSlaveReadiness()
XMC_VADC_GROUP_IgnoreSlaveReadiness()
+ */ +void XMC_VADC_GROUP_SetSyncSlaveReadySignal(XMC_VADC_GROUP_t *const group_ptr, + uint32_t eval_waiting_group, + uint32_t eval_origin_group); + +/** + * + * @param group_ptr Constant Pointer to the VADC Group + * @return + * uint32_t EVAL bits for the group + * + * \parDescription:
+ * Get the Eval bits of the group.
\n + * For Synchronized conversion the master's ready signal configuration must be copied onto the slaves. + * A call to this API would return the Sync EVAL Bits (GxSYNCTR.EVALy) which can be used to set in the slaves. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_CheckSlaveReadiness()
XMC_VADC_GROUP_IgnoreSlaveReadiness()
+ */ +__STATIC_INLINE uint32_t XMC_VADC_GROUP_GetSyncReadySignal(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t eval_mask; + XMC_ASSERT("XMC_VADC_GROUP_GetSyncReadySignal:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + +#if (XMC_VADC_MAXIMUM_NUM_GROUPS > 2U) + eval_mask = VADC_G_SYNCTR_EVALR1_Msk | VADC_G_SYNCTR_EVALR2_Msk | VADC_G_SYNCTR_EVALR3_Msk; +#else + eval_mask = VADC_G_SYNCTR_EVALR1_Msk; +#endif + return( group_ptr->SYNCTR & eval_mask); +} + +/** + * @param group_ptr Constant Pointer to the VADC Group + * @param eval_mask mask to configure the eval bits + * Use XMC_VADC_SYNCTR_EVAL_t to create the mask. + * @return None + * + * \parDescription:
+ * Set the Eval bits of the group.
\n + * For Synchronized conversion the master's ready signal configuration must be copied onto the slaves. + * A call to this API would configure the Sync EVAL Bits (GxSYNCTR.EVALy). + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_CheckSlaveReadiness()
XMC_VADC_GROUP_IgnoreSlaveReadiness()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_SetSyncReadySignal(XMC_VADC_GROUP_t *const group_ptr, uint32_t mask) +{ + uint32_t eval_mask; + XMC_ASSERT("XMC_VADC_GROUP_SetSyncReadySignal:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + +#if (XMC_VADC_MAXIMUM_NUM_GROUPS > 2U) + eval_mask = VADC_G_SYNCTR_EVALR1_Msk | VADC_G_SYNCTR_EVALR2_Msk | VADC_G_SYNCTR_EVALR3_Msk; +#else + eval_mask = VADC_G_SYNCTR_EVALR1_Msk; +#endif + group_ptr->SYNCTR &= ~(eval_mask); + group_ptr->SYNCTR |= mask; +} + +/** + * + * @param group_ptr Constant pointer to the master VADC Group + * @param ch_num Channel whose conversion triggers conversion in slave groups + * @return None + * + * \parDescription:
+ * Sets up a channel for synchronized conversion.\n\n Conversion of identically numbered channels across groups + * can be synchronized. For example, when the trigger to + * convert CH-1 of Group-2 is received, it is possible to simultaneously request conversion of CH-1 of Group-0 and + * Group-3. Group-2 in this example is therefore the master group while Groups-0 and 3 are the slave groups.
+ * Before the master can request its slaves for synchronized conversion, it has the option of checking the readiness + * of the slaves. + * + * \parRelated APIs:
+ * None + */ +void XMC_VADC_GROUP_EnableChannelSyncRequest(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num); + +/** + * + * @param group_ptr Pointer to the master VADC Group + * @param ch_num Channel whose conversion triggers conversion in slave groups + * @return None + * + * \parDescription:
+ * Disable the synchronization request for the particular channel specified as ch_num. To enable the synchronization + * call the API @ref XMC_VADC_GROUP_EnableChannelSyncRequest(). + * + * \parRelated APIs:
+ * None + */ +void XMC_VADC_GROUP_DisableChannelSyncRequest(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num); + +/** + * + * @param group_ptr Constant pointer to the VADC group. + * + * @return retuns IDLE if converter is free else returns busy. Refer @ref XMC_VADC_GROUP_STATE_t enum + * + * \parDescription:
+ * Checks the live status of the analog to digital converter. The converter can either idle doing nothing or busy + * sampling + converting. + * + * \parRelated APIs:
+ * None + */ +XMC_VADC_GROUP_STATE_t XMC_VADC_GROUP_IsConverterBusy(XMC_VADC_GROUP_t *const group_ptr); + +/** + * + * @param group_ptr Constant pointer to the VADC group whose global boundary registers are to be programmed + * @param boundary0 Boundary-0 Value
+ * Range: [0x0 - 0x0FFF] + * @param boundary1 Boundary-1 Value
+ * Range: [0x0 - 0x0FFF] + * + * @return None + * + * \parDescription:
+ * Programs the boundaries with \a boundary0 and boundary1 for result comparison.\n\n These two boundaries can serve as + * absolute boundaries. They defines a range against which the result of a conversion can be compared. In the + * fast compare mode, the two boundaries provide hysteresis capability to a compare value. In any case, these boundary + * values entered here form a boundary pallete. There are dedicated upper and lower boundary registers G_BOUND0 and + * G_BOUND1 who will derive their values from this palette. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_VADC_GROUP_SetBoundaries(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t boundary0, + const uint32_t boundary1); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param selection The boundary value selected for \b boundary_value. + * @param boundary_value Select the boundary value. + * @return + * None + * + * \parDescription:
+ * Programs the boundary with \a boundary_value for result comparison.\n\n This defines a range against which + * the result of a conversion can be compared. In the fast compare mode, the two boundaries provide hysteresis + * capability to a compare value. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_SetIndividualBoundary(XMC_VADC_GROUP_t *const group_ptr, + const XMC_VADC_CHANNEL_BOUNDARY_t selection, + const uint16_t boundary_value); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param sr_num The service request number (0 through 3) + * @param type IRQ type (Kernel specific interrupt vs Module wide shared interrupt ) + * @return None + * + * \parDescription:
+ * Activates a Service Request line(manually trigger).
\n + * VADC provides few SR lines for each group and a few more which is shared across all the groups. + * These SR lines can be connected to an NVIC node which in-turn would generate an interrupt. + * This API would manually trigger the given SR line. Could be used for evaluation and testing purposes. + * + * \parRelated APIs:
+ * None + */ +void XMC_VADC_GROUP_TriggerServiceRequest(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t sr_num, + const XMC_VADC_GROUP_IRQ_t type); + +/** + * + * @param group_ptr Constant pointer to the VADC group + * @param emux_cfg EMUX configuration structure + * @return None + * + * \parDescription:
+ * Configures group EMUX parameters associated with the \a emux_cfg configuration structure.\n\n An external emux + * interface allows additional channels to be connected to a VADC group. The conversion properties + * of such channels can be different from the standard channels which are directly connected to the VADC group. + * This API configures conversion properties of channels connected via EMUX interface. + * + * \parRelated APIs:
+ * None + */ +__STATIC_INLINE void XMC_VADC_GROUP_ExternalMuxControlInit(XMC_VADC_GROUP_t *const group_ptr, + const XMC_VADC_GROUP_EMUXCFG_t emux_cfg) +{ + uint32_t emux_config; + + XMC_ASSERT("XMC_VADC_GROUP_ExternalMuxControlInit:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + emux_config = ((uint32_t)emux_cfg.starting_external_channel << (uint32_t)VADC_G_EMUXCTR_EMUXSET_Pos) | + ((uint32_t)emux_cfg.connected_channel << (uint32_t)VADC_G_EMUXCTR_EMUXCH_Pos); + + group_ptr->EMUXCTR = emux_config; + emux_config = ((uint32_t)emux_cfg.emux_coding << (uint32_t)VADC_G_EMUXCTR_EMXCOD_Pos) | + ((uint32_t)emux_cfg.emux_mode << (uint32_t)VADC_G_EMUXCTR_EMUXMODE_Pos)| + ((uint32_t)emux_cfg.stce_usage << (uint32_t)VADC_G_EMUXCTR_EMXST_Pos); + +#if (XMC_VADC_EMUX_CH_SEL_STYLE == 1U) + emux_config |= ((uint32_t)emux_cfg.emux_channel_select_style << (uint32_t)VADC_G_EMUXCTR_EMXCSS_Pos); +#endif + group_ptr->EMUXCTR |= (emux_config | ((uint32_t)VADC_G_EMUXCTR_EMXWC_Msk)) ; +} + +#if XMC_VADC_BOUNDARY_FLAG_SELECT == 1U + +/** + * @param group_ptr Constant pointer to the VADC group + * @param boundary_flag_num The Boundary flag for which the interrupt node needs to be configured. + * Range: [0x0 to 0x3] + * @param node Service Request node Id + * @return + * None + * + * \parDescription:
+ * Connects the boundary event to the SR line of VADC or to a common boundary flag.
\n + * This API will connect a Service Request line(SR) to a boundary event. Hence to get a interrupt on this + * Service request line one has to enable the required NVIC node. A call to this API would configure the register bit + * field GxBFLNP.BFLxNP. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_SetBoundaryEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, + const uint8_t boundary_flag_num, + const XMC_VADC_BOUNDARY_NODE_t node); +#endif + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * uint32_t The complete GxALIAS register + * + * \parDescription:
+ * Returns the ALIAS values.\n The ALIAS value that is configured for Channel-0 and channel-1 are returned. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE uint32_t XMC_VADC_GROUP_GetAlias(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_GetAliasWrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + return (group_ptr->ALIAS); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param conv_class conversion property to be extracted + * @return + * XMC_VADC_GROUP_CLASS_t The complete GxICLASSy register + * + * \parDescription:
+ * Returns the input class configuration values.\n + * This returns the sampling time configuration and resolution configured in the appropriate group input class + * \b conv_class. A call to this API would return the register GxICLASSy. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE XMC_VADC_GROUP_CLASS_t XMC_VADC_GROUP_GetInputClass(XMC_VADC_GROUP_t *const group_ptr, + const XMC_VADC_CHANNEL_CONV_t conv_class) +{ + XMC_VADC_GROUP_CLASS_t input_value; + XMC_ASSERT("XMC_VADC_GROUP_GetInputClass:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_GetInputClass:Wrong conv_class selected", + (XMC_VADC_CHANNEL_CONV_GROUP_CLASS0 == conv_class) || (XMC_VADC_CHANNEL_CONV_GROUP_CLASS1 == conv_class)) + + input_value.g_iclass0 = (uint32_t) 0xFFFFFFFF; + if ((XMC_VADC_CHANNEL_CONV_GROUP_CLASS0 == conv_class) || (XMC_VADC_CHANNEL_CONV_GROUP_CLASS1 == conv_class)) + { + input_value.g_iclass0 = group_ptr->ICLASS[(uint32_t)conv_class]; + } + + return (input_value); +} +#endif + +#if (XMC_VADC_GSCAN_AVAILABLE == 1U) +/** + * @param group_ptr Pointer to the VADC group + * @param config Pointer to Scan configuration + * @return None + * + * \parDescription:
+ * Initializes the VADC SCAN functional block.
\n + * The GROUP SCAN request source functional block converts channels sequentially starting with the highest numbered + * channel to the lowest. Channels must register themselves as being part of the the scan sequence. + * A call to this API will first disable the arbitration slot for queue (XMC_VADC_GROUP_ScanEnableArbitrationSlot()) + * and then it would configure all the related registers with the required configuration values. + * The arbitration slot is re-enabled at the end of init by invoking XMC_VADC_GROUP_ScanDisableArbitrationSlot(). + * A call to this API would configure the registers GxARBPR, GxASCTRL, GxASMR needed scan request source. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanEnableArbitrationSlot()
XMC_VADC_GROUP_ScanDisableArbitrationSlot()
+ * XMC_VADC_GROUP_ScanSelectTrigger()
XMC_VADC_GROUP_ScanSelectGating()
+ */ +void XMC_VADC_GROUP_ScanInit(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_SCAN_CONFIG_t *config); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Enables arbitration slot of the scan request source.
\n + * If the scan request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the scan channel can only be converted when the arbiter comes + * to the scan slot. Thus this must be enabled if any conversion need to take place. + * A call to this API would configure the register bit field GxARBPR.ASEN1. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanDisableArbitrationSlot()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanEnableArbitrationSlot(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanEnableArbitrationSlot:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ARBPR |= (uint32_t)VADC_G_ARBPR_ASEN1_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Disables arbitration slot of the scan request source.
\n + * If the scan request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the scan channel can only be converted when the arbiter comes + * to the scan slot.A call to this API will lead to all conversions request by scan to be blocked. + * A call to this API would configure the register bit field GxARBPR.ASEN1. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanEnableArbitrationSlot()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanDisableArbitrationSlot(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanDisableArbitrationSlot:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ARBPR &= ~((uint32_t)VADC_G_ARBPR_ASEN1_Msk); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * bool returns true if the arbitration is enabled else returns false. + * + * \parDescription:
+ * Returns the arbitration status of the scan request source.
\n + * If the scan request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the scan channel can only be converted when the arbiter comes + * to the scan slot. A call to this API would return the status of the arbitration slot of scan. + * A call to this API would read the register bit field GxARBPR.ASEN1. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanEnableArbitrationSlot(),
XMC_VADC_GROUP_ScanDisableArbitrationSlot()
+ */ +__STATIC_INLINE bool XMC_VADC_GROUP_ScanIsArbitrationSlotEnabled(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanIsArbitrationSlotEnabled:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + return ((group_ptr->ARBPR & (uint32_t)VADC_G_ARBPR_ASEN1_Msk) >> VADC_G_ARBPR_ASEN1_Pos); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param trigger_input Choice of the input earmarked as a trigger line + * @return + * None + * + * \parDescription:
+ * Select Trigger signal for scan request source.
\n + * A scan request source will raise conversion request only if there were either a request from application or + * occurrence of a hardware trigger. This API selects one of the 16 input lines as a trigger line. This is + * needed when a hardware trigger is needed for the conversion of the scan request source. + * Refer to the reference manual to determine the signal that needs to be connected. + * A call to this API would configure the register bit field GxASCTRL.XTSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanSelectGating()
XMC_VADC_GROUP_ScanEnableExternalTrigger()
+ */ +void XMC_VADC_GROUP_ScanSelectTrigger(XMC_VADC_GROUP_t *const group_ptr, XMC_VADC_TRIGGER_INPUT_SELECT_t trigger_input); + + +/** + * @param group_ptr Constant pointer to the VADC group + * @param trigger_edge Trigger edge selection + * @return + * None + * + * \parDescription:
+ * Selects the trigger edge for scan request source.
\n + * A scan request source will raise conversion request only if there were either a request from application or + * occurrence of a hardware trigger. This API selects one of the 4 possible trigger edges. This is + * needed when a hardware trigger is needed for the conversion of the scan request source. + * A call to this API would configure the register bit field GxASCTRL.XTMODE. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanSelectTrigger()
+ */ +void XMC_VADC_GROUP_ScanSelectTriggerEdge(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_TRIGGER_EDGE_t trigger_edge); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param gating_input Module input signal meant to be selected as gating input + * @return + * None + * + * \parDescription:
+ * Select Gating signal for scan request source.
\n + * Passage of the trigger input to the request source can be controlled via a gating signal. Any one of the 16 input + * lines can be chosen as a gating signal. Trigger signal can be given to the scan request source only + * when the gating signal's active level is detected. Additionally the GxASMR.ENGT has to be configured for + * the gating signal's active level. A call to this API would configure the register bit field GxASCTRL.GTSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanSelectTrigger()
+ */ +void XMC_VADC_GROUP_ScanSelectGating(XMC_VADC_GROUP_t *const group_ptr, XMC_VADC_GATE_INPUT_SELECT_t gating_input); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param mode_sel Select how the gating is applied to the scan request source + * @return + * None + * + * \parDescription:
+ * Selects the gating mode of scan request source.
\n + * Passage of the trigger input to the request source can be controlled via a gating signal. + * This API determines how the gating signal behaves, either active low or active high. + * If gating signal needs to ignored XMC_VADC_GATEMODE_IGNORE should be used as the \a mode_sel. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanSelectGating(); + */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanSetGatingMode(XMC_VADC_GROUP_t *const group_ptr, XMC_VADC_GATEMODE_t mode_sel) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanSetGatingMode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanSetGatingMode:Wrong mode selected", (mode_sel <= XMC_VADC_GATEMODE_ACTIVELOW)) + + /* Clear the existing gate configuration */ + group_ptr->ASMR &= (uint32_t) (~((uint32_t)VADC_G_ASMR_ENGT_Msk)); + /* Set the new gating mode */ + group_ptr->ASMR |= (uint32_t)((uint32_t)mode_sel << VADC_G_ASMR_ENGT_Pos); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Enables continuous conversion mode.
\n + * Typically for a scan request source to generate conversion request, either a hardware trigger or a software + * request is a pre-requisite. Using autoscan feature it is possible to start the conversion once and allow the + * sequence to repeat without any further triggers. Once all channels belonging to a scan request source have + * been converted, a request source completion event is generated. Generation of this event can restart the scan + * sequence. Every request source event will cause a load event to occur. A call to this API would configure + * the register bit field GxASMR.SCAN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanDisableContinuousMode()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanEnableContinuousMode(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanEnableContinuousMode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ASMR |= (uint32_t)VADC_G_ASMR_SCAN_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Disables continuous conversion mode.
\n + * Typically for a scan request source to generate conversion request, either a hardware trigger or a software + * request is a pre-requisite. Using autoscan feature it is possible to start the conversion once and allow the + * sequence to repeat without any further triggers. Once all channels belonging to a scan request source have + * been converted, a request source completion event is generated. Generation of this event can restart the scan + * sequence. By invoking this feature the Autoscan mode of operations is disabled. A call to this API would configure + * the register bit field GxASMR.SCAN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanEnableContinuousMode()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanDisableContinuousMode(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanDisableContinuousMode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ASMR &= ~((uint32_t)VADC_G_ASMR_SCAN_Msk); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Generates conversion request (Software initiated conversion).
\n + * A conversion request can be raised either upon detection of a hardware trigger, or by software. This API forces + * the scan unit to generate a conversion request to the analog converter. It is assumed that the scan has already + * been filled up with entries. A call to this API would configure the register bit field GxASMR.LDEV. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanTriggerConversion(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanTriggerConversion:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ASMR |= (uint32_t)VADC_G_ASMR_LDEV_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Aborts an ongoing scan sequence conversion.
\n + * An ongoing sequence can be aborted at any time. The scan unit picks the pending channels one by one from a + * pending register and requests for their conversion. This API essentially clears the channel pending register thus + * creating an illusion that there are no more channels left in the sequence. + * A call to this API would configure the registers GxASMR, GxASCTRL, GxARBPR to achieve the sequence abort. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_ScanSequenceAbort(XMC_VADC_GROUP_t *const group_ptr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num The channel meant to be added to scan sequence + *
Range: [0x0 to 0x7] + * @return + * None + * + * \parDescription:
+ * Adds a channel to the scan sequence.
\n + * Call this API to insert a new single channel into the scan request source. This will be added to the scan + * sequence. The added channel will be part of the conversion sequence when the next load event occurs. + * A call to this API would configure the register bit fields of GxASSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanAddMultipleChannels()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanAddChannelToSequence(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + XMC_ASSERT("VADC_GSCAN_AddSingleChannel:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanAddChannelToSequence:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + group_ptr->ASSEL |= (uint32_t)((uint32_t)1 << ch_num); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_mask Mask word indicating channels which form part of scan conversion sequence + * Bit location 0/1/2/3/4/5/6/7 represents channels-0/1/2/3/4/5/6/7 respectively. + * To Add the channel to the scan sequence enable the respective bit. + * Passing a 0x0 will clear all the selected channels + *
Range: [0x0 to 0xFF] + * @return + * None + * + * \parDescription:
+ * Adds multiple channels to the scan sequence.
\n + * Call this API to insert a multiple channels into the scan request source. This will be added to a scan + * sequence. The added channels will be a part of the conversion sequence when the next load event occurs. + * A call to this API would configure the register bit fields of GxASSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanAddChannelToSequence()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanAddMultipleChannels(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_mask) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanAddMultipleChannels:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ASSEL = ch_mask; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num The channel being audited for completion of conversion + *
Range: [0x0 to 0x7] + * @return + * bool returns true if the channel is pending conversion else returns false + * + * \parDescription:
+ * Determine if the channel is pending for conversion.
\n + * This API will check if the Channel in question is awaiting conversion in the current arbitration round. + * When a load event occurs the scan sequence is pushed to a pending conversion register. + * From the pending register the channels are taken up by the converter. This API would return true + * if the channel is found in the pending register (GxASPND). + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanGetNumChannelsPending()
+ */ +__STATIC_INLINE bool XMC_VADC_GROUP_ScanIsChannelPending(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + + XMC_ASSERT("XMC_VADC_GROUP_ScanIsChannelPending:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanIsChannelPending:Wrong Channel Number", ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + return( (bool)((uint32_t)(group_ptr->ASPND >> ch_num) & 1U)); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return
+ * uint32_t Returns the total channels pending for conversion. + *
Range: [0x0 to 0x8] + * + * \parDescription:
+ * Returns the total number of pending channels.
\n + * This API will read the pending channels register and will return the number of channels that are awaiting conversion. + * When a load event occurs the scan sequence is pushed to a pending conversion register. + * From the pending register the channels are taken up by the converter. When the API is called it would + * return the total number of channels pending (GxASPND). + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanIsChannelPending()
+ */ +uint32_t XMC_VADC_GROUP_ScanGetNumChannelsPending(XMC_VADC_GROUP_t *const group_ptr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Manually asserts the conversion complete request source event.
\n + * This API will set the request source event for scan. This will trigger a interrupt if the + * service node pointer for the scan has been configured. + * A call to this API would configure the register bit field GxSEFLAG.SEV1. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanTriggerReqSrcEvent(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanTriggerReqSrcEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->SEFLAG |= (uint32_t)VADC_G_SEFLAG_SEV1_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Acknowledges the scan conversion complete request source event.
\n + * This API will clear the request source event that occurred. This will clear a interrupt if it was raised. + * A call to this API would configure the register bit field GxSEFLAG.SEV1. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanTriggerReqSrcEvent()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanClearReqSrcEvent(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanClearReqSrcEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->SEFCLR |= (uint32_t)VADC_G_SEFCLR_SEV1_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * bool returns true if the service request event is raised. + * returns false if the service request event was not raised. + * + * \parDescription:
+ * Determines if the request source event is asserted.
+ * This API will get the status of the scan request source event. Will return a true + * if the event has occurred for scan. A call to this API would access the register bit field GxSEFLAG.SEV1. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE bool XMC_VADC_GROUP_ScanGetReqSrcEventStatus(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GSCAN_GetRSEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + return( (bool)(group_ptr->SEFLAG & (uint32_t)VADC_G_SEFLAG_SEV1_Msk)); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param sr Service Request Id + * @return + * None + * + * \parDescription:
+ * Connects the scan request source event to the SR line of VADC.
\n + * This API will connect a Service Request line(SR) to a scan request source event. Hence to get a interrupt on this + * Service request line one has to enable the required NVIC node. A call to this API would configure the register bit + * field GxSEVNP.SEV1NP . + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_ScanSetReqSrcEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_SR_t sr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Enables the trigger for scan request source.
\n + * By using this API, the trigger signal will be activated for the scan request source. The trigger signal and trigger + * edge will be selected from the ASCTRL register. The Selection of a input will be done by + * XMC_VADC_GROUP_ScanSelectTrigger(). A call to this API would configure the register bit field GxASMR.ENTR. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanSelectTrigger()
XMC_VADC_GROUP_ScanDisableExternalTrigger()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanEnableExternalTrigger(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanEnableExternalTrigger:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + group_ptr->ASMR |= (uint32_t)VADC_G_ASMR_ENTR_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Disables the trigger for scan request source.
+ * By using this API the trigger will be deactivated for the scan request source. + * This will just deactivate the H/W trigger for the scan request source. If any configuration were done + * to select the trigger input in GxASCTRL, it will be not be effected by this API. + * A call to this API would configure the register bit field GxASMR.ENTR. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanEnableExternalTrigger()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanDisableExternalTrigger(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanDisableExternalTrigger:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + group_ptr->ASMR &= ~((uint32_t)VADC_G_ASMR_ENTR_Msk); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param channel_num channel number to be removed from the scan sequence. + * @return + * None + * + * \parDescription:
+ * Removes a channel from the scan sequence.
+ * By using this API the it is possible to remove a single channel from the conversion sequence. + * The remaining channels will continue however they are. + * A call to this API would configure the register GxASSEL. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_ScanRemoveChannel(XMC_VADC_GROUP_t *const group_ptr, const uint32_t channel_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Enables the scan request source event .
+ * By using this API the request source event will be activated for the scan request source. + * Other configurations w.r.t service node pointer are not done in this API. + * A call to this API would configure the register bit field GxASMR.ENSI. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanDisableEvent(),
XMC_VADC_GROUP_ScanSetReqSrcEventInterruptNode()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanEnableEvent(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanEnableEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + group_ptr->ASMR |= ((uint32_t)VADC_G_ASMR_ENSI_Msk); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Disables the scan request source event .
+ * By using this API the request source event will be deactivated for the scan request source. + * Other configurations w.r.t service node pointer are not done in this API. + * A call to this API would configure the register bit field GxASMR.ENSI. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanEnableEvent(),
XMC_VADC_GROUP_ScanSetReqSrcEventInterruptNode()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanDisableEvent(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanDisableEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + group_ptr->ASMR &= ~((uint32_t)VADC_G_ASMR_ENSI_Msk); +} +#endif + +/** + * @param global_ptr Pointer to the VADC module + * @param config Pointer to initialization data structure + * + * \parDescription:
+ * Initializes the Background scan functional block.
\n + * The BACKGROUND SCAN request source functional block converts channels of all VADC groups that have not + * been assigned as a priority channel (priority channels can be converted only by queue and scan). Background Scan + * request source converts the unprioritized channels. Unprioritized channels however can also be used with queue + * and scan. But a channel which is prioritized can not be used with background request source. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_BackgroundEnableArbitrationSlot()
XMC_VADC_GROUP_BackgroundDisableArbitrationSlot()
+ * XMC_VADC_GLOBAL_BackgroundSelectTrigger()
XMC_VADC_GLOBAL_BackgroundSelectGating()
+ */ +void XMC_VADC_GLOBAL_BackgroundInit(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_BACKGROUND_CONFIG_t *config); + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) +/** + * @param group_ptr Constant pointer to the VADC group which may receive a + * conversion request from background request source + * + * @return + * None + * + * \parDescription:
+ * Enables arbitration slot of the Background request source.
\n + * If the Background request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the Background channel can only be converted when the arbiter + * comes to the Background slot. Thus this must be enabled if any conversion need to take place. + * A call to this API would configure the register bit field GxARBPR.ASEN2. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_BackgroundDisableArbitrationSlot()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_BackgroundEnableArbitrationSlot(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_BackgroundEnableArbitrationSlot:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ARBPR |= (uint32_t)VADC_G_ARBPR_ASEN2_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group which may receive a conversion request + * from background request source + * @return + * None + * + * \parDescription:
+ * Disables arbitration slot of the Background request source.
\n + * If the Background request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the Background channel can only be converted when the arbiter + * comes to the Background slot.A call to this API will lead to all conversions request by Background to be blocked. + * A call to this API would configure the register bit field GxARBPR.ASEN2 + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_BackgroundEnableArbitrationSlot()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_BackgroundDisableArbitrationSlot(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_BackgroundDisableArbitrationSlot:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ARBPR &= ~((uint32_t)VADC_G_ARBPR_ASEN2_Msk); +} +#endif + +/** + * @param global_ptr Pointer to the VADC module + * @param input_num Choice of the input earmarked as a trigger line + * Accepts enum ::XMC_VADC_TRIGGER_INPUT_SELECT_t + * @return + * None + * + * \parDescription:
+ * Select Trigger signal for Background request source.
\n + * A Background request source will raise conversion request only if there were either a request from application or + * occurrence of a hardware trigger. This API selects one of the 16 input lines as a trigger line. This is + * needed when a hardware trigger is needed for the conversion of the Background request source. + * Refer to the reference manual to determine the signal that needs to be connected. + * A call to this API would configure the register bit field BRSCTRL.XTSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundSelectGating()
XMC_VADC_GLOBAL_BackgroundEnableExternalTrigger()
+ */ +void XMC_VADC_GLOBAL_BackgroundSelectTrigger(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t input_num); + + +/** + * @param global_ptr Pointer to the VADC module + * @param trigger_edge Select the trigger edge + * @return + * None + * + * \parDescription:
+ * Select Trigger edge for Background request source.
\n + * A Background request source will raise conversion request only if there were either a request from application or + * occurrence of a hardware trigger. This API selects one of the 4 possible values for the trigger edge. This is + * needed when a hardware trigger is needed for the conversion of the Background request source. + * A call to this API would configure the register bit field BRSCTRL.XTMODE. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundSelectGating()
XMC_VADC_GLOBAL_BackgroundEnableExternalTrigger()
+ */ +void XMC_VADC_GLOBAL_BackgroundSelectTriggerEdge(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_TRIGGER_EDGE_t trigger_edge); + +/** + * @param global_ptr Pointer to the VADC module + * @param input_num Module input signal meant to be selected as gating input + * Accepts enum ::XMC_VADC_GATE_INPUT_SELECT_t + * @return + * None + * + * \parDescription:
+ * Select Gating signal for Background request source.
\n + * Passage of the trigger input to the request source can be controlled via a gating signal. Any one of the 16 input + * lines can be chosen as a gating signal. Trigger signal can be given to the Background request source only + * when the gating signal's active level is detected. Additionally the GxBRSMR.ENGT has to be configured for + * the gating signal's active level. A call to this API would configure the register bit field BRSCTRL.GTSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundSelectTrigger()
+ */ +void XMC_VADC_GLOBAL_BackgroundSelectGating(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t input_num); + +/** + * @param global_ptr Pointer to the VADC module + * @param mode_sel Select how the gating is applied to the background scan request source + * @return + * None + * + * Details of function
+ * Selects the gating mode of background request source.
\n + * Passage of the trigger input to the request source can be controlled via a gating signal. + * This API determines how the gating signal behaves, either active low or active high. + * If gating signal needs to ignored XMC_VADC_GATEMODE_IGNORE should be used as the \a mode_sel. + * A call to this API would configure the register bit field BRSMR.ENGT. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundSelectGating(); + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundSetGatingMode(XMC_VADC_GLOBAL_t *const global_ptr, + XMC_VADC_GATEMODE_t mode_sel) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSetGatingMode:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSetGatingMode:Wrong mode selected", (mode_sel <= XMC_VADC_GATEMODE_ACTIVELOW)) + + /* Clear the existing gate configuration */ + global_ptr->BRSMR &= (uint32_t)(~((uint32_t)VADC_BRSMR_ENGT_Msk)); + /* Configure the new gating mode*/ + global_ptr->BRSMR |= (uint32_t)((uint32_t)mode_sel << VADC_BRSMR_ENGT_Pos); +} + + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Enables continuous conversion mode.
\n + * Typically for a Background request source to generate conversion request, either a hardware trigger or a software + * request is needed. Using autoscan (continuous conversion)feature it is possible to start the conversion + * once and allow the sequence to repeat without any further triggers. Once all channels belonging to a Background + * request source have been converted, a request source completion event is generated. Generation of this event + * can restart the Background configure sequence. Every request source event will cause a load event to occur. + * A call to this API would access the register bit field BRSMR.SCAN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_BackgroundDisableContinuousMode()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundEnableContinuousMode(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundEnableContinuousMode:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->BRSMR |= (uint32_t)VADC_BRSMR_SCAN_Msk; +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Disables continuous conversion mode.
\n + * Typically for a Background request source to generate conversion request, either a hardware trigger or a software + * request is a pre-requisite. Using autoscan feature it is possible to start the conversion once and allow the + * sequence to repeat without any further triggers. Once all channels belonging to a Background request source have + * been converted, a request source completion event is generated. Generation of this event can restart the Background + * sequence. By invoking this API the Autoscan mode of operations is disabled. A call to this API would configure the + * register bit field BRSMR.SCAN. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundEnableContinuousMode()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundDisableContinuousMode(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundDisableContinuousMode:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->BRSMR &= ~((uint32_t)VADC_BRSMR_SCAN_Msk); +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Generates conversion request (Software initiated conversion).
\n + * A conversion request can be raised either upon detection of a hardware trigger, or by software. This API forces + * the scan unit to generate a conversion request to the analog converter. It is assumed that the background scan + * has already been filled up with entries. A call to this API would set the register bit field BRSMR.LDEV. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundTriggerConversion(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundTriggerConversion:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->BRSMR |= (uint32_t)VADC_BRSMR_LDEV_Msk; +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Aborts an ongoing background scan conversion(sequence).
\n + * An ongoing sequence can be aborted at any time. The scan unit picks the pending channels one by one from a + * pending register and requests for their conversion. This API essentially clears the channel pending register thus + * creating an illusion that there are no more channels left in the sequence. + * A call to this API would configure the registers BRSMR, BRSCTRL, GxARBPR(if group is available) to abort the + * current scan sequence. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GLOBAL_BackgroundAbortSequence(XMC_VADC_GLOBAL_t *const global_ptr); + +/** + * @param global_ptr Pointer to the VADC module + * @param grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan + * Request source + * @param ch_num The unprioritized channel meant to be added to the scan sequence + *
Range: [0x0 to 0x7] + * @return + * None + * + * \parDescription:
+ * Adds a channel to the background scan sequence.
\n + * Call this API to insert a new single channel into the background scan request source. This will be added to the scan + * sequence. The added channel will be part of the conversion sequence when the next load event occurs. + * A call to this API would configure the register bit fields of BRSSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundAddMultipleChannels()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundAddChannelToSequence(XMC_VADC_GLOBAL_t *const global_ptr, + const uint32_t grp_num, + const uint32_t ch_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundAddChannelToSequence:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundAddChannelToSequence:Wrong Group Number",((grp_num) < XMC_VADC_MAXIMUM_NUM_GROUPS)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundAddChannelToSequence:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + global_ptr->BRSSEL[grp_num] |= (uint32_t)((uint32_t)1 << ch_num); +} + +/** + * @param global_ptr Pointer to the VADC module + * @param grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan + * @param ch_mask Mask word indicating channels which form part of scan conversion sequence + * Bit location 0/1/2/3/4/5/6/7 represents channels-0/1/2/3/4/5/6/7 respectively. + * To Add the channel to the scan sequence enable the respective bit. + * Passing a 0x0 will clear all the previously selected channels + *
Range: [0x0 to 0xFF] + * @return + * None + * + * \parDescription:
+ * Adds multiple channels to the scan sequence.
\n + * Call this API to insert a multiple channels into the scan request source. This will be added to a scan + * sequence. The added channels will be a part of the conversion sequence when the next load event occurs. + * A call to this API would configure the register bit fields of BRSSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundAddChannelToSequence()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgndAddMultipleChannels(XMC_VADC_GLOBAL_t *const global_ptr, + const uint32_t grp_num, + const uint32_t ch_mask) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgndAddMultipleChannels:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgndAddMultipleChannels:Wrong Group Number", ((grp_num) < XMC_VADC_MAXIMUM_NUM_GROUPS)) + global_ptr->BRSSEL[grp_num] |= ch_mask; +} + +/** + * @param global_ptr Pointer to the VADC module + * @param grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan + * Request source + * @param ch_num The unprioritized channel meant to be added to the scan sequence + *
Range: [0x0 to 0x7] + * @return + * None + * + * \parDescription:
+ * Removes a channel to the background scan sequence.
\n + * Call this API to insert a new single channel into the background scan request source. This will be added to the scan + * sequence. The added channel will be part of the conversion sequence when the next load event occurs. + * A call to this API would configure the register bit fields of BRSSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundAddChannelToSequence()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundRemoveChannelFromSequence(XMC_VADC_GLOBAL_t *const global_ptr, + const uint32_t grp_num, + const uint32_t ch_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundAddChannelToSequence:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundAddChannelToSequence:Wrong Group Number",((grp_num) < XMC_VADC_MAXIMUM_NUM_GROUPS)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundAddChannelToSequence:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + global_ptr->BRSSEL[grp_num] &= (uint32_t)~((uint32_t)1 << ch_num); +} + +/** + * @param global_ptr Pointer to the VADC module + * @param grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan + * @param ch_mask Mask word indicating channels which form part of scan conversion sequence + * Bit location 0/1/2/3/4/5/6/7 represents channels-0/1/2/3/4/5/6/7 respectively. + * To Add the channel to the scan sequence enable the respective bit. + * Passing a 0x0 will clear all the previously selected channels + *
Range: [0x0 to 0xFF] + * @return + * None + * + * \parDescription:
+ * Removes multiple channels to the scan sequence.
\n + * Call this API to insert a multiple channels into the scan request source. This will be added to a scan + * sequence. The added channels will be a part of the conversion sequence when the next load event occurs. + * A call to this API would configure the register bit fields of BRSSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundAddChannelToSequence()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgndRemoveMultipleChannels(XMC_VADC_GLOBAL_t *const global_ptr, + const uint32_t grp_num, + const uint32_t ch_mask) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgndAddMultipleChannels:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgndAddMultipleChannels:Wrong Group Number", ((grp_num) < XMC_VADC_MAXIMUM_NUM_GROUPS)) + global_ptr->BRSSEL[grp_num] &= (uint32_t)~ch_mask; +} + +/** + * @param global_ptr Pointer to the VADC module + * @param grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan RS + * @param ch_num The channel being audited for completion of conversion + *
Range: [0x0 to 0x7] + * @return + * bool returns true if the channel is pending conversion else returns false + * + * \parDescription:
+ * Determine if the channel is pending.
\n + * This API will check if the Channel in question is awaiting conversion in the current arbitration round. + * When a load event occurs the scan sequence is pushed to a pending conversion register. + * From the pending register the channels are taken up by the converter. This API would return true + * if the channel is found in the pending register (BRSPND[\b grp_num]). + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundGetNumChannelsPending()
+ */ +__STATIC_INLINE bool XMC_VADC_GLOBAL_BackgroundIsChannelPending(XMC_VADC_GLOBAL_t *const global_ptr, + const uint32_t grp_num, + const uint32_t ch_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundIsChannelPending:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundIsChannelPending:Wrong Group Number", ((grp_num) < XMC_VADC_MAXIMUM_NUM_GROUPS)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundIsChannelPending:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + return( (bool)(global_ptr->BRSPND[grp_num] & (uint32_t)((uint32_t)1 << ch_num))); +} + +/** + * @param global_ptr Pointer to the VADC module + * @return
+ * uint32_t Returns the total channels pending for conversion. + *
Range: [0x0 to (0x8*number of groups)] + * + * \parDescription:
+ * Returns the number of pending channels.
\n + * This API will read the pending channels register and will return the number of channels that are awaiting conversion. + * When a load event occurs the scan sequence is pushed to a pending conversion register. + * From the pending register the channels are taken up by the converter. When the API is called it would + * return the total number of channels pending (BRSPND[\b grp_num]). + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundIsChannelPending()
+ */ +uint32_t XMC_VADC_GLOBAL_BackgroundGetNumChannelsPending(XMC_VADC_GLOBAL_t *const global_ptr); + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Manually asserts the conversion complete request source event.
\n + * This API will set the request source event for background scan. This will trigger a interrupt if the + * service node pointer for the scan has been configured. + * A call to this API would configure the register bit field GLOBEFLAG.SEVGLB. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundTriggerReqSrcEvent(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundTriggerReqSrcEvent:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->GLOBEFLAG |= (uint32_t)VADC_GLOBEFLAG_SEVGLB_Msk; +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Acknowledges the background scan conversion complete request source event.
\n + * This API will clear the request source event that occurred. This will clear a interrupt if it was raised. + * A call to this API would configure the register bit field GLOBEFLAG.SEVGLB + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundTriggerReqSrcEvent()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundClearReqSrcEvent(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundClearReqSrcEvent:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->GLOBEFLAG |= (uint32_t)VADC_GLOBEFLAG_SEVGLBCLR_Msk; +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * bool returns true if the service request event is raised. + * returns false if the service request event was not raised. + * + * \parDescription:
+ * Determines if the request source event is asserted.
+ * This API will get the status of the background scan request source event. Will return a true + * if the event has occurred for background scan. A call to this API would configure the register + * bit field GLOBEFLAG.SEVGLB. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE bool XMC_VADC_GLOBAL_BackgroundGetReqSrcEventStatus(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundGetReqSrcEventStatus:Wrong Module Pointer", (global_ptr == VADC)) + return((bool)(global_ptr->GLOBEFLAG & (uint32_t)VADC_GLOBEFLAG_SEVGLB_Msk)); +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Enables the trigger for background scan request source.
\n + * By using this API the trigger will be activated for the scan request source. The trigger signal and trigger + * edge will be selected from the BRSCTRL register. The Selection of a input will be done by + * XMC_VADC_GLOBAL_BackgroundSelectTrigger(). A call to this API would configure the register bit field BRSMR.ENTR. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundSelectTrigger()
XMC_VADC_GLOBAL_BackgroundDisableExternalTrigger()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundEnableExternalTrigger(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundEnableExternalTrigger:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->BRSMR |= (uint32_t)VADC_BRSMR_ENTR_Msk; +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Disables the trigger for background scan request source.
+ * By using this API the trigger will be deactivated for the background scan request source. + * This will just deactivate the H/W trigger for the background scan request source. If any configuration was done + * to select the trigger input in BRSCTRL will be not be effected. A call to this API would configure the register + * bit field BRSMR.ENTR. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundEnableExternalTrigger()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundDisableExternalTrigger(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundDisableExternalTrigger:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->BRSMR &= ~((uint32_t)VADC_BRSMR_ENTR_Msk); +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Enables the background scan request source event .
+ * By using this API the request source event will be activated for the background scan request source. + * Other configurations w.r.t service node pointer are not done in this API. + * A call to this API would configure the register bit field BRSMR.ENSI. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundEnableEvent(),
XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundEnableEvent(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundEnableEvent:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->BRSMR |= ((uint32_t)VADC_BRSMR_ENSI_Msk); +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Disables the background scan request source event .
+ * By using this API the request source event will be deactivated for the background scan request source. + * Other configurations w.r.t service node pointer are not done in this API. + * A call to this API would configure the register bit field BRSMR.ENSI. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_BackgroundEnableEvent(),
XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundDisableEvent(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundDisableEvent:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->BRSMR &= ~((uint32_t)VADC_BRSMR_ENSI_Msk); +} + +#if (XMC_VADC_QUEUE_AVAILABLE == 1U) +/** + * @param group_ptr Pointer to the VADC group + * @param config Pointer to initialization data structure + * @return + * None + * + * \parDescription:
+ * Initializes VADC QUEUE functional block.
\n + * The QUEUE request source functional block converts channels stored in a queue. The first channel entered into the + * queue is converted first. A channel once converted, can be placed back into the queue if desired(refill). + * A call to this API will first disable the arbitration slot for queue (XMC_VADC_GROUP_QueueEnableArbitrationSlot()) + * and then it would configure all the related registers with the required configuration values. + * The arbitration slot is re-enabled at the end of init by invoking XMC_VADC_GROUP_QueueDisableArbitrationSlot(). + * A call to this API would configure the registers GxARBPR, GxQCTRL0, GxQMR0 to configure the queue request + * source. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueEnableArbitrationSlot()
XMC_VADC_GROUP_QueueDisableArbitrationSlot()
+ * XMC_VADC_GROUP_QueueSelectTrigger()
XMC_VADC_GROUP_QueueSelectGating()
+ */ +void XMC_VADC_GROUP_QueueInit(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_QUEUE_CONFIG_t *config); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Enables arbitration slot of the queue request source.
\n + * If the QUEUE request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the queue channel can only be converted when the arbiter comes + * to the queue slot. Thus this must be enabled if any conversion need to take place. + * A call to this API would configure the register bit field GxARBPR.ASEN0. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueDisableArbitrationSlot()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueEnableArbitrationSlot(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueEnableArbitrationSlot:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)); + group_ptr->ARBPR |= (uint32_t)((uint32_t)1 << VADC_G_ARBPR_ASEN0_Pos); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Disables arbitration slot of the queue request source.
\n + * If the QUEUE request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the queue channel can only be converted when the arbiter comes + * to the queue slot.A call to this API will lead to all conversions request by queue to be blocked. + * A call to this API would configure the register bit field GxARBPR.ASEN0. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueEnableArbitrationSlot()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueDisableArbitrationSlot(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueDisableArbitrationSlot:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)); + group_ptr->ARBPR &= ~((uint32_t)VADC_G_ARBPR_ASEN0_Msk); +} + + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * bool returns true if the arbitration is enabled else returns false. + * + * \parDescription:
+ * Returns the arbitration status of the queue request source.
\n + * If the queue request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the queue channel can only be converted when the arbiter comes + * to the queue slot. A call to this API would return the status of the arbitration slot of queue. + * A call to this API would read the register bit field GxARBPR.ASEN1. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueEnableArbitrationSlot(),
XMC_VADC_GROUP_QueueDisableArbitrationSlot()
+ */ +__STATIC_INLINE bool XMC_VADC_GROUP_QueueIsArbitrationSlotEnabled(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueIsArbitrationSlotEnabled:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + return ((group_ptr->ARBPR & (uint32_t)VADC_G_ARBPR_ASEN0_Msk) >> VADC_G_ARBPR_ASEN0_Pos); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param input_num Choice of the input earmarked as a trigger line + * @return + * None + * + * \parDescription:
+ * Select Trigger signal for queue request source.
\n + * A queue request source will raise conversion request only if there were either a request from application or + * occurrence of a hardware trigger. This API selects one of the 16 input lines as a trigger line. This is + * needed when a hardware trigger is needed for the conversion of the queue request source. + * Refer to the reference manual to determine the signal that needs to be connected. + * A call to this API would configure the register bit field GxQCTRL0.XTSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueSelectGating()
XMC_VADC_GROUP_QueueEnableExternalTrigger()
+ */ +void XMC_VADC_GROUP_QueueSelectTrigger(XMC_VADC_GROUP_t *const group_ptr, + const XMC_VADC_TRIGGER_INPUT_SELECT_t input_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param trigger_edge Choice of the trigger edge + * @return + * None + * + * \parDescription:
+ * Select Trigger signal edge for queue request source.
\n + * A queue request source will raise conversion request only if there were either a request from application or + * occurrence of a hardware trigger. This API selects one of the 4 trigger edges. This is + * needed when a hardware trigger is needed for the conversion of the queue request source. + * Refer to the reference manual to determine the signal that needs to be connected. + * A call to this API would configure the register bit field GxQCTRL0.XTMODE. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueSelectGating()
XMC_VADC_GROUP_QueueEnableExternalTrigger()
+ */ +void XMC_VADC_GROUP_QueueSelectTriggerEdge(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_TRIGGER_EDGE_t trigger_edge); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param input_num Choice of the input earmarked as the gating line + * @return + * None + * + * \parDescription:
+ * Select Gating signal for queue request source.
\n + * Passage of the trigger input to the request source can be controlled via a gating signal. Any one of the 16 input + * lines can be chosen as a gating signal. Trigger signal can be given to the queue request source only + * when the gating signal's active level is detected. Additionally the GxQMR0.ENGT has to be configured for + * the gating signal's active level. A call to this API would configure the register bit field GxQCTRL0.GTSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueSelectTrigger()
+ */ +void XMC_VADC_GROUP_QueueSelectGating(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GATE_INPUT_SELECT_t input_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param mode_sel Select how the gating is applied to the queue request source + * @return + * None + * + * Details of function
+ * Selects the gating mode of queue request source.
\n + * Passage of the trigger input to the request source can be controlled via a gating signal. + * This API determines how the gating signal behaves, either active low or active high. + * If gating signal needs to ignored XMC_VADC_GATEMODE_IGNORE should be used as the \a mode_sel. + * A call to this API would configure the register bit field GxQMR0.ENGT. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueSelectGating(); + */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueSetGatingMode(XMC_VADC_GROUP_t *const group_ptr, XMC_VADC_GATEMODE_t mode_sel) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueSetGatingMode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_QueueSetGatingMode:Wrong mode selected", (mode_sel <= XMC_VADC_GATEMODE_ACTIVELOW)) + + /* Clear the existing gate configuration */ + group_ptr->QMR0 &= (uint32_t)(~((uint32_t) VADC_G_QMR0_ENGT_Msk)); + /* Set the new gating mode */ + group_ptr->QMR0 |= (uint32_t)((uint32_t)mode_sel << VADC_G_QMR0_ENGT_Pos); +} + + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Generates conversion request (Software initiated conversion).
+ * A conversion request can be raised either upon detection of a hardware trigger, or by software. This API forces + * the queue unit to generate a conversion request to the analog converter. It is assumed that the queue has already + * been filled up with entries. A call to this API would configure the register bit field GxQMR0.TREV. + * + * \parNote:
+ * The conversion of queue entry will start immediately after the entry has been loaded into GxQINR0. + * This happens only if the queue entry has been loaded into the register without the need for the H/W trigger.\n + * If a H/W Trigger is selected while loading the entry, the conversion will occur in one of the 2 ways: + *
    + *
  • The H/W generates a trigger needed for the queue request source. + *
  • The Conversion is triggered manually by calling this API. + *
+ * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueInsertChannel()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueTriggerConversion(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueTriggerConversion:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->QMR0 |= (uint32_t)((uint32_t)1 << VADC_G_QMR0_TREV_Pos); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * uint32_t returns the total number of channels. + *
Range: [0x0 to 0x8] + * + * \parDescription:
+ * Returns the number of channels present in the queue.
\n + * This API will return the queue buffer size. This buffer will be consisting of valid queue entries which + * will be converted when a trigger event occurs. All the entries that are loaded onto the GxQINR0 will + * be added to the queue buffer. Hence if an application needs to get the number of valid queue entries + * this API would provide the interface. A call to this API would access the registers GxQBUR0, GxQSR0 in order + * to determine the queue length. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueInsertChannel()
+ */ +uint32_t XMC_VADC_GROUP_QueueGetLength(XMC_VADC_GROUP_t *const group_ptr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Aborts an ongoing conversion by flushing the queue.
\n + * This API will flush the queue buffer. Ongoing conversion of the Queue request source will + * not be effected by this API. This would clear all the contents that are present in the queue buffer. + * A call to this API would configure the registers GxQCTRL0, GxQMR0, GxARBPR in order to abort + * the queue sequence. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueRemoveChannel()
XMC_VADC_GROUP_QueueFlushEntries()
+ */ +void XMC_VADC_GROUP_QueueAbortSequence(XMC_VADC_GROUP_t *const group_ptr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Flushing the queue Entry.
\n + * This API will flush one entry in the queue buffer. Ongoing conversion of the Queue request source will + * not be effected by this API. This would clear all the contents that are present in the queue buffer. + * A call to this API would configure the registers GxQMR0. This is a Blocking API, i.e will only exit when + * all the entries are removed from the queue. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueRemoveChannel()
XMC_VADC_GROUP_QueueAbortSequence(0
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueFlushEntries(XMC_VADC_GROUP_t *const group_ptr) +{ + /* Initiate flushing of the queue */ + group_ptr->QMR0 |= (uint32_t)VADC_G_QMR0_FLUSH_Msk; + + while( !((group_ptr->QSR0)& (uint32_t)VADC_G_QSR0_EMPTY_Msk)) + { + /* Wait until the queue is indeed flushed */ + } +} + + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Clears the next valid channel in the queue buffer.
\n + * A queue entry lined up for conversion can be removed and replaced by its successor. The call to this API will + * first check if a valid queue entry is present in the queue backup register if present would clear its valid flag. + * If no valid queue entries are present in the backup then the first channel + * present in the queue buffer would be cleared. + * A call to this API would configure the registers GxQCTRL0, GxQMR0, GxARBPR in order to clear a + * channel from the queue. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueInsertChannel()
+ */ +void XMC_VADC_GROUP_QueueRemoveChannel(XMC_VADC_GROUP_t *const group_ptr); + +/** + * + * @param group_ptr Constant pointer to the VADC group + * @param entry Details of the node being added + * @return + * None + * + * \parDescription:
+ * Inserts a queue entry to the tail of the queue buffer.
\n + * This API will insert a new channel into the queue buffer. The Queue will start conversion of + * the channels from the head of the buffer. This Insert will place the entry after the last valid entry. + * If no valid entries are present then this API will place the Queue entry at the head of the buffer. + * Then the successive call to the insert will place the new entry after the last entry. + * A call to this API would configure the register GxQINR0 for a single queue entry. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueRemoveChannel()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueInsertChannel(XMC_VADC_GROUP_t *const group_ptr, + const XMC_VADC_QUEUE_ENTRY_t entry) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueInsertChannel:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + /* Insert the channel physically and get the length of the queue*/ + group_ptr->QINR0 = entry.qinr0; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * int32_t Returns -1 if there are no channels for conversion + * Else would return the next valid channel for conversion. + *
Range: [0x0 to 0x8] + * + * \parDescription:
+ * Returns the next entry in the queue request source for conversion.
\n + * Identifies the channel in the queue lined up for conversion next. + * API will return a valid queue entry from the queue buffer. First checks for the valid channel entry + * in the backup register and returns if present. If the valid entry has not been found in the backup register + * then the queue buffer is searched for a valid entry. A call to this API would access the registers GxQ0R0, + * GxQBUR0 to determine the next channel. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueRemoveChannel()
XMC_VADC_GROUP_QueueInsertChannel()
+ */ +int32_t XMC_VADC_GROUP_QueueGetNextChannel(XMC_VADC_GROUP_t *const group_ptr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * int32_t Returns -1 if there is no channel that have been interrupted. + * Else would return the channel that is interrupted. + *
Range: [0x0 to 0x8] + * + * \parDescription:
+ * Identifies the channel whose conversion was suspended.
\n + * When using cancel inject repeat mode the canceled conversion will be placed in the backup register. + * This API will return the valid queue channel number from the backup register. This happens when ever + * there is a high priority conversion interrupts the conversion of queue request source. This forces the channel + * to goto the backup register. A call to this API would access the register GxQBUR0 to determine the + * interrupted channel. + * + * \parRelated APIs:
+ * None. + */ +int32_t XMC_VADC_GROUP_QueueGetInterruptedChannel(XMC_VADC_GROUP_t *const group_ptr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Manually asserts the conversion complete request source event.
\n + * This API will set the request source event for queue. This will trigger a interrupt if the + * service node pointer for the scan has been configured. + * A call to this API would configure the register bit field GxSEFLAG.SEV0. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueClearReqSrcEvent()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueTriggerReqSrcEvent(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueTriggerReqSrcEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->SEFLAG |= 1U; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Acknowledges the conversion complete request source event.
\n + * This API will clear the request source event that occurred. This will clear a interrupt if it was raised. + * A call to this API would configure the register bit field GxSEFCLR.SEV0. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueTriggerReqSrcEvent()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueClearReqSrcEvent(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueClearReqSrcEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->SEFCLR = (uint32_t)VADC_G_SEFCLR_SEV0_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * bool returns true if the service request event is raised. + * returns false if the service request event was not raised. + * + * \parDescription:
+ * Determines if the request source event is asserted.
+ * This API will get the status of the queue request source event. Will return a true + * if the event has occurred for queue. A call to this API would acces the register bit field GxSEFLAG.SEV0. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE bool XMC_VADC_GROUP_QueueGetReqSrcEventStatus(XMC_VADC_GROUP_t *const group_ptr) +{ + + XMC_ASSERT("XMC_VADC_GROUP_QueueGetReqSrcEventStatus:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + return(group_ptr->SEFLAG & (uint32_t)VADC_G_SEFLAG_SEV0_Msk); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param sr The service request line (Common SR lines, Group specific SR lines) + * @return + * None + * + * \parDescription:
+ * Connects the event to the SR line of VADC.
\n + * This API will connect a Service Request line(SR) to a queue request source event. Hence to get a interrupt on this + * Service request line one has to enable the required NVIC node. A call to this API would configure the register + * bit field GxSEVNP.SEVNP0. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_QueueSetReqSrcEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_SR_t sr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Enables the trigger for queue request source.
\n + * By using this API the trigger will be activated for the queue request source. The trigger signal and trigger + * edge will be selected from the QCTRL register. The Selection of a input will be done by + * XMC_VADC_GROUP_QueueSelectTrigger(). A call to this API would configure the register bit field GxQMR0.ENTR + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueSelectTrigger()
XMC_VADC_GROUP_QueueDisableExternalTrigger()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueEnableExternalTrigger(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueEnableExternalTrigger:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + group_ptr->QMR0 |= (uint32_t)VADC_G_QMR0_ENTR_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Disables the trigger for queue request source.
+ * By using this API the trigger will be deactivated for the queue request source. + * This will just deactivate the H/W trigger for the queue request source. If any configuration was done + * to select the trigger input in GxQCTRL0 will be not be effected. A call to this API would configure the + * register bit field GxQMR0.ENTR + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueEnableExternalTrigger()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueDisableExternalTrigger(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueDisableExternalTrigger:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + group_ptr->QMR0 &= ~((uint32_t)VADC_G_QMR0_ENTR_Msk); +} +#endif + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num The channel being initialized + *
Range: [0x0 to 0x7] + * @param config Pointer to initialization data + * @return + * None + * + * \parDescription:
+ * Initializes the ADC channel for conversion.
\n + * This API will do the channel related initializations. This includes configuration of the CHCTR settings + * and boundary flag settings. This must be called in the application in order to enable the conversion of + * a channel. After a request source has been initialized this API has to be called for each channel that + * has to be converted. A call to this API would configure the registers GxCHCTR GxBFL GxALIAS GxCHASS + * GxBFLC(depending on device) in order to configure the channel. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_ChannelInit(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num, + const XMC_VADC_CHANNEL_CONFIG_t *config); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param src_ch_num Channel which will be converted by \b alias_ch_num, when called by the request source. + *
Range:[0x0 to 0x7] + * @param alias_ch_num This is the alias channel (Ch-0 or Ch-1) + *
Range:[0x0, 0x1] + * @return + * None + * + * \parDescription:
+ * Sets the Alias channel(\b alias_ch_num) to convert from the source channel(\b src_ch_num).
\n + * When a alias configuration takes place the request source(queue/scan/background) will not call channel \b src_ch_num. + * The Request sources will call the channel \b alias_ch_num , this would invoke the conversion of + * the pin associated with \b src_ch_num. The configuration of the alias channel (\b alias_ch_num) will be used + * for the conversion.\n + * When an alias channel (Ch-0 or Ch-1) receives a trigger, it converts the aliased channel (\b src_ch_num). + * The properties of Ch-0 or Ch-1 (as indicated in \b alias_ch_num ) apply when \b src_ch_num is converted. + * A call to this API would configure the register GxALIAS. + * + * \parNote:
+ * Alias Channel (\b alias_ch_num) and the source channel (\b src_ch_num) cannot be the same. + * If they are, that alias feature is not used for the conversion. In order to Reset the alias + * feature that was previously selected this method can be used. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_SetChannelAlias(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t src_ch_num, + const uint32_t alias_ch_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose input was converted + *
Range: [0x0 to 0x7] + * @return + * bool Returns true if there was violation w.r.t the specified boundaries. + * + * \parDescription:
+ * Determines if the result of the channel confines with the specified boundaries.
\n + * An application may not necessarily always need to know the exact value of the converted result, but merely + * an indication if the generated result is within stipulated boundaries. Generation of Channel event can be subject + * to channel event generation criteria (Generate always, Never generate, Generate if result is out of bounds, + * Generate if result is within bounds). When interrupts are not enabled, this API can be used to determine the + * nature of the result. A call to this API would access the registers GxCHCTR and GxCEFLAG in order to determine + * if a violation has occured. + * + * \parRelated APIs:
+ * None + */ +bool XMC_VADC_GROUP_ChannelIsResultOutOfBounds(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose input is to be converted + *
Range: [0x0 to 0x7] + * @param ref Reference voltage + * @return + * None + * + * \parDescription:
+ * Selects the reference voltage for conversion.
\n + * An internal voltage reference (VARef) or an external voltage reference fed to Ch-0 can serve as a voltage reference + * for conversions. A call to this API would configure the register bit field GxCHCTR.REFSEL. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_ChannelSetInputReference(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num, + const XMC_VADC_CHANNEL_REF_t ref); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose i/p is to be converted + *
Range: [0x0 to 0x7] + * @param result_reg_num Result Register associated with this channel + * @return + * None + * + * \parDescription:
+ * Selects the target result register.
\n + * There are upto 16 result registers which a channel can choose from to store the results of conversion. + * This selects only the group related result registers. A call to this API would configure the register + * bit field GxCHCTR.RESREG. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_ChannelSetResultRegister(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const uint32_t result_reg_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose conversion class is to be configured + *
Range: [0x0 to 0x7] + * @param conversion_class conversion property to be associated with this channel + * @return + * None + * + * \parDescription:
+ * Selects the conversion class registers.
\n + * It configures the channel to have a particular conversion class properties like sampling + * time and resolution. A call to this API would configure the register + * bit field GxCHCTR.ICLSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelGetInputClass(). + */ +void XMC_VADC_GROUP_ChannelSetIclass(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const XMC_VADC_CHANNEL_CONV_t conversion_class); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose result alignment is to be returned + *
Range: [0x0 to 0x7] + * @return + * XMC_VADC_RESULT_ALIGN_LEFT if the result are aligned to the left + * XMC_VADC_RESULT_ALIGN_RIGHT if the result are aligned to the right + * + * \parDescription:
+ * Returns the channel result alignment.
\n + * The results are aligned either to the left or to the right. A left aligned 10bit resolution has its LSB + * at bit2 where as a left aligned 8bit resolution starts at bit4. A call to this API would return the currently + * configured alignment value. + * A call to this API would read the register bit field GxCHCTR.RESPOS. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE XMC_VADC_RESULT_ALIGN_t XMC_VADC_GROUP_ChannelGetResultAlignment(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num) +{ + XMC_ASSERT("XMC_VADC_GROUP_ChannelGetResultAlignment:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelGetResultAlignment:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + return ((XMC_VADC_RESULT_ALIGN_t)((group_ptr->CHCTR[ch_num] & (uint32_t)VADC_G_CHCTR_RESPOS_Msk) >> + (uint32_t)VADC_G_CHCTR_RESPOS_Pos) ); +} + + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose result alignment is to be returned + *
Range: [0x0 to 0x7] + * @return + * XMC_VADC_CHANNEL_CONV_t Returns the configured input class for the \b ch_num + * + * \parDescription:
+ * Returns the channel's input class for conversion for the required channel.
\n + * The sampling time and resolution can be taken from any of the 4 possible Input class registers. + * This API would return the input class register that is taken up by \b ch_num for conversion. + * A call to this API would read the register bit field GxCHCTR.RESPOS. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelSetIclass(). + */ +__STATIC_INLINE XMC_VADC_CHANNEL_CONV_t XMC_VADC_GROUP_ChannelGetInputClass(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num) +{ + XMC_ASSERT("XMC_VADC_GROUP_ChannelGetInputClass:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelGetInputClass:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + return ((XMC_VADC_CHANNEL_CONV_t)((group_ptr->CHCTR[ch_num] & (uint32_t)VADC_G_CHCTR_ICLSEL_Msk) >> + (uint32_t)VADC_G_CHCTR_ICLSEL_Pos) ); +} + +/** + * + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose associated result register is to be found + *
Range: [0x0 to 0x7] + * @return + * uint8_t returns the Group result register to which it is linked to. + *
Range: [0x0 to 0xF] + * + * \parDescription:
+ * Returns the result register associated with this channel.
\n + * There are upto 16 result registers which a channel can choose from to store the results of conversion. + * This returns only the group related result registers. A call to this API would access the register + * bit field GxCHCTR.RESREG. + * + * \parRelated APIs:
+ * None. + */ +uint8_t XMC_VADC_GROUP_ChannelGetResultRegister(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose channel event is to be asserted + *
Range: [0x0 to 0x7] + * @return + * None + * + * \parDescription:
+ * Manually asserts a Channel event.
\n + * It is merely the channel event which is asserted. For this asserted event to lead to an interrupt, it must + * have been bound to an SR and that SR must have been enabled. It can potentially lead to an interrupt if the + * SR line is connected to an NVIC node. A call to this API would configure the register bit fields of GxCEFLAG. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelClearEvent(). + */ +void XMC_VADC_GROUP_ChannelTriggerEvent(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * uint32_t returns the asserted channel events + * + * \parDescription:
+ * Returns the Channel event flag register.
\n + * The return is merely the channel events which are asserted. + * A call to this API would read the register bit fields of GxCEFLAG. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelClearEvent(). + */ +__STATIC_INLINE uint32_t XMC_VADC_GROUP_ChannelGetAssertedEvents(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ChannelGetAssertedEvents:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + return(group_ptr->CEFLAG); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose channel event is to be acknowledged + *
Range: [0x0 to 0x7] + * @return + * None + * + * \parDescription:
+ * Acknowledges a Channel event.
\n + * When a channel event is raised after the conversion of that channel, it has to be cleared. This API would clear + * the Channel event of a particular channel if it has occurred. A call to this API would configure the register + * bit fields of GxCEFCLR. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelTriggerEvent(). + */ +__STATIC_INLINE void XMC_VADC_GROUP_ChannelClearEvent(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + + XMC_ASSERT("XMC_VADC_GROUP_ChannelClearEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelClearEvent:Wrong Channel Number", ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + group_ptr->CEFCLR = (uint32_t)((uint32_t)1 << ch_num); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose channel event is to be connected to a service request line + *
Range: [0x0 to 0x7] + * @param sr The service request line to which the channel event is to be connected + * @return + * None + * + * \parDescription:
+ * Binds a channel event to a requested Service Request line.
\n + * The channel event is connected to a service request line. For an event to result in an interrupt, this service + * request line must be enabled in VADC and the NVIC node which this service request line is connected to must have + * interrupt generation enabled. A call to this API would configure the register bit fields of GxCEVNP0. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelTriggerEvent()
XMC_VADC_GROUP_ChannelClearEvent() + */ +void XMC_VADC_GROUP_ChannelSetEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const XMC_VADC_SR_t sr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose channel event is being configured + *
Range: [0x0 to 0x7] + * @param criteria The condition under which the channel may assert its channel event + * @return + * None + * + * \parDescription:
+ * Defines the conditions under which a channel may assert its channel event.
\n + * The channel event can be generated under the following conditions - Always, Never, Result Out of bounds and Result + * inside the boundaries. A call to this API would configure the register bit field GxCHCTR.CHEVMODE. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelTriggerEvent()
XMC_VADC_GROUP_ChannelClearEvent()
+ * XMC_VADC_GROUP_ChannelSetEventInterruptNode()
+ */ +void XMC_VADC_GROUP_ChannelTriggerEventGenCriteria(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const XMC_VADC_CHANNEL_EVGEN_t criteria); + + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose channel event is being configured + *
Range: [0x0 to 0x7] + * @param boundary_sel Select the upper/lower boundary configuration . + * @param selection The boundary value selected for \b boundary_sel. + * @return + * None + * + * \parDescription:
+ * Configure the boundary selection for the given channel
\n + * The channel event can be generated under the following conditions - Always, Never, Result Out of bounds and Result + * inside the boundaries. The boundary values to which results are compared can be selected from several sources. + * A call to this API would configure the register bit field GxCHCTR.BNDSELL or GxCHCTR.BNDSELU . + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_ChannelSetBoundarySelection(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + XMC_VADC_BOUNDARY_SELECT_t boundary_sel, + XMC_VADC_CHANNEL_BOUNDARY_t selection); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg_num Result register which is intended to be initialized + *
Range: [0x0 to 0xF] + * @param config Pointer to initialization data + * @return + * None + * + * \parDescription:
+ * Initializes a Group Result Register.
+ * Various options needed for the working of the result result will be configured with this API. + * This would determine the result handling of the group registers. This API must be called after + * the channel Init (XMC_VADC_GROUP_ChannelInit())to initialize the result register that is selected for the channel. + * This API would also determine if the result register that is being configured has to a part of a FIFO buffer. + * In this API one can also configure the various result handling options line FIR/IIR filters and it order. + * Also configures the Data reduction to accumulate 2/3/4 results need to be done. This API will also configure + * the result event generation. A call to this API would configure the register GxRCR with the \b config . + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_AddResultToFifo()
XMC_VADC_GROUP_EnableResultEvent()
XMC_VADC_GROUP_DisableResultEvent()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ResultInit(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t res_reg_num, + const XMC_VADC_RESULT_CONFIG_t *config) +{ + XMC_ASSERT("XMC_VADC_GROUP_ResultInit:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->RCR[res_reg_num] = config->g_rcr; + +} + + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Register which is required to be a part of results FIFO + *
Range: [0x0 to 0xF] + * @return + * None + * + * \parDescription:
+ * Adds result register to Result FIFO.
\n + * Sometimes, the rate of consumption of results by application software may not match the rate at which the + * results are produced. A Result FIFO thus helps a slow consumer to read out results without loss of data. + * When a result register is added to fifo, it is in fact chained to its higher numbered neighbor. For example, if + * Result Register-5 is to be added to FIFO, it gets chained to Result Register-6. Results are written to Register-6 + * while the same can be read out of Register-5 leisurely by software. + * A call to this API would configure the register bit field GxRCR.FEN. + * + * \parNote:
+ * The FIFO is always read by the software with the lowest numbered result register. + * The hardware will write the results from the highest numbered result register. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_AddResultToFifo(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register for which event generation is to be enabled + *
Range: [0x0 to 0xF] + * @return + * None + * + * \parDescription:
+ * Enables result event generation.
\n + * Once the results of conversion are available, the result event (which is being enabled in this function) + * if connected to a service request line(Group or Shared service request) can lead to an interrupt. It is therefore + * not only necessary to enable the event, but also to connect it to a service request line. The + * service request generation capability must also be enabled and so should the corresponding NVIC node. + * A call to this API would configure the register bit field GxRCR.SRGEN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_SetResultInterruptNode(). + */ +__STATIC_INLINE void XMC_VADC_GROUP_EnableResultEvent(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + + XMC_ASSERT("XMC_VADC_GROUP_EnableResultEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_EnableResultEvent:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + group_ptr->RCR[res_reg] |= (uint32_t)VADC_G_RCR_SRGEN_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register for which event generation is to be disabled + *
Range: [0x0 to 0xF] + * @return + * None + * + * \parDescription:
+ * Disable result event generation.
\n + * This would just disable the event. It would not alter anything w.r.t the SR line if it was configured. + * A call to this API would configure the register bit field GxRCR.SRGEN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_EnableResultEvent(). + */ +__STATIC_INLINE void XMC_VADC_GROUP_DisableResultEvent(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + XMC_ASSERT("XMC_VADC_GROUP_DisableResultEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_DisableResultEvent:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + group_ptr->RCR[res_reg] &= ~((uint32_t)VADC_G_RCR_SRGEN_Msk); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register from which the result of conversion is to be read out + *
Range: [0x0 to 0xF] + * @return + * uint32_t returns the complete result register GxRESy. + * + * \parDescription:
+ * Returns the result register completely (result of conversion as well as other info).
\n + * The Result register will have information regarding the channel that is requesting the conversion, + * if the result is valid, if the fast compare bit, Data Reduction Counter, and the request source information. + * All these information will be returned back. And if the user is polling for the result he can use the + * result if the valid bit is set. A call to this API would return the complete register GxRES. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_GetResult(). + */ +__STATIC_INLINE uint32_t XMC_VADC_GROUP_GetDetailedResult(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + XMC_ASSERT("XMC_VADC_GROUP_GetDetailedResult:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_GetDetailedResult:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + return(group_ptr->RES[res_reg]); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register from which the result of conversion is to be read out + *
Range: [0x0 to 0xF] + * @return + * XMC_VADC_RESULT_SIZE_t Result register values. + *
Range:[ 0x0 to 0xFFF] (Result of single conversion. Accumulated results not considered for range) + * + * \parDescription:
+ * Returns the result of the conversion.
\n + * This API will only return the result of the conversion and will strip out the other information that is present + * in the result register. A call to this API would access the register bit field GxRES.RESULT. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_GetDetailedResult(). + */ +__STATIC_INLINE XMC_VADC_RESULT_SIZE_t XMC_VADC_GROUP_GetResult(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t res_reg) +{ + XMC_ASSERT("XMC_VADC_GROUP_GetResult:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_GetResult:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + + return ((XMC_VADC_RESULT_SIZE_t)group_ptr->RES[res_reg]); +} + +/** + * + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register for which the compare value is being set + *
Range: [0x0 to 0xF] + * @param compare_val The compare value itself + *
Range: [0x0 to 0xFFF] + * @return + * None + * + * \parDescription:
+ * Configures the compare value (relevant to the Fast Compare Mode).
\n + * A channel input can be converted and its value stored in its result register. Alternatively, the channel input can + * be converted and compared against a compare value. This is the fast compare mode typically utilized by applications + * that are not interested in absolute converted value of an analog input, but rather a binary decision on how the + * input fares against a preset compare value. The channel should have had already chosen the correct ICLASS with + * the fast compare mode enabled. \b compare_val would be the compare value on which FCM bit in the result + * register will be set. The FCM bit will be set if the analog voltage is greater than the compare value. + * A call to this API would configure the register bit field GxRES.RESULT. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_GetFastCompareResult(). + */ +void XMC_VADC_GROUP_SetResultFastCompareValue(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t res_reg, + const XMC_VADC_RESULT_SIZE_t compare_val); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register for which the compare value is being set + *
Range: [0x0 to 0xF] + * @return + * ::XMC_VADC_FAST_COMPARE_t If the input is greater or lower than the compare value returns the appropriate enum. + * if the valid flag was not set then it would return XMC_VADC_FAST_COMPARE_UNKNOWN. + * + * \parDescription:
+ * Determines the input is greater/lower than the compare value.
\n + * This API determines if the input is greater/lower than the preset compare value. + * A call to this API would access the register bit field GxRES.FCM. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_SetResultFastCompareValue(). + */ +XMC_VADC_FAST_COMPARE_t XMC_VADC_GROUP_GetFastCompareResult(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg); + +/** + * + * @param group_ptr Constant pointer to the VADC group + * @param subtraction_val 12 bit subtraction value + *
Range: [0x0 to 0xFFF] + * @return + * None + * + * \parDescription:
+ * Configures the subtraction value (relevant to the Difference Mode).
\n + * A channel input can be converted and its value stored in its result register. Alternatively, the channel input can + * be converted and subtracted with the value stored in GxRES[0]. This Difference Mode typically utilized by + * applications that are not interested in absolute converted value of an analog input, but rather a difference of + * converted values. Subtraction value will always be present in the GxRES[0] and thus this API would configure + * that register. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_SetResultSubtractionValue(XMC_VADC_GROUP_t *const group_ptr, + const uint16_t subtraction_val); +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register for which the result event is being asserted + *
Range: [0x0 to 0xF] + * @return + * None + * + * \parDescription:
+ * Manually asserts the result event.
\n + * The result event must necessarily be connected to a SR line. The SR in turn must have been enabled along with the + * corresponding NVIC node. Only then will the assertion of RES event lead to an interrupt. + * A call to this API would access the register bit fieldS OF GxREFLAG. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ClearResultEvent(). + */ +__STATIC_INLINE void XMC_VADC_GROUP_TriggerResultEvent(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + XMC_ASSERT("XMC_VADC_GROUP_TriggerResultEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_TriggerResultEvent:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + group_ptr->REFLAG = (uint32_t)((uint32_t)1 << res_reg); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * uint32_t returns the asserted result events + * + * \parDescription:
+ * Returns the Result event flag register.
\n + * The return is merely the result events which are asserted. + * A call to this API would read the register bit fields of GxREFLAG. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_TriggerResultEvent(). + */ +__STATIC_INLINE uint32_t XMC_VADC_GROUP_GetAssertedResultEvents(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_GetAssertedResultEvents:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + return(group_ptr->REFLAG); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register for which the result event is being acknowledged + *
Range: [0x0 to 0xF] + * @return + * None + * + * \parDescription:
+ * Acknowledges a Result event.
\n + * When a Result event is raised after the conversion of that associated channel has produced a result and + * it has to be cleared. This API would clear the Channel event of a particular channel if it has occurred. + * A call to this API would access the register bit fields of GxREFCLR. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelTriggerEvent(). + */ +__STATIC_INLINE void XMC_VADC_GROUP_ClearResultEvent(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + XMC_ASSERT("XMC_VADC_GROUP_ClearResultEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ClearResultEvent:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + group_ptr->REFCLR = (uint32_t)((uint32_t)1 << res_reg); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register for which the result event is being asserted + *
Range: [0x0 to 0xF] + * @param sr The SR line to which the result event must be connected + * @return + * None + * + * \parDescription:
+ * Binds a result event to a requested Service Request line.
\n + * The result event is connected to a service request line. For an event to result in an interrupt, this service + * request line must be enabled in VADC and the NVIC node which this service request line is connected to must have + * interrupt generation enabled. A call to this API would access the registers GxREVNP0 GxREVNP1. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_TriggerResultEvent()
XMC_VADC_GROUP_ClearResultEvent() + */ +void XMC_VADC_GROUP_SetResultInterruptNode(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t res_reg, + const XMC_VADC_SR_t sr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register which forms a part of FIFO + *
Range: [0x0 to 0xF] + * @return + * uint32_t returns the Result register number which is the tail of the FIFO,\b res_reg is apart of this FIFO. + * + * \parDescription:
+ * Returns the the FIFO tail (register from where to read the results).
\n + * The analog converter writes to the head of the FIFO. It is the head of the FIFO which is bound to the channel. + * Applications read the result from the tail of the FIFO. This API would return the result + * register from where a user can call the API XMC_VADC_GROUP_GetResult() to read the result stored in the FIFO. + * A call to this API would access the register bit field GxRCR.FEN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_GetResultFifoHead()
+ */ +uint32_t XMC_VADC_GROUP_GetResultFifoTail(XMC_VADC_GROUP_t *const group_ptr, uint32_t res_reg); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register which forms a part of fifo + *
Range: [0x0 to 0xF] + * @return + * uint32_t returns the Result register number which is the head of the FIFO,\b res_reg is apart of this FIFO. + * + * \parDescription:
+ * Returns the the FIFO head (register to which the results are written by H/W).
\n + * The analog converter writes to the head of the FIFO. It is the head of the FIFO which is bound to the channel. + * Applications read the result from the tail of the FIFO. This API would just return the head of the FIFO + * from where the results are being added to the FIFO. + * A call to this API would access the register bit field GxRCR.FEN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_GetResultFifoHead()
+ */ +uint32_t XMC_VADC_GROUP_GetResultFifoHead(XMC_VADC_GROUP_t *const group_ptr,const uint32_t res_reg); + +/** + * + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register in question + *
Range: [0x0 to 0xF] + * @return + * bool returns true if the \b res_reg is the FIFO head. + * + * \parDescription:
+ * Determines if the requested register is the head of a FIFO.
\n + * The analog converter writes to the head of the FIFO. It is the head of the FIFO which is bound to the channel. + * Applications read the result from the tail of the FIFO. + * A call to this API would access the register bit field GxRCR.FEN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_GetResultFifoHead()
+ */ +bool XMC_VADC_GROUP_IsResultRegisterFifoHead(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg); + +/** + * + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register number
+ *
Range: [0x0 to 0xF] + * @return + * bool returns true if the \b res_reg is the FIFO member, else false. + * + * \parDescription:
+ * Determines whether the specified register is a FIFO member or not.
\n + * The analog converter writes to the head of the FIFO. It is the head of the FIFO which is bound to the channel. + * Applications read the result from the tail of the FIFO. + * A call to this API would access the register bit field GxRCR.FEN. + * + */ +__STATIC_INLINE bool XMC_VADC_GROUP_IsResultRegisterInFifo(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t res_reg) +{ + + XMC_ASSERT("XMC_VADC_GROUP_IsResultRegisterInFifo:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_IsResultRegisterInFifo:Wrong Result Register", + ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + return( (bool)(group_ptr->RCR[res_reg] & (uint32_t)VADC_G_RCR_FEN_Msk)); +} + +#if XMC_VADC_RESULT_PRIORITY_AVAILABLE == 1U +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Registers which need to be set for priority conversions + * Bit location 0..15 represents Result Register-0..15 respectively. + * To add the result register as priority. + * Passing a 0x0 will clear all the selected channels + *
Range: [0x0 to 0xFFFF] + * @return + * None + * + * \parDescription:
+ * Prioritize a Result register for group conversions.
\n + * Applications that need to reserve certain result registers only for Queue and scan request sources should + * use this API. A call to this API would access the register bit fields of GxRRASS. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_GetResultRegPriority(). + */ +__STATIC_INLINE void XMC_VADC_GROUP_SetResultRegPriority(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_mask) +{ + XMC_ASSERT("XMC_VADC_GROUP_SetResultRegPriority:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->RRASS = (uint32_t)res_mask; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Get the priority of all Result register.
\n + * A call to this API would access the register bit fields of GxRRASS. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_SetResultRegPriority(). + */ +__STATIC_INLINE uint32_t XMC_VADC_GROUP_GetResultRegPriority(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_GetResultRegPriority:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + return(group_ptr->RRASS); +} +#endif +#endif + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_vadc_map.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_vadc_map.h new file mode 100644 index 00000000..865f6688 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_vadc_map.h @@ -0,0 +1,293 @@ +/** + * @file xmc_vadc_map.h + * @date 2016-11-17 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-15: + * - Initial version + * + * 2015-12-01: + * - Added: + * - XMC4300 device supported + * + * - Fixed: + * - Wrong MACRO name corrected for XMC4200/4100 devices. + * XMC_VADC_G3_SAMPLE renamed to XMC_VADC_G1_SAMPLE + * + * 2016-11-17: + * - Fixed: Add missing support for XMC47000 + * - Fixed: Renamed XMC_CCU_41_ST2 to XMC_CCU_41_ST3 + * - Added: New macros equivalent to th existing ones but with better naming. + * Old macros are kept for backward compatibility but they deprecated. + * - Added: ECAT support for XMC48/43 + * + * @endcond + * + */ + +#ifndef XMC_ADC_MAP_H +#define XMC_ADC_MAP_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************************************************************************************************************** + * MACROS + *********************************************************************************************************************/ +#if ( UC_FAMILY == XMC1 ) + +/* Group request source Gating input connection mappings */ +#define XMC_CCU_40_ST3 XMC_VADC_REQ_GT_A /**< @deprecated use instead XMC_VADC_REQ_GT_CCU40_ST3 */ +#define XMC_CCU_40_ST2 XMC_VADC_REQ_GT_B /**< @deprecated use instead XMC_VADC_REQ_GT_CCU40_ST2 */ +#define XMC_CCU_40_ST1 XMC_VADC_REQ_GT_C /**< @deprecated use instead XMC_VADC_REQ_GT_CCU40_ST1 */ +#define XMC_CCU_40_ST0 XMC_VADC_REQ_GT_D /**< @deprecated use instead XMC_VADC_REQ_GT_CCU40_ST0 */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_CCU_80_ST3_A XMC_VADC_REQ_GT_E /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_ST3A */ +#define XMC_CCU_81_ST3 XMC_VADC_REQ_GT_F /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_ST3 */ +#endif +#if (UC_SERIES != XMC13 && UC_SERIES != XMC11) +#define XMC_LEDTS0_FN XMC_VADC_REQ_GT_I /**< @deprecated use instead XMC_VADC_REQ_GT_LEDTS0_FN */ +#define XMC_LEDTS1_FN XMC_VADC_REQ_GT_J /**< @deprecated use instead XMC_VADC_REQ_GT_LEDTS1_FN */ +#endif +#define XMC_ERU_0_PDOUT2 XMC_VADC_REQ_GT_K /**< @deprecated use instead XMC_VADC_REQ_GT_ERU0_PDOUT2 */ +#define XMC_ERU_0_PDOUT3 XMC_VADC_REQ_GT_L /**< @deprecated use instead XMC_VADC_REQ_GT_ERU0_PDOUT3 */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_CCU_80_ST0 XMC_VADC_REQ_GT_M /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_ST0 */ +#define XMC_CCU_80_ST1 XMC_VADC_REQ_GT_N /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_ST1 */ +#endif +#define XMC_ERU_0_PDOUT0 XMC_VADC_REQ_GT_O /**< @deprecated use instead XMC_VADC_REQ_GT_ERU0_PDOUT0 */ +#define XMC_ERU_0_PDOUT1 XMC_VADC_REQ_GT_P /**< @deprecated use instead XMC_VADC_REQ_GT_ERU0_PDOUT1 */ + +/* Group request source Trigger input connection mappings */ +#define XMC_CCU_40_SR2 XMC_VADC_REQ_TR_A /**< @deprecated use instead XMC_VADC_REQ_TR_CCU40_SR2 */ +#define XMC_CCU_40_SR3 XMC_VADC_REQ_TR_B /**< @deprecated use instead XMC_VADC_REQ_TR_CCU40_SR3 */ +#if (UC_SERIES != XMC11) +#define XMC_BCCU0_TRIGOUT XMC_VADC_REQ_TR_F /**< @deprecated use instead XMC_VADC_REQ_TR_BCCU0_TRIGOUT0, XMC_VADC_REQ_TR_G0_BCCU0_TRIGOUT0 or XMC_VADC_REQ_TR_G1_BCCU0_TRIGOUT1 */ +#endif +#define XMC_ERU_0_IOUT2 XMC_VADC_REQ_TR_G /**< @deprecated use instead XMC_VADC_REQ_TR_ERU0_IOUT2 */ +#define XMC_ERU_0_IOUT3 XMC_VADC_REQ_TR_H /**< @deprecated use instead XMC_VADC_REQ_TR_ERU0_IOUT3 */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_CCU_80_SR2 XMC_VADC_REQ_TR_I /**< @deprecated use instead XMC_VADC_REQ_TR_CCU80_SR2 */ +#define XMC_CCU_80_SR3 XMC_VADC_REQ_TR_J /**< @deprecated use instead XMC_VADC_REQ_TR_CCU80_SR3 */ +#endif +#define XMC_ERU_0_IOUT0 XMC_VADC_REQ_TR_M /**< @deprecated use instead XMC_VADC_REQ_TR_ERU0_IOUT0 */ +#define XMC_ERU_0_IOUT1 XMC_VADC_REQ_TR_N /**< @deprecated use instead XMC_VADC_REQ_TR_ERU0_IOUT1 */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_POSIF_0_SR1 XMC_VADC_REQ_TR_O /**< @deprecated use instead XMC_VADC_REQ_TR_POSIF0_SR1 */ +#endif +#define XMC_REQ_GT_SEL XMC_VADC_REQ_TR_P /**< @deprecated use instead XMC_VADC_REQ_TR_REQ_GT_SEL */ + +/* Group request source Gating input connection mappings */ +#define XMC_VADC_REQ_GT_CCU40_ST3 XMC_VADC_REQ_GT_A /**< VADC Gating input A */ +#define XMC_VADC_REQ_GT_CCU40_ST2 XMC_VADC_REQ_GT_B /**< VADC Gating input B */ +#define XMC_VADC_REQ_GT_CCU40_ST1 XMC_VADC_REQ_GT_C /**< VADC Gating input C */ +#define XMC_VADC_REQ_GT_CCU40_ST0 XMC_VADC_REQ_GT_D /**< VADC Gating input D */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_VADC_REQ_GT_CCU80_ST3A XMC_VADC_REQ_GT_E /**< VADC Gating input E */ +#define XMC_VADC_REQ_GT_CCU80_ST3 XMC_VADC_REQ_GT_F /**< VADC Gating input F */ +#endif +#if (UC_SERIES != XMC13 && UC_SERIES != XMC11) +#define XMC_VADC_REQ_GT_LEDTS0_FN XMC_VADC_REQ_GT_I /**< VADC Gating input I */ +#define XMC_VADC_REQ_GT_LEDTS1_FN XMC_VADC_REQ_GT_J /**< VADC Gating input J */ +#endif +#define XMC_VADC_REQ_GT_ERU0_PDOUT2 XMC_VADC_REQ_GT_K /**< VADC Gating input K */ +#define XMC_VADC_REQ_GT_ERU0_PDOUT3 XMC_VADC_REQ_GT_L /**< VADC Gating input L */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_VADC_REQ_GT_CCU80_ST0 XMC_VADC_REQ_GT_M /**< VADC Gating input M */ +#define XMC_VADC_REQ_GT_CCU80_ST1 XMC_VADC_REQ_GT_N /**< VADC Gating input N */ +#endif +#define XMC_VADC_REQ_GT_ERU0_PDOUT0 XMC_VADC_REQ_GT_O /**< VADC Gating input O */ +#define XMC_VADC_REQ_GT_ERU0_PDOUT1 XMC_VADC_REQ_GT_P /**< VADC Gating input P */ + +/* Group request source Trigger input connection mappings */ +#define XMC_VADC_REQ_TR_CCU40_SR2 XMC_VADC_REQ_TR_A /**< VADC Trigger input A */ +#define XMC_VADC_REQ_TR_CCU40_SR3 XMC_VADC_REQ_TR_B /**< VADC Trigger input B */ +#if (UC_SERIES != XMC11) +#define XMC_VADC_REQ_TR_BCCU0_TRIGOUT0 XMC_VADC_REQ_TR_F /**< VADC Global Background Source Trigger input F */ +#define XMC_VADC_REQ_TR_G0_BCCU0_TRIGOUT0 XMC_VADC_REQ_TR_F /**< VADC Group 0 Trigger input F */ +#define XMC_VADC_REQ_TR_G1_BCCU0_TRIGOUT1 XMC_VADC_REQ_TR_F /**< VADC Group1 Trigger input F */ +#endif +#define XMC_VADC_REQ_TR_ERU0_IOUT2 XMC_VADC_REQ_TR_G /**< VADC Trigger input G */ +#define XMC_VADC_REQ_TR_ERU0_IOUT3 XMC_VADC_REQ_TR_H /**< VADC Trigger input H */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_VADC_REQ_TR_CCU80_SR2 XMC_VADC_REQ_TR_I /**< VADC Trigger input I */ +#define XMC_VADC_REQ_TR_CCU80_SR3 XMC_VADC_REQ_TR_J /**< VADC Trigger input J */ +#endif +#define XMC_VADC_REQ_TR_ERU0_IOUT0 XMC_VADC_REQ_TR_M /**< VADC Trigger input M */ +#define XMC_VADC_REQ_TR_ERU0_IOUT1 XMC_VADC_REQ_TR_N /**< VADC Trigger input N */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_VADC_REQ_TR_POSIF0_SR1 XMC_VADC_REQ_TR_O /**< VADC Trigger input O */ +#endif +#define XMC_VADC_REQ_TR_REQ_GT_SEL XMC_VADC_REQ_TR_P /**< VADC Trigger input P */ + +#endif + +#if ( UC_FAMILY == XMC4 ) + +/* Group request source Gating input connection mappings */ +#define XMC_CCU_40_ST3 XMC_VADC_REQ_GT_A /**< @deprecated use instead XMC_VADC_REQ_GT_CCU40_ST3 */ +#define XMC_CCU_41_ST3 XMC_VADC_REQ_GT_B /**< @deprecated use instead XMC_VADC_REQ_GT_CCU41_ST3 */ +#define XMC_CCU_40_SR0 XMC_VADC_REQ_GT_C /**< @deprecated use instead XMC_VADC_REQ_GT_CCU40_SR0 */ +#define XMC_CCU_41_SR1 XMC_VADC_REQ_GT_D /**< @deprecated use instead XMC_VADC_REQ_GT_CCU41_SR1 */ +#define XMC_CCU_80_ST3_A XMC_VADC_REQ_GT_E /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_ST3A */ +#define XMC_CCU_80_ST3_B XMC_VADC_REQ_GT_F /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_ST3B */ + +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_CCU_81_ST3_A XMC_VADC_REQ_GT_G /**< @deprecated use instead XMC_VADC_REQ_GT_CCU81_ST3A */ +#define XMC_CCU_81_ST3_B XMC_VADC_REQ_GT_H /**< @deprecated use instead XMC_VADC_REQ_GT_CCU81_ST3B */ +#endif + +#define XMC_DAC_0_SGN XMC_VADC_REQ_GT_I /**< @deprecated use instead XMC_VADC_REQ_GT_DAC0_SGN, XMC_VADC_REQ_GT_G0_DAC0_SGN or XMC_VADC_REQ_GT_G2_DAC0_SGN */ +#define XMC_DAC_1_SGN XMC_VADC_REQ_GT_I /**< @deprecated use instead XMC_VADC_REQ_GT_DAC0_SGN, XMC_VADC_REQ_GT_G1_DAC1_SGN or XMC_VADC_REQ_GT_G3_DAC1_SGN */ +#define XMC_LEDTS_FN XMC_VADC_REQ_GT_J /**< @deprecated use instead XMC_VADC_REQ_GT_LEDTS_FN */ +#define XMC_VADC_G0_BLOUT0 XMC_VADC_REQ_GT_K /**< @deprecated use instead XMC_VADC_REQ_GT_VADC_G1BFLOUT0 or XMC_VADC_REQ_GT_G0_VADC_G1BFLOUT0 */ +#define XMC_VADC_G1_BLOUT0 XMC_VADC_REQ_GT_K /**< @deprecated use instead XMC_VADC_REQ_GT_VADC_G1BFLOUT0 or XMC_VADC_REQ_GT_G1_VADC_G0BFLOUT0 */ +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_VADC_G2_BLOUT0 XMC_VADC_REQ_GT_K /**< @deprecated use instead XMC_VADC_REQ_GT_VADC_G1BFLOUT0 or XMC_VADC_REQ_GT_G2_VADC_G3BFLOUT0 */ +#define XMC_VADC_G3_BLOUT0 XMC_VADC_REQ_GT_K /**< @deprecated use instead XMC_VADC_REQ_GT_VADC_G1BFLOUT0 or XMC_VADC_REQ_GT_G3_VADC_G2BFLOUT0 */ +#endif +#define XMC_VADC_G0_SAMPLE XMC_VADC_REQ_GT_L /**< @deprecated use instead XMC_VADC_REQ_GT_G0_VADC_G3SAMPLE */ +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_VADC_G1_SAMPLE XMC_VADC_REQ_GT_L /**< @deprecated use instead XMC_VADC_REQ_GT_G1_VADC_G0SAMPLE */ +#define XMC_VADC_G2_SAMPLE XMC_VADC_REQ_GT_L /**< @deprecated use instead XMC_VADC_REQ_GT_G2_VADC_G1SAMPLE */ +#define XMC_VADC_G3_SAMPLE XMC_VADC_REQ_GT_L /**< @deprecated use instead XMC_VADC_REQ_GT_G3_VADC_G2SAMPLE */ +#endif +#define XMC_CCU_80_SR0 XMC_VADC_REQ_GT_M /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_SR0 */ +#define XMC_CCU_80_SR1 XMC_VADC_REQ_GT_N /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_SR1 */ +#define XMC_ERU_1_PDOUT0 XMC_VADC_REQ_GT_O /**< @deprecated use instead XMC_VADC_REQ_GT_ERU1_PDOUT0 */ +#define XMC_ERU_1_PDOUT1 XMC_VADC_REQ_GT_P /**< @deprecated use instead XMC_VADC_REQ_GT_ERU1_PDOUT1 */ + +/* Group request source Trigger input connection mappings */ +#define XMC_CCU_40_SR2 XMC_VADC_REQ_TR_A /**< @deprecated use instead XMC_VADC_REQ_TR_CCU40_SR2 */ +#define XMC_CCU_40_SR3 XMC_VADC_REQ_TR_B /**< @deprecated use instead XMC_VADC_REQ_TR_CCU40_SR3 */ +#define XMC_CCU_41_SR2 XMC_VADC_REQ_TR_C /**< @deprecated use instead XMC_VADC_REQ_TR_CCU41_SR2 */ +#define XMC_CCU_41_SR3 XMC_VADC_REQ_TR_D /**< @deprecated use instead XMC_VADC_REQ_TR_CCU41_SR3 */ +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_CCU_42_SR3 XMC_VADC_REQ_TR_E /**< @deprecated use instead XMC_VADC_REQ_TR_CCU42_SR3 */ +#define XMC_CCU_43_SR3 XMC_VADC_REQ_TR_F /**< @deprecated use instead XMC_VADC_REQ_TR_CCU43_SR3 */ +#endif +#define XMC_CCU_80_SR2 XMC_VADC_REQ_TR_I /**< @deprecated use instead XMC_VADC_REQ_TR_CCU80_SR2 */ +#define XMC_CCU_80_SR3 XMC_VADC_REQ_TR_J /**< @deprecated use instead XMC_VADC_REQ_TR_CCU80_SR3 */ +#define XMC_CCU_81_SR2 XMC_VADC_REQ_TR_K /**< @deprecated use instead XMC_VADC_REQ_TR_CCU81_SR2 */ +#define XMC_CCU_81_SR3 XMC_VADC_REQ_TR_L /**< @deprecated use instead XMC_VADC_REQ_TR_CCU81_SR3 */ +#define XMC_ERU_1_IOUT0 XMC_VADC_REQ_TR_M /**< @deprecated use instead XMC_VADC_REQ_TR_ERU1_IOUT0 */ +#define XMC_ERU_1_IOUT1 XMC_VADC_REQ_TR_N /**< @deprecated use instead XMC_VADC_REQ_TR_ERU1_IOUT1, XMC_VADC_REQ_TR_G0_ERU1_IOUT1 or XMC_VADC_REQ_TR_G1_ERU1_IOUT1 */ +#define XMC_ERU_1_IOUT2 XMC_VADC_REQ_TR_N /**< @deprecated use instead XMC_VADC_REQ_TR_ERU1_IOUT1, XMC_VADC_REQ_TR_G2_ERU1_IOUT2 or XMC_VADC_REQ_TR_G3_ERU1_IOUT1 */ +#if ( (UC_SERIES != XMC43) ) +#define XMC_POSIF_0_SR1 XMC_VADC_REQ_TR_O /**< @deprecated use instead XMC_VADC_REQ_TR_POSIF0_SR1, XMC_VADC_REQ_TR_G0_POSIF0_SR1 or XMC_VADC_REQ_TR_G2_POSIF0_SR1 */ +#endif +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_POSIF_1_SR1 XMC_VADC_REQ_TR_O /**< @deprecated use instead XMC_VADC_REQ_TR_POSIF0_SR1, XMC_VADC_REQ_TR_G1_POSIF0_SR1 or XMC_VADC_REQ_TR_G3_POSIF0_SR1 */ +#endif +#define XMC_REQ_GT_SEL XMC_VADC_REQ_TR_P /**< @deprecated use instead XMC_VADC_REQ_GT_CCU40_ST3 */ + +/* Group request source Gating input connection mappings */ +#define XMC_VADC_REQ_GT_CCU40_ST3 XMC_VADC_REQ_GT_A /**< VADC Gating input A */ +#define XMC_VADC_REQ_GT_CCU41_ST3 XMC_VADC_REQ_GT_B /**< VADC Gating input B */ +#define XMC_VADC_REQ_GT_CCU40_SR0 XMC_VADC_REQ_GT_C /**< VADC Gating input C */ +#define XMC_VADC_REQ_GT_CCU41_SR1 XMC_VADC_REQ_GT_D /**< VADC Gating input D */ +#define XMC_VADC_REQ_GT_CCU80_ST3A XMC_VADC_REQ_GT_E /**< VADC Gating input E */ +#define XMC_VADC_REQ_GT_CCU80_ST3B XMC_VADC_REQ_GT_F /**< VADC Gating input F */ +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_VADC_REQ_GT_CCU81_ST3A XMC_VADC_REQ_GT_G /**< VADC Gating input G */ +#define XMC_VADC_REQ_GT_CCU81_ST3B XMC_VADC_REQ_GT_H /**< VADC Gating input H */ +#endif +#define XMC_VADC_REQ_GT_DAC0_SGN XMC_VADC_REQ_GT_I /**< VADC Global Background Source Gating input I */ +#define XMC_VADC_REQ_GT_G0_DAC0_SGN XMC_VADC_REQ_GT_I /**< VADC Group 0 Gating input I */ +#define XMC_VADC_REQ_GT_G1_DAC1_SGN XMC_VADC_REQ_GT_I /**< VADC Group 1 Gating input I */ +#define XMC_VADC_REQ_GT_G2_DAC0_SGN XMC_VADC_REQ_GT_I /**< VADC Group 2 Gating input I */ +#define XMC_VADC_REQ_GT_G3_DAC1_SGN XMC_VADC_REQ_GT_I /**< VADC Group 3 Gating input I */ +#define XMC_VADC_REQ_GT_LEDTS_FN XMC_VADC_REQ_GT_J /**< VADC Gating input J */ +#define XMC_VADC_REQ_GT_VADC_G1BFLOUT0 XMC_VADC_REQ_GT_K /**< VADC Global Background Source Gating input K */ +#define XMC_VADC_REQ_GT_G0_VADC_G1BFLOUT0 XMC_VADC_REQ_GT_K /**< VADC Group 0 Gating input K */ +#define XMC_VADC_REQ_GT_G1_VADC_G0BFLOUT0 XMC_VADC_REQ_GT_K /**< VADC Group 1 Gating input K */ +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_VADC_REQ_GT_G2_VADC_G3BFLOUT0 XMC_VADC_REQ_GT_K /**< VADC Group 2 Gating input K */ +#define XMC_VADC_REQ_GT_G3_VADC_G2BFLOUT0 XMC_VADC_REQ_GT_K /**< VADC Group 3 Gating input K */ +#endif +#define XMC_VADC_REQ_GT_G0_VADC_G3SAMPLE XMC_VADC_REQ_GT_L /**< VADC Group 0 Gating input L */ +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_VADC_REQ_GT_G1_VADC_G0SAMPLE XMC_VADC_REQ_GT_L /**< VADC Group 1 Gating input L */ +#define XMC_VADC_REQ_GT_G2_VADC_G1SAMPLE XMC_VADC_REQ_GT_L /**< VADC Group 2 Gating input L */ +#define XMC_VADC_REQ_GT_G3_VADC_G2SAMPLE XMC_VADC_REQ_GT_L /**< VADC Group 3 Gating input L */ +#endif +#define XMC_VADC_REQ_GT_CCU80_SR0 XMC_VADC_REQ_GT_M /**< VADC Gating input M */ +#define XMC_VADC_REQ_GT_CCU80_SR1 XMC_VADC_REQ_GT_N /**< VADC Gating input N */ +#define XMC_VADC_REQ_GT_ERU1_PDOUT0 XMC_VADC_REQ_GT_O /**< VADC Gating input O */ +#define XMC_VADC_REQ_GT_ERU1_PDOUT1 XMC_VADC_REQ_GT_P /**< VADC Gating input P */ + +/* Group request source Trigger input connection mappings */ +#define XMC_VADC_REQ_TR_CCU40_SR2 XMC_VADC_REQ_TR_A /**< VADC Trigger input A */ +#define XMC_VADC_REQ_TR_CCU40_SR3 XMC_VADC_REQ_TR_B /**< VADC Trigger input B */ +#define XMC_VADC_REQ_TR_CCU41_SR2 XMC_VADC_REQ_TR_C /**< VADC Trigger input C */ +#define XMC_VADC_REQ_TR_CCU41_SR3 XMC_VADC_REQ_TR_D /**< VADC Trigger input D */ +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_VADC_REQ_TR_CCU42_SR3 XMC_VADC_REQ_TR_E /**< VADC Trigger input E */ +#define XMC_VADC_REQ_TR_CCU43_SR3 XMC_VADC_REQ_TR_F /**< VADC Trigger input F */ +#endif +#if ((UC_SERIES == XMC48) || (UC_SERIES == XMC43)) +#define XMC_VADC_REQ_TR_ECAT_SYNC0 XMC_VADC_REQ_TR_G /**< VADC Trigger input G */ +#define XMC_VADC_REQ_TR_ECAT_SYNC1 XMC_VADC_REQ_TR_H /**< VADC Trigger input H */ +#endif +#define XMC_VADC_REQ_TR_CCU80_SR2 XMC_VADC_REQ_TR_I /**< VADC Trigger input I */ +#define XMC_VADC_REQ_TR_CCU80_SR3 XMC_VADC_REQ_TR_J /**< VADC Trigger input J */ +#define XMC_VADC_REQ_TR_CCU81_SR2 XMC_VADC_REQ_TR_K /**< VADC Trigger input K */ +#define XMC_VADC_REQ_TR_CCU81_SR3 XMC_VADC_REQ_TR_L /**< VADC Trigger input L */ +#define XMC_VADC_REQ_TR_ERU1_IOUT0 XMC_VADC_REQ_TR_M /**< VADC Trigger input M */ +#define XMC_VADC_REQ_TR_ERU1_IOUT1 XMC_VADC_REQ_TR_M /**< VADC Global Background Source Trigger input N */ +#define XMC_VADC_REQ_TR_G0_ERU1_IOUT1 XMC_VADC_REQ_TR_N /**< VADC Group 0 Trigger input N */ +#define XMC_VADC_REQ_TR_G1_ERU1_IOUT1 XMC_VADC_REQ_TR_N /**< VADC Group 1 Trigger input N */ +#define XMC_VADC_REQ_TR_G2_ERU1_IOUT2 XMC_VADC_REQ_TR_N /**< VADC Group 2 Trigger input N */ +#define XMC_VADC_REQ_TR_G3_ERU1_IOUT2 XMC_VADC_REQ_TR_N /**< VADC Group 3 Trigger input N */ +#if ( (UC_SERIES != XMC43) ) +#define XMC_VADC_REQ_TR_POSIF0_SR1 XMC_VADC_REQ_TR_O /**< VADC Global Background Source Trigger input O */ +#define XMC_VADC_REQ_TR_G0_POSIF0_SR1 XMC_VADC_REQ_TR_O /**< VADC Group 0 Trigger input O */ +#define XMC_VADC_REQ_TR_G1_POSIF1_SR1 XMC_VADC_REQ_TR_O /**< VADC Group 1 Trigger input O */ +#endif +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_VADC_REQ_TR_G2_POSIF0_SR1 XMC_VADC_REQ_TR_O /**< VADC Group 2 Trigger input O */ +#define XMC_VADC_REQ_TR_G3_POSIF1_SR1 XMC_VADC_REQ_TR_O /**< VADC Group 3 Trigger input O */ +#endif +#define XMC_VADC_REQ_TR_REQ_GT_SEL XMC_VADC_REQ_TR_P /**< VADC Trigger input P */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_wdt.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_wdt.h new file mode 100644 index 00000000..223af6e6 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/inc/xmc_wdt.h @@ -0,0 +1,439 @@ +/** + * @file xmc_wdt.h + * @date 2015-08-06 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * - Documentation updates
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-08-06: + * - Bug fix in XMC_WDT_SetDebugMode() API, Wrong register is being configured.
+ * @endcond + */ + +#ifndef XMC_WDT_H +#define XMC_WDT_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ + +#include "xmc_common.h" +#include "xmc_scu.h" +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup WDT + * @brief Watchdog driver for the XMC microcontroller family. + * + * The watchdog unit (WDT) improves the system integrity, by triggering the system reset request to bring the system + * back from the unresponsive state to normal operation. + * + * This LLD provides the Configuration structure XMC_WDT_CONFIG_t and initialization function XMC_WDT_Init().\n + * It can be used to: + * -# Start or Stop the watchdog timer. (XMC_WDT_Start() and XMC_WDT_Stop()) + * -# Service the watchdog timer. (XMC_WDT_Service()) + * -# Configure the service window upper bound and lower bound timing values. (XMC_WDT_SetWindowBounds()) + * -# Enable the generation of the pre-warning event for the first overflow of the timer. (XMC_WDT_SetMode()) + * -# Clear the pre-warning alarm event. It is mandatory to clear the flag during pre-warning alarm ISR, to stop + generating reset request for the second overflow of the timer. (XMC_WDT_ClearAlarm()) + * -# Suspend the watchdog timer during Debug HALT mode. (XMC_WDT_SetDebugMode()) + * -# Configure service indication pulse width.(XMC_WDT_SetServicePulseWidth()) + * + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +#define XMC_WDT_MAGIC_WORD (0xABADCAFEU) /* Magic word to be written in Service Register (SRV), + to service or feed the watchdog. */ + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/** + * Defines working modes for watchdog. Use type XMC_WDT_MODE_t for this enum. + */ +typedef enum XMC_WDT_MODE +{ + XMC_WDT_MODE_TIMEOUT = (uint32_t)0x0 << WDT_CTR_PRE_Pos, /**< Generates reset request as soon as the timer overflow + occurs. */ + XMC_WDT_MODE_PREWARNING = (uint32_t)0x1 << WDT_CTR_PRE_Pos /**< Generates an alarm event for the first overflow. And + reset request after subsequent overflow, if not + serviced after first overflow. */ +} XMC_WDT_MODE_t; + +/** + * Defines debug behaviour of watchdog when the CPU enters HALT mode. Use type XMC_WDT_DEBUG_MODE_t for this enum. + */ +typedef enum XMC_WDT_DEBUG_MODE +{ + XMC_WDT_DEBUG_MODE_STOP = (uint32_t)0x0 << WDT_CTR_DSP_Pos, /**< Watchdog counter is paused during debug halt. */ + XMC_WDT_DEBUG_MODE_RUN = (uint32_t)0x1 << WDT_CTR_DSP_Pos /**< Watchdog counter is not paused during debug halt. */ +} XMC_WDT_DEBUG_MODE_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + /* Anonymous structure/union guard start */ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * Structure for initializing watchdog timer. Use type XMC_WDT_CONFIG_t for this structure. + */ +typedef struct XMC_WDT_CONFIG +{ + uint32_t window_upper_bound; /**< Upper bound for service window (WUB). Reset request is generated up on overflow of + timer. ALways upper bound value has to be more than lower bound value. If it is set + lower than WLB, triggers a system reset after timer crossed upper bound value.\n + Range: [0H to FFFFFFFFH] */ + uint32_t window_lower_bound; /**< Lower bound for servicing window (WLB). Setting the lower bound to 0H disables the + window mechanism.\n + Range: [0H to FFFFFFFFH] */ + union + { + struct + { + uint32_t : 1; + uint32_t prewarn_mode : 1; /**< Pre-warning mode (PRE). This accepts boolean values as input. */ + uint32_t : 2; + uint32_t run_in_debug_mode : 1; /**< Watchdog timer behaviour during debug (DSP). This accepts boolean values as input. */ + uint32_t : 3; + uint32_t service_pulse_width : 8; /**< Service Indication Pulse Width (SPW). Generated Pulse width is of (SPW+1), + in fwdt cycles.\n + Range: [0H to FFH] */ + uint32_t : 16; + }; + uint32_t wdt_ctr; /* Value of operation mode control register (CTR). It’s bit fields are represented by above + union members. */ + }; +} XMC_WDT_CONFIG_t; +/* Anonymous structure/union guard end */ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif +/********************************************************************************************************************* + * API PROTOTYPES + ********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * \if XMC4 + * Enables watchdog clock and releases watchdog reset.\n + * \endif + * \if XMC1 + * Enables watchdog clock.\n + * \endif + * \par + * This API is invoked by XMC_WDT_Init() and therefore no need to call it explicitly during watchdog initialization + * sequence. Invoke this API to enable watchdog once again if the watchdog is disabled by invoking XMC_WDT_Disable(). + * + * \parNote:
+ * \if XMC4 + * 1. It is required to configure the watchdog, again after invoking XMC_WDT_Disable(). Since all the registers are + * reset with default values. + * \endif + * \if XMC1 + * 1. Not required to configure the watchdog again after invoking XMC_WDT_Disable(). Since the registers retains with + * the configured values. + * \endif + * \parRelated APIs:
+ * XMC_WDT_Init(), XMC_WDT_Disable() + */ +void XMC_WDT_Enable(void); + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * \if XMC4 + * Disables the clock and resets watchdog timer.\n + * \endif + * \if XMC1 + * Disables the clock to the watchdog timer.\n + * \endif + * + * \parNote:
+ * \if XMC4 + * 1. Resets the registers with default values. So XMC_WDT_Init() has to be invoked again to configure the watchdog. + * \endif + * \if XMC1 + * 1. After invoking XMC_WDT_Disable(), all register values are displayed with 0F in debugger. Once enabled by + calling XMC_WDT_Enable(), previous configured register values are displayed. No need to invoke XMC_WDT_Init() + again. + * \endif + * \parRelated APIs:
+ * XMC_WDT_Enable() + */ +void XMC_WDT_Disable(void); + +/** + * @param config pointer to a constant watchdog configuration data structure. Refer data structure XMC_WDT_CONFIG_t + * for detail. + * + * @return None + * + * \parDescription:
+ * Initializes and configures watchdog with configuration data pointed by \a config.\n + * \par + * It invokes XMC_WDT_Enable() to enable clock and release reset. Then configures the lower and upper window bounds, + * working mode (timeout/pre-warning), debug behaviour and service request indication pulse width. + * + * \parNote:
+ * 1. With out invoking this XMC_WDT_Init() or XMC_WDT_Enable(), invocation of other APIs like XMC_WDT_SetWindowBounds(), + * XMC_WDT_SetMode(), XMC_WDT_SetServicePulseWidth(), XMC_WDT_SetDebugMode(), XMC_WDT_Start(), XMC_WDT_GetCounter(), + * XMC_WDT_Service(), XMC_WDT_ClearAlarm() has no affect. + */ +void XMC_WDT_Init(const XMC_WDT_CONFIG_t *const config); + +/** + * @param lower_bound specifies watchdog window lower bound in terms of watchdog clock (fWDT) cycles. + * Range: [0H to FFFFFFFFH]. + * @param upper_bound specifies watchdog window upper bound in terms of watchdog clock (fWDT) cycles. + * Range: [0H to FFFFFFFFH]. + * + * @return None + * + * \parDescription:
+ * Sets watchdog window lower and upper bounds by updating WLB and WUB registers.\n + * \par + * Window lower and upper bounds are set during initialization in XMC_WDT_Init(). Invoke this API to alter the values as + * needed later in the program. This upper bound and lower bound can be calculated by using the below formula\n + * upper_bound or lower_bound = desired_boundary_time(sec) * fwdt(hz) + * + * \parNote: + * 1. Always ensure that upper_bound is greater than the lower_bound value. If not, whenever timer crosses the + * upper_bound value it triggers the reset(wdt_rst_req) of the controller. + */ +__STATIC_INLINE void XMC_WDT_SetWindowBounds(uint32_t lower_bound, uint32_t upper_bound) +{ + WDT->WLB = lower_bound; + WDT->WUB = upper_bound; +} + +/** + * @param mode is one of the working modes of the watchdog timer, i.e timeout or pre-warning. Refer @ref XMC_WDT_MODE_t + * for valid values. + * + * @return None + * + * \parDescription:
+ * Sets watchdog working mode (timeout or pre-warning) by updating PRE bit of CTR register.\n + * \par + * The working mode is set during initialization in XMC_WDT_Init(). Invoke this API to alter the mode as needed later in + * the program. + */ +__STATIC_INLINE void XMC_WDT_SetMode(XMC_WDT_MODE_t mode) +{ + WDT->CTR = (WDT->CTR & (uint32_t)~WDT_CTR_PRE_Msk) | (uint32_t)mode; +} + +/** + * @param service_pulse_width specifies Service indication pulse width in terms of fwdt. + * Range: [0H – FFH]. + * @return None + * + * \parDescription:
+ * Sets service indication pulse width by updating SPW bit field of CTR register.\n + * \par + * The service indication pulse (with width service_pulse_width + 1 in fwdt cycles) is generated on successful servicing + * or feeding of watchdog. The pulse width is initially set during initialization in XMC_WDT_Init(). Invoke this API to + * alter the width as needed later in the program. + */ +__STATIC_INLINE void XMC_WDT_SetServicePulseWidth(uint8_t service_pulse_width) +{ + WDT->CTR = (WDT->CTR & (uint32_t)~WDT_CTR_SPW_Msk) | ((uint32_t)service_pulse_width << WDT_CTR_SPW_Pos); +} + +/** + * @param debug_mode running state of watchdog during debug halt mode. Refer @ref XMC_WDT_DEBUG_MODE_t for + * valid values. + * + * @return None + * + * \parDescription:
+ * Sets debug behaviour of watchdog by modifying DSP bit of CTR register.\n + * \par + * Depending upon DSP bit, the watchdog timer stops when CPU is in HALT mode. The debug behaviour is initially set as + * XMC_WDT_DEBUG_MODE_STOP during initialization in XMC_WDT_Init(). Invoke this API to change the debug behaviour as + * needed later in the program. + */ +__STATIC_INLINE void XMC_WDT_SetDebugMode(const XMC_WDT_DEBUG_MODE_t debug_mode) +{ + WDT->CTR = (WDT->CTR & (uint32_t)~WDT_CTR_DSP_Msk) | (uint32_t)debug_mode; +} + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * Start the watchdog timer by setting ENB bit of CTR register.\n + * \par + * Invoke this API to start the watchdog after initialization, or to resume the watchdog when + * paused by invoking XMC_WDT_Stop(). + * + * \parRelated APIs:
+ * XMC_WDT_Init(), XMC_WDT_Stop() + */ +__STATIC_INLINE void XMC_WDT_Start(void) +{ + WDT->CTR |= (uint32_t)WDT_CTR_ENB_Msk; +} + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * Pauses watchdog timer by resetting ENB bit of CTR register.\n + * \par + * Invoke this API to pause the watchdog as needed in the program e.g. debugging through software control. + * + * \parRelated APIs:
+ * XMC_WDT_Init(), XMC_WDT_Stop() + */ +__STATIC_INLINE void XMC_WDT_Stop(void) +{ + WDT->CTR &= (uint32_t)~WDT_CTR_ENB_Msk; +} + +/** + * @param None + * + * @return uint32_t Current count value of watchdog timer register (TIM). + * Range: [0H to FFFFFFFFH] + * + * \parDescription:
+ * Reads current count of timer register (TIM).\n + * \par + * Invoke this API before servicing or feeding the watchdog to check whether count is between lower and upper + * window bounds. + * + * \parRelated APIs:
+ * XMC_WDT_Service() + */ +__STATIC_INLINE uint32_t XMC_WDT_GetCounter(void) +{ + return WDT->TIM; +} + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * Services or feeds the watchdog by writing the Magic word in SRV register.\n + * \par + * Service watchdog when count value of watchdog timer is between lower and upper window bounds. Successful servicing + * will reset watchdog timer (TIM register) to 0H and generate service indication pulse. + * + * \parNote:
+ * 1. invoking this API when count value of watchdog timer is less than window lower bound results + * wrong servicing and immediately triggers reset request. + * + * \parRelated APIs:
+ * XMC_WDT_GetCounter(), XMC_WDT_SetWindowBounds(), XMC_WDT_SetServicePulseWidth() + */ +__STATIC_INLINE void XMC_WDT_Service(void) +{ + WDT->SRV = XMC_WDT_MAGIC_WORD; +} + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * Clears pre-warning alarm by setting ALMC bit in WDTCLR register.\n + * \par + * In pre-warning mode, first overflow of the timer upper window bound fires the pre-warning alarm. XMC_WDT_ClearAlarm() + * must be invoked to clear the alarm alarm. After clearing of the alarm, watchdog timer must be serviced within valid + * time window. Otherwise watchdog timer triggers the reset request up on crossing the upper bound value in a subsequent + * cycle. + * + * \parRelated APIs:
+ * XMC_WDT_Service(), XMC_WDT_SetMode() + */ +__STATIC_INLINE void XMC_WDT_ClearAlarm(void) +{ + WDT->WDTCLR = WDT_WDTCLR_ALMC_Msk; +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* XMC_WDT_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_eru.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_eru.c new file mode 100644 index 00000000..531cf55f --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_eru.c @@ -0,0 +1,63 @@ +/** + * @file xmc1_eru.c + * @date 2015-02-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * @endcond + */ + +#include "xmc_eru.h" + +#if UC_FAMILY == XMC1 + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +void XMC_ERU_Enable(XMC_ERU_t *const eru) +{ + XMC_UNUSED_ARG(eru); +} + +void XMC_ERU_Disable(XMC_ERU_t *const eru) +{ + XMC_UNUSED_ARG(eru); +} + +#endif /* if( UC_FAMILY == XMC1 ) */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_flash.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_flash.c new file mode 100644 index 00000000..c72f9855 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_flash.c @@ -0,0 +1,254 @@ +/** + * @file xmc1_flash.c + * @date 2015-10-14 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-10: + * - Initial
+ * + * 2015-06-20: + * - Removed definition of GetDriverVersion API + * + * 2015-10-14: + * - Fixed defect in API XMC_FLASH_ErasePages, related to the errata NVM_CM.001 + * - NVM ROM user routine XMC1000_NvmErasePage(address) used for erase page. + * + * @endcond + * + */ + +#include "xmc_flash.h" + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#if UC_FAMILY == XMC1 + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +/* FLASH programming / erase options */ +typedef enum FLASH_ACTION +{ + FLASH_ACTION_IDLE = (uint32_t)0x00, + FLASH_ACTION_ONESHOT_WRITE_VERIFY = ((uint32_t)0x51 << NVM_NVMPROG_ACTION_Pos), + FLASH_ACTION_ONESHOT_WRITE = ((uint32_t)0x91 << NVM_NVMPROG_ACTION_Pos), + FLASH_ACTION_CONTINUOUS_WRITE_VERIFY = ((uint32_t)0x61 << NVM_NVMPROG_ACTION_Pos), + FLASH_ACTION_CONTINUOUS_WRITE = ((uint32_t)0xa1 << NVM_NVMPROG_ACTION_Pos), + FLASH_ACTION_ONESHOT_PAGE_ERASE = ((uint32_t)0x92 << NVM_NVMPROG_ACTION_Pos), + FLASH_ACTION_CONTINUOUS_PAGE_ERASE = ((uint32_t)0xa2 << NVM_NVMPROG_ACTION_Pos), + FLASH_ACTION_ONESHOT_VERIFY_ONLY = ((uint32_t)0xd0 << NVM_NVMPROG_ACTION_Pos), + FLASH_ACTION_CONTINUOUS_VERIFY_ONLY = ((uint32_t)0xe0 << NVM_NVMPROG_ACTION_Pos) +} FLASH_ACTION_t; + + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* + * This API shall clear the ECC and VERIFICATION error status. + */ +void XMC_FLASH_ClearStatus(void) +{ + NVM->NVMPROG |= (uint16_t)((uint16_t)NVM_NVMPROG_RSTVERR_Msk | (uint16_t)NVM_NVMPROG_RSTECC_Msk); +} + +/* + * This API shall return the status of NVM. + */ +uint32_t XMC_FLASH_GetStatus(void) +{ + return NVM->NVMSTATUS; +} + +/* + * This API shall enable the the flash interrupt event. + */ +void XMC_FLASH_EnableEvent(const uint32_t event_msk) +{ + NVM->NVMCONF |= (uint16_t)event_msk; +} + +/* + * This API shall disable the the flash interrupt event. + */ +void XMC_FLASH_DisableEvent(const uint32_t event_msk) +{ + NVM->NVMCONF &= (uint16_t)(~(uint16_t)event_msk); +} + +void XMC_FLASH_ErasePage(uint32_t *address) +{ + (void)XMC1000_NvmErasePage(address); +} + +void XMC_FLASH_ProgramVerifyPage(uint32_t *address, const uint32_t *data) +{ + (void)XMC1000_NvmProgVerify(data, address); +} + +/* Write blocks of data into flash*/ +void XMC_FLASH_WriteBlocks(uint32_t *address, const uint32_t *data, uint32_t num_blocks, bool verify) +{ + uint32_t word; + uint32_t block; + + XMC_ASSERT("XMC_FLASH_WriteBlocks: Starting address not aligned to Block", + ((uint32_t)address & FLASH_BLOCK_ADDR_MASK) == 0U) + + /* Configure the continuous Write option command and reset the NVM error / verification status*/ + NVM->NVMPROG &= (uint16_t)(~(uint16_t)NVM_NVMPROG_ACTION_Msk); + NVM->NVMPROG |= (uint16_t)(NVM_NVMPROG_RSTVERR_Msk | NVM_NVMPROG_RSTECC_Msk); + + if (verify == true) + { + NVM->NVMPROG |= (uint16_t)FLASH_ACTION_CONTINUOUS_WRITE_VERIFY; + } + else + { + NVM->NVMPROG |= (uint16_t)FLASH_ACTION_CONTINUOUS_WRITE; + } + + for (block = 0U; block < num_blocks; ++block) + { + for (word = 0U; word < XMC_FLASH_WORDS_PER_BLOCK; ++word) + { + *address = *data; + data++; + address++; + } + + while (XMC_FLASH_IsBusy() == true) + { + } + } + + /* Stop continuous write operation */ + NVM->NVMPROG &= (uint16_t)(~(uint16_t)NVM_NVMPROG_ACTION_Msk); +} + +/* Erase flash pages */ +void XMC_FLASH_ErasePages(uint32_t *address, uint32_t num_pages) +{ + uint32_t page; + + XMC_ASSERT("XMC_FLASH_ErasePages: Starting address not aligned to Page", + ((uint32_t)address & FLASH_PAGE_ADDR_MASK) == 0U) + + for (page = 0U; page < num_pages; ++page) + { + (void)XMC1000_NvmErasePage(address); + + while (XMC_FLASH_IsBusy() == true) + { + } + + /* Increment the page address for the next erase */ + address += XMC_FLASH_WORDS_PER_PAGE; + + } + +} + +/* Write multiple data blocks and verify the written data */ +void XMC_FLASH_VerifyBlocks(uint32_t *address, const uint32_t *data, uint32_t num_blocks) +{ + uint32_t word; + uint32_t block; + + XMC_ASSERT("XMC_FLASH_VerifyBlocks: Starting address not aligned to Block", + ((uint32_t)address & FLASH_BLOCK_ADDR_MASK) == 0U) + + /* Configure the Continuous write with verify option command and reset the NVM error / verification status*/ + NVM->NVMPROG &= (uint16_t)~NVM_NVMPROG_ACTION_Msk; + NVM->NVMPROG |= (uint16_t)((uint16_t)NVM_NVMPROG_RSTVERR_Msk | + (uint16_t)NVM_NVMPROG_RSTECC_Msk | + (uint16_t)FLASH_ACTION_CONTINUOUS_VERIFY_ONLY); + + for (block = 0U; block < num_blocks; ++block) + { + for (word = 0U; word < XMC_FLASH_WORDS_PER_BLOCK; ++word) + { + *address = *data; + data++; + address++; + } + + while (XMC_FLASH_IsBusy() == true) + { + } + } + + /* Stop continuous verify operation */ + NVM->NVMPROG &= (uint16_t)(~(uint16_t)NVM_NVMPROG_ACTION_Msk); +} + +/* Read data blocks from flash */ +void XMC_FLASH_ReadBlocks(uint32_t *address, uint32_t *data, uint32_t num_blocks) +{ + uint32_t word; + uint32_t block; + + XMC_ASSERT("XMC_FLASH_ReadBlocks: Starting address not aligned to Block", + ((uint32_t)address & FLASH_BLOCK_ADDR_MASK) == 0U) + + for (block = 0U; block < num_blocks; ++block) + { + for (word = 0U; word < XMC_FLASH_WORDS_PER_BLOCK; ++word) + { + *data = *address; + data++; + address++; + } + } +} + +/* Erase single sector */ +void XMC_FLASH_EraseSector(uint32_t *address) +{ + XMC_ASSERT("XMC_FLASH_EraseSector: Starting address not aligned to Sector", + ((uint32_t)address & FLASH_SECTOR_ADDR_MASK) == 0U) + XMC_FLASH_ErasePages(address, XMC_FLASH_PAGES_PER_SECTOR); +} + +/* Program single page */ +void XMC_FLASH_ProgramPage(uint32_t *address, const uint32_t *data) +{ + XMC_FLASH_ProgramVerifyPage(address, data); +} + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_gpio.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_gpio.c new file mode 100644 index 00000000..86eaee3f --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_gpio.c @@ -0,0 +1,104 @@ +/** + * @file xmc1_gpio.c + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * @endcond + * + */ + +#include "xmc_gpio.h" + +#if UC_FAMILY == XMC1 + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +#define PORT_PHCR_Msk PORT0_PHCR0_PH0_Msk +#define PORT_PHCR_Size PORT0_PHCR0_PH0_Msk +#define PORT_HWSEL_Msk PORT0_HWSEL_HW0_Msk + +/******************************************************************************* + * API IMPLEMENTATION + *******************************************************************************/ + +void XMC_GPIO_Init(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_CONFIG_t *const config) +{ + XMC_ASSERT("XMC_GPIO_Init: Invalid port", XMC_GPIO_CHECK_PORT(port)); + XMC_ASSERT("XMC_GPIO_Init: Invalid mode", XMC_GPIO_IsModeValid(config->mode)); + XMC_ASSERT("XMC_GPIO_Init: Invalid input hysteresis", XMC_GPIO_CHECK_INPUT_HYSTERESIS(config->input_hysteresis)); + + /* Switch to input */ + port->IOCR[pin >> 2U] &= ~(uint32_t)((uint32_t)PORT_IOCR_PC_Msk << (PORT_IOCR_PC_Size * (pin & 0x3U))); + + /* HW port control is disabled */ + port->HWSEL &= ~(uint32_t)((uint32_t)PORT_HWSEL_Msk << ((uint32_t)pin << 1U)); + + /* Set input hysteresis */ + port->PHCR[(uint32_t)pin >> 3U] &= ~(uint32_t)((uint32_t)PORT_PHCR_Msk << ((uint32_t)PORT_PHCR_Size * ((uint32_t)pin & 0x7U))); + port->PHCR[(uint32_t)pin >> 3U] |= (uint32_t)config->input_hysteresis << ((uint32_t)PORT_PHCR_Size * ((uint32_t)pin & 0x7U)); + + /* Enable digital input */ + if (XMC_GPIO_CHECK_ANALOG_PORT(port)) + { + port->PDISC &= ~(uint32_t)((uint32_t)0x1U << pin); + } + /* Set output level */ + port->OMR = (uint32_t)config->output_level << pin; + + /* Set mode */ + port->IOCR[pin >> 2U] |= (uint32_t)config->mode << (PORT_IOCR_PC_Size * (pin & 0x3U)); +} + +void XMC_GPIO_SetInputHysteresis(XMC_GPIO_PORT_t *const port, + const uint8_t pin, + const XMC_GPIO_INPUT_HYSTERESIS_t hysteresis) +{ + XMC_ASSERT("XMC_GPIO_SetInputHysteresis: Invalid port", XMC_GPIO_CHECK_PORT(port)); + XMC_ASSERT("XMC_GPIO_SetInputHysteresis: Invalid input hysteresis", XMC_GPIO_CHECK_INPUT_HYSTERESIS(hysteresis)); + + port->PHCR[(uint32_t)pin >> 3U] &= ~(uint32_t)((uint32_t)PORT_PHCR_Msk << ((uint32_t)PORT_PHCR_Size * ((uint32_t)pin & 0x7U))); + port->PHCR[(uint32_t)pin >> 3U] |= (uint32_t)hysteresis << ((uint32_t)PORT_PHCR_Size * ((uint32_t)pin & 0x7U)); +} + +#endif /* UC_FAMILY == XMC1 */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_rtc.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_rtc.c new file mode 100644 index 00000000..5ee01e6d --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_rtc.c @@ -0,0 +1,160 @@ +/** + * @file xmc1_rtc.c + * @date 2016-03-09 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-05-20: + * - XMC_RTC_Init() function is modified + * by adding RTC running condition check + * + * 2016-03-09: + * - Optimize write only registers + * + * @endcond + * + */ + + +/** + * + * @brief RTC driver for XMC microcontroller family. + * + */ + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ +#include + +#if UC_FAMILY == XMC1 +#include + +/********************************************************************************************************************* + * API IMPLEMENTATION + *********************************************************************************************************************/ +/* + * Initialize the RTC peripheral + */ +XMC_RTC_STATUS_t XMC_RTC_Init(const XMC_RTC_CONFIG_t *const config) +{ + if (XMC_RTC_IsRunning() == false) + { + if (XMC_RTC_IsEnabled() == false) + { + XMC_RTC_Enable(); + } + + XMC_RTC_SetPrescaler(config->prescaler); + + while ((XMC_SCU_GetMirrorStatus() & (SCU_GENERAL_MIRRSTS_RTC_TIM0_Msk | SCU_GENERAL_MIRRSTS_RTC_TIM1_Msk)) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->TIM0 = config->time.raw0; + RTC->TIM1 = config->time.raw1; + + while ((XMC_SCU_GetMirrorStatus() & (SCU_GENERAL_MIRRSTS_RTC_ATIM0_Msk | SCU_GENERAL_MIRRSTS_RTC_ATIM1_Msk)) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->ATIM0 = config->alarm.raw0; + RTC->ATIM1 = config->alarm.raw1; + } + return XMC_RTC_STATUS_OK; +} + +/* + * Ungates a clock node for RTC + */ +void XMC_RTC_Enable(void) +{ + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_RTC); +} + +/* + * Gates a clock node for RTC + */ +void XMC_RTC_Disable(void) +{ + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_RTC); +} + +/* + * Suspends RTC function during CPU HALT mode + */ +void XMC_RTC_SetDebugMode(const XMC_RTC_DEBUG_MODE_t debug_mode) +{ + uint32_t regval; + regval = (RTC->CTR & (uint32_t)~RTC_CTR_SUS_Msk); + RTC->CTR = (regval | (uint32_t)debug_mode); +} + +/* + * Enable RTC periodic and alarm event(s) + */ +void XMC_RTC_EnableEvent(const uint32_t event) +{ + RTC->MSKSR |= event; +} + +/* + * Disable RTC periodic and alarm event(s) + */ +void XMC_RTC_DisableEvent(const uint32_t event) +{ + RTC->MSKSR &= ~event; +} + +/* + * Clear RTC periodic and alarm event(s) + */ +void XMC_RTC_ClearEvent(const uint32_t event) +{ + RTC->CLRSR = event; +} + +/* + * Checks RTC peripheral is enabled for programming to its registers + */ +bool XMC_RTC_IsEnabled(void) +{ + return !XMC_SCU_CLOCK_IsPeripheralClockGated(XMC_SCU_PERIPHERAL_CLOCK_RTC); +} + +#endif /* UC_FAMILY == XMC1 */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_scu.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_scu.c new file mode 100644 index 00000000..891cf6bf --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc1_scu.c @@ -0,0 +1,946 @@ +/** + * @file xmc1_scu.c + * @date 2017-04-11 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-05-20: + * - XMC_SCU_StartTempMeasurement API is modified + * - XMC_ASSERT statements are added in XMC_SCU_INTERRUPT_SetEventHandler + * + * 2015-06-20: + * - XMC_SCU_INTERRUPT_EnableEvent,XMC_SCU_INTERRUPT_DisableEvent, + * - XMC_SCU_INTERRUPT_TriggerEvent,XMC_SCU_INTERUPT_GetEventStatus, + * - XMC_SCU_INTERRUPT_ClearEventStatus APIs are added + * + * 2015-09-23: + * - XMC1400 support added + * + * 2015-11-30: + * - Documentation improved + * + * 2016-02-29: + * - Fixed XMC_SCU_CLOCK_ScaleMCLKFrequency + * It solves issues with down clock frequency scaling + * + * 2016-04-15: + * - Fixed XMC_SCU_CLOCK_Init for XMC1400 + * It solves issues when trying to disable the OSCHP and use the XTAL pins as GPIO + * + * 2017-02-09 + * - At XMC_SCU_CLOCK_Init() fixed issue while reading oscillator watchdog status + * + * 2017-04-11: + * - Added XMC_SCU_SetBMI() + * + * @endcond + * + */ + +/** + * + * @brief SCU low level driver API prototype definition for XMC1 family of microcontrollers
+ * + * Detailed description of file
+ * APIs provided in this file cover the following functional blocks of SCU:
+ * -- GCU (APIs prefixed with XMC_SCU_GEN_)
+ * ----Temperature Monitoring, Voltage Monitoring, CCU Start etc + * + * -- CCU (APIs prefixed with XMC_SCU_CLOCK_)
+ * ---- Clock initialization, Clock Gating, Sleep Management etc + * + * -- RCU (APIs prefixed with XMC_SCU_RESET_)
+ * ---- Reset Init, Cause, Manual Reset Assert/Deassert etc + * + * -- INTERRUPT (APIs prefixed with XMC_SCU_INTERRUPT_)
+ * ---- Initialization, Manual Assert/Deassert, Acknowledge etc + * + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +#if UC_FAMILY == XMC1 + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define SCU_IRQ_NUM (3U) /**< array index value for list of events that can generate SCU interrupt */ +#define SCU_GCU_PASSWD_PROT_ENABLE (195UL) /**< Password for enabling protection */ +#define SCU_GCU_PASSWD_PROT_DISABLE (192UL) /**< Password for disabling protection */ + + +#define XMC_SCU_CHECK_RTCCLKSRC(source) ( (source == XMC_SCU_CLOCK_RTCCLKSRC_DCO2) || \ + (source == XMC_SCU_CLOCK_RTCCLKSRC_ERU_IOUT0) || \ + (source == XMC_SCU_CLOCK_RTCCLKSRC_ACMP0_OUT) || \ + (source == XMC_SCU_CLOCK_RTCCLKSRC_ACMP1_OUT) || \ + (source == XMC_SCU_CLOCK_RTCCLKSRC_ACMP2_OUT) ) /**< Used to verify + whether provided RTC + clock source is valid + or not */ +#define SCU_GENERAL_INTCR_INTSEL_Msk SCU_GENERAL_INTCR0_INTSEL0_Msk /**< Mask value of Interrupt Source Select + for Node 0 */ +#define SCU_GENERAL_INTCR_INTSEL_Size SCU_GENERAL_INTCR0_INTSEL1_Pos /**< Bit position value of Interrupt Source Select + for Node 1 */ + +#define ANA_TSE_T1 (0x10000F30U) /**< d is a constant data can be retrieved from Flash sector 0 to calculate OFFSET + value for DCO calibration */ +#define ANA_TSE_T2 (0x10000F31U) /**< e is a constant data can be retrieved from Flash sector 0 to calculate OFFSET + value for DCO calibration */ +#define DCO_ADJLO_T1 (0x10000F32U) /**< b is a constant data can be retrieved from Flash sector 0 to calculate OFFSET + value for DCO calibration */ +#define DCO_ADJLO_T2 (0x10000F33U) /**< a is a constant data can be retrieved from Flash sector 0 to calculate OFFSET + value for DCO calibration */ + +#if UC_SERIES == XMC14 +#define XMC_SCU_INTERRUPT_EVENT_MAX (64U) /**< Maximum supported SCU events for XMC14 device. */ +#else +#define XMC_SCU_INTERRUPT_EVENT_MAX (32U) /**< Maximum supported SCU events for XMC11/12/13 device. */ +#endif + +#if UC_SERIES == XMC14 +#define DCO1_DIV2_FREQUENCY_KHZ_Q22_10 (48000U << 10) /**< used to configures main clock (MCLK) frequency to requested + frequency value during runtime for XMC14 device. */ +#else +#define DCO1_DIV2_FREQUENCY_KHZ_Q24_8 (32000U << 8) /**< used to configures main clock (MCLK) frequency to requested + frequency value during runtime for XMC11/12/13 device. */ +#endif + +#define ROM_BmiInstallationReq \ + (*((uint32_t (**)(uint32_t requestedBmiValue))0x00000108U)) /**< Pointer to Request BMI installation routine is + available inside ROM. */ + +#define ROM_CalcTemperature \ + (*((uint32_t (**)(void))0x0000010cU)) /**< Pointer to Calculate chip temperature routine is + available inside ROM. */ + +#define ROM_CalcTSEVAR \ + (*((uint32_t (**)(uint32_t temperature))0x00000120U)) /**< Pointer to Calculate target level for temperature + comparison routine is available inside ROM. */ + +/********************************************************************************************************************* + * LOCAL DATA + ********************************************************************************************************************/ +static XMC_SCU_INTERRUPT_EVENT_HANDLER_t event_handler_list[XMC_SCU_INTERRUPT_EVENT_MAX]; /**< For registering callback + functions on SCU event + occurrence. */ + +static XMC_SCU_INTERRUPT_EVENT_t event_masks[SCU_IRQ_NUM] = +{ + (XMC_SCU_INTERRUPT_EVENT_FLASH_ERROR | + XMC_SCU_INTERRUPT_EVENT_FLASH_COMPLETED | + XMC_SCU_INTERRUPT_EVENT_PESRAM | + XMC_SCU_INTERRUPT_EVENT_PEUSIC0 | +#if defined(USIC1) + XMC_SCU_INTERRUPT_EVENT_PEUSIC1 | +#endif +#if defined(CAN) + XMC_SCU_INTERRUPT_EVENT_PEMCAN | +#endif +#if UC_SERIES == XMC14 + XMC_SCU_INTERRUPT_EVENT_LOSS_EXT_CLOCK | +#endif + XMC_SCU_INTERRUPT_EVENT_LOCI), + + (XMC_SCU_INTERRUPT_EVENT_STDBYCLKFAIL | +#if UC_SERIES == XMC14 + XMC_SCU_INTERRUPT_EVENT_DCO1_OUT_SYNC | +#endif + XMC_SCU_INTERRUPT_EVENT_VDDPI | + XMC_SCU_INTERRUPT_EVENT_VDROP | + XMC_SCU_INTERRUPT_EVENT_VCLIP | + XMC_SCU_INTERRUPT_EVENT_TSE_DONE | + XMC_SCU_INTERRUPT_EVENT_TSE_HIGH | + XMC_SCU_INTERRUPT_EVENT_TSE_LOW | + XMC_SCU_INTERRUPT_EVENT_WDT_WARN | + XMC_SCU_INTERRUPT_EVENT_RTC_PERIODIC | + XMC_SCU_INTERRUPT_EVENT_RTC_ALARM | + XMC_SCU_INTERRUPT_EVENT_RTCCTR_UPDATED | + XMC_SCU_INTERRUPT_EVENT_RTCATIM0_UPDATED | + XMC_SCU_INTERRUPT_EVENT_RTCATIM1_UPDATED | + XMC_SCU_INTERRUPT_EVENT_RTCTIM0_UPDATED | + XMC_SCU_INTERRUPT_EVENT_RTCTIM1_UPDATED), + + ( +#if UC_SERIES != XMC11 + XMC_SCU_INTERRUPT_EVENT_ORC0 | + XMC_SCU_INTERRUPT_EVENT_ORC1 | + XMC_SCU_INTERRUPT_EVENT_ORC2 | + XMC_SCU_INTERRUPT_EVENT_ORC3 | + XMC_SCU_INTERRUPT_EVENT_ORC4 | + XMC_SCU_INTERRUPT_EVENT_ORC5 | + XMC_SCU_INTERRUPT_EVENT_ORC6 | + XMC_SCU_INTERRUPT_EVENT_ORC7 | +#endif +#if defined(COMPARATOR) + XMC_SCU_INTERRUPT_EVENT_ACMP0 | + XMC_SCU_INTERRUPT_EVENT_ACMP1 | + XMC_SCU_INTERRUPT_EVENT_ACMP2 | +#if UC_SERIES == XMC14 + XMC_SCU_INTERRUPT_EVENT_ACMP3 | +#endif +#endif + 0) +}; /**< Defines list of events that can generate SCU interrupt and also indicates SCU events mapping to corresponding + service request number. These event mask values can be used to verify which event is triggered that corresponds + to service request number during runtime. All the event items are tabulated as per service request sources list + table of SCU. */ + +/********************************************************************************************************************* + * LOCAL ROUTINES + ********************************************************************************************************************/ +/* Utility routine to perform frequency up scaling */ +static void XMC_SCU_CLOCK_lFrequencyUpScaling(uint32_t curr_idiv, uint32_t idiv); + +/* Utility routine to perform frequency down scaling */ +static void XMC_SCU_CLOCK_lFrequencyDownScaling(uint32_t curr_idiv, uint32_t idiv); + +/* Calculates the value which must be installed in ANATSEIx register to get indication in + SCU_INTERRUPT->SRRAW bit when the chip temperature is above/below some target/threshold. */ +static uint32_t XMC_SCU_CalcTSEVAR(uint32_t temperature) +{ + uint32_t limit; + + XMC_ASSERT("XMC_SCU_CalcTSEVAR: temperature out of range", (temperature >= 233U) && (temperature <= 388U)); + + limit = ROM_CalcTSEVAR(temperature); + if (limit == 0U) + { + limit = ROM_CalcTSEVAR(temperature + 1U); + if (limit == 0U) + { + limit = ROM_CalcTSEVAR(temperature - 1U); + } + } + + return (limit); +} + +#if UC_SERIES == XMC14 +/* This is a local function used to generate the delay until register get updated with new configured value. */ +static void delay(uint32_t cycles) +{ + while(cycles > 0U) + { + __NOP(); + cycles--; + } +} +#endif + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + #ifdef XMC_ASSERT_ENABLE +/* API to verify SCU event weather it is valid event or not */ +__STATIC_INLINE bool XMC_SCU_INTERRUPT_IsValidEvent(XMC_SCU_INTERRUPT_EVENT_t event) +{ + return ((event == XMC_SCU_INTERRUPT_EVENT_WDT_WARN) || + (event == XMC_SCU_INTERRUPT_EVENT_RTC_PERIODIC) || + (event == XMC_SCU_INTERRUPT_EVENT_RTC_ALARM) || + (event == XMC_SCU_INTERRUPT_EVENT_VDDPI) || +#if defined(USIC1) + (event == XMC_SCU_INTERRUPT_EVENT_PEUSIC1) || +#endif +#if defined(CAN) + (event == XMC_SCU_INTERRUPT_EVENT_PEMCAN) || +#endif +#if UC_SERIES == XMC14 + (event == XMC_SCU_INTERRUPT_EVENT_LOSS_EXT_CLOCK) || + (event == XMC_SCU_INTERRUPT_EVENT_DCO1_OUT_SYNC) || +#endif +#if defined(COMPARATOR) + (event == XMC_SCU_INTERRUPT_EVENT_ACMP0) || + (event == XMC_SCU_INTERRUPT_EVENT_ACMP1) || + (event == XMC_SCU_INTERRUPT_EVENT_ACMP2) || +#if UC_SERIES == XMC14 + (event == XMC_SCU_INTERRUPT_EVENT_ACMP3) || +#endif +#endif + (event == XMC_SCU_INTERRUPT_EVENT_VDROP) || +#if UC_SERIES != XMC11 + (event == XMC_SCU_INTERRUPT_EVENT_ORC0) || + (event == XMC_SCU_INTERRUPT_EVENT_ORC1) || + (event == XMC_SCU_INTERRUPT_EVENT_ORC2) || + (event == XMC_SCU_INTERRUPT_EVENT_ORC3) || + (event == XMC_SCU_INTERRUPT_EVENT_ORC4) || + (event == XMC_SCU_INTERRUPT_EVENT_ORC5) || + (event == XMC_SCU_INTERRUPT_EVENT_ORC6) || + (event == XMC_SCU_INTERRUPT_EVENT_ORC7) || +#endif + (event == XMC_SCU_INTERRUPT_EVENT_LOCI) || + (event == XMC_SCU_INTERRUPT_EVENT_PESRAM) || + (event == XMC_SCU_INTERRUPT_EVENT_PEUSIC0) || + (event == XMC_SCU_INTERRUPT_EVENT_FLASH_ERROR) || + (event == XMC_SCU_INTERRUPT_EVENT_FLASH_COMPLETED) || + (event == XMC_SCU_INTERRUPT_EVENT_VCLIP) || + (event == XMC_SCU_INTERRUPT_EVENT_STDBYCLKFAIL) || + (event == XMC_SCU_INTERRUPT_EVENT_RTCCTR_UPDATED) || + (event == XMC_SCU_INTERRUPT_EVENT_RTCATIM0_UPDATED) || + (event == XMC_SCU_INTERRUPT_EVENT_RTCATIM1_UPDATED) || + (event == XMC_SCU_INTERRUPT_EVENT_RTCTIM0_UPDATED) || + (event == XMC_SCU_INTERRUPT_EVENT_RTCTIM1_UPDATED) || + (event == XMC_SCU_INTERRUPT_EVENT_TSE_DONE) || + (event == XMC_SCU_INTERRUPT_EVENT_TSE_HIGH) || + (event == XMC_SCU_INTERRUPT_EVENT_TSE_LOW)); +} + #endif + +/* API to enable the SCU event */ +void XMC_SCU_INTERRUPT_EnableEvent(const XMC_SCU_INTERRUPT_EVENT_t event) +{ + SCU_INTERRUPT->SRMSK |= (uint32_t)event; +#if UC_SERIES == XMC14 + SCU_INTERRUPT->SRMSK1 |= (uint32_t)(event >> 32U); +#endif +} + +/* API to disable the SCU event */ +void XMC_SCU_INTERRUPT_DisableEvent(const XMC_SCU_INTERRUPT_EVENT_t event) +{ + SCU_INTERRUPT->SRMSK &= ~(uint32_t)event; +#if UC_SERIES == XMC14 + SCU_INTERRUPT->SRMSK1 &= (uint32_t)~(event >> 32U); +#endif +} + +/* API to trigger the SCU event */ +void XMC_SCU_INTERRUPT_TriggerEvent(const XMC_SCU_INTERRUPT_EVENT_t event) +{ + SCU_INTERRUPT->SRSET |= (uint32_t)event; +#if UC_SERIES == XMC14 + SCU_INTERRUPT->SRSET1 |= (uint32_t)(event >> 32U); +#endif +} + +/* API to get the SCU event status */ +XMC_SCU_INTERRUPT_EVENT_t XMC_SCU_INTERUPT_GetEventStatus(void) +{ + XMC_SCU_INTERRUPT_EVENT_t tmp; + + tmp = SCU_INTERRUPT->SRRAW; +#if UC_SERIES == XMC14 + tmp |= ((int64_t)SCU_INTERRUPT->SRRAW1 << 32U); +#endif + return (tmp); +} + +/* API to clear the SCU event status */ +void XMC_SCU_INTERRUPT_ClearEventStatus(const XMC_SCU_INTERRUPT_EVENT_t event) +{ + SCU_INTERRUPT->SRCLR |= (uint32_t)event; +#if UC_SERIES == XMC14 + SCU_INTERRUPT->SRCLR1 |= (uint32_t)(event >> 32U); +#endif +} + +/* API to lock protected bitfields from being modified */ +void XMC_SCU_LockProtectedBits(void) +{ + SCU_GENERAL->PASSWD = SCU_GCU_PASSWD_PROT_ENABLE; +} + +/* API to make protected bitfields available for modification */ +void XMC_SCU_UnlockProtectedBits(void) +{ + SCU_GENERAL->PASSWD = SCU_GCU_PASSWD_PROT_DISABLE; + + while(((SCU_GENERAL->PASSWD) & SCU_GENERAL_PASSWD_PROTS_Msk)) + { + /* Loop until the lock is removed */ + } +} + +/* API to initialize power supply monitoring unit */ +void XMC_SCU_SupplyMonitorInit(const XMC_SCU_SUPPLYMONITOR_t *obj) +{ + uint32_t anavdel; + uint32_t irqmask; + + anavdel = 0UL; + + anavdel |= (uint32_t)((obj-> ext_supply_threshold) << SCU_ANALOG_ANAVDEL_VDEL_SELECT_Pos); + anavdel |= (uint32_t)((obj->ext_supply_monitor_speed) << SCU_ANALOG_ANAVDEL_VDEL_TIM_ADJ_Pos); + + if(true == (obj->enable_at_init)) + { + anavdel |= (uint32_t)SCU_ANALOG_ANAVDEL_VDEL_EN_Msk; + } + SCU_ANALOG->ANAVDEL = (uint16_t) anavdel; + + irqmask = 0UL; + + if(true == (obj->enable_prewarning_int)) + { + irqmask |= (uint32_t)SCU_INTERRUPT_SRMSK_VDDPI_Msk; + } + + if(true == (obj->enable_vdrop_int)) + { + irqmask |= (uint32_t)SCU_INTERRUPT_SRMSK_VDROPI_Msk; + } + + if(true == (obj->enable_vclip_int)) + { + irqmask |= (uint32_t)SCU_INTERRUPT_SRMSK_VCLIPI_Msk; + } + SCU_INTERRUPT->SRMSK |= (uint32_t)irqmask; +} + +/* API to program lower temperature limit */ +XMC_SCU_STATUS_t XMC_SCU_SetTempLowLimit(uint32_t limit) +{ + XMC_SCU_STATUS_t status = XMC_SCU_STATUS_OK; + + limit = XMC_SCU_CalcTSEVAR(limit); + + if (limit != 0) + { + SCU_ANALOG->ANATSEIL = (uint16_t)limit; + } + else + { + status = XMC_SCU_STATUS_ERROR; + } + + return (status); +} + +/* API to program higher temperature limit */ +XMC_SCU_STATUS_t XMC_SCU_SetTempHighLimit(uint32_t limit) +{ + XMC_SCU_STATUS_t status = XMC_SCU_STATUS_OK; + + limit = XMC_SCU_CalcTSEVAR(limit); + + if (limit != 0) + { + SCU_ANALOG->ANATSEIH = (uint16_t)limit; + } + else + { + status = XMC_SCU_STATUS_ERROR; + } + + return (status); +} + +/* API to program temperature limits as raw digital values into temperature sensor */ +void XMC_SCU_SetRawTempLimits(const uint32_t lower_temp, const uint32_t upper_temp) +{ + SCU_ANALOG->ANATSEIH = (uint16_t)(upper_temp & SCU_ANALOG_ANATSEIH_TSE_IH_Msk); + SCU_ANALOG->ANATSEIL = (uint16_t)(lower_temp & SCU_ANALOG_ANATSEIL_TSE_IL_Msk); +} + +/* API to start temperature measurement */ +void XMC_SCU_StartTempMeasurement(void) +{ + SCU_ANALOG->ANATSECTRL |= (uint16_t)SCU_ANALOG_ANATSECTRL_TSE_EN_Msk; +} + +/* API to stop temperature measurement */ +void XMC_SCU_StopTempMeasurement(void) +{ + SCU_ANALOG->ANATSECTRL &= (uint16_t)~SCU_ANALOG_ANATSECTRL_TSE_EN_Msk; +} + +/* API to check if the temperature has gone past the ceiling */ +bool XMC_SCU_HighTemperature(void) +{ + return ((SCU_INTERRUPT->SRRAW & SCU_INTERRUPT_SRRAW_TSE_HIGH_Msk) == SCU_INTERRUPT_SRRAW_TSE_HIGH_Msk); +} + +/* API to check if the temperature is lower than normal */ +bool XMC_SCU_LowTemperature(void) +{ + return ((SCU_INTERRUPT->SRRAW & SCU_INTERRUPT_SRRAW_TSE_LOW_Msk) == SCU_INTERRUPT_SRRAW_TSE_LOW_Msk); +} + +/* API to retrieve the device temperature */ +uint32_t XMC_SCU_GetTemperature(void) +{ + uint32_t temperature; + + temperature = (uint32_t)(SCU_ANALOG->ANATSEMON); + + return (temperature); +} + +/* Calculates the die temperature value using ROM function */ +uint32_t XMC_SCU_CalcTemperature(void) +{ + return (ROM_CalcTemperature()); +} + + +/* API which initializes the clock tree ofthe device */ +void XMC_SCU_CLOCK_Init(const XMC_SCU_CLOCK_CONFIG_t *const config) +{ + /* Remove protection */ + XMC_SCU_UnlockProtectedBits(); + +#if (UC_SERIES == XMC14) + /* OSCHP source selection - OSC mode */ + + if (config->oschp_mode != XMC_SCU_CLOCK_OSCHP_MODE_DISABLED) + { + if (OSCHP_GetFrequency() > 20000000U) + { + SCU_ANALOG->ANAOSCHPCTRL |= (uint16_t)SCU_ANALOG_ANAOSCHPCTRL_HYSCTRL_Msk; + } + + SCU_ANALOG->ANAOSCHPCTRL = (uint16_t)(SCU_ANALOG->ANAOSCHPCTRL & ~(SCU_ANALOG_ANAOSCHPCTRL_SHBY_Msk | SCU_ANALOG_ANAOSCHPCTRL_MODE_Msk)) | + config->oschp_mode; + + do + { + /* Restart OSC_HP oscillator watchdog */ + SCU_INTERRUPT->SRCLR1 = SCU_INTERRUPT_SRCLR1_LOECI_Msk; + + /* Enable OSC_HP oscillator watchdog*/ + SCU_CLK->OSCCSR &= ~SCU_CLK_OSCCSR_XOWDEN_Msk; + SCU_CLK->OSCCSR |= SCU_CLK_OSCCSR_XOWDEN_Msk; + + /* Wait a few DCO2 cycles for the update of the clock detection result */ + delay(2500); + + /* check clock is ok */ + } + while(SCU_INTERRUPT->SRRAW1 & SCU_INTERRUPT_SRRAW1_LOECI_Msk); + } + else /* (config->oschp_mode == XMC_SCU_CLOCK_OSCHP_MODE_DISABLED) */ + { + SCU_ANALOG->ANAOSCHPCTRL |= SCU_ANALOG_ANAOSCHPCTRL_MODE_Msk; + } + + SCU_ANALOG->ANAOSCLPCTRL = (uint16_t)config->osclp_mode; + + SCU_CLK->CLKCR1 = (SCU_CLK->CLKCR1 & ~SCU_CLK_CLKCR1_DCLKSEL_Msk) | + config->dclk_src; + +#endif + /* Update PCLK selection mux. */ + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~(SCU_CLK_CLKCR_PCLKSEL_Msk | SCU_CLK_CLKCR_RTCCLKSEL_Msk)) | + config->rtc_src | + config->pclk_src; + + /* Close the lock opened above. */ + XMC_SCU_LockProtectedBits(); + + /* Update the dividers now */ + XMC_SCU_CLOCK_ScaleMCLKFrequency(config->idiv, config->fdiv); + +} + +/* API which selects one of the available parent clock nodes for a given child clock node */ +void XMC_SCU_CLOCK_SetRtcClockSource(const XMC_SCU_CLOCK_RTCCLKSRC_t source) +{ + XMC_ASSERT("XMC_SCU_CLOCK_SetRtcSourceClock:Wrong Parent Clock", XMC_SCU_CHECK_RTCCLKSRC(source)); + + XMC_SCU_UnlockProtectedBits(); + + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~SCU_CLK_CLKCR_RTCCLKSEL_Msk) | + source; + + XMC_SCU_LockProtectedBits(); +} + +/* API to program the divider placed between fperiph and its parent */ +void XMC_SCU_CLOCK_SetFastPeripheralClockSource(const XMC_SCU_CLOCK_PCLKSRC_t source) +{ + XMC_SCU_UnlockProtectedBits(); + + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~SCU_CLK_CLKCR_PCLKSEL_Msk) | + source; + + XMC_SCU_LockProtectedBits(); +} + +/* API which gates a clock node at its source */ +void XMC_SCU_CLOCK_GatePeripheralClock(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral) +{ + XMC_SCU_UnlockProtectedBits(); + SCU_CLK->CGATSET0 |= (uint32_t)peripheral; + XMC_SCU_LockProtectedBits(); +} + +/* API which ungates a clock note at its source */ +void XMC_SCU_CLOCK_UngatePeripheralClock(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral) +{ + XMC_SCU_UnlockProtectedBits(); + SCU_CLK->CGATCLR0 |= (uint32_t)peripheral; + while ((SCU_CLK->CLKCR) & SCU_CLK_CLKCR_VDDC2LOW_Msk) + { + /* Wait voltage suply stabilization */ + } + XMC_SCU_LockProtectedBits(); +} + +/* Checks the status of peripheral clock gating */ +bool XMC_SCU_CLOCK_IsPeripheralClockGated(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral) +{ + return (bool)((SCU_CLK->CGATSTAT0 & peripheral) != 0); +} + +/* This API configures main clock (MCLK) frequency to requested frequency value. */ +void XMC_SCU_CLOCK_SetMCLKFrequency(uint32_t freq_khz) +{ + uint32_t ratio; + uint32_t ratio_int; + uint32_t ratio_frac; + +#if UC_SERIES == XMC14 + if (((SCU_CLK->CLKCR1) & SCU_CLK_CLKCR1_DCLKSEL_Msk) == 0U) + { + ratio = DCO1_DIV2_FREQUENCY_KHZ_Q22_10 / freq_khz; + } + else + { + ratio = ((OSCHP_GetFrequency() / 1000U) << 10U) / freq_khz; + } + + /* Manage overflow */ + if (ratio > 0xffffffU) + { + ratio = 0xffffffU; + } + + ratio_int = ratio >> 10U; + ratio_frac = ratio & 0x3ffU; +#else + ratio = DCO1_DIV2_FREQUENCY_KHZ_Q24_8 / freq_khz; + + /* Manage overflow */ + if (ratio > 0xffffU) + { + ratio = 0xffffU; + } + + ratio_int = ratio >> 8U; + ratio_frac = ratio & 0xffU; +#endif + + XMC_SCU_CLOCK_ScaleMCLKFrequency(ratio_int, ratio_frac); +} + + +/* A utility routine which updates the fractional dividers in steps */ +void XMC_SCU_CLOCK_ScaleMCLKFrequency(uint32_t idiv, uint32_t fdiv) +{ + /* Find out current and target value of idiv */ + uint32_t curr_idiv; + + XMC_SCU_UnlockProtectedBits(); + + /* Take a snapshot of value already programmed into IDIV */ + curr_idiv = (SCU_CLK->CLKCR & SCU_CLK_CLKCR_IDIV_Msk) >> SCU_CLK_CLKCR_IDIV_Pos; + +#if (UC_SERIES == XMC14) + SCU_CLK->CLKCR1 = (SCU_CLK->CLKCR1 & (uint32_t)~(SCU_CLK_CLKCR1_FDIV_Msk)) | + (uint32_t)((fdiv >> 8U) << SCU_CLK_CLKCR1_FDIV_Pos); + + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~(SCU_CLK_CLKCR_FDIV_Msk | SCU_CLK_CLKCR_CNTADJ_Msk)) | + (uint32_t)((fdiv & 0xffU) << SCU_CLK_CLKCR_FDIV_Pos) | + (uint32_t)(1023UL << SCU_CLK_CLKCR_CNTADJ_Pos); +#else + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~(SCU_CLK_CLKCR_FDIV_Msk | SCU_CLK_CLKCR_CNTADJ_Msk)) | + (uint32_t)(fdiv << SCU_CLK_CLKCR_FDIV_Pos) | + (uint32_t)(1023UL << SCU_CLK_CLKCR_CNTADJ_Pos); +#endif + + while ((SCU_CLK->CLKCR)& SCU_CLK_CLKCR_VDDC2LOW_Msk) + { + /* Spin until the core supply stabilizes */ + } + + if(curr_idiv <= idiv) + { + /* Requested IDIV is greater than currently programmed IDIV. So downscale the frequency */ + XMC_SCU_CLOCK_lFrequencyDownScaling(curr_idiv, idiv); + } + else + { + /* Requested IDIV is lower than currently programmed IDIV. So upscale the frequency */ + XMC_SCU_CLOCK_lFrequencyUpScaling(curr_idiv, idiv); + } + + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~(SCU_CLK_CLKCR_IDIV_Msk | SCU_CLK_CLKCR_CNTADJ_Msk)) | + (uint32_t)(idiv << SCU_CLK_CLKCR_IDIV_Pos) | (uint32_t)(1023UL << SCU_CLK_CLKCR_CNTADJ_Pos); + + while ((SCU_CLK->CLKCR) & SCU_CLK_CLKCR_VDDC2LOW_Msk) + { + /* Wait voltage suply stabilization */ + } + + XMC_SCU_LockProtectedBits(); + + SystemCoreClockUpdate(); + +} + +/* Utility routine to perform frequency up scaling */ +static void XMC_SCU_CLOCK_lFrequencyUpScaling(uint32_t curr_idiv, uint32_t target_idiv) +{ + while (curr_idiv > (target_idiv * 4UL)) + { + curr_idiv = (uint32_t)(curr_idiv >> 2UL); /* Divide by 4. */ + + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~(SCU_CLK_CLKCR_IDIV_Msk | SCU_CLK_CLKCR_CNTADJ_Msk)) | + (uint32_t)(curr_idiv << SCU_CLK_CLKCR_IDIV_Pos) | + (uint32_t)(1023UL << SCU_CLK_CLKCR_CNTADJ_Pos); + + while (SCU_CLK->CLKCR & SCU_CLK_CLKCR_VDDC2LOW_Msk) + { + /* Wait voltage suply stabilization */ + } + } +} + +/* Utility routine to perform frequency down scaling */ +static void XMC_SCU_CLOCK_lFrequencyDownScaling(uint32_t curr_idiv, uint32_t target_idiv) +{ + + while ((curr_idiv * 4UL) < target_idiv) + { + if(0U == curr_idiv) + { + curr_idiv = 1U; + } + curr_idiv = (uint32_t)(curr_idiv << 2UL); /* Multiply by 4. */ + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~(SCU_CLK_CLKCR_IDIV_Msk | SCU_CLK_CLKCR_CNTADJ_Msk)) | + (uint32_t)(curr_idiv << SCU_CLK_CLKCR_IDIV_Pos) | + (uint32_t)(1023UL << SCU_CLK_CLKCR_CNTADJ_Pos); + + while (SCU_CLK->CLKCR & SCU_CLK_CLKCR_VDDC2LOW_Msk) + { + /* Wait voltage suply stabilization */ + } + } +} + +/* + * API to retrieve clock frequency of peripherals on the peripheral bus using a shared functional clock + */ +uint32_t XMC_SCU_CLOCK_GetPeripheralClockFrequency(void) +{ + return (SystemCoreClock); +} + +/* Provides the clock frequency of peripherals on the peripheral bus that are using a shared functional clock */ +uint32_t XMC_SCU_CLOCK_GetFastPeripheralClockFrequency(void) +{ + return (SystemCoreClock << ((SCU_CLK->CLKCR & SCU_CLK_CLKCR_PCLKSEL_Msk) >> SCU_CLK_CLKCR_PCLKSEL_Pos)); +} + +/* DCO1 clock frequency can be calibrated during runtime to achieve a better accuracy */ +void XMC_SCU_CLOCK_CalibrateOscillatorOnTemperature(int32_t temperature) +{ + int32_t a; + int32_t b; + int32_t d; + int32_t e; + int32_t offset; + + a = *((uint8_t*)DCO_ADJLO_T2); + b = *((uint8_t*)DCO_ADJLO_T1); + d = *((uint8_t*)ANA_TSE_T1); + e = *((uint8_t*)ANA_TSE_T2); + + offset = b + (((a - b) * (temperature - d)) / (e - d)); + offset &= SCU_ANALOG_ANAOFFSET_ADJL_OFFSET_Msk; + + XMC_SCU_UnlockProtectedBits(); + SCU_ANALOG->ANAOFFSET = (uint16_t)offset; + XMC_SCU_LockProtectedBits(); +} + +/* + * API to assign the event handler function to be executed on occurrence of the selected event + */ +XMC_SCU_STATUS_t XMC_SCU_INTERRUPT_SetEventHandler(XMC_SCU_INTERRUPT_EVENT_t event, XMC_SCU_INTERRUPT_EVENT_HANDLER_t handler) +{ + uint32_t index; + XMC_SCU_STATUS_t status; + + XMC_ASSERT("XMC_SCU_INTERRUPT_SetEventHandler: Invalid event", XMC_SCU_INTERRUPT_IsValidEvent(event)); + XMC_ASSERT("XMC_SCU_INTERRUPT_SetEventHandler: Invalid handler", handler != NULL); + + index = 0U; + + while (((event & ((XMC_SCU_INTERRUPT_EVENT_t)1 << index)) == 0U) && (index < XMC_SCU_INTERRUPT_EVENT_MAX)) + { + index++; + } + + if (index == XMC_SCU_INTERRUPT_EVENT_MAX) + { + status = XMC_SCU_STATUS_ERROR; + } + else + { + event_handler_list[index] = handler; + status = XMC_SCU_STATUS_OK; + } + + return (status); +} + +/* + * A common function to execute callback functions for multiple events + */ +void XMC_SCU_IRQHandler(uint32_t sr_num) +{ + XMC_ASSERT("XMC_SCU_IRQHandler: Invalid sr_num", sr_num < SCU_IRQ_NUM); + + uint32_t index; + XMC_SCU_INTERRUPT_EVENT_t event; + XMC_SCU_INTERRUPT_EVENT_HANDLER_t event_handler; + + index = 0U; + event = XMC_SCU_INTERUPT_GetEventStatus() & event_masks[sr_num]; + XMC_SCU_INTERRUPT_ClearEventStatus(event); + + while ((event != 0) && (index < XMC_SCU_INTERRUPT_EVENT_MAX)) + { + if ((event & ((XMC_SCU_INTERRUPT_EVENT_t)1 << index)) != 0U) + { + event &= ~((XMC_SCU_INTERRUPT_EVENT_t)1 << index); + event_handler = event_handler_list[index]; + if (event_handler != NULL) + { + event_handler(); + } + + /* break; XMC1: Only PULSE interrupts */ + } + index++; + } +} + +/* Install BMI */ +uint32_t XMC_SCU_SetBMI(uint32_t flags, uint8_t timeout) +{ + return ROM_BmiInstallationReq((flags & 0x0fffU) | ((timeout << 12) & 0xf000U)); +} + +#if (UC_SERIES == XMC14) +/* DCO1 clock frequency can be calibrated during runtime to achieve a better accuracy */ +void XMC_SCU_CLOCK_EnableDCO1ExtRefCalibration(XMC_SCU_CLOCK_SYNC_CLKSRC_t sync_clk, uint32_t prescaler, uint32_t syn_preload) +{ + + XMC_SCU_UnlockProtectedBits(); + SCU_ANALOG->ANASYNC2 = (uint16_t)(prescaler << SCU_ANALOG_ANASYNC2_PRESCALER_Pos); + SCU_ANALOG->ANASYNC1 = (uint16_t)(syn_preload | + sync_clk | + SCU_ANALOG_ANASYNC1_SYNC_DCO_EN_Msk); + + XMC_SCU_LockProtectedBits(); + +} + +/* This function stops the automatic DCO1 calibration based on the selected clock source */ +void XMC_SCU_CLOCK_DisableDCO1ExtRefCalibration(void) +{ + XMC_SCU_UnlockProtectedBits(); + SCU_ANALOG->ANASYNC2 = 0U; + SCU_ANALOG->ANASYNC1 = 0U; + XMC_SCU_LockProtectedBits(); +} + +/* This functions checks the status of the synchronisation */ +bool XMC_SCU_CLOCK_IsDCO1ExtRefCalibrationReady(void) +{ + return (bool)((SCU_ANALOG->ANASYNC2 & SCU_ANALOG_ANASYNC2_SYNC_READY_Msk) != 0U); +} + +/** + * This function enables the watchdog on the DCO1 frequency + */ +void XMC_SCU_CLOCK_EnableDCO1OscillatorWatchdog(void) +{ + SCU_CLK->OSCCSR |= SCU_CLK_OSCCSR_OWDEN_Msk; +} + +/** + * This function disables the watchdog on the DCO1 frequency + */ +void XMC_SCU_CLOCK_DisableDCO1OscillatorWatchdog(void) +{ + SCU_CLK->OSCCSR &= ~SCU_CLK_OSCCSR_OWDEN_Msk; +} + +/** + * This function clears the status of the watchdog on the DCO1 frequency + */ +void XMC_SCU_CLOCK_ClearDCO1OscillatorWatchdogStatus(void) +{ + SCU_CLK->OSCCSR |= SCU_CLK_OSCCSR_OWDRES_Msk; +} + +/** + * This function checks if the DCO1 frequency is in the limits of the watchdog. + */ +bool XMC_SCU_CLOCK_IsDCO1ClockFrequencyUsable(void) +{ + return ((SCU_CLK->OSCCSR & (SCU_CLK_OSCCSR_OSC2L_Msk | SCU_CLK_OSCCSR_OSC2H_Msk)) == 0U); +} + +/* This function selects service request source for a NVIC interrupt node */ +void XMC_SCU_SetInterruptControl(uint8_t irq_number, XMC_SCU_IRQCTRL_t source) +{ + XMC_ASSERT("XMC_SCU_SetInterruptControl: Invalid irq_number", irq_number < 32); + XMC_ASSERT("XMC_SCU_SetInterruptControl: Invalid source", (source >> 8) == irq_number); + + source &= 0x3U; + if (irq_number < 16U) + { + SCU_GENERAL->INTCR0 = (SCU_GENERAL->INTCR0 & ~(SCU_GENERAL_INTCR_INTSEL_Msk << (irq_number * SCU_GENERAL_INTCR_INTSEL_Size))) | + (source << (irq_number * SCU_GENERAL_INTCR_INTSEL_Size)); + } + else + { + irq_number &= 0x0fU; + SCU_GENERAL->INTCR1 = (SCU_GENERAL->INTCR1 & ~(SCU_GENERAL_INTCR_INTSEL_Msk << (irq_number * SCU_GENERAL_INTCR_INTSEL_Size))) | + (source << (irq_number * SCU_GENERAL_INTCR_INTSEL_Size)); + } +} + +#endif +#endif /* UC_FAMILY == XMC1 */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_acmp.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_acmp.c new file mode 100644 index 00000000..5e49a6f6 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_acmp.c @@ -0,0 +1,119 @@ +/** + * @file xmc_acmp.c + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2014-12-10: + * - Initial
+ * 2015-02-20: + * - Removed unused declarations
+ * 2015-05-08: + * - Fixed sequence problem of low power mode in XMC_ACMP_Init() API
+ * - Fixed wrong register setting in XMC_ACMP_SetInput() API
+ * - Removed return type variable and by default comparator enable from XMC_ACMP_Init() API.
+ * Additional call to XMC_ACMP_EnableComparator() API needed to start Comparator after Init.
+ * 2015-06-04: + * - Removed return type variable and by default comparator enable from XMC_ACMP_Init() API.
+ * - Divided XMC_ACMP_SetInput into two 3 APIs to reduce the code size and complexity as stated below
+ * (a)XMC_ACMP_EnableReferenceDivider
+ * (b)XMC_ACMP_DisableReferenceDivider
+ * (c)XMC_ACMP_SetInput
+ * - Optimized enable and disable API's and moved to header file as static inline APIs. + * - XMC_ACMP_t typedef changed to structure which overrides the standard header file structure. + * 2015-06-20: + * - Removed definition of GetDriverVersion API + * @endcond + * + */ + + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +/* If ACMP is available*/ +#if defined (COMPARATOR) + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +#define XMC_ACMP_INSTANCE_1 (1U) /* Instance number for Slice-1 */ + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* API to initialize an instance of ACMP module */ +void XMC_ACMP_Init(XMC_ACMP_t *const peripheral, uint32_t instance, const XMC_ACMP_CONFIG_t *const config) +{ + + XMC_ASSERT("XMC_ACMP_Init:NULL Configuration", (config != (XMC_ACMP_CONFIG_t *)NULL)) + XMC_ASSERT("XMC_ACMP_Init:Wrong module pointer", XMC_ACMP_CHECK_MODULE_PTR(peripheral)) + XMC_ASSERT("XMC_ACMP_Init:Wrong instance number", XMC_ACMP_CHECK_INSTANCE(instance) ) + + /* + * Initializes the comparator with configuration supplied. Low power node setting is retained during initialization. + * All the instances passed are handled with low power setting, to avoid conditional check for ACMP0 instance. + * This reduces the code size. No side effects, because this register bit field is empty for other instances. + */ + peripheral->ANACMP[instance] = ((peripheral->ANACMP[instance] & (uint32_t)COMPARATOR_ANACMP0_CMP_LPWR_Msk)) | + (uint32_t)config->anacmp; +} + +/* API to select INP source */ +void XMC_ACMP_SetInput(XMC_ACMP_t *const peripheral, uint32_t instance, XMC_ACMP_INP_SOURCE_t source) +{ + XMC_ASSERT("XMC_ACMP_SetInput:Wrong module pointer", XMC_ACMP_CHECK_MODULE_PTR(peripheral)) + XMC_ASSERT("XMC_ACMP_SetInput:Wrong instance number", ((instance != XMC_ACMP_INSTANCE_1) && + XMC_ACMP_CHECK_INSTANCE(instance)) ) + XMC_ASSERT("XMC_ACMP_SetInput:Wrong input source", ((source == XMC_ACMP_INP_SOURCE_STANDARD_PORT) || + (source == XMC_ACMP_INP_SOURCE_ACMP1_INP_PORT)) ) + + /* + * Three options of Input Setting are listed below + * 1. The comparator inputs aren't connected to other comparator inputs + * 2. Can program the comparators to connect ACMP0.INP to ACMP1.INP in XMC1200 AA or XMC1300 AA + * Can program the comparators to connect ACMP0.INN to ACMP1.INP in XMC1200 AB or XMC1300 AB or XMC1400 AA + * 3. Can program the comparators to connect ACMP2.INP to ACMP1.INP + * 4. Can program the comparators to connect ACMP3.INP to ACMP1.INP in XMC1400 + */ + peripheral->ANACMP[instance] = ((peripheral->ANACMP[instance] & (uint32_t)(~COMPARATOR_ANACMP0_ACMP0_SEL_Msk))) | + (uint32_t)source; +} + +#endif /* #ifdef ACMP_AVAILABLE */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_bccu.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_bccu.c new file mode 100644 index 00000000..731aab60 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_bccu.c @@ -0,0 +1,577 @@ +/** + * @file xmc_bccu.c + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-19: + * - Initial draft
+ * + * 2015-05-08: + * - Minor bug fixes in following APIs: XMC_BCCU_ConcurrentStartDimming(), XMC_BCCU_ConcurrentAbortDimming(), + * XMC_BCCU_SetGlobalDimmingLevel()
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * Detailed description of file:
+ * APIs for the functional blocks of BCCU have been defined:
+ * -- GLOBAL configuration
+ * -- Clock configuration, Function/Event configuration, Interrupt configuration
+ * + * @endcond + * + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +#if defined(BCCU0) +#include + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_BCCU_NO_OF_CHANNELS (9U) +#define XMC_BCCU_CHANNEL_MASK ((0x1 << XMC_BCCU_NO_OF_CHANNELS)-1) +#define XMC_BCCU_NO_OF_DIM_ENGINE (3U) +#define XMC_BCCU_DIM_ENGINE_MASK (((0x1 << XMC_BCCU_NO_OF_DIM_ENGINE)-1)) + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * GLOBAL DATA + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * LOCAL/UTILITY ROUTINES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* + * API to initialise the global resources of a BCCU module + */ +void XMC_BCCU_GlobalInit(XMC_BCCU_t *const bccu, const XMC_BCCU_GLOBAL_CONFIG_t *const config) +{ + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_BCCU0); + + bccu->GLOBCON = config->globcon; + + bccu->GLOBCLK = config->globclk; + bccu->GLOBDIM = config->global_dimlevel; + +} + +/* + * API to configure the global trigger mode & delay of a BCCU module + */ +void XMC_BCCU_ConfigGlobalTrigger(XMC_BCCU_t *const bccu, XMC_BCCU_TRIGMODE_t mode, XMC_BCCU_TRIGDELAY_t delay) +{ + bccu->GLOBCON &= ~(uint32_t)(BCCU_GLOBCON_TM_Msk | BCCU_GLOBCON_TRDEL_Msk); + bccu->GLOBCON |= ((uint32_t)mode | ((uint32_t)delay << BCCU_GLOBCON_TRDEL_Pos)); +} + +/* + * API to configure the trap input selection of a BCCU module + */ +void XMC_BCCU_SelectTrapInput (XMC_BCCU_t *const bccu, XMC_BCCU_CH_TRAP_IN_t input) +{ + bccu->GLOBCON &= ~(uint32_t)(BCCU_GLOBCON_TRAPIS_Msk); + bccu->GLOBCON |= ((uint32_t)input << BCCU_GLOBCON_TRAPIS_Pos); +} + +/* + * API to configure the trap edge selection of a BCCU module + */ +void XMC_BCCU_SetTrapEdge (XMC_BCCU_t *const bccu, XMC_BCCU_CH_TRAP_EDGE_t edge) +{ + bccu->GLOBCON &= ~(uint32_t)(BCCU_GLOBCON_TRAPED_Msk); + bccu->GLOBCON |= ((uint32_t)edge << BCCU_GLOBCON_TRAPED_Pos); +} + +/* + * API to configure the suspend mode of a BCCU module + */ +void XMC_BCCU_ConfigSuspendMode (XMC_BCCU_t *const bccu, XMC_BCCU_SUSPEND_MODE_t mode) +{ + bccu->GLOBCON &= ~(uint32_t)(BCCU_GLOBCON_SUSCFG_Msk); + bccu->GLOBCON |= ((uint32_t)mode << BCCU_GLOBCON_SUSCFG_Pos); +} + +/* + * API to configure number of consecutive zeroes allowed at modulator output (flicker watch-dog number) + */ +void XMC_BCCU_SetFlickerWDThreshold (XMC_BCCU_t *const bccu, uint32_t threshold_no) +{ + XMC_ASSERT("XMC_BCCU_SetFlickerWDThreshold: Invalid threshold no", (threshold_no <= BCCU_GLOBCON_WDMBN_Msk)); + + bccu->GLOBCON &= ~(uint32_t)(BCCU_GLOBCON_WDMBN_Msk); + bccu->GLOBCON |= (uint32_t)(threshold_no << BCCU_GLOBCON_WDMBN_Pos); +} + +/* + * API to configure the fast clock prescaler factor of a BCCU module + */ +void XMC_BCCU_SetFastClockPrescaler (XMC_BCCU_t *const bccu, uint32_t div) +{ + XMC_ASSERT("XMC_BCCU_SetFastClockPrescaler: Invalid divider value", (div <= BCCU_GLOBCLK_FCLK_PS_Msk)); + + bccu->GLOBCLK &= ~(uint32_t)(BCCU_GLOBCLK_FCLK_PS_Msk); + bccu->GLOBCLK |= div; + +} + +/* + * API to configure the dimmer clock prescaler factor of a BCCU module + */ +void XMC_BCCU_SetDimClockPrescaler (XMC_BCCU_t *const bccu, uint32_t div) +{ + XMC_ASSERT("XMC_BCCU_SetDimClockPrescaler: Invalid divider value", (div <= BCCU_GLOBCLK_DCLK_PS_Msk)); + + bccu->GLOBCLK &= ~(uint32_t)(BCCU_GLOBCLK_DCLK_PS_Msk); + bccu->GLOBCLK |= (uint32_t)(div << BCCU_GLOBCLK_DCLK_PS_Pos); + +} + +/* + * API to configure the modulator output (bit-time) clock prescaler factor of a BCCU module + */ +void XMC_BCCU_SelectBitClock (XMC_BCCU_t *const bccu, XMC_BCCU_BCLK_MODE_t div) +{ + bccu->GLOBCLK &= ~(uint32_t)(BCCU_GLOBCLK_BCS_Msk); + bccu->GLOBCLK |= ((uint32_t)div << BCCU_GLOBCLK_BCS_Pos); +} + +/* + * API to enable the channels at the same time + */ +void XMC_BCCU_ConcurrentEnableChannels (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentEnableChannels: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK)); + + bccu->CHEN |= mask; +} + +/* + * API to disable the channels at the same time + */ +void XMC_BCCU_ConcurrentDisableChannels (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentDisableChannels: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK)); + bccu->CHEN &= ~(uint32_t)(mask); +} + +/* + * API to set the channel's output passive levels at the same time + */ +void XMC_BCCU_ConcurrentSetOutputPassiveLevel(XMC_BCCU_t *const bccu, uint32_t chan_mask, XMC_BCCU_CH_ACTIVE_LEVEL_t level) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentSetOutputPassiveLevel: Invalid channel mask", (chan_mask <= XMC_BCCU_CHANNEL_MASK)); + + bccu->CHOCON &= ~(uint32_t)(chan_mask); + bccu->CHOCON |= (chan_mask * (uint32_t)level); +} + +/* + * API to enable the various types of traps at the same time + */ +void XMC_BCCU_ConcurrentEnableTrap (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentEnableTrap: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK)); + + bccu->CHOCON |= (uint32_t)(mask << BCCU_CHOCON_CH0TPE_Pos); +} + +/* + * API to disable the various types of traps at the same time + */ +void XMC_BCCU_ConcurrentDisableTrap (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentDisableTrap: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK)); + + bccu->CHOCON &= ~(uint32_t)(mask << BCCU_CHOCON_CH0TPE_Pos); +} + +/* + * API to configure trigger mode and trigger delay at the same time, and also configure the channel enable + */ +void XMC_BCCU_ConcurrentConfigTrigger (XMC_BCCU_t *const bccu, XMC_BCCU_TRIG_CONFIG_t *trig) +{ + uint32_t reg; + + XMC_ASSERT("XMC_BCCU_ConcurrentConfigTrigger: Invalid channel mask", (trig->mask_chans <= XMC_BCCU_CHANNEL_MASK)); + + bccu->GLOBCON &= ~(uint32_t)(BCCU_GLOBCON_TM_Msk | BCCU_GLOBCON_TRDEL_Msk); + bccu->GLOBCON |= ((uint32_t)trig->mode | ((uint32_t)trig->delay << BCCU_GLOBCON_TRDEL_Pos)); + reg = 0U; + reg |= trig->mask_chans; + reg |= ((uint32_t)trig->mask_trig_lines << BCCU_CHTRIG_TOS0_Pos); + bccu->CHTRIG = reg; +} + +/* + * API to start the linear walk of the channels to change towards target intensity at the same time + */ +void XMC_BCCU_ConcurrentStartLinearWalk (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentStartLinearWalk: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK)); + + bccu->CHSTRCON |= (uint32_t)(mask); +} + +/* + * API to abort the linear walk of the channels at the same time + */ +void XMC_BCCU_ConcurrentAbortLinearWalk (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentAbortLinearWalk: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK)); + + bccu->CHSTRCON |= (uint32_t)(mask << BCCU_CHSTRCON_CH0A_Pos); +} + +/* + * API to enable the dimming engines at the same time + */ +void XMC_BCCU_ConcurrentEnableDimmingEngine (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentEnableDimmingEngine: Invalid dimming engine mask", (mask <= XMC_BCCU_DIM_ENGINE_MASK)); + + bccu->DEEN = (uint32_t)(mask); +} + +/* + * API to enable the dimming engines at the same time + */ +void XMC_BCCU_ConcurrentDisableDimmingEngine (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentDisableDimmingEngine: Invalid dimming engine mask", (mask <= XMC_BCCU_DIM_ENGINE_MASK)); + + bccu->DEEN &= ~(uint32_t)(mask); +} + +/* + * API to start the dimming engines at the same time to change towards target dim level + */ +void XMC_BCCU_ConcurrentStartDimming (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentStartDimming: Invalid dimming engine mask", (mask <= XMC_BCCU_DIM_ENGINE_MASK)); + + bccu->DESTRCON = (uint32_t)(mask); +} + +/* + * API to abort the dimming engines at the same time + */ +void XMC_BCCU_ConcurrentAbortDimming (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentAbortDimming: Invalid dimming engine mask", (mask <= XMC_BCCU_DIM_ENGINE_MASK)); + + bccu->DESTRCON = (uint32_t)(mask << BCCU_DESTRCON_DE0A_Pos); +} + +/* + * API to configure the dim level of a dimming engine + */ +void XMC_BCCU_SetGlobalDimmingLevel (XMC_BCCU_t *const bccu, uint32_t level) +{ + XMC_ASSERT("XMC_BCCU_SetGlobalDimmingLevel: Invalid global dimming level", (level <= BCCU_GLOBDIM_GLOBDIM_Msk)); + + bccu->GLOBDIM = level; +} + +/* + * API to enable a specific channel + */ +void XMC_BCCU_EnableChannel (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + XMC_ASSERT("XMC_BCCU_EnableChannel: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1))); + + bccu->CHEN |= (uint32_t)(BCCU_CHEN_ECH0_Msk << chan_no); +} + +/* + * API to disable a specific channel + */ +void XMC_BCCU_DisableChannel (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + XMC_ASSERT("XMC_BCCU_DisableChannel: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1))); + + bccu->CHEN &= ~(uint32_t)(BCCU_CHEN_ECH0_Msk << chan_no); +} + +/* + * API to set the specific channel's passive level + */ +void XMC_BCCU_SetOutputPassiveLevel(XMC_BCCU_t *const bccu, uint32_t chan_no, XMC_BCCU_CH_ACTIVE_LEVEL_t level) +{ + XMC_ASSERT("XMC_BCCU_SetOutputPassiveLevel: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1))); + + bccu->CHOCON |= ((uint32_t)level << chan_no); +} + +/* + * API to enable the specific channel trap + */ +void XMC_BCCU_EnableTrap (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + XMC_ASSERT("XMC_BCCU_EnableTrap: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1))); + + bccu->CHOCON |= (uint32_t)(BCCU_CHOCON_CH0TPE_Msk << chan_no); +} + +/* + * API to disable the specific channel trap + */ +void XMC_BCCU_DisableTrap (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + XMC_ASSERT("XMC_BCCU_DisableTrap: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1))); + + bccu->CHOCON &= ~(uint32_t)(BCCU_CHOCON_CH0TPE_Msk << chan_no); +} + +/* + * API to configure specific channel trigger enable and trigger line. + */ +void XMC_BCCU_EnableChannelTrigger (XMC_BCCU_t *const bccu, uint32_t chan_no, XMC_BCCU_CH_TRIGOUT_t trig_line) +{ + uint32_t reg; + XMC_ASSERT("XMC_BCCU_EnableChannelTrigger: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1))); + + bccu->CHTRIG &= ~(uint32_t)(BCCU_CHTRIG_TOS0_Msk << chan_no); + reg = (uint32_t)(BCCU_CHTRIG_ET0_Msk << chan_no); + reg |= ((uint32_t)trig_line << (BCCU_CHTRIG_TOS0_Pos + chan_no)); + bccu->CHTRIG |= reg; +} + +/* + * API to disable specific channel + */ +void XMC_BCCU_DisableChannelTrigger (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + XMC_ASSERT("XMC_BCCU_DisableChannelTrigger: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1))); + + bccu->CHTRIG &= ~(uint32_t)(BCCU_CHTRIG_ET0_Msk << chan_no); +} + +/* + * API to initialise the channel of a BCCU module + */ +void XMC_BCCU_CH_Init (XMC_BCCU_CH_t *const channel, const XMC_BCCU_CH_CONFIG_t *const config) +{ + channel->CHCONFIG = config->chconfig; + + channel->PKCMP = config->pkcmp; + + channel->PKCNTR = config->pkcntr; +} + +/* + * API to configure channel trigger edge and force trigger edge + */ +void XMC_BCCU_CH_ConfigTrigger (XMC_BCCU_CH_t *const channel, XMC_BCCU_CH_TRIG_EDGE_t edge, uint32_t force_trig_en) +{ + uint32_t reg; + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_TRED_Msk | BCCU_CH_CHCONFIG_ENFT_Msk); + + reg = ((uint32_t)edge << BCCU_CH_CHCONFIG_TRED_Pos); + reg |= (uint32_t)(force_trig_en << BCCU_CH_CHCONFIG_ENFT_Pos); + channel->CHCONFIG |= reg; +} + +/* + * API to configure the linear walker clock prescaler factor of a BCCU channel + */ +void XMC_BCCU_CH_SetLinearWalkPrescaler (XMC_BCCU_CH_t *const channel, uint32_t clk_div) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_LINPRES_Msk); + channel->CHCONFIG |= (uint32_t)(clk_div << BCCU_CH_CHCONFIG_LINPRES_Pos); +} + +/* + * API to set channel target intensity + */ +void XMC_BCCU_CH_SetTargetIntensity (XMC_BCCU_CH_t *const channel, uint32_t ch_int) +{ + channel->INTS = ch_int; +} + +/* + * API to retrieve the channel actual intensity + */ +uint32_t XMC_BCCU_CH_ReadIntensity (XMC_BCCU_CH_t *const channel) +{ + return (uint32_t)(channel->INT & BCCU_CH_INT_CHINT_Msk); +} + +/* + * API to enable packer. Also configures packer threshold, off-time and on-time compare levels + */ +void XMC_BCCU_CH_EnablePacker (XMC_BCCU_CH_t *const channel, uint32_t thresh, uint32_t off_comp, uint32_t on_comp) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_PEN_Msk | BCCU_CH_CHCONFIG_PKTH_Msk); + channel->CHCONFIG |= thresh; + channel->PKCMP = (off_comp | (uint32_t)(on_comp << BCCU_CH_PKCMP_ONCMP_Pos)); + channel->CHCONFIG |= (uint32_t)BCCU_CH_CHCONFIG_PEN_Msk; +} + +/* + * API to configure packer threshold + */ +void XMC_BCCU_CH_SetPackerThreshold (XMC_BCCU_CH_t *const channel, uint32_t val) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_PKTH_Msk); + channel->CHCONFIG |= val; +} + +/* + * API to configure packer off-time compare level + */ +void XMC_BCCU_CH_SetPackerOffCompare (XMC_BCCU_CH_t *const channel, uint32_t level) +{ + channel->PKCMP &= ~(uint32_t)(BCCU_CH_PKCMP_OFFCMP_Msk); + channel->PKCMP |= level; +} + +/* + * API to configure packer on-time compare level. + */ +void XMC_BCCU_CH_SetPackerOnCompare (XMC_BCCU_CH_t *const channel, uint32_t level) +{ + channel->PKCMP &= ~(uint32_t)(BCCU_CH_PKCMP_ONCMP_Msk); + channel->PKCMP |= (level << BCCU_CH_PKCMP_ONCMP_Pos); +} + +/* + * API to disable a packer. + */ +void XMC_BCCU_CH_DisablePacker (XMC_BCCU_CH_t *const channel) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_PEN_Msk); +} + +/* + * API to set packer off-time counter value + */ +void XMC_BCCU_CH_SetPackerOffCounter (XMC_BCCU_CH_t *const channel, uint32_t cnt_val) +{ + channel->PKCNTR &= ~(uint32_t)(BCCU_CH_PKCNTR_OFFCNTVAL_Msk); + channel->PKCNTR |= cnt_val; +} + +/* + * API to set packer on-time counter value + */ +void XMC_BCCU_CH_SetPackerOnCounter (XMC_BCCU_CH_t *const channel, uint32_t cnt_val) +{ + channel->PKCNTR &= ~(uint32_t)(BCCU_CH_PKCNTR_ONCNTVAL_Msk); + channel->PKCNTR |= (uint32_t)(cnt_val << BCCU_CH_PKCNTR_ONCNTVAL_Pos); +} + +/* + * API to select the dimming engine of a channel + */ +void XMC_BCCU_CH_SelectDimEngine (XMC_BCCU_CH_t *const channel, XMC_BCCU_CH_DIMMING_SOURCE_t sel) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_DSEL_Msk); + channel->CHCONFIG |= ((uint32_t)sel << BCCU_CH_CHCONFIG_DSEL_Pos); +} + +/* + * API to bypass the dimming engine. And the brightness of channel is depending only on + * intensity of the channel. + */ +void XMC_BCCU_CH_EnableDimmingBypass (XMC_BCCU_CH_t *const channel) +{ + channel->CHCONFIG |= (uint32_t)(BCCU_CH_CHCONFIG_DBP_Msk); +} + +/* + * API to disable the bypass of dimming engine. And the brightness of channel is depending + * on intensity of channel and dimming level of dimming engine. + */ +void XMC_BCCU_CH_DisableDimmingBypass (XMC_BCCU_CH_t *const channel) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_DBP_Msk); +} + +/* + * API to initialise a specific dimming engine of a BCCU module + */ +void XMC_BCCU_DIM_Init (XMC_BCCU_DIM_t *const dim_engine, const XMC_BCCU_DIM_CONFIG_t *const config) +{ + dim_engine->DTT = config->dtt; +} + +/* + * API to set dimming engine target dim level + */ +void XMC_BCCU_DIM_SetTargetDimmingLevel (XMC_BCCU_DIM_t *const dim_engine, uint32_t level) +{ + dim_engine->DLS = level; +} + +/* + * API to configure the dimming clock prescaler factor of a dimming engine + */ +void XMC_BCCU_DIM_SetDimDivider (XMC_BCCU_DIM_t *const dim_engine, uint32_t div) +{ + dim_engine->DTT &= ~(uint32_t)(BCCU_DE_DTT_DIMDIV_Msk); + dim_engine->DTT |= div; +} + +/* + * API to configure the dimming curve + */ +void XMC_BCCU_DIM_ConfigDimCurve (XMC_BCCU_DIM_t *const dim_engine, uint32_t dither_en, XMC_BCCU_DIM_CURVE_t sel) +{ + uint32_t reg; + dim_engine->DTT &= ~(uint32_t)(BCCU_DE_DTT_DTEN_Msk | BCCU_DE_DTT_CSEL_Msk); + reg = (uint32_t)(dither_en << BCCU_DE_DTT_DTEN_Pos); + reg |= ((uint32_t)sel << BCCU_DE_DTT_CSEL_Pos); + dim_engine->DTT |= reg; +} + +#endif /* BCCU0 */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_can.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_can.c new file mode 100644 index 00000000..547ebc39 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_can.c @@ -0,0 +1,744 @@ +/** + * @file xmc_can.c + * @date 2016-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * + * 2015-05-20: + * - New API added: XMC_CAN_MO_ReceiveData()
+ * - XMC_CAN_MO_Config() signature has changed
+ * - Minor fix in XMC_CAN_TXFIFO_ConfigMOSlaveObject().
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * 2015-09-01: + * - Removed fCANB clock support
+ * + * 2015-09-08: + * - Fixed bug in XMC_CAN_Init()
+ * + * 2016-06-07: + * - Changed XMC_CAN_AllocateMOtoNodeList to wait for ready status of list controller + * + * 2015-06-20: + * - Fixed bug in XMC_CAN_MO_Config()
+ * @endcond + * + */ + +/******************************************************************************* + * HEADER FILES + *******************************************************************************/ +#include "xmc_can.h" + +#if defined(CAN) +#include "xmc_scu.h" + +__STATIC_INLINE uint32_t max(uint32_t a, uint32_t b) +{ + return (a > b) ? a : b; +} + +__STATIC_INLINE uint32_t min(uint32_t a, uint32_t b) +{ + return (a < b) ? a : b; +} + +/******************************************************************************* + * API IMPLEMENTATION + *******************************************************************************/ + +/* Baudrate Configuration */ +void XMC_CAN_NODE_NominalBitTimeConfigure (XMC_CAN_NODE_t *const can_node, + const XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t *const can_bit_time) +{ + uint32_t temp_brp = 12U ; + uint32_t temp_tseg1 = 12U; + uint32_t best_brp = 0U; + uint32_t best_tseg1 = 1U; + uint32_t best_tseg2 = 0U; + uint32_t best_tbaud = 0U; + uint32_t best_error = 10000U; + + XMC_ASSERT("XMC_CAN_NODE_NOMINAL_BIT_TIME_Configure: rate not supported", (can_bit_time->baudrate < 1000000U) || + (can_bit_time->baudrate >= 100000U)); + XMC_ASSERT("XMC_CAN_NODE_NOMINAL_BIT_TIME_Configure: fCAN not supported", + can_bit_time->can_frequency <= 120000000U); + XMC_ASSERT("XMC_CAN_NODE_NOMINAL_BIT_TIME_Configure: fCAN not supported", + can_bit_time->can_frequency > 5000000U); + XMC_ASSERT("XMC_CAN_NODE_NOMINAL_BIT_TIME_Configure: sample point not supported", + (can_bit_time->sample_point < 10000U) && ((can_bit_time->sample_point > 0U))); + + /* + * Bit timing & sampling + * Tq = (BRP+1)/Fcan if DIV8 = 0 + * Tq = 8*(BRP+1)/Fcan if DIV8 = 1 + * TSync = 1.Tq + * TSeg1 = (TSEG1+1)*Tq >= 3Tq + * TSeg2 = (TSEG2+1)*Tq >= 2Tq + * Bit Time = TSync + TSeg1 + TSeg2 >= 8Tq + * + * Resynchronization: + * + * Tsjw = (SJW + 1)*Tq + * TSeg1 >= Tsjw + Tprop + * TSeg2 >= Tsjw + */ + /* search for best baudrate */ + for (temp_brp = 1U; temp_brp <= 64U; temp_brp++) + { + + uint32_t f_quanta = (uint32_t)((can_bit_time->can_frequency * 10U) / temp_brp); + uint32_t temp_tbaud = (uint32_t)(f_quanta / (can_bit_time->baudrate)); + uint32_t temp_baudrate; + uint32_t error; + + if((temp_tbaud % 10U) > 5U) + { + temp_tbaud = (uint32_t)(temp_tbaud / 10U); + temp_tbaud++; + } + else + { + temp_tbaud = (uint32_t)(temp_tbaud / 10U); + } + + if(temp_tbaud > 0U) + { + temp_baudrate = (uint32_t) (f_quanta / (temp_tbaud * 10U)); + } + else + { + temp_baudrate = f_quanta / 10U; + temp_tbaud = 1; + } + + if(temp_baudrate >= can_bit_time->baudrate) + { + error = temp_baudrate - can_bit_time->baudrate; + } + else + { + error = can_bit_time->baudrate - temp_baudrate; + } + + if ((temp_tbaud <= 20U) && (best_error > error)) + { + best_brp = temp_brp; + best_tbaud = temp_tbaud; + best_error = (error); + + if (error < 1000U) + { + break; + } + } + } + /* search for best sample point */ + best_error = 10000U; + + for (temp_tseg1 = 64U; temp_tseg1 >= 3U; temp_tseg1--) + { + uint32_t tempSamplePoint = ((temp_tseg1 + 1U) * 10000U) / best_tbaud; + uint32_t error; + if (tempSamplePoint >= can_bit_time->sample_point) + { + error = tempSamplePoint - can_bit_time->sample_point; + } + else + { + error = can_bit_time->sample_point - tempSamplePoint; + } + if (best_error > error) + { + best_tseg1 = temp_tseg1; + best_error = error; + } + if (tempSamplePoint < (can_bit_time->sample_point)) + { + break; + } + } + + best_tseg2 = best_tbaud - best_tseg1 - 1U; + + XMC_CAN_NODE_EnableConfigurationChange(can_node); + /* Configure bit timing register */ + can_node->NBTR = (((uint32_t)(best_tseg2 - 1u) << CAN_NODE_NBTR_TSEG2_Pos) & (uint32_t)CAN_NODE_NBTR_TSEG2_Msk) | + ((((uint32_t)((uint32_t)(can_bit_time->sjw)-1U) << CAN_NODE_NBTR_SJW_Pos)) & (uint32_t)CAN_NODE_NBTR_SJW_Msk)| + (((uint32_t)(best_tseg1-1U) << CAN_NODE_NBTR_TSEG1_Pos) & (uint32_t)CAN_NODE_NBTR_TSEG1_Msk)| + (((uint32_t)(best_brp - 1U) << CAN_NODE_NBTR_BRP_Pos) & (uint32_t)CAN_NODE_NBTR_BRP_Msk)| + (((uint32_t)0U << CAN_NODE_NBTR_DIV8_Pos) & (uint32_t)CAN_NODE_NBTR_DIV8_Msk); + XMC_CAN_NODE_DisableConfigurationChange(can_node); +} +/* Function to allocate message object from free list to node list */ +void XMC_CAN_AllocateMOtoNodeList(XMC_CAN_t *const obj, const uint8_t node_num, const uint8_t mo_num) +{ + /* wait while panel operation is in progress. */ + while (XMC_CAN_IsPanelControlReady(obj) == false) + { + /*Do nothing*/ + }; + + /* Panel Command for allocation of MO to node list */ + XMC_CAN_PanelControl(obj, XMC_CAN_PANCMD_STATIC_ALLOCATE,mo_num,(node_num + 1U)); +} + +/* Disable XMC_CAN Peripheral */ +void XMC_CAN_Disable(XMC_CAN_t *const obj) +{ + /* Disable CAN Module */ + obj->CLC = CAN_CLC_DISR_Msk; +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_MCAN); +#endif +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_MCAN); +#endif +} + +/* Enable XMC_CAN Peripheral */ +void XMC_CAN_Enable(XMC_CAN_t *const obj) +{ +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_MCAN); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_MCAN); +#endif + /* Enable CAN Module */ + obj->CLC &= ~(uint32_t)CAN_CLC_DISR_Msk; + while (obj->CLC & CAN_CLC_DISS_Msk) + { + /*Do nothing*/ + }; +} +#if defined(MULTICAN_PLUS) +uint32_t XMC_CAN_GetBaudrateClockFrequency(XMC_CAN_t *const obj) +{ + uint32_t frequency; + + switch(XMC_CAN_GetBaudrateClockSource(obj)) + { +#if UC_FAMILY == XMC4 + case XMC_CAN_CANCLKSRC_FPERI: + frequency = XMC_SCU_CLOCK_GetPeripheralClockFrequency(); + break; +#else + case XMC_CAN_CANCLKSRC_MCLK: + frequency = XMC_SCU_CLOCK_GetPeripheralClockFrequency(); + break; +#endif + case XMC_CAN_CANCLKSRC_FOHP: + frequency = OSCHP_GetFrequency(); + break; + + default: + frequency = 0; + break; + } + + return frequency; +} + +void XMC_CAN_Init(XMC_CAN_t *const obj, XMC_CAN_CANCLKSRC_t clksrc, uint32_t can_frequency) +{ + uint32_t step_n, step_f; + bool normal_divider; + uint32_t freq_n, freq_f; + uint32_t step; + uint32_t can_frequency_khz; + uint32_t peripheral_frequency_khz; + XMC_CAN_DM_t can_divider_mode; + + uint32_t peripheral_frequency; + /*Enabling the module*/ + XMC_CAN_Enable(obj); + + XMC_CAN_SetBaudrateClockSource(obj, clksrc); + + peripheral_frequency = XMC_CAN_GetBaudrateClockFrequency(obj); + + XMC_ASSERT("XMC_CAN_Init: frequency not supported", can_frequency <= peripheral_frequency); + + /* Normal divider mode */ + step_n = (uint32_t)min(max(0U, (1024U - (peripheral_frequency / can_frequency))), 1023U); + freq_n = (uint32_t) (peripheral_frequency / (1024U - step_n)); + + /* Fractional divider mode */ + can_frequency_khz = (uint32_t) (can_frequency >> 6); + peripheral_frequency_khz = (uint32_t)(peripheral_frequency >> 6); + + step_f = (uint32_t)(min( (((1024U * can_frequency_khz) / peripheral_frequency_khz) ), 1023U )); + freq_f = (uint32_t)((peripheral_frequency_khz * step_f) / 1024U); + freq_f = freq_f << 6; + + normal_divider = (uint32_t)(can_frequency - freq_n) <= (can_frequency - freq_f); + + step = (normal_divider != 0U) ? step_n : step_f; + can_divider_mode = (normal_divider != 0U) ? XMC_CAN_DM_NORMAL : XMC_CAN_DM_FRACTIONAL; + + obj->FDR &= (uint32_t) ~(CAN_FDR_DM_Msk | CAN_FDR_STEP_Msk); + obj->FDR |= ((uint32_t)can_divider_mode << CAN_FDR_DM_Pos) | ((uint32_t)step << CAN_FDR_STEP_Pos); + +} + +void XMC_CAN_SetBaudrateClockSource(XMC_CAN_t *const obj,const XMC_CAN_CANCLKSRC_t source) +{ + obj->MCR = (obj->MCR & ~CAN_MCR_CLKSEL_Msk) | source ; +} + +XMC_CAN_CANCLKSRC_t XMC_CAN_GetBaudrateClockSource(XMC_CAN_t *const obj) +{ + return ((XMC_CAN_CANCLKSRC_t)((obj->MCR & CAN_MCR_CLKSEL_Msk) >> CAN_MCR_CLKSEL_Pos)); +} + +#else +/* Initialization of XMC_CAN GLOBAL Object */ +void XMC_CAN_Init(XMC_CAN_t *const obj, uint32_t can_frequency) +{ + uint32_t step_n, step_f; + bool normal_divider; + uint32_t freq_n, freq_f; + uint32_t step; + uint32_t can_frequency_khz; + uint32_t peripheral_frequency_khz; + XMC_CAN_DM_t can_divider_mode; + + uint32_t peripheral_frequency = (XMC_SCU_CLOCK_GetPeripheralClockFrequency()); + + XMC_ASSERT("XMC_CAN_Init: frequency not supported", can_frequency <= peripheral_frequency); + + /*Enabling the module*/ + XMC_CAN_Enable(obj); + + /* Normal divider mode */ + step_n = (uint32_t)min(max(0U, (1024U - (peripheral_frequency / can_frequency))), 1023U); + freq_n = (uint32_t) (peripheral_frequency / (1024U - step_n)); + + /* Fractional divider mode */ + can_frequency_khz = (uint32_t) (can_frequency >> 6); + peripheral_frequency_khz = (uint32_t)(peripheral_frequency >> 6); + + step_f = (uint32_t)(min( (((1024U * can_frequency_khz) / peripheral_frequency_khz) ), 1023U )); + freq_f = (uint32_t)((peripheral_frequency_khz * step_f) / 1024U); + freq_f = freq_f << 6; + + normal_divider = (uint32_t)(can_frequency - freq_n) <= (can_frequency - freq_f); + + step = (normal_divider != 0U) ? step_n : step_f; + can_divider_mode = (normal_divider != 0U) ? XMC_CAN_DM_NORMAL : XMC_CAN_DM_FRACTIONAL; + + obj->FDR &= (uint32_t) ~(CAN_FDR_DM_Msk | CAN_FDR_STEP_Msk); + obj->FDR |= ((uint32_t)can_divider_mode << CAN_FDR_DM_Pos) | ((uint32_t)step << CAN_FDR_STEP_Pos); +} +#endif + +/* Sets the Identifier of the MO */ +void XMC_CAN_MO_SetIdentifier(XMC_CAN_MO_t *const can_mo, const uint32_t can_identifier) +{ + if ((can_mo->can_mo_ptr->MOAR & CAN_MO_MOAR_IDE_Msk) != (uint32_t)CAN_MO_MOAR_IDE_Msk) + { + can_mo->can_mo_ptr->MOAR = ((can_mo->can_mo_ptr->MOAR) & ~(uint32_t)(CAN_MO_MOAR_ID_Msk)) | + ((can_identifier << XMC_CAN_MO_MOAR_STDID_Pos) & (uint32_t)CAN_MO_MOAR_ID_Msk); + } + else + { + can_mo->can_mo_ptr->MOAR = ((can_mo->can_mo_ptr->MOAR) & ~(uint32_t)(CAN_MO_MOAR_ID_Msk)) | + (can_identifier & (uint32_t)CAN_MO_MOAR_ID_Msk); + } + can_mo->can_identifier = can_identifier; +} + + +/* Gets the Identifier of the MO */ +uint32_t XMC_CAN_MO_GetIdentifier(const XMC_CAN_MO_t *const can_mo) +{ + uint32_t identifier; + if ((can_mo->can_mo_ptr->MOAR & CAN_MO_MOAR_IDE_Msk) != (uint32_t)CAN_MO_MOAR_IDE_Msk) + { + identifier = ((can_mo->can_mo_ptr->MOAR) & (uint32_t)(CAN_MO_MOAR_ID_Msk)) >> XMC_CAN_MO_MOAR_STDID_Pos; + } + else + { + identifier = ((can_mo->can_mo_ptr->MOAR) & (uint32_t)(CAN_MO_MOAR_ID_Msk)); + } + return identifier; +} + +/* Gets the acceptance mask for the CAN MO. */ +uint32_t XMC_CAN_MO_GetAcceptanceMask(const XMC_CAN_MO_t *const can_mo) +{ + uint32_t identifier_mask; + if (((can_mo->can_mo_ptr->MOAMR & CAN_MO_MOAMR_MIDE_Msk) != (uint32_t)CAN_MO_MOAMR_MIDE_Msk) + && ((can_mo->can_mo_ptr->MOAR & CAN_MO_MOAR_IDE_Msk) != (uint32_t)CAN_MO_MOAR_IDE_Msk)) + { + identifier_mask = ((can_mo->can_mo_ptr->MOAMR) & (uint32_t)(CAN_MO_MOAMR_AM_Msk)) >> XMC_CAN_MO_MOAR_STDID_Pos; + } + else + { + identifier_mask = ((can_mo->can_mo_ptr->MOAMR) & (uint32_t)(CAN_MO_MOAMR_AM_Msk)); + } + return identifier_mask; +} + +/* Gets the acceptance mask of the MO */ +void XMC_CAN_MO_SetAcceptanceMask(XMC_CAN_MO_t *const can_mo,const uint32_t can_id_mask) +{ + if (((can_mo->can_mo_ptr->MOAMR & CAN_MO_MOAMR_MIDE_Msk) != (uint32_t)CAN_MO_MOAMR_MIDE_Msk) + && ((can_mo->can_mo_ptr->MOAR & CAN_MO_MOAR_IDE_Msk) != (uint32_t)CAN_MO_MOAR_IDE_Msk)) + { + can_mo->can_mo_ptr->MOAMR = ((can_mo->can_mo_ptr->MOAMR) & ~(uint32_t)(CAN_MO_MOAMR_AM_Msk)) | + (can_id_mask << XMC_CAN_MO_MOAR_STDID_Pos); + } + else + { + can_mo->can_mo_ptr->MOAMR = ((can_mo->can_mo_ptr->MOAMR) & ~(uint32_t)(CAN_MO_MOAMR_AM_Msk)) | + (can_id_mask & (uint32_t)CAN_MO_MOAMR_AM_Msk); + } + can_mo->can_id_mask = can_id_mask; +} + +/* Initialization of XMC_CAN MO Object */ +void XMC_CAN_MO_Config(const XMC_CAN_MO_t *const can_mo) +{ + uint32_t reg; + + /* Configure MPN */ + uint32_t num = ((uint32_t)(can_mo->can_mo_ptr) - CAN_BASE - 0x1000U)/0x0020U; + uint32_t set = (((uint32_t)(num/32) << (CAN_MO_MOIPR_MPN_Pos + 5U)) | ((uint32_t)(num%32) << CAN_MO_MOIPR_MPN_Pos)); + can_mo->can_mo_ptr->MOIPR &= ~(CAN_MO_MOIPR_MPN_Msk); + can_mo->can_mo_ptr->MOIPR |= set; + + if (((can_mo->can_id_mode != (uint32_t) XMC_CAN_FRAME_TYPE_STANDARD_11BITS) && + (can_mo->can_id_mode != (uint32_t) XMC_CAN_FRAME_TYPE_EXTENDED_29BITS)) || + ((can_mo->can_mo_type != XMC_CAN_MO_TYPE_RECMSGOBJ) && + (can_mo->can_mo_type != XMC_CAN_MO_TYPE_TRANSMSGOBJ))) + { + ; /*Do nothing*/ + } + else + { + + /* Disable Message object */ + can_mo->can_mo_ptr->MOCTR = CAN_MO_MOCTR_RESMSGVAL_Msk; + if (can_mo->can_id_mode == (uint32_t)XMC_CAN_FRAME_TYPE_STANDARD_11BITS) + { + reg = can_mo->mo_ar; + reg &= (uint32_t) ~(CAN_MO_MOAR_ID_Msk); + reg |= (can_mo->can_identifier << XMC_CAN_MO_MOAR_STDID_Pos); + can_mo->can_mo_ptr->MOAR = reg; + + reg = can_mo->mo_amr; + reg &= (uint32_t) ~(CAN_MO_MOAMR_AM_Msk); + reg |= (can_mo->can_id_mask << XMC_CAN_MO_MOAR_STDID_Pos); + can_mo->can_mo_ptr->MOAMR = reg; + } + else + { + can_mo->can_mo_ptr->MOAR = can_mo->mo_ar; + can_mo->can_mo_ptr->MOAMR = can_mo->mo_amr; + } + /* Check whether message object is transmit message object */ + if (can_mo->can_mo_type == XMC_CAN_MO_TYPE_TRANSMSGOBJ) + { + /* Set MO as Transmit message object */ + XMC_CAN_MO_UpdateData(can_mo); + can_mo->can_mo_ptr->MOCTR = CAN_MO_MOCTR_SETDIR_Msk; + } + else + { + /* Set MO as Receive message object and set RXEN bit */ + can_mo->can_mo_ptr->MOCTR = CAN_MO_MOCTR_RESDIR_Msk; + } + + /* Reset RTSEL and Set MSGVAL ,TXEN0 and TXEN1 bits */ + can_mo->can_mo_ptr->MOCTR = (CAN_MO_MOCTR_SETTXEN0_Msk | CAN_MO_MOCTR_SETTXEN1_Msk | CAN_MO_MOCTR_SETMSGVAL_Msk | + CAN_MO_MOCTR_SETRXEN_Msk | CAN_MO_MOCTR_RESRTSEL_Msk); + } +} + +/* Update of XMC_CAN Object */ +XMC_CAN_STATUS_t XMC_CAN_MO_UpdateData(const XMC_CAN_MO_t *const can_mo) +{ + XMC_CAN_STATUS_t error = XMC_CAN_STATUS_MO_NOT_ACCEPTABLE; + /* Check whether message object is transmit message object */ + if (can_mo->can_mo_type == XMC_CAN_MO_TYPE_TRANSMSGOBJ) + { + can_mo->can_mo_ptr->MOCTR = CAN_MO_MOCTR_RESMSGVAL_Msk; + /* Configure data length */ + can_mo->can_mo_ptr->MOFCR = ((can_mo->can_mo_ptr->MOFCR) & ~(uint32_t)(CAN_MO_MOFCR_DLC_Msk)) | + (((uint32_t) can_mo->can_data_length << CAN_MO_MOFCR_DLC_Pos) & (uint32_t)CAN_MO_MOFCR_DLC_Msk); + /* Configure Data registers*/ + can_mo->can_mo_ptr->MODATAL = can_mo->can_data[0]; + can_mo->can_mo_ptr->MODATAH = can_mo->can_data[1]; + /* Reset RTSEL and Set MSGVAL ,TXEN0 and TXEN1 bits */ + can_mo->can_mo_ptr->MOCTR = (CAN_MO_MOCTR_SETNEWDAT_Msk| CAN_MO_MOCTR_SETMSGVAL_Msk |CAN_MO_MOCTR_RESRTSEL_Msk); + error = XMC_CAN_STATUS_SUCCESS; + } + else + { + error = XMC_CAN_STATUS_MO_NOT_ACCEPTABLE; + } + return error; +} + +/* This function is will put a transmit request to transmit message object */ +XMC_CAN_STATUS_t XMC_CAN_MO_Transmit(const XMC_CAN_MO_t *const can_mo) +{ + XMC_CAN_STATUS_t error = XMC_CAN_STATUS_ERROR; + uint32_t mo_type = (uint32_t)(((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_MSGVAL_Msk) >> CAN_MO_MOSTAT_MSGVAL_Pos); + uint32_t mo_transmission_ongoing = (uint32_t) ((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_TXRQ_Msk) >> CAN_MO_MOSTAT_TXRQ_Pos; + /* check if message is disabled */ + if (mo_type == 0U) + { + error = XMC_CAN_STATUS_MO_DISABLED; + } + /* check if transmission is ongoing on message object */ + else if (mo_transmission_ongoing == 1U) + { + error = XMC_CAN_STATUS_BUSY; + } + else + { + /* set TXRQ bit */ + can_mo->can_mo_ptr-> MOCTR = CAN_MO_MOCTR_SETTXRQ_Msk | CAN_MO_MOCTR_SETTXEN0_Msk | CAN_MO_MOCTR_SETTXEN1_Msk; + error = XMC_CAN_STATUS_SUCCESS; + } + return error; +} + +/* This function is will read the message object data bytes */ +XMC_CAN_STATUS_t XMC_CAN_MO_ReceiveData (XMC_CAN_MO_t *can_mo) +{ + XMC_CAN_STATUS_t error = XMC_CAN_STATUS_ERROR; + uint8_t rx_pnd = 0U; + uint8_t new_data = 0U; + uint32_t mo_type = (uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_DIR_Msk) >> CAN_MO_MOSTAT_DIR_Pos; + uint32_t mo_recepcion_ongoing = (uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_RXUPD_Msk) >> CAN_MO_MOSTAT_RXUPD_Pos; + /* check if message object is a receive message object */ + if (mo_type != (uint32_t)XMC_CAN_MO_TYPE_RECMSGOBJ) + { + error = XMC_CAN_STATUS_MO_NOT_ACCEPTABLE; + } + /* check if reception is ongoing on message object */ + else if (mo_recepcion_ongoing == 1U) + { + error = XMC_CAN_STATUS_BUSY; + } + else + { + /* read message parameters */ + do + { + can_mo->can_data[0] = can_mo->can_mo_ptr->MODATAL; + can_mo->can_data[1] = can_mo->can_mo_ptr->MODATAH; + + rx_pnd = (uint8_t)((uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_RXUPD_Msk) >> CAN_MO_MOSTAT_RXUPD_Pos); + new_data = (uint8_t)((uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_NEWDAT_Msk) >> CAN_MO_MOSTAT_NEWDAT_Pos); + } while ((rx_pnd != 0U) && (new_data != 0U)); + + error = XMC_CAN_STATUS_SUCCESS; + } + return error; +} + + +/* This function is will read the message object data bytes */ +XMC_CAN_STATUS_t XMC_CAN_MO_Receive (XMC_CAN_MO_t *can_mo) +{ + XMC_CAN_STATUS_t error = XMC_CAN_STATUS_ERROR; + uint8_t rx_pnd = 0U; + uint8_t new_data = 0U; + uint32_t mo_type = (uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_DIR_Msk) >> CAN_MO_MOSTAT_DIR_Pos; + uint32_t mo_recepcion_ongoing = (uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_RXUPD_Msk) >> CAN_MO_MOSTAT_RXUPD_Pos; + /* check if message object is a receive message object */ + if (mo_type != (uint32_t)XMC_CAN_MO_TYPE_RECMSGOBJ) + { + error = XMC_CAN_STATUS_MO_NOT_ACCEPTABLE; + } + /* check if reception is ongoing on message object */ + else if (mo_recepcion_ongoing == 1U) + { + error = XMC_CAN_STATUS_BUSY; + } + else + { + /* read message parameters */ + do + { + can_mo->can_mo_ptr->MOCTR = CAN_MO_MOCTR_RESNEWDAT_Msk; + if ((((can_mo->can_mo_ptr->MOAR) & CAN_MO_MOAR_IDE_Msk) >> CAN_MO_MOAR_IDE_Pos) == 0U) + { + can_mo->can_id_mode = (uint32_t)XMC_CAN_FRAME_TYPE_STANDARD_11BITS; + can_mo->can_identifier = (can_mo->can_mo_ptr->MOAR & XMC_CAN_MO_MOAR_STDID_Msk) >> XMC_CAN_MO_MOAR_STDID_Pos; + can_mo->can_ide_mask = (uint32_t)(can_mo->can_mo_ptr->MOAMR & CAN_MO_MOAMR_MIDE_Msk) >> CAN_MO_MOAMR_MIDE_Pos; + if(can_mo->can_ide_mask == 1U) + { + can_mo->can_id_mask = (uint32_t)(can_mo->can_mo_ptr->MOAMR & XMC_CAN_MO_MOAR_STDID_Msk) >> XMC_CAN_MO_MOAR_STDID_Pos; + } + else + { + can_mo->can_id_mask = (uint32_t)(can_mo->can_mo_ptr->MOAMR & CAN_MO_MOAMR_AM_Msk); + } + } + else + { + can_mo->can_id_mode = (uint32_t)XMC_CAN_FRAME_TYPE_EXTENDED_29BITS; + can_mo->can_identifier = (can_mo->can_mo_ptr->MOAR & CAN_MO_MOAR_ID_Msk); + can_mo->can_id_mask = (uint32_t)(can_mo->can_mo_ptr->MOAMR & CAN_MO_MOAMR_AM_Msk); + can_mo->can_ide_mask = (uint32_t)(can_mo->can_mo_ptr->MOAMR & CAN_MO_MOAMR_MIDE_Msk) >> CAN_MO_MOAMR_MIDE_Pos; + } + can_mo->can_data_length = (uint8_t)((uint32_t)((can_mo->can_mo_ptr->MOFCR) & CAN_MO_MOFCR_DLC_Msk) >> CAN_MO_MOFCR_DLC_Pos); + + can_mo->can_data[0] = can_mo->can_mo_ptr->MODATAL; + can_mo->can_data[1] = can_mo->can_mo_ptr->MODATAH; + + rx_pnd = (uint8_t)((uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_RXUPD_Msk) >> CAN_MO_MOSTAT_RXUPD_Pos); + new_data = (uint8_t)((uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_NEWDAT_Msk) >> CAN_MO_MOSTAT_NEWDAT_Pos); + } while ((rx_pnd != 0U) && (new_data != 0U)); + + can_mo->can_mo_type = XMC_CAN_MO_TYPE_RECMSGOBJ; + error = XMC_CAN_STATUS_SUCCESS; + } + return error; +} + +/* Function to enable node event */ +void XMC_CAN_NODE_EnableEvent(XMC_CAN_NODE_t *const can_node, const XMC_CAN_NODE_EVENT_t event) +{ + if(event != XMC_CAN_NODE_EVENT_CFCIE) + { + can_node->NCR |= (uint32_t)event; + } + else + { + can_node->NFCR |= (uint32_t)event; + } +} + +/* Function to disable node event */ +void XMC_CAN_NODE_DisableEvent(XMC_CAN_NODE_t *const can_node, const XMC_CAN_NODE_EVENT_t event) +{ + if(event != XMC_CAN_NODE_EVENT_CFCIE) + { + can_node->NCR &= ~(uint32_t)event; + } + else + { + can_node->NFCR &= ~(uint32_t)event; + } +} +/* Function to transmit MO from the FIFO */ +XMC_CAN_STATUS_t XMC_CAN_TXFIFO_Transmit(const XMC_CAN_MO_t *const can_mo) +{ + XMC_CAN_STATUS_t error = XMC_CAN_STATUS_ERROR; + uint32_t mo_type = ((uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_MSGVAL_Msk) >> CAN_MO_MOSTAT_MSGVAL_Pos); + uint32_t mo_transmission_ongoing = (uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_TXRQ_Msk) >> CAN_MO_MOSTAT_TXRQ_Pos; + uint32_t mo_cur = (uint32_t)(can_mo->can_mo_ptr-> MOFGPR & CAN_MO_MOFGPR_CUR_Msk) >> CAN_MO_MOFGPR_CUR_Pos; + CAN_MO_TypeDef* mo = (CAN_MO_TypeDef *)(CAN_BASE + 0x1000UL + (mo_cur * 0x0020UL)); + /* check if message is disabled */ + if (mo_type == 0U) + { + error = XMC_CAN_STATUS_MO_DISABLED; + } + /* check if transmission is ongoing on message object */ + else if (mo_transmission_ongoing == 1U) + { + error = XMC_CAN_STATUS_BUSY; + } + else + { + mo->MOCTR = CAN_MO_MOCTR_SETTXRQ_Msk | CAN_MO_MOCTR_SETTXEN0_Msk | CAN_MO_MOCTR_SETTXEN1_Msk; + error = XMC_CAN_STATUS_SUCCESS; + } + return error; +} + +/* Function to initialize the transmit FIFO MO base object */ +void XMC_CAN_TXFIFO_ConfigMOBaseObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_FIFO_CONFIG_t can_fifo) +{ + can_mo->can_mo_ptr->MOFCR = ((can_mo->can_mo_ptr->MOFCR ) & ~(uint32_t)(CAN_MO_MOFCR_MMC_Msk)) | + (((uint32_t)0x2U << CAN_MO_MOFCR_MMC_Pos) & (uint32_t)CAN_MO_MOFCR_MMC_Msk); + can_mo->can_mo_ptr->MOFGPR = ((can_mo->can_mo_ptr->MOFGPR ) & ~(uint32_t)(CAN_MO_MOFGPR_BOT_Msk | + CAN_MO_MOFGPR_TOP_Msk | + CAN_MO_MOFGPR_CUR_Msk)) | + (((uint32_t)can_fifo.fifo_bottom << CAN_MO_MOFGPR_BOT_Pos) & (uint32_t)CAN_MO_MOFGPR_BOT_Msk) | + (((uint32_t)can_fifo.fifo_base << CAN_MO_MOFGPR_CUR_Pos) & (uint32_t) CAN_MO_MOFGPR_CUR_Msk) | + (((uint32_t)can_fifo.fifo_top << CAN_MO_MOFGPR_TOP_Pos) & (uint32_t) CAN_MO_MOFGPR_TOP_Msk); +} +/* Function to Initialize the receive FIFO MO base object */ +void XMC_CAN_RXFIFO_ConfigMOBaseObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_FIFO_CONFIG_t can_fifo) +{ + can_mo->can_mo_ptr->MOFCR = ((can_mo->can_mo_ptr->MOFCR ) & ~(uint32_t)(CAN_MO_MOFCR_MMC_Msk)) | + (((uint32_t)0x1U << CAN_MO_MOFCR_MMC_Pos) & (uint32_t)CAN_MO_MOFCR_MMC_Msk); + can_mo->can_mo_ptr->MOFGPR = ((can_mo->can_mo_ptr->MOFGPR ) & ~( uint32_t)(CAN_MO_MOFGPR_BOT_Msk | + CAN_MO_MOFGPR_TOP_Msk | + CAN_MO_MOFGPR_CUR_Msk)) | + (((uint32_t)can_fifo.fifo_bottom << CAN_MO_MOFGPR_BOT_Pos) & (uint32_t)CAN_MO_MOFGPR_BOT_Msk) | + (((uint32_t)can_fifo.fifo_base << CAN_MO_MOFGPR_CUR_Pos) & (uint32_t)CAN_MO_MOFGPR_CUR_Msk) | + (((uint32_t)can_fifo.fifo_top << CAN_MO_MOFGPR_TOP_Pos) & (uint32_t)CAN_MO_MOFGPR_TOP_Msk); +} + +/* Function to Initialize the FIFO MO slave object */ +void XMC_CAN_TXFIFO_ConfigMOSlaveObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_FIFO_CONFIG_t can_fifo) +{ + can_mo->can_mo_ptr->MOFCR = ((can_mo->can_mo_ptr->MOFCR ) & ~(uint32_t)(CAN_MO_MOFCR_MMC_Msk)) | + (((uint32_t)0x3U << CAN_MO_MOFCR_MMC_Pos) & (uint32_t)CAN_MO_MOFCR_MMC_Msk); + can_mo->can_mo_ptr->MOFGPR = ((can_mo->can_mo_ptr->MOFGPR ) & ~(uint32_t)(CAN_MO_MOFGPR_CUR_Msk)) | + (((uint32_t)can_fifo.fifo_base << CAN_MO_MOFGPR_CUR_Pos) & (uint32_t)CAN_MO_MOFGPR_CUR_Msk); + + can_mo->can_mo_ptr->MOCTR = CAN_MO_MOCTR_SETTXEN0_Msk| + CAN_MO_MOCTR_RESTXEN1_Msk; +} + +/* Function to Initialize the Gateway Source Object */ +void XMC_CAN_GATEWAY_InitSourceObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_GATEWAY_CONFIG_t can_gateway) +{ + can_mo->can_mo_ptr->MOFCR = (((uint32_t)0x4U << CAN_MO_MOFCR_MMC_Pos) & (uint32_t)CAN_MO_MOFCR_MMC_Msk) | + ((((uint32_t)can_gateway.gateway_data_frame_send) << CAN_MO_MOFCR_GDFS_Pos) & (uint32_t)CAN_MO_MOFCR_GDFS_Msk) | + ((((uint32_t)can_gateway.gateway_data_length_code_copy) << CAN_MO_MOFCR_DLCC_Pos) & (uint32_t)CAN_MO_MOFCR_DLCC_Msk) | + ((((uint32_t)can_gateway.gateway_identifier_copy) << CAN_MO_MOFCR_IDC_Pos) & (uint32_t)CAN_MO_MOFCR_IDC_Msk) | + ((((uint32_t)can_gateway.gateway_data_copy) << CAN_MO_MOFCR_DATC_Pos) & (uint32_t)CAN_MO_MOFCR_DATC_Msk) ; + can_mo->can_mo_ptr->MOFGPR = (uint32_t)((((uint32_t)can_gateway.gateway_bottom << CAN_MO_MOFGPR_BOT_Pos) & (uint32_t)CAN_MO_MOFGPR_BOT_Msk) | + (((uint32_t)can_gateway.gateway_base << CAN_MO_MOFGPR_CUR_Pos) & (uint32_t)CAN_MO_MOFGPR_CUR_Msk) | + (((uint32_t)can_gateway.gateway_top << CAN_MO_MOFGPR_TOP_Pos) & (uint32_t)CAN_MO_MOFGPR_TOP_Msk)); +} + +#endif /* XMC_CAN_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_ccu4.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_ccu4.c new file mode 100644 index 00000000..c0f3868c --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_ccu4.c @@ -0,0 +1,1136 @@ +/** + * @file xmc_ccu4.c + * @date 2017-02-25 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-06-20: + * - Removed definition of GetDriverVersion API
+ * + * 2015-07-01: + * - In XMC_CCU4_SLICE_StartConfig(), Options in XMC_ASSERT check for start mode is corrected.
+ * + * 2015-07-24: + * - XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent() is updated to support XMC14 device.
+ * + * 2015-08-17: + * - Start of prescaler XMC_CCU4_StartPrescaler() is invoked in XMC_CCU4_Init() API.
+ * - Bug fix XMC_CCU4_SLICE_ConfigureEvent() during the level setting for XMC14 devices.
+ * - XMC_CCU4_EnableShadowTransfer() definition is removed, since the API is made as inline.
+ * + * 2015-10-07: + * - XMC_CCU4_SLICE_GetEvent() is made as inline. + * - DOC updates for the newly added APIs. + * + * 2017-02-25: + * - XMC_CCU4_lAssertReset(), XMC_CCU4_lDeassertReset(), XMC_CCU4_lGateClock() and XMC_CCU4_lUngateClock() fix compilation warnings. + * + * @endcond + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include "xmc_ccu4.h" + +#if defined(CCU40) +#include "xmc_scu.h" +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_CCU4_NUM_SLICES_PER_MODULE (4U) +#define XMC_CCU4_SLICE_DITHER_PERIOD_MASK (1U) +#define XMC_CCU4_SLICE_DITHER_DUTYCYCLE_MASK (2U) +#define XMC_CCU4_SLICE_EVENT_EDGE_CONFIG_MASK (3U) +#define XMC_CCU4_SLICE_EVENT_LEVEL_CONFIG_MASK (1U) +#define XMC_CCU4_SLICE_EVENT_FILTER_CONFIG_MASK (3U) +#if defined(CCU4V3) /* Defined for XMC1400 devices only */ +#define XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK CCU4_CC4_INS1_EV0IS_Msk +#else +#define XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK CCU4_CC4_INS_EV0IS_Msk +#endif +#define XMC_CCU4_GIDLC_CLOCK_MASK (15U) +#define XMC_CCU4_GCSS_SLICE0_MASK (1U) +#define XMC_CCU4_GCSS_SLICE1_MASK (16U) +#define XMC_CCU4_GCSS_SLICE2_MASK (256U) +#define XMC_CCU4_GCSS_SLICE3_MASK (4096U) + +/** Macro to check if the clock selected enum passed is valid */ +#define XMC_CCU4_SLICE_CHECK_CLOCK(clock) \ + ((clock == XMC_CCU4_CLOCK_SCU) || \ + (clock == XMC_CCU4_CLOCK_EXTERNAL_A) || \ + (clock == XMC_CCU4_CLOCK_EXTERNAL_B) || \ + (clock == XMC_CCU4_CLOCK_EXTERNAL_C)) + +/** Macro used to check if the event ID is valid*/ +#define XMC_CCU4_SLICE_CHECK_EVENT_ID(event_id) \ + ((event_id == XMC_CCU4_SLICE_EVENT_NONE)|| \ + (event_id == XMC_CCU4_SLICE_EVENT_0) || \ + (event_id == XMC_CCU4_SLICE_EVENT_1) || \ + (event_id == XMC_CCU4_SLICE_EVENT_2)) + +/** Macro used to check if the edge sensitivity is valid*/ +#define XMC_CCU4_SLICE_CHECK_EDGE_SENSITIVITY(edge) \ + ((edge == XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_NONE) || \ + (edge == XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_RISING_EDGE) || \ + (edge == XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_FALLING_EDGE)|| \ + (edge == XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_DUAL_EDGE)) + +/** Macro used to check if the filter clock cycles are valid */ +#define XMC_CCU4_SLICE_CHECK_EVENT_FILTER(cycles) \ + ((cycles == XMC_CCU4_SLICE_EVENT_FILTER_DISABLED) || \ + (cycles == XMC_CCU4_SLICE_EVENT_FILTER_3_CYCLES) || \ + (cycles == XMC_CCU4_SLICE_EVENT_FILTER_5_CYCLES) || \ + (cycles == XMC_CCU4_SLICE_EVENT_FILTER_7_CYCLES)) + +/** Macro used to check if the Multi-channel input related action is valid*/ +#define XMC_CCU4_SLICE_CHECK_MCS_ACTION(mcs_action) \ + ((mcs_action == XMC_CCU4_SLICE_MCMS_ACTION_TRANSFER_PR_CR) || \ + (mcs_action == XMC_CCU4_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP) || \ + (mcs_action == XMC_CCU4_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP_DIT)) + +/** Macro used to check if the SR line is valid*/ +#define XMC_CCU4_SLICE_CHECK_SR_ID(id) \ + ((id == XMC_CCU4_SLICE_SR_ID_0) || \ + (id == XMC_CCU4_SLICE_SR_ID_1) || \ + (id == XMC_CCU4_SLICE_SR_ID_2) || \ + (id == XMC_CCU4_SLICE_SR_ID_3)) + +/** Macro to check if the end mode enum passed is valid */ +#define XMC_CCU4_CHECK_END_MODE(end_mode) \ + ((end_mode == XMC_CCU4_SLICE_END_MODE_TIMER_STOP) || \ + (end_mode == XMC_CCU4_SLICE_END_MODE_TIMER_CLEAR) || \ + (end_mode == XMC_CCU4_SLICE_END_MODE_TIMER_STOP_CLEAR)) + +/********************************************************************************************************************* + * LOCAL ROUTINES + ********************************************************************************************************************/ +#if defined(PERIPHERAL_RESET_SUPPORTED) +__STATIC_INLINE void XMC_CCU4_lAssertReset(const XMC_CCU4_MODULE_t *const module) +{ + if (module == CCU40) + { + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU40); + } +#if defined(CCU41) + else if (module == CCU41) + { + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU41); + } +#endif +#if defined(CCU42) + else if (module == CCU42) + { + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU42); + } +#endif +#if defined(CCU43) + else if (module == CCU43) + { + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU43); + } +#endif + else + { + XMC_ASSERT("XMC_CCU4_lAssertReset:Invalid Module Pointer", 0); + } +} + +__STATIC_INLINE void XMC_CCU4_lDeassertReset(const XMC_CCU4_MODULE_t *const module) +{ + if (module == CCU40) + { + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU40); + } +#if defined(CCU41) + else if (module == CCU41) + { + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU41); + } +#endif +#if defined(CCU42) + else if (module == CCU42) + { + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU42); + } +#endif +#if defined(CCU43) + else if (module == CCU43) + { + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU43); + } +#endif + else + { + XMC_ASSERT("XMC_CCU4_lDeassertReset:Invalid Module Pointer", 0); + } +} +#endif + +#if defined(CLOCK_GATING_SUPPORTED) +__STATIC_INLINE void XMC_CCU4_lGateClock(const XMC_CCU4_MODULE_t *const module) +{ + + if (module == CCU40) + { + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU40); + } +#if defined(CCU41) + else if (module == CCU41) + { + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU41); + } +#endif +#if defined(CCU42) + else if (module == CCU42) + { + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU42); + } +#endif +#if defined(CCU43) + else if (module == CCU43) + { + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU43); + } +#endif + else + { + XMC_ASSERT("XMC_CCU4_lGateClock:Invalid Module Pointer", 0); + } +} + +__STATIC_INLINE void XMC_CCU4_lUngateClock(const XMC_CCU4_MODULE_t *const module) +{ + if (module == CCU40) + { + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU40); + } +#if defined(CCU41) + else if (module == CCU41) + { + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU41); + } +#endif +#if defined(CCU42) + else if (module == CCU42) + { + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU42); + } +#endif +#if defined(CCU43) + else if (module == CCU43) + { + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU43); + } +#endif + else + { + XMC_ASSERT("XMC_CCU4_lUngateClock:Invalid Module Pointer", 0); + } +} +#endif + +#if defined (XMC_ASSERT_ENABLE) +__STATIC_INLINE bool XMC_CCU4_SLICE_IsInputvalid(XMC_CCU4_SLICE_INPUT_t input) +{ +#if (UC_SERIES == XMC14) + return (input < 48U); +#else + return (input < 16U); +#endif +} +#endif +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +void XMC_CCU4_EnableModule(XMC_CCU4_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU4_EnableModule:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + +#if UC_FAMILY == XMC4 + /* Enable CCU4 module clock */ + XMC_SCU_CLOCK_EnableClock(XMC_SCU_CLOCK_CCU); +#endif + +#if defined(CLOCK_GATING_SUPPORTED) + XMC_CCU4_lUngateClock(module); +#endif + +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_CCU4_lDeassertReset(module); +#endif +} + +void XMC_CCU4_DisableModule(XMC_CCU4_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU4_DisableModule:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_CCU4_lAssertReset(module); +#endif + +#if defined(CLOCK_GATING_SUPPORTED) + XMC_CCU4_lGateClock(module); +#endif +} + +/* API to initialize CCU4 global resources */ +void XMC_CCU4_Init(XMC_CCU4_MODULE_t *const module, const XMC_CCU4_SLICE_MCMS_ACTION_t mcs_action) +{ + uint32_t gctrl; + + XMC_ASSERT("XMC_CCU4_Init:Invalid module pointer", XMC_CCU4_IsValidModule(module)); + XMC_ASSERT("XMC_CCU4_Init:Invalid mcs action", XMC_CCU4_SLICE_CHECK_MCS_ACTION(mcs_action)); + + /* Enable CCU4 module */ + XMC_CCU4_EnableModule(module); + /* Start the prescaler */ + XMC_CCU4_StartPrescaler(module); + + gctrl = module->GCTRL; + gctrl &= ~((uint32_t) CCU4_GCTRL_MSDE_Msk); + gctrl |= ((uint32_t) mcs_action) << CCU4_GCTRL_MSDE_Pos; + + module->GCTRL = gctrl; +} + +/* API to select CCU4 module clock */ +void XMC_CCU4_SetModuleClock(XMC_CCU4_MODULE_t *const module, const XMC_CCU4_CLOCK_t clock) +{ + uint32_t gctrl; + + XMC_ASSERT("XMC_CCU4_SetModuleClock:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + XMC_ASSERT("XMC_CCU4_SetModuleClock:Invalid Module Clock", XMC_CCU4_SLICE_CHECK_CLOCK(clock)); + + gctrl = module->GCTRL; + gctrl &= ~((uint32_t) CCU4_GCTRL_PCIS_Msk); + gctrl |= ((uint32_t) clock) << CCU4_GCTRL_PCIS_Pos; + + module->GCTRL = gctrl; +} + +/* API to configure the multichannel shadow transfer request via SW and via the CCU4x.MCSS input. */ +void XMC_CCU4_SetMultiChannelShadowTransferMode(XMC_CCU4_MODULE_t *const module, const uint32_t slice_mode_msk) +{ + uint32_t gctrl; + + XMC_ASSERT("XMC_CCU4_SetMultiChannelShadowTransferMode:Invalid module Pointer", XMC_CCU4_IsValidModule(module)); + + gctrl = module->GCTRL; + gctrl &= ~((uint32_t)slice_mode_msk >> 16U); + gctrl |= ((uint32_t)slice_mode_msk & 0xFFFFU); + module->GCTRL = gctrl; +} + +/* API to configure CC4 Slice as Timer */ +void XMC_CCU4_SLICE_CompareInit(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_COMPARE_CONFIG_t *const compare_init) +{ + XMC_ASSERT("XMC_CCU4_SLICE_CompareInit:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_CompareInit:Compare Init Pointer is NULL", + (XMC_CCU4_SLICE_COMPARE_CONFIG_t *) NULL != compare_init); + + /* Program the timer mode */ + slice->TC = compare_init->tc; + /* Enable the timer concatenation */ + slice->CMC = ((uint32_t) compare_init->timer_concatenation << CCU4_CC4_CMC_TCE_Pos); + /* Program initial prescaler divider value */ + slice->PSC = (uint32_t) compare_init->prescaler_initval; + /* Program the dither compare value */ + slice->DITS = (uint32_t) compare_init->dither_limit; + /* Program timer output passive level */ + slice->PSL = (uint32_t) compare_init->passive_level; + /* Program floating prescaler compare value */ + slice->FPCS = (uint32_t) compare_init->float_limit; +} + +/* API to configure CC4 Slice for Capture */ +void XMC_CCU4_SLICE_CaptureInit(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_CAPTURE_CONFIG_t *const capture_init) +{ + XMC_ASSERT("XMC_CCU4_SLICE_CaptureInit:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_CaptureInit:Capture Init Pointer is NULL", + (XMC_CCU4_SLICE_CAPTURE_CONFIG_t *) NULL != capture_init); + + /* Program the capture mode */ + slice->TC = capture_init->tc; + /* Enable the timer concatenation */ + slice->CMC = ((uint32_t)capture_init->timer_concatenation << CCU4_CC4_CMC_TCE_Pos); + /* Program initial prescaler divider value */ + slice->PSC = (uint32_t) capture_init->prescaler_initval; + /* Program initial floating prescaler compare value */ + slice->FPCS = (uint32_t) capture_init->float_limit; +} + + +/* API to configure the Start trigger function of a slice */ +void XMC_CCU4_SLICE_StartConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_START_MODE_t start_mode) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU4_SLICE_StartConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_StartConfig:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU4_SLICE_StartConfig:Invalid Start Mode", + ((start_mode == XMC_CCU4_SLICE_START_MODE_TIMER_START_CLEAR) ||\ + (start_mode == XMC_CCU4_SLICE_START_MODE_TIMER_START))); + /* First, Bind the event with the stop function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_STRTS_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_STRTS_Pos; + + slice->CMC = cmc; + + tc = slice->TC; + /* Next, Configure the start mode */ + if (start_mode == XMC_CCU4_SLICE_START_MODE_TIMER_START_CLEAR) + { + tc |= (uint32_t)CCU4_CC4_TC_STRM_Msk; + } + else + { + tc &= ~((uint32_t)CCU4_CC4_TC_STRM_Msk); + } + + slice->TC = tc; +} + +/* API to configure the Stop trigger function of a slice */ +void XMC_CCU4_SLICE_StopConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_END_MODE_t end_mode) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU4_SLICE_StopConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_StopConfig:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU4_SLICE_StopConfig:Invalid Start Mode", XMC_CCU4_CHECK_END_MODE(end_mode)); + + /* First, Bind the event with the stop function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_ENDS_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_ENDS_Pos; + + slice->CMC = cmc; + + /* Next, Configure the stop mode */ + tc = slice->TC; + tc &= ~((uint32_t) CCU4_CC4_TC_ENDM_Msk); + tc |= ((uint32_t) end_mode) << CCU4_CC4_TC_ENDM_Pos; + + slice->TC = tc; +} + +/* API to configure the Load trigger function of a slice */ +void XMC_CCU4_SLICE_LoadConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU4_SLICE_LoadConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_LoadConfig:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + + /* Bind the event with the load function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_LDS_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_LDS_Pos; + + slice->CMC = cmc; +} + +/* API to configure the slice modulation function */ +void XMC_CCU4_SLICE_ModulationConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_MODULATION_MODE_t mod_mode, + const bool synch_with_pwm) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU4_SLICE_ModulationConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_ModulationConfig:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU4_SLICE_ModulationConfig:Invalid Modulation Mode", + ((mod_mode == XMC_CCU4_SLICE_MODULATION_MODE_CLEAR_OUT) ||\ + (mod_mode == XMC_CCU4_SLICE_MODULATION_MODE_CLEAR_ST_OUT))); + + tc = slice->TC; + cmc = slice->CMC; + + /* First, Bind the event with the modulation function */ + cmc &= ~((uint32_t) CCU4_CC4_CMC_MOS_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_MOS_Pos; + slice->CMC = cmc; + + /* Next, Modulation mode */ + if (mod_mode == XMC_CCU4_SLICE_MODULATION_MODE_CLEAR_OUT) + { + tc |= (uint32_t) CCU4_CC4_TC_EMT_Msk; + } + else + { + tc &= ~((uint32_t) CCU4_CC4_TC_EMT_Msk); + } + + /* Synchronization of modulation effect with PWM cycle */ + if (synch_with_pwm == (bool) true) + { + tc |= (uint32_t) CCU4_CC4_TC_EMS_Msk; + } + else + { + tc &= ~((uint32_t) CCU4_CC4_TC_EMS_Msk); + } + + slice->TC = tc; +} + +/* API to configure the slice count function */ +void XMC_CCU4_SLICE_CountConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU4_SLICE_CountConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_CountConfig:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + + /* Bind the event with the count function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_CNTS_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_CNTS_Pos; + + slice->CMC = cmc; +} + +/* API to configure slice gate function */ +void XMC_CCU4_SLICE_GateConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU4_SLICE_GateConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_GateConfig:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + + /* Bind the event with the gate function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_GATES_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_GATES_Pos; + + slice->CMC = cmc; +} + +/* API to configure Capture-0 function */ +void XMC_CCU4_SLICE_Capture0Config(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU4_SLICE_Capture0Config:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_Capture0Config:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + + /* Bind the event with the gate function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_CAP0S_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_CAP0S_Pos; + + slice->CMC = cmc; +} + +/* API to configure Capture-1 function */ +void XMC_CCU4_SLICE_Capture1Config(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU4_SLICE_Capture1Config:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_Capture1Config:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + + /* Bind the event with the gate function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_CAP1S_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_CAP1S_Pos; + + slice->CMC = cmc; +} + +/* API to configure direction function */ +void XMC_CCU4_SLICE_DirectionConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU4_SLICE_DirectionConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_DirectionConfig:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + + /* Bind the event with the direction function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_UDS_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_UDS_Pos; + + slice->CMC = cmc; +} + +/* API to configure slice status bit override function */ +void XMC_CCU4_SLICE_StatusBitOverrideConfig(XMC_CCU4_SLICE_t *const slice) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU4_SLICE_StatusBitOverrideConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + + /* Bind the event with the override function */ + cmc = slice->CMC; + /* Map status bit trigger override to Event 1 & + status bit value override to Event 2 */ + cmc &= ~((uint32_t) CCU4_CC4_CMC_OFS_Msk); + cmc |= ((uint32_t) 1) << CCU4_CC4_CMC_OFS_Pos; + + slice->CMC = cmc; +} + +/* API to configure trap function */ +void XMC_CCU4_SLICE_TrapConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_TRAP_EXIT_MODE_t exit_mode, + const bool synch_with_pwm) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU4_SLICE_TrapConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_TrapConfig:Invalid Exit Mode", ((exit_mode == XMC_CCU4_SLICE_TRAP_EXIT_MODE_AUTOMATIC) ||\ + (exit_mode == XMC_CCU4_SLICE_TRAP_EXIT_MODE_SW))); + + /* First, Map trap function to Event 2 */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_TS_Msk); + cmc |= ((uint32_t) 1) << CCU4_CC4_CMC_TS_Pos; + slice->CMC = cmc; + + /* Next, Configure synchronization option */ + tc = slice->TC; + + if (synch_with_pwm == (bool) true) + { + tc |= (uint32_t) CCU4_CC4_TC_TRPSE_Msk; + } + else + { + tc &= ~((uint32_t) CCU4_CC4_TC_TRPSE_Msk); + } + + /* Configure exit mode */ + if (exit_mode == XMC_CCU4_SLICE_TRAP_EXIT_MODE_SW) + { + tc |= (uint32_t) CCU4_CC4_TC_TRPSW_Msk; + } + else + { + tc &= ~((uint32_t) CCU4_CC4_TC_TRPSW_Msk); + } + + slice->TC = tc; +} + +/* API to configure a slice Status Bit Override event */ +void XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_CONFIG_t *const ev1_config, + const XMC_CCU4_SLICE_EVENT_CONFIG_t *const ev2_config) +{ + uint32_t ins; + + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Input", + XMC_CCU4_SLICE_IsInputvalid(ev1_config->mapped_input)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Edge Sensitivity", + XMC_CCU4_SLICE_CHECK_EDGE_SENSITIVITY(ev1_config->edge)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Level Sensitivity", + ((ev1_config->level == XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH) ||\ + (ev1_config->level == XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW))); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Debounce Period", + XMC_CCU4_SLICE_CHECK_EVENT_FILTER(ev1_config->duration)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Input", + XMC_CCU4_SLICE_IsInputvalid(ev2_config->mapped_input)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Edge Sensitivity", + XMC_CCU4_SLICE_CHECK_EDGE_SENSITIVITY(ev2_config->edge)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Level Sensitivity", + ((ev2_config->level == XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH) ||\ + (ev2_config->level == XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW))); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Debounce Period", + XMC_CCU4_SLICE_CHECK_EVENT_FILTER(ev2_config->duration)); +#if defined(CCU4V3) /* Defined for XMC1400 devices only */ + ins = slice->INS2; + + /* Configure the edge sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU4_CC4_INS2_EV1EM_Pos); + ins |= ((uint32_t) ev1_config->edge) << CCU4_CC4_INS2_EV1EM_Pos; + + /* Configure the edge sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU4_CC4_INS2_EV2EM_Pos); + ins |= ((uint32_t) ev2_config->edge) << CCU4_CC4_INS2_EV2EM_Pos; + + /* Configure the level sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU4_CC4_INS2_EV1LM_Pos); + ins |= ((uint32_t) ev1_config->level) << CCU4_CC4_INS2_EV1LM_Pos; + + /* Configure the level sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU4_CC4_INS2_EV2LM_Pos); + ins |= ((uint32_t) ev2_config->level) << CCU4_CC4_INS2_EV2LM_Pos; + + /* Configure the debounce filter for event 1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU4_CC4_INS2_LPF1M_Pos); + ins |= ((uint32_t) ev1_config->duration) << CCU4_CC4_INS2_LPF1M_Pos; + + /* Configure the debounce filter for event 2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU4_CC4_INS2_LPF2M_Pos); + ins |= ((uint32_t) ev2_config->duration) << CCU4_CC4_INS2_LPF2M_Pos; + + slice->INS2 = ins; + + ins = slice->INS1; + + /* Next, the input for Event1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU4_CC4_INS1_EV1IS_Pos); + ins |= ((uint32_t) ev1_config->mapped_input) << CCU4_CC4_INS1_EV1IS_Pos; + + /* Finally, the input for Event2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU4_CC4_INS1_EV2IS_Pos); + ins |= ((uint32_t) ev2_config->mapped_input) << CCU4_CC4_INS1_EV2IS_Pos; + + slice->INS1 = ins; +#else + ins = slice->INS; + + /* Configure the edge sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU4_CC4_INS_EV1EM_Pos); + ins |= ((uint32_t) ev1_config->edge) << CCU4_CC4_INS_EV1EM_Pos; + + /* Configure the edge sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU4_CC4_INS_EV2EM_Pos); + ins |= ((uint32_t) ev2_config->edge) << CCU4_CC4_INS_EV2EM_Pos; + + /* Configure the level sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU4_CC4_INS_EV1LM_Pos); + ins |= ((uint32_t) ev1_config->level) << CCU4_CC4_INS_EV1LM_Pos; + + /* Configure the level sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU4_CC4_INS_EV2LM_Pos); + ins |= ((uint32_t) ev2_config->level) << CCU4_CC4_INS_EV2LM_Pos; + + /* Configure the debounce filter for event 1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU4_CC4_INS_LPF1M_Pos); + ins |= ((uint32_t) ev1_config->duration) << CCU4_CC4_INS_LPF1M_Pos; + + /* Configure the debounce filter for event 2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU4_CC4_INS_LPF2M_Pos); + ins |= ((uint32_t) ev2_config->duration) << CCU4_CC4_INS_LPF2M_Pos; + + /* Next, the input for Event1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU4_CC4_INS_EV1IS_Pos); + ins |= ((uint32_t) ev1_config->mapped_input) << CCU4_CC4_INS_EV1IS_Pos; + + /* Finally, the input for Event2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU4_CC4_INS_EV2IS_Pos); + ins |= ((uint32_t) ev2_config->mapped_input) << CCU4_CC4_INS_EV2IS_Pos; + + slice->INS = ins; +#endif +} + +/* API to configure a slice trigger event */ +void XMC_CCU4_SLICE_ConfigureEvent(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_EVENT_CONFIG_t *const config) +{ + uint32_t ins; + uint8_t pos; + uint8_t offset; + + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureEvent:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureEvent:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureEvent:Invalid Input", XMC_CCU4_SLICE_IsInputvalid(config->mapped_input)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureEvent:Invalid Edge Sensitivity", + XMC_CCU4_SLICE_CHECK_EDGE_SENSITIVITY(config->edge)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureEvent:Invalid Level Sensitivity", + ((config->level == XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH) ||\ + (config->level == XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW))); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureEvent:Invalid Debounce Period", + XMC_CCU4_SLICE_CHECK_EVENT_FILTER(config->duration)); + /* Calculate offset with reference to event */ + offset = ((uint8_t) event) - 1U; + +#if defined(CCU4V3) /* Defined for XMC1400 devices only */ + ins = slice->INS2; + + /* First, configure the edge sensitivity */ + pos = ((uint8_t) CCU4_CC4_INS2_EV0EM_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_EDGE_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->edge) << pos; + + /* Next, the level */ + pos = ((uint8_t) CCU4_CC4_INS2_EV0LM_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_LEVEL_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->level) << pos; + + /* Next, the debounce filter */ + pos = ((uint8_t) CCU4_CC4_INS2_LPF0M_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_FILTER_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->duration) << pos; + + slice->INS2 = ins; + + ins = slice->INS1; + + /* Finally the input */ + pos = ((uint8_t) CCU4_CC4_INS1_EV0IS_Pos) + (uint8_t)(offset << 3U); + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->mapped_input) << pos; + + slice->INS1 = ins; + +#else + ins = slice->INS; + + /* First, configure the edge sensitivity */ + pos = ((uint8_t) CCU4_CC4_INS_EV0EM_Pos) + (uint8_t)(offset << 1U); + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_EDGE_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->edge) << pos; + + /* Next, the level */ + pos = ((uint8_t) CCU4_CC4_INS_EV0LM_Pos) + offset; + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_LEVEL_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->level) << pos; + + /* Next, the debounce filter */ + pos = ((uint8_t) CCU4_CC4_INS_LPF0M_Pos) + (uint8_t)(offset << 1U); + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_FILTER_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->duration) << pos; + + /* Finally the input */ + pos = ((uint8_t) CCU4_CC4_INS_EV0IS_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->mapped_input) << pos; + + slice->INS = ins; +#endif +} + +/* API to bind an input to a slice trigger event */ +void XMC_CCU4_SLICE_SetInput(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_INPUT_t input) +{ + uint32_t ins; + uint8_t pos; + uint8_t offset; + + XMC_ASSERT("XMC_CCU4_SLICE_SetInput:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_SetInput:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU4_SLICE_SetInput:Invalid Input", XMC_CCU4_SLICE_IsInputvalid(input)); + + /* Calculate offset with reference to event */ + offset = ((uint8_t) event) - 1U; + +#if defined(CCU4V3) /* Defined for XMC1400 devices only */ + pos = ((uint8_t) CCU4_CC4_INS1_EV0IS_Pos) + (uint8_t) (offset << 3U); + + ins = slice->INS1; + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) input) << pos; + + slice->INS1 = ins; +#else + pos = ((uint8_t) CCU4_CC4_INS_EV0IS_Pos) + (uint8_t) (offset << 2U); + + ins = slice->INS; + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) input) << pos; + + slice->INS = ins; +#endif +} + +/* API to program timer repeat mode - Single shot vs repeat */ +void XMC_CCU4_SLICE_SetTimerRepeatMode(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t mode) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerRepeatMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerRepeatMode:Invalid Timer Repeat Mode", + ((mode == XMC_CCU4_SLICE_TIMER_REPEAT_MODE_REPEAT) ||\ + (mode == XMC_CCU4_SLICE_TIMER_REPEAT_MODE_SINGLE))); + + if (XMC_CCU4_SLICE_TIMER_REPEAT_MODE_REPEAT == mode) + { + slice->TC &= ~((uint32_t) CCU4_CC4_TC_TSSM_Msk); + } + else + { + slice->TC |= (uint32_t) CCU4_CC4_TC_TSSM_Msk; + } +} + +/* Programs timer counting mode */ +void XMC_CCU4_SLICE_SetTimerCountingMode(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_TIMER_COUNT_MODE_t mode) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerCountingMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerCountingMode:Invalid Timer Count Mode", ((mode == XMC_CCU4_SLICE_TIMER_COUNT_MODE_EA) ||\ + (mode == XMC_CCU4_SLICE_TIMER_COUNT_MODE_CA))); + + if (XMC_CCU4_SLICE_TIMER_COUNT_MODE_EA == mode) + { + slice->TC &= ~((uint32_t) CCU4_CC4_TC_TCM_Msk); + } + else + { + slice->TC |= (uint32_t) CCU4_CC4_TC_TCM_Msk; + } +} + +/* Retrieves desired capture register value */ +uint32_t XMC_CCU4_SLICE_GetCaptureRegisterValue(const XMC_CCU4_SLICE_t *const slice, const uint8_t reg_num) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetCaptureRegisterValue:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_GetCaptureRegisterValue:Invalid register number", (reg_num < 4U)); + return(slice->CV[reg_num]); +} + +/* @brief Retrieves the latest captured timer value */ +XMC_CCU4_STATUS_t XMC_CCU4_SLICE_GetLastCapturedTimerValue(const XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_CAP_REG_SET_t set, + uint32_t *val_ptr) +{ + XMC_CCU4_STATUS_t retval; + uint8_t i; + uint8_t start; + uint8_t end; + + XMC_ASSERT("XMC_CCU4_SLICE_GetLastCapturedTimerValue:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_GetLastCapturedTimerValue:Invalid Register Set", ((set == XMC_CCU4_SLICE_CAP_REG_SET_LOW) ||\ + (set == XMC_CCU4_SLICE_CAP_REG_SET_HIGH))); + + retval = XMC_CCU4_STATUS_ERROR; + + /* First check if extended capture mode is enabled */ + if ((slice->TC) & CCU4_CC4_TC_ECM_Msk) + { + /* Extended capture mode has been enabled. So start with the lowest capture register and work your way up */ + start = 0U; + end = XMC_CCU4_NUM_SLICES_PER_MODULE; + } + else + { + /* Extended capture mode is not enabled */ + if (set == XMC_CCU4_SLICE_CAP_REG_SET_HIGH) + { + start = ((uint8_t) XMC_CCU4_NUM_SLICES_PER_MODULE) >> 1U; + end = (uint8_t) XMC_CCU4_NUM_SLICES_PER_MODULE; + } + else + { + start = 0U; + end = ((uint8_t) XMC_CCU4_NUM_SLICES_PER_MODULE) >> 1U; + } + } + + for(i=start; i < end; i++) + { + if ( (slice->CV[i]) & CCU4_CC4_CV_FFL_Msk ) + { + *val_ptr = slice->CV[i]; + retval = XMC_CCU4_STATUS_OK; + break; + } + } + + return retval; +} + +/* Retrieves timer capture value from a FIFO made of capture registers */ +#if defined(CCU4V1) /* Defined for XMC4500, XMC400, XMC4200, XMC4100 devices only */ +int32_t XMC_CCU4_GetCapturedValueFromFifo(const XMC_CCU4_MODULE_t *const module, const uint8_t slice_number) +{ + int32_t cap; + uint32_t extracted_slice; + + XMC_ASSERT("XMC_CCU4_GetCapturedValueFromFifo:Invalid Slice Pointer", XMC_CCU4_IsValidModule(module)); + + /* First read the global fifo register */ + cap = (int32_t) module->ECRD; + + extracted_slice = (((uint32_t) cap) & ((uint32_t) CCU4_ECRD_SPTR_Msk)) >> CCU4_ECRD_SPTR_Pos; + + /* Return captured result only if it were applicable to this slice */ + if(extracted_slice != ((uint32_t)slice_number)) + { + cap = -1; + } + + return (cap); +} +#else +uint32_t XMC_CCU4_SLICE_GetCapturedValueFromFifo(const XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_CAP_REG_SET_t set) +{ + uint32_t cap; + + XMC_ASSERT("XMC_CCU4_SLICE_GetCapturedValueFromFifo:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_GetCapturedValueFromFifo:Invalid Register Set", + ((set == XMC_CCU4_SLICE_CAP_REG_SET_LOW) ||\ + (set == XMC_CCU4_SLICE_CAP_REG_SET_HIGH))); + + if(XMC_CCU4_SLICE_CAP_REG_SET_LOW == set) + { + cap = slice->ECRD0; + } + else + { + cap = slice->ECRD1; + } + + return cap; +} +#endif + +/* Enables PWM dithering feature */ +void XMC_CCU4_SLICE_EnableDithering(XMC_CCU4_SLICE_t *const slice, + const bool period_dither, + const bool duty_dither, + const uint8_t spread) +{ + uint32_t tc; + + XMC_ASSERT("XMC_CCU4_SLICE_EnableDithering:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + + tc = slice->TC; + tc &= ~((uint32_t) CCU4_CC4_TC_DITHE_Msk); + + if ((bool) true == period_dither) + { + tc |= (((uint32_t) XMC_CCU4_SLICE_DITHER_PERIOD_MASK) << CCU4_CC4_TC_DITHE_Pos); + } + if ((bool) true == duty_dither) + { + tc |= (((uint32_t) XMC_CCU4_SLICE_DITHER_DUTYCYCLE_MASK) << CCU4_CC4_TC_DITHE_Pos); + } + + slice->TC = tc; + + XMC_CCU4_SLICE_SetDitherCompareValue((XMC_CCU4_SLICE_t *)slice, (uint8_t)spread); +} + +/* Programs Pre-scalar divider */ +void XMC_CCU4_SLICE_SetPrescaler(XMC_CCU4_SLICE_t *const slice, const uint8_t div_val) +{ + uint32_t fpc; + + XMC_ASSERT("XMC_CCU4_SLICE_SetPrescaler:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + + fpc = slice->FPC; + fpc &= ~((uint32_t) CCU4_CC4_FPC_PVAL_Msk); + fpc |= ((uint32_t) div_val) << CCU4_CC4_FPC_PVAL_Pos; + slice->FPC = fpc; + /* + * In any case, update the initial value of the divider which is to be loaded once the prescaler increments to the + * compare value. + */ + slice->PSC = (uint32_t) div_val; +} + +/* Binds a capcom event to an NVIC node */ +void XMC_CCU4_SLICE_SetInterruptNode(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_IRQ_ID_t event, + const XMC_CCU4_SLICE_SR_ID_t sr) +{ + uint32_t srs; + uint32_t pos; + uint32_t mask; + + XMC_ASSERT("XMC_CCU4_SLICE_SetInterruptNode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_SetInterruptNode:Invalid SR ID ", XMC_CCU4_SLICE_CHECK_SR_ID(sr)); + XMC_ASSERT("XMC_CCU4_SLICE_SetInterruptNode:Invalid event", XMC_CCU4_SLICE_CHECK_INTERRUPT(event)); + + srs = slice->SRS; + + switch(event) + { + case XMC_CCU4_SLICE_IRQ_ID_PERIOD_MATCH: + case XMC_CCU4_SLICE_IRQ_ID_ONE_MATCH: + mask = ((uint32_t) CCU4_CC4_SRS_POSR_Msk); + pos = CCU4_CC4_SRS_POSR_Pos; + break; + + case XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_UP: + case XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_DOWN: + mask = ((uint32_t) CCU4_CC4_SRS_CMSR_Msk); + pos = CCU4_CC4_SRS_CMSR_Pos; + break; + + case XMC_CCU4_SLICE_IRQ_ID_EVENT0: + mask = ((uint32_t) CCU4_CC4_SRS_E0SR_Msk); + pos = CCU4_CC4_SRS_E0SR_Pos; + break; + + case XMC_CCU4_SLICE_IRQ_ID_EVENT1: + mask = ((uint32_t) CCU4_CC4_SRS_E1SR_Msk); + pos = CCU4_CC4_SRS_E1SR_Pos; + break; + + default: + mask = ((uint32_t) CCU4_CC4_SRS_E2SR_Msk); + pos = CCU4_CC4_SRS_E2SR_Pos; + break; + } + + srs &= ~mask; + srs |= (uint32_t)sr << pos; + slice->SRS = srs; +} + +/* Asserts passive level for the slice output */ +void XMC_CCU4_SLICE_SetPassiveLevel(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_t level) +{ + uint32_t psl; + + XMC_ASSERT("XMC_CCU4_SLICE_SetPassiveLevel:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_SetPassiveLevel:Invalid Passive level", ((level == XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_LOW) ||\ + (level == XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_HIGH))); + + psl = slice->PSL; + psl &= ~((uint32_t) CCU4_CC4_PSL_PSL_Msk); + psl |= (uint32_t) level; + + /* Program CC4 slice output passive level */ + slice->PSL = psl; +} + +#endif /* CCU40 */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_ccu8.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_ccu8.c new file mode 100644 index 00000000..e5ece680 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_ccu8.c @@ -0,0 +1,1320 @@ +/** + * @file xmc_ccu8.c + * @date 2017-02-25 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-06-20: + * - Removed definition of GetDriverVersion API
+ * - Added XMC_CCU8_SLICE_LoadSelector() API, to select which compare register value has to be loaded + * during external load event. + * + * 2015-07-24: + * - XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent() is updated to support XMC14 device.
+ * + * 2015-08-17: + * - XMC_CCU8_SLICE_CHC_CONFIG_MASK is not applicable to XMC14 devices.
+ * - Start of prescaler XMC_CCU8_StartPrescaler() is invoked in XMC_CCU8_Init() API.
+ * - In XMC_CCU8_SLICE_CompareInit(), CHC register is updated according to the device.
+ * - Bug fix XMC_CCU8_SLICE_ConfigureEvent() during the level setting for XMC14 devices.
+ * - XMC_CCU8_EnableShadowTransfer() definition is removed, since the API is made as inline.
+ * + * 2015-10-07: + * - XMC_CCU8_SLICE_GetEvent() is made as inline. + * - DOC updates for the newly added APIs. + * + * 2017-02-25: + * - XMC_CCU8_lAssertReset(), XMC_CCU8_lDeassertReset(), XMC_CCU8_lGateClock() and XMC_CCU8_lUngateClock() fix compilation warnings. + * + * @endcond + */ +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include "xmc_ccu8.h" + +#if defined(CCU80) +#include "xmc_scu.h" + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_CCU8_NUM_SLICES_PER_MODULE (4U) +#define XMC_CCU8_SLICE_DITHER_PERIOD_MASK (1U) +#define XMC_CCU8_SLICE_DITHER_DUTYCYCLE_MASK (2U) +#define XMC_CCU8_SLICE_EVENT_EDGE_CONFIG_MASK (3U) +#define XMC_CCU8_SLICE_EVENT_LEVEL_CONFIG_MASK (1U) +#define XMC_CCU8_SLICE_EVENT_FILTER_CONFIG_MASK (3U) +#if defined(CCU8V3) /* Defined for XMC1400 devices */ +#define XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK CCU8_CC8_INS1_EV0IS_Msk +#else +#define XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK CCU8_CC8_INS_EV0IS_Msk +#endif +#define XMC_CCU8_GIDLC_CLOCK_MASK (15U) +#define XMC_CCU8_GCSS_SLICE0_MASK (1U) +#define XMC_CCU8_GCSS_SLICE1_MASK (16U) +#define XMC_CCU8_GCSS_SLICE2_MASK (256U) +#define XMC_CCU8_GCSS_SLICE3_MASK (4096U) +#define XMC_CCU8_SLICE_DEAD_TIME_CONFIG_MASK (63U) +#if !defined(CCU8V3) /* Defined for all devices except XMC1400 */ +#define XMC_CCU8_SLICE_CHC_CONFIG_MASK (20U) +#endif + +#define XMC_CCU8_SLICE_CHECK_DTC_DIV(div) \ + ((div == XMC_CCU8_SLICE_DTC_DIV_1) || \ + (div == XMC_CCU8_SLICE_DTC_DIV_2) || \ + (div == XMC_CCU8_SLICE_DTC_DIV_4) || \ + (div == XMC_CCU8_SLICE_DTC_DIV_8)) + +#define XMC_CCU8_SLICE_CHECK_CLOCK(clock) \ + ((clock == XMC_CCU8_CLOCK_SCU) || \ + (clock == XMC_CCU8_CLOCK_EXTERNAL_A) || \ + (clock == XMC_CCU8_CLOCK_EXTERNAL_B) || \ + (clock == XMC_CCU8_CLOCK_EXTERNAL_C)) + +#define XMC_CCU8_SLICE_CHECK_OUTPUT(out) \ + ((out == XMC_CCU8_SLICE_OUTPUT_0) || \ + (out == XMC_CCU8_SLICE_OUTPUT_1) || \ + (out == XMC_CCU8_SLICE_OUTPUT_2) || \ + (out == XMC_CCU8_SLICE_OUTPUT_3)) + +#define XMC_CCU8_SLICE_CHECK_END_MODE(end_mode) \ + ((end_mode == XMC_CCU8_SLICE_END_MODE_TIMER_STOP) || \ + (end_mode == XMC_CCU8_SLICE_END_MODE_TIMER_CLEAR) || \ + (end_mode == XMC_CCU8_SLICE_END_MODE_TIMER_STOP_CLEAR)) + +#define XMC_CCU8_SLICE_CHECK_EVENT_ID(event_id) \ + ((event_id == XMC_CCU8_SLICE_EVENT_NONE)|| \ + (event_id == XMC_CCU8_SLICE_EVENT_0) || \ + (event_id == XMC_CCU8_SLICE_EVENT_1) || \ + (event_id == XMC_CCU8_SLICE_EVENT_2)) + +#define XMC_CCU8_SLICE_CHECK_EDGE_SENSITIVITY(edge) \ + ((edge == XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_NONE) || \ + (edge == XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_RISING_EDGE) || \ + (edge == XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_FALLING_EDGE)|| \ + (edge == XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_DUAL_EDGE)) + +#define XMC_CCU8_SLICE_CHECK_EVENT_FILTER(cycles) \ + ((cycles == XMC_CCU8_SLICE_EVENT_FILTER_DISABLED) || \ + (cycles == XMC_CCU8_SLICE_EVENT_FILTER_3_CYCLES) || \ + (cycles == XMC_CCU8_SLICE_EVENT_FILTER_5_CYCLES) || \ + (cycles == XMC_CCU8_SLICE_EVENT_FILTER_7_CYCLES)) + +#define XMC_CCU8_SLICE_CHECK_CAP_TIMER_CLEAR_MODE(mode) \ + ((mode == XMC_CCU8_SLICE_TIMER_CLEAR_MODE_NEVER) || \ + (mode == XMC_CCU8_SLICE_TIMER_CLEAR_MODE_CAP_HIGH)|| \ + (mode == XMC_CCU8_SLICE_TIMER_CLEAR_MODE_CAP_LOW) || \ + (mode == XMC_CCU8_SLICE_TIMER_CLEAR_MODE_ALWAYS)) + +#define XMC_CCU8_SLICE_CHECK_MCS_ACTION(mcs_action) \ + ((mcs_action == XMC_CCU8_SLICE_MCMS_ACTION_TRANSFER_PR_CR) || \ + (mcs_action == XMC_CCU8_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP) || \ + (mcs_action == XMC_CCU8_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP_DIT)) + +#define XMC_CCU8_SLICE_CHECK_SR_ID(id) \ + ((id == XMC_CCU8_SLICE_SR_ID_0) || \ + (id == XMC_CCU8_SLICE_SR_ID_1) || \ + (id == XMC_CCU8_SLICE_SR_ID_2) || \ + (id == XMC_CCU8_SLICE_SR_ID_3)) + +#define XMC_CCU8_SLICE_CHECK_MODULATION_CHANNEL(channel) \ + ((channel == XMC_CCU8_SLICE_MODULATION_CHANNEL_NONE) || \ + (channel == XMC_CCU8_SLICE_MODULATION_CHANNEL_1) || \ + (channel == XMC_CCU8_SLICE_MODULATION_CHANNEL_2) || \ + (channel == XMC_CCU8_SLICE_MODULATION_CHANNEL_1_AND_2)) + +#if((UC_SERIES == XMC13) || (UC_SERIES == XMC14)) +#define XMC_CCU8_SLICE_CHECK_SLICE_STATUS(channel) \ + ((channel == XMC_CCU8_SLICE_STATUS_CHANNEL_1) || \ + (channel == XMC_CCU8_SLICE_STATUS_CHANNEL_2) || \ + (channel == XMC_CCU8_SLICE_STATUS_CHANNEL_1_AND_2) || \ + (channel == XMC_CCU8_SLICE_STATUS_CHANNEL_1_OR_2)) +#else +#define XMC_CCU8_SLICE_CHECK_SLICE_STATUS(channel) \ + ((channel == XMC_CCU8_SLICE_STATUS_CHANNEL_1) || \ + (channel == XMC_CCU8_SLICE_STATUS_CHANNEL_2) || \ + (channel == XMC_CCU8_SLICE_STATUS_CHANNEL_1_AND_2)) +#endif + +/********************************************************************************************************************* + * LOCAL ROUTINES + ********************************************************************************************************************/ +#if defined(PERIPHERAL_RESET_SUPPORTED) +__STATIC_INLINE void XMC_CCU8_lAssertReset(const XMC_CCU8_MODULE_t *const module) +{ + if (module == CCU80) + { + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU80); + } +#if defined(CCU81) + else if (module == CCU81) + { + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU81); + } +#endif + else + { + XMC_ASSERT("XMC_CCU8_lAssertReset:Invalid Module Pointer", 0); + } +} + +__STATIC_INLINE void XMC_CCU8_lDeassertReset(const XMC_CCU8_MODULE_t *const module) +{ + if (module == CCU80) + { + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU80); + } +#if defined(CCU81) + else if (module == CCU81) + { + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU81); + } +#endif + else + { + XMC_ASSERT("XMC_CCU8_lDeassertReset:Invalid Module Pointer", 0); + } +} +#endif + +#if defined(CLOCK_GATING_SUPPORTED) +__STATIC_INLINE void XMC_CCU8_lGateClock(XMC_CCU8_MODULE_t *const module) +{ + if (module == CCU80) + { + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU80); + } +#if defined(CCU81) + else if (module == CCU81) + { + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU81); + } +#endif + else + { + XMC_ASSERT("XMC_CCU8_lGateClock:Invalid Module Pointer", 0); + } +} + +__STATIC_INLINE void XMC_CCU8_lUngateClock(XMC_CCU8_MODULE_t *const module) +{ + if (module == CCU80) + { + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU80); + } +#if defined(CCU81) + else if (module == CCU81) + { + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU81); + } +#endif + else + { + XMC_ASSERT("XMC_CCU8_lUngateClock:Invalid Module Pointer", 0); + } +} +#endif + +#if defined (XMC_ASSERT_ENABLE) +__STATIC_INLINE bool XMC_CCU8_SLICE_IsInputvalid(XMC_CCU8_SLICE_INPUT_t input) +{ +#if (UC_SERIES == XMC14) + return (input < 48U); +#else + return (input < 16U); +#endif +} +#endif +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* API to set the CCU8 module as active and enable the clock */ +void XMC_CCU8_EnableModule(XMC_CCU8_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU8_EnableModule:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + +#if (UC_FAMILY == XMC4) + /* Enable CCU8 module clock */ + XMC_SCU_CLOCK_EnableClock(XMC_SCU_CLOCK_CCU); +#endif + +#if defined(CLOCK_GATING_SUPPORTED) + XMC_CCU8_lUngateClock(module); +#endif + +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_CCU8_lDeassertReset(module); +#endif +} + +/* API to set the CCU8 module as idle and disable the clock */ +void XMC_CCU8_DisableModule(XMC_CCU8_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU8_DisableModule:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_CCU8_lAssertReset(module); +#endif + +#if defined(CLOCK_GATING_SUPPORTED) + XMC_CCU8_lGateClock(module); +#endif +} + +/* API to initialize CCU8 global resources */ +void XMC_CCU8_Init(XMC_CCU8_MODULE_t *const module, const XMC_CCU8_SLICE_MCMS_ACTION_t mcs_action) +{ + uint32_t gctrl; + + XMC_ASSERT("XMC_CCU8_Init:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + XMC_ASSERT("XMC_CCU8_Init:Invalid mcs action", XMC_CCU8_SLICE_CHECK_MCS_ACTION(mcs_action)); + + /* Enable CCU8 module */ + XMC_CCU8_EnableModule(module); + /* Start the prescaler */ + XMC_CCU8_StartPrescaler(module); + + gctrl = module->GCTRL; + gctrl &= ~((uint32_t) CCU8_GCTRL_MSDE_Msk); + gctrl |= (uint32_t)mcs_action << CCU8_GCTRL_MSDE_Pos; + + module->GCTRL = gctrl; +} + +/* API to select CCU8 module clock */ +void XMC_CCU8_SetModuleClock(XMC_CCU8_MODULE_t *const module, const XMC_CCU8_CLOCK_t clock) +{ + uint32_t gctrl; + + XMC_ASSERT("XMC_CCU8_SetModuleClock:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + XMC_ASSERT("XMC_CCU8_SetModuleClock:Invalid Module Clock", XMC_CCU8_SLICE_CHECK_CLOCK(clock)); + + gctrl = module->GCTRL; + gctrl &= ~((uint32_t) CCU8_GCTRL_PCIS_Msk); + gctrl |= ((uint32_t) clock) << CCU8_GCTRL_PCIS_Pos; + + module->GCTRL = gctrl; +} + +/* API to configure CC8 Slice in Compare mode */ +void XMC_CCU8_SLICE_CompareInit(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CONFIG_t *const compare_init) +{ + XMC_ASSERT("XMC_CCU8_SLICE_CompareInit:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_CompareInit:Timer Init Pointer is NULL", + (XMC_CCU8_SLICE_COMPARE_CONFIG_t *) NULL != compare_init); + /* Stops the timer */ + XMC_CCU8_SLICE_StopTimer(slice); + /* Program the timer mode */ + slice->TC = compare_init->tc; + /* Enable the timer concatenation */ + slice->CMC = (uint32_t)compare_init->timer_concatenation << CCU8_CC8_CMC_TCE_Pos; + /* Program initial prescaler divider value */ + slice->PSC = (uint32_t) compare_init->prescaler_initval; + /* Program floating prescaler compare value */ + slice->FPCS = (uint32_t) compare_init->float_limit; + /* Program the dither compare value */ + slice->DITS = (uint32_t) compare_init->dither_limit; + /* Program timer output passive level */ + slice->PSL = (uint32_t) compare_init->psl; + /* Asymmetric PWM and Slice output routing configuration */ +#if defined(CCU8V3) /* Defined for XMC1400 devices only */ + slice->CHC = (uint32_t) compare_init->chc; +#else + slice->CHC = (uint32_t)((uint32_t)compare_init->chc ^ XMC_CCU8_SLICE_CHC_CONFIG_MASK); +#endif +} + +/* API to configure CC8 Slice in Capture mode */ +void XMC_CCU8_SLICE_CaptureInit(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_CAPTURE_CONFIG_t *const capture_init) +{ + XMC_ASSERT("XMC_CCU8_SLICE_CaptureInit:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_CaptureInit:Capture Init Pointer is NULL", + (XMC_CCU8_SLICE_CAPTURE_CONFIG_t *) NULL != capture_init); + /* Stops the timer */ + XMC_CCU8_SLICE_StopTimer(slice); + /* Capture mode configuration */ + slice->TC = capture_init->tc; + /* Enable the timer concatenation */ + slice->CMC = (uint32_t)capture_init->timer_concatenation << CCU8_CC8_CMC_TCE_Pos; + /* Program floating prescaler compare value */ + slice->FPCS = (uint32_t) capture_init->float_limit; + /* Program initial prescaler divider value */ + slice->PSC = (uint32_t) capture_init->prescaler_initval; +} + +/* API to configure the each output of the slice with either STx or inverted STx. */ +void XMC_CCU8_SLICE_SetOutPath(XMC_CCU8_SLICE_t *const slice, const uint32_t out_path_msk) +{ + uint32_t chc; + XMC_ASSERT("XMC_CCU8_SLICE_SetOutPath:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + chc = slice->CHC; +#if !defined(CCU8V3) /* Defined for all devices except XMC1400 */ + chc &= ~((uint32_t)out_path_msk >> 16U); + chc |= ((uint32_t)out_path_msk & 0xFFFFU); +#else + chc &= ~((uint32_t)((uint32_t)(out_path_msk & 0xCCCC0U) >> 2U)); + chc |= ((uint32_t)out_path_msk & 0x33330U); +#endif + slice->CHC = chc; +} + +/* API to configure the multichannel shadow transfer request via SW and via the CCU8x.MCSS input. */ +void XMC_CCU8_SetMultiChannelShadowTransferMode(XMC_CCU8_MODULE_t *const module, const uint32_t slice_mode_msk) +{ + uint32_t gctrl; + + XMC_ASSERT("XMC_CCU8_SetMultiChannelShadowTransferMode:Invalid module Pointer", XMC_CCU8_IsValidModule(module)); + + gctrl = module->GCTRL; + gctrl &= ~((uint32_t)slice_mode_msk >> 16U); + gctrl |= ((uint32_t)slice_mode_msk & 0xFFFFU); + module->GCTRL = gctrl; +} + + +/* API to configure the Start trigger function of a slice*/ +void XMC_CCU8_SLICE_StartConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_START_MODE_t start_mode) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_StartConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_StartConfig:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU8_SLICE_StartConfig:Invalid Start Mode", + ((start_mode == XMC_CCU8_SLICE_START_MODE_TIMER_START) ||\ + (start_mode == XMC_CCU8_SLICE_START_MODE_TIMER_START_CLEAR))); + cmc = slice->CMC; + + cmc &= ~((uint32_t) CCU8_CC8_CMC_STRTS_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_STRTS_Pos; + + slice->CMC = cmc; + + tc = slice->TC; + + if(start_mode == XMC_CCU8_SLICE_START_MODE_TIMER_START_CLEAR) + { + tc |= (uint32_t) CCU8_CC8_TC_STRM_Msk; + } + else + { + tc &= ~((uint32_t) CCU8_CC8_TC_STRM_Msk); + } + + slice->TC = tc; +} + +/* API to configure the Stop trigger function of a slice */ +void XMC_CCU8_SLICE_StopConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_END_MODE_t end_mode) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_StopConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_StopConfig:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU8_SLICE_StopConfig:Invalid End Mode", XMC_CCU8_SLICE_CHECK_END_MODE(end_mode)); + + cmc = slice->CMC; + /* First, Bind the event with the stop function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_ENDS_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_ENDS_Pos; + + slice->CMC = cmc; + + /* Configure the stop mode */ + tc = slice->TC; + tc &= ~((uint32_t) CCU8_CC8_TC_ENDM_Msk); + tc |= ((uint32_t) end_mode) << CCU8_CC8_TC_ENDM_Pos; + + slice->TC = tc; +} + +/* API to configure the Load trigger function of a slice*/ +void XMC_CCU8_SLICE_LoadConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU8_SLICE_LoadConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_LoadConfig:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + + cmc = slice->CMC; + + /* First, Bind the event with the load function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_LDS_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_LDS_Pos; + + slice->CMC = cmc; +} + +/* API to configure, which compare register value has to be loaded during external load event */ +void XMC_CCU8_SLICE_LoadSelector(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_COMPARE_CHANNEL_t ch_num) +{ + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_LoadSelector:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_LoadSelector:Invalid Channel number", XMC_CCU8_SLICE_CHECK_COMP_CHANNEL(ch_num)); + + tc = slice->TC; + + /* First, Bind the event with the load function */ + tc &= ~((uint32_t) CCU8_CC8_TC_TLS_Msk); + tc |= (uint32_t)ch_num << CCU8_CC8_TC_TLS_Pos; + + slice->TC = tc; +} + +/* API to configure the slice modulation function */ +void XMC_CCU8_SLICE_ModulationConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_MODULATION_MODE_t mod_mode, + const XMC_CCU8_SLICE_MODULATION_CHANNEL_t channel, + const bool synch_with_pwm) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_ModulationConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_ModulationConfig:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU8_SLICE_ModulationConfig:Invalid channel for modulation", + XMC_CCU8_SLICE_CHECK_MODULATION_CHANNEL(channel)); + XMC_ASSERT("XMC_CCU8_SLICE_ModulationConfig:Invalid Modulation Mode", + ((mod_mode == XMC_CCU8_SLICE_MODULATION_MODE_CLEAR_ST_OUT) ||\ + (mod_mode == XMC_CCU8_SLICE_MODULATION_MODE_CLEAR_OUT))); + + cmc = slice->CMC; + + /* First, Bind the event with the modulation function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_MOS_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_MOS_Pos; + + slice->CMC = cmc; + + tc = slice->TC; + + /* Next, Modulation mode */ + if(mod_mode == XMC_CCU8_SLICE_MODULATION_MODE_CLEAR_OUT) + { + tc |= (uint32_t) CCU8_CC8_TC_EMT_Msk; + } + else + { + tc &= ~((uint32_t) CCU8_CC8_TC_EMT_Msk); + } + + /* Synchronization of modulation effect with PWM cycle */ + if(synch_with_pwm == true) + { + tc |= (uint32_t) CCU8_CC8_TC_EMS_Msk; + } + else + { + tc &= ~((uint32_t) CCU8_CC8_TC_EMS_Msk); + } + + /* Configure on which channel external modulation to be applied */ + tc &= ~((uint32_t) CCU8_CC8_TC_EME_Msk); + tc |= (uint32_t)channel << CCU8_CC8_TC_EME_Pos; + + slice->TC = tc; +} + +/* API to configure the slice count function */ +void XMC_CCU8_SLICE_CountConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU8_SLICE_CountConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_CountConfig:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + + cmc = slice->CMC; + + /* First, Bind the event with the count function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_CNTS_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_CNTS_Pos; + + slice->CMC = cmc; +} + +/* API to configure slice gate function */ +void XMC_CCU8_SLICE_GateConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU8_SLICE_GateConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_GateConfig:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + + cmc = slice->CMC; + + /* First, Bind the event with the gate function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_GATES_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_GATES_Pos; + + slice->CMC = cmc; +} + +/* API to configure Capture-0 function */ +void XMC_CCU8_SLICE_Capture0Config(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU8_SLICE_Capture0Config:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_Capture0Config:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + + cmc = slice->CMC; + + /* First, Bind the event with the gate function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_CAP0S_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_CAP0S_Pos; + + slice->CMC = cmc; +} + +/* API to configure Capture-1 function */ +void XMC_CCU8_SLICE_Capture1Config(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU8_SLICE_Capture1Config:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_Capture1Config:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + + + cmc = slice->CMC; + + /* First, Bind the event with the gate function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_CAP1S_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_CAP1S_Pos; + + slice->CMC = cmc; +} + +/* API to configure direction function */ +void XMC_CCU8_SLICE_DirectionConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU8_SLICE_DirectionConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_DirectionConfig:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + + cmc = slice->CMC; + + /* First, Bind the event with the direction function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_UDS_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_UDS_Pos; + + slice->CMC = cmc; +} + +/* API to configure slice status bit override function */ +void XMC_CCU8_SLICE_StatusBitOverrideConfig(XMC_CCU8_SLICE_t *const slice) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU8_SLICE_StatusBitOverrideConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + + cmc = slice->CMC; + + /* Map status bit trigger override to Event 1 & + status bit value override to Event 2 */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_OFS_Msk); + cmc |= ((uint32_t) 1) << CCU8_CC8_CMC_OFS_Pos; + + slice->CMC = cmc; +} + +/* API to configure trap function*/ +void XMC_CCU8_SLICE_TrapConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_TRAP_EXIT_MODE_t exit_mode, + const bool synch_with_pwm) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_TrapConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_TrapConfig:Invalid Exit Mode", ((exit_mode == XMC_CCU8_SLICE_TRAP_EXIT_MODE_AUTOMATIC) ||\ + (exit_mode == XMC_CCU8_SLICE_TRAP_EXIT_MODE_SW))); + + cmc = slice->CMC; + + /* Map trap function to Event 2 */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_TS_Msk); + cmc |= ((uint32_t) 1) << CCU8_CC8_CMC_TS_Pos; + + slice->CMC = cmc; + + tc = slice->TC; + + /* Configure synchronization option */ + if(synch_with_pwm == true) + { + tc |= (uint32_t) CCU8_CC8_TC_TRPSE_Msk; + } + else + { + tc &= ~((uint32_t) CCU8_CC8_TC_TRPSE_Msk); + } + + /* Configure exit mode */ + if(exit_mode == XMC_CCU8_SLICE_TRAP_EXIT_MODE_SW) + { + tc |= (uint32_t) CCU8_CC8_TC_TRPSW_Msk; + } + else + { + tc &= ~((uint32_t) CCU8_CC8_TC_TRPSW_Msk); + } + + slice->TC = tc; +} + +/* API to configure a slice Status Bit Override event */ +void XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_CONFIG_t *const ev1_config, + const XMC_CCU8_SLICE_EVENT_CONFIG_t *const ev2_config) +{ + uint32_t ins; + + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Input", + XMC_CCU8_SLICE_IsInputvalid(ev1_config->mapped_input)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Edge Sensitivity", + XMC_CCU8_SLICE_CHECK_EDGE_SENSITIVITY(ev1_config->edge)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Level Sensitivity", + ((ev1_config->level == XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH) ||\ + (ev1_config->level == XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW))); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Debounce Period", + XMC_CCU8_SLICE_CHECK_EVENT_FILTER(ev1_config->duration)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Input", + XMC_CCU8_SLICE_IsInputvalid(ev2_config->mapped_input)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Edge Sensitivity", + XMC_CCU8_SLICE_CHECK_EDGE_SENSITIVITY(ev2_config->edge)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Level Sensitivity", + ((ev2_config->level == XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH) ||\ + (ev2_config->level == XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW))); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Debounce Period", + XMC_CCU8_SLICE_CHECK_EVENT_FILTER(ev2_config->duration)); + +#if defined(CCU8V3) /* Defined for XMC1400 devices only */ + ins = slice->INS2; + + /* Configure the edge sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU8_CC8_INS2_EV1EM_Pos); + ins |= ((uint32_t) ev1_config->edge) << CCU8_CC8_INS2_EV1EM_Pos; + + /* Configure the edge sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU8_CC8_INS2_EV2EM_Pos); + ins |= ((uint32_t) ev2_config->edge) << CCU8_CC8_INS2_EV2EM_Pos; + + /* Configure the level sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU8_CC8_INS2_EV1LM_Pos); + ins |= ((uint32_t) ev1_config->level) << CCU8_CC8_INS2_EV1LM_Pos; + + /* Configure the level sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU8_CC8_INS2_EV2LM_Pos); + ins |= ((uint32_t) ev2_config->level) << CCU8_CC8_INS2_EV2LM_Pos; + + /* Configure the debounce filter for event 1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU8_CC8_INS2_LPF1M_Pos); + ins |= ((uint32_t) ev1_config->duration) << CCU8_CC8_INS2_LPF1M_Pos; + + /* Configure the debounce filter for event 2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU8_CC8_INS2_LPF2M_Pos); + ins |= ((uint32_t) ev2_config->duration) << CCU8_CC8_INS2_LPF2M_Pos; + + slice->INS2 = ins; + + ins = slice->INS1; + /* Next, the input for Event1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU8_CC8_INS1_EV1IS_Pos); + ins |= ((uint32_t) ev1_config->mapped_input) << CCU8_CC8_INS1_EV1IS_Pos; + + /* Finally, the input for Event2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU8_CC8_INS1_EV2IS_Pos); + ins |= ((uint32_t) ev2_config->mapped_input) << CCU8_CC8_INS1_EV2IS_Pos; + + slice->INS1 = ins; +#else + ins = slice->INS; + + /* Configure the edge sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU8_CC8_INS_EV1EM_Pos); + ins |= ((uint32_t) ev1_config->edge) << CCU8_CC8_INS_EV1EM_Pos; + + /* Configure the edge sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU8_CC8_INS_EV2EM_Pos); + ins |= ((uint32_t) ev2_config->edge) << CCU8_CC8_INS_EV2EM_Pos; + + /* Configure the level sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU8_CC8_INS_EV1LM_Pos); + ins |= ((uint32_t) ev1_config->level) << CCU8_CC8_INS_EV1LM_Pos; + + /* Configure the level sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU8_CC8_INS_EV2LM_Pos); + ins |= ((uint32_t) ev2_config->level) << CCU8_CC8_INS_EV2LM_Pos; + + /* Configure the debounce filter for event 1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU8_CC8_INS_LPF1M_Pos); + ins |= ((uint32_t) ev1_config->duration) << CCU8_CC8_INS_LPF1M_Pos; + + /* Configure the debounce filter for event 2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU8_CC8_INS_LPF2M_Pos); + ins |= ((uint32_t) ev2_config->duration) << CCU8_CC8_INS_LPF2M_Pos; + + /* Next, the input for Event1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU8_CC8_INS_EV1IS_Pos); + ins |= ((uint32_t) ev1_config->mapped_input) << CCU8_CC8_INS_EV1IS_Pos; + + /* Finally, the input for Event2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU8_CC8_INS_EV2IS_Pos); + ins |= ((uint32_t) ev2_config->mapped_input) << CCU8_CC8_INS_EV2IS_Pos; + + slice->INS = ins; +#endif +} + +/* API to configure a slice trigger event */ +void XMC_CCU8_SLICE_ConfigureEvent(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_EVENT_CONFIG_t *const config) +{ + uint32_t ins; + uint8_t pos; + uint8_t offset; + + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureEvent:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureEvent:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureEvent:Invalid Input", XMC_CCU8_SLICE_IsInputvalid(config->mapped_input)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureEvent:Invalid Edge Sensitivity", + XMC_CCU8_SLICE_CHECK_EDGE_SENSITIVITY(config->edge)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureEvent:Invalid Level Sensitivity", + ((config->level == XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH) ||\ + (config->level == XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW))); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureEvent:Invalid Debounce Period", + XMC_CCU8_SLICE_CHECK_EVENT_FILTER(config->duration)); + + /* Calculate offset with reference to event */ + offset = ((uint8_t) event) - 1U; + +#if defined(CCU8V3) /* Defined for XMC1400 devices only */ + ins = slice->INS2; + + /* First, configure the edge sensitivity */ + pos = ((uint8_t) CCU8_CC8_INS2_EV0EM_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_EDGE_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->edge) << pos; + + /* Next, the level */ + pos = ((uint8_t) CCU8_CC8_INS2_EV0LM_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_LEVEL_CONFIG_MASK) << pos); + ins |= ((uint32_t) (config->level)) << pos; + + /* Next, the debounce filter */ + pos = ((uint8_t) CCU8_CC8_INS2_LPF0M_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_FILTER_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->duration) << pos; + + slice->INS2 = ins; + + ins = slice->INS1; + + /* Finally the input */ + pos = ((uint8_t) CCU8_CC8_INS1_EV0IS_Pos) + (uint8_t)(offset << 3U); + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->mapped_input) << pos; + + slice->INS1 = ins; + +#else + ins = slice->INS; + + /* First, configure the edge sensitivity */ + pos = ((uint8_t) CCU8_CC8_INS_EV0EM_Pos) + (uint8_t)(offset << 1U); + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_EDGE_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->edge) << pos; + + /* Next, the level */ + pos = ((uint8_t) CCU8_CC8_INS_EV0LM_Pos) + offset; + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_LEVEL_CONFIG_MASK) << pos); + ins |= ((uint32_t) (config->level)) << pos; + + /* Next, the debounce filter */ + pos = ((uint8_t) CCU8_CC8_INS_LPF0M_Pos) + (uint8_t)(offset << 1U); + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_FILTER_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->duration) << pos; + + /* Finally the input */ + pos = ((uint8_t) CCU8_CC8_INS_EV0IS_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->mapped_input) << pos; + + slice->INS = ins; +#endif +} + +/* API to bind an input to a slice trigger event */ +void XMC_CCU8_SLICE_SetInput(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_INPUT_t input) +{ + uint32_t ins; + uint8_t pos; + uint8_t offset; + + XMC_ASSERT("XMC_CCU8_SLICE_SetInput:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetInput:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU8_SLICE_SetInput:Invalid Input", XMC_CCU8_SLICE_IsInputvalid(input)); + + /* Calculate offset with reference to event */ + offset = ((uint8_t) event) - 1U; + +#if defined(CCU8V3) /* Defined for XMC1400 devices only */ + pos = ((uint8_t) CCU8_CC8_INS1_EV0IS_Pos) + (uint8_t) (offset << 3U); + ins = slice->INS1; + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) input) << pos; + + slice->INS1 = ins; +#else + + pos = ((uint8_t) CCU8_CC8_INS_EV0IS_Pos) + (uint8_t) (offset << 2U); + ins = slice->INS; + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) input) << pos; + + slice->INS = ins; +#endif +} + +/* API to program timer repeat mode - Single shot vs repeat */ +void XMC_CCU8_SLICE_SetTimerRepeatMode(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_TIMER_REPEAT_MODE_t mode) +{ + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerRepeatMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerRepeatMode:Invalid Timer Repeat Mode", + ((mode == XMC_CCU8_SLICE_TIMER_REPEAT_MODE_REPEAT) ||\ + (mode == (mode == XMC_CCU8_SLICE_TIMER_REPEAT_MODE_REPEAT)))); + + tc = slice->TC; + + if(XMC_CCU8_SLICE_TIMER_REPEAT_MODE_REPEAT == mode) + { + tc &= ~((uint32_t) CCU8_CC8_TC_TSSM_Msk); + } + else + { + tc |= (uint32_t) CCU8_CC8_TC_TSSM_Msk; + } + + slice->TC = tc; +} + +/* Programs timer counting mode */ +void XMC_CCU8_SLICE_SetTimerCountingMode(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_TIMER_COUNT_MODE_t mode) +{ + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerCountingMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerCountingMode:Invalid Timer Count Mode", + ((mode == XMC_CCU8_SLICE_TIMER_COUNT_MODE_EA) ||\ + (mode == XMC_CCU8_SLICE_TIMER_COUNT_MODE_CA))); + + tc = slice->TC; + + if(XMC_CCU8_SLICE_TIMER_COUNT_MODE_EA == mode) + { + tc &= ~((uint32_t) CCU8_CC8_TC_TCM_Msk); + } + else + { + tc |= (uint32_t) CCU8_CC8_TC_TCM_Msk; + } + + slice->TC = tc; +} + +/* Programs period match value of the timer */ +void XMC_CCU8_SLICE_SetTimerPeriodMatch(XMC_CCU8_SLICE_t *const slice, const uint16_t period_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerPeriodMatch:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->PRS = (uint32_t) period_val; +} + +/* Retrieves desired capture register value */ +uint32_t XMC_CCU8_SLICE_GetCaptureRegisterValue(const XMC_CCU8_SLICE_t *const slice, const uint8_t reg_num) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetCaptureRegisterValue:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_GetCaptureRegisterValue:Invalid register number", (reg_num < 4U)); + return(slice->CV[reg_num]); +} + +/* @brief Retrieves the latest captured timer value */ +XMC_CCU8_STATUS_t XMC_CCU8_SLICE_GetLastCapturedTimerValue(const XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_CAP_REG_SET_t set, + uint32_t *val_ptr) +{ + + XMC_CCU8_STATUS_t retval; + uint8_t i; + uint8_t start; + uint8_t end; + + XMC_ASSERT("XMC_CCU8_SLICE_GetLastCapturedTimerValue:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_GetLastCapturedTimerValue:Invalid Register Set", + ((set == XMC_CCU8_SLICE_CAP_REG_SET_LOW) ||\ + (set == XMC_CCU8_SLICE_CAP_REG_SET_HIGH))); + + retval = XMC_CCU8_STATUS_ERROR; + + /* First check if extended capture mode is enabled */ + if((slice->TC) & CCU8_CC8_TC_ECM_Msk) + { + /* Extended capture mode has been enabled. So start with the lowest capture register and work your way up */ + start = 0U; + end = XMC_CCU8_NUM_SLICES_PER_MODULE; + } + else + { + /* Extended capture mode is not enabled */ + if(set == XMC_CCU8_SLICE_CAP_REG_SET_HIGH) + { + start = ((uint8_t) XMC_CCU8_NUM_SLICES_PER_MODULE) >> 1U; + end = (uint8_t) XMC_CCU8_NUM_SLICES_PER_MODULE; + } + else + { + start = 0U; + end = ((uint8_t) XMC_CCU8_NUM_SLICES_PER_MODULE) >> 1U; + } + } + + for(i=start; iCV[i]) & CCU8_CC8_CV_FFL_Msk ) + { + *val_ptr = slice->CV[i]; + retval = XMC_CCU8_STATUS_OK; + break; + } + } + + return retval; +} +/* Retrieves timer capture value from a FIFO made of capture registers */ +#if defined(CCU8V1) /* Defined for XMC4800, XMC4700, XMC4500, XMC4400, XMC4200, XMC4100 devices only */ +int32_t XMC_CCU8_GetCapturedValueFromFifo(const XMC_CCU8_MODULE_t *const module, const uint8_t slice_number) +{ + int32_t cap; + uint32_t extracted_slice; + + XMC_ASSERT("XMC_CCU8_GetCapturedValueFromFifo:Invalid Slice Pointer", XMC_CCU8_IsValidModule(module)); + + /* First read the global fifo register */ + cap = (int32_t) module->ECRD; + + extracted_slice = (((uint32_t) cap) & ((uint32_t) CCU8_ECRD_SPTR_Msk)) >> CCU8_ECRD_SPTR_Pos; + + /* Return captured result only if it were applicable to this slice */ + if(extracted_slice != ((uint32_t)slice_number)) + { + cap = -1; + } + + return (cap); +} +#else +/* Retrieves timer capture value from a FIFO made of capture registers */ +uint32_t XMC_CCU8_SLICE_GetCapturedValueFromFifo(const XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_CAP_REG_SET_t set) +{ + uint32_t cap; + + XMC_ASSERT("XMC_CCU8_SLICE_GetCapturedValueFromFifo:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_GetCapturedValueFromFifo:Invalid Register Set", + ((set == XMC_CCU8_SLICE_CAP_REG_SET_LOW) ||\ + (set == XMC_CCU8_SLICE_CAP_REG_SET_HIGH))); + + if(XMC_CCU8_SLICE_CAP_REG_SET_LOW == set) + { + cap = slice->ECRD0; + } + else + { + cap = slice->ECRD1; + } + + return cap; +} +#endif + +/* Enables PWM dithering feature */ +void XMC_CCU8_SLICE_EnableDithering(XMC_CCU8_SLICE_t *const slice, + const bool period_dither, + const bool duty_dither, + const uint8_t spread) +{ + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_EnableDithering:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + + tc = slice->TC; + tc &= ~((uint32_t) CCU8_CC8_TC_DITHE_Msk); + + if(true == period_dither) + { + tc |= (((uint32_t) XMC_CCU8_SLICE_DITHER_PERIOD_MASK) << CCU8_CC8_TC_DITHE_Pos); + } + if(true == duty_dither) + { + tc |= (((uint32_t) XMC_CCU8_SLICE_DITHER_DUTYCYCLE_MASK) << CCU8_CC8_TC_DITHE_Pos); + } + + slice->TC = tc; + + XMC_CCU8_SLICE_SetDitherCompareValue((XMC_CCU8_SLICE_t *)slice, (uint8_t)spread); +} + +/* Programs Pre-scaler divider */ +void XMC_CCU8_SLICE_SetPrescaler(XMC_CCU8_SLICE_t *const slice, const uint8_t div_val) +{ + uint32_t fpc; + + XMC_ASSERT("XMC_CCU8_SLICE_SetPrescaler:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + + /* If the prescaler is not running, update directly the divider*/ + fpc = slice->FPC; + fpc &= ~((uint32_t) CCU8_CC8_FPC_PVAL_Msk); + fpc |= ((uint32_t) div_val) << CCU8_CC8_FPC_PVAL_Pos; + slice->FPC = fpc; + + /* + * In any case, update the initial value of the divider which is to be loaded once the prescaler increments to the + * compare value. + */ + slice->PSC = (uint32_t) div_val; +} + +/* Programs timer compare match value for channel 1 or 2 */ +void XMC_CCU8_SLICE_SetTimerCompareMatch(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t channel, + const uint16_t compare_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerCompareMatch:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerCompareMatch:Invalid channel", XMC_CCU8_SLICE_CHECK_COMP_CHANNEL(channel)); + + if (XMC_CCU8_SLICE_COMPARE_CHANNEL_1 == channel) + { + slice->CR1S = (uint32_t) compare_val; + } + else + { + slice->CR2S = (uint32_t) compare_val; + } +} + +/* Returns the timer compare match value for channel 1 or 2 */ +uint16_t XMC_CCU8_SLICE_GetTimerCompareMatch(const XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t channel) +{ + uint16_t compare_value; + + XMC_ASSERT("XMC_CCU8_SLICE_GetCompareMatch:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_GetCompareMatch:Invalid channel", XMC_CCU8_SLICE_CHECK_COMP_CHANNEL(channel)); + + if (XMC_CCU8_SLICE_COMPARE_CHANNEL_1 == channel) + { + compare_value = (uint16_t) slice->CR1; + } + else + { + compare_value = (uint16_t) slice->CR2; + } + + return(compare_value); +} + +/* Binds a capcom event to an NVIC node */ +void XMC_CCU8_SLICE_SetInterruptNode(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_IRQ_ID_t event, + const XMC_CCU8_SLICE_SR_ID_t sr) +{ + uint32_t srs; + uint32_t mask; + uint32_t pos; + + XMC_ASSERT("XMC_CCU8_SLICE_SetInterruptNode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetInterruptNode:Invalid SR ID ", XMC_CCU8_SLICE_CHECK_SR_ID(sr)); + XMC_ASSERT("XMC_CCU8_SLICE_SetInterruptNode:Invalid event", XMC_CCU8_SLICE_CHECK_INTERRUPT(event)); + + srs = slice->SRS; + + switch(event) + { + case XMC_CCU8_SLICE_IRQ_ID_PERIOD_MATCH: + case XMC_CCU8_SLICE_IRQ_ID_ONE_MATCH: + mask = ((uint32_t) CCU8_CC8_SRS_POSR_Msk); + pos = CCU8_CC8_SRS_POSR_Pos; + break; + + case XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_UP_CH_1: + case XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_DOWN_CH_1: + mask = ((uint32_t) CCU8_CC8_SRS_CM1SR_Msk); + pos = CCU8_CC8_SRS_CM1SR_Pos; + break; + + case XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_UP_CH_2: + case XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_DOWN_CH_2: + mask = ((uint32_t) CCU8_CC8_SRS_CM2SR_Msk); + pos = CCU8_CC8_SRS_CM2SR_Pos; + break; + + case XMC_CCU8_SLICE_IRQ_ID_EVENT0: + mask = ((uint32_t) CCU8_CC8_SRS_E0SR_Msk); + pos = CCU8_CC8_SRS_E0SR_Pos; + break; + + case XMC_CCU8_SLICE_IRQ_ID_EVENT1: + mask = ((uint32_t) CCU8_CC8_SRS_E1SR_Msk); + pos = CCU8_CC8_SRS_E1SR_Pos; + break; + + default: + mask = ((uint32_t) CCU8_CC8_SRS_E2SR_Msk); + pos = CCU8_CC8_SRS_E2SR_Pos; + break; + } + + srs &= ~mask; + srs |= (uint32_t)sr << pos; + + slice->SRS = srs; +} + +/* Asserts passive level for the slice output */ +void XMC_CCU8_SLICE_SetPassiveLevel(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_OUTPUT_t out, + const XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_t level) +{ + uint32_t psl; + + XMC_ASSERT("XMC_CCU8_SLICE_SetPassiveLevel:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetPassiveLevel:Invalid Slice Output", XMC_CCU8_SLICE_CHECK_OUTPUT(out)); + XMC_ASSERT("XMC_CCU8_SLICE_SetPassiveLevel:Invalid Passive Level", + ((level == XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_LOW) ||\ + (level == XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_HIGH))); + + psl = slice->PSL; + + psl &= ~((uint32_t) out); + psl |= (uint32_t) level << ((uint32_t)out >> 1U); + + /* Program CC8 slice output passive level */ + slice->PSL = psl; +} + +/* Initializes Dead time configuration for the slice outputs */ +void XMC_CCU8_SLICE_DeadTimeInit(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_DEAD_TIME_CONFIG_t *const config) +{ + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureDeadTime:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + + /* Program dead time value for channel 1 */ + slice->DC1R = config->dc1r; + /* Program dead time value for channel 2 */ + slice->DC2R = config->dc2r; + /* Program dead time control configuration */ + slice->DTC = config->dtc; +} + +/* Activates or deactivates dead time for compare channel and ST path */ +void XMC_CCU8_SLICE_ConfigureDeadTime(XMC_CCU8_SLICE_t *const slice, const uint8_t mask) +{ + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureDeadTime:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureDeadTime:Invalid Channel", (mask <= XMC_CCU8_SLICE_DEAD_TIME_CONFIG_MASK)); + + slice->DTC &= ~((uint32_t) XMC_CCU8_SLICE_DEAD_TIME_CONFIG_MASK); + slice->DTC |= (uint32_t) mask; +} + +/* Configures rising edge delay and falling edge delay for dead time */ +void XMC_CCU8_SLICE_SetDeadTimeValue(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t channel, + const uint8_t rise_value, + const uint8_t fall_value) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetDeadTimeValue:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetDeadTimeValue:Invalid channel", XMC_CCU8_SLICE_CHECK_COMP_CHANNEL(channel)); + + if (XMC_CCU8_SLICE_COMPARE_CHANNEL_1 == channel) + { + slice->DC1R = (((uint32_t) fall_value) << CCU8_CC8_DC1R_DT1F_Pos) | ((uint32_t) rise_value); + } + else + { + slice->DC2R = (((uint32_t) fall_value) << CCU8_CC8_DC2R_DT2F_Pos) | ((uint32_t) rise_value); + } +} + +/* Configures clock division factor for dead time */ +void XMC_CCU8_SLICE_SetDeadTimePrescaler(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_DTC_DIV_t div_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetDeadTimePrescaler:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetDeadTimePrescaler:Invalid divider value", XMC_CCU8_SLICE_CHECK_DTC_DIV(div_val)); + + slice->DTC &= ~((uint32_t) CCU8_CC8_DTC_DTCC_Msk); + slice->DTC |= ((uint32_t) div_val) << CCU8_CC8_DTC_DTCC_Pos; +} + +/* Configures status ST1, ST2 mapping to STy */ +void XMC_CCU8_SLICE_ConfigureStatusBitOutput(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_STATUS_t channel) +{ + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOutput:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOutput:Invalid Channel", XMC_CCU8_SLICE_CHECK_SLICE_STATUS(channel)); + + slice->TC &= ~((uint32_t) CCU8_CC8_TC_STOS_Msk); + slice->TC |= ((uint32_t) channel) << CCU8_CC8_TC_STOS_Pos; +} + +#endif /* CCU80 */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_common.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_common.c new file mode 100644 index 00000000..73101ee4 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_common.c @@ -0,0 +1,219 @@ +/** + * @file xmc_common.c + * @date 2017-02-25 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2017-02-25: + * - Remove the need to define XMC_USER_ASSERT_FUNCTION + * - XMC_AssertHandler fixed compilation warnings + * + * @endcond + * + */ + +#include "xmc_common.h" + +/******************************************************************************* + * DATA STRUCTURES + *******************************************************************************/ +struct list +{ + struct list *next; +}; + +/******************************************************************************* + * API IMPLEMENTATION + *******************************************************************************/ +#if defined(XMC_ASSERT_ENABLE) +__WEAK void XMC_AssertHandler(const char *const msg, const char *const file, uint32_t line) +{ + XMC_UNUSED_ARG(msg); + XMC_UNUSED_ARG(file); + XMC_UNUSED_ARG(line); + + while(1) + { + /* Endless loop */ + } +} +#endif + +void XMC_LIST_Init(XMC_LIST_t *list) +{ + *list = NULL; +} + +void *XMC_LIST_GetHead(XMC_LIST_t *list) +{ + return *list; +} + +void *XMC_LIST_GetTail(XMC_LIST_t *list) +{ + struct list *tail; + + if (*list == NULL) + { + tail = NULL; + } + else + { + for (tail = (struct list *)*list; tail->next != NULL; tail = tail->next) + { + /* Loop through the list */ + } + } + + return tail; +} + +void XMC_LIST_Add(XMC_LIST_t *list, void *item) +{ + struct list *tail; + + ((struct list *)item)->next = NULL; + tail = (struct list *)XMC_LIST_GetTail(list); + + if (tail == NULL) + { + *list = item; + } + else + { + tail->next = (struct list *)item; + } +} + +void XMC_LIST_Remove(XMC_LIST_t *list, void *item) +{ + struct list *right, *left; + + if (*list != NULL) + { + left = NULL; + for(right = (struct list *)*list; right != NULL; right = right->next) + { + if(right == item) + { + if(left == NULL) + { + /* First on list */ + *list = right->next; + } + else + { + /* Not first on list */ + left->next = right->next; + } + right->next = NULL; + break; + } + left = right; + } + } +} + +void XMC_LIST_Insert(XMC_LIST_t *list, void *prev_item, void *new_item) +{ + if (prev_item == NULL) + { + ((struct list *)new_item)->next = (struct list *)*list; + *list = new_item; + } + else + { + ((struct list *)new_item)->next = ((struct list *)prev_item)->next; + ((struct list *)prev_item)->next = (struct list *)new_item; + } +} + +void XMC_PRIOARRAY_Init(XMC_PRIOARRAY_t *prioarray) +{ + XMC_ASSERT("XMC_PRIOARRAY_Init: NULL pointer", prioarray != NULL); + + /* Initialize head, next points to tail, previous to NULL and the priority is MININT */ + prioarray->items[prioarray->size].next = prioarray->size + 1; + prioarray->items[prioarray->size].previous = -1; + prioarray->items[prioarray->size].priority = INT32_MAX; + + /* Initialize tail, next points to NULL, previous is the head and the priority is MAXINT */ + prioarray->items[prioarray->size + 1].next = -1; + prioarray->items[prioarray->size + 1].previous = prioarray->size; + prioarray->items[prioarray->size + 1].priority = INT32_MIN; + +} + +void XMC_PRIOARRAY_Add(XMC_PRIOARRAY_t *prioarray, int32_t item, int32_t priority) +{ + int32_t next; + int32_t previous; + + XMC_ASSERT("XMC_PRIOARRAY_Add: item out of range", (item >= 0) && (item < prioarray->size)); + + next = XMC_PRIOARRAY_GetHead(prioarray); + while (XMC_PRIOARRAY_GetItemPriority(prioarray, next) > priority) + { + next = XMC_PRIOARRAY_GetItemNext(prioarray, next); + } + + previous = prioarray->items[next].previous; + + prioarray->items[item].next = next; + prioarray->items[item].previous = previous; + prioarray->items[item].priority = priority; + + prioarray->items[previous].next = item; + prioarray->items[next].previous = item; +} + +void XMC_PRIOARRAY_Remove(XMC_PRIOARRAY_t *prioarray, int32_t item) +{ + int32_t next; + int32_t previous; + + XMC_ASSERT("XMC_PRIOARRAY_Add: item out of range", (item >= 0) && (item < prioarray->size)); + + next = prioarray->items[item].next; + previous = prioarray->items[item].previous; + + prioarray->items[previous].next = next; + prioarray->items[next].previous = previous; +} + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_eru.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_eru.c new file mode 100644 index 00000000..9141b9b2 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_eru.c @@ -0,0 +1,295 @@ +/** + * @file xmc_eru.c + * @date 2016-03-10 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-06-20: + * - Removed definition of GetDriverVersion API
+ * + * 2016-03-10: + * - XMC_ERU_ETL_GetEdgeDetection() API is added to get the configured edge for event generation.
+ * + * @endcond + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ + +#include "xmc_eru.h" + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +#define ERU_EXISEL_BITSIZE (4UL) /* Used to set the input for path A and path B based on the channel */ +#define ERU_EXISEL_INPUT_BITSIZE (2UL) + +#define XMC_ERU_ETL_CHECK_INPUT_A(input) \ + ((input == XMC_ERU_ETL_INPUT_A0) || \ + (input == XMC_ERU_ETL_INPUT_A1) || \ + (input == XMC_ERU_ETL_INPUT_A2) || \ + (input == XMC_ERU_ETL_INPUT_A3)) + +#define XMC_ERU_ETL_CHECK_INPUT_B(input) \ + ((input == XMC_ERU_ETL_INPUT_B0) || \ + (input == XMC_ERU_ETL_INPUT_B1) || \ + (input == XMC_ERU_ETL_INPUT_B2) || \ + (input == XMC_ERU_ETL_INPUT_B3)) + +#define XMC_ERU_ETL_CHECK_STATUS_FLAG_MODE(mode) \ + ((mode == XMC_ERU_ETL_STATUS_FLAG_MODE_SWCTRL) || \ + (mode == XMC_ERU_ETL_STATUS_FLAG_MODE_HWCTRL)) + +#define XMC_ERU_ETL_CHECK_EVENT_SOURCE(source) \ + ((source == XMC_ERU_ETL_SOURCE_A) || \ + (source == XMC_ERU_ETL_SOURCE_B) || \ + (source == XMC_ERU_ETL_SOURCE_A_OR_B) || \ + (source == XMC_ERU_ETL_SOURCE_A_AND_B) || \ + (source == XMC_ERU_ETL_SOURCE_NOT_A) || \ + (source == XMC_ERU_ETL_SOURCE_NOT_A_OR_B) || \ + (source == XMC_ERU_ETL_SOURCE_NOT_A_AND_B) || \ + (source == XMC_ERU_ETL_SOURCE_NOT_B) || \ + (source == XMC_ERU_ETL_SOURCE_A_OR_NOT_B) || \ + (source == XMC_ERU_ETL_SOURCE_A_AND_NOT_B) || \ + (source == XMC_ERU_ETL_SOURCE_NOT_A_OR_NOT_B) || \ + (source == XMC_ERU_ETL_SOURCE_NOT_A_AND_NOT_B)) + +#define XMC_ERU_ETL_CHECK_TRIGGER_EDGE(edge) \ + ((edge == XMC_ERU_ETL_EDGE_DETECTION_DISABLED) || \ + (edge == XMC_ERU_ETL_EDGE_DETECTION_RISING) || \ + (edge == XMC_ERU_ETL_EDGE_DETECTION_FALLING) || \ + (edge == XMC_ERU_ETL_EDGE_DETECTION_BOTH)) + +#define XMC_ERU_ETL_CHECK_TRIGGER_CHANNEL(channel) \ + ((channel == XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL0) || \ + (channel == XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL1) || \ + (channel == XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL2) || \ + (channel == XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL3)) + +#define XMC_ERU_OGU_CHECK_PATTERN_INPUT(input) \ + ((input == XMC_ERU_OGU_PATTERN_DETECTION_INPUT0) || \ + (input == XMC_ERU_OGU_PATTERN_DETECTION_INPUT1) || \ + (input == XMC_ERU_OGU_PATTERN_DETECTION_INPUT2) || \ + (input == XMC_ERU_OGU_PATTERN_DETECTION_INPUT3)) + +#define XMC_ERU_OGU_CHECK_PERIPHERAL_TRIGGER(trigger) \ + ((trigger == XMC_ERU_OGU_PERIPHERAL_TRIGGER1) || \ + (trigger == XMC_ERU_OGU_PERIPHERAL_TRIGGER2) || \ + (trigger == XMC_ERU_OGU_PERIPHERAL_TRIGGER3)) + +#define XMC_ERU_OGU_CHECK_SERIVCE_REQUEST(service) \ + ((service == XMC_ERU_OGU_SERVICE_REQUEST_DISABLED) || \ + (service == XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER) || \ + (service == XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER_AND_PATTERN_MATCH) || \ + (service == XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER_AND_PATTERN_MISMATCH)) + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ +/* Initializes the selected ERU_ETLx channel with the config structure. */ +void XMC_ERU_ETL_Init(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_CONFIG_t *const config) +{ + XMC_ASSERT("XMC_ERU_ETL_Init:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_Init:Invalid Channel Number", (channel < 4U)); + + XMC_ERU_Enable(eru); + + eru->EXISEL = (eru->EXISEL & + ~((uint32_t)(ERU_EXISEL_EXS0A_Msk | ERU_EXISEL_EXS0B_Msk) << (channel * ERU_EXISEL_BITSIZE))) | + (config->input << (channel * (uint32_t)ERU_EXISEL_BITSIZE)); + + eru->EXICON[channel] = config->raw; +} + +/* Initializes the selected ERU_OGUy channel with the config structure. */ +void XMC_ERU_OGU_Init(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_CONFIG_t *const config) +{ + XMC_ASSERT("XMC_ERU_OGU_Init:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_OGU_Init:Invalid Channel Number", (channel < 4U)); + + XMC_ERU_Enable(eru); + + eru->EXOCON[channel] = config->raw; +} + +/* Configures the event source for path A and path B, with selected input_a and input_b respectively.*/ +void XMC_ERU_ETL_SetInput(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_INPUT_A_t input_a, + const XMC_ERU_ETL_INPUT_B_t input_b) +{ + XMC_ASSERT("XMC_ERU_ETL_SetInput:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_SetInput:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_ETL_SetInput:Invalid A", XMC_ERU_ETL_CHECK_INPUT_A(input_a)); + XMC_ASSERT("XMC_ERU_ETL_SetInput:Invalid B", XMC_ERU_ETL_CHECK_INPUT_B(input_b)); + + eru->EXISEL = (eru->EXISEL & ~((uint32_t)(ERU_EXISEL_EXS0A_Msk | ERU_EXISEL_EXS0B_Msk) << (channel * ERU_EXISEL_BITSIZE))) | + (((uint32_t)input_a | (uint32_t)(input_b << ERU_EXISEL_INPUT_BITSIZE)) << (channel * ERU_EXISEL_BITSIZE)); +} + +/* Select input path combination along with polarity for event generation by setting (SS, NA, NB) bits of + EXICONx(x = [0 to 3]) register */ +void XMC_ERU_ETL_SetSource(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_SOURCE_t source) +{ + XMC_ASSERT("XMC_ERU_ETL_SetSource:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_SetSource:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_ETL_SetSource:Invalid Source", XMC_ERU_ETL_CHECK_EVENT_SOURCE(source)); + + eru->EXICON_b[channel].SS = (uint8_t)source; +} + +/* Configure event trigger edge/s by setting (RE, FE) bits of EXICONx(x = [0 to 3]) register.*/ +void XMC_ERU_ETL_SetEdgeDetection(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_EDGE_DETECTION_t edge_detection) +{ + XMC_ASSERT("XMC_ERU_ETL_SetEdgeDetection:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_SetEdgeDetection:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_ETL_SetEdgeDetection:Invalid Trigger Edge", XMC_ERU_ETL_CHECK_TRIGGER_EDGE(edge_detection)); + + eru->EXICON_b[channel].ED = (uint8_t)edge_detection; +} + +/* Returns the configured event trigger edge/s by reading (RE, FE) bits of EXICONx(x = [0 to 3]) register. */ +XMC_ERU_ETL_EDGE_DETECTION_t XMC_ERU_ETL_GetEdgeDetection(XMC_ERU_t *const eru, const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_ETL_GetEdgeDetection:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_GetEdgeDetection:Invalid Channel Number", (channel < 4U)); + return ((XMC_ERU_ETL_EDGE_DETECTION_t)(eru->EXICON_b[channel].ED)); +} + +/* Set the status flag bit(FL) in EXICONx(x = [0 to 3]). */ +void XMC_ERU_ETL_SetStatusFlagMode(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_STATUS_FLAG_MODE_t mode) +{ + XMC_ASSERT("XMC_ERU_ETL_SetStatusFlagMode:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_SetStatusFlagMode:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_ETL_SetStatusFlagMode:Invalid Status Flag Mode", XMC_ERU_ETL_CHECK_STATUS_FLAG_MODE(mode)); + + eru->EXICON_b[channel].LD = (uint8_t)mode; +} + +/* Configure which Channel of OGUy(Output gating unit y = [0 to 3]) to be mapped by the trigger pulse generated by + * ETLx(Event Trigger Logic, x = [0 to 3]) by setting (OCS and PE) bit fields. */ +void XMC_ERU_ETL_EnableOutputTrigger(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL_t trigger) +{ + XMC_ASSERT("XMC_ERU_ETL_EnableOutputTrigger:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_EnableOutputTrigger:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_ETL_EnableOutputTrigger:Invalid Output Channel", XMC_ERU_ETL_CHECK_TRIGGER_CHANNEL(trigger)); + + eru->EXICON_b[channel].OCS = (uint8_t)trigger; + eru->EXICON_b[channel].PE = (uint8_t)true; +} + +/* Disables the trigger pulse generation by clearing the (PE) of the EXICONx(x = [0 to 3]). */ +void XMC_ERU_ETL_DisableOutputTrigger(XMC_ERU_t *const eru, const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_ETL_DisableOutputTrigger:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_DisableOutputTrigger:Invalid Channel Number", (channel < 4U)); + + eru->EXICON_b[channel].PE = false; +} + +/* Configures ERU_ETLx(x = [0 to 3]) for pattern match detection by setting IPENx(x = [0 to 3) and GEEN bits. */ +void XMC_ERU_OGU_EnablePatternDetection(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_PATTERN_DETECTION_INPUT_t input) +{ + XMC_ASSERT("XMC_ERU_OGU_EnablePatternDetection:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_OGU_EnablePatternDetection:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_OGU_EnablePatternDetection:Invalid Pattern input", XMC_ERU_OGU_CHECK_PATTERN_INPUT(input)); + + eru->EXOCON_b[channel].IPEN = (uint8_t)input; + eru->EXOCON_b[channel].GEEN = true; +} + +/* Disable the pattern detection by clearing (GEEN) bit. */ +void XMC_ERU_OGU_DisablePatternDetection(XMC_ERU_t *const eru, const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_OGU_DisablePatternDetection:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_OGU_DisablePatternDetection:Invalid Channel Number", (channel < 4U)); + + eru->EXOCON_b[channel].GEEN = false; +} + +/* Configures peripheral trigger input, by setting (ISS) bit. */ +void XMC_ERU_OGU_EnablePeripheralTrigger(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_PERIPHERAL_TRIGGER_t peripheral_trigger) +{ + XMC_ASSERT("XMC_ERU_OGU_EnablePeripheralTrigger:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_OGU_EnablePeripheralTrigger:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_OGU_EnablePeripheralTrigger:Invalid Peripheral Trigger Input", + XMC_ERU_OGU_CHECK_PERIPHERAL_TRIGGER(peripheral_trigger)); + + eru->EXOCON_b[channel].ISS = (uint8_t)peripheral_trigger; +} + +/* Disables event generation based on peripheral trigger by clearing (ISS) bit. */ +void XMC_ERU_OGU_DisablePeripheralTrigger(XMC_ERU_t *const eru, + const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_OGU_DisablePeripheralTrigger:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_OGU_DisablePeripheralTrigger:Invalid Channel Number", (channel < 4U)); + + eru->EXOCON_b[channel].ISS = (uint8_t)0; +} + +/* Configures the gating scheme for service request generation by setting (GP) bit. */ +void XMC_ERU_OGU_SetServiceRequestMode(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_SERVICE_REQUEST_t mode) +{ + XMC_ASSERT("XMC_ERU_OGU_SetServiceRequestMode:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_OGU_SetServiceRequestMode:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_OGU_SetServiceRequestMode:Invalid Service Request Mode", XMC_ERU_OGU_CHECK_SERIVCE_REQUEST(mode)); + + eru->EXOCON_b[channel].GP = (uint8_t)mode; + +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_gpio.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_gpio.c new file mode 100644 index 00000000..208b32dd --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_gpio.c @@ -0,0 +1,81 @@ +/** + * @file xmc_gpio.c + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * @endcond + * + */ + +/******************************************************************************* + * HEADER FILES + *******************************************************************************/ + +#include + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +#define PORT_HWSEL_Msk PORT0_HWSEL_HW0_Msk + +/******************************************************************************* + * API IMPLEMENTATION + *******************************************************************************/ + +void XMC_GPIO_SetMode(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_MODE_t mode) +{ + XMC_ASSERT("XMC_GPIO_SetMode: Invalid port", XMC_GPIO_CHECK_PORT(port)); + XMC_ASSERT("XMC_GPIO_SetMode: Invalid mode", XMC_GPIO_IsModeValid(mode)); + + port->IOCR[(uint32_t)pin >> 2U] &= ~(uint32_t)((uint32_t)PORT_IOCR_PC_Msk << ((uint32_t)PORT_IOCR_PC_Size * ((uint32_t)pin & 0x3U))); + port->IOCR[(uint32_t)pin >> 2U] |= (uint32_t)mode << ((uint32_t)PORT_IOCR_PC_Size * ((uint32_t)pin & 0x3U)); +} + +void XMC_GPIO_SetHardwareControl(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_HWCTRL_t hwctrl) +{ + XMC_ASSERT("XMC_GPIO_SetHardwareControl: Invalid port", XMC_GPIO_CHECK_PORT(port)); + XMC_ASSERT("XMC_GPIO_SetHardwareControl: Invalid hwctrl", XMC_GPIO_CHECK_HWCTRL(hwctrl)); + + port->HWSEL &= ~(uint32_t)((uint32_t)PORT_HWSEL_Msk << ((uint32_t)pin << 1U)); + port->HWSEL |= (uint32_t)hwctrl << ((uint32_t)pin << 1U); +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_i2c.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_i2c.c new file mode 100644 index 00000000..7d9e3802 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_i2c.c @@ -0,0 +1,402 @@ +/** + * @file xmc_i2c.c + * @date 2015-10-02 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-05-20: + - Modified XMC_I2C_CH_Stop() API for not setting to IDLE the channel if it is busy
+ * + * 2015-06-20: + * - Removed GetDriverVersion API
+ * + * 2015-08-14: + * - updated the XMC_I2C_CH_SetBaudrate API to support dynamic change from 400K to low frequencies
+ * + * 2015-09-01: + * - Modified XMC_I2C_CH_EnableEvent() and XMC_I2C_CH_DisableEvent() for supporting multiple events configuration
+ * + * 2015-10-02: + * - Fixed 10bit addressing + * + * @endcond + * + */ + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ +#include + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ +#define XMC_I2C_7BIT_ADDR_Pos (8U) /**< 7-bit address position */ +#define TRANSMISSION_MODE (3U) /**< The shift control signal is considered active + without referring to the actual signal level. Data + frame transfer is possible after each edge of the signal.*/ +#define WORDLENGTH (7U) /**< Word length */ +#define SET_TDV (1U) /**< Transmission data valid */ +#define XMC_I2C_10BIT_ADDR_MASK (0x7C00U) /**< Address mask for 10-bit mode */ + +/********************************************************************************************************************* + * ENUMS + *********************************************************************************************************************/ + +typedef enum XMC_I2C_CH_TDF +{ + XMC_I2C_CH_TDF_MASTER_SEND = 0U, + XMC_I2C_CH_TDF_SLAVE_SEND = (uint32_t)1U << 8U, + XMC_I2C_CH_TDF_MASTER_RECEIVE_ACK = (uint32_t)2U << 8U, + XMC_I2C_CH_TDF_MASTER_RECEIVE_NACK = (uint32_t)3U << 8U, + XMC_I2C_CH_TDF_MASTER_START = (uint32_t)4U << 8U, + XMC_I2C_CH_TDF_MASTER_RESTART = (uint32_t)5U << 8U, + XMC_I2C_CH_TDF_MASTER_STOP = (uint32_t)6U << 8U +} XMC_I2C_CH_TDF_t; + +typedef enum XMC_I2C_CH_MAX_SPEED +{ + XMC_I2C_CH_MAX_SPEED_STANDARD = 100000U, + XMC_I2C_CH_MAX_SPEED_FAST = 400000U +} XMC_I2C_CH_MAX_SPEED_t; + +typedef enum XMC_I2C_CH_CLOCK_OVERSAMPLING +{ + XMC_I2C_CH_CLOCK_OVERSAMPLING_STANDARD = 10U, + XMC_I2C_CH_CLOCK_OVERSAMPLING_FAST = 25U +} XMC_I2C_CH_CLOCK_OVERSAMPLINGS_t; + +/********************************************************************************************************************* + * API IMPLEMENTATION + *********************************************************************************************************************/ +/* Initializes the USIC channel by setting the data format, slave address, baudrate, transfer buffer */ +void XMC_I2C_CH_Init(XMC_USIC_CH_t *const channel, const XMC_I2C_CH_CONFIG_t *const config) +{ + XMC_USIC_CH_Enable(channel); + + /* Data format configuration */ + channel->SCTR = ((uint32_t)TRANSMISSION_MODE << (uint32_t)USIC_CH_SCTR_TRM_Pos) | /* Transmision mode */ + ((uint32_t)WORDLENGTH << (uint32_t)USIC_CH_SCTR_WLE_Pos) | /* 8 data bits */ + USIC_CH_SCTR_FLE_Msk | /* unlimited data flow */ + USIC_CH_SCTR_SDIR_Msk | /* MSB shifted first */ + USIC_CH_SCTR_PDL_Msk; /* Passive Data Level */ + + XMC_I2C_CH_SetSlaveAddress(channel, config->address); + (void)XMC_I2C_CH_SetBaudrate(channel, config->baudrate); + + /* Enable transfer buffer */ + channel->TCSR = ((uint32_t)SET_TDV << (uint32_t)USIC_CH_TCSR_TDEN_Pos) | USIC_CH_TCSR_TDSSM_Msk; + + /* Clear status flags */ + channel->PSCR = 0xFFFFFFFFU; + + /* Disable parity generation */ + channel->CCR = 0x0U; +} +/* Sets the slave address */ +void XMC_I2C_CH_SetSlaveAddress(XMC_USIC_CH_t *const channel, const uint16_t address) +{ + if ((address & XMC_I2C_10BIT_ADDR_MASK) == XMC_I2C_10BIT_ADDR_GROUP) + { + channel->PCR_IICMode = (address & 0xffU) | ((address << 1) & 0xfe00U); + } + else + { + channel->PCR_IICMode = ((uint32_t)address) << XMC_I2C_7BIT_ADDR_Pos; + } +} +/* Read the slave address */ +uint16_t XMC_I2C_CH_GetSlaveAddress(const XMC_USIC_CH_t *const channel) +{ + uint32_t address = channel->PCR_IICMode & (uint32_t)USIC_CH_PCR_IICMode_SLAD_Msk; + + if ((address & 0xffU) == 0U) + { + address = address >> XMC_I2C_7BIT_ADDR_Pos; + } + else + { + address = (address & 0xffU) | ((address >> 1) & 0x0300U); + } + + return (uint16_t)address; +} +/* Sets the baudrate and oversampling based on standard speed or fast speed */ +XMC_I2C_CH_STATUS_t XMC_I2C_CH_SetBaudrate(XMC_USIC_CH_t *const channel, uint32_t rate) +{ + XMC_I2C_CH_STATUS_t status; + + status = XMC_I2C_CH_STATUS_ERROR; + + if (rate <= (uint32_t)XMC_I2C_CH_MAX_SPEED_STANDARD) + { + channel->PCR_IICMode &= (uint32_t)~USIC_CH_PCR_IICMode_STIM_Msk; + if (XMC_USIC_CH_SetBaudrate(channel, rate, (uint32_t)XMC_I2C_CH_CLOCK_OVERSAMPLING_STANDARD) == XMC_USIC_CH_STATUS_OK) + { + status = XMC_I2C_CH_STATUS_OK; + } + } + else if (rate <= (uint32_t)XMC_I2C_CH_MAX_SPEED_FAST) + { + channel->PCR_IICMode |= (uint32_t)USIC_CH_PCR_IICMode_STIM_Msk; + if (XMC_USIC_CH_SetBaudrate(channel, rate, (uint32_t)XMC_I2C_CH_CLOCK_OVERSAMPLING_FAST) == XMC_USIC_CH_STATUS_OK) + { + status = XMC_I2C_CH_STATUS_OK; + } + } + else + { + status = XMC_I2C_CH_STATUS_ERROR; + } + + return status; +} +/* Sends master start condition along with read/write command to IN/TBUF register based on FIFO/non-FIFO modes. */ +void XMC_I2C_CH_MasterStart(XMC_USIC_CH_t *const channel, const uint16_t addr, const XMC_I2C_CH_CMD_t command) +{ + uint32_t temp; + + temp = addr | (uint32_t)XMC_I2C_CH_TDF_MASTER_START; + if (command == XMC_I2C_CH_CMD_READ) + { + temp |= 0x1U; + } + + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while (XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + /* check TDV, wait until TBUF is ready */ + } + + /* clear PSR_TBIF */ + XMC_I2C_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[0] = temp; + } + else + { + channel->IN[0U] = temp; + } +} +/* Sends master repeated start condition along with read/write command to IN/TBUF register based on FIFO/non-FIFO modes. */ +void XMC_I2C_CH_MasterRepeatedStart(XMC_USIC_CH_t *const channel, const uint16_t addr, const XMC_I2C_CH_CMD_t command) +{ + uint32_t tmp; + tmp = addr | (uint32_t)XMC_I2C_CH_TDF_MASTER_RESTART; + if (command == XMC_I2C_CH_CMD_READ) + { + tmp |= 0x1U; + } + + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while (XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + /* check TDV, wait until TBUF is ready */ + } + + /* clear PSR_TBIF */ + XMC_I2C_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[0] = tmp; + } + else + { + channel->IN[0U] = tmp; + } +} + +/* Sends master stop command to IN/TBUF register based on FIFO/non-FIFO modes. */ +void XMC_I2C_CH_MasterStop(XMC_USIC_CH_t *const channel) +{ + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while (XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + /* check TDV, wait until TBUF is ready */ + } + + /* clear PSR_TBIF */ + XMC_I2C_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[0] = (uint32_t)XMC_I2C_CH_TDF_MASTER_STOP; + } + else + { + channel->IN[0U] = (uint32_t)XMC_I2C_CH_TDF_MASTER_STOP; + } +} + +/* Sends master send command along with data to IN/TBUF register based on FIFO/non-FIFO modes. */ +void XMC_I2C_CH_MasterTransmit(XMC_USIC_CH_t *const channel, const uint8_t data) +{ + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while (XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + /* check TDV, wait until TBUF is ready */ + } + + /* clear PSR_TBIF */ + XMC_I2C_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[0] = (uint32_t)XMC_I2C_CH_TDF_MASTER_SEND | data; + } + else + { + channel->IN[0] = (uint32_t)XMC_I2C_CH_TDF_MASTER_SEND | data; + } +} + +/* Sends slave send command along with data to IN/TBUF register based on FIFO/non-FIFO modes. */ +void XMC_I2C_CH_SlaveTransmit(XMC_USIC_CH_t *const channel, const uint8_t data) +{ + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while(XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + /* check TDV, wait until TBUF is ready */ + } + + /* clear PSR_TBIF */ + XMC_I2C_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[0] = (uint32_t)XMC_I2C_CH_TDF_SLAVE_SEND | data; + } + else + { + channel->IN[0] = (uint32_t)XMC_I2C_CH_TDF_SLAVE_SEND | data; + } +} + +/* Sends master receive ack command to IN/TBUF register based on FIFO/non-FIFO modes. */ +void XMC_I2C_CH_MasterReceiveAck(XMC_USIC_CH_t *const channel) +{ +/* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while(XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + /* check TDV, wait until TBUF is ready */ + } + + /* clear PSR_TBIF */ + XMC_I2C_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[0] = (uint32_t)XMC_I2C_CH_TDF_MASTER_RECEIVE_ACK; + } + else + { + channel->IN[0] = (uint32_t)XMC_I2C_CH_TDF_MASTER_RECEIVE_ACK; + } +} + +/* Sends master receive nack command to IN/TBUF register based on FIFO/non-FIFO modes. */ +void XMC_I2C_CH_MasterReceiveNack(XMC_USIC_CH_t *const channel) +{ + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while(XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + /* check TDV, wait until TBUF is ready */ + } + + /* clear PSR_TBIF */ + XMC_I2C_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[0] = (uint32_t)XMC_I2C_CH_TDF_MASTER_RECEIVE_NACK; + } + else + { + channel->IN[0] = (uint32_t)XMC_I2C_CH_TDF_MASTER_RECEIVE_NACK; + } +} + +/* Reads the data from RBUF if FIFO size is 0 otherwise from OUTR. */ +uint8_t XMC_I2C_CH_GetReceivedData(const XMC_USIC_CH_t *const channel) +{ + uint8_t retval; + + /* Check FIFO size */ + if ((channel->RBCTR & USIC_CH_RBCTR_SIZE_Msk) == 0U) + { + retval = (uint8_t)channel->RBUF; + } + else + { + retval = (uint8_t)channel->OUTR; + } + + return retval; +} + +/* Sets the operating mode of USIC to IDLE */ +XMC_I2C_CH_STATUS_t XMC_I2C_CH_Stop(XMC_USIC_CH_t *const channel) +{ + XMC_I2C_CH_STATUS_t status = XMC_I2C_CH_STATUS_OK; + + if (((uint32_t)XMC_USIC_CH_GetTransmitBufferStatus(channel) & (uint32_t)XMC_USIC_CH_TBUF_STATUS_BUSY) != 0U) + { + status = XMC_I2C_CH_STATUS_BUSY; + } + else + { + /* USIC channel in IDLE mode */ + XMC_USIC_CH_SetMode(channel, XMC_USIC_CH_OPERATING_MODE_IDLE); + } + return status; +} + +void XMC_I2C_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR |= (event&0x1fc00U); + channel->PCR_IICMode |= ((event) & 0x41fc0000U); +} + +void XMC_I2C_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR &= (uint32_t)~(event&0x1fc00U); + channel->PCR_IICMode &= (uint32_t)~((event) & 0x41fc0000U); +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_i2s.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_i2s.c new file mode 100644 index 00000000..332195e3 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_i2s.c @@ -0,0 +1,268 @@ +/** + * @file xmc_i2s.c + * @date 2015-06-30 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-08-21: + * - Initial
+ * + * 2015-09-01: + * - Modified XMC_I2S_CH_EnableEvent() and XMC_I2S_CH_DisableEvent() for supporting multiple events configuration
+ * + * 2015-09-14: + * - Modified XMC_I2S_CH_SetSystemWordLength for supporting up to 63 system word length. + * - Removed parity configuration
+ * + * 2015-09-28: + * - Fixed bugs in the XMC_I2S_CH_Init() and in the ASSERTs
+ * + * 2015-11-04: + * - Modified the check of XMC_USIC_CH_GetTransmitBufferStatus() in the XMC_I2S_CH_Transmit() API
+ * + * 2016-06-30: + * - Modified XMC_I2S_CH_Init: + * + change default passive level to 0 + * + Call XMC_I2S_CH_SetSystemWordLength() to set the system frame length equal to the frame length. + * - Modified XMC_I2S_CH_SetBaudrate: + * + Optional Master clock output signal generated with a fixed phase relation to SCLK. + * + * @endcond + * + */ +/** + * + * @brief I2S driver for XMC microcontroller family + * + */ +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ + +#include +#include + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +/* To take into account the SCLK divider by 2 and the PPPEN divider (see Divider Mode Counter figure in RM) */ +#define XMC_I2S_CH_OVERSAMPLING (4UL) + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* Initializes the selected I2S channel with the config structure. */ +void XMC_I2S_CH_Init(XMC_USIC_CH_t *const channel, const XMC_I2S_CH_CONFIG_t *const config) +{ + XMC_ASSERT("XMC_I2S_CH_Init: data_delayed_sclk_periods value not valid",(config->data_delayed_sclk_periods > 0U) && + (config->data_delayed_sclk_periods < config->frame_length)); + XMC_USIC_CH_Enable(channel); + + if(config->bus_mode == XMC_I2S_CH_BUS_MODE_MASTER) + { + /* Configure baud rate */ + (void)XMC_I2S_CH_SetBaudrate(channel, config->baudrate); + } + /* Configuration of USIC Shift Control */ + /* Transmission Mode (TRM) = 1 */ + channel->SCTR = (uint32_t)(0x3UL << USIC_CH_SCTR_TRM_Pos) | + (uint32_t)((config->frame_length -1U) << USIC_CH_SCTR_FLE_Pos) | + (uint32_t)((config->data_bits - 1U) << USIC_CH_SCTR_WLE_Pos) | + USIC_CH_SCTR_SDIR_Msk; + + /* Configuration of USIC Transmit Control/Status Register */ + /* TBUF Data Enable (TDEN) = 1 */ + /* TBUF Data Single Shot Mode (TDSSM) = 1 */ + /* WA mode enabled(WAMD) = 1 */ + channel->TCSR = (uint32_t)((channel->TCSR & (~(USIC_CH_TCSR_WLEMD_Msk | + USIC_CH_TCSR_SELMD_Msk | + USIC_CH_TCSR_FLEMD_Msk | + USIC_CH_TCSR_HPCMD_Msk))) | + USIC_CH_TCSR_WAMD_Msk | + (0x01UL << USIC_CH_TCSR_TDEN_Pos) | + USIC_CH_TCSR_TDSSM_Msk); + + if(config->bus_mode == XMC_I2S_CH_BUS_MODE_MASTER) + { + /* Configuration of Protocol Control Register */ + channel->PCR_IISMode = (uint32_t)USIC_CH_PCR_IISMode_WAGEN_Msk; + } + + /* Configuration of Protocol Control Register */ + channel->PCR_IISMode |= (uint32_t)(USIC_CH_PCR_IISMode_DTEN_Msk | + (uint32_t)config->wa_inversion) | + ((uint32_t)((uint32_t)config->data_delayed_sclk_periods - 1U) << USIC_CH_PCR_IISMode_TDEL_Pos); + + XMC_I2S_CH_SetSystemWordLength(channel, config->frame_length); + + /* Clear protocol status */ + channel->PSCR = 0xFFFFFFFFUL; +} + + +XMC_I2S_CH_STATUS_t XMC_I2S_CH_SetBaudrate(XMC_USIC_CH_t *const channel, const uint32_t rate) +{ + XMC_I2S_CH_STATUS_t status; + + status = XMC_I2S_CH_STATUS_ERROR; + + if (rate <= (XMC_SCU_CLOCK_GetPeripheralClockFrequency() >> 1U)) + { + if (XMC_USIC_CH_SetBaudrate(channel, rate, XMC_I2S_CH_OVERSAMPLING) == XMC_USIC_CH_STATUS_OK) + { + channel->BRG = (uint32_t)((channel->BRG & ~(USIC_CH_BRG_CTQSEL_Msk)) | + (0x2UL << USIC_CH_BRG_CTQSEL_Pos)) | + USIC_CH_BRG_PPPEN_Msk; + + status = XMC_I2S_CH_STATUS_OK; + } + + } + return status; +} + +void XMC_I2S_CH_SetSystemWordLength(XMC_USIC_CH_t *const channel,uint32_t sclk_cycles_system_word_length) +{ + uint32_t sclk_cycles_system_word_length_temp; + uint8_t dctq_temp; + uint8_t pctq_temp; + uint8_t dctq = 1U; + uint8_t pctq = 1U; + uint8_t best_error = 64U; + uint8_t error; + XMC_ASSERT("XMC_I2S_CH_Init: data_delayed_sclk_periods value not valid",(sclk_cycles_system_word_length > 0U) && (sclk_cycles_system_word_length < 65U)); + + + for (dctq_temp =1U; dctq_temp < 33U ; dctq_temp++) + { + for (pctq_temp =1U; pctq_temp < 5U ; pctq_temp++) + { + sclk_cycles_system_word_length_temp = ((uint32_t)dctq_temp) * ((uint32_t)pctq_temp); + if(sclk_cycles_system_word_length_temp == sclk_cycles_system_word_length) + { + dctq = dctq_temp; + pctq = pctq_temp; + break; + } + if (sclk_cycles_system_word_length_temp > sclk_cycles_system_word_length) + { + error = (uint8_t)(sclk_cycles_system_word_length_temp - sclk_cycles_system_word_length); + } + else + { + error = (uint8_t)(sclk_cycles_system_word_length - sclk_cycles_system_word_length_temp); + } + + if(error < best_error) + { + best_error = error; + dctq = dctq_temp; + pctq = pctq_temp; + } + } + } + channel->BRG = (uint32_t)((channel->BRG & ~((uint32_t)(USIC_CH_BRG_DCTQ_Msk | + USIC_CH_BRG_PCTQ_Msk))) | + (uint32_t)((uint32_t)((uint32_t)((uint32_t)dctq- 1U) << USIC_CH_BRG_DCTQ_Pos) | + (uint32_t)((uint32_t)((uint32_t)pctq- 1U) << USIC_CH_BRG_PCTQ_Pos))); +} + +/* Puts the data into FIFO if FIFO mode is enabled or else into standard buffers, by setting the proper mode. */ +void XMC_I2S_CH_Transmit(XMC_USIC_CH_t *const channel, const uint16_t data, const XMC_I2S_CH_CHANNEL_t channel_number) +{ + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while((uint32_t)XMC_USIC_CH_GetTransmitBufferStatus(channel) == (uint32_t)XMC_USIC_CH_TBUF_STATUS_BUSY) + { + } + + XMC_I2S_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2S_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[(uint32_t)channel_number << 4] = data; + } + else + { + channel->IN[(uint32_t)channel_number << 4] = data; + } +} + +/* Reads the data from the buffers based on the FIFO mode selection. */ +uint16_t XMC_I2S_CH_GetReceivedData(XMC_USIC_CH_t *const channel) +{ + uint16_t retval; + + /* Check FIFO size */ + if ((channel->RBCTR & USIC_CH_RBCTR_SIZE_Msk) == 0U) + { + retval = (uint16_t)channel->RBUF; + } + else + { + retval = (uint16_t)channel->OUTR; + } + + return retval; +} + +XMC_I2S_CH_STATUS_t XMC_I2S_CH_Stop(XMC_USIC_CH_t *const channel) +{ + XMC_I2S_CH_STATUS_t status = XMC_I2S_CH_STATUS_OK; + + if (((uint32_t)XMC_USIC_CH_GetTransmitBufferStatus(channel) & (uint32_t)XMC_USIC_CH_TBUF_STATUS_BUSY) != 0U) + { + status = XMC_I2S_CH_STATUS_BUSY; + } + else + { + /* USIC channel in IDLE mode */ + XMC_USIC_CH_SetMode(channel, XMC_USIC_CH_OPERATING_MODE_IDLE); + } + + return status; +} + +void XMC_I2S_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR |= (event&0x1fc00U); + channel->PCR_IISMode |= ((event >> 2U) & 0x8070U); +} + +void XMC_I2S_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR &= (uint32_t)~(event&0x1fc00U); + channel->PCR_IISMode &= (uint32_t)~((event >> 2U) & 0x8070U); +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_ledts.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_ledts.c new file mode 100644 index 00000000..72ac5cd6 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_ledts.c @@ -0,0 +1,383 @@ +/** + * @file xmc_ledts.c + * @date 2017-02-25 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * - New API added: XMC_LEDTS_SetActivePADNo()
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * 2017-02-25: + * - XMC_LEDTS_InitGlobal() fixed compilation warnings + * + * Detailed description of file:
+ * APIs for the functional blocks of LEDTS have been defined:
+ * -- GLOBAL (APIs prefixed with LEDTS_GLOBAL_)
+ * -- Clock configuration, Function/Event configuration, Interrupt configuration + * + * @endcond + * + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +#if defined(LEDTS0) +#include "xmc_scu.h" + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_LEDTS_CLOCK_NOT_RUNNING 0U + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * GLOBAL DATA + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * LOCAL/UTILITY ROUTINES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/** + * Initialization of global register + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitGlobal(XMC_LEDTS_t *const ledts, const XMC_LEDTS_GLOBAL_CONFIG_t *config) +{ + XMC_ASSERT("XMC_LEDTS_InitGlobal:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + XMC_ASSERT("XMC_LEDTS_InitGlobal:Null Pointer", (config != (XMC_LEDTS_GLOBAL_CONFIG_t *)NULL)); + + if (ledts == XMC_LEDTS0) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_LEDTS0); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_LEDTS0); +#endif + } +#if defined(LEDTS1) + else if (ledts == XMC_LEDTS1) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_LEDTS1); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_LEDTS1); +#endif + } +#endif +#if defined(LEDTS2) + else if (ledts == XMC_LEDTS2) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_LEDTS2); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_LEDTS2); +#endif + } +#endif + else + { + XMC_ASSERT("XMC_LEDTS_InitGlobal:Invalid Module Pointer", 0); + } + + if((ledts->GLOBCTL & LEDTS_GLOBCTL_CLK_PS_Msk) != XMC_LEDTS_CLOCK_NOT_RUNNING) + { + return XMC_LEDTS_STATUS_RUNNING; + } + + ledts->GLOBCTL = config->globctl; + + return XMC_LEDTS_STATUS_SUCCESS; +} + +/** + * Initialization of registers for LED-driving function + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitLED(XMC_LEDTS_t *const ledts, const XMC_LEDTS_LED_CONFIG_t *config) +{ + XMC_ASSERT("XMC_LEDTS_LED_Init:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + XMC_ASSERT("XMC_LEDTS_LED_Init:Null Pointer", (config != (XMC_LEDTS_LED_CONFIG_t *)NULL)); + + if((ledts->GLOBCTL & LEDTS_GLOBCTL_CLK_PS_Msk) != XMC_LEDTS_CLOCK_NOT_RUNNING) + { + return XMC_LEDTS_STATUS_RUNNING; + } + + ledts->FNCTL &= ~(LEDTS_FNCTL_COLLEV_Msk | LEDTS_FNCTL_NR_LEDCOL_Msk); + ledts->FNCTL |= (config->fnctl); + + /* Enable LED function */ + ledts->GLOBCTL |= LEDTS_GLOBCTL_LD_EN_Msk; + + return XMC_LEDTS_STATUS_SUCCESS; +} + +/** + * Initialization of registers for basic Touch-Sense control function + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitTSBasic(XMC_LEDTS_t *const ledts, const XMC_LEDTS_TS_CONFIG_BASIC_t *config) +{ + uint32_t reg; + + XMC_ASSERT("XMC_LEDTS_TS_Basic_Init:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + XMC_ASSERT("XMC_LEDTS_TS_Basic_Init:Null Pointer", (config != (XMC_LEDTS_TS_CONFIG_BASIC_t *)NULL)); + + if((ledts->GLOBCTL & LEDTS_GLOBCTL_CLK_PS_Msk) != XMC_LEDTS_CLOCK_NOT_RUNNING) + { + return XMC_LEDTS_STATUS_RUNNING; + } + + reg = ~(LEDTS_FNCTL_ACCCNT_Msk | LEDTS_FNCTL_TSCCMP_Msk | LEDTS_FNCTL_TSCTRR_Msk | LEDTS_FNCTL_TSCTRSAT_Msk | + LEDTS_FNCTL_NR_TSIN_Msk); + ledts->FNCTL &= (reg); + ledts->FNCTL |= (config->fnctl); + + /* Enable TS function */ + ledts->GLOBCTL |= LEDTS_GLOBCTL_TS_EN_Msk; + + return XMC_LEDTS_STATUS_SUCCESS; +} + +/** + * Initialization of registers for advanced Touch-Sense control function + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitTSAdvanced (XMC_LEDTS_t *const ledts, const XMC_LEDTS_TS_CONFIG_ADVANCED_t *config) +{ + uint32_t reg; + + XMC_ASSERT("XMC_LEDTS_TS_Advanced_Init:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + XMC_ASSERT("XMC_LEDTS_TS_Advanced_Init:Null Pointer", (config != (XMC_LEDTS_TS_CONFIG_ADVANCED_t *)NULL)); + + if((ledts->GLOBCTL & LEDTS_GLOBCTL_CLK_PS_Msk) != XMC_LEDTS_CLOCK_NOT_RUNNING) + { + return XMC_LEDTS_STATUS_RUNNING; + } + + reg = ~(LEDTS_GLOBCTL_MASKVAL_Msk | LEDTS_GLOBCTL_FENVAL_Msk); + ledts->GLOBCTL &= (reg); + ledts->GLOBCTL |= (config->globctl); + + reg = ~(LEDTS_FNCTL_PADT_Msk | LEDTS_FNCTL_PADTSW_Msk | LEDTS_FNCTL_EPULL_Msk | LEDTS_FNCTL_TSOEXT_Msk); + ledts->FNCTL &= (reg); + ledts->FNCTL |= (config->fnctl); + + return XMC_LEDTS_STATUS_SUCCESS; +} + +/** + * Starts LEDTS-counter + */ +void XMC_LEDTS_StartCounter(XMC_LEDTS_t *const ledts, const uint16_t prescaler) +{ + XMC_ASSERT("XMC_LEDTS_Start_Counter:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + ledts->GLOBCTL |= prescaler<<16U; +} + +/** + * Stops LEDTS-counter + */ +void XMC_LEDTS_StopCounter(XMC_LEDTS_t *const ledts) +{ + XMC_ASSERT("XMC_LEDTS_Stop_Counter:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + ledts->GLOBCTL &= 0x0000FFFF; +} + +/** + * Reads time interrupt flags + */ +uint32_t XMC_LEDTS_ReadInterruptFlag(XMC_LEDTS_t *const ledts) +{ + XMC_ASSERT("XMC_LEDTS_ReadInterruptFlag:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + return (ledts->EVFR & 0xF); +} + +/** + * Set the active pad number + */ +void XMC_LEDTS_SetActivePADNo(XMC_LEDTS_t *const ledts, XMC_LEDTS_NUMBER_TS_INPUT_t pad_num) +{ + uint32_t reg; + + XMC_ASSERT("XMC_LEDTS_SetActivePADNo:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + reg = ledts->FNCTL; + reg &= ~(LEDTS_FNCTL_PADT_Msk); + reg |= (uint32_t)pad_num; + ledts->FNCTL = reg; +} + +/** + * Clears interrupt indication flags + */ +void XMC_LEDTS_ClearInterruptFlag(XMC_LEDTS_t *const ledts, uint32_t interrupt_mask) +{ + XMC_ASSERT("XMC_LEDTS_ClearInterruptFlag:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + ledts->EVFR = (interrupt_mask << LEDTS_EVFR_CTSF_Pos); +} + +/** + * Programming of registers to output pattern on an LED column in LED matrix + */ +void XMC_LEDTS_SetLEDLinePattern(XMC_LEDTS_t *const ledts, XMC_LEDTS_LED_COLUMN_t column, const uint8_t pattern) +{ + uint32_t reg; + uint8_t reg_index = ((uint8_t)column) >> 2; + uint8_t bit_shift_count = ((uint8_t)column & 0x03) * 8; + + XMC_ASSERT("XMC_LEDTS_Set_LED_Line_Pattern:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + reg = ledts->LINE[reg_index]; + reg &= (~(0xff << bit_shift_count)); + reg |= pattern << bit_shift_count; + ledts->LINE[reg_index] = reg; + +} + +/** + * Programming of registers to adjust brightness of an LED column in LED matrix + */ +void XMC_LEDTS_SetColumnBrightness(XMC_LEDTS_t *const ledts, XMC_LEDTS_LED_COLUMN_t column, const uint8_t brightness) +{ + uint32_t reg; + uint8_t reg_index = ((uint8_t)column) >> 2; + uint8_t bit_shift_count = ((uint8_t)column & 0x03) * 8; + + XMC_ASSERT("XMC_LEDTS_Set_Column_Brightness:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + reg = ledts->LDCMP[reg_index]; + reg &= (~(0xff << bit_shift_count)); + reg |= brightness << bit_shift_count; + ledts->LDCMP[reg_index] = reg; +} + +/** + * Programming of registers to set common oscillation window size for touch-sense inputs + */ +void XMC_LEDTS_SetCommonOscillationWindow(XMC_LEDTS_t *const ledts, const uint8_t common_size) +{ + uint32_t reg; + + XMC_ASSERT("XMC_LEDTS_Set_Common_Oscillation_Window:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + reg = ledts->LDCMP[1]; + reg &= ~LEDTS_LDCMP1_CMP_LDA_TSCOM_Msk; + reg |= (common_size << LEDTS_LDCMP1_CMP_LDA_TSCOM_Pos); + ledts->LDCMP[1] = reg; +} + +/** + * Checking the previous active function or LED column status + */ +uint32_t XMC_LEDTS_ReadFNCOL(XMC_LEDTS_t *const ledts) +{ + uint32_t fncol_read; + + XMC_ASSERT("XMC_LEDTS_Read_FNCOL:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + fncol_read = ledts->FNCTL & LEDTS_FNCTL_FNCOL_Msk; + fncol_read >>= LEDTS_FNCTL_FNCOL_Pos; + + return fncol_read; +} + +/** + * Set the number of LED column Enabled + */ +void XMC_LEDTS_SetNumOfLEDColumns(XMC_LEDTS_t *const ledts, uint8_t count) +{ + + XMC_ASSERT("XMC_LEDTS_SetNumOfLEDColumns:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + ledts->FNCTL &= ~(LEDTS_FNCTL_NR_LEDCOL_Msk); + ledts->FNCTL |= (count << LEDTS_FNCTL_NR_LEDCOL_Pos); +} + +/** + * Reading recorded number of oscillation counts + */ +uint16_t XMC_LEDTS_ReadTSVAL(XMC_LEDTS_t *const ledts) +{ + uint16_t no_of_oscillations; + + XMC_ASSERT("XMC_LEDTS_Read_TSVAL:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + no_of_oscillations = (ledts->TSVAL & 0xFFFF); + + return no_of_oscillations; +} + +/** + * Programming of registers to adjust the size of oscillation window + */ +void XMC_LEDTS_SetOscillationWindow(XMC_LEDTS_t *const ledts, XMC_LEDTS_NUMBER_TS_INPUT_t touchpad, const uint8_t size) +{ + uint32_t reg; + uint8_t reg_index = ((uint8_t)touchpad) >> 2; + uint8_t bit_shift_count = ((uint8_t)touchpad & 0x03) * 8; + + XMC_ASSERT("XMC_LEDTS_Set_Oscillation_Window:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + reg = ledts->TSCMP[reg_index]; + reg &= (~(0xff << bit_shift_count)); + reg |= size << bit_shift_count; + ledts->TSCMP[reg_index] = reg; +} + +#endif /* LEDTS0 */ + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_math.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_math.c new file mode 100644 index 00000000..5af1191e --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_math.c @@ -0,0 +1,473 @@ + +/** + * @file xmc_math.c + * @date 2017-04-20 + * + * @cond + ********************************************************************************** + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification,are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share + * modifications, enhancements or bug fixes with Infineon Technologies AG + * dave@infineon.com). + ********************************************************************************** + * + * Change History + * -------------- + * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * - Updated copyright and change history section. + * + * 2015-09-23: + * - Added SQRT functions + * + * 2015-10-08: + * - Return values for sin(), cos(), sinh(), cosh(), arctan() are corrected. + * + * 2017-04-20: + * - Foward declaration of __aeabi_* to fix link time optimization (-flto) compilation errors + * + * @endcond + * + */ + +/** + * + * @brief MATH driver - API implementation for XMC13 family MATH libraries.
+ * + * Detailed description of file
+ * APIs provided in this file cover the following functional blocks of MATH:
+ * + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +#if defined (MATH) +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +/* Reciprocal of Circular gain in XMC_MATH_Q0_23_t format ((2^23)/1.646760258121) */ +#define XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023 (0x4DBA76U) +/* Reciprocal of Hyperbolic gain in XMC_MATH_Q1_22_t format ((2^22)/0.828159360960) */ +#define XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22 (0x4D47A1U) +/* Signed division is selected */ +#define XMC_MATH_SIGNED_DIVISION ((uint32_t) 0 << MATH_DIVCON_USIGN_Pos) +/* Unsigned division is selected */ +#define XMC_MATH_UNSIGNED_DIVISION ((uint32_t) 1 << MATH_DIVCON_USIGN_Pos) + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * GLOBAL DATA + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * LOCAL ROUTINES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * API IMPLEMENTATION - Utility functions + ********************************************************************************************************************/ + +/* Utility function to check if the DIV unit is busy */ +bool XMC_MATH_DIV_IsBusy(void) +{ + bool status; + if (MATH->DIVST & MATH_DIVST_BSY_Msk) + { + status = true; /* DIV unit is busy running a division operation */ + } + else + { + status = false; /* DIV unit is idle */ + } + + return (status); +} + +/* Utility function to check if the CORDIC unit is busy */ +bool XMC_MATH_CORDIC_IsBusy(void) +{ + bool status; + if (MATH->STATC & MATH_STATC_BSY_Msk) + { + status = true; /* CORDIC unit is busy running an operation */ + } + else + { + status = false; /* CORDIC unit is idle */ + } + + return (status); +} + +/* This functions returns the status of a requested event */ +bool XMC_MATH_GetEventStatus(const XMC_MATH_EVENT_t event) +{ + bool status; + if (MATH->EVFR & (uint32_t) event) + { + status = true; /* Requested event has been detected */ + } + else + { + status = false; /* Requested event has not been detected */ + } + return (status); +} + +#ifndef XMC_MATH_DISABLE_DIV_ABI + +/* Forward prototypes. */ +uint32_t __aeabi_uidiv(uint32_t dividend, uint32_t divisor) __attribute__((externally_visible)); +int32_t __aeabi_idiv(int32_t dividend, int32_t divisor) __attribute__((externally_visible)); +uint64_t __aeabi_uidivmod(uint32_t dividend, uint32_t divisor) __attribute__((externally_visible)); +int64_t __aeabi_idivmod(int32_t dividend, int32_t divisor) __attribute__((externally_visible)); + +/*********************************************************************************************************************** + * API IMPLEMENTATION - aeabi routines + **********************************************************************************************************************/ +/* This function performs unsigned integer division */ +uint32_t __aeabi_uidiv(uint32_t dividend, uint32_t divisor) +{ + MATH->DIVCON = XMC_MATH_UNSIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; + + return ((uint32_t) MATH->QUOT); +} + +/* This function performs signed integer division */ +int32_t __aeabi_idiv(int32_t dividend, int32_t divisor) +{ + MATH->DIVCON = XMC_MATH_SIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; + + return ((int32_t) MATH->QUOT); +} + +/* This function performs unsigned integer division modulo */ +uint64_t __aeabi_uidivmod(uint32_t dividend, uint32_t divisor) +{ + uint64_t remainder; + + MATH->DIVCON = XMC_MATH_UNSIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; + + remainder = ((uint64_t) MATH->RMD) << 32U; + return (remainder | MATH->QUOT); +} + +/* This function performs signed integer division modulo */ +int64_t __aeabi_idivmod(int32_t dividend, int32_t divisor) +{ + uint64_t remainder; + uint64_t result; + + MATH->DIVCON = XMC_MATH_SIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; + + remainder = ((uint64_t) MATH->RMD) << 32U; + result = (remainder | MATH->QUOT); + return ((int64_t) result); +} +#endif + +/*********************************************************************************************************************** + * API IMPLEMENTATION - Blocking functions + **********************************************************************************************************************/ +/* This function computes the cosine of a given angle in radians */ +XMC_MATH_Q0_23_t XMC_MATH_CORDIC_Cos(XMC_MATH_Q0_23_t angle_in_radians) +{ + int32_t result; + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t) angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023 << MATH_CORDX_DATA_Pos; + result = ((int32_t)MATH->CORRX) >> MATH_CORRX_RESULT_Pos; + return ((XMC_MATH_Q0_23_t) result); +} + +/* This function computes the sine of a given angle in radians */ +XMC_MATH_Q0_23_t XMC_MATH_CORDIC_Sin(XMC_MATH_Q0_23_t angle_in_radians) +{ + int32_t result; + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t)angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023 << MATH_CORDX_DATA_Pos; + result = ((int32_t)MATH->CORRY) >> MATH_CORRY_RESULT_Pos; + return ((XMC_MATH_Q0_23_t) result); +} + +/* This function computes the tangent of a given angle in radians */ +XMC_MATH_Q0_11_t XMC_MATH_CORDIC_Tan(XMC_MATH_Q0_23_t angle_in_radians) +{ + uint32_t result; + MATH->GLBCON = (uint32_t) XMC_MATH_DIV_DVDRC_CORRY_IS_SOURCE + \ + (uint32_t) XMC_MATH_DIV_DVSRC_CORRX_IS_SOURCE; /* Chain the results of CORDIC operation to DIV unit */ + MATH->DIVCON = (uint32_t) 11 << MATH_DIVCON_DVSSRC_Pos; /* Right Shifts Divisor by 11 places prior to division */ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t)angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023 << MATH_CORDX_DATA_Pos; + result = MATH->QUOT; + return ((XMC_MATH_Q0_11_t) result); +} + +/* This function computes the arc tangent of a given angle in radians */ +XMC_MATH_Q0_23_t XMC_MATH_CORDIC_ArcTan(XMC_MATH_Q8_15_t x, XMC_MATH_Q8_15_t y) +{ + uint32_t result; + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR; + MATH->CORDZ = 0U; /* Clear register */ + MATH->CORDY = ((uint32_t) y) << MATH_CORDY_DATA_Pos; + MATH->CORDX = ((uint32_t) x) << MATH_CORDX_DATA_Pos; + result = ((int32_t)MATH->CORRZ) >> MATH_CORRZ_RESULT_Pos; + return ((XMC_MATH_Q0_23_t) result); +} + +/* This function computes the hyperbolic cosine of a given angle in radians */ +XMC_MATH_Q1_22_t XMC_MATH_CORDIC_Cosh(XMC_MATH_Q0_23_t angle_in_radians) +{ + int32_t result; + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t) angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22 << MATH_CORDX_DATA_Pos; + result = ((int32_t)MATH->CORRX) >> MATH_CORRX_RESULT_Pos; + return ((XMC_MATH_Q1_22_t) result); +} + +/* This function computes the hyperbolic sine of a given angle in radians */ +XMC_MATH_Q1_22_t XMC_MATH_CORDIC_Sinh(XMC_MATH_Q0_23_t angle_in_radians) +{ + int32_t result; + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t)angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22 << MATH_CORDX_DATA_Pos; + result = ((int32_t)MATH->CORRY) >> MATH_CORRY_RESULT_Pos; + return ((XMC_MATH_Q1_22_t) result); +} + +/* This function computes the hyperbolic tangent of a given angle in radians */ +XMC_MATH_Q0_11_t XMC_MATH_CORDIC_Tanh(XMC_MATH_Q0_23_t angle_in_radians) +{ + uint32_t result; + MATH->GLBCON = (uint32_t) XMC_MATH_DIV_DVDRC_CORRY_IS_SOURCE + \ + (uint32_t) XMC_MATH_DIV_DVSRC_CORRX_IS_SOURCE; /* Chain the results of CORDIC operation to DIV unit */ + MATH->DIVCON = (uint32_t) 11 << MATH_DIVCON_DVSSRC_Pos; /* Right Shifts Divisor by 11 places prior to division */ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t) angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22 << MATH_CORDX_DATA_Pos; + result = MATH->QUOT; + return ((XMC_MATH_Q0_11_t) result); +} + +/*********************************************************************************************************************** + * API IMPLEMENTATION - Non blocking functions + **********************************************************************************************************************/ +/* This function computes the cosine of a given angle in radians */ +void XMC_MATH_CORDIC_CosNB(XMC_MATH_Q0_23_t angle_in_radians) +{ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t) angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023 << MATH_CORDX_DATA_Pos; +} + +/* This function computes the sine of a given angle in radians */ +void XMC_MATH_CORDIC_SinNB(XMC_MATH_Q0_23_t angle_in_radians) +{ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t)angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023 << MATH_CORDX_DATA_Pos; +} + +/* This function computes the tangent of a given angle in radians */ +void XMC_MATH_CORDIC_TanNB(XMC_MATH_Q0_23_t angle_in_radians) +{ + MATH->GLBCON = (uint32_t) XMC_MATH_DIV_DVDRC_CORRY_IS_SOURCE + \ + (uint32_t) XMC_MATH_DIV_DVSRC_CORRX_IS_SOURCE; /* Chain the results of CORDIC operation to DIV unit */ + MATH->DIVCON = (uint32_t) 11 << MATH_DIVCON_DVSSRC_Pos; /* Right Shifts Divisor by 11 places prior to division */ + + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t)angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023 << MATH_CORDX_DATA_Pos; +} + +/* This function computes the arc tangent of a given value */ +void XMC_MATH_CORDIC_ArcTanNB(XMC_MATH_Q8_15_t x, XMC_MATH_Q8_15_t y) +{ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR; + MATH->CORDZ = 0U; /* Clear register */ + MATH->CORDY = ((uint32_t) y) << MATH_CORDY_DATA_Pos; + MATH->CORDX = ((uint32_t) x) << MATH_CORDX_DATA_Pos; +} + +/* This function computes the hyperbolic cosine of a given angle in radians */ +void XMC_MATH_CORDIC_CoshNB(XMC_MATH_Q0_23_t angle_in_radians) +{ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t)angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22 << MATH_CORDX_DATA_Pos; +} + +/* This function computes the hyperbolic sine of a given angle in radians */ +void XMC_MATH_CORDIC_SinhNB(XMC_MATH_Q0_23_t angle_in_radians) +{ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t)angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22 << MATH_CORDX_DATA_Pos; +} + +/* This function computes the hyperbolic tangent of a given angle in radians */ +void XMC_MATH_CORDIC_TanhNB(XMC_MATH_Q0_23_t angle_in_radians) +{ + MATH->GLBCON = (uint32_t) XMC_MATH_DIV_DVDRC_CORRY_IS_SOURCE + \ + (uint32_t) XMC_MATH_DIV_DVSRC_CORRX_IS_SOURCE; /* Chain the results of CORDIC operation to DIV unit */ + MATH->DIVCON = (uint32_t) 11 << MATH_DIVCON_DVSSRC_Pos; /* Right Shifts Divisor by 11 places prior to division */ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t) angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22 << MATH_CORDX_DATA_Pos; +} + +/* This function performs division for given two unsigned arguments */ +void XMC_MATH_DIV_UnsignedDivNB(uint32_t dividend, uint32_t divisor) +{ + MATH->DIVCON = XMC_MATH_UNSIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; +} + +/* This function performs division for given two signed arguments */ +void XMC_MATH_DIV_SignedDivNB(int32_t dividend, int32_t divisor) +{ + MATH->DIVCON = XMC_MATH_SIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; +} + +/* This function performs modulo operation for given two unsigned arguments */ +void XMC_MATH_DIV_UnsignedModNB(uint32_t dividend, uint32_t divisor) +{ + MATH->DIVCON = XMC_MATH_UNSIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; +} + +/* This function performs modulo operation for given two signed arguments */ +void XMC_MATH_DIV_SignedModNB(int32_t dividend, int32_t divisor) +{ + MATH->DIVCON = XMC_MATH_SIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; +} + +int16_t XMC_MATH_CORDIC_Q15_Sqrt(int16_t x) +{ + int32_t temp; + MATH->STATC = 0U; /* Clear register */ + + MATH->CON = (uint32_t)XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC | + (uint32_t)XMC_MATH_CORDIC_ROTVEC_MODE_VECTORING; + + temp = (int32_t)x << 15; /* Q30 to handle numbers > 1.0 */ + + MATH->CORDY = (temp - 0x10000000U); /* x - 0.25 */ + MATH->CORDX = (temp + 0x10000000U); /* x + 0.25 */ + + return (int16_t)(((MATH->CORRX >> 14) * 39568) >> 16); /* Q16 * Q15 */ +} + +int32_t XMC_MATH_CORDIC_Q31_Sqrt(int32_t x) +{ + MATH->STATC = 0U; /* Clear register */ + + MATH->CON = (uint32_t)XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC | + (uint32_t)XMC_MATH_CORDIC_ROTVEC_MODE_VECTORING; + + x >>= 1; /* Q30 to handle numbers > 1.0 */ + + MATH->CORDY = (x - 0x10000000U); /* x - 0.25 */ + MATH->CORDX = (x + 0x10000000U); /* x + 0.25 */ + + return ((MATH->CORRX >> 14) * 39568); /* Q16 * Q15 */ +} + +#endif /* end of #if defined (MATH) */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_pau.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_pau.c new file mode 100644 index 00000000..ccb37ff4 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_pau.c @@ -0,0 +1,109 @@ +/** + * @file xmc_pau.c + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-06-20: + * - Removed GetDriverVersion API + * @endcond + * + */ + +/** + * + * @brief PAU driver for XMC1 microcontroller family. + * + */ + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ +#include "xmc_pau.h" + +#if defined(PAU) + +/********************************************************************************************************************** + * API IMPLEMENTATION + *********************************************************************************************************************/ + +/* + * Enable peripheral access + */ +void XMC_PAU_EnablePeripheralAccess(XMC_PAU_PERIPHERAL_t peripheral) +{ + uint32_t reg_num; + + reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U; + XMC_PAU->PRIVDIS[reg_num] &= (uint32_t)~((uint32_t)peripheral & 0x0fffffffUL); +} + +/* + * Disable peripheral access + */ +void XMC_PAU_DisablePeripheralAccess(XMC_PAU_PERIPHERAL_t peripheral) +{ + uint32_t reg_num; + + reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U; + XMC_PAU->PRIVDIS[reg_num] |= (uint32_t)((uint32_t)peripheral & 0x0fffffffUL); +} + +/* + * Check if peripheral access is enabled + */ +bool XMC_PAU_IsPeripheralAccessEnabled(XMC_PAU_PERIPHERAL_t peripheral) +{ + uint32_t reg_num; + + reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U; + return (bool)(XMC_PAU->PRIVDIS[reg_num] & ((uint32_t)peripheral & 0x0fffffffUL)); +} + +/* + * Check if peripheral is available + */ +bool XMC_PAU_IsPeripheralAvailable(XMC_PAU_PERIPHERAL_t peripheral) +{ + uint32_t reg_num; + + reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U; + return (bool)(XMC_PAU->AVAIL[reg_num] & ((uint32_t)peripheral & 0x0fffffffUL)); +} + +#endif /* defined(PAU) */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_posif.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_posif.c new file mode 100644 index 00000000..a8b50a22 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_posif.c @@ -0,0 +1,275 @@ +/** + * @file xmc_posif.c + * @date 2017-02-25 + * + * @cond + ********************************************************************************** + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification,are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share + * modifications, enhancements or bug fixes with Infineon Technologies AG + * dave@infineon.com). + ********************************************************************************** + * + * Change History + * -------------- + * + * 2015-02-18: + * - Initial version + * + * 2015-02-20: + * - Driver description added
+ * + * 2015-04-30: + * - XMC_POSIF_Enable and XMC_POSIF_Disable APIs updated for POSIF1 peripheral check
+ * + * 2015-06-19: + * - Removed GetDriverVersion API
+ * + * 2017-02-25: + * - XMC_POSIF_Enable() and XMC_POSIF_Disable() fixed compilation warnings + * + * @endcond + * + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +/* POSIF is not available on XMC1100 and XMC1200 */ +#if defined(POSIF0) +#include + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_POSIF_PCONF_INSEL_Msk (0x3fUL << POSIF_PCONF_INSEL0_Pos) /*< Mask for input pins selection */ +#define XMC_POSIF_INSEL_MAX (4U) /*< Maximum possible input selector */ + +/********************************************************************************************************************* + * LOCAL ROUTINES + ********************************************************************************************************************/ +#ifdef XMC_ASSERT_ENABLE +__STATIC_INLINE bool XMC_POSIF_IsPeripheralValid(const XMC_POSIF_t *const peripheral) +{ + bool tmp; + + tmp = (peripheral == POSIF0); +#if defined(POSIF1) + tmp |= (peripheral == POSIF1); +#endif + + return tmp; +} +#endif +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* API to enable the POSIF module */ +void XMC_POSIF_Enable(XMC_POSIF_t *const peripheral) +{ +#if UC_FAMILY == XMC4 + XMC_SCU_CLOCK_EnableClock(XMC_SCU_CLOCK_CCU); +#endif + + if (peripheral == POSIF0) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_POSIF0); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_POSIF0); +#endif + } +#if defined(POSIF1) + else if (peripheral == POSIF1) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_POSIF1); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_POSIF1); +#endif + } +#endif + else + { + XMC_ASSERT("XMC_POSIF_Disable:Invalid module pointer", 0); + } +} + +/* API to disable the POSIF module */ +void XMC_POSIF_Disable(XMC_POSIF_t *const peripheral) +{ + if (peripheral == POSIF0) + { +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_POSIF0); +#endif +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_POSIF0); +#endif + } +#if defined(POSIF1) + else if (peripheral == POSIF1) + { +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_POSIF1); +#endif +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_POSIF1); +#endif + } +#endif + else + { + XMC_ASSERT("XMC_POSIF_Disable:Invalid module pointer", 0); + } +} + +/* API to initialize POSIF global resources */ +void XMC_POSIF_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_CONFIG_t *const config) +{ + XMC_ASSERT("XMC_POSIF_Init:Invalid module pointer", XMC_POSIF_IsPeripheralValid(peripheral)); + XMC_ASSERT("XMC_POSIF_Init:NULL Pointer", (config != (XMC_POSIF_CONFIG_t *)NULL) ); + + /* Enable the POSIF module */ + XMC_POSIF_Enable(peripheral); + + /* Stop POSIF */ + XMC_POSIF_Stop(peripheral); + + /* Program the operational mode, input selectors and debounce filter */ + peripheral->PCONF = config->pconf; +} + +/* API to initialize hall sensor interface */ +XMC_POSIF_STATUS_t XMC_POSIF_HSC_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_HSC_CONFIG_t * const config) +{ + XMC_POSIF_STATUS_t retval; + + XMC_ASSERT("XMC_POSIF_HSC_Init:Invalid module pointer\n", XMC_POSIF_IsPeripheralValid(peripheral)); + XMC_ASSERT("XMC_POSIF_HSC_Init:NULL Pointer\n", (config != (XMC_POSIF_HSC_CONFIG_t *)NULL) ); + + if (XMC_POSIF_MODE_HALL_SENSOR == (XMC_POSIF_MODE_t)((peripheral->PCONF) & (uint32_t)POSIF_PCONF_FSEL_Msk) ) + { + peripheral->PCONF |= config->hall_config; + retval = XMC_POSIF_STATUS_OK; + } + else + { + retval = XMC_POSIF_STATUS_ERROR; + } + return retval; +} + +/* API to initialize quadrature decoder interface */ +XMC_POSIF_STATUS_t XMC_POSIF_QD_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_QD_CONFIG_t * const config) +{ + uint8_t reg; + XMC_POSIF_STATUS_t retval; + + XMC_ASSERT("XMC_POSIF_QD_Init:Invalid module pointer", XMC_POSIF_IsPeripheralValid(peripheral)); + XMC_ASSERT("XMC_POSIF_QD_Init:NULL Pointer", (config != (XMC_POSIF_QD_CONFIG_t *)NULL) ); + + reg = (uint8_t)((peripheral->PCONF) & (uint32_t)POSIF_PCONF_FSEL_Msk); + if (((uint32_t)XMC_POSIF_MODE_QD == reg) || ((uint32_t)XMC_POSIF_MODE_MCM_QD == reg)) + { + /* Program the quadrature mode */ + peripheral->PCONF |= (uint32_t)(config->mode) << POSIF_PCONF_QDCM_Pos; + peripheral->QDC = config->qdc; + retval = XMC_POSIF_STATUS_OK; + } + else + { + retval = XMC_POSIF_STATUS_ERROR; + } + + return retval; +} + +/* API to initialize multi-channel mode. + * This is used in Hall mode, standalone multi-channel mode and quadrature with multi-channel mode + */ +XMC_POSIF_STATUS_t XMC_POSIF_MCM_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_MCM_CONFIG_t * const config) +{ + XMC_POSIF_STATUS_t retval; + + XMC_ASSERT("XMC_POSIF_MCM_Init:Invalid module pointer", XMC_POSIF_IsPeripheralValid(peripheral)); + XMC_ASSERT("XMC_POSIF_MCM_Init:NULL Pointer", (config != (XMC_POSIF_MCM_CONFIG_t *)NULL) ); + + if ((XMC_POSIF_MODE_t)((peripheral->PCONF) & (uint32_t)POSIF_PCONF_FSEL_Msk) != XMC_POSIF_MODE_QD) + { + peripheral->PCONF |= config->mcm_config; + retval = XMC_POSIF_STATUS_OK; + } + else + { + retval = XMC_POSIF_STATUS_ERROR; + } + return retval; +} + +/* API to configure input source */ +void XMC_POSIF_SelectInputSource (XMC_POSIF_t *const peripheral, const XMC_POSIF_INPUT_PORT_t input0, + const XMC_POSIF_INPUT_PORT_t input1, const XMC_POSIF_INPUT_PORT_t input2) +{ + uint32_t reg; + XMC_ASSERT("XMC_POSIF_SelectInputSource:Invalid module pointer", XMC_POSIF_IsPeripheralValid(peripheral)); + XMC_ASSERT("XMC_POSIF_SelectInputSource:Wrong input port input0", (input0 < XMC_POSIF_INSEL_MAX)); + XMC_ASSERT("XMC_POSIF_SelectInputSource:Wrong input port input1", (input1 < XMC_POSIF_INSEL_MAX)); + XMC_ASSERT("XMC_POSIF_SelectInputSource:Wrong input port input2", (input2 < XMC_POSIF_INSEL_MAX)); + + reg = (uint32_t)((((uint32_t)input0 << POSIF_PCONF_INSEL0_Pos) & (uint32_t)POSIF_PCONF_INSEL0_Msk) | + (((uint32_t)input1 << POSIF_PCONF_INSEL1_Pos) & (uint32_t)POSIF_PCONF_INSEL1_Msk) | + (((uint32_t)input2 << POSIF_PCONF_INSEL2_Pos) & (uint32_t)POSIF_PCONF_INSEL2_Msk)); + peripheral->PCONF = ((peripheral->PCONF & ~(uint32_t)XMC_POSIF_PCONF_INSEL_Msk) | reg); +} + +/* API to select an interrupt node */ +void XMC_POSIF_SetInterruptNode(XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event, const XMC_POSIF_SR_ID_t sr) +{ + uint32_t reg; + + XMC_ASSERT("XMC_POSIF_SetInterruptNode:Invalid module pointer", XMC_POSIF_IsPeripheralValid(peripheral)); + XMC_ASSERT("XMC_POSIF_SetInterruptNode:Wrong IRQ event", (event <= XMC_POSIF_IRQ_EVENT_PCLK) ); + XMC_ASSERT("XMC_POSIF_SetInterruptNode:Wrong SR ID", (sr <= XMC_POSIF_SR_ID_1) ); + + reg = peripheral->PFLGE; + reg &= ~((uint32_t)1 << ((uint32_t)event + (uint32_t)POSIF_PFLGE_CHESEL_Pos)); + reg |= (uint32_t)sr << ((uint32_t)event + (uint32_t)POSIF_PFLGE_CHESEL_Pos); + peripheral->PFLGE = reg; +} +#endif /* #if defined(POSIF0) */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_prng.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_prng.c new file mode 100644 index 00000000..9685ba8d --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_prng.c @@ -0,0 +1,107 @@ + +/** + * @file xmc_prng.c + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * - Removed GetDriverVersion API
+ * + * 2015-06-20 + * - Removed definition of GetDriverVersion API
+ * + * @endcond + */ + +#include "xmc_prng.h" + +#if defined (PRNG) + +/********************************************************************************************************************* + * API IMPLEMENTATION + *********************************************************************************************************************/ + +/* + * Initializes the PRNG peripheral with the settings in the + * initialization structure XMC_PRNG_INIT_t + */ +XMC_PRNG_INIT_STATUS_t XMC_PRNG_Init(const XMC_PRNG_INIT_t *prng) +{ + volatile uint16_t read_warm_up; + uint16_t reg_val, iter; + XMC_PRNG_INIT_STATUS_t status = XMC_PRNG_INITIALIZED; + + XMC_ASSERT("XMC_PRNG_Init:Null Pointer", (prng != (XMC_PRNG_INIT_t *)NULL)); + + /* Configure block size for key loading mode */ + XMC_PRNG_SetRandomDataBlockSize(XMC_PRNG_RDBS_WORD); + + /* Enable key loading mode */ + XMC_PRNG_EnableKeyLoadingMode(); + + /* Load key words (80 bits) and wait till RDV is set */ + for (iter = (uint16_t)0UL; iter < (uint16_t)5UL; iter++) + { + XMC_PRNG_LoadKeyWords(prng->key_words[iter]); + while (PRNG_CHK_RDV_Msk != XMC_PRNG_CheckValidStatus()); + } + + XMC_PRNG_EnableStreamingMode(); + + /* Warm up phase: Read and discard 64 bits */ + read_warm_up = PRNG->WORD; + read_warm_up = PRNG->WORD; + read_warm_up = PRNG->WORD; + reg_val = PRNG->WORD; + read_warm_up &= reg_val; + + /* Configure block size either byte (8 bit) or word (16 bit) */ + XMC_PRNG_SetRandomDataBlockSize(prng->block_size); + + /* + * Checks for reset value for "random data block size". If reset, + * PRNG is not initialized + */ + if ((uint16_t)XMC_PRNG_RDBS_RESET == (PRNG->CTRL & (uint16_t)PRNG_CTRL_RDBS_Msk)) + { + status = XMC_PRNG_NOT_INITIALIZED; + } + + return status; +} + +#endif /* #if defined (PRNG) */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_rtc.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_rtc.c new file mode 100644 index 00000000..6a115952 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_rtc.c @@ -0,0 +1,298 @@ +/** + * @file xmc_rtc.c + * @date 2015-05-19 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-06-20: + * - Removed GetDriverVersion API + * + * 2016-05-19: + * - Added XMC_RTC_SetTimeStdFormat() and XMC_RTC_SetAlarmStdFormat() + * + * @endcond + * + */ + +/** + * + * @brief RTC driver for XMC microcontroller family. + * + */ + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ + +#include "xmc_scu.h" +#include "xmc_rtc.h" + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ + +#define XMC_RTC_MAXSECONDS (59U) /**< RTC time : Maximum seconds */ +#define XMC_RTC_MAXMINUTES (59U) /**< RTC time : Maximum minutes */ +#define XMC_RTC_MAXHOURS (23U) /**< RTC time : Maximum hours */ +#define XMC_RTC_MAXDAYS (31U) /**< RTC time : Maximum days */ +#define XMC_RTC_MAXDAYSOFWEEK (7U) /**< RTC time : Maximum days of week */ +#define XMC_RTC_MAXMONTH (12U) /**< RTC time : Maximum month */ +#define XMC_RTC_MAXYEAR (0xFFFFU) /**< RTC time : Maximum year */ +#define XMC_RTC_MAXPRESCALER (0xFFFFU) /**< RTC time : Maximum prescaler */ +#define XMC_RTC_YEAR_OFFSET (1900U) /**< RTC year offset : Year offset */ + +#if (UC_FAMILY == XMC4) +#define XMC_RTC_INIT_SEQUENCE (1U) +#endif +#if (UC_FAMILY == XMC1) +#define XMC_RTC_INIT_SEQUENCE (0U) +#endif + +/********************************************************************************************************************* + * API IMPLEMENTATION + *********************************************************************************************************************/ + +/* + * Enables RTC peripheral to start counting time + */ +void XMC_RTC_Start(void) +{ + while((XMC_SCU_GetMirrorStatus() & SCU_GENERAL_MIRRSTS_RTC_CTR_Msk) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->CTR |= (uint32_t)RTC_CTR_ENB_Msk; +} + +/* + * Disables RTC peripheral to start counting time + */ +void XMC_RTC_Stop(void) +{ + while((XMC_SCU_GetMirrorStatus() & SCU_GENERAL_MIRRSTS_RTC_CTR_Msk) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->CTR &= ~(uint32_t)RTC_CTR_ENB_Msk; +} + +/* + * Sets the RTC module prescaler value + */ +void XMC_RTC_SetPrescaler(uint16_t prescaler) +{ + XMC_ASSERT("XMC_RTC_SetPrescaler:Wrong prescaler value", (prescaler < XMC_RTC_MAXPRESCALER)); + + while((XMC_SCU_GetMirrorStatus() & SCU_GENERAL_MIRRSTS_RTC_CTR_Msk) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->CTR = (RTC->CTR & ~(uint32_t)RTC_CTR_DIV_Msk) | + ((uint32_t)prescaler << (uint32_t)RTC_CTR_DIV_Pos); +} + +/* + * Sets the RTC_TIM0, RTC_TIM1 registers with time values + */ +void XMC_RTC_SetTime(const XMC_RTC_TIME_t *const time) +{ + XMC_ASSERT("XMC_RTC_SetTime:Wrong seconds value", ((uint32_t)time->seconds < XMC_RTC_MAXSECONDS)); + XMC_ASSERT("XMC_RTC_SetTime:Wrong minutes value", ((uint32_t)time->minutes < XMC_RTC_MAXMINUTES)); + XMC_ASSERT("XMC_RTC_SetTime:Wrong hours value", ((uint32_t)time->hours < XMC_RTC_MAXHOURS)); + XMC_ASSERT("XMC_RTC_SetTime:Wrong month day value", ((uint32_t)time->days < XMC_RTC_MAXDAYS)); + XMC_ASSERT("XMC_RTC_SetTime:Wrong week day value", ((uint32_t)time->daysofweek < XMC_RTC_MAXDAYSOFWEEK)); + XMC_ASSERT("XMC_RTC_SetTime:Wrong month value", ((uint32_t)time->month < XMC_RTC_MAXMONTH)); + XMC_ASSERT("XMC_RTC_SetTime:Wrong year value", ((uint32_t)time->year < XMC_RTC_MAXYEAR)); + + #if (XMC_RTC_INIT_SEQUENCE == 1U) + while ((XMC_SCU_GetMirrorStatus() & SCU_GENERAL_MIRRSTS_RTC_TIM0_Msk) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->TIM0 = time->raw0; + + while ((XMC_SCU_GetMirrorStatus() & SCU_GENERAL_MIRRSTS_RTC_TIM1_Msk) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->TIM1 = time->raw1; + #endif + #if (XMC_RTC_INIT_SEQUENCE == 0U) + while ((XMC_SCU_GetMirrorStatus() & (SCU_GENERAL_MIRRSTS_RTC_TIM0_Msk | SCU_GENERAL_MIRRSTS_RTC_TIM1_Msk)) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->TIM0 = time->raw0; + RTC->TIM1 = time->raw1; ; + #endif +} + +/* + * Gets the RTC module time value + */ +void XMC_RTC_GetTime(XMC_RTC_TIME_t *const time) +{ + time->raw0 = RTC->TIM0; + time->raw1 = RTC->TIM1; +} + +/* + * Sets the RTC module time values in standard format + */ +void XMC_RTC_SetTimeStdFormat(const struct tm *const stdtime) +{ + + XMC_RTC_TIME_t time; + + time.seconds = stdtime->tm_sec; + time.minutes = stdtime->tm_min; + time.hours = stdtime->tm_hour; + time.days = stdtime->tm_mday - 1; + time.month = stdtime->tm_mon; + time.year = stdtime->tm_year + XMC_RTC_YEAR_OFFSET; + time.daysofweek = stdtime->tm_wday; + + XMC_RTC_SetTime(&time); +} + +/* + * Gets the RTC module time values in standard format + */ +void XMC_RTC_GetTimeStdFormat(struct tm *const stdtime) +{ + XMC_RTC_TIME_t time; + time.raw0 = RTC->TIM0; + time.raw1 = RTC->TIM1; + + stdtime->tm_sec = (int8_t)time.seconds; + stdtime->tm_min = (int8_t)time.minutes; + stdtime->tm_hour = (int8_t)time.hours; + stdtime->tm_mday = ((int8_t)time.days + (int8_t)1); + stdtime->tm_mon = (int8_t)time.month; + stdtime->tm_year = (int32_t)time.year - (int32_t)XMC_RTC_YEAR_OFFSET; + stdtime->tm_wday = (int8_t)time.daysofweek; +} + +/* + * Sets the RTC module alarm time value + */ +void XMC_RTC_SetAlarm(const XMC_RTC_ALARM_t *const alarm) +{ + XMC_ASSERT("XMC_RTC_SetAlarm:Wrong seconds value", ((uint32_t)alarm->seconds < XMC_RTC_MAXSECONDS)); + XMC_ASSERT("XMC_RTC_SetAlarm:Wrong minutes value", ((uint32_t)alarm->minutes < XMC_RTC_MAXMINUTES)); + XMC_ASSERT("XMC_RTC_SetAlarm:Wrong hours value", ((uint32_t)alarm->hours < XMC_RTC_MAXHOURS)); + XMC_ASSERT("XMC_RTC_SetAlarm:Wrong days value", ((uint32_t)alarm->days < XMC_RTC_MAXDAYS)); + XMC_ASSERT("XMC_RTC_SetAlarm:Wrong month value", ((uint32_t)alarm->month < XMC_RTC_MAXMONTH)); + XMC_ASSERT("XMC_RTC_SetAlarm:Wrong year value", ((uint32_t)alarm->year < XMC_RTC_MAXYEAR)); + + #if (XMC_RTC_INIT_SEQUENCE == 1U) + while ((XMC_SCU_GetMirrorStatus() & SCU_GENERAL_MIRRSTS_RTC_ATIM0_Msk) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->ATIM0 = alarm->raw0; + + while ((XMC_SCU_GetMirrorStatus() & SCU_GENERAL_MIRRSTS_RTC_ATIM1_Msk) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->ATIM1 = alarm->raw1; + #endif + #if (XMC_RTC_INIT_SEQUENCE == 0U) + while ((XMC_SCU_GetMirrorStatus() & (SCU_GENERAL_MIRRSTS_RTC_ATIM0_Msk | SCU_GENERAL_MIRRSTS_RTC_ATIM1_Msk)) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->ATIM0 = alarm->raw0; + RTC->ATIM1 = alarm->raw1; + #endif +} + +/* + * Gets the RTC module alarm time value + */ +void XMC_RTC_GetAlarm(XMC_RTC_ALARM_t *const alarm) +{ + alarm->raw0 = RTC->ATIM0; + alarm->raw1 = RTC->ATIM1; +} + + +/* + * Sets the RTC module alarm time value in standard format + */ +void XMC_RTC_SetAlarmStdFormat(const struct tm *const stdtime) +{ + XMC_RTC_ALARM_t alarm; + + + alarm.seconds = stdtime->tm_sec; + alarm.minutes = stdtime->tm_min; + alarm.hours = stdtime->tm_hour; + alarm.days = stdtime->tm_mday - 1; + alarm.month = stdtime->tm_mon; + alarm.year = stdtime->tm_year + XMC_RTC_YEAR_OFFSET; + + XMC_RTC_SetAlarm(&alarm); +} + +/* + * Gets the RTC module alarm time value in standard format + */ +void XMC_RTC_GetAlarmStdFormat(struct tm *const stdtime) +{ + XMC_RTC_ALARM_t alarm; + + alarm.raw0 = RTC->ATIM0; + alarm.raw1 = RTC->ATIM1; + + stdtime->tm_sec = (int8_t)alarm.seconds; + stdtime->tm_min = (int8_t)alarm.minutes; + stdtime->tm_hour = (int8_t)alarm.hours; + stdtime->tm_mday = ((int8_t)alarm.days + (int8_t)1); + stdtime->tm_mon = (int8_t)alarm.month; + stdtime->tm_year = (int32_t)alarm.year - (int32_t)XMC_RTC_YEAR_OFFSET; +} + +/* + * Gets the RTC periodic and alarm event(s) status + */ +uint32_t XMC_RTC_GetEventStatus(void) +{ + return RTC->STSSR; +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_spi.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_spi.c new file mode 100644 index 00000000..8d324a32 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_spi.c @@ -0,0 +1,279 @@ +/** + * @file xmc_spi.c + * @date 2015-11-04 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-05-20: + * - Modified XMC_SPI_CH_Stop() API for not setting to IDLE the channel if it is busy + * - Modified XMC_SPI_CH_SetInterwordDelay() implementation in order to gain accuracy
+ * + * 2015-06-20: + * - Removed GetDriverVersion API
+ * + * 2015-09-01: + * - Modified XMC_SPI_CH_EnableEvent() and XMC_SPI_CH_DisableEvent() for supporting multiple events configuration
+ * + * 2015-11-04: + * - Modified the check of XMC_USIC_CH_GetTransmitBufferStatus() in the XMC_SPI_CH_Transmit() flag
+ * @endcond + * + */ +/** + * + * @brief SPI driver for XMC microcontroller family + * + */ +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ + +#include +#include + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_SPI_CH_OVERSAMPLING (2UL) + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* Initializes the selected SPI channel with the config structure. */ +void XMC_SPI_CH_Init(XMC_USIC_CH_t *const channel, const XMC_SPI_CH_CONFIG_t *const config) +{ + XMC_USIC_CH_Enable(channel); + + if(config->bus_mode == XMC_SPI_CH_BUS_MODE_MASTER) + { + /* Configure baud rate */ + (void)XMC_USIC_CH_SetBaudrate(channel, config->baudrate, XMC_SPI_CH_OVERSAMPLING); + } + + /* Configuration of USIC Shift Control */ + /* Transmission Mode (TRM) = 1 */ + /* Passive Data Level (PDL) = 1 */ + channel->SCTR = USIC_CH_SCTR_PDL_Msk | + (0x1UL << USIC_CH_SCTR_TRM_Pos) | + (0x3fUL << USIC_CH_SCTR_FLE_Pos)| + (0x7UL << USIC_CH_SCTR_WLE_Pos); + + /* Configuration of USIC Transmit Control/Status Register */ + /* TBUF Data Enable (TDEN) = 1 */ + /* TBUF Data Single Shot Mode (TDSSM) = 1 */ + channel->TCSR = (uint32_t)(USIC_CH_TCSR_HPCMD_Msk | + (0x01UL << USIC_CH_TCSR_TDEN_Pos) | + USIC_CH_TCSR_TDSSM_Msk); + + if(config->bus_mode == XMC_SPI_CH_BUS_MODE_MASTER) + { + /* Configuration of Protocol Control Register */ + channel->PCR_SSCMode = (uint32_t)(USIC_CH_PCR_SSCMode_MSLSEN_Msk | + USIC_CH_PCR_SSCMode_SELCTR_Msk | + (uint32_t)config->selo_inversion | + USIC_CH_PCR_SSCMode_FEM_Msk); + } + + /* Clear protocol status */ + channel->PSCR = 0xFFFFFFFFUL; + + /* Set parity settings */ + channel->CCR = (uint32_t)config->parity_mode; +} + +XMC_SPI_CH_STATUS_t XMC_SPI_CH_SetBaudrate(XMC_USIC_CH_t *const channel, const uint32_t rate) +{ + XMC_SPI_CH_STATUS_t status; + + status = XMC_SPI_CH_STATUS_ERROR; + + if (rate <= (XMC_SCU_CLOCK_GetPeripheralClockFrequency() >> 1U)) + { + if (XMC_USIC_CH_SetBaudrate(channel, rate, XMC_SPI_CH_OVERSAMPLING) == XMC_USIC_CH_STATUS_OK) + { + status = XMC_SPI_CH_STATUS_OK; + } + } + return status; +} + +/* Enable the selected slave signal by setting (SELO) bits in PCR register. */ +void XMC_SPI_CH_EnableSlaveSelect(XMC_USIC_CH_t *const channel, const XMC_SPI_CH_SLAVE_SELECT_t slave) +{ + /* Configuration of Protocol Control Register */ + channel->PCR_SSCMode &= (uint32_t)~USIC_CH_PCR_SSCMode_SELO_Msk; + channel->PCR_SSCMode |= (uint32_t)slave; +} + +/* Disable the slave signals by clearing (SELO) bits in PCR register. */ +void XMC_SPI_CH_DisableSlaveSelect(XMC_USIC_CH_t *const channel) +{ + XMC_SPI_CH_ClearStatusFlag(channel, (uint32_t)XMC_SPI_CH_STATUS_FLAG_MSLS); + + /* Configuration of Protocol Control Register */ + channel->PCR_SSCMode &= (uint32_t)~USIC_CH_PCR_SSCMode_SELO_Msk; +} + +/* Puts the data into FIFO if FIFO mode is enabled or else into standard buffers, by setting the proper mode. */ +void XMC_SPI_CH_Transmit(XMC_USIC_CH_t *const channel, const uint16_t data, const XMC_SPI_CH_MODE_t mode) +{ + + channel->CCR = (channel->CCR & (uint32_t)(~USIC_CH_CCR_HPCEN_Msk)) | + (((uint32_t) mode << USIC_CH_CCR_HPCEN_Pos) & (uint32_t)USIC_CH_CCR_HPCEN_Msk); + + + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while((uint32_t)XMC_USIC_CH_GetTransmitBufferStatus(channel) == (uint32_t)XMC_USIC_CH_TBUF_STATUS_BUSY) + { + } + + XMC_SPI_CH_ClearStatusFlag(channel, (uint32_t)XMC_SPI_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[mode] = data; + } + else + { + channel->IN[mode] = data; + } +} + +/* Reads the data from the buffers based on the FIFO mode selection. */ +uint16_t XMC_SPI_CH_GetReceivedData(XMC_USIC_CH_t *const channel) +{ + uint16_t retval; + + /* Check FIFO size */ + if ((channel->RBCTR & USIC_CH_RBCTR_SIZE_Msk) == 0U) + { + retval = (uint16_t)channel->RBUF; + } + else + { + retval = (uint16_t)channel->OUTR; + } + + return retval; +} + +/* Configures the inter word delay by setting PCR.PCTQ1, PCR.DCTQ1 bit fields. */ +void XMC_SPI_CH_SetInterwordDelay(XMC_USIC_CH_t *const channel,uint32_t tinterword_delay_us) +{ + uint32_t peripheral_clock; + uint32_t pdiv; + uint32_t step; + uint32_t fFD; + uint32_t fpdiv; + uint32_t divider_factor1 = 0U; + uint32_t divider_factor2 = 32U; + uint32_t divider_factor1_int = 0U; + uint32_t divider_factor1_int_min = 4U; + uint32_t divider_factor1_frac_min =100U; + uint32_t divider_factor1_frac = 0U; + uint32_t divider_factor2_temp = 0U; + peripheral_clock = XMC_SCU_CLOCK_GetPeripheralClockFrequency(); + pdiv = (uint32_t)(channel->BRG & USIC_CH_BRG_PDIV_Msk) >> USIC_CH_BRG_PDIV_Pos; + step = (uint32_t)(channel->FDR & USIC_CH_FDR_STEP_Msk) >> USIC_CH_FDR_STEP_Pos; + fFD = (uint32_t)((peripheral_clock >> 10U) * step); + fpdiv= fFD/(1U+pdiv); + + if(tinterword_delay_us < (128000000/fpdiv)) + { + for(divider_factor2_temp = 32U; divider_factor2_temp > 0U; --divider_factor2_temp) + { + + divider_factor1 = (tinterword_delay_us*fpdiv)/(divider_factor2_temp*10000); + divider_factor1_frac = divider_factor1%100U; + + if(divider_factor1_frac > 50) + { + divider_factor1_int = (divider_factor1/100U)+1; + divider_factor1_frac = (divider_factor1_int*100)-divider_factor1; + } + else + { + divider_factor1_int = (divider_factor1/100U); + } + + if ((divider_factor1_int < 5U) && (divider_factor1_int > 0) && (divider_factor1_frac < divider_factor1_frac_min)) + { + divider_factor1_frac_min = divider_factor1_frac; + divider_factor1_int_min = divider_factor1_int; + divider_factor2= divider_factor2_temp; + } + } + } + + channel->PCR_SSCMode = (uint32_t)((channel->PCR_SSCMode) & (~(USIC_CH_PCR_SSCMode_DCTQ1_Msk | + USIC_CH_PCR_SSCMode_PCTQ1_Msk | + USIC_CH_PCR_SSCMode_CTQSEL1_Msk))) | + (((divider_factor1_int_min - 1) << USIC_CH_PCR_SSCMode_PCTQ1_Pos) & (uint32_t)USIC_CH_PCR_SSCMode_PCTQ1_Msk) | + (((divider_factor2 - 1 ) << USIC_CH_PCR_SSCMode_DCTQ1_Pos) & (uint32_t)USIC_CH_PCR_SSCMode_DCTQ1_Msk); +} + +XMC_SPI_CH_STATUS_t XMC_SPI_CH_Stop(XMC_USIC_CH_t *const channel) +{ + XMC_SPI_CH_STATUS_t status = XMC_SPI_CH_STATUS_OK; + + if (((uint32_t)XMC_USIC_CH_GetTransmitBufferStatus(channel) & (uint32_t)XMC_USIC_CH_TBUF_STATUS_BUSY) != 0U) + { + status = XMC_SPI_CH_STATUS_BUSY; + } + else + { + + /* USIC channel in IDLE mode */ + XMC_USIC_CH_SetMode(channel, XMC_USIC_CH_OPERATING_MODE_IDLE); + } + + return status; +} + +void XMC_SPI_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR |= (event&0x1fc00U); + channel->PCR_SSCMode |= ((event << 13U) & 0xe000U); +} + +void XMC_SPI_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR &= (uint32_t)~(event&0x1fc00U); + channel->PCR_SSCMode &= (uint32_t)~((event << 13U) & 0xe000U); +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_uart.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_uart.c new file mode 100644 index 00000000..3641315a --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_uart.c @@ -0,0 +1,216 @@ +/** + * @file xmc_uart.c + * @date 2016-07-22 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-05-20: + * - xmc_uart_ch_stop API implementation corrected. + * - Modified XMC_UART_CH_Stop() API for not setting to IDLE the channel if it is busy
+ * + * 2015-06-20: + * - Removed GetDriverVersion API
+ * + * 2015-09-01: + * - Modified XMC_UART_CH_EnableEvent() and XMC_UART_CH_DisableEvent() for supporting multiple events configuration
+ * + * 2016-07-22: + * - Modified XMC_UART_CH_Init() to enable transfer status BUSY + * - Modified XMC_UART_CH_Stop() to check for transfer status + * + * @endcond + * + */ + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ + +#include +#include + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ + +#define XMC_UART_CH_OVERSAMPLING (16UL) +#define XMC_UART_CH_OVERSAMPLING_MIN_VAL (4UL) + +/********************************************************************************************************************* + * API IMPLEMENTATION + *********************************************************************************************************************/ + +void XMC_UART_CH_Init(XMC_USIC_CH_t *channel, const XMC_UART_CH_CONFIG_t *const config) +{ + uint32_t oversampling = XMC_UART_CH_OVERSAMPLING; + + /* USIC channel switched on*/ + XMC_USIC_CH_Enable(channel); + + if(config->oversampling != 0U) + { + oversampling = (uint32_t)config->oversampling; + } + + /* Configure baud rate */ + (void)XMC_USIC_CH_SetBaudrate(channel, config->baudrate, oversampling); + + /* Configure frame format + * Configure the number of stop bits + * Pulse length is set to 0 to have standard UART signaling, + * i.e. the 0 level is signaled during the complete bit time + * Sampling point set equal to the half of the oversampling period + * Enable Sample Majority Decision + * Enable Transfer Status BUSY + */ + channel->PCR_ASCMode = (uint32_t)(((config->stop_bits - 1UL) << USIC_CH_PCR_ASCMode_STPB_Pos) | + (((oversampling >> 1UL) + 1UL) << USIC_CH_PCR_ASCMode_SP_Pos) | + USIC_CH_PCR_ASCMode_SMD_Msk | + USIC_CH_PCR_ASCMode_RSTEN_Msk | USIC_CH_PCR_ASCMode_TSTEN_Msk); + + /* Set passive data level, high + Set word length. Data bits - 1 + If frame length is > 0, frame_lemgth-1; else, FLE = WLE (Data bits - 1) + Transmission Mode: The shift control signal is considered active if it + is at 1-level. This is the setting to be programmed to allow data transfers */ + channel->SCTR = (uint32_t)((((uint32_t)config->data_bits - 1UL) << USIC_CH_SCTR_WLE_Pos) | + ((0x1UL << USIC_CH_SCTR_TRM_Pos) | USIC_CH_SCTR_PDL_Msk)); + + if (config->frame_length != 0U) + { + channel->SCTR |= (uint32_t)(((uint32_t)config->frame_length - 1UL) << USIC_CH_SCTR_FLE_Pos); + } + else + { + channel->SCTR |= (uint32_t)(((uint32_t)config->data_bits - 1UL) << USIC_CH_SCTR_FLE_Pos); + } + + /* Enable transfer buffer */ + channel->TCSR = (0x1UL << USIC_CH_TCSR_TDEN_Pos) | + USIC_CH_TCSR_TDSSM_Msk; + + /* Clear protocol status */ + channel->PSCR = 0xFFFFFFFFUL; + + /* Set parity settings */ + channel->CCR = (uint32_t)config->parity_mode; +} + +XMC_UART_CH_STATUS_t XMC_UART_CH_SetBaudrate(XMC_USIC_CH_t *const channel, uint32_t rate, uint32_t oversampling) +{ + XMC_UART_CH_STATUS_t status; + + status = XMC_UART_CH_STATUS_ERROR; + + if ((rate <= (XMC_SCU_CLOCK_GetPeripheralClockFrequency() >> 2U)) && (oversampling >= XMC_UART_CH_OVERSAMPLING_MIN_VAL)) + { + if (XMC_USIC_CH_SetBaudrate(channel, rate, oversampling) == XMC_USIC_CH_STATUS_OK) + { + status = XMC_UART_CH_STATUS_OK; + } + } + return status; +} + +void XMC_UART_CH_Transmit(XMC_USIC_CH_t *const channel, const uint16_t data) +{ + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0UL) + { + /* Wait till the Transmit Buffer is free for transmission */ + while(XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + } + + /* Clear the Transmit Buffer indication flag */ + XMC_UART_CH_ClearStatusFlag(channel, (uint32_t)XMC_UART_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + /*Transmit data */ + channel->TBUF[0U] = data; + } + else + { + channel->IN[0U] = data; + } +} + +uint16_t XMC_UART_CH_GetReceivedData(XMC_USIC_CH_t *const channel) +{ + uint16_t retval; + + /* Check FIFO size */ + if ((channel->RBCTR & USIC_CH_RBCTR_SIZE_Msk) == 0U) + { + retval = (uint16_t)channel->RBUF; + } + else + { + retval = (uint16_t)channel->OUTR; + } + + return retval; +} + +XMC_UART_CH_STATUS_t XMC_UART_CH_Stop(XMC_USIC_CH_t *const channel) +{ + XMC_UART_CH_STATUS_t status = XMC_UART_CH_STATUS_OK; + + if (((XMC_USIC_CH_GetTransmitBufferStatus(channel) & (uint32_t) XMC_USIC_CH_TBUF_STATUS_BUSY) != 0U) || + ((XMC_UART_CH_GetStatusFlag(channel) & XMC_UART_CH_STATUS_FLAG_TRANSFER_STATUS_BUSY) != 0)) + { + status = XMC_UART_CH_STATUS_BUSY; + } + else + { + /* USIC channel in IDLE mode */ + XMC_USIC_CH_SetMode(channel, XMC_USIC_CH_OPERATING_MODE_IDLE); + } + return status; +} + +void XMC_UART_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR |= (event&0x1fc00U); + channel->PCR_ASCMode |= (event&0xf8U); +} + +void XMC_UART_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR &= (uint32_t)~(event&0x1fc00U); + channel->PCR_ASCMode &= (uint32_t)~(event&0xf8U); +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_usic.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_usic.c new file mode 100644 index 00000000..d6f3b0c7 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_usic.c @@ -0,0 +1,373 @@ +/** + * @file xmc_usic.c + * @date 2015-09-01 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * - Documentation improved
+ * + * 2015-05-08: + * - Clearing bit fields PDIV, PCTQ, PPPEN in XMC_USIC_CH_SetBaudrate() API
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-08-27: + * - Added APIs for external input for BRG configuration:XMC_USIC_CH_ConfigExternalInputSignalToBRG()
+ * + * 2015-08-28: + * - Added asserts to XMC_USIC_CH_ConfigExternalInputSignalToBRG()
+ * + * 2015-09-01: + * - Fixed warning in the asserts
+ * + * @endcond + * + */ + +/******************************************************************************* + * HEADER FILES + *******************************************************************************/ + +#include "xmc_usic.h" +#include "xmc_scu.h" + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +#define USIC_CH_INPR_Msk (0x7UL) + +/******************************************************************************* + * API IMPLEMENTATION + *******************************************************************************/ + +void XMC_USIC_CH_Enable(XMC_USIC_CH_t *const channel) +{ + XMC_ASSERT("XMC_USIC_CH_Enable: channel not valid", XMC_USIC_IsChannelValid(channel)); + + if ((channel == XMC_USIC0_CH0) || (channel == XMC_USIC0_CH1)) + { + XMC_USIC_Enable(XMC_USIC0); + } +#if defined(USIC1) + else if((channel == XMC_USIC1_CH0) || (channel == XMC_USIC1_CH1)) + { + XMC_USIC_Enable(XMC_USIC1); + } +#endif +#if defined(USIC2) + else if((channel == XMC_USIC2_CH0) || (channel == XMC_USIC2_CH1)) + { + XMC_USIC_Enable(XMC_USIC2); + } +#endif + else + { + XMC_ASSERT("USIC module not available", 0U/*Always*/); + } + + /* USIC channel switched on*/ + channel->KSCFG = (USIC_CH_KSCFG_MODEN_Msk | USIC_CH_KSCFG_BPMODEN_Msk); + while ((channel->KSCFG & USIC_CH_KSCFG_MODEN_Msk) == 0U) + { + /* Wait till the channel is enabled */ + } + + /* Set USIC channel in IDLE mode */ + channel->CCR &= (uint32_t)~USIC_CH_CCR_MODE_Msk; +} + +void XMC_USIC_CH_Disable(XMC_USIC_CH_t *const channel) +{ + channel->KSCFG = (uint32_t)((channel->KSCFG & (~USIC_CH_KSCFG_MODEN_Msk)) | USIC_CH_KSCFG_BPMODEN_Msk); +} + +XMC_USIC_CH_STATUS_t XMC_USIC_CH_SetBaudrate(XMC_USIC_CH_t *const channel, uint32_t rate, uint32_t oversampling) +{ + XMC_USIC_CH_STATUS_t status; + + uint32_t peripheral_clock; + + uint32_t clock_divider; + uint32_t clock_divider_min; + + uint32_t pdiv; + uint32_t pdiv_int; + uint32_t pdiv_int_min; + + uint32_t pdiv_frac; + uint32_t pdiv_frac_min; + + /* The rate and peripheral clock are divided by 100 to be able to use only 32bit arithmetic */ + if ((rate >= 100U) && (oversampling != 0U)) + { + peripheral_clock = XMC_SCU_CLOCK_GetPeripheralClockFrequency() / 100U; + rate = rate / 100U; + + clock_divider_min = 1U; + pdiv_int_min = 1U; + pdiv_frac_min = 0x3ffU; + + for(clock_divider = 1023U; clock_divider > 0U; --clock_divider) + { + pdiv = ((peripheral_clock * clock_divider) / (rate * oversampling)); + pdiv_int = pdiv >> 10U; + pdiv_frac = pdiv & 0x3ffU; + + if ((pdiv_int < 1024U) && (pdiv_frac < pdiv_frac_min)) + { + pdiv_frac_min = pdiv_frac; + pdiv_int_min = pdiv_int; + clock_divider_min = clock_divider; + } + } + + channel->FDR = XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_FRACTIONAL | + (clock_divider_min << USIC_CH_FDR_STEP_Pos); + + channel->BRG = (channel->BRG & ~(USIC_CH_BRG_DCTQ_Msk | + USIC_CH_BRG_PDIV_Msk | + USIC_CH_BRG_PCTQ_Msk | + USIC_CH_BRG_PPPEN_Msk)) | + ((oversampling - 1U) << USIC_CH_BRG_DCTQ_Pos) | + ((pdiv_int_min - 1U) << USIC_CH_BRG_PDIV_Pos); + + status = XMC_USIC_CH_STATUS_OK; + } + else + { + status = XMC_USIC_CH_STATUS_ERROR; + } + + return status; +} + +void XMC_USIC_CH_ConfigExternalInputSignalToBRG(XMC_USIC_CH_t *const channel, + const uint16_t pdiv, + const uint32_t oversampling, + const XMC_USIC_CH_INPUT_COMBINATION_MODE_t combination_mode) +{ + XMC_ASSERT("XMC_USIC_CH_ConfigExternalInputSignalToBRG: Divider out of range", ((1U < pdiv) || (pdiv < 1024U))); + XMC_ASSERT("XMC_USIC_CH_ConfigExternalInputSignalToBRG: Oversampling out of range", ((1U < oversampling) || (oversampling < 32U))); + + /* Setting the external input frequency source through DX1 */ + XMC_USIC_CH_SetBRGInputClockSource(channel, XMC_USIC_CH_BRG_CLOCK_SOURCE_DX1T); + + /* Setting the trigger combination mode */ + XMC_USIC_CH_SetInputTriggerCombinationMode(channel,XMC_USIC_CH_INPUT_DX1,combination_mode); + + /* Configuring the dividers and oversampling */ + channel->BRG = (channel->BRG & ~(USIC_CH_BRG_DCTQ_Msk | + USIC_CH_BRG_PDIV_Msk | + USIC_CH_BRG_PCTQ_Msk | + USIC_CH_BRG_PPPEN_Msk)) | + (((oversampling) - 1U) << USIC_CH_BRG_DCTQ_Pos) | + (((pdiv) - 1U) << USIC_CH_BRG_PDIV_Pos); +} + +void XMC_USIC_CH_TXFIFO_Configure(XMC_USIC_CH_t *const channel, + const uint32_t data_pointer, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit) +{ + /* Disable FIFO */ + channel->TBCTR &= (uint32_t)~USIC_CH_TBCTR_SIZE_Msk; + + /* LOF = 0, A standard transmit buffer event occurs when the filling level equals the limit value and gets + * lower due to transmission of a data word + * STBTEN = 0, the trigger of the standard transmit buffer event is based on the transition of the fill level + * from equal to below the limit, not the fact being below + */ + channel->TBCTR = (uint32_t)(channel->TBCTR & (uint32_t)~(USIC_CH_TBCTR_LIMIT_Msk | + USIC_CH_TBCTR_DPTR_Msk | + USIC_CH_TBCTR_SIZE_Msk)) | + (uint32_t)((limit << USIC_CH_TBCTR_LIMIT_Pos) | + (data_pointer << USIC_CH_TBCTR_DPTR_Pos) | + ((uint32_t)size << USIC_CH_TBCTR_SIZE_Pos)); +} + + +void XMC_USIC_CH_RXFIFO_Configure(XMC_USIC_CH_t *const channel, + const uint32_t data_pointer, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit) +{ + /* Disable FIFO */ + channel->RBCTR &= (uint32_t)~USIC_CH_RBCTR_SIZE_Msk; + + /* LOF = 1, A standard receive buffer event occurs when the filling level equals the limit value and gets bigger + * due to the reception of a new data word + */ + channel->RBCTR = (uint32_t)((channel->RBCTR & (uint32_t)~(USIC_CH_RBCTR_LIMIT_Msk | + USIC_CH_RBCTR_DPTR_Msk | + USIC_CH_RBCTR_LOF_Msk)) | + ((limit << USIC_CH_RBCTR_LIMIT_Pos) | + (data_pointer << USIC_CH_RBCTR_DPTR_Pos) | + ((uint32_t)size << USIC_CH_RBCTR_SIZE_Pos) | + (uint32_t)USIC_CH_RBCTR_LOF_Msk)); +} + +void XMC_USIC_CH_TXFIFO_SetSizeTriggerLimit(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit) +{ + /* Disable FIFO */ + channel->TBCTR &= (uint32_t)~USIC_CH_TBCTR_SIZE_Msk; + + /* STBTEN = 0, the trigger of the standard transmit buffer event is based on the transition of the fill level + * from equal to below the limit, not the fact being below + */ + channel->TBCTR = (uint32_t)((uint32_t)(channel->TBCTR & (uint32_t)~USIC_CH_TBCTR_LIMIT_Msk) | + (limit << USIC_CH_TBCTR_LIMIT_Pos) | + ((uint32_t)size << USIC_CH_TBCTR_SIZE_Pos)); +} + +void XMC_USIC_CH_RXFIFO_SetSizeTriggerLimit(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit) +{ + /* Disable FIFO */ + channel->RBCTR &= (uint32_t)~USIC_CH_RBCTR_SIZE_Msk; + + channel->RBCTR = (uint32_t)((uint32_t)(channel->RBCTR & (uint32_t)~USIC_CH_RBCTR_LIMIT_Msk) | + (limit << USIC_CH_RBCTR_LIMIT_Pos) | + ((uint32_t)size << USIC_CH_RBCTR_SIZE_Pos)); +} + +void XMC_USIC_CH_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request) +{ + channel->INPR = (uint32_t)((channel->INPR & (~(uint32_t)(USIC_CH_INPR_Msk << (uint32_t)interrupt_node))) | + (service_request << (uint32_t)interrupt_node)); +} + +void XMC_USIC_CH_TXFIFO_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request) +{ + channel->TBCTR = (uint32_t)((channel->TBCTR & (~(uint32_t)(USIC_CH_INPR_Msk << (uint32_t)interrupt_node))) | + (service_request << (uint32_t)interrupt_node)); +} + +void XMC_USIC_CH_RXFIFO_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request) +{ + channel->RBCTR = (uint32_t)((channel->RBCTR & (~(uint32_t)(USIC_CH_INPR_Msk << (uint32_t)interrupt_node))) | + (service_request << (uint32_t)interrupt_node)); +} + +void XMC_USIC_Enable(XMC_USIC_t *const usic) +{ + if (usic == USIC0) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_USIC0); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_USIC0); +#endif + } +#if defined(USIC1) + else if (usic == USIC1) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_USIC1); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_USIC1); +#endif + } +#endif +#if defined(USIC2) + else if (usic == USIC2) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_USIC2); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_USIC2); +#endif + } +#endif + else + { + XMC_ASSERT("USIC module not available", 0/*Always*/); + } +} + +void XMC_USIC_Disable(XMC_USIC_t *const usic) +{ + if (usic == (XMC_USIC_t *)USIC0) + { +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_USIC0); +#endif +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_USIC0); +#endif + } +#if defined(USIC1) + else if (usic == (XMC_USIC_t *)USIC1) + { +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_USIC1); +#endif +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_USIC1); +#endif + } +#endif +#if defined(USIC2) + else if (usic == (XMC_USIC_t *)USIC2) + { +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_USIC2); +#endif +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_USIC2); +#endif + } +#endif + else + { + XMC_ASSERT("USIC module not available", 0/*Always*/); + } + +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_vadc.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_vadc.c new file mode 100644 index 00000000..30298969 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_vadc.c @@ -0,0 +1,2121 @@ +/** + * @file xmc_vadc.c + * @date 2016-06-17 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-15: + * - Initial
+ * + * 2015-02-20: + * - Revised for XMC1201 device.
+ * + * 2015-04-27: + * - Added new APIs for SHS.
+ * - Added New APIs for trigger edge selection.
+ * - Added new APIs for Queue flush entries, boundary selection, Boundary node pointer.
+ * - Revised GatingMode APIs and EMUX Control Init API.
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * 2015-06-25: + * - BFL configuration in channel initialization fixed. + * + * 2015-07-28: + * - CLOCK_GATING_SUPPORTED and PERIPHERAL_RESET_SUPPORTED macros used + * - Clubbed the macro definitions for XMC13 XMC12 and XMC14 + * - Clubbed the macro definitions for XMC44 XMC47 and XMC48 + * - New APIs Created. + * - XMC_VADC_GLOBAL_SetIndividualBoundary + * - XMC_VADC_GROUP_SetIndividualBoundary + * - XMC_VADC_GROUP_GetAlias + * - XMC_VADC_GROUP_GetInputClass + * - XMC_VADC_GROUP_ChannelSetIclass + * - XMC_VADC_GROUP_ChannelGetResultAlignment + * - XMC_VADC_GROUP_ChannelGetInputClass + * - XMC_VADC_GROUP_SetResultSubtractionValue + * + * 2015-12-01: + * - Fixed the analog calibration voltage for XMC1100 to external reference upper supply range. + * - Fixed the XMC_VADC_GLOBAL_StartupCalibration() for XMC1100. + * + * 2016-06-17: + * - New macros added XMC_VADC_SHS_FULL_SET_REG, XMC_VADC_RESULT_PRIORITY_AVAILABLE + * and XMC_VADC_SYNCTR_START_LOCATION + * - New Enum added XMC_VADC_SHS_GAIN_LEVEL_t and XMC_VADC_SYNCTR_EVAL_t + * - Fixed the EVAL configuration in API XMC_VADC_GROUP_CheckSlaveReadiness and XMC_VADC_GROUP_IgnoreSlaveReadiness + * - New APIs added are: + * - XMC_VADC_GROUP_SetSyncSlaveReadySignal + * - XMC_VADC_GROUP_ChannelGetAssertedEvents + * - XMC_VADC_GROUP_GetAssertedResultEvents + * - XMC_VADC_GROUP_SetResultRegPriority + * - XMC_VADC_GROUP_SetSyncReadySignal + * - XMC_VADC_GROUP_GetSyncReadySignal + * - XMC_VADC_GROUP_GetResultRegPriority + * + * 2017-01-11: + * - Fix assertion in XMC_VADC_GROUP_CheckSlaveReadiness() and XMC_VADC_GROUP_IgnoreSlaveReadiness() checking the slave_group parameter + * + * @endcond + * + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_VADC_MAX_ICLASS_SET (2U) /**< Defines the maximum number of conversion parameter sets */ +#define XMC_VADC_NUM_EMUX_INTERFACES (2U) /**< Defines the maximum number of external multiplexer interfaces */ + +#define XMC_VADC_RESULT_LEFT_ALIGN_10BIT (2U) /**< Defines the 10 bit converted result register left align mask. It \ + is used in the XMC_VADC_GLOBAL_SetCompareValue() API */ + +#define XMC_VADC_SYNCTR_START_LOCATION (3U) /**< Defines the location in SYNCTR needed for calculations*/ +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * GLOBAL DATA + ********************************************************************************************************************/ + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) + +#if (XMC_VADC_MAXIMUM_NUM_GROUPS == 4U) +static VADC_G_TypeDef *const g_xmc_vadc_group_array[XMC_VADC_MAXIMUM_NUM_GROUPS] = {(VADC_G_TypeDef*)(void*)VADC_G0, + (VADC_G_TypeDef*)(void*)VADC_G1, + (VADC_G_TypeDef*)(void*)VADC_G2, + (VADC_G_TypeDef*)(void*)VADC_G3 }; +#else +static VADC_G_TypeDef *const g_xmc_vadc_group_array[XMC_VADC_MAXIMUM_NUM_GROUPS] = {(VADC_G_TypeDef* )(void *) VADC_G0, + (VADC_G_TypeDef* )(void *)VADC_G1 }; +#endif + +#endif + +/********************************************************************************************************************* + * LOCAL ROUTINES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/*API to enable the VADC Module*/ +void XMC_VADC_GLOBAL_EnableModule(void) +{ + /* + * Enable Out of Range Comparator for ADC channels pins P2.2to P2.9. This hack is applicable only for XMC1xxx devices + * and in particular the G11 step. + * + * Please refer to the XMC1000 Errata sheet V1.4 released 2014-06 Errata ID : ADC_AI.003 Additonal bit to enable ADC + * function + */ + +#if defined (COMPARATOR) + COMPARATOR->ORCCTRL = (uint32_t)0xFF; +#endif + +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_VADC); +#endif + +#if defined(PERIPHERAL_RESET_SUPPORTED) + /* Reset the Hardware */ + XMC_SCU_RESET_DeassertPeripheralReset((XMC_SCU_PERIPHERAL_RESET_t)XMC_SCU_PERIPHERAL_RESET_VADC ); +#endif +} + +/*API to Disable the VADC Module*/ +void XMC_VADC_GLOBAL_DisableModule(void) +{ +#if defined(PERIPHERAL_RESET_SUPPORTED) + /* Reset the Hardware */ + XMC_SCU_RESET_AssertPeripheralReset((XMC_SCU_PERIPHERAL_RESET_t)XMC_SCU_PERIPHERAL_RESET_VADC ); +#endif + +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_VADC); +#endif + +} + + +/* API to initialize global resources */ +void XMC_VADC_GLOBAL_Init(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_GLOBAL_CONFIG_t *config) +{ +#if (XMC_VADC_GROUP_AVAILABLE == 0U) + uint32_t reg; +#endif + XMC_ASSERT("XMC_VADC_GLOBAL_Init:Wrong Module Pointer", (global_ptr == VADC)) + + /* Enable the VADC module*/ + XMC_VADC_GLOBAL_EnableModule(); + + global_ptr->CLC = (uint32_t)(config->clc); + + /* Clock configuration */ + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) + global_ptr->GLOBCFG = (uint32_t)(config->clock_config.globcfg | (uint32_t)(VADC_GLOBCFG_DIVWC_Msk)); +#endif + + /* ICLASS-0 configuration */ + global_ptr->GLOBICLASS[0] = (uint32_t)(config->class0.globiclass); + + /* ICLASS-1 configuration */ + global_ptr->GLOBICLASS[1] = (uint32_t)(config->class1.globiclass); + + + /*Result generation related configuration */ + global_ptr->GLOBRCR = (uint32_t)(config->globrcr); + +#if (XMC_VADC_BOUNDARY_AVAILABLE == 1U) + + /* Boundaries */ + global_ptr->GLOBBOUND = (uint32_t)(config->globbound); + +#endif + + /* Configure the SHS register that are needed for XMC11xx devices*/ +#if (XMC_VADC_GROUP_AVAILABLE == 0U) + + /* Enabling the Analog part of the converter*/ + reg = SHS0->SHSCFG | SHS_SHSCFG_SCWC_Msk; + reg &= ~(SHS_SHSCFG_ANOFF_Msk); + SHS0->SHSCFG = reg; + + /* From the Errata sheet of XMC1100 V1.7*/ + XMC_VADC_CONV_ENABLE_FOR_XMC11 = 1U; +#endif + +} + +/* API to Set the Global IClass registers*/ +void XMC_VADC_GLOBAL_InputClassInit(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_GLOBAL_CLASS_t config, + const XMC_VADC_GROUP_CONV_t conv_type, const uint32_t set_num) +{ + + XMC_ASSERT("XMC_VADC_GLOBAL_InputClassInit:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_InputClassInit:Wrong Conversion Type", ((conv_type) <= XMC_VADC_GROUP_CONV_EMUX)) + XMC_ASSERT("XMC_VADC_GLOBAL_InputClassInit:Wrong ICLASS set number", (set_num < XMC_VADC_MAX_ICLASS_SET)) + +#if(XMC_VADC_EMUX_AVAILABLE == 1U) + if (conv_type == XMC_VADC_GROUP_CONV_STD ) + { +#endif + global_ptr->GLOBICLASS[set_num] = config.globiclass & + (uint32_t)(VADC_GLOBICLASS_CMS_Msk | VADC_GLOBICLASS_STCS_Msk); +#if(XMC_VADC_EMUX_AVAILABLE == 1U) + } + else + { + global_ptr->GLOBICLASS[set_num] = config.globiclass & (uint32_t)(VADC_GLOBICLASS_CME_Msk | VADC_GLOBICLASS_STCE_Msk); + } +#endif +} + +/* API to enable startup calibration feature */ +void XMC_VADC_GLOBAL_StartupCalibration(XMC_VADC_GLOBAL_t *const global_ptr) +{ +#if (XMC_VADC_GROUP_AVAILABLE == 1U) + uint8_t i; + VADC_G_TypeDef *group_ptr; +#endif + + XMC_ASSERT("XMC_VADC_GLOBAL_StartupCalibration:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->GLOBCFG |= (uint32_t)VADC_GLOBCFG_SUCAL_Msk; + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) + /* Loop until all active groups finish calibration */ + for(i=0U; iARBCFG) & (uint32_t)VADC_G_ARBCFG_ANONS_Msk) + { + /* This group is active. Loop until it finishes calibration */ + while((group_ptr->ARBCFG) & (uint32_t)VADC_G_ARBCFG_CAL_Msk) + { + /* NOP */ + } + } + } +#else + /* Loop until it finishes calibration */ + while ((((SHS0->SHSCFG) & (uint32_t)SHS_SHSCFG_STATE_Msk) >> (uint32_t)SHS_SHSCFG_STATE_Pos) == + XMC_VADC_SHS_START_UP_CAL_ACTIVE ) + { + /* NOP */ + } +#endif +} + +/* API to set boudaries for result of conversion. Should the boundaries be violated, interrupts are generated */ +#if (XMC_VADC_BOUNDARY_AVAILABLE == 1U) +void XMC_VADC_GLOBAL_SetBoundaries(XMC_VADC_GLOBAL_t *const global_ptr, + const uint32_t boundary0, + const uint32_t boundary1) +{ + uint32_t globbound; + + XMC_ASSERT("XMC_VADC_GLOBAL_SetBoundaries:Wrong Module Pointer", (global_ptr == VADC)) + + globbound = 0U; + globbound |= (uint32_t) (boundary0 << VADC_GLOBBOUND_BOUNDARY0_Pos); + globbound |= (uint32_t) (boundary1 << VADC_GLOBBOUND_BOUNDARY1_Pos); + + global_ptr->GLOBBOUND = globbound; +} + +/* API to set an individual boundary for conversion results */ +void XMC_VADC_GLOBAL_SetIndividualBoundary(XMC_VADC_GLOBAL_t *const global_ptr, + const XMC_VADC_CHANNEL_BOUNDARY_t selection, + const uint16_t boundary_value) +{ + + uint32_t globbound; + + XMC_ASSERT("XMC_VADC_GLOBAL_SetBoundaries:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_SetBoundaries:Wrong Boundary Selection", + ((XMC_VADC_CHANNEL_BOUNDARY_GLOBAL_BOUND0 == selection) || + (XMC_VADC_CHANNEL_BOUNDARY_GLOBAL_BOUND1 == selection))) + + /* Program the Boundary registers */ + globbound = global_ptr->GLOBBOUND; + + if (XMC_VADC_CHANNEL_BOUNDARY_GLOBAL_BOUND0 == selection) + { + globbound &= ~((uint32_t) VADC_GLOBBOUND_BOUNDARY0_Msk); + globbound |= (uint32_t) ((uint32_t) boundary_value << VADC_GLOBBOUND_BOUNDARY0_Pos); + } + else if (XMC_VADC_CHANNEL_BOUNDARY_GLOBAL_BOUND1 == selection) + { + globbound &= ~((uint32_t) VADC_GLOBBOUND_BOUNDARY1_Msk); + globbound |= (uint32_t) ((uint32_t) boundary_value << VADC_GLOBBOUND_BOUNDARY1_Pos); + } + else + { + /* For MISRA*/ + } + global_ptr->GLOBBOUND = globbound; + +} + +#endif + +/* API to set compare value for the result register. Result of conversion is compared against this compare value */ +void XMC_VADC_GLOBAL_SetCompareValue(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_RESULT_SIZE_t compare_val) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SetCompareValue:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->GLOBRES &= ~((uint32_t)VADC_GLOBRES_RESULT_Msk); + global_ptr->GLOBRES |= (uint32_t)((uint32_t)compare_val << XMC_VADC_RESULT_LEFT_ALIGN_10BIT); +} + +/* API to retrieve the result of comparison */ +XMC_VADC_FAST_COMPARE_t XMC_VADC_GLOBAL_GetCompareResult(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_VADC_FAST_COMPARE_t result; + uint32_t res; + + XMC_ASSERT("XMC_VADC_GLOBAL_GetCompareResult:Wrong Module Pointer", (global_ptr == VADC)) + + res = global_ptr->GLOBRES; + + if (res & (uint32_t)VADC_GLOBRES_VF_Msk) + { + result = (XMC_VADC_FAST_COMPARE_t)((uint32_t)(res >> (uint32_t)VADC_GLOBRES_FCR_Pos) & (uint32_t)1); + } + else + { + result = XMC_VADC_FAST_COMPARE_UNKNOWN; + } + + return result; +} + +/* Bind one of the four groups to one of the two EMUX interfaces */ +#if (XMC_VADC_EMUX_AVAILABLE == 1U) +void XMC_VADC_GLOBAL_BindGroupToEMux(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t emuxif, const uint32_t group) +{ + uint32_t mask; + uint32_t pos; + + XMC_ASSERT("XMC_VADC_GLOBAL_BindGroupToEMux:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BindGroupToEMux:Wrong EMUX Group", (emuxif < XMC_VADC_NUM_EMUX_INTERFACES)) + XMC_ASSERT("XMC_VADC_GLOBAL_BindGroupToEMux:Wrong VADC Group", (group < XMC_VADC_MAXIMUM_NUM_GROUPS)) + + if (0U == emuxif) + { + pos = (uint32_t)VADC_EMUXSEL_EMUXGRP0_Pos; + mask = (uint32_t)VADC_EMUXSEL_EMUXGRP0_Msk; + } + else + { + pos = (uint32_t)VADC_EMUXSEL_EMUXGRP1_Pos; + mask = (uint32_t)VADC_EMUXSEL_EMUXGRP1_Msk; + } + + global_ptr->EMUXSEL &= ~(mask); + global_ptr->EMUXSEL |= (uint32_t) (group << pos); + +} +#endif + +/* API to bind result event with a service request line */ +void XMC_VADC_GLOBAL_SetResultEventInterruptNode(XMC_VADC_GLOBAL_t *const global_ptr, XMC_VADC_SR_t sr) +{ + uint32_t node; + + XMC_ASSERT("XMC_VADC_GLOBAL_SetResultEventInterruptNode:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_SetResultEventInterruptNode:Wrong SR Number", (sr <= XMC_VADC_SR_SHARED_SR3)) + + if (sr >= XMC_VADC_SR_SHARED_SR0) + { + node = (uint32_t)sr - (uint32_t)XMC_VADC_SR_SHARED_SR0; + } + else + { + node = (uint32_t)sr; + } + + global_ptr->GLOBEVNP &= ~((uint32_t)VADC_GLOBEVNP_REV0NP_Msk); + global_ptr->GLOBEVNP |= (uint32_t)(node << VADC_GLOBEVNP_REV0NP_Pos); +} + +/* API to bind request source event with a service request line */ +void XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode(XMC_VADC_GLOBAL_t *const global_ptr, XMC_VADC_SR_t sr) +{ + uint32_t node; + + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode:Wrong Module Pointer", (global_ptr == VADC)) + + if (sr >= XMC_VADC_SR_SHARED_SR0) + { + node = (uint32_t)sr - (uint32_t)XMC_VADC_SR_SHARED_SR0; + } + else + { + node = (uint32_t)sr; + } + + global_ptr->GLOBEVNP &= ~((uint32_t)VADC_GLOBEVNP_SEV0NP_Msk); + global_ptr->GLOBEVNP |= (uint32_t) (node << VADC_GLOBEVNP_SEV0NP_Pos); +} + +/* API to initialize an instance of group of VADC hardware */ +#if (XMC_VADC_GROUP_AVAILABLE == 1U) +void XMC_VADC_GROUP_Init( XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GROUP_CONFIG_t *config) +{ + XMC_ASSERT("XMC_VADC_GROUP_Init:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* Program the input classes */ + XMC_VADC_GROUP_InputClassInit(group_ptr, config->class0, XMC_VADC_GROUP_CONV_STD, 0U); + XMC_VADC_GROUP_InputClassInit(group_ptr, config->class0, XMC_VADC_GROUP_CONV_EMUX, 0U); + XMC_VADC_GROUP_InputClassInit(group_ptr, config->class1, XMC_VADC_GROUP_CONV_STD, 1U); + XMC_VADC_GROUP_InputClassInit(group_ptr, config->class1, XMC_VADC_GROUP_CONV_EMUX, 1U); + + group_ptr->ARBCFG = config->g_arbcfg; + + group_ptr->BOUND = config->g_bound; + + /* External mux configuration */ + XMC_VADC_GROUP_ExternalMuxControlInit(group_ptr,config->emux_config); + +} + +/* API to program conversion characteristics */ +void XMC_VADC_GROUP_InputClassInit(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GROUP_CLASS_t config, + const XMC_VADC_GROUP_CONV_t conv_type, const uint32_t set_num) +{ + uint32_t conv_class; + uint32_t conv_mode_pos; + uint32_t sample_time_pos; + uint32_t conv_mode_mask; + uint32_t sample_time_mask; + uint32_t sample_time; + XMC_VADC_CONVMODE_t conv_mode; + + XMC_ASSERT("XMC_VADC_GROUP_InputClassInit:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_InputClassInit:Wrong Conversion Type", ((conv_type) <= XMC_VADC_GROUP_CONV_EMUX)) + XMC_ASSERT("XMC_VADC_GROUP_InputClassInit:Wrong ICLASS set number", (set_num < XMC_VADC_MAX_ICLASS_SET)) + + /* + * Obtain the mask and position macros of the parameters based on what is being requested - Standard channels vs + * external mux channels. + */ + if (XMC_VADC_GROUP_CONV_STD == conv_type) + { + conv_mode_pos = (uint32_t) VADC_G_ICLASS_CMS_Pos; + conv_mode_mask = (uint32_t) VADC_G_ICLASS_CMS_Msk; + sample_time_pos = (uint32_t) VADC_G_ICLASS_STCS_Pos; + sample_time_mask = (uint32_t) VADC_G_ICLASS_STCS_Msk; + sample_time = (uint32_t) config.sample_time_std_conv; + conv_mode = (XMC_VADC_CONVMODE_t)config.conversion_mode_standard; + } + else + { + conv_mode_pos = (uint32_t) VADC_G_ICLASS_CME_Pos; + conv_mode_mask = (uint32_t) VADC_G_ICLASS_CME_Msk; + sample_time_pos = (uint32_t) VADC_G_ICLASS_STCE_Pos; + sample_time_mask = (uint32_t) VADC_G_ICLASS_STCE_Msk; + sample_time = (uint32_t) config.sampling_phase_emux_channel; + conv_mode = (XMC_VADC_CONVMODE_t)config.conversion_mode_emux; + } + + /* Determine the class */ + conv_class = group_ptr->ICLASS[set_num]; + + /* Program the class register */ + conv_class &= ~(conv_mode_mask); + conv_class |= (uint32_t)((uint32_t) conv_mode << conv_mode_pos); + conv_class &= ~(sample_time_mask); + conv_class |= (uint32_t)(sample_time << sample_time_pos); + group_ptr->ICLASS[set_num] = conv_class; +} + +/* API which sets the power mode of analog converter of a VADC group */ +void XMC_VADC_GROUP_SetPowerMode(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GROUP_POWERMODE_t power_mode) +{ + uint32_t arbcfg; + + XMC_ASSERT("XMC_VADC_GROUP_SetPowerMode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_SetPowerMode:Wrong Power Mode", (power_mode <= XMC_VADC_GROUP_POWERMODE_NORMAL)) + + arbcfg = group_ptr->ARBCFG; + + arbcfg &= ~((uint32_t)VADC_G_ARBCFG_ANONC_Msk); + arbcfg |= (uint32_t)power_mode; + + group_ptr->ARBCFG = arbcfg; +} + +/* API which programs a group as a slave group during sync conversions */ +void XMC_VADC_GROUP_SetSyncSlave(XMC_VADC_GROUP_t *const group_ptr, uint32_t master_grp, uint32_t slave_grp) +{ + uint32_t synctr; + #if (XMC_VADC_MULTIPLE_SLAVEGROUPS == 1U ) + #endif + XMC_ASSERT("XMC_VADC_GROUP_SetSyncSlave:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + #if (XMC_VADC_MULTIPLE_SLAVEGROUPS == 1U ) + + /* Determine the coding of SYNCTR */ + if (slave_grp > master_grp) + { + master_grp = master_grp + 1U; + } + #endif + + /* Program SYNCTR */ + synctr = group_ptr->SYNCTR; + synctr &= ~((uint32_t)VADC_G_SYNCTR_STSEL_Msk); + synctr |= master_grp; + group_ptr->SYNCTR = synctr; +} + +/* API which programs a group as a master group during sync conversions */ +void XMC_VADC_GROUP_SetSyncMaster(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t synctr; + + XMC_ASSERT("XMC_VADC_GROUP_SetSyncMaster:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + synctr = group_ptr->SYNCTR; + synctr &= ~((uint32_t)VADC_G_SYNCTR_STSEL_Msk); + group_ptr->SYNCTR = synctr; +} + +/* API to enable checking of readiness of slaves before a synchronous conversion request is issued */ +void XMC_VADC_GROUP_CheckSlaveReadiness(XMC_VADC_GROUP_t *const group_ptr, uint32_t slave_group) +{ + uint32_t i,master_grp_num; + XMC_ASSERT("XMC_VADC_GROUP_CheckSlaveReadiness:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_CheckSlaveReadiness:Wrong Slave group", ((slave_group >= 0) && (slave_group <= (XMC_VADC_MAXIMUM_NUM_GROUPS - 1)))) + + master_grp_num =0; + for(i=0; iSYNCTR |= (1U << (slave_group + XMC_VADC_SYNCTR_START_LOCATION)); +} + +/* API to disable checking of readiness of slaves during synchronous conversions */ +void XMC_VADC_GROUP_IgnoreSlaveReadiness(XMC_VADC_GROUP_t *const group_ptr, uint32_t slave_group) +{ + uint32_t i,master_grp_num; + XMC_ASSERT("XMC_VADC_GROUP_IgnoreSlaveReadiness:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_IgnoreSlaveReadiness:Wrong Slave group", ((slave_group >= 0) && (slave_group <= (XMC_VADC_MAXIMUM_NUM_GROUPS - 1)))) + + master_grp_num =0; + for(i=0; iSYNCTR &= ~(1U << (slave_group + XMC_VADC_SYNCTR_START_LOCATION)); +} + +/* API to configure EVAL bit in the slave groups*/ +void XMC_VADC_GROUP_SetSyncSlaveReadySignal(XMC_VADC_GROUP_t *const group_ptr, + uint32_t eval_waiting_group, + uint32_t eval_origin_group) +{ + XMC_ASSERT("XMC_VADC_GROUP_SetSyncSlaveReadySignal:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_SetSyncSlaveReadySignal:Wrong Group numbers", (eval_waiting_group == eval_origin_group )) + + if(eval_origin_group < eval_waiting_group) + { + eval_origin_group++; + } + group_ptr->SYNCTR |= (1U << (eval_origin_group + XMC_VADC_SYNCTR_START_LOCATION)); +} + + +/* API to enable the synchronous conversion feature - Applicable only to kernel configured as master */ +void XMC_VADC_GROUP_EnableChannelSyncRequest(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + uint32_t synctr; + + XMC_ASSERT("XMC_VADC_GROUP_EnableChannelSyncRequest:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_EnableChannelSyncRequest:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + synctr = group_ptr->SYNCTR; + + if (!(synctr & (uint32_t)VADC_G_SYNCTR_STSEL_Msk)) + { + group_ptr->CHCTR[ch_num] |= (uint32_t)((uint32_t)1 << VADC_G_CHCTR_SYNC_Pos); + } +} + +/* API to disable synchronous conversion feature */ +void XMC_VADC_GROUP_DisableChannelSyncRequest(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + uint32_t synctr; + + XMC_ASSERT("XMC_VADC_GROUP_DisableChannelSyncRequest:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_DisableChannelSyncRequest:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + synctr = group_ptr->SYNCTR; + + if (synctr & (uint32_t)VADC_G_SYNCTR_STSEL_Msk) + { + group_ptr->CHCTR[ch_num] &= ~((uint32_t)VADC_G_CHCTR_SYNC_Msk); + } +} + +/* API to retrieve the converter state - Idle vs Busy */ +XMC_VADC_GROUP_STATE_t XMC_VADC_GROUP_IsConverterBusy(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t arbcfg; + + XMC_ASSERT("XMC_VADC_GROUP_IsConverterBusy:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + arbcfg = group_ptr->ARBCFG; + arbcfg &= (uint32_t)VADC_G_ARBCFG_BUSY_Msk; + arbcfg = arbcfg >> VADC_G_ARBCFG_BUSY_Pos; + + return( (XMC_VADC_GROUP_STATE_t)arbcfg); +} + +/* API to set boundaries for conversion results */ +void XMC_VADC_GROUP_SetBoundaries(XMC_VADC_GROUP_t *const group_ptr, const uint32_t boundary0, const uint32_t boundary1) +{ + uint32_t bound; + + XMC_ASSERT("XMC_VADC_GROUP_SetBoundaries:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* Program the Boundary registers */ + bound = group_ptr->BOUND; + bound &= ~((uint32_t) VADC_G_BOUND_BOUNDARY0_Msk); + bound &= ~((uint32_t) VADC_G_BOUND_BOUNDARY1_Msk); + bound |= (uint32_t) ((uint32_t) boundary0 << VADC_G_BOUND_BOUNDARY0_Pos); + bound |= (uint32_t) ((uint32_t) boundary1 << VADC_G_BOUND_BOUNDARY1_Pos); + group_ptr->BOUND = bound; +} + +/* API to set an individual boundary for conversion results */ +void XMC_VADC_GROUP_SetIndividualBoundary(XMC_VADC_GROUP_t *const group_ptr, + const XMC_VADC_CHANNEL_BOUNDARY_t selection, + const uint16_t boundary_value) +{ + + uint32_t bound; + + XMC_ASSERT("XMC_VADC_GROUP_SetIndividualBoundary:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_SetIndividualBoundary:Wrong Boundary Selection", + ((XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND0 == selection) || + (XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND1 == selection))) + + /* Program the Boundary registers */ + bound = group_ptr->BOUND; + if (XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND0 == selection) + { + bound &= ~((uint32_t) VADC_G_BOUND_BOUNDARY0_Msk); + bound |= (uint32_t) ((uint32_t) boundary_value << VADC_G_BOUND_BOUNDARY0_Pos); + } + else if (XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND1 == selection) + { + bound &= ~((uint32_t) VADC_G_BOUND_BOUNDARY1_Msk); + bound |= (uint32_t) ((uint32_t) boundary_value << VADC_G_BOUND_BOUNDARY1_Pos); + } + else + { + /* For MISRA*/ + } + group_ptr->BOUND = bound; + +} + +/* Manually assert service request (Interrupt) to NVIC */ +void XMC_VADC_GROUP_TriggerServiceRequest(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t sr_num, + const XMC_VADC_GROUP_IRQ_t type) +{ + uint32_t sract; + + XMC_ASSERT("XMC_VADC_GROUP_TriggerServiceRequest:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_TriggerServiceRequest:Wrong SR number", (sr_num <= XMC_VADC_SR_SHARED_SR3)) + XMC_ASSERT("XMC_VADC_GROUP_TriggerServiceRequest:Wrong SR type", ((type)<= XMC_VADC_GROUP_IRQ_SHARED)) + + sract = group_ptr->SRACT; + + if (XMC_VADC_GROUP_IRQ_KERNEL == type) + { + sract |= (uint32_t)((uint32_t)1 << sr_num); + } + else + { + sract |= (uint32_t)((uint32_t)1 << (sr_num + (uint32_t)8)); + } + + group_ptr->SRACT = sract; +} + +#if XMC_VADC_BOUNDARY_FLAG_SELECT == 1U + +/* API to set the SR line for the Boundary flag node pointer*/ +void XMC_VADC_GROUP_SetBoundaryEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, + const uint8_t boundary_flag_num, + const XMC_VADC_BOUNDARY_NODE_t sr) +{ + uint32_t flag_pos; + XMC_ASSERT("XMC_VADC_GROUP_SetBoundaryEventInterruptNode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* Program the GxBFLNP */ + flag_pos = (uint32_t)boundary_flag_num << (uint32_t)2; + group_ptr->BFLNP &= ~((uint32_t)VADC_G_BFLNP_BFL0NP_Msk << flag_pos); + group_ptr->BFLNP |= (uint32_t)sr << flag_pos; +} + +#endif + +#endif + +#if(XMC_VADC_SHS_AVAILABLE == 1U) + +/* API to Initialize the Sample and hold features*/ +void XMC_VADC_GLOBAL_SHS_Init(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, const XMC_VADC_GLOBAL_SHS_CONFIG_t *config) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_Init:Wrong SHS Pointer", (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_Init:Wrong Index number",(config == (XMC_VADC_GLOBAL_SHS_CONFIG_t*)NULL)) + + /* Initialize the SHS Configuration register*/ + shs_ptr->SHSCFG = (uint32_t)((uint32_t)config->shscfg | (uint32_t)SHS_SHSCFG_SCWC_Msk); + +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) + /* Select the Calibration order*/ + shs_ptr->CALCTR &= ~((uint32_t)SHS_CALCTR_CALORD_Msk); + shs_ptr->CALCTR |= (uint32_t) ((uint32_t)config->calibration_order << SHS_CALCTR_CALORD_Pos); +#endif +} + +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) +/* API to enable the accelerated mode of conversion */ +void XMC_VADC_GLOBAL_SHS_EnableAcceleratedMode(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, XMC_VADC_GROUP_INDEX_t group_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_EnableAcceleratedMode:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_EnableAcceleratedMode:Wrong Index number",(group_num <= XMC_VADC_GROUP_INDEX_1)) + + /* Set the converted to Accelerated mode from compatible mode*/ + if (group_num == XMC_VADC_GROUP_INDEX_0 ) + { + shs_ptr->TIMCFG0 |= (uint32_t)SHS_TIMCFG0_AT_Msk; + } + else if (group_num == XMC_VADC_GROUP_INDEX_1 ) + { + shs_ptr->TIMCFG1 |= (uint32_t)SHS_TIMCFG1_AT_Msk; + } + else + { + /* for MISRA*/ + } +} + +/* API to disable the accelerated mode of conversion */ +void XMC_VADC_GLOBAL_SHS_DisableAcceleratedMode(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, XMC_VADC_GROUP_INDEX_t group_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_DisableAcceleratedMode:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_DisableAcceleratedMode:Wrong Index number",(group_num <= XMC_VADC_GROUP_INDEX_1)) + + /* Set the converted to Accelerated mode from compatible mode*/ + if (group_num == XMC_VADC_GROUP_INDEX_0 ) + { + shs_ptr->TIMCFG0 &= ~(uint32_t)SHS_TIMCFG0_AT_Msk; + } + else if (group_num == XMC_VADC_GROUP_INDEX_1 ) + { + shs_ptr->TIMCFG1 &= ~(uint32_t)SHS_TIMCFG1_AT_Msk; + } + else + { + /* for MISRA*/ + } +} + +/* API to set the Short sample time of the Sample and hold module*/ +void XMC_VADC_GLOBAL_SHS_SetShortSampleTime(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + uint8_t sst_value) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetShortSampleTime:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetShortSampleTime:Wrong Index number",(group_num <= XMC_VADC_GROUP_INDEX_1)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetShortSampleTime:Wrong SST value",(sst_value < 64U)) + + /* Set the short sample time for the Accelerated mode of operation*/ + if (group_num == XMC_VADC_GROUP_INDEX_0 ) + { + shs_ptr->TIMCFG0 &= ~((uint32_t)SHS_TIMCFG0_SST_Msk); + shs_ptr->TIMCFG0 |= (uint32_t)((uint32_t)sst_value << SHS_TIMCFG0_SST_Pos ); + } + else if (group_num == XMC_VADC_GROUP_INDEX_1 ) + { + shs_ptr->TIMCFG1 &= ~((uint32_t)SHS_TIMCFG1_SST_Msk); + shs_ptr->TIMCFG1 |= (uint32_t)((uint32_t)sst_value << SHS_TIMCFG1_SST_Pos ); + } + else + { + /* for MISRA*/ + } +} +#endif + +/* API to set the gain factor of the Sample and hold module*/ +void XMC_VADC_GLOBAL_SHS_SetGainFactor(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + uint8_t gain_value, + XMC_VADC_GROUP_INDEX_t group_num, + uint8_t ch_num) +{ + uint32_t ch_mask; + + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetGainFactor:Wrong SHS Pointer", (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetGainFactor:Wrong Index number",(group_num <= XMC_VADC_GROUP_INDEX_1)) + + /*Calculate location of channel bit-field*/ + ch_mask = ((uint32_t)ch_num << (uint32_t)2); + if (group_num == XMC_VADC_GROUP_INDEX_0 ) + { + shs_ptr->GNCTR00 &= ~((uint32_t)SHS_GNCTR00_GAIN0_Msk << ch_mask) ; + shs_ptr->GNCTR00 |= ((uint32_t)gain_value << ch_mask); + } + else if (group_num == XMC_VADC_GROUP_INDEX_1 ) + { + shs_ptr->GNCTR10 &= ~((uint32_t)SHS_GNCTR10_GAIN0_Msk << ch_mask); + shs_ptr->GNCTR10 |= ((uint32_t)gain_value << ch_mask); + } + else + { + /* for MISRA*/ + } +} + +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) +/* API to enable the gain and offset calibration of the Sample and hold module*/ +void XMC_VADC_GLOBAL_SHS_EnableGainAndOffsetCalibrations(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_EnableGainAndOffsetCalibrations:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_EnableGainAndOffsetCalibrations:Wrong group selected", + (group_num <= (uint32_t)XMC_VADC_GROUP_INDEX_1)) + + /* Enable gain and offset calibration*/ + if ( XMC_VADC_GROUP_INDEX_0 == group_num) + { + shs_ptr->CALOC0 &= ~((uint32_t)SHS_CALOC0_DISCAL_Msk); + } + else if ( XMC_VADC_GROUP_INDEX_1 == group_num) + { + shs_ptr->CALOC1 &= ~((uint32_t)SHS_CALOC1_DISCAL_Msk); + } + else + { + /* for MISRA */ + } +} + +/* API to enable the gain and offset calibration of the Sample and hold module*/ +void XMC_VADC_GLOBAL_SHS_DisableGainAndOffsetCalibrations(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_DisableGainAndOffsetCalibrations:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_DisableGainAndOffsetCalibrations:Wrong group selected", + (group_num <= (uint32_t)XMC_VADC_GROUP_INDEX_1)) + + if ( XMC_VADC_GROUP_INDEX_0 == group_num) + { + shs_ptr->CALOC0 |= (uint32_t)SHS_CALOC0_DISCAL_Msk; + } + else if ( XMC_VADC_GROUP_INDEX_1 == group_num) + { + shs_ptr->CALOC1 |= (uint32_t)SHS_CALOC1_DISCAL_Msk; + } + else + { + /* for MISRA */ + } +} + +/* API to get the offset calibration value of the Sample and hold module*/ +uint8_t XMC_VADC_GLOBAL_SHS_GetOffsetCalibrationValue(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + XMC_VADC_SHS_GAIN_LEVEL_t gain_level) +{ + uint32_t calibration_value; + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_GetOffsetCalibrationValue:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_GetOffsetCalibrationValue:Wrong Group number selected", + (group_num == XMC_VADC_GROUP_INDEX_0)||(group_num == XMC_VADC_GROUP_INDEX_1)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_GetOffsetCalibrationValue:Wrong gain level selected", + (gain_level == XMC_VADC_SHS_GAIN_LEVEL_0)||(gain_level == XMC_VADC_SHS_GAIN_LEVEL_1)|| + (gain_level == XMC_VADC_SHS_GAIN_LEVEL_2)||(gain_level == XMC_VADC_SHS_GAIN_LEVEL_3)) + + calibration_value = 0U; + if ( XMC_VADC_GROUP_INDEX_0 == group_num) + { + calibration_value = (shs_ptr->CALOC0 >> (uint32_t)gain_level) & (uint32_t)SHS_CALOC0_CALOFFVAL0_Msk; + } + else if ( XMC_VADC_GROUP_INDEX_1 == group_num) + { + calibration_value = (shs_ptr->CALOC1 >> (uint32_t)gain_level) & (uint32_t)SHS_CALOC1_CALOFFVAL0_Msk; + } + else + { + /* for MISRA */ + } + return ((uint8_t)calibration_value); +} + +/* API to set the offset calibration value of the Sample and hold module*/ +void XMC_VADC_GLOBAL_SHS_SetOffsetCalibrationValue(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + XMC_VADC_SHS_GAIN_LEVEL_t gain_level, + uint8_t offset_calibration_value) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetOffsetCalibrationValue:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetOffsetCalibrationValue:Wrong Group number selected", + (group_num == XMC_VADC_GROUP_INDEX_0)||(group_num == XMC_VADC_GROUP_INDEX_1)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetOffsetCalibrationValue:Wrong gain level selected", + (gain_level == XMC_VADC_SHS_GAIN_LEVEL_0)||(gain_level == XMC_VADC_SHS_GAIN_LEVEL_1)|| + (gain_level == XMC_VADC_SHS_GAIN_LEVEL_2)||(gain_level == XMC_VADC_SHS_GAIN_LEVEL_3)) + + if ( XMC_VADC_GROUP_INDEX_0 == group_num) + { + shs_ptr->CALOC0 = (shs_ptr->CALOC0 & ~((uint32_t)SHS_CALOC0_CALOFFVAL0_Msk << (uint32_t)gain_level)) | + (uint32_t)SHS_CALOC0_OFFWC_Msk; + shs_ptr->CALOC0 |= ((uint32_t)offset_calibration_value << (uint32_t)gain_level) | (uint32_t)SHS_CALOC0_OFFWC_Msk; + } + else if ( XMC_VADC_GROUP_INDEX_1 == group_num) + { + shs_ptr->CALOC1 = (shs_ptr->CALOC1 & ~((uint32_t)SHS_CALOC1_CALOFFVAL0_Msk << (uint32_t)gain_level)) | + (uint32_t)SHS_CALOC1_OFFWC_Msk; + shs_ptr->CALOC1 |= ((uint32_t)offset_calibration_value << (uint32_t)gain_level) | (uint32_t)SHS_CALOC1_OFFWC_Msk; + } + else + { + /* for MISRA */ + } +} +#endif + +/* API to set the values of sigma delta loop of the Sample and hold module*/ +void XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + XMC_VADC_SHS_LOOP_CH_t loop_select, + uint8_t ch_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop:Wrong Group number selected", + (group_num == XMC_VADC_GROUP_INDEX_0)||(group_num == XMC_VADC_GROUP_INDEX_1)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop:Wrong Delta sigma loop selected", + (loop_select == XMC_VADC_SHS_LOOP_CH_0)||(loop_select == XMC_VADC_SHS_LOOP_CH_1)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + shs_ptr->LOOP &= ~(((uint32_t)SHS_LOOP_LPCH0_Msk | (uint32_t)SHS_LOOP_LPSH0_Msk | (uint32_t)SHS_LOOP_LPEN0_Msk) + << (uint32_t)loop_select); + shs_ptr->LOOP |= ((uint32_t)ch_num | ((uint32_t)group_num << (uint32_t)SHS_LOOP_LPSH0_Pos)) << (uint32_t)loop_select; + +} + +#endif + +#if (XMC_VADC_GSCAN_AVAILABLE == 1U) +/* API to initialize the group scan hardware of a kernel */ +void XMC_VADC_GROUP_ScanInit(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_SCAN_CONFIG_t *config) +{ + uint32_t reg; + + XMC_ASSERT("XMC_VADC_GROUP_ScanInit:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* All configurations have to be performed with the arbitration slot disabled */ + XMC_VADC_GROUP_ScanDisableArbitrationSlot(group_ptr); + + /* Read in the existing contents of arbitration priority register */ + reg = group_ptr->ARBPR; + + /* Program the priority of the request source */ + reg &= ~(uint32_t)VADC_G_ARBPR_PRIO1_Msk; + reg |= (uint32_t)((uint32_t)config->req_src_priority << VADC_G_ARBPR_PRIO1_Pos); + + /* Program the start mode */ + if (XMC_VADC_STARTMODE_WFS != (XMC_VADC_STARTMODE_t)(config->conv_start_mode)) + { + reg |= (uint32_t)(VADC_G_ARBPR_CSM1_Msk); + } + + group_ptr->ARBPR = reg; + + group_ptr->ASCTRL = (uint32_t)(config->asctrl |(VADC_G_ASCTRL_XTWC_Msk) |(VADC_G_ASCTRL_GTWC_Msk) | + (VADC_G_ASCTRL_TMWC_Msk)); + + group_ptr->ASMR = (uint32_t)((config->asmr)| (uint32_t)((uint32_t)XMC_VADC_GATEMODE_IGNORE << VADC_G_ASMR_ENGT_Pos)); + + if (XMC_VADC_STARTMODE_CNR == (XMC_VADC_STARTMODE_t)(config->conv_start_mode)) + { + group_ptr->ASMR |= (uint32_t)VADC_G_ASMR_RPTDIS_Msk; + } + + /* Enable arbitration slot now */ + XMC_VADC_GROUP_ScanEnableArbitrationSlot(group_ptr); + +} + +/* API to select one of the 16 inputs as a trigger input for Group Scan request source */ +void XMC_VADC_GROUP_ScanSelectTrigger(XMC_VADC_GROUP_t *const group_ptr, XMC_VADC_TRIGGER_INPUT_SELECT_t trigger_input) +{ + uint32_t scanctrl; + + XMC_ASSERT("XMC_VADC_GROUP_ScanSelectTrigger:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanSelectTrigger:Wrong Trigger Port", ((trigger_input)< XMC_VADC_NUM_PORTS)) + + scanctrl = group_ptr->ASCTRL; + scanctrl |= (uint32_t) VADC_G_ASCTRL_XTWC_Msk; + scanctrl &= ~((uint32_t)VADC_G_ASCTRL_XTSEL_Msk); + scanctrl |= (uint32_t)((uint32_t)trigger_input << VADC_G_ASCTRL_XTSEL_Pos); + group_ptr->ASCTRL = scanctrl; +} + +/* Select a trigger edge*/ +void XMC_VADC_GROUP_ScanSelectTriggerEdge(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_TRIGGER_EDGE_t trigger_edge) +{ + uint32_t scanctrl; + + XMC_ASSERT("XMC_VADC_GROUP_ScanSelectTriggerEdge:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanSelectTriggerEdge:Wrong Trigger Port", ((trigger_edge)<= XMC_VADC_TRIGGER_EDGE_ANY)) + + scanctrl = group_ptr->ASCTRL; + scanctrl |= (uint32_t) VADC_G_ASCTRL_XTWC_Msk; + scanctrl &= ~((uint32_t)VADC_G_ASCTRL_XTMODE_Msk); + scanctrl |= (uint32_t)((uint32_t)trigger_edge << VADC_G_ASCTRL_XTMODE_Pos); + group_ptr->ASCTRL = scanctrl; +} + +/* API to select one of the 16 inputs as a trigger gating input for Group Scan request source */ +void XMC_VADC_GROUP_ScanSelectGating(XMC_VADC_GROUP_t *const group_ptr, XMC_VADC_GATE_INPUT_SELECT_t gating_input) +{ + uint32_t scanctrl; + + XMC_ASSERT("XMC_VADC_GROUP_ScanSelectGating:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanSelectGating:Wrong Gating Port", ((gating_input)< XMC_VADC_NUM_PORTS)) + + scanctrl = group_ptr->ASCTRL; + scanctrl |= (uint32_t)VADC_G_ASCTRL_GTWC_Msk; + scanctrl &= ~((uint32_t)VADC_G_ASCTRL_GTSEL_Msk); + scanctrl |= (uint32_t)((uint32_t)gating_input << VADC_G_ASCTRL_GTSEL_Pos); + group_ptr->ASCTRL = scanctrl; +} + +/* API to stop an ongoing conversion of a sequence */ +void XMC_VADC_GROUP_ScanSequenceAbort(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t asctrl; + bool arbitration_status; + + XMC_ASSERT("XMC_VADC_GROUP_ScanSequenceAbort:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* To disable trigger and gating before abort*/ + asctrl = group_ptr->ASCTRL; + + group_ptr->ASCTRL =(0U | (uint32_t)VADC_G_ASCTRL_XTWC_Msk | + (uint32_t)VADC_G_ASCTRL_GTWC_Msk | (uint32_t)VADC_G_ASCTRL_TMWC_Msk ); + + /* To disable Arbitration before abort*/ + arbitration_status = (bool)((uint32_t)(group_ptr->ARBPR >> VADC_G_ARBPR_ASEN1_Pos) & 1U); + XMC_VADC_GROUP_ScanDisableArbitrationSlot(group_ptr); + + group_ptr->ASMR &= ~((uint32_t)VADC_G_ASMR_ENGT_Msk); + group_ptr->ASMR |= (uint32_t)VADC_G_ASMR_CLRPND_Msk; + + /* Enable the arbitration slot 1*/ + group_ptr->ARBPR |= (uint32_t)((uint32_t)arbitration_status << VADC_G_ARBPR_ASEN1_Pos); + + /* Enable any disabled gating*/ + group_ptr->ASCTRL =(asctrl | (uint32_t)VADC_G_ASCTRL_XTWC_Msk | + (uint32_t)VADC_G_ASCTRL_GTWC_Msk | (uint32_t)VADC_G_ASCTRL_TMWC_Msk ); +} + +/* API to find out number of channels awaiting conversion */ +uint32_t XMC_VADC_GROUP_ScanGetNumChannelsPending(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t reg; + uint32_t i; + uint32_t count; + + XMC_ASSERT("XMC_VADC_GROUP_ScanGetNumChannelsPending:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + + count = 0U; + + if (group_ptr->ASPND) + { + reg = group_ptr->ASPND; + + for(i=0U;i> (uint32_t)1); + } + } + + return count; +} + +/* API to select a service request line (NVIC Node) for request source event */ +void XMC_VADC_GROUP_ScanSetReqSrcEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_SR_t sr) +{ + uint32_t sevnp; + sevnp = group_ptr->SEVNP; + + XMC_ASSERT("XMC_VADC_GROUP_ScanSetReqSrcEventInterruptNode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanSetReqSrcEventInterruptNode:Wrong Service Request", ((sr) <= XMC_VADC_SR_SHARED_SR3)) + + sevnp &= ~((uint32_t)VADC_G_SEVNP_SEV1NP_Msk); + sevnp |= (uint32_t)((uint32_t)sr << VADC_G_SEVNP_SEV1NP_Pos); + + group_ptr->SEVNP = sevnp; +} + +/* Removes the selected channel from conversion*/ +void XMC_VADC_GROUP_ScanRemoveChannel(XMC_VADC_GROUP_t *const group_ptr, const uint32_t channel_num) +{ + uint32_t assel; + + XMC_ASSERT("XMC_VADC_GROUP_ScanRemoveChannel:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanRemoveChannel:Wrong channel number", ((channel_num)< XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + assel = group_ptr->ASSEL; + assel &= (~( 1 << channel_num)); + group_ptr->ASSEL = assel; +} +#endif + +/* API to initialize background scan request source hardware */ +void XMC_VADC_GLOBAL_BackgroundInit(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_BACKGROUND_CONFIG_t *config) +{ + #if (XMC_VADC_GROUP_AVAILABLE ==1U) + uint8_t i; + uint32_t reg; + uint32_t conv_start_mask; + #endif + + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundInit:Wrong Module Pointer", (global_ptr == VADC)) + + #if (XMC_VADC_GROUP_AVAILABLE ==1U) + for(i=(uint8_t)0; i < XMC_VADC_MAXIMUM_NUM_GROUPS; i++) + { + XMC_VADC_GROUP_BackgroundDisableArbitrationSlot((XMC_VADC_GROUP_t *)g_xmc_vadc_group_array[i]); + } + + conv_start_mask = (uint32_t) 0; + if (XMC_VADC_STARTMODE_WFS != (XMC_VADC_STARTMODE_t)config->conv_start_mode) + { + conv_start_mask = (uint32_t)VADC_G_ARBPR_CSM2_Msk; + } + + for(i=0U; i < XMC_VADC_MAXIMUM_NUM_GROUPS; i++) + { + reg = g_xmc_vadc_group_array[i]->ARBPR; + + reg &= ~(uint32_t)(VADC_G_ARBPR_PRIO2_Msk); + + /* Program the priority of the request source */ + reg |= (uint32_t)((uint32_t)config->req_src_priority << VADC_G_ARBPR_PRIO2_Pos); + + /* Program the start mode */ + reg |= conv_start_mask; + + g_xmc_vadc_group_array[i]->ARBPR = reg; + + } + #endif + + /* program BRSCTRL register */ + global_ptr->BRSCTRL = (uint32_t)(config->asctrl | (uint32_t)VADC_BRSCTRL_XTWC_Msk | (uint32_t)VADC_BRSCTRL_GTWC_Msk); + + /* program BRSMR register */ + global_ptr->BRSMR = (uint32_t)((config->asmr)| (uint32_t)((uint32_t)XMC_VADC_GATEMODE_IGNORE << VADC_BRSMR_ENGT_Pos)); + +#if (XMC_VADC_GROUP_AVAILABLE ==1U) + if (XMC_VADC_STARTMODE_CNR == (XMC_VADC_STARTMODE_t)(config->conv_start_mode)) + { + global_ptr->BRSMR |= (uint32_t)VADC_BRSMR_RPTDIS_Msk; + } +#endif + + #if (XMC_VADC_GROUP_AVAILABLE ==1U) + for(i=(uint8_t)0; i < XMC_VADC_MAXIMUM_NUM_GROUPS; i++) + { + XMC_VADC_GROUP_BackgroundEnableArbitrationSlot((XMC_VADC_GROUP_t *)g_xmc_vadc_group_array[i]); + } + #endif + +} + +/* API to select one of the 16 inputs as a trigger for background scan request source */ +void XMC_VADC_GLOBAL_BackgroundSelectTrigger(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t input_num) +{ + uint32_t scanctrl; + + XMC_ASSERT("VADC_BCKGND_SelectTriggerInput:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSelectTrigger:Wrong Trigger Port", ((input_num)< XMC_VADC_NUM_PORTS)) + + + scanctrl = global_ptr->BRSCTRL; + scanctrl |= (uint32_t)VADC_BRSCTRL_XTWC_Msk; + scanctrl &= ~((uint32_t)VADC_BRSCTRL_XTSEL_Msk); + scanctrl |= (uint32_t)(input_num << VADC_BRSCTRL_XTSEL_Pos); + global_ptr->BRSCTRL = scanctrl; +} + +/* Select a trigger edge*/ +void XMC_VADC_GLOBAL_BackgroundSelectTriggerEdge(XMC_VADC_GLOBAL_t *const global_ptr, + const XMC_VADC_TRIGGER_EDGE_t trigger_edge) +{ + uint32_t scanctrl; + + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSelectTriggerEdge:Wrong Global Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSelectTriggerEdge:Wrong Trigger Port", + ((trigger_edge)<= XMC_VADC_TRIGGER_EDGE_ANY)) + + scanctrl = global_ptr->BRSCTRL; + scanctrl |= (uint32_t) VADC_BRSCTRL_XTWC_Msk; + scanctrl &= ~((uint32_t)VADC_BRSCTRL_XTMODE_Msk); + scanctrl |= (uint32_t)((uint32_t)trigger_edge << VADC_BRSCTRL_XTMODE_Pos); + global_ptr->BRSCTRL = scanctrl; +} + + +/* API to select one of the 16 inputs as a trigger gate for background scan request source */ +void XMC_VADC_GLOBAL_BackgroundSelectGating(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t input_num) +{ + uint32_t scanctrl; + + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSelectGating:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSelectGating:Wrong Gating Port", ((input_num)< XMC_VADC_NUM_PORTS)) + + scanctrl = global_ptr->BRSCTRL; + scanctrl |= (uint32_t)VADC_BRSCTRL_GTWC_Msk; + scanctrl &= ~((uint32_t)VADC_BRSCTRL_GTSEL_Msk); + scanctrl |= (uint32_t)(input_num << VADC_BRSCTRL_GTSEL_Pos); + global_ptr->BRSCTRL = scanctrl; +} + +/* API to abort ongoing conversion of a sequence */ +void XMC_VADC_GLOBAL_BackgroundAbortSequence(XMC_VADC_GLOBAL_t *const global_ptr) +{ + uint32_t brsctrl; +#if (XMC_VADC_GROUP_AVAILABLE ==1U) + uint32_t i; + uint8_t grp_asen2_flag[XMC_VADC_MAXIMUM_NUM_GROUPS]; +#endif + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundAbortSequence:Wrong Module Pointer", (global_ptr == VADC)) + + /* To disable trigger and gating before abort*/ + brsctrl = global_ptr->BRSCTRL; + + global_ptr->BRSCTRL =(0U | (uint32_t)VADC_BRSCTRL_XTWC_Msk | (uint32_t)VADC_BRSCTRL_GTWC_Msk); + + /* Disable Background Request source */ + +#if (XMC_VADC_GROUP_AVAILABLE ==1U) + for(i=(uint8_t)0; i < XMC_VADC_MAXIMUM_NUM_GROUPS; i++) + { + grp_asen2_flag[i] = (uint8_t)(g_xmc_vadc_group_array[i]->ARBPR >> VADC_G_ARBPR_ASEN2_Pos); + XMC_VADC_GROUP_BackgroundDisableArbitrationSlot((XMC_VADC_GROUP_t *)g_xmc_vadc_group_array[i]); + } +#endif + + /* Abort the ongoing sequence */ + global_ptr->BRSMR |= (uint32_t)VADC_BRSMR_CLRPND_Msk; + +#if (XMC_VADC_GROUP_AVAILABLE ==1U) + /* Enable Background Request source */ + for(i=(uint8_t)0; i < XMC_VADC_MAXIMUM_NUM_GROUPS; i++) + { + if ((uint8_t)1 == grp_asen2_flag[i]) + { + XMC_VADC_GROUP_BackgroundEnableArbitrationSlot((XMC_VADC_GROUP_t*)g_xmc_vadc_group_array[i]); + } + } +#endif + + /* Re-enable any disabled trigger and gating*/ + global_ptr->BRSCTRL =(brsctrl | (uint32_t)VADC_BRSCTRL_XTWC_Msk | (uint32_t)VADC_BRSCTRL_GTWC_Msk); +} + +/* API to determine how many channels are awaiting conversion */ +uint32_t XMC_VADC_GLOBAL_BackgroundGetNumChannelsPending(XMC_VADC_GLOBAL_t *const global_ptr) +{ + uint32_t reg; + uint32_t i; + uint32_t j; + uint32_t count; + + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundGetNumChannelsPending:Wrong Module Pointer", (global_ptr == VADC)) + + count = 0U; + + /* Loop through all groups and find out who is awaiting conversion */ + for(i = 0U; i < XMC_VADC_MAXIMUM_NUM_GROUPS; i++) + { + if (global_ptr->BRSSEL[i]) + { + reg = global_ptr->BRSPND[i]; + + for(j=0U;j> 1U; + } + } + } + + return count; +} + +#if (XMC_VADC_QUEUE_AVAILABLE == 1U) +/* API to initialize queue request source */ +void XMC_VADC_GROUP_QueueInit(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_QUEUE_CONFIG_t *config) +{ + uint32_t reg; + + XMC_ASSERT("XMC_VADC_GROUP_QueueInit:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* Disable arbitration slot of the queue request source */ + XMC_VADC_GROUP_QueueDisableArbitrationSlot(group_ptr); + + reg = group_ptr->ARBPR; + + /* Request Source priority */ + reg &= ~((uint32_t)VADC_G_ARBPR_PRIO0_Msk); + reg |= (uint32_t) ((uint32_t)config->req_src_priority << VADC_G_ARBPR_PRIO0_Pos); + + /* Conversion Start mode */ + if (XMC_VADC_STARTMODE_WFS != (XMC_VADC_STARTMODE_t)config->conv_start_mode) + { + reg |= (uint32_t)(VADC_G_ARBPR_CSM0_Msk); + } + + group_ptr->ARBPR = reg; + + + group_ptr->QCTRL0 = (uint32_t)((config->qctrl0)|(uint32_t)(VADC_G_QCTRL0_XTWC_Msk)| + (uint32_t)(VADC_G_QCTRL0_TMWC_Msk)| + (uint32_t)(VADC_G_QCTRL0_GTWC_Msk)); + + /* Gating mode */ + group_ptr->QMR0 = ((uint32_t)(config->qmr0) | (uint32_t)((uint32_t)XMC_VADC_GATEMODE_IGNORE << VADC_G_QMR0_ENGT_Pos)); + + if (XMC_VADC_STARTMODE_CNR == (XMC_VADC_STARTMODE_t)(config->conv_start_mode) ) + { + group_ptr->QMR0 |= (uint32_t)((uint32_t)1 << VADC_G_QMR0_RPTDIS_Pos); + } + /* Enable arbitration slot for the queue request source */ + XMC_VADC_GROUP_QueueEnableArbitrationSlot(group_ptr); + +} + +/* API to select one of the 16 possible triggers as a conversion trigger for queue request source */ +void XMC_VADC_GROUP_QueueSelectTrigger(XMC_VADC_GROUP_t *const group_ptr, + const XMC_VADC_TRIGGER_INPUT_SELECT_t input_num) +{ + uint32_t qctrl; + + XMC_ASSERT("XMC_VADC_GROUP_QueueSelectTrigger:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_QueueSelectTrigger:Wrong Trigger Port", ((input_num)< XMC_VADC_NUM_PORTS)) + + + /* Now select the conversion trigger */ + qctrl = group_ptr->QCTRL0; + qctrl |= (uint32_t)VADC_G_QCTRL0_XTWC_Msk; + qctrl &= ~((uint32_t)VADC_G_QCTRL0_XTSEL_Msk); + qctrl |= (uint32_t)((uint32_t)input_num << VADC_G_QCTRL0_XTSEL_Pos); + group_ptr->QCTRL0 = qctrl; +} + +/* Select a trigger edge*/ +void XMC_VADC_GROUP_QueueSelectTriggerEdge(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_TRIGGER_EDGE_t trigger_edge) +{ + uint32_t qctrl; + + XMC_ASSERT("XMC_VADC_GROUP_QueueSelectTriggerEdge:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_QueueSelectTriggerEdge:Wrong Gating Port", ((trigger_edge)<= XMC_VADC_TRIGGER_EDGE_ANY)) + + /* Now select the gating input */ + qctrl = group_ptr->QCTRL0; + qctrl |= (uint32_t)VADC_G_QCTRL0_XTWC_Msk; + qctrl &= ~((uint32_t)VADC_G_QCTRL0_XTMODE_Msk); + qctrl |= (uint32_t)((uint32_t)trigger_edge << VADC_G_QCTRL0_XTMODE_Pos); + group_ptr->QCTRL0 = qctrl; +} + +/* API to select one of the 16 possible trigger gates as a trigger gating signal for queue request source */ +void XMC_VADC_GROUP_QueueSelectGating(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GATE_INPUT_SELECT_t input_num) +{ + uint32_t qctrl; + + XMC_ASSERT("XMC_VADC_GROUP_QueueSelectGating:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_QueueSelectGating:Wrong Gating Port", ((input_num)< XMC_VADC_NUM_PORTS)) + + /* Now select the gating input */ + qctrl = group_ptr->QCTRL0; + qctrl |= (uint32_t)VADC_G_QCTRL0_GTWC_Msk; + qctrl &= ~((uint32_t)VADC_G_QCTRL0_GTSEL_Msk); + qctrl |= (uint32_t)((uint32_t)input_num << VADC_G_QCTRL0_GTSEL_Pos); + group_ptr->QCTRL0 = qctrl; +} + +/* API to determine the number of channels in the queue (length includes the valid channel in the Backup register)*/ +uint32_t XMC_VADC_GROUP_QueueGetLength(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t qsr; + uint32_t qbur0; + uint32_t length; + + XMC_ASSERT("XMC_VADC_GROUP_QueueGetLength:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + qsr = group_ptr->QSR0; + qbur0 = group_ptr->QBUR0; + + if (qsr & (uint32_t)VADC_G_QSR0_EMPTY_Msk) + { + length = 0U; + } + else + { + length = (qsr & (uint32_t)VADC_G_QSR0_FILL_Msk) + 1U; + } + + if (qbur0 & (uint32_t)VADC_G_QBUR0_V_Msk ) + { + length++; + } + + return length; +} + +/* API to abort ongoing conversion of a channel sequence */ +void XMC_VADC_GROUP_QueueAbortSequence(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t qctrl0; + bool arbitration_status; + + XMC_ASSERT("XMC_VADC_GROUP_QueueAbortSequence:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* Disable any gating if present*/ + qctrl0 = group_ptr->QCTRL0; + + group_ptr->QCTRL0 =(0U | (uint32_t)VADC_G_QCTRL0_XTWC_Msk | + (uint32_t)VADC_G_QCTRL0_GTWC_Msk | (uint32_t)VADC_G_QCTRL0_TMWC_Msk ); + + /* Disable the Arbitration 0 in the group before abort*/ + arbitration_status = (bool)((uint32_t)(group_ptr->ARBPR >> VADC_G_ARBPR_ASEN0_Pos) & 1U); + XMC_VADC_GROUP_QueueDisableArbitrationSlot(group_ptr); + + /* Flush the Entries from queue*/ + XMC_VADC_GROUP_QueueFlushEntries(group_ptr); + + /* Enable the arbitration slot 0*/ + group_ptr->ARBPR |= (uint32_t)((uint32_t)arbitration_status << VADC_G_ARBPR_ASEN0_Pos); + + /* Enable any disabled gating*/ + group_ptr->QCTRL0 = (qctrl0 | (uint32_t)VADC_G_QCTRL0_XTWC_Msk | + (uint32_t)VADC_G_QCTRL0_GTWC_Msk | (uint32_t)VADC_G_QCTRL0_TMWC_Msk ); +} + +/* API to abort conversion of the channel queued up next */ +void XMC_VADC_GROUP_QueueRemoveChannel(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t length_before_abort; + uint32_t length_after_abort; + uint32_t qctrl0; + bool arbitration_status; + + XMC_ASSERT("XMC_VADC_GROUP_QueueRemoveChannel:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* Disable any gating if present*/ + qctrl0= group_ptr->QCTRL0; + + group_ptr->QCTRL0 =(0U | (uint32_t)VADC_G_QCTRL0_XTWC_Msk | + (uint32_t)VADC_G_QCTRL0_GTWC_Msk | (uint32_t)VADC_G_QCTRL0_TMWC_Msk ); + + /* Disable the Arbitration 0 in the group before abort*/ + arbitration_status = (bool)((uint32_t)(group_ptr->ARBPR >> VADC_G_ARBPR_ASEN0_Pos) & 1U); + XMC_VADC_GROUP_QueueDisableArbitrationSlot(group_ptr); + + length_before_abort = XMC_VADC_GROUP_QueueGetLength(group_ptr); + + if (length_before_abort) + { + /* Remove the first entry of the queue */ + group_ptr->QMR0 |= (uint32_t)VADC_G_QMR0_CLRV_Msk; + + length_after_abort = XMC_VADC_GROUP_QueueGetLength(group_ptr); + + /* Loop until a reduction in queue length is assessed */ + while(length_after_abort == length_before_abort) + { + length_after_abort = XMC_VADC_GROUP_QueueGetLength(group_ptr); + } + } + /* Enable the arbitration slot 0*/ + group_ptr->ARBPR |= (uint32_t)((uint32_t)arbitration_status << VADC_G_ARBPR_ASEN0_Pos); + + /* Enable any disabled gating*/ + group_ptr->QCTRL0 = (qctrl0 | (uint32_t)VADC_G_QCTRL0_XTWC_Msk | + (uint32_t)VADC_G_QCTRL0_GTWC_Msk | (uint32_t)VADC_G_QCTRL0_TMWC_Msk ); +} + +/* Get details of channel meant to be converted right after the ongoing conversion */ +int32_t XMC_VADC_GROUP_QueueGetNextChannel(XMC_VADC_GROUP_t *const group_ptr) +{ + int32_t ch_num; + + XMC_ASSERT("XMC_VADC_GROUP_QueueGetNextChannel:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* + * Check if there is something in the backup stage. If not, read queue-0 + * entry. + */ + if ( (group_ptr->QBUR0) & (uint32_t)VADC_G_QBUR0_V_Msk) + { + ch_num = (int32_t)(group_ptr->QBUR0 & (uint32_t)VADC_G_QBUR0_REQCHNR_Msk); + } + else if ( (group_ptr->Q0R0) & (uint32_t)VADC_G_Q0R0_V_Msk) + { + ch_num = (int32_t)(group_ptr->Q0R0 & (uint32_t)VADC_G_Q0R0_REQCHNR_Msk); + } + else + { + /* Nothing is pending */ + ch_num = -1; + } + + return ch_num; +} + +/* Get the channel number of the channel whose conversion had been interrupted */ +int32_t XMC_VADC_GROUP_QueueGetInterruptedChannel(XMC_VADC_GROUP_t *const group_ptr) +{ + int32_t ch_num; + + XMC_ASSERT("XMC_VADC_GROUP_QueueGetInterruptedChannel:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + if ((group_ptr->QBUR0) & (uint32_t)VADC_G_QBUR0_V_Msk) + { + ch_num = (int32_t)(group_ptr->QBUR0 & (uint32_t)VADC_G_QBUR0_REQCHNR_Msk); + } + else + { + /* No such channel */ + ch_num = -1; + } + + return ch_num; +} + +/* Select a Service Request line for the request source event */ +void XMC_VADC_GROUP_QueueSetReqSrcEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_SR_t sr) +{ + uint32_t sevnp; + + XMC_ASSERT("XMC_VADC_GROUP_QueueSetReqSrcEventInterruptNode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_QueueSetReqSrcEventInterruptNode:Wrong Service Request", ((sr) <= XMC_VADC_SR_SHARED_SR3)) + + sevnp = group_ptr->SEVNP; + + sevnp &= ~((uint32_t)VADC_G_SEVNP_SEV0NP_Msk); + sevnp |= (uint32_t)((uint32_t)sr << VADC_G_SEVNP_SEV0NP_Pos); + + group_ptr->SEVNP = sevnp; + +} +#endif + +#if (XMC_VADC_GROUP_AVAILABLE ==1U) +/* API to initialize a channel unit */ +void XMC_VADC_GROUP_ChannelInit(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num, + const XMC_VADC_CHANNEL_CONFIG_t *config) +{ + uint32_t prio; + uint32_t ch_assign; + uint32_t mask; + + + XMC_ASSERT("XMC_VADC_GROUP_ChannelInit:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelInit:Wrong Channel Number", ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + prio = (uint32_t)config->channel_priority; + + /* Priority channel */ + ch_assign = group_ptr->CHASS; + ch_assign &= ~((uint32_t)((uint32_t)1 << ch_num)); + ch_assign |= (uint32_t)(prio << ch_num); + group_ptr->CHASS = ch_assign; + + /* Alias channel */ + if (config->alias_channel >= (int32_t)0) + { + mask = (uint32_t)0; + if ((uint32_t)1 == ch_num) + { + mask = VADC_G_ALIAS_ALIAS1_Pos; + group_ptr->ALIAS &= ~(uint32_t)(VADC_G_ALIAS_ALIAS1_Msk); + } + else if ((uint32_t)0 == ch_num) + { + mask = VADC_G_ALIAS_ALIAS0_Pos; + group_ptr->ALIAS &= ~(uint32_t)(VADC_G_ALIAS_ALIAS0_Msk); + } + + group_ptr->ALIAS |= (uint32_t)(config->alias_channel << mask); + } + + group_ptr->BFL |= config->bfl; + +#if (XMC_VADC_BOUNDARY_FLAG_SELECT == 1U) + group_ptr->BFLC |= config->bflc; +#endif + /* Program the CHCTR register */ + group_ptr->CHCTR[ch_num] = config->chctr; + +} + +/* API to set an alias channel for channels numbered 2 through 7 */ +void XMC_VADC_GROUP_SetChannelAlias(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t src_ch_num, + const uint32_t alias_ch_num) +{ + uint32_t alias; + uint32_t mask; + uint32_t pos; + + XMC_ASSERT("XMC_VADC_GROUP_SetChannelAlias:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_SetChannelAlias:Wrong Alias Channel", ((alias_ch_num == 0)|| (alias_ch_num == 1U))) + XMC_ASSERT("XMC_VADC_GROUP_SetChannelAlias:Wrong Aliased Channel", ((src_ch_num < 8U))) + + alias = group_ptr->ALIAS; + + if (0U == alias_ch_num) + { + mask = (uint32_t) VADC_G_ALIAS_ALIAS0_Msk; + pos = (uint32_t) VADC_G_ALIAS_ALIAS0_Pos; + } + else + { + mask = (uint32_t) VADC_G_ALIAS_ALIAS1_Msk; + pos = (uint32_t) VADC_G_ALIAS_ALIAS1_Pos; + } + alias &= ~mask; + alias |= (uint32_t)(src_ch_num << pos); + + group_ptr->ALIAS = alias; +} + +/* API to determine whether input to a channel has violated boundary conditions */ +bool XMC_VADC_GROUP_ChannelIsResultOutOfBounds(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + bool retval; + uint32_t chctr; + uint32_t ceflag; + + XMC_ASSERT("XMC_VADC_GROUP_ChannelIsResultOutOfBounds:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelIsResultOutOfBounds:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + retval = (bool)false; + /* + Check if the Channel event is configured to be generated in the event of + boundary violation and if affirmative, check if the channel event is set. + */ + /* Extract CHEVMODE for requested channel */ + chctr = group_ptr->CHCTR[ch_num]; + chctr = (uint32_t)(chctr >> (uint32_t)VADC_G_CHCTR_CHEVMODE_Pos)& (uint32_t)0x3; + + /* Extract CEFLAG for the requested channel */ + ceflag = group_ptr->CEFLAG; + ceflag = ceflag & ((uint32_t)((uint32_t)1 << ch_num) ); + + /* Check what was the channel event generation criteria */ + if ( (( (uint32_t)XMC_VADC_CHANNEL_EVGEN_INBOUND == chctr) \ + || ((uint32_t) XMC_VADC_CHANNEL_EVGEN_OUTBOUND == chctr)) && (ceflag) ) + { + retval = (bool)true; + } + + return retval; +} + +/* Set a reference voltage for conversion */ +void XMC_VADC_GROUP_ChannelSetInputReference(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const XMC_VADC_CHANNEL_REF_t ref) +{ + uint32_t chctr; + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetInputReference:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetInputReference:Wrong Channel Number", ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetInputReference:Wrong Voltage Reference", ((ref)<= XMC_VADC_CHANNEL_REF_ALT_CH0)) + + chctr = group_ptr->CHCTR[ch_num]; + chctr &= ~((uint32_t)VADC_G_CHCTR_REFSEL_Msk); + chctr |= (uint32_t)((uint32_t)ref << VADC_G_CHCTR_REFSEL_Pos); + + group_ptr->CHCTR[ch_num] = chctr; +} + +/* API to select one of the available 16 registers for storing the channel result */ +void XMC_VADC_GROUP_ChannelSetResultRegister(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const uint32_t result_reg_num) +{ + uint32_t chctr; + + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetResultRegister:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetResultRegister:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetResultRegister:Wrong Result Register", + ((result_reg_num) < XMC_VADC_NUM_RESULT_REGISTERS)) + + chctr = group_ptr->CHCTR[ch_num]; + chctr &= ~((uint32_t)VADC_G_CHCTR_RESREG_Msk); + chctr |= (uint32_t)(result_reg_num << VADC_G_CHCTR_RESREG_Pos); + + group_ptr->CHCTR[ch_num] = chctr; +} + +/* API to select one of the available 4 class conversion */ +void XMC_VADC_GROUP_ChannelSetIclass(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const XMC_VADC_CHANNEL_CONV_t conversion_class) +{ + + uint32_t chctr; + + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetIclass:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetIclass:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetIclass:Wrong input class ", + (XMC_VADC_CHANNEL_CONV_GLOBAL_CLASS1 >= conversion_class)) + + chctr = group_ptr->CHCTR[ch_num]; + chctr &= ~((uint32_t)VADC_G_CHCTR_ICLSEL_Msk); + chctr |= (uint32_t)((uint32_t)conversion_class << (uint32_t)VADC_G_CHCTR_ICLSEL_Pos); + + group_ptr->CHCTR[ch_num] = chctr; + +} + +/* API to retrieve the result register bound with specified channel */ +uint8_t XMC_VADC_GROUP_ChannelGetResultRegister(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + uint8_t resreg; + + XMC_ASSERT("XMC_VADC_GROUP_ChannelGetResultRegister:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelGetResultRegister:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + resreg = (uint8_t)((group_ptr->CHCTR[ch_num] & (uint32_t)VADC_G_CHCTR_RESREG_Msk) >> VADC_G_CHCTR_RESREG_Pos) ; + + return resreg; +} + +/* API to manually assert channel event */ +void XMC_VADC_GROUP_ChannelTriggerEvent(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + uint32_t ceflag; + + XMC_ASSERT("XMC_VADC_GROUP_ChannelTriggerEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelTriggerEvent:Wrong Channel Number", ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + ceflag = group_ptr->CEFLAG; + ceflag |= (uint32_t)((uint32_t)1 << ch_num); + group_ptr->CEFLAG = ceflag; +} + +/* API to bind channel event with a service request (NVIC Node) */ +void XMC_VADC_GROUP_ChannelSetEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const XMC_VADC_SR_t sr) +{ + uint32_t route_mask; + + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetEventInterruptNode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetEventInterruptNode:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetEventInterruptNode:Wrong Service Request", ((sr) <= XMC_VADC_SR_SHARED_SR3)) + + route_mask = group_ptr->CEVNP0; + route_mask &= ~((uint32_t)15 << (ch_num * (uint32_t)4)); + route_mask |= (uint32_t)( (uint32_t)sr << (ch_num * (uint32_t)4)); + group_ptr->CEVNP0 = route_mask; +} + +/* API to configure conditions for generation of channel event */ +void XMC_VADC_GROUP_ChannelTriggerEventGenCriteria( XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const XMC_VADC_CHANNEL_EVGEN_t criteria) +{ + uint32_t chctr; + + XMC_ASSERT("XMC_VADC_GROUP_ChannelTriggerEventGenCriteria:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelTriggerEventGenCriteria:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelTriggerEventGenCriteria:Wrong Event Generation Criteria", + ((criteria) <= XMC_VADC_CHANNEL_EVGEN_ALWAYS)) + + chctr = group_ptr->CHCTR[ch_num]; + chctr &= ~((uint32_t)VADC_G_CHCTR_CHEVMODE_Msk); + chctr |= (uint32_t)((uint32_t)criteria << VADC_G_CHCTR_CHEVMODE_Pos); + group_ptr->CHCTR[ch_num] = chctr; +} + +/* API to configure the boundary selection */ +void XMC_VADC_GROUP_ChannelSetBoundarySelection(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + XMC_VADC_BOUNDARY_SELECT_t boundary_sel, + XMC_VADC_CHANNEL_BOUNDARY_t selection) +{ + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetBoundarySelection:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetBoundarySelection:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + group_ptr->CHCTR[ch_num] &= ~((uint32_t)VADC_G_CHCTR_BNDSELL_Msk << boundary_sel); + group_ptr->CHCTR[ch_num] |= (selection<< ((uint32_t)VADC_G_CHCTR_BNDSELL_Pos + (uint32_t)boundary_sel)); +} + +/* Make the specified result register part of Result FIFO */ +void XMC_VADC_GROUP_AddResultToFifo(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + uint32_t fen; + + XMC_ASSERT("XMC_VADC_GROUP_AddResultToFifo:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_AddResultToFifo:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + + /* Extract and clear the FIFO enable field */ + fen = group_ptr->RCR[res_reg]; + fen &= ~((uint32_t)VADC_G_RCR_FEN_Msk); + /* Set this register up as a FIFO member */ + fen |= (uint32_t)((uint32_t)1 << VADC_G_RCR_FEN_Pos); + group_ptr->RCR[res_reg] = fen; +} + + +/* Applicable to fast compare mode, this API sets up the value which is to be compared against conversion result */ +void XMC_VADC_GROUP_SetResultFastCompareValue(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t res_reg, + const XMC_VADC_RESULT_SIZE_t compare_val) +{ + uint32_t res = group_ptr->RES[res_reg]; + + XMC_ASSERT("XMC_VADC_GROUP_SetResultFastCompareValue:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_SetResultFastCompareValue:Wrong Result Register", + ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + + res &= ~((uint32_t)VADC_G_RES_RESULT_Msk); + res |= (uint32_t)((uint32_t)compare_val << XMC_VADC_RESULT_LEFT_ALIGN_10BIT); + group_ptr->RES[res_reg] = res; +} + +/* API to retrieve the result of fast mode comparison */ +XMC_VADC_FAST_COMPARE_t XMC_VADC_GROUP_GetFastCompareResult(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + XMC_VADC_FAST_COMPARE_t result; + uint32_t res; + + XMC_ASSERT("XMC_VADC_GROUP_GetFastCompareResult:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_GetFastCompareResult:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + + res = group_ptr->RES[res_reg]; + + if (res & (uint32_t)VADC_G_RES_VF_Msk) + { + result = (XMC_VADC_FAST_COMPARE_t)((uint32_t)(res >> (uint32_t)VADC_G_RES_FCR_Pos) & (uint32_t)1); + } + else + { + result = XMC_VADC_FAST_COMPARE_UNKNOWN; + } + + return result; +} + +/* Applicable to fast compare mode, this API sets up the value which is to be compared against conversion result */ +void XMC_VADC_GROUP_SetResultSubtractionValue(XMC_VADC_GROUP_t *const group_ptr, + const uint16_t subtraction_val) +{ + uint32_t res; + + XMC_ASSERT("XMC_VADC_GROUP_SetResultSubtractionValue:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + res = group_ptr->RES[0]; + res &= ~((uint32_t)VADC_G_RES_RESULT_Msk); + res |= (uint32_t)subtraction_val; + group_ptr->RES[0] = res; +} + + +/* API to select a service request line (NVIC Node) for result event of specified unit of result hardware */ +void XMC_VADC_GROUP_SetResultInterruptNode(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t res_reg, + const XMC_VADC_SR_t sr) +{ + uint32_t route_mask; + + XMC_ASSERT("XMC_VADC_GROUP_SetResultInterruptNode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_SetResultInterruptNode:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + XMC_ASSERT("XMC_VADC_GROUP_SetResultInterruptNode:Wrong Service Request", ((sr) <= XMC_VADC_SR_SHARED_SR3)) + + if (res_reg <= 7U) + { + route_mask = group_ptr->REVNP0; + route_mask &= ~((uint32_t)((uint32_t)15 << (res_reg * (uint32_t)4) )); + route_mask |= (uint32_t)((uint32_t)sr << (res_reg * (uint32_t)4)); + group_ptr->REVNP0 = route_mask; + } + else + { + route_mask = group_ptr->REVNP1; + route_mask &= ~((uint32_t)((uint32_t)15 << (( res_reg - (uint32_t)8) * (uint32_t)4) )); + route_mask |= (uint32_t)((uint32_t)sr << ((res_reg - (uint32_t)8) * (uint32_t)4)); + group_ptr->REVNP1 = route_mask; + } +} + +/* API to retrieve the tail of the fifo which the specified result register is a part of */ +uint32_t XMC_VADC_GROUP_GetResultFifoTail(XMC_VADC_GROUP_t *const group_ptr, uint32_t res_reg) +{ + uint32_t tail; + uint32_t rcr; + int32_t i; + bool exit_flag; + + XMC_ASSERT("XMC_VADC_GROUP_GetResultFifoTail:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_GetResultFifoTail:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + + tail = 0U; + exit_flag= (bool)false; + + if ((bool)true == XMC_VADC_GROUP_IsResultRegisterFifoHead(group_ptr, res_reg)) + { + res_reg = res_reg - 1U; + } + + /* Border condition */ + if (0U == res_reg) + { + tail = 0U; + } + else + { + /* Stop either at a node that does not have FEN set or at Node-0 */ + for(i = (int32_t)res_reg; i >= (int32_t)0; i--) + { + rcr = group_ptr->RCR[i]; + rcr &= (uint32_t)VADC_G_RCR_FEN_Msk; + + if (rcr) + { + if ((int32_t)0 == i) + { + /* No more nodes. Stop here */ + tail = (uint32_t)0; + exit_flag = (bool)true; + } + } + else + { + /* The preceding register forms the tail of the FIFO */ + tail = (uint32_t)i + (uint32_t)1; + exit_flag = (bool)true; + } + if (exit_flag) + { + break; + } + } + } + return tail; +} + +/* API to retrieve the head of the fifo which the specified result register is a part of */ +uint32_t XMC_VADC_GROUP_GetResultFifoHead(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + uint32_t head; + uint32_t rcr; + uint32_t i; + + XMC_ASSERT("XMC_VADC_GROUP_GetResultFifoHead:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_GetResultFifoHead:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + + if ((bool)true == XMC_VADC_GROUP_IsResultRegisterFifoHead(group_ptr, res_reg)) + { + head = res_reg; + } + else + { + head = XMC_VADC_NUM_RESULT_REGISTERS - (uint32_t)1; + + for(i = res_reg; i < XMC_VADC_NUM_RESULT_REGISTERS ; i++) + { + rcr = group_ptr->RCR[i]; + rcr &= (uint32_t)VADC_G_RCR_FEN_Msk; + + if (!rcr) + { + /* This node forms the head of the FIFO */ + head = i ; + break; + } + } + } + return head; +} + +/* API to determine if the specified result register is the head of a result fifo */ +bool XMC_VADC_GROUP_IsResultRegisterFifoHead(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + bool ret_val; + uint32_t rcr_head; + uint32_t rcr_next; + + XMC_ASSERT("XMC_VADC_GROUP_IsResultRegisterFifoHead:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_IsResultRegisterFifoHead:Wrong Result Register", + ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + + rcr_head = group_ptr->RCR[res_reg]; + rcr_head &= (uint32_t)VADC_G_RCR_FEN_Msk; + rcr_next = group_ptr->RCR[res_reg - (uint32_t)1]; + rcr_next &= (uint32_t)VADC_G_RCR_FEN_Msk; + + if (rcr_head) + { + ret_val = (bool)false; + } + else if (rcr_next) + { + ret_val = (bool)true; + } + else + { + ret_val = (bool)false; + } + + return ret_val; +} + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_wdt.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_wdt.c new file mode 100644 index 00000000..43018b1d --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Libraries/XMCLib/src/xmc_wdt.c @@ -0,0 +1,94 @@ +/** + * @file xmc_wdt.c + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-06-20: + * - Removed definition of GetDriverVersion API
+ * + * @endcond + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include "xmc_wdt.h" +#include "xmc_scu.h" + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* Enables watchdog clock and releases watchdog reset. */ +void XMC_WDT_Enable(void) +{ +#if UC_FAMILY == XMC4 + XMC_SCU_CLOCK_EnableClock(XMC_SCU_CLOCK_WDT); +#endif + +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_WDT); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_WDT); +#endif +} + +/* Disables watchdog clock and resets watchdog. */ +void XMC_WDT_Disable(void) +{ +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_WDT); +#endif +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_WDT); +#endif + +#if UC_FAMILY == XMC4 + XMC_SCU_CLOCK_DisableClock(XMC_SCU_CLOCK_WDT); +#endif +} +/* Initializes and configures watchdog with configuration data pointed by \a config. */ +void XMC_WDT_Init(const XMC_WDT_CONFIG_t *const config) +{ + XMC_WDT_Enable(); + WDT->CTR = config->wdt_ctr; + WDT->WLB = config->window_lower_bound; + WDT->WUB = config->window_upper_bound; +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Startup/startup_XMC1400.S b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Startup/startup_XMC1400.S new file mode 100644 index 00000000..b5c24fff --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Startup/startup_XMC1400.S @@ -0,0 +1,375 @@ +/********************************************************************************************************************* + * @file startup_XMC1400.S + * @brief CMSIS Core Device Startup File for Infineon XMC1400 Device Series + * @version V1.1 + * @date 05 Jan 2016 + * + * @cond + ********************************************************************************************************************* + * Copyright (c) 2015-2016, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + **************************** Change history ******************************** + * V1.0, Sep, 03, 2015 JFT:Initial version + * MCLK=8MHz, PCLK=16MHz + * V1.1, Jan, 05, 2016 JFT:Fix .reset section attributes + * + * @endcond + */ + +/***************************************************************************** + * Clock system handling by SSW + * CLK_VAL1 Configuration + * FDIV Fractional Divider Selection <0-1023> + * Deafult: 0. Fractional part of clock divider, MCLK = DCO1 / (IDIV + (FDIV / 1024)) + * IDIV Divider Selection <1-16> + * Deafult: 6. Interger part of clock divider, MCLK = DCO1 / (IDIV + (FDIV / 1024) = 8MHz) + * PCLKSEL PCLK Clock Select + * <0=> PCLK = MCLK + * <1=> PCLK = 2 x MCLK + * Deafult: 2 x MCLK + * RTCCLKSEL RTC Clock Select + * <0=> 32.768kHz standby clock + * <1=> 32.768kHz external clock from ERU0.IOUT0 + * <2=> 32.768kHz external clock from ACMP0.OUT + * <3=> 32.768kHz external clock from ACMP1.OUT + * <4=> 32.768kHz external clock from ACMP2.OUT + * <5=> 32.768kHz XTAL clock via OSC_LP + * <6=> Reserved + * <7=> Reserved + * Deafult: 32.768kHz standby clock + * do not move CLK_VAL1 to SCU_CLKCR[0..19] + * + *****************************************************************************/ +#define CLKVAL1_SSW 0x00041800 + +/***************************************************************************** + * CLK_VAL2 Configuration + * disable VADC and SHS Gating + * disable CCU80 Gating + * disable CCU40 Gating + * disable USIC0 Gating + * disable BCCU0 Gating + * disable LEDTS0 Gating + * disable LEDTS1 Gating + * disable POSIF0 Gating + * disable MATH Gating + * disable WDT Gating + * disable RTC Gating + * disable CCU81 Gating + * disable CCU41 Gating + * disable USIC1 Gating + * disable LEDTS2 Gating + * disable POSIF1 Gating + * disable MCAN0 Gating + * do not move CLK_VAL2 to SCU_CGATCLR0[0..10] + * + *****************************************************************************/ +#define CLKVAL2_SSW 0x00000100 + +/* A couple of macros to ease definition of the various handlers */ +.macro Insert_InterruptHandler Interrupt + .weak \Interrupt\()_Handler + .thumb_set \Interrupt\()_Handler, Default_Handler +.endm + +.macro Insert_InterruptVeener Interrupt + .globl \Interrupt\()_Veener +\Interrupt\()_Veener: + LDR R0, =\Interrupt\()_Handler + BX R0 +.endm + +/* ================== START OF VECTOR TABLE DEFINITION ====================== */ +/* Vector Table - This is indirectly branched to through the veneers */ + .syntax unified + .cpu cortex-m0 + + .section .reset, "a", %progbits + + .align 2 + + .globl __Vectors + .type __Vectors, %object +__Vectors: + .long __initial_sp /* Top of Stack */ + .long Reset_Handler /* Reset Handler */ +/* + * All entries below are redundant for M0, but are retained because they can + * in the future be directly ported to M0 Plus devices. + */ + .long 0 /* Reserved */ + .long HardFault_Handler /* Hard Fault Handler */ + .long CLKVAL1_SSW /* Reserved */ + .long CLKVAL2_SSW /* Reserved */ +#ifdef RETAIN_VECTOR_TABLE + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long SVC_Handler /* SVCall Handler */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long PendSV_Handler /* PendSV Handler */ + .long SysTick_Handler /* SysTick Handler */ + + /* Interrupt Handlers for Service Requests (SR) from XMC1400 Peripherals */ + .long IRQ0_Handler /* SCU.SR0, CAN0.SR0, CCU40.SR0, SCU.SR0 | CAN0.SR0 */ + .long IRQ1_Handler /* SCU.SR1, CAN0.SR1, CCU80.SR0, SCU.SR1 | CAN0.SR1 */ + .long IRQ2_Handler /* SCU.SR2, CAN0.SR2, CCU80.SR1, SCU.SR2 | CAN0.SR2 */ + .long IRQ3_Handler /* ERU0.SR0, ERU1.SR0, CAN0.SR0, ERU0.SR0 | ERU1.SR0 */ + .long IRQ4_Handler /* ERU0.SR1, ERU1.SR1, CAN0.SR1, ERU0.SR1 | ERU1.SR1 */ + .long IRQ5_Handler /* ERU0.SR2, ERU1.SR2, CAN0.SR2, ERU0.SR2 | ERU1.SR2 */ + .long IRQ6_Handler /* ERU0.SR3, ERU1.SR3, CAN0.SR3, ERU0.SR3 | ERU1.SR3 */ + .long IRQ7_Handler /* MATH.SR0, CAN0.SR3, CCU40.SR1, MATH.SR0 | CAN0.SR3 */ + .long IRQ8_Handler /* LEDTS2.SR0, CCU40.SR0, CCU80.SR0, LEDTS2.SR0 | CCU40.SR0 */ + .long IRQ9_Handler /* USIC0.SR0, USIC1.SR0, ERU0.SR0, USIC0.SR0 | USIC1.SR0 */ + .long IRQ10_Handler /* USIC0.SR1, USIC1.SR1, ERU0.SR1, USIC0.SR1 | USIC1.SR1 */ + .long IRQ11_Handler /* USIC0.SR2, USIC1.SR2, ERU0.SR2, USIC0.SR2 | USIC1.SR2 */ + .long IRQ12_Handler /* USIC0.SR3, USIC1.SR3, ERU0.SR3, USIC0.SR3 | USIC1.SR3 */ + .long IRQ13_Handler /* USIC0.SR4, USIC1.SR4, CCU80.SR1, USIC0.SR4 | USIC1.SR4 */ + .long IRQ14_Handler /* USIC0.SR5, USIC1.SR5, POSIF0.SR0, USIC0.SR5 | USIC1.SR5 */ + .long IRQ15_Handler /* VADC0.C0SR0, USIC0.SR0, POSIF0.SR1, VADC0.C0SR0 | USIC0.SR0 */ + .long IRQ16_Handler /* VADC0.C0SR1, USIC0.SR1, CCU40.SR2, VADC0.C0SR1 | USIC0.SR1 */ + .long IRQ17_Handler /* VADC0.G0SR0, USIC0.SR2, CAN0.SR0, VADC0.G0SR0 | USIC0.SR2 */ + .long IRQ18_Handler /* VADC0.G0SR1, USIC0.SR3, CAN0.SR1, VADC0.G0SR1 | USIC0.SR3 */ + .long IRQ19_Handler /* VADC0.G1SR0, USIC0.SR4, CAN0.SR2, VADC0.G1SR0 | USIC0.SR4 */ + .long IRQ20_Handler /* VADC0.G1SR1, USIC0.SR5, CAN0.SR3, VADC0.G1SR1 | USIC0.SR5 */ + .long IRQ21_Handler /* CCU40.SR0, CCU41.SR0, USIC0.SR0, CCU40.SR0 | CCU41.SR0 */ + .long IRQ22_Handler /* CCU40.SR1, CCU41.SR1, USIC0.SR1, CCU40.SR1 | CCU41.SR1 */ + .long IRQ23_Handler /* CCU40.SR2, CCU41.SR2, USIC0.SR2, CCU40.SR2 | CCU41.SR2 */ + .long IRQ24_Handler /* CCU40.SR3, CCU41.SR3, USIC0.SR3, CCU40.SR3 | CCU41.SR3 */ + .long IRQ25_Handler /* CCU80.SR0, CCU81.SR0, USIC0.SR4, CCU80.SR0 | CCU81.SR0 */ + .long IRQ26_Handler /* CCU80.SR1, CCU81.SR1, USIC0.SR5, CCU80.SR1 | CCU81.SR1 */ + .long IRQ27_Handler /* POSIF0.SR0, POSIF1.SR0, CCU40.SR3, POSIF0.SR0 | POSIF1.SR0 */ + .long IRQ28_Handler /* POSIF0.SR1, POSIF1.SR1, ERU0.SR0, POSIF0.SR1 | POSIF1.SR1 */ + .long IRQ29_Handler /* LEDTS0.SR0, CCU40.SR1, ERU0.SR1, LEDTS0.SR0 | CCU40.SR1 */ + .long IRQ30_Handler /* LEDTS1.SR0, CCU40.SR2, ERU0.SR2, LEDTS1.SR0 | CCU40.SR2 */ + .long IRQ31_Handler /* BCCU0.SR0, CCU40.SR3, ERU0.SR3, BCCU0.SR0 | CCU40.SR3 */ +#endif + + .size __Vectors, . - __Vectors +/* ================== END OF VECTOR TABLE DEFINITION ======================= */ + +/* ================== START OF VECTOR ROUTINES ============================= */ + + .thumb + .align 1 + +/* Reset Handler */ + .thumb_func + .globl Reset_Handler + .type Reset_Handler, %function +Reset_Handler: +/* Initialize interrupt veneer */ + ldr r1, =eROData + ldr r2, =VeneerStart + ldr r3, =VeneerEnd + bl __copy_data + + ldr r0, =SystemInit + blx r0 + +/* Initialize data */ + ldr r1, =DataLoadAddr + ldr r2, =__data_start + ldr r3, =__data_end + bl __copy_data + +/* RAM code */ + ldr r1, =__ram_code_load + ldr r2, =__ram_code_start + ldr r3, =__ram_code_end + bl __copy_data + +/* Define __SKIP_BSS_CLEAR to disable zeroing uninitialzed data in startup. + * The BSS section is specified by following symbols + * __bss_start__: start of the BSS section. + * __bss_end__: end of the BSS section. + * + * Both addresses must be aligned to 4 bytes boundary. + */ +#ifndef __SKIP_BSS_CLEAR + ldr r1, =__bss_start + ldr r2, =__bss_end + + movs r0, 0 + + subs r2, r1 + ble .L_loop3_done + +.L_loop3: + subs r2, #4 + str r0, [r1, r2] + bgt .L_loop3 +.L_loop3_done: +#endif /* __SKIP_BSS_CLEAR */ + +#ifndef __SKIP_LIBC_INIT_ARRAY + ldr r0, =__libc_init_array + blx r0 +#endif + + ldr r0, =main + blx r0 + + .thumb_func + .type __copy_data, %function +__copy_data: +/* The ranges of copy from/to are specified by following symbols + * r1: start of the section to copy from. + * r2: start of the section to copy to + * r3: end of the section to copy to + * + * All addresses must be aligned to 4 bytes boundary. + * Uses r0 + */ + subs r3, r2 + ble .L_loop_done + +.L_loop: + subs r3, #4 + ldr r0, [r1,r3] + str r0, [r2,r3] + bgt .L_loop + +.L_loop_done: + bx lr + + .pool + .size Reset_Handler,.-Reset_Handler +/* ======================================================================== */ +/* ========== START OF EXCEPTION HANDLER DEFINITION ======================== */ + + .align 1 + + .thumb_func + .weak Default_handler + .type Default_handler, %function +Default_Handler: + b . + .size Default_Handler, . - Default_Handler + + Insert_InterruptHandler HardFault + Insert_InterruptHandler SVC + Insert_InterruptHandler PendSV + Insert_InterruptHandler SysTick + + Insert_InterruptHandler IRQ0 + Insert_InterruptHandler IRQ1 + Insert_InterruptHandler IRQ2 + Insert_InterruptHandler IRQ3 + Insert_InterruptHandler IRQ4 + Insert_InterruptHandler IRQ5 + Insert_InterruptHandler IRQ6 + Insert_InterruptHandler IRQ7 + Insert_InterruptHandler IRQ8 + Insert_InterruptHandler IRQ9 + Insert_InterruptHandler IRQ10 + Insert_InterruptHandler IRQ11 + Insert_InterruptHandler IRQ12 + Insert_InterruptHandler IRQ13 + Insert_InterruptHandler IRQ14 + Insert_InterruptHandler IRQ15 + Insert_InterruptHandler IRQ16 + Insert_InterruptHandler IRQ17 + Insert_InterruptHandler IRQ18 + Insert_InterruptHandler IRQ19 + Insert_InterruptHandler IRQ20 + Insert_InterruptHandler IRQ21 + Insert_InterruptHandler IRQ22 + Insert_InterruptHandler IRQ23 + Insert_InterruptHandler IRQ24 + Insert_InterruptHandler IRQ25 + Insert_InterruptHandler IRQ26 + Insert_InterruptHandler IRQ27 + Insert_InterruptHandler IRQ28 + Insert_InterruptHandler IRQ29 + Insert_InterruptHandler IRQ30 + Insert_InterruptHandler IRQ31 + +/* ======================================================================== */ + +/* ==================VENEERS VENEERS VENEERS VENEERS VENEERS=============== */ + .section ".XmcVeneerCode","ax",%progbits + + .align 1 + + Insert_InterruptVeener HardFault + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + Insert_InterruptVeener SVC + .long 0 + .long 0 + Insert_InterruptVeener PendSV + Insert_InterruptVeener SysTick + + Insert_InterruptVeener IRQ0 + Insert_InterruptVeener IRQ1 + Insert_InterruptVeener IRQ2 + Insert_InterruptVeener IRQ3 + Insert_InterruptVeener IRQ4 + Insert_InterruptVeener IRQ5 + Insert_InterruptVeener IRQ6 + Insert_InterruptVeener IRQ7 + Insert_InterruptVeener IRQ8 + Insert_InterruptVeener IRQ9 + Insert_InterruptVeener IRQ10 + Insert_InterruptVeener IRQ11 + Insert_InterruptVeener IRQ12 + Insert_InterruptVeener IRQ13 + Insert_InterruptVeener IRQ14 + Insert_InterruptVeener IRQ15 + Insert_InterruptVeener IRQ16 + Insert_InterruptVeener IRQ17 + Insert_InterruptVeener IRQ18 + Insert_InterruptVeener IRQ19 + Insert_InterruptVeener IRQ20 + Insert_InterruptVeener IRQ21 + Insert_InterruptVeener IRQ22 + Insert_InterruptVeener IRQ23 + Insert_InterruptVeener IRQ24 + Insert_InterruptVeener IRQ25 + Insert_InterruptVeener IRQ26 + Insert_InterruptVeener IRQ27 + Insert_InterruptVeener IRQ28 + Insert_InterruptVeener IRQ29 + Insert_InterruptVeener IRQ30 + Insert_InterruptVeener IRQ31 + +/* ======================================================================== */ +/* ======================================================================== */ + +/* ============= END OF INTERRUPT HANDLER DEFINITION ======================== */ + + .end diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Startup/system_XMC1400.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Startup/system_XMC1400.c new file mode 100644 index 00000000..d359ae5d --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/Startup/system_XMC1400.c @@ -0,0 +1,276 @@ +/********************************************************************************************************************* + * @file system_XMC1400.c + * @brief Device specific initialization for the XMC1400-Series according to CMSIS + * @version V1.1 + * @date 09 Dec 2015 + * + * @cond + ********************************************************************************************************************* + * Copyright (c) 2015-2016, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * *************************** Change history ******************************** + * V1.0, 03 Sep 2015, JFT : Initial version + * MCLK = 48MHz, PCLK = 96MHz + * V1.1, 09 Dec 2015, JFT : Enable prefetch unit + * + * @endcond + */ + +/******************************************************************************* + * HEADER FILES + *******************************************************************************/ + +#include +#include "system_XMC1400.h" + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +/* Define WEAK attribute */ +#if !defined(__WEAK) +#if defined ( __CC_ARM ) +#define __WEAK __attribute__ ((weak)) +#elif defined ( __ICCARM__ ) +#define __WEAK __weak +#elif defined ( __GNUC__ ) +#define __WEAK __attribute__ ((weak)) +#elif defined ( __TASKING__ ) +#define __WEAK __attribute__ ((weak)) +#endif +#endif + +#define DCO1_FREQUENCY (48000000U) + +/* +//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------ +*/ + +/* +// Clock configuration +*/ + +/* +// External crystal frequency [Hz] +// <8000000=> 8MHz +// <12000000=> 12MHz +// <16000000=> 16MHz +// <20000000=> 20MHz +// Defines external crystal frequency +// Default: 20MHz +*/ +#define OSCHP_FREQUENCY (20000000U) + +/* +// DCLK clock source selection +// <0=> Internal oscillator DCO1 (48MHz) +// <1=> External crystal oscillator +// Default: Internal oscillator DCO1 (48MHz) +*/ +#define DCLK_CLOCK_SRC 0 +#define DCLK_CLOCK_SRC_DCO1 0 +#define DCLK_CLOCK_SRC_EXT_XTAL 1 + +/* +// OSCHP external oscillator mode +// <0=> Crystal mode +// <1=> External clock direct input mode +// Default: Crystal mode +*/ +#define OSCHP_MODE 0 +#define OSCHP_MODE_XTAL 0 +#define OSCHP_MODE_DIRECT 1 + +/* +// RTC clock source selection +// <0=> Internal oscillator DCO2 (32768Hz) +// <5=> External crystal oscillator +// Default: Internal oscillator DCO2 (32768Hz) +*/ +#define RTC_CLOCK_SRC 0 +#define RTC_CLOCK_SRC_DCO2 0 +#define RTC_CLOCK_SRC_EXT_XTAL 5 +/* +// PCLK clock source selection +// <0=> MCLK +// <1=> 2xMCLK +// Default: 2xMCLK +*/ +#define PCLK_CLOCK_SRC 1 +#define PCLK_CLOCK_SRC_MCLK 0 +#define PCLK_CLOCK_SRC_2XMCLK 1 + +/* +//-------- <<< end of configuration section >>> ------------------ +*/ + +/******************************************************************************* + * GLOBAL VARIABLES + *******************************************************************************/ + +#if defined ( __CC_ARM ) +uint32_t SystemCoreClock __attribute__((at(0x20003FFC))); +#elif defined ( __ICCARM__ ) +__no_init uint32_t SystemCoreClock; +#elif defined ( __GNUC__ ) +uint32_t SystemCoreClock __attribute__((section(".no_init"))); +#elif defined ( __TASKING__ ) +uint32_t SystemCoreClock __at( 0x20003FFC ); +#endif + +/******************************************************************************* + * LOCAL FUNCTIONS + *******************************************************************************/ +#if DCLK_CLOCK_SRC != DCLK_CLOCK_SRC_DCO1 +static inline void delay(uint32_t cycles) +{ + while(cycles > 0) + { + __NOP(); + cycles--; + } +} +#endif + +/******************************************************************************* + * API IMPLEMENTATION + *******************************************************************************/ + +__WEAK void SystemInit(void) +{ + SystemCoreSetup(); + SystemCoreClockSetup(); +} + +__WEAK void SystemCoreSetup(void) +{ + /* Enable Prefetch unit */ + SCU_GENERAL->PFUCR &= ~SCU_GENERAL_PFUCR_PFUBYP_Msk; +} + +__WEAK void SystemCoreClockSetup(void) +{ + /* Clock setup done during SSW using the CLOCK_VAL1 and CLOCK_VAL2 defined in vector table */ + + /* disable bit protection */ + SCU_GENERAL->PASSWD = 0x000000C0UL; + +#if DCLK_CLOCK_SRC != DCLK_CLOCK_SRC_DCO1 + + if (OSCHP_GetFrequency() > 20000000U) + { + SCU_ANALOG->ANAOSCHPCTRL |= SCU_ANALOG_ANAOSCHPCTRL_HYSCTRL_Msk; + } + + /* OSCHP source selection - OSC mode */ + SCU_ANALOG->ANAOSCHPCTRL = (SCU_ANALOG->ANAOSCHPCTRL & ~SCU_ANALOG_ANAOSCHPCTRL_MODE_Msk) | + (OSCHP_MODE << SCU_ANALOG_ANAOSCHPCTRL_MODE_Pos); + + /* Enable OSC_HP oscillator watchdog*/ + SCU_CLK->OSCCSR |= SCU_CLK_OSCCSR_XOWDEN_Msk; + + do + { + /* Restart OSC_HP oscillator watchdog */ + SCU_INTERRUPT->SRCLR1 = SCU_INTERRUPT_SRCLR1_LOECI_Msk; + SCU_CLK->OSCCSR |= SCU_CLK_OSCCSR_XOWDRES_Msk; + + /* Wait a few DCO2 cycles for the update of the clock detection result */ + delay(2500); + + /* check clock is ok */ + } + while(SCU_INTERRUPT->SRRAW1 & SCU_INTERRUPT_SRRAW1_LOECI_Msk); + + /* DCLK source using OSC_HP */ + SCU_CLK->CLKCR1 |= SCU_CLK_CLKCR1_DCLKSEL_Msk; + +#else + + /* DCLK source using DCO1 */ + SCU_CLK->CLKCR1 &= ~SCU_CLK_CLKCR1_DCLKSEL_Msk; + +#endif + +#if RTC_CLOCK_SRC == RTC_CLOCK_SRC_EXT_XTAL + /* Enable OSC_LP */ + SCU_ANALOG->ANAOSCLPCTRL &= ~SCU_ANALOG_ANAOSCLPCTRL_MODE_Msk; +#endif + + /* Update PCLK selection mux. */ + /* Fractional divider enabled, MCLK frequency equal DCO1 frequency or external crystal frequency */ + SCU_CLK->CLKCR = (1023UL <PASSWD = 0x000000C3UL; + + SystemCoreClockUpdate(); +} + +__WEAK void SystemCoreClockUpdate(void) +{ + static uint32_t IDIV, FDIV; + + IDIV = ((SCU_CLK->CLKCR) & SCU_CLK_CLKCR_IDIV_Msk) >> SCU_CLK_CLKCR_IDIV_Pos; + + if (IDIV != 0) + { + FDIV = ((SCU_CLK->CLKCR) & SCU_CLK_CLKCR_FDIV_Msk) >> SCU_CLK_CLKCR_FDIV_Pos; + FDIV |= ((SCU_CLK->CLKCR1) & SCU_CLK_CLKCR1_FDIV_Msk) << 8; + + /* Fractional divider is enabled and used */ + if (((SCU_CLK->CLKCR1) & SCU_CLK_CLKCR1_DCLKSEL_Msk) == 0U) + { + SystemCoreClock = ((uint32_t)((DCO1_FREQUENCY << 6U) / ((IDIV << 10) + FDIV))) << 4U; + } + else + { + SystemCoreClock = ((uint32_t)((OSCHP_GetFrequency() << 6U) / ((IDIV << 10) + FDIV))) << 4U; + } + } + else + { + /* Fractional divider bypassed. */ + if (((SCU_CLK->CLKCR1) & SCU_CLK_CLKCR1_DCLKSEL_Msk) == 0U) + { + SystemCoreClock = DCO1_FREQUENCY; + } + else + { + SystemCoreClock = OSCHP_GetFrequency(); + } + } +} + +__WEAK uint32_t OSCHP_GetFrequency(void) +{ + return OSCHP_FREQUENCY; +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/blt_conf.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/blt_conf.h new file mode 100644 index 00000000..dc87f464 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/blt_conf.h @@ -0,0 +1,175 @@ +/************************************************************************************//** +* \file Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_GCC\Boot\blt_conf.h +* \brief Bootloader configuration header file. +* \ingroup Boot_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +* \internal +*---------------------------------------------------------------------------------------- +* C O P Y R I G H T +*---------------------------------------------------------------------------------------- +* Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +* +*---------------------------------------------------------------------------------------- +* L I C E N S E +*---------------------------------------------------------------------------------------- +* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published by the Free +* Software Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You have received a copy of the GNU General Public License along with OpenBLT. It +* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +* +* \endinternal +****************************************************************************************/ +#ifndef BLT_CONF_H +#define BLT_CONF_H + +/**************************************************************************************** +* C P U D R I V E R C O N F I G U R A T I O N +****************************************************************************************/ +/* To properly initialize the baudrate clocks of the communication interface, typically + * the speed of the crystal oscillator and/or the speed at which the system runs is + * needed. Set these through configurables BOOT_CPU_XTAL_SPEED_KHZ and + * BOOT_CPU_SYSTEM_SPEED_KHZ, respectively. To enable data exchange with the host that is + * not dependent on the targets architecture, the byte ordering needs to be known. + * Setting BOOT_CPU_BYTE_ORDER_MOTOROLA to 1 selects big endian mode and 0 selects + * little endian mode. + * + * Set BOOT_CPU_USER_PROGRAM_START_HOOK to 1 if you would like a hook function to be + * called the moment the user program is about to be started. This could be used to + * de-initialize application specific parts, for example to stop blinking an LED, etc. + */ +/** \brief Frequency of the external crystal oscillator. */ +#define BOOT_CPU_XTAL_SPEED_KHZ (20000) +/** \brief Desired system speed. */ +#define BOOT_CPU_SYSTEM_SPEED_KHZ (48000) +/** \brief Motorola or Intel style byte ordering. */ +#define BOOT_CPU_BYTE_ORDER_MOTOROLA (0) +/** \brief Enable/disable hook function call right before user program start. */ +#define BOOT_CPU_USER_PROGRAM_START_HOOK (1) + + +/**************************************************************************************** +* C O M M U N I C A T I O N I N T E R F A C E C O N F I G U R A T I O N +****************************************************************************************/ +/* The CAN communication interface is selected by setting the BOOT_COM_CAN_ENABLE + * configurable to 1. Configurable BOOT_COM_CAN_BAUDRATE selects the communication speed + * in bits/second. Two CAN messages are reserved for communication with the host. The + * message identifier for sending data from the target to the host is configured with + * BOOT_COM_CAN_TXMSG_ID. The one for receiving data from the host is configured with + * BOOT_COM_CAN_RXMSG_ID. The maximum amount of data bytes in a message for data + * transmission and reception is set through BOOT_COM_CAN_TX_MAX_DATA and + * BOOT_COM_CAN_RX_MAX_DATA, respectively. It is common for a microcontroller to have more + * than 1 CAN controller on board. The zero-based BOOT_COM_CAN_CHANNEL_INDEX selects the + * CAN controller channel. + * + */ +/** \brief Enable/disable CAN transport layer. */ +#define BOOT_COM_CAN_ENABLE (1) +/** \brief Configure the desired CAN baudrate. */ +#define BOOT_COM_CAN_BAUDRATE (500000) +/** \brief Configure CAN message ID target->host. */ +#define BOOT_COM_CAN_TX_MSG_ID (0x7E1) +/** \brief Configure number of bytes in the target->host CAN message. */ +#define BOOT_COM_CAN_TX_MAX_DATA (8) +/** \brief Configure CAN message ID host->target. */ +#define BOOT_COM_CAN_RX_MSG_ID (0x667) +/** \brief Configure number of bytes in the host->target CAN message. */ +#define BOOT_COM_CAN_RX_MAX_DATA (8) +/** \brief Select the desired CAN peripheral as a zero based index. */ +#define BOOT_COM_CAN_CHANNEL_INDEX (1) + +/* The UART communication interface is selected by setting the BOOT_COM_UART_ENABLE + * configurable to 1. Configurable BOOT_COM_UART_BAUDRATE selects the communication speed + * in bits/second. The maximum amount of data bytes in a message for data transmission + * and reception is set through BOOT_COM_UART_TX_MAX_DATA and BOOT_COM_UART_RX_MAX_DATA, + * respectively. It is common for a microcontroller to have more than 1 UART interface + * on board. The zero-based BOOT_COM_UART_CHANNEL_INDEX selects the UART interface. + * + */ +/** \brief Enable/disable UART transport layer. */ +#define BOOT_COM_UART_ENABLE (1) +/** \brief Configure the desired communication speed. */ +#define BOOT_COM_UART_BAUDRATE (57600) +/** \brief Configure number of bytes in the target->host data packet. */ +#define BOOT_COM_UART_TX_MAX_DATA (64) +/** \brief Configure number of bytes in the host->target data packet. */ +#define BOOT_COM_UART_RX_MAX_DATA (64) +/** \brief Select the desired UART peripheral as a zero based index. */ +#define BOOT_COM_UART_CHANNEL_INDEX (1) + + +/**************************************************************************************** +* B A C K D O O R E N T R Y C O N F I G U R A T I O N +****************************************************************************************/ +/* It is possible to implement an application specific method to force the bootloader to + * stay active after a reset. Such a backdoor entry into the bootloader is desired in + * situations where the user program does not run properly and therefore cannot + * reactivate the bootloader. By enabling these hook functions, the application can + * implement the backdoor, which overrides the default backdoor entry that is programmed + * into the bootloader. When desired for security purposes, these hook functions can + * also be implemented in a way that disables the backdoor entry altogether. + */ +/** \brief Enable/disable the backdoor override hook functions. */ +#define BOOT_BACKDOOR_HOOKS_ENABLE (0) + + +/**************************************************************************************** +* N O N - V O L A T I L E M E M O R Y D R I V E R C O N F I G U R A T I O N +****************************************************************************************/ +/* The NVM driver typically supports erase and program operations of the internal memory + * present on the microcontroller. Through these hook functions the NVM driver can be + * extended to support additional memory types such as external flash memory and serial + * eeproms. The size of the internal memory in kilobytes is specified with configurable + * BOOT_NVM_SIZE_KB. If desired the internal checksum writing and verification method can + * be overridden with a application specific method by enabling configuration switch + * BOOT_NVM_CHECKSUM_HOOKS_ENABLE. + */ +/** \brief Enable/disable the NVM hook function for supporting additional memory devices. */ +#define BOOT_NVM_HOOKS_ENABLE (0) +/** \brief Configure the size of the default memory device (typically flash EEPROM). */ +#define BOOT_NVM_SIZE_KB (200) +/** \brief Enable/disable hooks functions to override the user program checksum handling. */ +#define BOOT_NVM_CHECKSUM_HOOKS_ENABLE (0) + + +/**************************************************************************************** +* W A T C H D O G D R I V E R C O N F I G U R A T I O N +****************************************************************************************/ +/* The COP driver cannot be configured internally in the bootloader, because its use + * and configuration is application specific. The bootloader does need to service the + * watchdog in case it is used. When the application requires the use of a watchdog, + * set BOOT_COP_HOOKS_ENABLE to be able to initialize and service the watchdog through + * hook functions. + */ +/** \brief Enable/disable the hook functions for controlling the watchdog. */ +#define BOOT_COP_HOOKS_ENABLE (1) + + +/**************************************************************************************** +* S E E D / K E Y S E C U R I T Y C O N F I G U R A T I O N +****************************************************************************************/ +/* A security mechanism can be enabled in the bootloader's XCP module by setting configu- + * rable BOOT_XCP_SEED_KEY_ENABLE to 1. Before any memory erase or programming + * operations can be performed, access to this resource need to be unlocked. + * In the Microboot settings on tab "XCP Protection" you need to specify a DLL that + * implements the unlocking algorithm. The demo programs are configured for the (simple) + * algorithm in "FeaserKey.dll". The source code for this DLL is available so it can be + * customized to your needs. + * During the unlock sequence, Microboot requests a seed from the bootloader, which is in + * the format of a byte array. Using this seed the unlock algorithm in the DLL computes + * a key, which is also a byte array, and sends this back to the bootloader. The + * bootloader then verifies this key to determine if programming and erase operations are + * permitted. + * After enabling this feature the hook functions XcpGetSeedHook() and XcpVerifyKeyHook() + * are called by the bootloader to obtain the seed and to verify the key, respectively. + */ +#define BOOT_XCP_SEED_KEY_ENABLE (0) + + +#endif /* BLT_CONF_H */ +/*********************************** end of blt_conf.h *********************************/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/boot.dox b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/boot.dox new file mode 100644 index 00000000..ef437907 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/boot.dox @@ -0,0 +1,7 @@ +/** +\defgroup Boot_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC Bootloader +\brief Bootloader. +\ingroup ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +*/ + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/hooks.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/hooks.c new file mode 100644 index 00000000..5e5905ae --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/hooks.c @@ -0,0 +1,295 @@ +/************************************************************************************//** +* \file Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_GCC\Boot\hooks.c +* \brief Bootloader callback source file. +* \ingroup Boot_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +* \internal +*---------------------------------------------------------------------------------------- +* C O P Y R I G H T +*---------------------------------------------------------------------------------------- +* Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +* +*---------------------------------------------------------------------------------------- +* L I C E N S E +*---------------------------------------------------------------------------------------- +* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published by the Free +* Software Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You have received a copy of the GNU General Public License along with OpenBLT. It +* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +* +* \endinternal +****************************************************************************************/ + +/**************************************************************************************** +* Include files +****************************************************************************************/ +#include "boot.h" /* bootloader generic header */ +#include "led.h" /* LED driver header */ +#include "xmc_gpio.h" /* GPIO module */ + + +/**************************************************************************************** +* B A C K D O O R E N T R Y H O O K F U N C T I O N S +****************************************************************************************/ + +#if (BOOT_BACKDOOR_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Initializes the backdoor entry option. +** \return none. +** +****************************************************************************************/ +void BackDoorInitHook(void) +{ +} /*** end of BackDoorInitHook ***/ + + +/************************************************************************************//** +** \brief Checks if a backdoor entry is requested. +** \return BLT_TRUE if the backdoor entry is requested, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool BackDoorEntryHook(void) +{ + /* default implementation always activates the bootloader after a reset */ + return BLT_TRUE; +} /*** end of BackDoorEntryHook ***/ +#endif /* BOOT_BACKDOOR_HOOKS_ENABLE > 0 */ + + +/**************************************************************************************** +* C P U D R I V E R H O O K F U N C T I O N S +****************************************************************************************/ + +#if (BOOT_CPU_USER_PROGRAM_START_HOOK > 0) +/************************************************************************************//** +** \brief Callback that gets called when the bootloader is about to exit and +** hand over control to the user program. This is the last moment that +** some final checking can be performed and if necessary prevent the +** bootloader from activiting the user program. +** \return BLT_TRUE if it is okay to start the user program, BLT_FALSE to keep +** keep the bootloader active. +** +****************************************************************************************/ +blt_bool CpuUserProgramStartHook(void) +{ + /* clean up the LED driver */ + LedBlinkExit(); + /* okay to start the user program.*/ + return BLT_TRUE; +} /*** end of CpuUserProgramStartHook ***/ +#endif /* BOOT_CPU_USER_PROGRAM_START_HOOK > 0 */ + + +/**************************************************************************************** +* W A T C H D O G D R I V E R H O O K F U N C T I O N S +****************************************************************************************/ + +#if (BOOT_COP_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Callback that gets called at the end of the internal COP driver +** initialization routine. It can be used to configure and enable the +** watchdog. +** \return none. +** +****************************************************************************************/ +void CopInitHook(void) +{ + /* this function is called upon initialization. might as well use it to initialize + * the LED driver. It is kind of a visual watchdog anyways. + */ + LedBlinkInit(100); +} /*** end of CopInitHook ***/ + + +/************************************************************************************//** +** \brief Callback that gets called at the end of the internal COP driver +** service routine. This gets called upon initialization and during +** potential long lasting loops and routine. It can be used to service +** the watchdog to prevent a watchdog reset. +** \return none. +** +****************************************************************************************/ +void CopServiceHook(void) +{ + /* run the LED blink task. this is a better place to do it than in the main() program + * loop. certain operations such as flash erase can take a long time, which would cause + * a blink interval to be skipped. this function is also called during such operations, + * so no blink intervals will be skipped when calling the LED blink task here. + */ + LedBlinkTask(); +} /*** end of CopServiceHook ***/ +#endif /* BOOT_COP_HOOKS_ENABLE > 0 */ + + +/**************************************************************************************** +* N O N - V O L A T I L E M E M O R Y D R I V E R H O O K F U N C T I O N S +****************************************************************************************/ + +#if (BOOT_NVM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Callback that gets called at the start of the internal NVM driver +** initialization routine. +** \return none. +** +****************************************************************************************/ +void NvmInitHook(void) +{ +} /*** end of NvmInitHook ***/ + + +/************************************************************************************//** +** \brief Callback that gets called at the start of a firmware update to reinitialize +** the NVM driver. +** \return none. +** +****************************************************************************************/ +void NvmReinitHook(void) +{ +} /*** end of NvmReinitHook ***/ + + +/************************************************************************************//** +** \brief Callback that gets called at the start of the NVM driver write +** routine. It allows additional memory to be operated on. If the address +** is not within the range of the additional memory, then +** BLT_NVM_NOT_IN_RANGE must be returned to indicate that the data hasn't +** been written yet. +** \param addr Start address. +** \param len Length in bytes. +** \param data Pointer to the data buffer. +** \return BLT_NVM_OKAY if successful, BLT_NVM_NOT_IN_RANGE if the address is +** not within the supported memory range, or BLT_NVM_ERROR is the write +** operation failed. +** +****************************************************************************************/ +blt_int8u NvmWriteHook(blt_addr addr, blt_int32u len, blt_int8u *data) +{ + return BLT_NVM_NOT_IN_RANGE; +} /*** end of NvmWriteHook ***/ + + +/************************************************************************************//** +** \brief Callback that gets called at the start of the NVM driver erase +** routine. It allows additional memory to be operated on. If the address +** is not within the range of the additional memory, then +** BLT_NVM_NOT_IN_RANGE must be returned to indicate that the memory +** hasn't been erased yet. +** \param addr Start address. +** \param len Length in bytes. +** \return BLT_NVM_OKAY if successful, BLT_NVM_NOT_IN_RANGE if the address is +** not within the supported memory range, or BLT_NVM_ERROR is the erase +** operation failed. +** +****************************************************************************************/ +blt_int8u NvmEraseHook(blt_addr addr, blt_int32u len) +{ + return BLT_NVM_NOT_IN_RANGE; +} /*** end of NvmEraseHook ***/ + + +/************************************************************************************//** +** \brief Callback that gets called at the end of the NVM programming session. +** \return BLT_TRUE is successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmDoneHook(void) +{ + return BLT_TRUE; +} /*** end of NvmDoneHook ***/ +#endif /* BOOT_NVM_HOOKS_ENABLE > 0 */ + + +#if (BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0) +/************************************************************************************//** +** \brief Verifies the checksum, which indicates that a valid user program is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmVerifyChecksumHook(void) +{ + return BLT_TRUE; +} /*** end of NvmVerifyChecksum ***/ + + +/************************************************************************************//** +** \brief Writes a checksum of the user program to non-volatile memory. This is +** performed once the entire user program has been programmed. Through +** the checksum, the bootloader can check if a valid user programming is +** present and can be started. +** \return BLT_TRUE if successful, BLT_FALSE otherwise. +** +****************************************************************************************/ +blt_bool NvmWriteChecksumHook(void) +{ + return BLT_TRUE; +} +#endif /* BOOT_NVM_CHECKSUM_HOOKS_ENABLE > 0 */ + + +/**************************************************************************************** +* S E E D / K E Y S E C U R I T Y H O O K F U N C T I O N S +****************************************************************************************/ + +#if (BOOT_XCP_SEED_KEY_ENABLE > 0) +/************************************************************************************//** +** \brief Provides a seed to the XCP master that will be used for the key +** generation when the master attempts to unlock the specified resource. +** Called by the GET_SEED command. +** \param resource Resource that the seed if requested for (XCP_RES_XXX). +** \param seed Pointer to byte buffer wher the seed will be stored. +** \return Length of the seed in bytes. +** +****************************************************************************************/ +blt_int8u XcpGetSeedHook(blt_int8u resource, blt_int8u *seed) +{ + /* request seed for unlocking ProGraMming resource */ + if ((resource & XCP_RES_PGM) != 0) + { + seed[0] = 0x55; + } + + /* return seed length */ + return 1; +} /*** end of XcpGetSeedHook ***/ + + +/************************************************************************************//** +** \brief Called by the UNLOCK command and checks if the key to unlock the +** specified resource was correct. If so, then the resource protection +** will be removed. +** \param resource resource to unlock (XCP_RES_XXX). +** \param key pointer to the byte buffer holding the key. +** \param len length of the key in bytes. +** \return 1 if the key was correct, 0 otherwise. +** +****************************************************************************************/ +blt_int8u XcpVerifyKeyHook(blt_int8u resource, blt_int8u *key, blt_int8u len) +{ + /* suppress compiler warning for unused parameter */ + len = len; + + /* the example key algorithm in "FeaserKey.dll" works as follows: + * - PGM will be unlocked if key = seed - 1 + */ + + /* check key for unlocking ProGraMming resource */ + if ((resource == XCP_RES_PGM) && (key[0] == (0x55-1))) + { + /* correct key received for unlocking PGM resource */ + return 1; + } + + /* still here so key incorrect */ + return 0; +} /*** end of XcpVerifyKeyHook ***/ +#endif /* BOOT_XCP_SEED_KEY_ENABLE > 0 */ + + +/*********************************** end of hooks.c ************************************/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/led.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/led.c new file mode 100644 index 00000000..6d54c59d --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/led.c @@ -0,0 +1,105 @@ +/************************************************************************************//** +* \file Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_GCC\Boot\led.c +* \brief LED driver source file. +* \ingroup Boot_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +* \internal +*---------------------------------------------------------------------------------------- +* C O P Y R I G H T +*---------------------------------------------------------------------------------------- +* Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +* +*---------------------------------------------------------------------------------------- +* L I C E N S E +*---------------------------------------------------------------------------------------- +* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published by the Free +* Software Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You have received a copy of the GNU General Public License along with OpenBLT. It +* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +* +* \endinternal +****************************************************************************************/ + +/**************************************************************************************** +* Include files +****************************************************************************************/ +#include "boot.h" /* bootloader generic header */ +#include "led.h" /* module header */ +#include "xmc_gpio.h" /* GPIO module */ + + +/**************************************************************************************** +* Local data declarations +****************************************************************************************/ +/** \brief Holds the desired LED blink interval time. */ +static blt_int16u ledBlinkIntervalMs; + + +/************************************************************************************//** +** \brief Initializes the LED blink driver. +** \param interval_ms Specifies the desired LED blink interval time in milliseconds. +** \return none. +** +****************************************************************************************/ +void LedBlinkInit(blt_int16u interval_ms) +{ + /* initialize and turn of the LED */ + XMC_GPIO_SetMode(P4_0, XMC_GPIO_MODE_OUTPUT_PUSH_PULL); + XMC_GPIO_SetOutputLevel(P4_0, XMC_GPIO_OUTPUT_LEVEL_HIGH); + /* store the interval time between LED toggles */ + ledBlinkIntervalMs = interval_ms; +} /*** end of LedBlinkInit ***/ + + +/************************************************************************************//** +** \brief Task function for blinking the LED as a fixed timer interval. +** \return none. +** +****************************************************************************************/ +void LedBlinkTask(void) +{ + static blt_bool ledOn = BLT_FALSE; + static blt_int32u nextBlinkEvent = 0; + + /* check for blink event */ + if (TimerGet() >= nextBlinkEvent) + { + /* toggle the LED state */ + if (ledOn == BLT_FALSE) + { + /* turn the LED on */ + ledOn = BLT_TRUE; + XMC_GPIO_SetOutputLevel(P4_0, XMC_GPIO_OUTPUT_LEVEL_LOW); + } + else + { + /* turn the LED off */ + ledOn = BLT_FALSE; + XMC_GPIO_SetOutputLevel(P4_0, XMC_GPIO_OUTPUT_LEVEL_HIGH); + } + /* schedule the next blink event */ + nextBlinkEvent = TimerGet() + ledBlinkIntervalMs; + } +} /*** end of LedBlinkTask ***/ + + +/************************************************************************************//** +** \brief Cleans up the LED blink driver. This is intended to be used upon program +** exit. +** \return none. +** +****************************************************************************************/ +void LedBlinkExit(void) +{ + /* turn the LED off */ + XMC_GPIO_SetOutputLevel(P4_0, XMC_GPIO_OUTPUT_LEVEL_HIGH); +} /*** end of LedBlinkExit ***/ + + +/*********************************** end of led.c **************************************/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/led.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/led.h new file mode 100644 index 00000000..221cce03 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/led.h @@ -0,0 +1,40 @@ +/************************************************************************************//** +* \file Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_GCC\Boot\led.h +* \brief LED driver header file. +* \ingroup Boot_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +* \internal +*---------------------------------------------------------------------------------------- +* C O P Y R I G H T +*---------------------------------------------------------------------------------------- +* Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +* +*---------------------------------------------------------------------------------------- +* L I C E N S E +*---------------------------------------------------------------------------------------- +* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published by the Free +* Software Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You have received a copy of the GNU General Public License along with OpenBLT. It +* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +* +* \endinternal +****************************************************************************************/ +#ifndef LED_H +#define LED_H + +/**************************************************************************************** +* Function prototypes +****************************************************************************************/ +void LedBlinkInit(blt_int16u interval_ms); +void LedBlinkTask(void); +void LedBlinkExit(void); + + +#endif /* LED_H */ +/*********************************** end of led.h **************************************/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/main.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/main.c new file mode 100644 index 00000000..7f74cfcc --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Boot/main.c @@ -0,0 +1,113 @@ +/************************************************************************************//** +* \file Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_GCC\Boot\main.c +* \brief Bootloader application source file. +* \ingroup Boot_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +* \internal +*---------------------------------------------------------------------------------------- +* C O P Y R I G H T +*---------------------------------------------------------------------------------------- +* Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +* +*---------------------------------------------------------------------------------------- +* L I C E N S E +*---------------------------------------------------------------------------------------- +* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published by the Free +* Software Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You have received a copy of the GNU General Public License along with OpenBLT. It +* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +* +* \endinternal +****************************************************************************************/ + +/**************************************************************************************** +* Include files +****************************************************************************************/ +#include "boot.h" /* bootloader generic header */ +#include "xmc_gpio.h" /* GPIO module */ +#include "xmc_uart.h" /* UART driver header */ +#include "xmc_can.h" /* CAN driver header */ + + +/**************************************************************************************** +* Function prototypes +****************************************************************************************/ +static void PostInit(void); + + +/************************************************************************************//** +** \brief This is the entry point for the bootloader application and is called +** by the reset interrupt vector after the C-startup routines executed. +** \return Program exit code. +** +****************************************************************************************/ +int main(void) +{ + /* initialize the bootloader */ + BootInit(); + /* post initialization of the microcontroller */ + PostInit(); + + /* start the infinite program loop */ + while (1) + { + /* run the bootloader task */ + BootTask(); + } + return 0; +} /*** end of main ***/ + + +/************************************************************************************//** +** \brief Post initialization of the microcontroller. Contains all initialization +** code that should run after the bootloader's core was initialized. +** \return none. +** +****************************************************************************************/ +static void PostInit(void) +{ +#if (BOOT_COM_UART_ENABLE > 0) + XMC_GPIO_CONFIG_t rx_uart_config; + XMC_GPIO_CONFIG_t tx_uart_config; +#endif +#if (BOOT_COM_CAN_ENABLE > 0) + XMC_GPIO_CONFIG_t rx_can_config; + XMC_GPIO_CONFIG_t tx_can_config; +#endif + +#if (BOOT_COM_UART_ENABLE > 0) + /* initialize UART Rx pin */ + rx_uart_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE; + XMC_GPIO_Init(P1_3, &rx_uart_config); + /* initialize UART Tx pin */ + tx_uart_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7; + XMC_GPIO_Init(P1_2, &tx_uart_config); + /* set input source path to DXnA to connect P1_3 to ASC Receive. note that this + * function must be called after XMC_UART_CH_Init(), which is called when initializing + * the bootloader core with BootInit(). + */ + XMC_UART_CH_SetInputSource(XMC_UART0_CH1, XMC_UART_CH_INPUT_RXD, USIC0_C1_DX0_P1_3); +#endif + +#if (BOOT_COM_CAN_ENABLE > 0) + /* configure CAN receive pin */ + rx_can_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE; + XMC_GPIO_Init(P4_8, &rx_can_config); + /* configure CAN transmit pin */ + tx_can_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT9; + XMC_GPIO_Init(P4_9, &tx_can_config); + /* select CAN Receive Input C (N1_RXDC) to map P4_8 to CAN_NODE1 */ + XMC_CAN_NODE_EnableConfigurationChange(CAN_NODE1); + XMC_CAN_NODE_SetReceiveInput(CAN_NODE1, XMC_CAN_NODE_RECEIVE_INPUT_RXDCC); + XMC_CAN_NODE_DisableConfigurationChange(CAN_NODE1); +#endif +} /*** end of PostInit ***/ + + +/*********************************** end of main.c *************************************/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.cproject b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.cproject new file mode 100644 index 00000000..299ec4b5 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.cproject @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.project b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.project new file mode 100644 index 00000000..f79044ca --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.project @@ -0,0 +1,28 @@ + + + Prog + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + com.ifx.xmc4000.xmc4000Nature + com.dave.common.daveBenchNature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/com.dave.mbs.xc800.prefs b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/com.dave.mbs.xc800.prefs new file mode 100644 index 00000000..8ea29cc8 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/com.dave.mbs.xc800.prefs @@ -0,0 +1,14 @@ +ACTIVE_CONFIG_NAME=Debug +AppCompatibilitySet=1 +DEVICE_DESC=Package\= VQFN64 \nROM\= 200 KB Flash \nRAM\= 16 KB RAM \nInOut\= 34 digital I/O \nADC\= 12 ADC Channels, 12-bit, Analog-to-Digital Converter \nTimed_InOut\= 10 Timer, 20 CAPCOM channels \nSerial\= 2 USIC channels \nSHS\= 2 Sample and Hold Sequencer \nCOMP\= Comparator Control Unit \nPOSIF\= Position Interface Unit \nBCCU\= Brightness and Color Control Unit \nMATH\= MATH Coprocessor \n +DEVICE_NAME=XMC1404-Q064x0200 +DEVICE_PACKAGE=VQFN64 +DEVICE_PACK_VERSION=2.1.20 +DEVICE_PATH=/DeviceRoot/Microcontrollers/XMC1000/XMC1400 Series/XMC1404-Q064x0200 +FLASH_SIZE=200 +MBS_PROVIDER_ID_KEY=com.dave.mbs.xmc4000.xmc4000MbsFactory +SOFTWARE_ID=XMC1.4.04.Q064.ALL +TEMPLATE_KEY=com.ifx.xmc4000.appEmptyMainTemplate +USED_DAVE_VERSIONS=4.3.2 +eclipse.preferences.version=1 +minDaveVersion=4.3.2 diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/language.settings.xml b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/language.settings.xml new file mode 100644 index 00000000..d68ab084 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/language.settings.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/org.eclipse.cdt.core.prefs b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 00000000..d4995d0c --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,163 @@ +eclipse.preferences.version=1 +org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.cdt.core.formatter.alignment_for_assignment=16 +org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80 +org.eclipse.cdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.cdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.cdt.core.formatter.alignment_for_conditional_expression=34 +org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain=18 +org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list=0 +org.eclipse.cdt.core.formatter.alignment_for_declarator_list=16 +org.eclipse.cdt.core.formatter.alignment_for_enumerator_list=48 +org.eclipse.cdt.core.formatter.alignment_for_expression_list=0 +org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.cdt.core.formatter.alignment_for_member_access=0 +org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain=16 +org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.cdt.core.formatter.brace_position_for_array_initializer=next_line +org.eclipse.cdt.core.formatter.brace_position_for_block=next_line +org.eclipse.cdt.core.formatter.brace_position_for_block_in_case=next_line +org.eclipse.cdt.core.formatter.brace_position_for_method_declaration=next_line +org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration=next_line +org.eclipse.cdt.core.formatter.brace_position_for_switch=next_line +org.eclipse.cdt.core.formatter.brace_position_for_type_declaration=next_line +org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment=1 +org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column=true +org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true +org.eclipse.cdt.core.formatter.compact_else_if=true +org.eclipse.cdt.core.formatter.continuation_indentation=2 +org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header=false +org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces=0 +org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier=true +org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header=false +org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header=false +org.eclipse.cdt.core.formatter.indent_empty_lines=false +org.eclipse.cdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.cdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.cdt.core.formatter.indentation.size=2 +org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.cdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments=insert +org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters=insert +org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause=insert +org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments=insert +org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters=insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.cdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.cdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.cdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.cdt.core.formatter.join_wrapped_lines=true +org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.cdt.core.formatter.lineSplit=80 +org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.cdt.core.formatter.tabulation.char=space +org.eclipse.cdt.core.formatter.tabulation.size=2 +org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations=false diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/org.eclipse.cdt.ui.prefs b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/org.eclipse.cdt.ui.prefs new file mode 100644 index 00000000..7da732ea --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/org.eclipse.cdt.ui.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +formatter_profile=_Feaser +formatter_settings_version=1 diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/properties.index b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/properties.index new file mode 100644 index 00000000..13b76604 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/.settings/properties.index @@ -0,0 +1,5 @@ + + +
+
+ \ No newline at end of file diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Debug/demoprog_xmc1400.elf b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Debug/demoprog_xmc1400.elf new file mode 100644 index 0000000000000000000000000000000000000000..3f0e295539725543b643fd0892b50e6350db6309 GIT binary patch literal 130283 zcmeFa33yaR8ZKN_=k(s4oTR%UBmt6i62iWPMb?mDSi%wk1;r&Oj=>cb9n?_+sDtZ( zIF5>rjG{B{xS)|2MDJc_p9HOLMh>^7A3+4EnnnndLx+dE%D^mjS<36 zphal97=Sc%@H;Uo1i!uvdK7#>l}sEZobk}bZzjF*Tj=>nEK3WId4e zK-L3U4`e-%^+47GSr24Ako7>;16dDbJ&^T4)&p4&WId4eK-L3U4`e-%^+47GSr24A zko7>;16dDbJ&^T4)&p4&WId4eK-L3U4`e-%^+47GSr24Ako7>;16dDbJ@9{%2e`+c zd;MAF8+b3U^#=Yg^KRZhf8x3I`IF+4;|*d*!LInkmI-k{2|#(f;*%0O72TCUN|ekf zRBziOmN)KsD<6FPt}e9RwnsiaXH(;kZ!Mg_e7M)2d;WQDV97w?aBn~H-adaX&HMBC z?j0$dQ}F%iVX5j=FSR*Fl-glrJzP@WiQFD=9lv6x8-c-4%%S6@O zR+?ASWlCw&;|r{cUN!kDua4Sr&$uVzf~QT1aW5pB4l*4}I#FDoyBl=YjL%@@|x zH8p7MUFPI3zPTn@9INZv7=36({gw4Q9^OzdlwI>gnQS=daO39_dVM9IrvSa;W^#`C_=dN2; zpIf|d!&UVnrB+$1WW|Wqk|p-Mrgh94-|**6sH7^lclU z(`$Cu7u&5SeHG}UpMTSx;`}a?guFuRSh?G7l~+*aqTRA`O|5*zE)uQfg^7NFt=H}A z+g8yL6sP2b12$yTOIr^)h~iu~5*;_eM|>eQ8D$FaLdp1-VCZhgE^ zv=$a#UMshCD(+K!MXh>8j#hm?-Kti1DVkef)Lc^*ubWeEHC@=Pi`ANXQ+BBd7N2px z9JyMyl}2g`>H@`bRJq!bDw4%DJ?gC0a^!}6A~oIX=GJ$gSJb?!?x6a3lW$%0p-bym z!}CrLAwIT*aMr({nkzQW89lgdaB=Of&2nJAtx|<`A%9-o6Tm&z=sZmSx0JM4Z97M_ zrJ7~gs=8EDs(E!_&lb`?D4QXc&B-mlzOGB%5^!&*{{R{{%z0pB+sJ|%)(KRayd6-SFZp`M>^t12$V{bk(ScD~nU7Y{@YZQIq- zqfLx0?9y;;t=QJRxTW+N@k~((D9`U|sb3db8){Lk$tQQ^AqK^^g5vRYYr|`0UHvzO z)kPw8S?%0$Z{8((i%r9eMQ^!DrbMesebVfo9IpAa>C@)bRzaOp_s=F9k;%AhgKxyB zwl-(Ib(ZX1u-R%ZDSKm{-CWunY3Nd8ol)f9QI_wE*F@k8t6425oM$!HE;tBRd-5Ce z&^BAG68fU8t!+mQ&M`UbRdY$hD+O1ECt0g~Z{`%KNZn=4T_=^+tZY)vE1M&AtD2Zo zpRFdRCr(@K&)G7rxgqzUz=d|aPBpKZw0XtIkb?cdzC^G4KB z3v7F1o&^r1a{M43 z4{R<2X4I~`Pm?3(iuplVU9O7j@*0ZkK0jhGa7F$lh`V^*F-M$yn&|D@bo4R6!B58= z;cH!R%%Ia|b}O z&_AWRX8eBj2l}Q|))c8ObqRmCxU6naUG07gA4dG`+OVN**TVJZY2KjA8~7P-OX(zE zSWD=brOa1&wxBIpn}a27J4f&Jx7r$NDcPXfb`IGad^m_>c0oKD**~mEz3D@rwTVvv zYjbpB+s@XuU~2@B+7#w>a~QbS+N{*}rtQsd2KKy~IyRR*$$aNwp`Zu41ayg7qtnFL z`Rn9O@4-)URWKDfvEjtP$O})*9sJyhA{ANEc}fZUhoAg6i&T7JVro^fh1&Sz9{c92 z0aq0(K$q;%F;4e@#nqrCVAPghK8meQgdZwiL98q zWQex!?|aIcYf{kKlxpr;SJ5$ZPD#l!P(wK-sV;S!PYR~uCySJ?wPfksSQyU4h;^w-rwmmHt!P zcD}T?Gi;G%Z96;d?KCCTTvKt2&eQbP{+l~3Oimk69E4A7cxWv=G@v*HXz!1y=HB4k z-W-6Rd?^2RSW4O8I<}Rz!uy2C=@AgZZY=o=ZkFA+24j#C$8J1|2QY2B##w&>T8@A6 zD|3nh{w;Q~1CLDqsbnD|SD+Wv^^0dfXN)^$W8CrRx6}V%O|~1}XkuzZ{oao^)Z5|* zpZG$w2GpxNsJ{mG&%yUldYmmq@t5TXIxpkV`~^vvUJ-# zl(9_q3T-~7zDVbGO#NIpw+q{>bprX(U*5RuDOiB^g4htHEvT)zdu8f~Cin<`46YYD z4%?Ljy-yT=SJpOYRc&HhM0+E+`P&g~BZ4SXOW6z+XgCPHzbLZ-%Rx3EjDDI>GUT(7 zWzxFZc0Sj}ku%yUe7_UEAC2z|`2M}^hmR@2Huki(EeE5gA4<;`Z96OW%HeFav8|EG zjZKkBk)w-LQFud%@LP3}!$oRUQ($nsNuWn~NBffFE%Y(MX@wt9f8IEZde!83vjn%7 zPfo+a^`fF%acs&5g=?J~YVA$8h;QdyF+mR5^>N!y|4+dNQiH!jUHEY3Se;16dDbJ&^T4)&p4&WId4eK-L3U4`e-%^+47GSr24A zko7>;16dDbJ&^T4)&p4&WId4eK-L3U4`e-%^+47GSr24Ako7>;16dDbJ&^T4)&p4& zWId4eK-L3U4`e-%^+47GSr24Ako7>;16dDbJ&^T4)&p4&WId4eK-L5Q3m)h*QB3$x z;uRV66w?1EeEH5o@B0Pb73ih^zq*&hfl52kHm-zyHzLLN9*&m=#p@`1mADjF!}mAv z@gbaIVIkpW)^v3fw!C>(3}$*MX1a*@gRM z1}*5Hi-rhigbTmp-aUEm?&+;|>E7ML&vEg*QKu5e4fM+OH1vD*;OQgZ=bCTC5RZ?z z1TXkx-am(YCM<^j3_!0fE?Q-FDUr7B8@@rkp zaNMU1LtNp$828M4$l{fUam9}p-@M-ne$uz#K8r+rJbtF>OC=tfnVJ81@(dS_>DS05 z1Z9=jjhnHv59sFrw+{Dm#QTMiZ|t31xBR;ZxXV7;{aLDp-^hvY>f&0L?GxJMYdpIHz3>gEjWG=xC0isUjWML z%W43oGcdlDNc&I6CBO?Gbis3Rkp{lkgDnI9!-JK9U-MvFgcjS!sxP2F{0Z|tPF)0= zN{Mg^cl&r3v?G(o3;P5Y3Wgsi??Nr7QqeFQn0=z6Q7V-PpGWW{wG&J#RS>?L;K?qv zJiLP7A|+YcR8{x^f~UCD0pZuE`BW9r)ao#sj{RFV--+RC2`*MiO`Q^cjNoam?5yxj z1W#ApHFZw-Fx>4kTxxUpMuNX{!DGX>5j@ic7lyxKzGt}^EfPM${>!1zw}&Zu)aQqY z!LdpD=~Z808duH~Ya;p-Quf)3UJjMmcc}XShhGI`uXFPg;S0%grwiI)5QTkL+P|%| z=5Ci74PQg%dtA^7liObJf(cU@_qwtLVcKTj=TeJB^h$OblwM^@^P3v7qHe0t|%d}q0ZN1%~#!BMZBy7`kk2I`ox=_3ckneU}{3~z?@bUz{ z!PU5+1rvV7gVBNsZ}(udV8Y*euup`d@P%!knu9`z7oz+vEq3@LSRjS{B5wBSWDZ3^ zk-lXGFd;kzXc7J>2x7Pp_+YpW*J!vpfT|5&3~C~ri*!M_66xab%hW2vUd^>K-Wq3SPT_nR_ z16m=&NuR*mV8i?1c7+Tdg4@+Hyacy3GJFGWYi0N#n6pua&&KU(8D5Lq^D_JlZkuHI zOWd}|a2(~?D#OEZdkb1{Yn9=pxP1Um;H{d%x2_9(6uJjxlD_-c-G)EGMTBiwV+;F1 z@cJH10TuZxl8b#CLohu$eg9d)_ay5J{bF?b)EUC}l!5HnTNHVgY$_Fuea}pui)+Y< zod*fu3pZ)GlIWyq!uO&9%44iT-=+f1SQTqV_P)(@t4h_x*aP}r?xCTHvGvU06_Z_4 zjQyYQ)q$EeKib$hQ}|vpw1u(bsO5D7p##eSlb>C${|O3pCAgg+alSqt=o`w^E5O-J zs0`oM2`v6IC`i!v_L-o?<_-kmijR zB`QUZlWfEM&C-M%zK#;faZJiaXW@e50c-=n=T4q;0BP?4ybT}6T-ADM{a|m@(|>2J}=@Xt6`MM<&ex=4rMN1f+6o6ltCV**(j+Wykcl46hf4N z>qR|&*JfhuazT1H`f?1gk#C`nR$D)H&y%&&R`V#x>Dx}Ar zK}?5k+bl#UQaXU_5{W@z0AH$9uMtS>7h(6fm*B2LMBb$vy{pG zp~xD38I$)xgSF3%NP2?_8(oF)OIW-K*Z`|D_%c!tD+AOJjJCBh`OVUOEtAR3XgD9c38s*r+?oFyO+dJIXK_EfRs#pd=WFF9OS$ zqHhBir*VH`YASJmN#kx|igl9Xjxy-w$N>97H5K6<9a#b6E^|5OoJbhFUCg*#0pXIs!&SF0(&Vz0iLcna|Y-q#2Xt2sHZ(#b8#c zaua7?Dhz4>Rz~sn1j7Exr4BH0_O)UwP^m%D=Scm=rB<6b`%WFIWrs%JOoIBo%UomP z>|biJrq)J#;`f%l)0J&Bakfics;M)gQz*OJr5+nSBNyNg3a@TPzQ;!|#_tmQN0+)d zdM>GZ+>B0-UQX&>m-@TtA4vU4-Kb^Hir!KNuuW5~)I~CSCCS2Kk*w4uGCB;sjV&$u z!%D4iy8${&H}0Saj72&~Plnj`=_t3^2M#1 z0)HZ9DK3G(Fs1d}!W6l4_Gbht>uXeH?x8v8pL{pJ3B2`Dzbz=XRk*{_hW=mg7sP<$PQ*9253?eO5UgJ!Tmxm zBim1C9m4q%znsC9Gqnr2Y}rh)x!A%;+Dv%grL8Re2`pIfKvYMaxb|)gRR239#!4aqD0P06xW}U?~$)Z zXBMNMT!AOJ^95Bq=Tp>qpd19}G3XCEM}Wz3UWDN#&INe-Y!J?EbeVK6q{ozV9IB+n zc5W%bE$I9W3g8H58&uG(tx!U@#!y*w=OLB6L&*U!xTU2|g^*hHPIF|XHHrg3OTx}2KrRhC!@#*L?9`x5wM3mds9q9vBrIMUbuNUN%c72t`Q

fn1W~ z1W@3mInFc~xGcwcmo&$DAH`bYI4`pdj&nA3I!-^hxh3DZm1W3x9s}pne5bN2X!*`k zR7Xp~d6s2JI8(v7G~t|#5LuRRUVzmtotzN;(#hG1hOxAh!%4(totz*_i>Uq@87(Pr z`l2?L7C4_md|83xhw7F>=R>e8DRgE4T3YD*5%IsQ&>76SE_Pl3a!Ik%imF;#>`2NL zJ3Em>OE>3wC|lCaxgVZb+ReF;`E_%au)a&2>tODZ66Xno-_jCi3jI>zT+6bTIXSeY z%sCP+Sc)5$aEk0)k;lFGs+nrM;YPEMG6DjnUi3>5AKu zKF&badmpEPv_8%`u&kw@lVlzBa|R+%miBYbLhj4@In!A70nW|v#F7C{igh%=`6r6G zY=AS5MmS&4 zFQc4iY3C^CYu5WH=QOsJQO>(8`xs{_Jh)_x^Emx7#;K>=7?INzYW!EKtI;a+KStv>Jkf<&1^{{2!=6$Spq(1&;r7RSq{qx1)squhc_s*2jzh_^rBAgDQFw zm4C0;-Qq_|^l^C1|1ZUERi*sV#fTyQPQ{*6r2^57(Cgo=*oD*1zrrK_9~7Sp7=enM zy)5L9>Nc1V|1EqczmP1j_Zc98x&kI8s!<{G3)1kXTO!#XzLZ}P{2f3j72*uAb(W24 zkqfii)UY(`4LW_c5M7=_W*D18&U`pC^Ej9bUx!aYpw=5mE!u@PCSOu%&L@zPKazDk zN(l;Cw*y%`8%P(H`-!4!^8vosF37n#$?!3P?`gqOAdR4bA=p*!hd7cGIvRHv1+PIJ zg241x2#UbhJ^}u_(E?>-NB&E}Q>^(LHNU@cmA&688{7#zHRORExgSnzKTvZYMeW_> z5PJAUkb*+Ur_TY`E&`0w@S&ujrWOJ!2J_Eg*vis)uMfYEGuEbZr9B70V5(X zS}>tyeJdNO@Hh18qa774qr!dAj*P-bwZiMu3Ln!7-}qI9U1b@~f4O6+7g5(9v?dUk z-VNEpiS00_okV~ESt1vwz_zWUe2I+EN$+;VR>&H*h7YA=pW}V#`wIC5egD}nDcxi- z>*{N%%akeON3T+;Tk5x(2KV%kKe8}Cc4Qt2V`Y{6guWf!-c05aeHfG!UN%Wnm_7qY zv^F97qIz_KaU}xmL#pIM=s++Hnr@%|Ys`!v9 z#?kcs71MD9%dc6%FqIHL-72|J_nPhIa7->6&;b_e$tR_lK0Gr! zE!`W^IuCa5!@+|7*$QtAwO6rbqYp%&5pKP4 zh8eQWP>`ekkkVVePzj39N(bgxD3{C7sTS%6;#K`UzJ;`ksrY9`1*ln%`j9O@Be2r=^;{((@9noC4o==ZaTJ{af zYF#xN_J;uLoX6>$M-pDkoNIN?M*!Ak;e$yh_{b4`WEB8;kkz5rITg(E56rPMDj!r@ zdpVGW@3C(=$hs5oeSi_D<4b^<*KX}r%6>uFHVgql;qSOzl-+>X1WaB0p;GuEJz?N| z0rv#{XT4FCJb*kWv}-?+&7ug%U*WEhD|>*t*!o42FOgelOG~>RMpKF0pY^!>=h(UB zz^>?st&n3`D_8tdca?mB{q~>R`B&1$7hq%IUG)E-wYTnMiFN<`XNx}%-v%r~jET3w zsizXgioVx#IPw?D`tTqE1B2)%k3osPH!%Wk$b}~jL*Ppg`*DFOFpQ3svcFyp3(S^s zfL<{R9AX|C;t^D(5(A*nojLaRH#5hr>DDB~44C!r*PN_hS##1;##Zmck@>GIKUw3> zAfdzZlb#&5=3YiZ#!8fJR-!mZY?sakQBMrpeHSvx*GJ26CbiLLV6@5xuQ1ppOky5Tj8Fzq#z!nf(_u zN*jAC657~Yk+Vtq`m2?w*4(-&b;3758DZf(PVRw<=Hq8VE@q;AgIp+>TR$F)K7(D} zsB<2eeASAxvY07#Zk-8mh~m_&mBI|fgx-LMs`VP)p!9w+-!S!nhFg{MKFc>;aTyZ) zmZMjE_E9ftc#Y-UL~o4Hxml?VmNR+~;E^u8(aN1#2Wv*T@Y9y_ceGjGXcvCoGKHpb zy3iv;FOW&)hzg0?e>6*AQYgHDPSG0g>|PAwfX-31+I8No&uOgL+L0o>083q;p( z=cE$uoK(V{lS;UAQVDNPDv_R($_qgfb5cjZ3d{T|O-@6JrMjaEqp-yJD3C}L5R({z z09T3mNLz^=D2XlX@u)|2?_LNe`ynaSgGW>9c7(J{+=Wg-GsF}jc>Gv^u0!R2*SLD#0S3vk~1bn;)TcXp2aBqn!SC0Yb zoXb2bbs9yB(JSb^V=MyZZ=6{So1w~7e>6s0*lE`U zUOGM291X6?}n?}S{CUFr7PAN403l) z0RY3a2yl}^kv)e>-ewW*QPMgy&2^9F>bjRMTCa%j8mH^-Rou?dbu-PmPp3tIT}Xfh zEIDr8Vj(B#CS%nO{!B7q^l|dA(55DhH)9bxKyo@X3bp(k$cO!Kw2xpPFsVV@sE+Ih#y1_L?b~&yA_Hn)B@rYgdilkTX!S`CQ$-jf# zTh9-@!q||FscY!hS6J1Lf+2O(Ko4vM*n_clDTJ?JcCVce={}WOPV^ju`*lFyMbcYU z3yIE!t@DvcAklXY5~|M>;u~qtR2I7x?lhkv;E`M*>! z$|>5?54>MU7Go2>r&6>(YSxH;LD9=8x&g#LWQq=yetMx+O3J;D@8gtR0NFu0+gfS- zFj$Z3Yc=J4u!sO3C)M&r#u?@u332=OH~8{r$2HI}L~EF!HCPU0hRPC_ajy>f@4(3o z-sPZ3iBK}e?qz=Cfh%9lxNBp*bNOM|58yu@TEE1XMdt+C@E{bdMS+IrAaOSmVjo#L z2yz9OBLs>&!!Kb5#~|vAJq6mH2Y?*BqOazp?H>{5V-J$dGLR?4i201tLJf}ylV;K* zr_tR-x;q&RzL8JS3B{W4YQlH5!w(R?a{%aFHT?y^qlQvfHx0|ik$2H2-8Ixo?spk+ zC6eQTZwarUAIdb{j}ne%cQOLynuxFLD+4Imm?wd2v#K7#t(;!aOoxNvXfjpHK0jj` zO{QVxATq*gK!r=yDZupsj-hjq#&J5wrSu;J3aizH#X$Kg%W-P^tRSaaXrtp@G{TrKxy8GkQzA%V~zhS7Im9ITc7UZ+<=d}JHd zov(SH)9Q9>bzB|{P-nILf)#N2FV)qd%^G!=YjvMcUEUxtU!m2d;>dZRjMJJM+sic$ zXn7`NO}TE=Wkk97Tm~P@HII@tGEB@jQgQ^!*yD)=uHEQ~LX-11I%jU#7^!=~?=(MI2{mA0PczQW@PU(4gqr9Nk<-q?n+yI3gP2VIZnujH2f&xlaE}4 zTs8a&;QsTWjYVMXEka(^@`1t79Z@=aAoPbmU!Kk`qUirU5I3gA6w5UoKgLHsR}JAD zJ-#@P@NQOku7U-ix@W{n%c|G)4 zVIpChwpMAF3u7jGGuYy`nvoCDZ)T|VG+@-kP+}%_EZs*S$=|2*pQ!WqW3tEOKUwF0 zAYq+#_Q|eU9RT z8zH18v(8bZVDN(g=Fq-Y-a7!)l^vz`q@`E7(qpysN-d2QplVr5v1>XOni((7^L&1d zuF^x0l_~SJy3A)0)@53w%dnoXuF}6~cn9GoR_Jva=CW|zaVH3Qy&mn!nF!sx*(&dA zH+djem+nNyrqSG|GnS2Gb6GL>DN@u*Y`fx5gMoN}0Q*F{^dXe~DlPp)2k9r$(gS5@ z_Qjjp1<$8o7237Qc2ftzO|IbYkmK33_pNrpn<#h$1Wj0K zMJxR)+S?T!(9o~%iq6xt|FSEZ%d7soQLAQG^j?D72@>byPI?XcIx+PMaPF??9$?Io zLm4yUB+uY|j_<$Ne2)dEyQi5+>FsI$Er3p#9M79OkV3x$I1HfhorqMvU4*OI)6BTa zk$7BTVK6-spTlYOr@&)WPtH_5nW`64b$=~Hwkx%22D3OA%~*+P;dEoZcpuZ4Hy|VL zGY;L{uQq1)+=D%CBp7-&g1_St2zT4^0unlGTRuZ$GPf;XOpG}g;ci>LR%6Twr#fU{ zmFx?QZMG~Q%B0z{ypTz=WqB!+X3O$rNMgb}bCP-oP=4~#P4uifCl7g5h(8roay2N03By6%rxx{EVF#_Odm+FL-m%yVeEE!_T8i>^hgZDl%g#n8&+dpYVIMabFi4 z5DpFpSntYKhgZOKdx9>UN(~Rkh60@EQfnf0)29i0k_(Oxk7GuYU2tM}4#5T&oDzPN zMVR7(jp6%Q-l=ZBv%-%MoaTaa!W#)rcfo^&?^t-(|2>R}Zl=~oN%y<6qV_`g%6AH% zHTEWy#&?EJP5`5CiB29yhTk(88wthI_or8(FXthYM&=xYtIBzn8Ro2mOiFd}{;7#XRYIH*?6K>94FfSHKcHzfP+sHMQyD6+`u0@cBs z%OT+8_>e(Cj)ind&P(8|60s>dhi&sHa1_WQ=S^+VM(Fd4*sIVXecMkbc`oEc&drbu zid^|e3NDmq!c6bOvCs|Rbo9=QlSsm^$Xxje^vafBux?7TE={uvWGh$vf;EhRah@KI ztzhzjLNAj`T}dBZnk(OAPB%-o5cXO;@k^s7QT$L%Bk4Pc=dWQ-HxtCzE>|7_H_3bS zAR)6j%hHnfumY1so}>n~F$JSU$bxHfI~XjxT5+Rd z9zDuChn4saN!+Su#9Ntr)EYHnp$sZ`W zD=oQ4*F&R7$c2=Q$PSryDF&_x!@?wH{UVb4n)U%Id71|u1gMiPdra3otnVz(V!dFZ z;;Nq+!I{VcUGM^(%Nc25GykB4zhu!Xe<}ROv~Z;szB(;jWd@kcc?lW{W(9sx{Fl?h z)mr%BwD3^R>@IRBt7KyPuVdB~m%ok46Sd$w5ENbHb@bKDj;vMq;bT~5YF3_Q0BiqI zU_G=W>&!Ikp_;V>yB0*DJd%DpuAOxpH#1xaUV8sH?frQ`(fbBkO1Um_JWGwuV*vDr zhTogc;kVsPvM%k&%1K6J_)^Wf(Xg(fH5Yeejba|guwJZLKQycfmT`4Q);h2j z>6X9Rb#akygf6rn?4C?7Uf)sd^t9OZZnYXQ7oynjDRxUou{+aZw{*zOg(z0VUg++Q zV*gBw-Q6KK7upXYbss(UfYi%CnGUYN2#EFafTsAd=cRaBC0NZ=MGwFb{yl^F*ScW!%fv{3;=$bwyxW62 z8JLH1%r*e;SsxlZ8h%lK>kmpee?0iZqw0VO--|SUNsS+a+iec0p;hC^`S6kCyuX&5 zf6|=AxT{7P;FV~(Hc9VXoi8DZIu z_}oUUd8=;>ehBhZ-|95A?85dlNcLeNcN>n|VS)O=q?e%isULMZw-HO_YLCGWC;wiZ z7ET#dqJ-~BuI1$MNGTR2A0;j&@}48-2QFymok#SCE*Q*Ypx{$UBk7eBy!yd8ZQmRA-7^6M3(&z@NF)>bweqpS$4j_>*v&N{z~|qbt65 z(KUI;k?UVBI6h8~s?@~1N9lq#7d<7f9}0-IM^mK6yq8%I(gkPb9m+B&7o3y#HkmCK zJUCC1YP(=l-Z)ZyE;v8Gek#oIE7p=qHRo|`tODu;_)(>f&HJ9RL3J8HY_yR1wFfo| z71G??sFAmkW`2S@lJm@dLqpvrK7W(j)*0PE~4K@HuBg4))( z`(o%3J`S8XO3k8&hl0}%pM+~Ld=3ihgtymVTpaF%f@~1sYd~m`;io}qQQ_|i+2OO0 zYfCWvBDA+S;Tfcrgm*w)3nb1#^x`y6_+Ti&E`jhS4cj6y35ck*^+s5bp`z;s^6idbzkEqq*SFR(9$U%K2ujeW2dtNbn(AT99&B#1T|^bMjg%Fj{Mued*9HL1|6(NPx5|P6!}PyzsFvER@gJpbn-<4wL!9nrFKK+z5IR z4VBYqA&(gq=`E_$Na@raPc=F~Hr@z5wE(+zgJ>5#oo)lYn^{}wJ^;9Wz;%-|FbD5q zh3^@#6xc7}>SGm@$OEbBJjvMcKJ%bc&cX=9SaBYWUjkgw;qbIPkJ)m2O_8=jgWCWW z>)$!csmNC%L@BlH2LnLDdRvAi`>9jY_LRxj8HJa_8Ro-r64zBy+5wj{Yb=Z|8$>4J z<$mRN0_T0?)qEpB#S=i4mjGFrxmjNRrGf|Zhk;P>2@+GuA$+TG=^;~yFYK--K+oTZ zFY^v^^r7>%Vz1rV|~&<_uH@EK*-q-7tb?ERG0PI;70iNGTrZGWr@ z0@`-6it+$z#rw#|x%ywx1*l$hWhDd6`^aZ1Y5*PpLPa$aN0S5V_Xi^M&K*jVpE2hU;u@2)b3PgJ~z}4!RlgL>)5n04W;VNS@a8tyxZ1JHaP_R)PQd(C9ZRsv(;1wHVK`tVHhS0gFauC3(1mF|jt3w}HH z2`ViZTY~aOV?ROG!M02YtG3&~nR5*AQZ>jT1%XMEDE2H-v3ICBRto_uwg>!ntT(8> zSRtr>5&8gtnkBbW#|zrh1LZjC7!JA<+XHf3gzhKTAy~`<*K#P4YLT8Vi@gTNII*1& z1lJl^s20nqqz}|p@?ml%rjhFcaNz+L zI}9Xlg9{Bo>9IBKIS_L>$jn91I_@Bo@#6T|9(G8bb_bbE=edJSjdur`OjFA)xj(hI zgG|lg4l;Gx9b__{=MFM8-W_BzE%M81aOEKLcppmd4l-{dE`>=KHrx-~u(jjo5&fYH z2IKA^lX@`747!6%13E!>kZHg~+#O^ZupsUZGMOm`nQ?cJX{gn4caUko;R$X+#UL~2 z4l)h8ChiV04LCkQk7AG+cL$jUJtf|+256y7ks9OfAk%=e;_e{RfOFz+li6~a501No zOhavok0aIRQs)QVL8i&5Ij#pB0d=x2(y?)OkjZ209ApOFK_d%!`b<7-X``@$o>u|8->P{}>nF?+LPR(qPCPWHJbIyq&n^enh|Ci5t^9abtQX zZcOjQjp?1ZF})KvW_IGn%ud{x*@+u7J8@&Tl%UlFWA0Ae*tT*uqF~J3i5rXIS2RwC z$Gn}mvGh*dPzaLPiF*x;;qJsei0%14OInA*v`%`6cb`dLGD%Yw055z;;M&<<2|*uQ zd-7xS9O`Atwap=HNsGHgg)2Jl=6mMkZ|^mm3!m<2Z4 z+)V~p_U9x$&v!T82yS^(+REo#D{IL0Jk9zC&H9qy3uOD4pgwH*BB{X&DE0B_)lFVU zruQVZ@-2@&L6TO;EB||$n%}4FBrq7w+o}0zf?D$jr1B*JP&##AX!$`U{zWa%r?u>)mM^HKTn=WH+U*l-IhBA{K~05@Pg@#2m0FKa`=cLNDz!O&NlnuM zL(?MKv9MfT z%qXvtk`>8Ubq)qiJ_}`)*U$k~Iz1D}9uI)}M>K%@L9D`&=Ha5}vn~ptRWk+w<9i9j z&Nhb&-SpsCPM6fmmwH}I%{`&O{LGlnnz)UMKL^9B{xGwUtWZd4}pGqCrXezQ4ALQA<-3nNCdCZ z#Cb?A04`KRa3WdFNwDyJeSw%n#6Li1x#2-vqVnA$Q07TiXD@u&`Nx(}eB7y^<2WUG zbDD`6PkAYGE+Me50dnP9Kvu4PEJ&YC6T|}kun~FrY3FU7Zk*Sg;k+&F&a;Y92Z635 zA=>ekV-{aI7U(^T1o!oYeC1eR>~Dz4cn@h{9G%qB(H7q`7MQz|gkOCnX*c8=Ob!6u z;xDCODO$R)mLP**pSetOB|q5rI3~G#AKd3WB)vC|J%#jl`1;?*1&7P3{4?db6!)&6eF)j_hLht|_m4|4`4sz7$pRJbzF~<{JO6nY!8V$|F)TIAF7j!}#MEVbM!9g|#?l<; z!OFmAdT_3RIV#fpwt=tl;O+*#&4W9M{7o{{U-9*vAs(j-4N%4y5quoEhXyLT12q@I z&*IP^7Yc^>3nDbw<&Em93014>pa!Qif;>(a8lr9m$N_Y4LT|uB)x8?tpn@wM0uPpG(*3CEnnE7L)Dqgf9iA*I!q@yU*Th@awb$4wY!M^_5koSsrf+Z z*tyB0`9$1y`>$^=9knjAx$2DbTp}7 zLYlk)=|ob$gf#gG(#1*r64Io832E{IYq!W`99`5_nKUmUO`4aGCV7-l#WIOB@BhQkJXP!9M8F}tC4LQzvP#t-}G{ch4co0WkG(fpNmKxdgre>^i z_!82{<_|SgqmQIUUj9@=6CJ*UH1dkcuF1KUDqsCh)8=>POGqQH8QMaJFCmS*ZlFaX zyctZo$Baxx8N;mvxd5SY;jcU}%=20i_ET09sayFX(N5f@8;rbN!+7AFdE{Nj4Z>8v zS2)s2->H;z_!82{dyG8vG+05TuJ`%cu!LT3v>rYc>7-t7OzQQh;Ft`{U^L zgq||9p7|?T^^{psPnjk4lvz?wnI-jBXOQuO3lQcsR0_2gJ`$ppr&nH($7tDIK8>;hjW^(tr5ta2uAtbsCjmDB1h zsjNWHpIHr(0hZMBXGuMOmeliSNj-m-+*8jsqUX<&X8tV7`7>*ltbkY-+xk-8fkYu^ zr>w8^!>`cK^bV8e?3DGjP8V@@%KFCOIXi{3Fsx;2*(JZH7S2vtyA20tr>q}LnzK{Z zk2+n%*(qy}!E<)X+N;x|xC|=c!}nwk##j0|Z*5PH0ysNmec*z&eq2}|x?nKK*(vKI ztp~GH`q^TA?1D~+vs2bTT`&>k?3DG13l;=9J7s;UGsTlL$k{3DGnZN&%cD*{L9Br>r&?Jtf!=1+;|w1Z)g)b_(+rrYX(} za(2p6E;uLnHkmCKJUGbNDa&@jrrCw&Q4i5 zF8wkU%v#4AZMp6$K}5oV@cYR=fZ20epp-is!ZFrR)x?*S#j0Jm}{BdB3uA4 z!eL6}VqC&K2y#@SLA?ZOB@}}&F$~WusUA2O9Ldf|qjBJBC7W>d3G1vG@XF((LG7d$ zAl25Vkv4~o-*^h_>|Gv*f7P2eYRGoD0IA+Kkk8=)q~M`R@w}ebC!}dn$SKLGPqF=$-fgU6Zsw<_iy##j}u3F2YqM zC*o>}f}=5lR(64Wn)C}AN$)2-*jnu5?Ysq(?^d%1^NuTy+K|_ zP5KOb(wt$B@(jEEj9d;vSAB-vep&7U5aeM#dyD%ULj<|5ZNKV*c93V-?br0SA_Pc? zXV~qnE*KV3o?*AQ$=jhQ%9G#rPm*t}j`HNU-Cd6s1GZhI4$i@B0*|-ZJrzUNoc!*_ zlizkPgV86yyYb|=-P>Ty$?q<<-9!Br^4*JZ(I>y{zM4Tm^#FAPRr7?IJup)>Pk!5j zGE}42xBIINR77q1?Vnhm=0~ZI98f zGZH>FBy#A%Cr*Cf3AoUMEzwn<{I<*0ali$6^4qS|X*AkAdIgXFJQjh!4SDk09;!^+ zjONi+{o$7?nB)9zQPuO(wzt;>oKGr0=|qBW`J~> z6T?V9MLZ9wBKDF51_Ojq&1#;kT!bQf0cfY z_N3xcTIFfExTKsY#N%Cnm=@vjxW;Y%r%|bm0@yEsi-%ba*Gq=0lqc71 zo?J&ubxD7BN&BIR*zbe1I!$`tC0&M+*fTLz{&<=+)0jYy*t0ZVgxU5|n_<0mOhCSZ zqF5i1UwiPFfG$C*mMu;Ab>pync_8zA9xzOca2QvV0@v`#C~@fv%(==htx-T3)+)_f z_Hu7cAzp;p9?JXghxUGg)Nwu=M;hS_%V0GBMv z=T3)HK9Tey|5wP@6X5R>@MMUd{LJ&@NwWcc?s~HC({w-n5)Mb~z~A>_y7^1aF!8PR z760f5@GJI~C}=-MHg@MbKj15)ID7@q45DW&yHWI;j1(yXdCQorB6Uuh%AlSP%JHO@ z$$C;xPE#4zq?}4>O3o*hr?QP^=6fk9SCHCA^0;h9z6^X)){@#+-Uw=s^}wmBo6;JX zJLxx*r=Q%|A@~0G!|H3`*j`(axD|=7K!^Xa1&0*?Ut?YuaoZ?*vG}inBLu&KmQno& zK{ek6TB0e9K5LCnl!#s|a}wxr8a;!`I%+%z42+8=!{CO^aMtRncv%3;O)||{*+k)e zT#^{@LL+MD8Oh3Hh4W9O&Sj-9E8 zIH2LhO}MlorJrgwV(4}jXE>(S!NGswD#p`QUWyK2m~J^EwD_!BzOmv2rq0?6V6vzYdgZMZY9mibFKc7BWncCxT%_f8bt&^oSG^ zpCTc8tp#~1>S{UYx+pr%`hN*@dkL-s(S0rtl1Ua}qNMeh1acI*VEGal`u_wB>!!Z~ znuQh>=j{*Td+fwb0FUG%Lv$E>YKhW3UxSFTuyznYNRH;SVKh@B9K|(m=i?e?uRKQo zp-A}eQVt=bzVKN&x<+%4(A+=y!M(3eHsBg&mo!SR{8{Juq+A4?$%0Rd(Hb<*4gQQC zr5Ez7NBmN<>HaF?SiL9`!=i|`f0X2lAMkGgQa(o!ec^a z%LnBSa`IU{nkf8agg3{QI>8+pHyU)xhoxBhpI+e?{8A0+#?U58<2nKS|Gf zu=_trZ+Wo$KS`f^un$EDZUSWfE=m2`-zDjpN|pV)BzLCL{9TfF==Vc5Tk}^)tP+g5 z-M>OIkoQ+eWW)H|{VSxeG~^xny-v%ye}!ZK@2`-)(~RDs-=8$(9s0GC`at^GjMhjG=1OzM9wQXd{n>}a;44|!Tp_&67xXLrWcY(C&WkK{`+2d!_Q zWM^57Zy7sGu2;l4jhzonCw%3Qn*b&D#RadA!xirh=he1rL?<$xihMfbsU2#;OK;@> z_wC_O{~&CXVkIz6ito6;fMG1iIb4{iuwCx1zp=;&I3SZ{?Vn~2Pn;VI-pZ2a267J zTmMod_-a$%c}T>Nz%n(%M3v!5Cwn1f=@bV|wob8@G2aa;pT9Oz;!_k~i8bwhx$;2c zm(~ow3`o&0)|gJn#JU3vCt7W|o@AYfOis40!u1U66I{=-M&Nq3H5F80ZNybteGh`L zH5YixdJ$LKN&(}u&d1enJqS#|`W~D?>rSLYRs`v=Rf=oGngO1ubtCX-roiM_YjMrB zCIIhP-vgg#jY2x#+KP1Css%M+odrzNY5}H`H4K=}*2%yWSdGARvHAd0XdMDfk<|(5 zV(S!KyIQM&>1H+K+8r-%0Lp5{@J{$lJowC?arw-@`S~*bfy*At|F!XD9A&r19i%aO z-+|BUJMft`aKG7b>@$BFXmhpO*Jm`i^%h}Y-|0vON-Q;8jzkOxAB7oe1R5-ESj^UY zE=S7Q8nlB8Ngbv4rE+FA_$11wMr*Q_I!6W{AbpJFF>5_j%g3J@>(N#47}9I-u4qj+ z%bseSN4J94lD}4-YUo&k#o3oSdAR}oBD@^NHUNt7LKobUQ!%MUy8dKteW1_8a_jTq3_lw)sbDJYy0Y-{Kci?=(x7 z({j+t6V(R8!iePi%;rh7cK$HY-|Bxcl#Z#g@vzd)ojv%C(N zf8Z;tR{~XF;W8c!U6|eNz(0boI>0LE1$Yq%1>KNXjs%+K^Pq9@y9isN2B3NBeq7F$ zw4XWge|}jsN506*=*Ul~a_nzdsN28xDQ}sB#gBi~$l2qZ1Y`Z6V%L%3t|0qz5vmq!Ygax%mRZ(gLd^ICesl~=0aC13Pd$UKV$PUFV0|t+OFx! z{JFkvnUsv^XI|Z5vg`f8UInghBnkBNhG-;shh`>N5s~}*>C4IpT6?~3?>)NWNkL#v&xM!zXaz|0Wuh1l$$l9Ou&Tco^$5m{-ezDr1Fu`~TFjt!=P-l8ZXw+^ zU7abH(O6l~AsLd$d1#vTmp$Y#&nn6dZ*Qafq-D}(xz5IWPQC6NZy;<3*gcKP0Acdz z3}5Q#8KZrJk;&MM!ho?RGdHiPyM7)AonF_5ENU}Zbrf(2LF?->7@>2#YYXbf^a=ZB zN{-SZ^*$ZV6Vjan3TrxtiD{Jf+5cL9@!v*M9ouBsYpeeUj}`t?@A%(Jo7qkMKN&lA z^iq!Jr4A#+pEZP^j}hIdW0OTF;U)X&egXlLF*wBUfy`j}SwvzdWM)Km>KOE$e?`&@ z(SnSyhXEL1xPx1-k$H@Tzo2-%LQ#ea7+su^IW%_tdC>pAf5`o}YV24Y?LnKy>lWW} z_@DVC$;o_#WIX0Dn$-`b^dm5@oso~De1I9_$2cEI#3#~^GToskT`ANxshxiL@af#{ zNj&7dXIRFd&pd(9zj3y+JD{rEXqpTJL6wI z`MfyEeDa}`WN80wj3Mwpt86aQw+9~2!1Z|peP z5BEuTo$226e^(S{b{)ZvaS+NJ3WdE9TErWnMblxa{SxzfkDN5#47V~PG-I%Z-&F0{ zAqG1}C}PliB|*i4t2|ugQ(k`U|vuu_x%L1FSw3}rqZ7Cm1DciDzX18oN4Rp)0El>iK1xlO! z{qDWz-uvFn$W9uz>{rHqy6@a`?z!ild+xda-n&oQ0<*ipYb2a5V6?_*$&FEa{KWzhOJ>5k(n zy*AL$|Ene_{vWoDX^!EqFw*XTAw#r0eZvWk?G;`mb+XmAV3qh9Y1wXSqvAQWVYgwJ zzQm@|(;C0shbK3#bm(ov?fzQZDPuul`2@`kS3|@Y90v5F+>KWQyyFjyY zSeXf-f$92|sgLP{u6K5znwQ@`*`{7DO;}BE_%573!NEv8JQ?>|;7zUt`m=3t=y1{4bvZpp#!wnJuqm?^M}Hq$ ziwm1K`a?ZSf2p%LEWf!il-4a)-sn`WwN;@U^fPw;&Xhy;w87=w=I0%;_l*U?) zEf&Sad4*SB-5PY8TcF+OdqWO})^W+=&)slHd*|o*gC?#!*+u>5Yb)F07eZ-4_eU@A z3vT0Cwb4nHYn0;3WKkCF5j!#tZ-z*9oMp}L$D&q**_5`1ANMeD1T+pacK8X;p>6Za zVk%3Q#+xjV!d-k*$By=Pg4g3u{CNq5*%|-P&nCJ$ zJ5#vuKYmq5XZ-mcUGeKXTCm3x13L@|67m1k68qj_XR>qsUp(KjH+4y>mKHGn?+~^n zxQ&0;Ddfy6Pt8uBDV^!ry|?G|Vod?Ndpf#1x=xj5mKIm5rBl^4r#P^(QY(%v){2MI>CS9rWxg}Bc)BuOSu9mM)8qNk zeCKF+4pOd^J57BSt0jdU)x|)4pR3kN%fhi^hSgo1EzM1@E!B#(bE~Cl#{yIeyO>=p z*Km)GKe3GkJj|_Z;}P1%d+}|glPz&wy^k>lUmDrk(yAkVn-O1&#da>V&o3T)@GmnH z<1I8om_jxM)T6Q3uK3Oa@vBbsBs*KK)R^{NF1E2?_un^dnWI|KyKS*^@G z7xnYQU)QF*uuVL`vpkb3&aW=6TwYy*TvMycbct=<-pe}p9c)bh=HmO`c<|Ok_qS}+ zmBXr!|5*^*_5PEpa=r?;1w-Ng25s-3ZslBFL;QjGfI7RV&a7RYS%jK6ZGWeM0Ymz%d3BMMi z+KLY)#{UnZdW9&#n7=~|1wJ?-(JE7X7W>CD2a^*AcOFa~JUE7hTIJ{z?tSst&SWzF z+5_l0cZE{@R#VI$#gTDmi1<$sWxcIp{AYDBe}R}Walne^ugECG=c#z?n(+|L-^OD* z#zK|zo2{`_a->tD1%?qiD`IQZ^ zzSMZ{_Ehg~Z3gix6O*aQLsH{ACzDBxZJa7!-x^DHAG~F;cRMq{vrnzDL;Q1+e{SWU zzKO-m*!J#|yRT2-i-<1eU$@43GPgZ?5F?h&9i3uBCn)fDF&zv``ZQwR5Gwo|+hQ-r zm?gQEWO1+d7{3FU_V(+TciR<-w(g$ZSD+N3Vt%A8w)g&#UF}ySzuB9-K3+}4pMN66 z{qt?H9sEd_6ZZ>ku}tUK*<`5Z{u*S+K5Q1>!7gFgEY5F?>iHhToNU?P@xQN*=52^s z3uX7tjj>&w$@$&=o%6d>sz6i9;a~ks9R3g5%RL99u^;~4{_;8$I_l!gbXog*0n}Ko zZhVI^ogLp{Navh?*x#e3T~`30&iR9!Qw4riHvT6;>}PiWWPE!f^@dZojCI|bJUg~C z*|k%(jE=URS8ivcZHb>usF*}s{DuSD<5wl(kN#{T{zpL~xp1(nJ++*>($FG`8W+vnR@~#8%Ct|fbcC^PIy6XrIJvh?Y zeg>kp_O`Lqt!)SScZ`2-5l5xm<+qW0rgwLL@9vZpLLq)W9^0CkI3)S0xL-!x*uhBT zd+6y8_HGZc;P)lt-#}M{j_Y`;_h4_=PVr9sd}JJ_FYfA{ADg%ile*r67?~$=_4SS) z>U=fW`%d=Ft+B102fO$5#@9N!=>?5m@Et6S>RV$k1`@?;iC@Wrwy>9IN%GGQ{^`Y^ zSX)P1GQNz|n>%(&a#fyBVvvC3NZOkjd&3)&5B?JVK5z?!vFSSF1th%DW~EH8&Wvww-`&1@+so9v6GpGt|87&vXEww- z&y2k)bucuj`O^)t3uB}0__x2i_f_pTr4+XZ)HG-AN7J0hlr}P)eJ*D?{N5X9IWn1% z3jGwK=JjYO1JBqJeDg=O5~-ET>yCcVJ-_OimZxhA&vJgFlBx+#U9V;qIaCAxI^NsK zbnOa_jLu`>BN}&~inB8cew2#~BrodS(Y_<(OFk5h#G$KPX1j)zJ3{&Vek}H4#?41_Flw-jakA`Y|u|N;{Kk-(fGuD zWA2~i%!!$X^89SW*e4Ks@SqYgG)Vm_`a30INI*3wtKO6rKR zaawR)+`nlM_wO3SeHfkX!BqR$Ehj_8{S-)5^q9*1uQ+fHV*Go#>m@(vM)afMGZswM z`mP@7u3=H!ji1-5i!*vLl%rsUyR6}KokP*1YO|!G1`ZoqwzA#-0p8?G-po<(rW3ud zif=k{$HCif>pK*lj@})MO{%fciMHhG5|_@8ZzaeRE1sUL4)>i51bf%wmFR>SYt9O)hm zrTPQ7vU$B0DBb7hT+}_7WV8gEe`M}W_Z0q7_W_hi)4*rA17M-cGVpcgi-yu-cz%OT^1_y`1tr^x6&(a_nvvL3m<#9Om1;d?Z2b(=QXxH8EP+YN8EfQ?%m-yo>3it1aXIs z9*V#Ch~)G+M*m?DOR1tCX*)P>lyWfs`~$r092jf4%JU0<2o?hq1M#hz#m6CPOYm0y zUAOC*DBZENc=|cnLxCZv1%sLCrKPGiGH-XORH>9#v~T4Cg3{zCf>_tsp;T|C^ZK!* z%$j%(bNmY^nbPD9YDj*ukx%(Sca=X7{xX!-UC@tuW7ivFi~2M+J7GBZdEIZ=R~d+_ zUJG<%Gt1S*Y7zUm+O%d?Dy8Dga#BOjbQMgt$#f=Wk4zLNtzZTco!?q3J7o-vNH zJ2Snv^ujBBB7OwD>)!@P;Fdn|Ge_nT_2$?dfbZNjC+>!4GvPo>EEshhY`^a4bpy9{ zcJ_9*w#MJN@ksneru?n52YTn{PmYao4JA$w86Qy|p`)#ka!ve`ffe)-)I&?a_fG44-VdZLdy5r6Yz-L?ly)waW?f@a+r`S1>ly`o zt6dt#2o6opw|p?FEiRWTXi@67p@rvP#8a_$81io@L;mz#9Wr6#;T7?Nv6prJOa|y* zjj{Uv>aG*G|E1Ug+&^{Kflg&F=fSKcILyD%{)w_LPcL#=8$VMJm3vqgK+0iQ!Fa+$ z{67V;c068ShRi&}A>N4?8cz@Zs5^~Uuk;5`{6Djouio1CXqe%~A{P(fcV`pA`i{6;^Lv3@D@$cT% z5r0$c^_{TVC(d>B%6OBnzsLWppOEjq$NwBLdLx$aY(9-&ENHoNGoD{0%paei*@94D zK0kvOl!9$U;>X8l?nBtWc}w3LTKg`<``*~n_m&vXj#EEALxXqmfxn{f4GM$zK@5&h z(U7l?i^_2W@b}>2(;f`_H*f8`u%Yjbt$laL`+lAb)0?;T-LtXpO>K%VY53cPtAF#= zR-h(4Nc$u%{&?@x_5k*2ecXWv&gX;U+7z!R5%PB_m}#4(=bpch z=Z=4rUk2%Y*;rq`p4Y?q`AXeCiS+zEQ`nbN())Q6-%KuDhpt}ybnD@ytWuwnj{E-6 zbbeW>L#BNa7k}q*MeW+hf5hM~wD!F*-gmdP`zI04Ulx~dE0Pzt^P_qpUy+k(Gm*4D zZbadnZTm9at8iQTn#qKd@MH>YU)%;y;PUenTH>PeM&W&i zM#|IU^Fjml^NHeEpOTJzAcN`~B<_TYi|V@{Z@}vE_%_FUwr<41Unn2T>-R5$L$oSS zw5&cKmi-j?@F(r!a$s)OtV@r@sde$lPwGkXi^4a7hGh|a0{79f2rim73X_*#R`Oa8 zrq2DmqwQ_Iv{BwteGvu6a34e* zS1idlS~ixQc&=PFD!b2{WskNk$#*?m)Cc=Kb-(B2y&N1DIdy*Fu`6ZaN@qdI8TOT7 zIbAyH-meSh|I>KSioZczY-2J$CM|JXQ{+q_nwGkJ2zajCTu^CUx!Bny44&&VyHwv8 zvP0V+k_T5+*lztcPT7d#iVE|N%0?X5Rw#$iav5bcLMu2fpe!g{E5_@v3@;s5LmK4~ z)z!Tq;uM}dqp}jmDSRf9Klw)ad=8PEaTDj4i+qXW)O%|L7v)2k=S}g)dx1GS<2`v1 z&$(F!_kKP?%Ly6p1?F^2d{k6se(ZtAl#$oK<}DXm-x$BU1#_(Q;r>Ft&|gRfllgQS zpSKwv#1}`#M{~J+As^)P$CJV6V0r|H@8#9Y6r<(E8uoHd@tuxS@=nJo^G?Sp{Z7Xz zzSD8)Qtxz};-eNIJ-s#`V(i}U5uY+`0%x)P)_WBA-pbz!AaOIQrv@CfqhsUncY0^a=?EX@UnC#DkVL{G>5 zj_yQPGS!nxrS>OosFapU)78=|61SoZou%c|rP)Aw5G?C#|x;M&64^6A9xdHkQndoOdlyAr!60b$PGJ6~Sg zzdx~iZf>nSQv;jb)shOUh?||RP5bb2sal<$FYR6`mFH^Z>7|vK+qH1n;VIOFHXVzK!c(g#bScOl&*hKVdLv63XF8LE2~HH! z5~OIUBiZ8NQf;_Wdd*s?JabM}?BSt_p1A>}iVG+Z1ziQ_Q}mnEhc)7&2PRPGvI1scf*aR-<~CN@q$-4GHu8nVrgy6jiRxH6EgAqI*ko8QCq%tqG-XuVyp@)RlH9`}|r{w7Lb2P8=J` z6@~_j^>yu06>_6=H$!wJjb4-Lbc^mY5s@O8?%)Wo>MM4olijRe`j(R|ufL(~jlu&d~aZ7-N~q@HD7hCLNC{kg+Kk<@iH z*%%*cp4~xq1Wj(_c;0j<9EgnOj;0Ga_|yDoI$6x;QpL%f0#XV9I;ADoqn63^SW)+U zUW4`dU_i9b@*!aPbnR6gBzn=ITy82`u;U-vsN+6}&Oe_^7YEam+A@9aL%Au-Pa9GM z%dERt1Vh=y0%~h=S>y_7lL?BF(M`$clNlN;fVgHdOfRP;N9kqK0zm46S~=zc8Z9Rh+9#>u$o;w=$$6+eD)b zdaQ!FoK4r|aIAk&`xD0&-6meN9&L;!2(h^TMn6wjHBGgn>0JRW~4g>@#vY4dL` z%<(~IVHr#wFg2`UN>rL1SgfHHpDC3wmY*)qE|n_5V&yf(GUise74|y+!;%8Z}-Kx~h>s@i| z>JE4|gC6(0vST_HQNC3{edgNfDQA(=!vr#FSO8=fmE9Pr_BGCVMUyMM>p>f$>r+c_ zyvOg2_fWP}y<&t|W#wv0vhrIK`f@#d~!Eg3Y^wYdka^u>c zZsAMTqy|^+DAV7dOSdwaJ{CiqNvF+7Rp>TRuS|9T$znQbI@6TvY<13A-Qt3!#bvC2 zS%c(&isLC5{}7!NmP%@CRW;Z`Su&G{^xX&^&`7EkFfPKTz*;=kNhgQ#{Y`FAiNrk7g zL~S2>s^zyrsaNej_h6}Owsh9=F|A;7jN-txjAMfQ)^u!e-PtPy^hZo~vN@zCVM-%b z3MtI`HsQ=mDWl6(Vx#mub=*Z&QU<9BNv(TUYu@$j!wedXRJ2Je59>)6b}vr%lCLS3 z>TS?4E}4s&*y{%GN@+Dbs2xlb75k~{yJ%+a_xw>Eg}Nim?4tOP@cv-UN~b5+^;$57 zswR-@yBWx!RyJf&K&@;jZFKE1ZfmJjXfpfpEk?z$KBMWLf5+| zSC?oF5H%{BwF;o?CG%Sj2pUWt{Pb=>AT3X|c)h-asC~LWsUL%hQ8!bN;FUp23sQAm zpQRL7`}6K#7UrhwtCs3(ODb3UK&R2XGMRC0F?RJjI#OUgN2f2D zl{@^ks%RBR>9kvu7RFwouC_vj!!l!(mG1u4vY@ef<%``=O1DupkyUFrMJ(<151^VX zD^0=OzUk`aPcfaLXua3BP-CV_9%qJT_%tw;KWQaE-j}1UsFty>y4Ku+B5)r?T11NsP2d3+T?B!gN_o@7$yZlKOT7NEAW!#cJ~g){EAiTcFov|nxLE7gL(b{J;0QG1MTHNE1d zK|@Dmh1AX6HE3P#sq*|~tPUzB)U0;3^*#gc&TL4S$)~G^`c7mWV(0(V!xgmH^=8{n zZDzE{Y^85nsm?5{V&E`aKZXx0l$KjKn#4X9~R<2GPc zO`@ixUASJ8@kYtI;kpX0a|cTA)*&=RyUNnSxrL>vRasWTIx|;WEF(0_+_dU9m1n^! zPcGMgJiv~RS#h?M(r{b>?A9KqmfAv{+ce~L$!$|Y;c-vJN1Bxu-nCt**IAZGA>M!% z>#e)GUP!G$HfYkO-rVB^5E2mUo^8; zspzdvDTJ`F6DimD%+LW|d#Q=n_J^*X-%|;(#y-dG)Hyt&S;(oLxOlpd5z@0dPU?UmRGSl7^R$?$U#xMX`Y;N!!b$C!N6#pT zSL@oc%0X4hQ(RR7Rn8Vy%i2*|xhC*@Dt1kZ1EY9CWpsR~=~7~$9bXHdE4x;iDS!{oi3M_{E47Zk8V1a40?dl zX=XMm(#G;j__RQzk(pAd8FP81vOK+1#D+6knJc(sY#+8Qrc$V8XWzPYpoGJRp+{#y zD3%olTSZ<$bRS4VFV;@O*;z7G$rCHfi{vt0=O;mMrSs53!40SK4sB(mBsVnb?ZVi1p3cI^)-36@i{ z^x@3n&spNZn=Yrn)93JDHMLom`2nlmlOa8v9(BU8cWcmZj8FQ;?Nl&4X&yfy zQ)4OxJRx6|O;W~tnzpj{FJa*W{loZVZDj(IWn@v43C1T?^F5rI957FF^HF_#@nO6l zdq3=^EFV>n(CW8%R^@;2w9s-1Uxn}-O;~H;UQOz_#)dZTTC<;vSd!YjOXHc8d1q6` zM=O0V&gv-{3zRluZqb=8?qZ)eI6%jOxm2)vUGe(zuFtSB?3~pzQ~S$F$L)_^y??0Ndm_3 z2a!>tCejPRBtrM;ToO`XoHS}J$n;(H-dTJ5Ms2Cl=tf&is6*3((@`wA6*G9i+%zBc zO&8rpbl*ukQ7?Ur9OtT0cyZZBxM_u+OEkuH1q*k~)GAA=))fg9G%lXiOXCPk#_M-6 z=8Gm)T5uhiuJE-X_FQWDwpg6zCwkO018Y42W}5hjO^}|<4c-zA9i!diQ4O3OBmJ(L zdJv7CC^uO+Hk4L#OeLAZ;q|KG;4$^QuPnLKD75W*6oYus4197JF5+F8$*Ejg_ZNN! z>6PllfMad4#Y5aV^n??KBRT74!u<8H3QiOc=`NOwmFd|<^d628X-2C9YgIkj4NK+7 zJcbj4#mQkzU@~4g8j4d)kLJ=-c);7SaT;NHF&VMtJ)9Z9SkzG(j`_v%LW6Qc8;zp9 zS}3AAuv9EB$oQ%(OqUm2Moy$0CSy(@nu?$5XlhR}{~A2=ZV^ZK6%khpzya;UMr($w z(=bEChf3(^j!t2)+8}2~5!II1>KY&arLo%Fjo$hzGbm;g&DBv;BMoSMb>bd|=GTyx zj@C`-ZfRZskhmPfsTx{5N%HDlLo|Gd#Uh<>9FC@nU3>$N(I*2v5H`aPzrMmv13qkG z2$s0sFw`9XY*ndk-Y8VJBi2-)a-sXjI-GVHsv4YxCP}nenP@1R?xbO>Xl4mY6qkY1 z(BR@3Xh`Hx4})9zO@7)G!ilHM%bZ%l(G+NOTJ5I6fbwE!Zsq)<4p`F2BwCG@eT-9xkfRc5}zVT zAeEW$&#Hkr^{7&wpShl+zk1@s!& z8Q0Sqy`&Ztasyej6tiBgcuyxc4m4hSUFRwsHGWsmR8DBfGT91 zsC37w8XeVD#ruB0+NAoG5{#i+f!wrGSAZcllYXT{V=4{G-%M3%N6E91bb7eC84UDK z4HhvP87k`6gt<|>eif(%4QLmwv%nYQu?p7EP<@HH<~@?bKJYEdbczGHq5d&faq01O zYAQXM!BCclYAgCuiiuPxg+;r{%bZLqGTWaUEu2(?FqqQBB^m*(-;~Kd1z|V^Ihce| zg;YMHlGw2cwJg1GCstr;8*N7>Dg$eCbES%Lwd?hI=8$r~nfaxe92^YP#H`LWsOhSb zEhLyH ziDA?hjn2ZZTsh0p(Y$h&*wmo+M1>EWloeX3aj)ry8eEuNakML~suZu(PZb7p!C2ll zp@#V*K_mYb(r{=sh83U}A4D?0_H<7pO7pA6dOk#=3-OeL^Bu}q%v`rr*3X+l_<6FA zL(elctX^?gkByP8u_7pRD6x^=y?oH1z#%>P#WkHzUbTMLO*PIspB+V|*)|^bn|SP- zIuGR}jV>gwXCY{&^lf5Sep@p_f@=d?t}km?Wf%#_Vq(**m4{iyM_p@t_AxR9Fu6y} zMAiXB!G_BDs<1{>yXC?L4jIUYOi35o8+jOght|BgX6&s=%W&wYB3g!_;xyqP{e|r<0>vh>K<>9&%f8rE zFRn5<90*a+Hkn>oK8>vszKr4q;i1|KYf9JX;0e=9hA0P5n2szW&nX;7WD88w-LIR$q&(6GW<)5ce+&n(WAuvdq}YVhzj zo3?(DdB&+;dq3q~idDT^ujpj+R!Z(~Elb?GMU4!?oZ#VFU7v?jf|ii8QYoJVy;;rH3D!98knBwwUlwailNg&v zXko#j7^A;t?pz&5gw0*_9(H#WRjVJ-b(?ciqm9MI;9WggVbz2l!BL6_Jdp}Zw!V2c z^iC#8v%>iKH`ZE6HFY9}Ew6D~_RY4D%{R{1bzEwa9TLOYW&;dO;y?#xGwHj4=NEJ<#XGYy2 zQpYFMXsvTwC{3@b2NyzR(cf0#iD7s*Pkj<)gmeSb<=e5Yg~K6g*s+VXVuy)OAw7Q@I(q{l-wIO0Vw)8Hj}Jbk~Mo-T*>PO(Ym%N_J% zA3~3?!a0V@lg>_gySNb+MIk-bp8?e-9q$IFDb+VPiWaDr995=u3yj)R%5hs*&Ko*f9M(IR z0b9!G?AhS#%xb!}f{M&e&)jZaCJO7{j`1gp*&NoeCvh$f9=Y%Y4b`ewT^@-ktjBAD zZ&7=E)L2^?92JG2wuW5IPe=n42b1bU%z9fI&Symnz~r<;`^!-R$gVTV(p$q=*R zhJM&rYKI~9s!FRmeO+M^-=D)%NZiTA+N6F?Ifpq`aiBksN0hQToT;cs{mkRiw0hLv zkQP%n2p!_AXAWWMVUpTU>nTVRq?4(>7PaA-k)EhLV_VhVG+|AJnL?dXh;DcmRIjE7-V!H z$l@u$Jf0?@wD^-UNqOrfQ7;!Mg06jzR=owHWB1xv?A{8qE|<*Rm9u@GU6HXmqNYwaGV6b||^R>$qjS-@b^$gjdS5 zVk#Ia=@B5#XOidHz|fR#0*gL)_@75qVHr|05s~EmLr}XKHFcGl?8iV8a(P;Es!16t z5Og^`V@n$mT8&QST`tx!=r(HPmw`Tpt0j0{z>r@8!aWbURzJcy9Tza<*MNY(LhyuN zZ}1HH1t1?!_$>y{@IigQl_9^716m$Xu70HbKCW1BlmXGL_+t9ei$1~MD}o#YA;?(* zAp}>s#h1Wd$K$(0Kja{AI0uQ11v$AT!6kFB`jAvH^<5bS#R48duYTl}t&=uHn-y9w zwn0<_Y^2cZi)6DA-v6-FZ9(>}tw-P5D%{$FZ^r*7ctu@NpDmr^dwKb^1gnw+UvkXb zdvntgB&}!-(IN9$Pm|#q^=ietmE6O*{zGcuIn33QGt5<_zGPdul;vCs?@4gUrt-ta ziyy1ntKC?@kROeLjMid^e-$p2k->nvEifQuGlg5zXiN}M!WOA137?5Vz1ochQ^JAy zI=3saA-+~d!9F9Yj!CM^Dxp=UqzXx5y=&vx#yNy&ZCN~RG|0+D+1^8h9;Gr;J_k^h>Rml8n3-;-aiLNSa(HX`LTzz%5dex~}t59{f^xkvi-Qtz-?o zvG1&HT{%V}XZ;Uq4Pl`?!?KmrKx1ve)LUDR`F&p)7C{>pEhPK1F&kU=joWObI@i-q zGsCnwT!w>aq$l!y<^!mR;Fqr&uVp*Udu3>J%kR_8;bNu?m-PKshGl)fjUm5F2b!cX zX1epZkSBxlK*xex8IaN&L^{HwBs`_C#~F|?Ty+)0v?WMgBypP}w!WF@08uT$fr|{U zz!eX!=)1@pEkTHuENIsZzpU=>KgIA{xKN`EzHg!#k|iq|fiCU+r=+yZnVC>9hCii9 z3k-f5S3Ic2tiK}dUPLlyhQo^BH9vciHzNwD#xC-P$*%}%LE`=sZS5C@*_8pnTClBa zTZmI& zu^SMa*SC_(eaPXTkWv1H!gJC42TXlCK5cX2yzUB!1*I4d#@s} zj)76@rV-^*D*5?RNu1}3!p@aq{01&EVE7q*Z;M6zhjD=cgFjHW1qP%H^J2^&;UX`F zU)1-O7x7Qvf{GXr9aa%Pe)*S*Aj{wzhQQ5JzlE4@<6;gB`2|eBxWs=K7o=rCbXdeI z5VHvv2sR_wqHkY_fV7^L2)-B>b7J^XeZQ6Aqxzno?NUF|?!<-U4Bn+~rx=hjEP$gu zN?IXsLtICYbIgwU%$&vC1rEP}3;j8RdvR@s|LPmt)m~A5Z@kF3w`dXu4>TZQ9QnV% zBs~+H4YrZTjn?5E1NsCml#qcgp><$oM4eGs>q0I7d`Lyvrg;m%r7#sGdb^6Uqplu+ z`&Cqy0TX#G{*?f;xHblxg4Wf*dF0cGyiL*C{G@hRgYxrjMdG}XcGwynf#n&lOV3=w zhz2P=+6LHga*sBQXpqvQ73{MvFpcqpxX6GZzv1d@jQB6(LY@r%5|@^bcVE#6222+g zoZP;It0m~Z$dC!xA4@{UOG>XqWb{2n`nrH2KNRZ=MEnfmkc2^5-4+;}(XkBf)Ugbh zJ}g)gF+GalD1&|KHpk$gy3I2fP`5`J46EB5gN(Yhh8qBE!?hu(279i*$lDj=x-zJo zfAX)Nel4P;ey&FJOK~+Ag?nWW%lXU^k{df_ckkvee!RzBNH+$r36AWVbW#h#liItb zW*<{!$};#cE?ofLeMBP|eAFU%_uCr5;A0lSyN_!GgHKq5NWi>^VF`r7D*@5(ROsZz zM-YAx7fUnF(oh^`;7_mo1Rns7G$@)+>SVI@eIKaaj*F}ZeMS8;BALI(!c&wK;?j-u znK~U$1!3E9Sw1UE@Kv=jsAxSpp3b5g#d#(7`3Ncbg_I`Yt;1T2YYVF9f9vVnZEF^iW~PMrEkYyVb3xmL z*H$n72Dz8eQ(4$J`EBe^;i6y+zoPH$Vh{0;<3i0cAUa&-B>10-Ajd!m+#pFrXjXK= zUxw}2i3CNc&!K4{n<6Ofca-p11_3^-99EALu8BKflFhh~1p|IcI>G@lS1W>}3`o!t zRQUCsBRLT~~j`(YFAuk5!)$J4m zQihwaqdn?qkNLE&_j@T)zYJGP(07sHK3v}9NwSaFhZRfko(dxCtZpLiXl;}7mU>tO zCzhkN{?n6+wDqp^65XvQqHxC=Sdg$5Ah8}Hb^A7@kt~CUaA{TZ?%f)};5`;0Ox}(d z5`o#nhQQ-1R9;lL3ZFSbSo#AHkBgwasHQmzt|d7nd$D@Ahc~19A&%!tpyw zevd2G1qNSKw^;^T6o=!?MKiO7a>;W{ew`wmVvxWU57uHAdBc>}1Me{8 ztPi2^>fzJK;L0mlmM0K76Xx%I;R;zh#r#o>7uJDFem-7}M|4x01VrzL2=L!#}}$qmO2mXq`(u zsJPXCT`j^!LT^q%f_wwNVYLw^povZ3qQDH#>U--%iJ!#Tmuf`ei35nPlYdy#h^ z*9Znorx8+U#ypOToEhG*Pu*M2#D5tVI5YT~x-BsHzK&(^LL@>@&w%N}IY>?s6S6r7 z-gAy&22Bx?@)>aU{6RdZzRtP>FMbmhw=-S|67ErmD|OtJ-*-`xxhLICD0>Gk%EK_J z@2_U~sJ>51GQuC!aRI{*>3bD^ZolGTX%7JIQ*p_Q43FS~z!?N5^{sIIFt~gK7ldN) z6?I!+@D#2VtYFEHc|49w)jPuP=zCi$#D57FI5GITx-BsHhK^;xMB%z(%=d7SEyLDV zs(Z^e0k~bq1q|JtewLrGH((u%_>=9S}Za@C@&X;2#A1%LdQz$q4@4fFH&M z^JMTCu6VE-yU3f5;%W;jt!+Eq=->m0`vflTKS+&9Ts*k)X&b4KPvfU<@O1KfaAA~^ z$i{+%qGA}+^EcCqJsy4ayExv_Io;{Fw%5opJjd^k3Tk_>S_pW(y)0*4V+?(cZ zGq-Dbac@lMn}wv|mKCpi)vBMaXWnz0qglGkjhAw8Nt7##l1}0Uj)tV=I-uT*NKv%ANWLEF_E$FGd_Cmq4d8WFs(b!+UJ z*pJ0u68rJkOJmplD8Y}kB)0PpH;tck#Q6g+!$trd27&7J-1w&K8>(e(cyyJ z!J_eo7LF1d!pnXs>z|nr zf%?t8Cl(qhCPKKBCcBlQR){DHp;DmMQeg*DcmoPEeHP>53ce-@b?-R zF!8`M1O;yn)mdxs)YI3JgDEeyk^s2PgLeYH)xa&llYYU&cLIJGu-1%DPZ-hoX;}2f znqzt(6T}iu;4jRJ0e%{v^xyo3v@8*QM{97;&(KH%#@;*mIIr^4--CIRzzN)NzU9N5Z}~9i zT|UhDmk)Cu=EIzi3C#L>#Df!nIS=#kU-w|*IY0C9=Q%%8KW$H(uL(^4k7_rAyG_9x zHA4NB`r&*`N9+3BW!=oC;Jya*YCfjoHU0O!^a;jeexlH@NanvK0xx;|e^nEzzakIk zNq+hZ9-IJz^CcfYXx-kX;5{0l{t7?NmqPTI?+Bd04d+h+Q{Gh%CZ6*uAOEli6VG{+ zkN>m>6VLgTkKbzNQd&R%)06+#G@<${@^k*>r(d;hd{gj|2K1bt3H|TlW;fsq2*n>i z;^7mB=R6JpezD-Q`1@;scf}n2qnO(%H1G-BaK0z-7jg5)fOjDj{@?QO3B+?=hyXvG zp7TS2sqdF~Z~`#rje`FMZgv1(MJW6)c=!b3Iln}JUo6-Px$g(O07&S+<>3>E=R6bv zep>%0JpZ@{=?V8MY-?}?@I!zRfLi-k!T|AW4SouUcSP`n7242q5mn$bpeM`-;rBkT zJ}&?-KdFB=XV&t*#LjWGJ~@BZX*B*+1paL=|6c%q!gLAD|J{H;4w%`BJcKnrQ(oI) zZVDbFq4|k?Ztflnehc_TIw{?Dyv_7&whsel5XfJ&-bNo_hMa2>zxJJ_vdVd*hKb;LmvFEfCMbs^3#j z7bEFc0Q=*Q^MEZm3d{vq6vmh)QS)ZUpSp-wgQPUR^(1Apc+le-tpp zSLt7f^rs{E*8u(t^zWO&pZVPf7(Q9iGrxBL{$u!mJ_14fqmlFXHR$gj zGU>kr_+O(xd)UB#PZ;HAc~$vQ8GiY;0X~WG4VxVE9|n9U?)hVRj{^Q_Pu^DpzR!bi z1H1$2`SdK)-woK;*S&z>1bMDA_(uTKUJ;;vHUy91<`*%3y~p4`0r+8$|7QXJ4fK~V z_`d<{%OA&-Najz}=koyj_@4lLKhp0q>GwtO!+`fde!<@c_=K1L8Nh!Bd&!ve_W=I1 zX%Aaq*$)7IpGSWY@GH^151%Q7J^+A~Ru?_IMJo;AvJ_rBR zWB3gN{zb_DN&~+daLuE?4e)snz5_6LCqSMje*6$;L{qp}h;6ac6cK~NR z_&)=_)@!f-HIn`>BJei>KjNk5LeDtLa}(rY{ay?BF%N$u;8PyF7jO*zP3r3~U|-%T zzz=!!rvbko{BJP)D}YBl{9SI*ih^bvG)s^j(6Ry%R{T&1?QTEroF zsh(uAVn#zx=?Z{^};a?yAm%lk>)^=kSf!Wt#-&pW*1?jy=ge$za&rrGm4| zGpVBaZlb!c&aC06G~AjG_VUi*@h#KZg2D6DL%G$5EF(ubr}#9Eqy^F(%V*Ddb!W(` z6Yv=CA2jQcH#uY0F=#??Hhgev$IVG}p(gUIK5LS3-8Rl0qssUme9p-~LsFjySbwTt z$DTbmr|OOeWNb26#xZ{=yE_jMK%*1ocs?CaIJuc0zfj+lh#cIE6PwR2&Ymsu%ezH< z)^QotjZc{>Qo$+H0Jb_;oSVKK$Qn+RuLRWs_f|Z9%9H|758Rw|e9xgvf%qgV{HlTsYR$Ld!q zRquF1G3N%y>FqBbD}iN&C+H=MLdf%eGb_`x{Wut#m^~Kb&P+7v%wdL-QjVa+$&UjK zKHm&pID5||C9NE9YL3|l9v`q1W`KHp0LM8BO7c+_;xod@kCHLZg+%kkwr>fsYpW~? zj!N`deNPDbZR&TFOe%sFTpn`yd^z+#`sPj*QGC(i%W~AXFTII8f1$g=bJ4d?K^z-Ht;xK z)6dx)synrcHeOOEQIp2<(C1J}0-~&eP3F@hSt=@|8(U?d#p#ZcQjQ-*EDnN{SkiDUYROcIC$_dZPlrvS; zr&Fj0+qO*`HF=hDlS+$Xv6(u1r3!3fu@f9jYmP%DI@~U;#!X96$LdQ$)3oW*p&0)| zpg336DpRPv_UnJ2faS5Y1VV~%R;|u01rMItDoQpTo@z>3$F^13T4DC$i_BTQy0r3X zBV&c8)mk&`mP{yF*3E#qEqeZLo?cNGyb8sHqw{D1OGKg5WZqABx$d)WU z@^sZIW0uCB0r0zM_KZk+voEc!WtPLWH$r~-LppRmNSPFzh;dz_1sQXwN(QSgSAkyh gUqUac3h4w={KOd5xy439UNYU6E8WUL*7TJB7mJ2E2><{9 literal 0 HcmV?d00001 diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Debug/demoprog_xmc1400.srec b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Debug/demoprog_xmc1400.srec new file mode 100644 index 00000000..98747c07 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Debug/demoprog_xmc1400.srec @@ -0,0 +1,220 @@ +S018000064656D6F70726F675F786D63313430302E7372656343 +S31510003000500500201D30001000000000A5300010F3 +S315100030100018040000010000EE11AA55124885465A +S315100030201249134A134B00F018F8134880471349F6 +S31510003030134A144B00F011F81349144A144B00F0BC +S315100030400CF81449144A0020521A02DD043A88502A +S31510003050FCDC12488047124880479B1A03DD043B6C +S31510003060C858D050FBDC704750050020483C001073 +S315100030700C00002050010020813100108C3D001002 +S3151000308050050020500500208C3D001050050020F2 +S315100030905005002050050020CC050020FD3B0010F7 +S315100030A0753B0010FEE70000024A936E01218B4328 +S315100030B0936670470000014000487047002D3101AB +S315100030C038B51D4B1B681B041B0E1C4A136026D0FB +S315100030D019480268FF211140194C2160C269032565 +S315100030E02A40120211432160C269920508D49B023C +S315100030F0C918144800F07AFA0001134B18601AE048 +S31510003100FFF7DAFF80010D4B196889020C4B1B681B +S31510003110C91800F06BFA00010B4B18600BE0064B58 +S31510003120DB699B0503D4094A074B1A6003E0FFF7D6 +S31510003130C3FF054B186038BD000301405005002041 +S315100031405405002000001BB7FC3F0020006CDC0279 +S3151000315008B50749C0234B62064BD869064A024098 +S31510003160DA61064A1A60C3234B62FFF7A9FF08BD4E +S315100031700000014000030140FFFDFFFF0001F13F89 +S3151000318008B5FFF791FFFFF7E3FF08BDF0B54F460F +S315100031904646C0B48B08994604339B001E58032537 +S315100031A00D40ED00FC27AF40BE431E50436F4F004D +S315100031B00326BE40B3434367CB0810339B001C580D +S315100031C007260E40B6000427B740BC431C501F58B4 +S315100031D0BC465778B7403E1C67463E431E500C4BC4 +S315100031E0984204D1036E01268E40B343036653689A +S315100031F08B4043604B4604339B0019581278AA4003 +S31510003200151C0D431D500CBC90469946F0BDC0468A +S3151000321000020440C322014B5A627047000001406D +S31510003220C022034B5A62024B5B6A5B07FBD47047A2 +S315100032300000014010B5041CFFF7F2FF054B1A6998 +S3151000324014431C61034B1B685B00FBD4FFF7E2FFC2 +S3151000325010BDC04600030140014B18687047C046B8 +S31510003260FC3F0020F0B55F465646C0B485B0834695 +S315100032700F1C454B9A4600230293039301253AE00F +S315100032803B689800C0184000291C00F0AFF9019067 +S315100032907C68211C00F0AAF9061C0A2100F0B0F97E +S315100032A0052905D9301C0A2100F0A0F9461C04E0B6 +S315100032B0301C0A2100F09AF9061C002E06D0B10027 +S315100032C089194900019800F091F904E001980A2142 +S315100032D000F08CF90126A04201D3041B00E0241A49 +S315100032E0142E07D8A24505D9284B9C4206D9A246CA +S315100032F0029603950135402DC2D901E00296039539 +S31510003300214E0124402512E0681C1F4B5843029998 +S3151000331000F06CF93B89834201D8C21A00E01A1AF0 +S31510003320964201D9161C2C1C984202D3013D022D3F +S31510003330EAD8029B191B5B461B684022134358466A +S3151000334003608B1E1903E023DB011940081C7B89DF +S31510003350013B9B01FF210B401843071C013C240233 +S31510003360F0231B011C402743039B013BC0390B4034 +S315100033701F435B461F611B6893435A46136005B093 +S315100033800CBC92469B46F0BD10270000E7030000D8 +S3151000339010B5E2235B00C4583D33FF331C42F8D10D +S315100033A00131120402231A4309061143C333FF33B2 +S315100033B0C15010BD10B5041C80208003FFF73AFFE2 +S315100033C0236801229343236023689B07FCD410BD16 +S315100033D010B5E422520083580F24A3431943815099 +S315100033E010BDC046E4235B00C058BA3BFF3B1840F3 +S315100033F07047C04608B5FFF7F5FF012802D002282E +S3151000340003D005E0FFF728FF03E0FFF755FE00E0C5 +S31510003410002008BDF0B5474680B4051C0C1C161CD0 +S31510003420FFF7C8FF281C211CFFF7D2FF281CFFF747 +S31510003430E1FF041C311C00F0D9F88027FF003F1A69 +S31510003440194B9F4200D91F1C8021C900C91B201C83 +S3151000345000F0CCF88046B009A4098002211C00F0C7 +S31510003460C5F8114B984200D9181C4443A40AA4016C +S315100034704346F21A341B002394425B41DBB2002B05 +S3151000348000D0381C002B01D0012300E00223E9688C +S31510003490064A0A40EA60EA689B0318431043E8604C +S315100034A004BC9046F0BDC046FF030000003CFFFF81 +S315100034B010B5037E012B18D103682022DA61046847 +S315100034C021680B4B1940037B1B06F0221205134093 +S315100034D00B432360036802691A61036842695A61E3 +S315100034E00368044ADA61002000E0032010BDC046DC +S315100034F0FFFFFFF04000280010B50268204BD318DC +S31510003500990A49039B05DB0E1B020B4394681D4960 +S3151000351021409160026891680B439360037E012BF2 +S315100035202CD803682022DA61C3799B060ED4416831 +S315100035304B0F5A078B0413430268936181684B0F34 +S315100035405A078B0413430268D36005E00368426888 +S315100035509A6103688268DA60041C037E012B06D127 +S31510003560FFF7A6FF236880221205DA6103E00368DD +S3151000357080221201DA612368034ADA6110BDC0465F +S3151000358000F0FBAFFF00FFFF4000A0060268D16904 +S31510003590D3695B07DB0F09050FD4012B0FD0136915 +S315100035A0036153694361D169D3691B07DB0F49076F +S315100035B007D5002BF3D1002004E0032002E00220FF +S315100035C000E000207047C04630B58B0804339B00DE +S315100035D01C5803252940C900F9358D40AC431C50B1 +S315100035E01C588A40111C2143195030BD034B04222C +S315100035F05A6318625962986A7047C04600000340C1 +S31510003600034B04225A6318625962D96A986A704742 +S315100036100000034070B5051C0E1C00F0DBF8F479B1 +S31510003620002C00D11034281C3168221C00F03CF804 +S31510003630B379013B5B006408013424021C43114B2F +S315100036401C43EC633379013B1B0681225200134362 +S315100036506B637379002B05D06A6B013B1B04134314 +S315100036606B6305E0696B3279531E1B040B436B6366 +S31510003670A023DB00AB6301235B42EB6433892B642D +S3151000368070BDC0460100030086235B00C258E023CC +S31510003690DB041A4202D1406D80B203E08E235B0038 +S315100036A0C05880B27047C046F0B55F464E46C0B4AB +S315100036B083B063293DD9002A3DD0151C0C1C8346C6 +S315100036C0FFF7CAFD6421FFF791FF8146201C642194 +S315100036D0FFF78CFF071C1B4E012301930093341C2C +S315100036E011E048466043291C7943FFF77FFF830AA0 +S315100036F08005800D134A934204D8B04202D2061CAC +S3151000370001930094013C002CEBD180231B02009FF7 +S315100037101F435B461F615A690B4B1340013DAD02B7 +S315100037201D43019E013E360435435B465D61002014 +S3151000373002E0012000E0012003B00CBC91469B463C +S31510003740F0BDC046FF030000EF8000FC70B5842575 +S315100037506D004659064C344044514659054C264096 +S315100037601B02194314060A1C22433243425170BDF0 +S31510003770FFFFFFF8C0C0FFF870B586256D004659EB +S31510003780084C344044514659074C26401B021943F5 +S3151000379014060A1C22433243802149050A4342512A +S315100037A070BDC046FFFFFFF8C0C0FFEF08B5074B5E +S315100037B0984203D10820FFF73DFD06E0044B9842DE +S315100037C003D18020C002FFF735FD08BD0800004870 +S315100037D00840004810B5041C9023DB05984202D01F +S315100037E00C4B984203D10C48FFF7E0FF08E00B4B57 +S315100037F0984202D00A4B984202D10A48FFF7D6FFE8 +S315100038000323E360E368DB07FCD5236C0F229343A5 +S31510003810236410BD0002004808000048004000481C +S3151000382000420048084000487047C04630B589B08D +S3151000383001A9E1231B02019308230B714B71073B6E +S315100038408B710F33CB7100230B81174C201CFFF7A4 +S31510003850E1FE06AA00231370144D281C0321FFF75E +S3151000386095FC04AA9C231370281C0221FFF78EFCDA +S31510003870E36950229343E361E369493A9343E36171 +S31510003880201C1021033A0123FFF760FF201C0021A2 +S3151000389004220123FFF770FF236C0F2293430D3A86 +S315100038A01343236409B030BD0002004800010440F0 +S315100038B070B588B0FFF7D0FC041C00E064003C4BE8 +S315100038C09C42FBD900E064083A4B9C42FBD83A482C +S315100038D00121221CFFF79EFD01A90194374B4B6075 +S315100038E0FA235B010B8101254D81354C201CFFF716 +S315100038F0B9FC226840231343236023681D432560C7 +S31510003900304A314B1360D3793F210B40BF390B43FB +S31510003910D37153685B0F5B072C4803435360916860 +S31510003920490F4907014391601B0E20208343D37131 +S31510003930090E20231943D17208231373002305E0BF +S31510003940204AD218002111740133DBB2072BF7D9A4 +S315100039501C4800260676FFF7CFFD174801210122E5 +S31510003960FFF716FD164C23684025AB4323602368EA +S3151000397001229343236006AA1670154E301C0821A7 +S31510003980FFF704FC04AAA4231370301C0921FFF7C7 +S31510003990FDFB23682B432360E36807229343053A14 +S315100039A01343E3602368AB43236008B070BDC04681 +S315100039B0FF1AB700000E27070000045020A10700C9 +S315100039C000030450A00500202010045067060000D4 +S315100039D00004044010B58A235B00064AD3581B071F +S315100039E006D4041C101CFFF74FFE2070012000E0C7 +S315100039F0002010BD0002004808B5FFF717FFFFF7BB +S31510003A0057FF08BDBFF34F8F034A044BDA60BFF36D +S31510003A104F8FC046FDE7C0460400FA0500ED00E0F2 +S31510003A2008B5184B1B78002B0BD11748FFF7D2FFA0 +S31510003A30012825D10122134B1A700022134B1A703C +S31510003A401EE0124B187801300F4B1818FFF7C2FF03 +S31510003A50012815D10D4A13780133DBB213700A4AC7 +S31510003A60127893420CD10022064B1A70064B5B78E3 +S31510003A70FF2B05D1044B9B78002B01D1FFF7C2FF1A +S31510003A8008BDC0469D050020580500209C05002055 +S31510003A9000B583B0174B1B68DB69DB071AD51548D1 +S31510003AA0FFF774FD00280AD000220EE0114AD21842 +S31510003AB0127C6946CA540133DBB2012201E00022AE +S31510003AC000230C49097B9942F0D80A4B1B68012147 +S31510003AD0D96100E00022012A09D16B461B78FF2B21 +S31510003AE005D16B465B78002B01D1FFF78BFF03B036 +S31510003AF000BDC046A005002008B5FFF791FFFFF7EF +S31510003B00C7FF08BD10B5044C201C00218022FFF70A +S31510003B105BFD0123636010BD0004044008B500F08E +S31510003B205FF80E4B1B68C31AF422FF32934214D966 +S31510003B300B4B1B78002B08D1F33AFF3A084B1A703F +S31510003B4080225202074B5A6005E00022044B1A707D +S31510003B500132044B5A60014B186008BDC0050020A5 +S31510003B60C40500200004044008B5FFF7CBFF00F0A1 +S31510003B7011F808BD08B5FFF7F7FFFFF73DFFFFF790 +S31510003B80CDFFFFF7B9FFFAE7014B18607047C04643 +S31510003B90C805002008B50E4B1868FA218900FFF7F2 +S31510003BA025FD01380B4B98420DD80B4A50600B4936 +S31510003BB00B6A1B021B0AC020000603430B6200237C +S31510003BC09360073313600020FFF7DEFF08BDC04681 +S31510003BD0FC3F0020FFFFFF0010E000E000ED00E0DA +S31510003BE0014B18687047C046C8050020024A136882 +S31510003BF0013313607047C046C80500200E4B70B5E0 +S31510003C0000251E1C0D4CE41AA410A54204D0AB00CE +S31510003C10F35898470135F8E7FFF706FE084B0025DD +S31510003C201E1C084CE41AA410A54204D0AB00F3588D +S31510003C3098470135F8E770BD500500205005002063 +S30D10003C4050050020500500207C +S31510003C482C4800470000000000000000000000009B +S31510003C580000000000000000000000000000000046 +S31510003C6825480047000000000000000023480047D0 +S31510003C78234800472348004723480047234800475E +S31510003C88234800472348004723480047234800474E +S31510003C98234800472348004723480047234800473E +S31510003CA8234800472348004723480047234800472E +S31510003CB8234800472348004723480047234800471E +S31510003CC8234800472348004723480047234800470E +S31510003CD823480047234800472348004723480047FE +S31510003CE823480047234800472348004723480047EE +S31510003CF823480047A5300010A5300010A530001045 +S31510003D08ED3B0010A5300010A5300010A5300010AE +S31510003D18A5300010A5300010A5300010A5300010F1 +S31510003D28A5300010A5300010A5300010A5300010E1 +S31510003D38A5300010A5300010A5300010A5300010D1 +S31510003D48A5300010A5300010A5300010A5300010C1 +S31510003D58A5300010A5300010A5300010A5300010B1 +S31510003D68A5300010A5300010A5300010A5300010A1 +S31510003D78A5300010A5300010A5300010A530001091 +S30910003D88A53000103C +S7051000301D9D diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Include/cmsis_compiler.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Include/cmsis_compiler.h new file mode 100644 index 00000000..1003929e --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Include/cmsis_compiler.h @@ -0,0 +1,223 @@ +/**************************************************************************//** + * @file cmsis_compiler.h + * @brief CMSIS compiler generic header file + * @version V5.0.1 + * @date 30. January 2017 + ******************************************************************************/ +/* + * Copyright (c) 2009-2017 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. + */ + +#ifndef __CMSIS_COMPILER_H +#define __CMSIS_COMPILER_H + +#include + +/* + * ARM Compiler 4/5 + */ +#if defined ( __CC_ARM ) + #include "cmsis_armcc.h" + + +/* + * ARM Compiler 6 (armclang) + */ +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #include "cmsis_armclang.h" + + +/* + * GNU Compiler + */ +#elif defined ( __GNUC__ ) + #include "cmsis_gcc.h" + + +/* + * IAR Compiler + */ +#elif defined ( __ICCARM__ ) + + #ifndef __ASM + #define __ASM __asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + + #include + + #ifndef __NO_RETURN + #define __NO_RETURN __noreturn + #endif + #ifndef __USED + #define __USED __root + #endif + #ifndef __WEAK + #define __WEAK __weak + #endif + #ifndef __UNALIGNED_UINT32 + __packed struct T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __ALIGNED + #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored. + #define __ALIGNED(x) + #endif + #ifndef __PACKED + #define __PACKED __packed + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT __packed struct + #endif + + +/* + * TI ARM Compiler + */ +#elif defined ( __TI_ARM__ ) + #include + + #ifndef __ASM + #define __ASM __asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __NO_RETURN + #define __NO_RETURN __attribute__((noreturn)) + #endif + #ifndef __USED + #define __USED __attribute__((used)) + #endif + #ifndef __WEAK + #define __WEAK __attribute__((weak)) + #endif + #ifndef __UNALIGNED_UINT32 + struct __attribute__((packed)) T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) + #endif + #ifndef __PACKED + #define __PACKED __attribute__((packed)) + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __attribute__((packed)) + #endif + + +/* + * TASKING Compiler + */ +#elif defined ( __TASKING__ ) + /* + * The CMSIS functions have been implemented as intrinsics in the compiler. + * Please use "carm -?i" to get an up to date list of all intrinsics, + * Including the CMSIS ones. + */ + + #ifndef __ASM + #define __ASM __asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __NO_RETURN + #define __NO_RETURN __attribute__((noreturn)) + #endif + #ifndef __USED + #define __USED __attribute__((used)) + #endif + #ifndef __WEAK + #define __WEAK __attribute__((weak)) + #endif + #ifndef __UNALIGNED_UINT32 + struct __packed__ T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __ALIGNED + #define __ALIGNED(x) __align(x) + #endif + #ifndef __PACKED + #define __PACKED __packed__ + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __packed__ + #endif + + +/* + * COSMIC Compiler + */ +#elif defined ( __CSMC__ ) + #include + + #ifndef __ASM + #define __ASM _asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __NO_RETURN + // NO RETURN is automatically detected hence no warning here + #define __NO_RETURN + #endif + #ifndef __USED + #warning No compiler specific solution for __USED. __USED is ignored. + #define __USED + #endif + #ifndef __WEAK + #define __WEAK __weak + #endif + #ifndef __UNALIGNED_UINT32 + @packed struct T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __ALIGNED + #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored. + #define __ALIGNED(x) + #endif + #ifndef __PACKED + #define __PACKED @packed + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT @packed struct + #endif + + +#else + #error Unknown compiler. +#endif + + +#endif /* __CMSIS_COMPILER_H */ + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Include/cmsis_gcc.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Include/cmsis_gcc.h new file mode 100644 index 00000000..a4ad21a0 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Include/cmsis_gcc.h @@ -0,0 +1,1899 @@ +/**************************************************************************//** + * @file cmsis_gcc.h + * @brief CMSIS compiler GCC header file + * @version V5.0.1 + * @date 02. February 2017 + ******************************************************************************/ +/* + * Copyright (c) 2009-2017 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. + */ + +#ifndef __CMSIS_GCC_H +#define __CMSIS_GCC_H + +/* ignore some GCC warnings */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wunused-parameter" + +/* CMSIS compiler specific defines */ +#ifndef __ASM + #define __ASM __asm +#endif +#ifndef __INLINE + #define __INLINE inline +#endif +#ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline +#endif +#ifndef __NO_RETURN + #define __NO_RETURN __attribute__((noreturn)) +#endif +#ifndef __USED + #define __USED __attribute__((used)) +#endif +#ifndef __WEAK + #define __WEAK __attribute__((weak)) +#endif +#ifndef __UNALIGNED_UINT32 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpacked" +#pragma GCC diagnostic ignored "-Wattributes" + struct __attribute__((packed)) T_UINT32 { uint32_t v; }; +#pragma GCC diagnostic pop + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) +#endif +#ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) +#endif +#ifndef __PACKED + #define __PACKED __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) +#endif + + +/* ########################### Core Function Access ########################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions + @{ + */ + +/** + \brief Enable IRQ Interrupts + \details Enables IRQ interrupts by clearing the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__((always_inline)) __STATIC_INLINE void __enable_irq(void) +{ + __ASM volatile ("cpsie i" : : : "memory"); +} + + +/** + \brief Disable IRQ Interrupts + \details Disables IRQ interrupts by setting the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__((always_inline)) __STATIC_INLINE void __disable_irq(void) +{ + __ASM volatile ("cpsid i" : : : "memory"); +} + + +/** + \brief Get Control Register + \details Returns the content of the Control Register. + \return Control Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_CONTROL(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Control Register (non-secure) + \details Returns the content of the non-secure Control Register when in secure mode. + \return non-secure Control Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_CONTROL_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Control Register + \details Writes the given value to the Control Register. + \param [in] control Control Register value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_CONTROL(uint32_t control) +{ + __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Control Register (non-secure) + \details Writes the given value to the non-secure Control Register when in secure state. + \param [in] control Control Register value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_CONTROL_NS(uint32_t control) +{ + __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory"); +} +#endif + + +/** + \brief Get IPSR Register + \details Returns the content of the IPSR Register. + \return IPSR Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_IPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get APSR Register + \details Returns the content of the APSR Register. + \return APSR Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_APSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, apsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get xPSR Register + \details Returns the content of the xPSR Register. + \return xPSR Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_xPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get Process Stack Pointer + \details Returns the current value of the Process Stack Pointer (PSP). + \return PSP Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSP(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, psp" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Process Stack Pointer (non-secure) + \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state. + \return PSP Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PSP_NS(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, psp_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Process Stack Pointer + \details Assigns the given value to the Process Stack Pointer (PSP). + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : ); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Process Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state. + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : ); +} +#endif + + +/** + \brief Get Main Stack Pointer + \details Returns the current value of the Main Stack Pointer (MSP). + \return MSP Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSP(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, msp" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Main Stack Pointer (non-secure) + \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state. + \return MSP Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_MSP_NS(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, msp_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Main Stack Pointer + \details Assigns the given value to the Main Stack Pointer (MSP). + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : ); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Main Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state. + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : ); +} +#endif + + +/** + \brief Get Priority Mask + \details Returns the current state of the priority mask bit from the Priority Mask Register. + \return Priority Mask value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PRIMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Priority Mask (non-secure) + \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state. + \return Priority Mask value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PRIMASK_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Priority Mask + \details Assigns the given value to the Priority Mask Register. + \param [in] priMask Priority Mask + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask) +{ + __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Priority Mask (non-secure) + \details Assigns the given value to the non-secure Priority Mask Register when in secure state. + \param [in] priMask Priority Mask + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PRIMASK_NS(uint32_t priMask) +{ + __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory"); +} +#endif + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Enable FIQ + \details Enables FIQ interrupts by clearing the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__((always_inline)) __STATIC_INLINE void __enable_fault_irq(void) +{ + __ASM volatile ("cpsie f" : : : "memory"); +} + + +/** + \brief Disable FIQ + \details Disables FIQ interrupts by setting the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__((always_inline)) __STATIC_INLINE void __disable_fault_irq(void) +{ + __ASM volatile ("cpsid f" : : : "memory"); +} + + +/** + \brief Get Base Priority + \details Returns the current value of the Base Priority register. + \return Base Priority register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_BASEPRI(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Base Priority (non-secure) + \details Returns the current value of the non-secure Base Priority register when in secure state. + \return Base Priority register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_BASEPRI_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Base Priority + \details Assigns the given value to the Base Priority register. + \param [in] basePri Base Priority value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_BASEPRI(uint32_t basePri) +{ + __ASM volatile ("MSR basepri, %0" : : "r" (basePri) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Base Priority (non-secure) + \details Assigns the given value to the non-secure Base Priority register when in secure state. + \param [in] basePri Base Priority value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_BASEPRI_NS(uint32_t basePri) +{ + __ASM volatile ("MSR basepri_ns, %0" : : "r" (basePri) : "memory"); +} +#endif + + +/** + \brief Set Base Priority with condition + \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled, + or the new value increases the BASEPRI priority level. + \param [in] basePri Base Priority value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri) +{ + __ASM volatile ("MSR basepri_max, %0" : : "r" (basePri) : "memory"); +} + + +/** + \brief Get Fault Mask + \details Returns the current value of the Fault Mask register. + \return Fault Mask register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_FAULTMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Fault Mask (non-secure) + \details Returns the current value of the non-secure Fault Mask register when in secure state. + \return Fault Mask register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_FAULTMASK_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Fault Mask + \details Assigns the given value to the Fault Mask register. + \param [in] faultMask Fault Mask value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Fault Mask (non-secure) + \details Assigns the given value to the non-secure Fault Mask register when in secure state. + \param [in] faultMask Fault Mask value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory"); +} +#endif + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) + +/** + \brief Get Process Stack Pointer Limit + \details Returns the current value of the Process Stack Pointer Limit (PSPLIM). + \return PSPLIM Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_PSPLIM(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, psplim" : "=r" (result) ); + return(result); +} + + +#if ((defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) && \ + (defined (__ARM_ARCH_8M_MAIN__) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Get Process Stack Pointer Limit (non-secure) + \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. + \return PSPLIM Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_PSPLIM_NS(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Process Stack Pointer Limit + \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM). + \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit) +{ + __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit)); +} + + +#if ((defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) && \ + (defined (__ARM_ARCH_8M_MAIN__) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Set Process Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. + \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit) +{ + __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit)); +} +#endif + + +/** + \brief Get Main Stack Pointer Limit + \details Returns the current value of the Main Stack Pointer Limit (MSPLIM). + \return MSPLIM Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_MSPLIM(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, msplim" : "=r" (result) ); + + return(result); +} + + +#if ((defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) && \ + (defined (__ARM_ARCH_8M_MAIN__) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Get Main Stack Pointer Limit (non-secure) + \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state. + \return MSPLIM Register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __TZ_get_MSPLIM_NS(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Main Stack Pointer Limit + \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM). + \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_MSPLIM(uint32_t MainStackPtrLimit) +{ + __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit)); +} + + +#if ((defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) && \ + (defined (__ARM_ARCH_8M_MAIN__) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Set Main Stack Pointer Limit (non-secure) + \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state. + \param [in] MainStackPtrLimit Main Stack Pointer value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit) +{ + __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit)); +} +#endif + +#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) + +/** + \brief Get FPSCR + \details Returns the current value of the Floating Point Status/Control register. + \return Floating Point Status/Control register value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __get_FPSCR(void) +{ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) + uint32_t result; + + __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); + return(result); +#else + return(0U); +#endif +} + + +/** + \brief Set FPSCR + \details Assigns the given value to the Floating Point Status/Control register. + \param [in] fpscr Floating Point Status/Control value to set + */ +__attribute__((always_inline)) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr) +{ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) + __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc", "memory"); +#else + (void)fpscr; +#endif +} + +#endif /* ((defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + + +/*@} end of CMSIS_Core_RegAccFunctions */ + + +/* ########################## Core Instruction Access ######################### */ +/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface + Access to dedicated instructions + @{ +*/ + +/* Define macros for porting to both thumb1 and thumb2. + * For thumb1, use low register (r0-r7), specified by constraint "l" + * Otherwise, use general registers, specified by constraint "r" */ +#if defined (__thumb__) && !defined (__thumb2__) +#define __CMSIS_GCC_OUT_REG(r) "=l" (r) +#define __CMSIS_GCC_RW_REG(r) "+l" (r) +#define __CMSIS_GCC_USE_REG(r) "l" (r) +#else +#define __CMSIS_GCC_OUT_REG(r) "=r" (r) +#define __CMSIS_GCC_RW_REG(r) "+r" (r) +#define __CMSIS_GCC_USE_REG(r) "r" (r) +#endif + +/** + \brief No Operation + \details No Operation does nothing. This instruction can be used for code alignment purposes. + */ +//__attribute__((always_inline)) __STATIC_INLINE void __NOP(void) +//{ +// __ASM volatile ("nop"); +//} +#define __NOP() __ASM volatile ("nop") /* This implementation generates debug information */ + +/** + \brief Wait For Interrupt + \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs. + */ +//__attribute__((always_inline)) __STATIC_INLINE void __WFI(void) +//{ +// __ASM volatile ("wfi"); +//} +#define __WFI() __ASM volatile ("wfi") /* This implementation generates debug information */ + + +/** + \brief Wait For Event + \details Wait For Event is a hint instruction that permits the processor to enter + a low-power state until one of a number of events occurs. + */ +//__attribute__((always_inline)) __STATIC_INLINE void __WFE(void) +//{ +// __ASM volatile ("wfe"); +//} +#define __WFE() __ASM volatile ("wfe") /* This implementation generates debug information */ + + +/** + \brief Send Event + \details Send Event is a hint instruction. It causes an event to be signaled to the CPU. + */ +//__attribute__((always_inline)) __STATIC_INLINE void __SEV(void) +//{ +// __ASM volatile ("sev"); +//} +#define __SEV() __ASM volatile ("sev") /* This implementation generates debug information */ + + +/** + \brief Instruction Synchronization Barrier + \details Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or memory, + after the instruction has been completed. + */ +__attribute__((always_inline)) __STATIC_INLINE void __ISB(void) +{ + __ASM volatile ("isb 0xF":::"memory"); +} + + +/** + \brief Data Synchronization Barrier + \details Acts as a special kind of Data Memory Barrier. + It completes when all explicit memory accesses before this instruction complete. + */ +__attribute__((always_inline)) __STATIC_INLINE void __DSB(void) +{ + __ASM volatile ("dsb 0xF":::"memory"); +} + + +/** + \brief Data Memory Barrier + \details Ensures the apparent order of the explicit memory operations before + and after the instruction, without ensuring their completion. + */ +__attribute__((always_inline)) __STATIC_INLINE void __DMB(void) +{ + __ASM volatile ("dmb 0xF":::"memory"); +} + + +/** + \brief Reverse byte order (32 bit) + \details Reverses the byte order in integer value. + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __REV(uint32_t value) +{ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) + return __builtin_bswap32(value); +#else + uint32_t result; + + __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +#endif +} + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order in two unsigned short values. + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __REV16(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +} + + +/** + \brief Reverse byte order in signed short value + \details Reverses the byte order in a signed short value with sign extension to integer. + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__((always_inline)) __STATIC_INLINE int32_t __REVSH(int32_t value) +{ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + return (short)__builtin_bswap16(value); +#else + int32_t result; + + __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +#endif +} + + +/** + \brief Rotate Right in unsigned value (32 bit) + \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. + \param [in] op1 Value to rotate + \param [in] op2 Number of Bits to rotate + \return Rotated value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2) +{ + return (op1 >> op2) | (op1 << (32U - op2)); +} + + +/** + \brief Breakpoint + \details Causes the processor to enter Debug state. + Debug tools can use this to investigate system state when the instruction at a particular address is reached. + \param [in] value is ignored by the processor. + If required, a debugger can use it to store additional information about the breakpoint. + */ +#define __BKPT(value) __ASM volatile ("bkpt "#value) + + +/** + \brief Reverse bit order of value + \details Reverses the bit order of the given value. + \param [in] value Value to reverse + \return Reversed value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value) +{ + uint32_t result; + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) + __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); +#else + int32_t s = (4 /*sizeof(v)*/ * 8) - 1; /* extra shift needed at end */ + + result = value; /* r will be reversed bits of v; first get LSB of v */ + for (value >>= 1U; value; value >>= 1U) + { + result <<= 1U; + result |= value & 1U; + s--; + } + result <<= s; /* shift when v's highest bits are zero */ +#endif + return(result); +} + + +/** + \brief Count leading zeros + \details Counts the number of leading zeros of a data value. + \param [in] value Value to count the leading zeros + \return number of leading zeros in value + */ +#define __CLZ __builtin_clz + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) +/** + \brief LDR Exclusive (8 bit) + \details Executes a exclusive LDR instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint8_t __LDREXB(volatile uint8_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDR Exclusive (16 bit) + \details Executes a exclusive LDR instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint16_t __LDREXH(volatile uint16_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDR Exclusive (32 bit) + \details Executes a exclusive LDR instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __LDREXW(volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) ); + return(result); +} + + +/** + \brief STR Exclusive (8 bit) + \details Executes a exclusive STR instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr) +{ + uint32_t result; + + __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief STR Exclusive (16 bit) + \details Executes a exclusive STR instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr) +{ + uint32_t result; + + __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief STR Exclusive (32 bit) + \details Executes a exclusive STR instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) ); + return(result); +} + + +/** + \brief Remove the exclusive lock + \details Removes the exclusive lock which is created by LDREX. + */ +__attribute__((always_inline)) __STATIC_INLINE void __CLREX(void) +{ + __ASM volatile ("clrex" ::: "memory"); +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +#define __SSAT(ARG1,ARG2) \ +({ \ + int32_t __RES, __ARG1 = (ARG1); \ + __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +#define __USAT(ARG1,ARG2) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + + +/** + \brief Rotate Right with Extend (32 bit) + \details Moves each bit of a bitstring right by one bit. + The carry input is shifted in at the left end of the bitstring. + \param [in] value Value to rotate + \return Rotated value + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __RRX(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +} + + +/** + \brief LDRT Unprivileged (8 bit) + \details Executes a Unprivileged LDRT instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint8_t __LDRBT(volatile uint8_t *ptr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrbt %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" ); +#endif + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDRT Unprivileged (16 bit) + \details Executes a Unprivileged LDRT instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint16_t __LDRHT(volatile uint16_t *ptr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrht %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" ); +#endif + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDRT Unprivileged (32 bit) + \details Executes a Unprivileged LDRT instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __LDRT(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief STRT Unprivileged (8 bit) + \details Executes a Unprivileged STRT instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__((always_inline)) __STATIC_INLINE void __STRBT(uint8_t value, volatile uint8_t *ptr) +{ + __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief STRT Unprivileged (16 bit) + \details Executes a Unprivileged STRT instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__((always_inline)) __STATIC_INLINE void __STRHT(uint16_t value, volatile uint16_t *ptr) +{ + __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief STRT Unprivileged (32 bit) + \details Executes a Unprivileged STRT instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__((always_inline)) __STATIC_INLINE void __STRT(uint32_t value, volatile uint32_t *ptr) +{ + __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) ); +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) +/** + \brief Load-Acquire (8 bit) + \details Executes a LDAB instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint8_t __LDAB(volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint8_t) result); +} + + +/** + \brief Load-Acquire (16 bit) + \details Executes a LDAH instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint16_t __LDAH(volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint16_t) result); +} + + +/** + \brief Load-Acquire (32 bit) + \details Executes a LDA instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __LDA(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief Store-Release (8 bit) + \details Executes a STLB instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__((always_inline)) __STATIC_INLINE void __STLB(uint8_t value, volatile uint8_t *ptr) +{ + __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Store-Release (16 bit) + \details Executes a STLH instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__((always_inline)) __STATIC_INLINE void __STLH(uint16_t value, volatile uint16_t *ptr) +{ + __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Store-Release (32 bit) + \details Executes a STL instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__attribute__((always_inline)) __STATIC_INLINE void __STL(uint32_t value, volatile uint32_t *ptr) +{ + __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief Load-Acquire Exclusive (8 bit) + \details Executes a LDAB exclusive instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint8_t __LDAEXB(volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaexb %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint8_t) result); +} + + +/** + \brief Load-Acquire Exclusive (16 bit) + \details Executes a LDAH exclusive instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint16_t __LDAEXH(volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaexh %0, %1" : "=r" (result) : "Q" (*ptr) ); + return ((uint16_t) result); +} + + +/** + \brief Load-Acquire Exclusive (32 bit) + \details Executes a LDA exclusive instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __LDAEX(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaex %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief Store-Release Exclusive (8 bit) + \details Executes a STLB exclusive instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlexb %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief Store-Release Exclusive (16 bit) + \details Executes a STLH exclusive instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlexh %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief Store-Release Exclusive (32 bit) + \details Executes a STL exclusive instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__attribute__((always_inline)) __STATIC_INLINE uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlex %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) ); + return(result); +} + +#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + +/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ + + +/* ################### Compiler specific Intrinsics ########################### */ +/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics + Access to dedicated SIMD instructions + @{ +*/ + +#if (__ARM_FEATURE_DSP == 1) /* ToDo ARMCLANG: This should be ARCH >= ARMv7-M + SIMD */ + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __QADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __USUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __QADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __USUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __QASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __QSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __USAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __USAD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#define __SSAT16(ARG1,ARG2) \ +({ \ + int32_t __RES, __ARG1 = (ARG1); \ + __ASM ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + +#define __USAT16(ARG1,ARG2) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ + __RES; \ + }) + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM volatile ("uxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM volatile ("sxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__attribute__((always_inline)) __STATIC_INLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__attribute__((always_inline)) __STATIC_INLINE uint32_t __SEL (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE int32_t __QADD( int32_t op1, int32_t op2) +{ + int32_t result; + + __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__attribute__((always_inline)) __STATIC_INLINE int32_t __QSUB( int32_t op1, int32_t op2) +{ + int32_t result; + + __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +#if 0 +#define __PKHBT(ARG1,ARG2,ARG3) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) + +#define __PKHTB(ARG1,ARG2,ARG3) \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + if (ARG3 == 0) \ + __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \ + else \ + __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) +#endif + +#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \ + ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) ) + +#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \ + ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) ) + +__attribute__((always_inline)) __STATIC_INLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3) +{ + int32_t result; + + __ASM volatile ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#endif /* (__ARM_FEATURE_DSP == 1) */ +/*@} end of group CMSIS_SIMD_intrinsics */ + + +#pragma GCC diagnostic pop + +#endif /* __CMSIS_GCC_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Include/core_cm0.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Include/core_cm0.h new file mode 100644 index 00000000..6cdde790 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Include/core_cm0.h @@ -0,0 +1,875 @@ +/**************************************************************************//** + * @file core_cm0.h + * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File + * @version V5.0.1 + * @date 25. November 2016 + ******************************************************************************/ +/* + * Copyright (c) 2009-2016 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 (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM0_H_GENERIC +#define __CORE_CM0_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M0 + @{ + */ + +/* CMSIS CM0 definitions */ +#define __CM0_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS HAL main version */ +#define __CM0_CMSIS_VERSION_SUB ( 0U) /*!< [15:0] CMSIS HAL sub version */ +#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16U) | \ + __CM0_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ + +#define __CORTEX_M (0U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + This core does not support an FPU at all +*/ +#define __FPU_USED 0U + +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_PCS_VFP + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM0_H_DEPENDANT +#define __CORE_CM0_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM0_REV + #define __CM0_REV 0x0000U + #warning "__CM0_REV not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 2U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M0 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ + uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t _reserved0:1; /*!< bit: 0 Reserved */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[31U]; + __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RSERVED1[31U]; + __IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[31U]; + __IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[31U]; + uint32_t RESERVED4[64U]; + __IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ +} NVIC_Type; + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + uint32_t RESERVED0; + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + uint32_t RESERVED1; + __IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor. + Therefore they are not covered by the Cortex-M0 header file. + @{ + */ +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ + + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifndef CMSIS_NVIC_VIRTUAL +/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for Cortex-M0 */ +/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for Cortex-M0 */ + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ +/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M0 */ + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifndef CMSIS_VECTAB_VIRTUAL + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* Interrupt Priorities are WORD accessible only under ARMv6M */ +/* The following MACROS handle generation of the register offset and byte masks */ +#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) +#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) +#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } + else + { + SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | + (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn))); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + Address 0 must be mapped to SRAM. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)0x0U; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)0x0U; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__STATIC_INLINE void NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + SCB_AIRCR_SYSRESETREQ_Msk); + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + return 0U; /* No FPU */ +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM0_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1000_RomFunctionTable.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1000_RomFunctionTable.h new file mode 100644 index 00000000..d97a2b49 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1000_RomFunctionTable.h @@ -0,0 +1,176 @@ +/********************************************************************************************************************* + * @file XMC1000_RomFunctionTable.h + * @brief ROM functions prototypes for the XMC1400-Series + * @version V1.0 + * @date 03 Sep 2015 + * + * @cond + ********************************************************************************************************************* + * Copyright (c) 2015-2016, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + **************************** Change history ********************************* + * V1.0, 03 Sep 2015, JFT : Initial version + ***************************************************************************** + * @endcond + */ + +#ifndef ROM_FUNCTION_TABLE_H +#define ROM_FUNCTION_TABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* *************************************************************************** +******************************* Constants ******************************* +*************************************************************************** */ +/* Start address of the ROM function table */ +#define ROM_FUNCTION_TABLE_START (0x00000100U) + +/* Pointer to Erase Flash Page routine */ +#define _NvmErase (ROM_FUNCTION_TABLE_START + 0x00U) + +/* Pointer to Erase, Program & Verify Flash Page routine */ +#define _NvmProgVerify (ROM_FUNCTION_TABLE_START + 0x04U) + +/* Pointer to Request BMI installation routine */ +#define _BmiInstallationReq (ROM_FUNCTION_TABLE_START + 0x08U) + + +/* *************************************************************************** +******************************** Enumerations ******************************** +*************************************************************************** */ +typedef enum TagNVMStatus +{ + +/* The function succeeded */ + NVM_PASS = (int32_t)0x00010000U, + +/* Generic error code */ + NVM_E_FAIL = (int32_t)0x80010001U, + +/* Source data not in RAM */ + NVM_E_SRC_AREA_EXCCEED = (int32_t)0x80010003U, + +/* Source data is not 4 byte aligned */ + NVM_E_SRC_ALIGNMENT = (int32_t)0x80010004U, + +/* NVM module cannot be physically accessed */ + NVM_E_NVM_FAIL = (int32_t)0x80010005U, + +/* Verification of written page not successful */ + NVM_E_VERIFY = (int32_t)0x80010006U, + +/* Destination data is not (completely) located in NVM */ + NVM_E_DST_AREA_EXCEED = (int32_t)0x80010009U, + +/* Destination data is not properly aligned */ + NVM_E_DST_ALIGNMENT = (int32_t)0x80010010U, + +} NVM_STATUS; + + +/* *************************************************************************** +*********************************** Macros *********************************** +*************************************************************************** */ + +/* *************************************************************************** +Description: Erase granularity = 1 Page of 16 blocks of 16 Bytes + = Equivalent to 256 Bytes using this routine. + +Input parameters: +– Logical address of the Flash Page to be erased which must be page aligned +and in NVM address range + +Return status: +– OK (NVM_PASS) +– Invalid address (NVM_E_DST_ALIGNMENT or NVM_E_DST_AREA_EXCEED) +– Operation failed (Error during low level NVM programming driver): + NVM_E_FAIL + NVM_E_VERIFY + NVM_E_NVM_FAIL + +Prototype: + NVM_STATUS XMC1000_NvmErasePage(uint32_t *pageAddr) +*************************************************************************** */ +#define XMC1000_NvmErasePage (*((NVM_STATUS (**) (uint32_t * )) \ + _NvmErase)) + +/* *************************************************************************** +Description: This procedure performs erase (skipped if not necessary), program +and verify of selected Flash page. + +Input parameter: +– Logical address of the target Flash Page, must be page aligned and in NVM +address range + +– Address in SRAM where the data starts, must be 4-byte aligned + +Return status: +– OK (NVM_PASS) +– Invalid addresses + NVM_E_DST_ALIGNMENT + NVM_E_SRC_ALIGNMENT + NVM_E_DST_AREA_EXCEED + NVM_E_SRC_AREA_EXCCEED +– Operation failed (Error during low level NVM programming driver): + NVM_E_FAIL + NVM_E_VERIFY + NVM_E_NVM_FAIL + +Prototype: + NVM_STATUS XMC1000_NvmProgVerify(const uint32_t *srcAddr, uint32_t *dstAddr) +*************************************************************************** */ +#define XMC1000_NvmProgVerify (*((NVM_STATUS (**) (const uint32_t * ,\ + uint32_t * ))\ + _NvmProgVerify)) + + +/* *************************************************************************** +Description: This procedure initiates installation of a new BMI value. In +particular, it can be used as well as to restore the state upon delivery for a +device already in User Productive mode. + +Input parameter: +– BMI value to be installed + +Return status: +– wrong input BMI value (0x01) - only upon error, if OK the procedure triggers +a reset respectively does not return to calling routine ! + +Prototype: + unsigned long XMC1000_BmiInstallationReq(unsigned short requestedBmiValue) +**************************************************************************** */ +#define XMC1000_BmiInstallationReq (*((uint32_t (**) (uint16_t)) \ + _BmiInstallationReq)) + +#ifdef __cplusplus +} +#endif + +#endif /* ROM_FUNCTION_TABLE_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1400.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1400.h new file mode 100644 index 00000000..9c9fa178 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/CMSIS/Infineon/XMC1400_series/Include/XMC1400.h @@ -0,0 +1,8899 @@ +/********************************************************************************************************************* + * Copyright (c) 2015-2016, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + *********************************************************************************************************************/ + +/****************************************************************************************************//** + * @file XMC1400.h + * + * @brief CMSIS Cortex-M0 Peripheral Access Layer Header File for + * XMC1400 from Infineon. + * + * @version V1.1.0 (Reference Manual v1.1) + * @date 30. August 2016 + * + * @note Generated with SVDConv V2.87l + * from CMSIS SVD File 'XMC1400_Processed_SVD.xml' Version 1.1.0 (Reference Manual v1.1), + *******************************************************************************************************/ + + + +/** @addtogroup Infineon + * @{ + */ + +/** @addtogroup XMC1400 + * @{ + */ + +#ifndef XMC1400_H +#define XMC1400_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* ------------------------- Interrupt Number Definition ------------------------ */ + +typedef enum { +/* ------------------- Cortex-M0 Processor Exceptions Numbers ------------------- */ + 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 */ + SVCall_IRQn = -5, /*!< 11 System Service Call via SVC instruction */ + PendSV_IRQn = -2, /*!< 14 Pendable request for system service */ + SysTick_IRQn = -1, /*!< 15 System Tick Timer */ +/* --------------------- XMC1400 Specific Interrupt Numbers --------------------- */ + IRQ0_IRQn = 0, + IRQ1_IRQn = 1, + IRQ2_IRQn = 2, + IRQ3_IRQn = 3, + IRQ4_IRQn = 4, + IRQ5_IRQn = 5, + IRQ6_IRQn = 6, + IRQ7_IRQn = 7, + IRQ8_IRQn = 8, + IRQ9_IRQn = 9, + IRQ10_IRQn = 10, + IRQ11_IRQn = 11, + IRQ12_IRQn = 12, + IRQ13_IRQn = 13, + IRQ14_IRQn = 14, + IRQ15_IRQn = 15, + IRQ16_IRQn = 16, + IRQ17_IRQn = 17, + IRQ18_IRQn = 18, + IRQ19_IRQn = 19, + IRQ20_IRQn = 20, + IRQ21_IRQn = 21, + IRQ22_IRQn = 22, + IRQ23_IRQn = 23, + IRQ24_IRQn = 24, + IRQ25_IRQn = 25, + IRQ26_IRQn = 26, + IRQ27_IRQn = 27, + IRQ28_IRQn = 28, + IRQ29_IRQn = 29, + IRQ30_IRQn = 30, + IRQ31_IRQn = 31 + +} IRQn_Type; + + +/** @addtogroup Configuration_of_CMSIS + * @{ + */ + + +/* ================================================================================ */ +/* ================ Processor and Core Peripheral Section ================ */ +/* ================================================================================ */ + +/* ----------------Configuration of the Cortex-M0 Processor and Core Peripherals---------------- */ +#define __CM0_REV 0x0000 /*!< Cortex-M0 Core Revision */ +#define __MPU_PRESENT 0 /*!< MPU present or not */ +#define __NVIC_PRIO_BITS 2 /*!< Number of Bits used for Priority Levels */ +#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */ +/** @} */ /* End of group Configuration_of_CMSIS */ + +#include "core_cm0.h" /*!< Cortex-M0 processor and core peripherals */ +#include "system_XMC1400.h" /*!< XMC1400 System */ + + +/* ================================================================================ */ +/* ================ Device Specific Peripheral Section ================ */ +/* ================================================================================ */ +/* Macro to modify desired bitfields of a register */ +#define WR_REG(reg, mask, pos, val) reg = (((uint32_t)val << pos) & \ + ((uint32_t)mask)) | \ + (reg & ((uint32_t)~((uint32_t)mask))) + +/* Macro to modify desired bitfields of a register */ +#define WR_REG_SIZE(reg, mask, pos, val, size) { \ +uint##size##_t VAL1 = (uint##size##_t)((uint##size##_t)val << pos); \ +uint##size##_t VAL2 = (uint##size##_t) (VAL1 & (uint##size##_t)mask); \ +uint##size##_t VAL3 = (uint##size##_t)~((uint##size##_t)mask); \ +uint##size##_t VAL4 = (uint##size##_t) ((uint##size##_t)reg & VAL3); \ +reg = (uint##size##_t) (VAL2 | VAL4);\ +} + +/** Macro to read bitfields from a register */ +#define RD_REG(reg, mask, pos) (((uint32_t)reg & (uint32_t)mask) >> pos) + +/** Macro to read bitfields from a register */ +#define RD_REG_SIZE(reg, mask, pos,size) ((uint##size##_t)(((uint32_t)reg & \ + (uint32_t)mask) >> pos) ) + +/** Macro to set a bit in register */ +#define SET_BIT(reg, pos) (reg |= ((uint32_t)1< + +/******************************************************************************* + * GLOBAL VARIABLES + *******************************************************************************/ + +extern uint32_t SystemCoreClock; + +/******************************************************************************* + * API PROTOTYPES + *******************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize the system + * + */ +void SystemInit(void); + +/** + * @brief Initialize CPU settings + * + */ +void SystemCoreSetup(void); + +/** + * @brief Initialize clock + * + */ +void SystemCoreClockSetup(void); + +/** + * @brief Update SystemCoreClock variable + * + */ +void SystemCoreClockUpdate(void); + +/** + * @brief Returns frequency of the high performace oscillator + * User needs to overload this function to return the correct oscillator frequency + */ +uint32_t OSCHP_GetFrequency(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/Newlib/syscalls.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/Newlib/syscalls.c new file mode 100644 index 00000000..0ce488cf --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/Newlib/syscalls.c @@ -0,0 +1,100 @@ +/********************************************************************************************************************* + * @file syscalls.c + * @brief Newlib stubs + * @version V1.6 + * @date 20 Apr 2017 + * + * @cond + ********************************************************************************************************************* + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * *************************** Change history ******************************** + * V0.1 : Initial version + * V0.2 : Label updates + * V1.0 : Made _sbrk device agnostic + * V1.1 : C++ support + * V1.2 : Restored compatibility with old project files + * V1.3 Jan 2014, PKB : Encapsulating everything in this file for use only with GCC + * V1.4 11 Dec 2015, JFT : Fix heap overflow + * V1.5 09 Mar 2016, JFT : Add dso_handle to support destructors call at exit + * V1.6 20 Apr 2017, JFT : Foward declaration of __sbrk to fix link time optimization (-flto) compilation errors + * @endcond + */ + +/* + * This file contains stubs for standard C library functionality that must + * typically be provided for the underlying platform. + * + */ +#if defined ( __GNUC__ ) + +#include +#include +#include + +/* Forward prototypes. */ +caddr_t _sbrk(int nbytes) __attribute__((externally_visible)); +void _init(void) __attribute__((externally_visible)); + +/* c++ destructor dynamic shared object needed if -fuse-cxa-atexit is used*/ +void *__dso_handle __attribute__ ((weak)); + +// defined in linker script +extern caddr_t Heap_Bank1_Start; +extern caddr_t Heap_Bank1_End; +caddr_t _sbrk(int nbytes) +{ + static caddr_t heap_ptr = NULL; + caddr_t base; + + if (heap_ptr == NULL) { + heap_ptr = (caddr_t)&Heap_Bank1_Start; + } + + base = heap_ptr; + + /* heap word alignment */ + nbytes = (nbytes + 3) & ~0x3U; + if ((caddr_t)&Heap_Bank1_End > (heap_ptr + nbytes)) + { + heap_ptr += nbytes; + return (base); + } + else + { + /* Heap overflow */ + errno = ENOMEM; + return ((caddr_t)-1); + } +} + +/* Init */ +void _init(void) +{} + +#endif /* __GNUC__ */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_ccu4_map.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_ccu4_map.h new file mode 100644 index 00000000..e69ac723 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_ccu4_map.h @@ -0,0 +1,3791 @@ +/** + * @file xmc1_ccu4_map.h + * @date 2015-08-25 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-08-25: + * - Initial version + * + * @endcond + */ + +#ifndef XMC1_CCU4_MAP_H +#define XMC1_CCU4_MAP_H + +#if UC_SERIES != XMC14 +#define XMC_CCU4_SLICE_INPUT_A (0U) +#define XMC_CCU4_SLICE_INPUT_B (1U) +#define XMC_CCU4_SLICE_INPUT_C (2U) +#define XMC_CCU4_SLICE_INPUT_D (3U) +#define XMC_CCU4_SLICE_INPUT_E (4U) +#define XMC_CCU4_SLICE_INPUT_F (5U) +#define XMC_CCU4_SLICE_INPUT_G (6U) +#define XMC_CCU4_SLICE_INPUT_H (7U) +#define XMC_CCU4_SLICE_INPUT_I (8U) +#define XMC_CCU4_SLICE_INPUT_J (9U) +#define XMC_CCU4_SLICE_INPUT_K (10U) +#define XMC_CCU4_SLICE_INPUT_L (11U) +#define XMC_CCU4_SLICE_INPUT_M (12U) +#define XMC_CCU4_SLICE_INPUT_N (13U) +#define XMC_CCU4_SLICE_INPUT_O (14U) +#define XMC_CCU4_SLICE_INPUT_P (15U) +#else +#define XMC_CCU4_SLICE_INPUT_AA (0U) +#define XMC_CCU4_SLICE_INPUT_AB (1U) +#define XMC_CCU4_SLICE_INPUT_AC (2U) +#define XMC_CCU4_SLICE_INPUT_AD (3U) +#define XMC_CCU4_SLICE_INPUT_AE (4U) +#define XMC_CCU4_SLICE_INPUT_AF (5U) +#define XMC_CCU4_SLICE_INPUT_AG (6U) +#define XMC_CCU4_SLICE_INPUT_AH (7U) +#define XMC_CCU4_SLICE_INPUT_AI (8U) +#define XMC_CCU4_SLICE_INPUT_AJ (9U) +#define XMC_CCU4_SLICE_INPUT_AK (10U) +#define XMC_CCU4_SLICE_INPUT_AL (11U) +#define XMC_CCU4_SLICE_INPUT_AM (12U) +#define XMC_CCU4_SLICE_INPUT_AN (13U) +#define XMC_CCU4_SLICE_INPUT_AO (14U) +#define XMC_CCU4_SLICE_INPUT_AP (15U) +#define XMC_CCU4_SLICE_INPUT_AQ (16U) +#define XMC_CCU4_SLICE_INPUT_AR (17U) +#define XMC_CCU4_SLICE_INPUT_AS (18U) +#define XMC_CCU4_SLICE_INPUT_AT (19U) +#define XMC_CCU4_SLICE_INPUT_AU (20U) +#define XMC_CCU4_SLICE_INPUT_AV (21U) +#define XMC_CCU4_SLICE_INPUT_AW (22U) +#define XMC_CCU4_SLICE_INPUT_AX (23U) +#define XMC_CCU4_SLICE_INPUT_AY (24U) +#define XMC_CCU4_SLICE_INPUT_AZ (25U) +#define XMC_CCU4_SLICE_INPUT_BA (26U) +#define XMC_CCU4_SLICE_INPUT_BB (27U) +#define XMC_CCU4_SLICE_INPUT_BC (28U) +#define XMC_CCU4_SLICE_INPUT_BD (29U) +#define XMC_CCU4_SLICE_INPUT_BE (30U) +#define XMC_CCU4_SLICE_INPUT_BF (31U) +#define XMC_CCU4_SLICE_INPUT_BG (32U) +#define XMC_CCU4_SLICE_INPUT_BH (33U) +#define XMC_CCU4_SLICE_INPUT_BI (34U) +#define XMC_CCU4_SLICE_INPUT_BJ (35U) +#define XMC_CCU4_SLICE_INPUT_BK (36U) +#define XMC_CCU4_SLICE_INPUT_BL (37U) +#define XMC_CCU4_SLICE_INPUT_BM (38U) +#define XMC_CCU4_SLICE_INPUT_BN (39U) +#define XMC_CCU4_SLICE_INPUT_BO (40U) +#define XMC_CCU4_SLICE_INPUT_BP (41U) +#define XMC_CCU4_SLICE_INPUT_BQ (42U) +#define XMC_CCU4_SLICE_INPUT_BR (43U) +#define XMC_CCU4_SLICE_INPUT_BS (44U) +#define XMC_CCU4_SLICE_INPUT_BT (45U) +#define XMC_CCU4_SLICE_INPUT_BU (46U) +#define XMC_CCU4_SLICE_INPUT_BV (47U) +#endif + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN24) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN40) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP16) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP38) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1200) && (UC_PACKAGE == TSSOP38) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_LEDTSledts_SR0 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_LEDTSledts_SR0 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == VQFN40) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_LEDTSledts_SR0 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_LEDTSledts_SR0 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP28) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_LEDTSledts_SR0 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_LEDTSledts_SR0 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP38) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_LEDTSledts_SR0 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_LEDTSledts_SR0 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN24) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN40) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP16) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP28) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN24) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN40) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP16) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP38) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN24) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN40) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP16) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP28) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP38) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == LQFP64) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_P4_8 21 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_P4_1 26 +#define CCU40_IN1_P4_9 21 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_LEDTS0_SR 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_P4_10 21 +#define CCU40_IN2_P4_2 26 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_LEDTS1_SR 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_P4_11 21 +#define CCU40_IN3_P4_3 26 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_0 2 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_P4_8 26 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_1 2 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_P4_9 26 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_10 26 +#define CCU41_IN2_P4_2 2 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_11 26 +#define CCU41_IN3_P4_3 2 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == VQFN48) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_LEDTS0_SR 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_LEDTS1_SR 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == LQFP64) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_P4_8 21 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_P4_1 26 +#define CCU40_IN1_P4_9 21 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_ACMP3_OUT 17 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_P4_10 21 +#define CCU40_IN2_P4_2 26 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_P4_11 21 +#define CCU40_IN3_P4_3 26 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_ACMP3_OUT 18 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_0 2 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_P4_8 26 +#define CCU41_IN0_POSIF1_OUT0 4 +#define CCU41_IN0_POSIF1_OUT1 5 +#define CCU41_IN0_POSIF1_OUT3 6 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_1 2 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_P4_9 26 +#define CCU41_IN1_POSIF1_OUT0 4 +#define CCU41_IN1_POSIF1_OUT1 5 +#define CCU41_IN1_POSIF1_OUT3 6 +#define CCU41_IN1_POSIF1_OUT4 7 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_ACMP3_OUT 17 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_10 26 +#define CCU41_IN2_P4_2 2 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_POSIF1_OUT0 28 +#define CCU41_IN2_POSIF1_OUT1 4 +#define CCU41_IN2_POSIF1_OUT2 5 +#define CCU41_IN2_POSIF1_OUT3 6 +#define CCU41_IN2_POSIF1_OUT4 7 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_11 26 +#define CCU41_IN3_P4_3 2 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_POSIF1_OUT0 28 +#define CCU41_IN3_POSIF1_OUT1 29 +#define CCU41_IN3_POSIF1_OUT3 4 +#define CCU41_IN3_POSIF1_OUT5 5 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_ACMP3_OUT 18 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN40) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN48) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_ACMP3_OUT 17 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_ACMP3_OUT 18 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_POSIF1_OUT0 4 +#define CCU41_IN0_POSIF1_OUT1 5 +#define CCU41_IN0_POSIF1_OUT3 6 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_POSIF1_OUT0 4 +#define CCU41_IN1_POSIF1_OUT1 5 +#define CCU41_IN1_POSIF1_OUT3 6 +#define CCU41_IN1_POSIF1_OUT4 7 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_ACMP3_OUT 17 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_POSIF1_OUT0 28 +#define CCU41_IN2_POSIF1_OUT1 4 +#define CCU41_IN2_POSIF1_OUT2 5 +#define CCU41_IN2_POSIF1_OUT3 6 +#define CCU41_IN2_POSIF1_OUT4 7 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_POSIF1_OUT0 28 +#define CCU41_IN3_POSIF1_OUT1 29 +#define CCU41_IN3_POSIF1_OUT3 4 +#define CCU41_IN3_POSIF1_OUT5 5 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_ACMP3_OUT 18 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN64) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_P4_8 21 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_P4_1 26 +#define CCU40_IN1_P4_9 21 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_ACMP3_OUT 17 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_P4_10 21 +#define CCU40_IN2_P4_2 26 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_P4_11 21 +#define CCU40_IN3_P4_3 26 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_ACMP3_OUT 18 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_0 2 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_P4_8 26 +#define CCU41_IN0_POSIF1_OUT0 4 +#define CCU41_IN0_POSIF1_OUT1 5 +#define CCU41_IN0_POSIF1_OUT3 6 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_1 2 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_P4_9 26 +#define CCU41_IN1_POSIF1_OUT0 4 +#define CCU41_IN1_POSIF1_OUT1 5 +#define CCU41_IN1_POSIF1_OUT3 6 +#define CCU41_IN1_POSIF1_OUT4 7 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_ACMP3_OUT 17 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_10 26 +#define CCU41_IN2_P4_2 2 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_POSIF1_OUT0 28 +#define CCU41_IN2_POSIF1_OUT1 4 +#define CCU41_IN2_POSIF1_OUT2 5 +#define CCU41_IN2_POSIF1_OUT3 6 +#define CCU41_IN2_POSIF1_OUT4 7 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_11 26 +#define CCU41_IN3_P4_3 2 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_POSIF1_OUT0 28 +#define CCU41_IN3_POSIF1_OUT1 29 +#define CCU41_IN3_POSIF1_OUT3 4 +#define CCU41_IN3_POSIF1_OUT5 5 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_ACMP3_OUT 18 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == TSSOP38) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN40) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN48) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN64) +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_P4_8 21 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_P4_1 26 +#define CCU40_IN1_P4_9 21 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_P4_10 21 +#define CCU40_IN2_P4_2 26 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_P4_11 21 +#define CCU40_IN3_P4_3 26 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_0 2 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_P4_8 26 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_1 2 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_P4_9 26 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_10 26 +#define CCU41_IN2_P4_2 2 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_11 26 +#define CCU41_IN3_P4_3 2 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == LQFP64) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_P4_8 21 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_P4_1 26 +#define CCU40_IN1_P4_9 21 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_ACMP3_OUT 17 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_LEDTS0_SR 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_P4_10 21 +#define CCU40_IN2_P4_2 26 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_LEDTS1_SR 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_P4_11 21 +#define CCU40_IN3_P4_3 26 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_ACMP3_OUT 18 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_0 2 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_P4_8 26 +#define CCU41_IN0_POSIF1_OUT0 4 +#define CCU41_IN0_POSIF1_OUT1 5 +#define CCU41_IN0_POSIF1_OUT3 6 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_1 2 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_P4_9 26 +#define CCU41_IN1_POSIF1_OUT0 4 +#define CCU41_IN1_POSIF1_OUT1 5 +#define CCU41_IN1_POSIF1_OUT3 6 +#define CCU41_IN1_POSIF1_OUT4 7 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_ACMP3_OUT 17 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_10 26 +#define CCU41_IN2_P4_2 2 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_POSIF1_OUT0 28 +#define CCU41_IN2_POSIF1_OUT1 4 +#define CCU41_IN2_POSIF1_OUT2 5 +#define CCU41_IN2_POSIF1_OUT3 6 +#define CCU41_IN2_POSIF1_OUT4 7 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_11 26 +#define CCU41_IN3_P4_3 2 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_POSIF1_OUT0 28 +#define CCU41_IN3_POSIF1_OUT1 29 +#define CCU41_IN3_POSIF1_OUT3 4 +#define CCU41_IN3_POSIF1_OUT5 5 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_ACMP3_OUT 18 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN48) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_ACMP3_OUT 17 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_LEDTS0_SR 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_LEDTS1_SR 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_ACMP3_OUT 18 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_POSIF1_OUT0 4 +#define CCU41_IN0_POSIF1_OUT1 5 +#define CCU41_IN0_POSIF1_OUT3 6 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_POSIF1_OUT0 4 +#define CCU41_IN1_POSIF1_OUT1 5 +#define CCU41_IN1_POSIF1_OUT3 6 +#define CCU41_IN1_POSIF1_OUT4 7 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_ACMP3_OUT 17 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_POSIF1_OUT0 28 +#define CCU41_IN2_POSIF1_OUT1 4 +#define CCU41_IN2_POSIF1_OUT2 5 +#define CCU41_IN2_POSIF1_OUT3 6 +#define CCU41_IN2_POSIF1_OUT4 7 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_POSIF1_OUT0 28 +#define CCU41_IN3_POSIF1_OUT1 29 +#define CCU41_IN3_POSIF1_OUT3 4 +#define CCU41_IN3_POSIF1_OUT5 5 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_ACMP3_OUT 18 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN64) +#define CCU40_IN0_BCCU0_OUT0 16 +#define CCU40_IN0_BCCU0_OUT6 25 +#define CCU40_IN0_CCU40_GP01 12 +#define CCU40_IN0_CCU40_SR0 27 +#define CCU40_IN0_CCU40_SR2 19 +#define CCU40_IN0_CCU40_ST0 20 +#define CCU40_IN0_CCU40_ST1 13 +#define CCU40_IN0_CCU40_ST2 14 +#define CCU40_IN0_CCU40_ST3 15 +#define CCU40_IN0_CCU80_ST3 7 +#define CCU40_IN0_ERU0_IOUT0 10 +#define CCU40_IN0_ERU0_PDOUT0 9 +#define CCU40_IN0_ERU0_PDOUT1 3 +#define CCU40_IN0_ERU1_IOUT0 23 +#define CCU40_IN0_ERU1_PDOUT0 22 +#define CCU40_IN0_ERU1_PDOUT1 24 +#define CCU40_IN0_P0_0 2 +#define CCU40_IN0_P0_12 0 +#define CCU40_IN0_P0_6 1 +#define CCU40_IN0_P4_0 26 +#define CCU40_IN0_P4_8 21 +#define CCU40_IN0_POSIF0_OUT0 4 +#define CCU40_IN0_POSIF0_OUT1 5 +#define CCU40_IN0_POSIF0_OUT3 6 +#define CCU40_IN0_SCU_ACMP0_OUT 18 +#define CCU40_IN0_SCU_ACMP1_OUT 17 +#define CCU40_IN0_SCU_GSC40 8 +#define CCU40_IN0_U0C0_DX2INS 11 +#define CCU40_IN1_BCCU0_OUT3 25 +#define CCU40_IN1_BCCU0_OUT8 16 +#define CCU40_IN1_CCU40_GP02 12 +#define CCU40_IN1_CCU40_SR1 27 +#define CCU40_IN1_CCU40_SR2 19 +#define CCU40_IN1_CCU40_ST0 13 +#define CCU40_IN1_CCU40_ST1 20 +#define CCU40_IN1_CCU40_ST2 14 +#define CCU40_IN1_CCU40_ST3 15 +#define CCU40_IN1_ERU0_IOUT1 10 +#define CCU40_IN1_ERU0_PDOUT0 3 +#define CCU40_IN1_ERU0_PDOUT1 9 +#define CCU40_IN1_ERU1_IOUT1 23 +#define CCU40_IN1_ERU1_PDOUT0 24 +#define CCU40_IN1_ERU1_PDOUT1 22 +#define CCU40_IN1_P0_1 2 +#define CCU40_IN1_P0_12 0 +#define CCU40_IN1_P0_7 1 +#define CCU40_IN1_P4_1 26 +#define CCU40_IN1_P4_9 21 +#define CCU40_IN1_POSIF0_OUT0 4 +#define CCU40_IN1_POSIF0_OUT1 5 +#define CCU40_IN1_POSIF0_OUT3 6 +#define CCU40_IN1_POSIF0_OUT4 7 +#define CCU40_IN1_SCU_ACMP2_OUT 18 +#define CCU40_IN1_SCU_ACMP3_OUT 17 +#define CCU40_IN1_SCU_GSC40 8 +#define CCU40_IN1_U0C1_DX2INS 11 +#define CCU40_IN2_BCCU0_OUT4 16 +#define CCU40_IN2_BCCU0_OUT7 25 +#define CCU40_IN2_CCU40_GP03 12 +#define CCU40_IN2_CCU40_SR1 19 +#define CCU40_IN2_CCU40_SR2 27 +#define CCU40_IN2_CCU40_ST0 13 +#define CCU40_IN2_CCU40_ST1 14 +#define CCU40_IN2_CCU40_ST2 20 +#define CCU40_IN2_CCU40_ST3 15 +#define CCU40_IN2_ERU0_IOUT2 10 +#define CCU40_IN2_ERU0_PDOUT2 9 +#define CCU40_IN2_ERU0_PDOUT3 3 +#define CCU40_IN2_ERU1_IOUT2 23 +#define CCU40_IN2_ERU1_PDOUT2 22 +#define CCU40_IN2_ERU1_PDOUT3 24 +#define CCU40_IN2_LEDTS0_SR 11 +#define CCU40_IN2_P0_12 0 +#define CCU40_IN2_P0_2 2 +#define CCU40_IN2_P0_8 1 +#define CCU40_IN2_P4_10 21 +#define CCU40_IN2_P4_2 26 +#define CCU40_IN2_POSIF0_OUT0 28 +#define CCU40_IN2_POSIF0_OUT1 4 +#define CCU40_IN2_POSIF0_OUT2 5 +#define CCU40_IN2_POSIF0_OUT3 6 +#define CCU40_IN2_POSIF0_OUT4 7 +#define CCU40_IN2_SCU_ACMP1_OUT 18 +#define CCU40_IN2_SCU_ACMP2_OUT 17 +#define CCU40_IN2_SCU_GSC40 8 +#define CCU40_IN3_BCCU0_OUT1 25 +#define CCU40_IN3_BCCU0_OUT5 16 +#define CCU40_IN3_CCU40_GP00 12 +#define CCU40_IN3_CCU40_SR1 19 +#define CCU40_IN3_CCU40_SR3 27 +#define CCU40_IN3_CCU40_ST0 13 +#define CCU40_IN3_CCU40_ST1 14 +#define CCU40_IN3_CCU40_ST2 15 +#define CCU40_IN3_CCU40_ST3 20 +#define CCU40_IN3_CCU80_IGBTO 7 +#define CCU40_IN3_ERU0_IOUT3 10 +#define CCU40_IN3_ERU0_PDOUT2 3 +#define CCU40_IN3_ERU0_PDOUT3 9 +#define CCU40_IN3_ERU1_IOUT3 23 +#define CCU40_IN3_ERU1_PDOUT2 24 +#define CCU40_IN3_ERU1_PDOUT3 22 +#define CCU40_IN3_LEDTS1_SR 11 +#define CCU40_IN3_P0_12 0 +#define CCU40_IN3_P0_3 2 +#define CCU40_IN3_P0_9 1 +#define CCU40_IN3_P4_11 21 +#define CCU40_IN3_P4_3 26 +#define CCU40_IN3_POSIF0_OUT0 28 +#define CCU40_IN3_POSIF0_OUT1 29 +#define CCU40_IN3_POSIF0_OUT3 4 +#define CCU40_IN3_POSIF0_OUT5 5 +#define CCU40_IN3_SCU_ACMP0_OUT 17 +#define CCU40_IN3_SCU_ACMP3_OUT 18 +#define CCU40_IN3_SCU_GSC40 8 +#define CCU40_IN3_VADC0_G0ARBCNT 6 +#define CCU41_IN0_BCCU0_OUT0 16 +#define CCU41_IN0_BCCU0_OUT6 25 +#define CCU41_IN0_CCU41_GP01 12 +#define CCU41_IN0_CCU41_SR0 27 +#define CCU41_IN0_CCU41_SR2 19 +#define CCU41_IN0_CCU41_ST0 20 +#define CCU41_IN0_CCU41_ST1 13 +#define CCU41_IN0_CCU41_ST2 14 +#define CCU41_IN0_CCU41_ST3 15 +#define CCU41_IN0_CCU81_ST3 7 +#define CCU41_IN0_ERU0_IOUT0 10 +#define CCU41_IN0_ERU0_PDOUT0 9 +#define CCU41_IN0_ERU0_PDOUT1 3 +#define CCU41_IN0_ERU1_IOUT0 23 +#define CCU41_IN0_ERU1_PDOUT0 22 +#define CCU41_IN0_ERU1_PDOUT1 24 +#define CCU41_IN0_P0_4 1 +#define CCU41_IN0_P3_0 0 +#define CCU41_IN0_P4_0 2 +#define CCU41_IN0_P4_4 21 +#define CCU41_IN0_P4_8 26 +#define CCU41_IN0_POSIF1_OUT0 4 +#define CCU41_IN0_POSIF1_OUT1 5 +#define CCU41_IN0_POSIF1_OUT3 6 +#define CCU41_IN0_SCU_ACMP0_OUT 18 +#define CCU41_IN0_SCU_ACMP1_OUT 17 +#define CCU41_IN0_SCU_GSC40 8 +#define CCU41_IN0_U1C0_DX2INS 28 +#define CCU41_IN1_BCCU0_OUT1 16 +#define CCU41_IN1_BCCU0_OUT3 25 +#define CCU41_IN1_CCU40_ST1 11 +#define CCU41_IN1_CCU41_GP02 12 +#define CCU41_IN1_CCU41_SR1 27 +#define CCU41_IN1_CCU41_SR2 19 +#define CCU41_IN1_CCU41_ST0 13 +#define CCU41_IN1_CCU41_ST1 20 +#define CCU41_IN1_CCU41_ST2 14 +#define CCU41_IN1_CCU41_ST3 15 +#define CCU41_IN1_ERU0_IOUT1 10 +#define CCU41_IN1_ERU0_PDOUT0 3 +#define CCU41_IN1_ERU0_PDOUT1 9 +#define CCU41_IN1_ERU1_IOUT1 23 +#define CCU41_IN1_ERU1_PDOUT0 24 +#define CCU41_IN1_ERU1_PDOUT1 22 +#define CCU41_IN1_P0_5 1 +#define CCU41_IN1_P3_0 0 +#define CCU41_IN1_P4_1 2 +#define CCU41_IN1_P4_5 21 +#define CCU41_IN1_P4_9 26 +#define CCU41_IN1_POSIF1_OUT0 4 +#define CCU41_IN1_POSIF1_OUT1 5 +#define CCU41_IN1_POSIF1_OUT3 6 +#define CCU41_IN1_POSIF1_OUT4 7 +#define CCU41_IN1_SCU_ACMP2_OUT 18 +#define CCU41_IN1_SCU_ACMP3_OUT 17 +#define CCU41_IN1_SCU_GSC40 8 +#define CCU41_IN1_U1C1_DX2INS 28 +#define CCU41_IN2_BCCU0_OUT2 16 +#define CCU41_IN2_BCCU0_OUT7 25 +#define CCU41_IN2_CCU40_ST2 11 +#define CCU41_IN2_CCU41_GP03 12 +#define CCU41_IN2_CCU41_SR1 19 +#define CCU41_IN2_CCU41_SR2 27 +#define CCU41_IN2_CCU41_ST0 13 +#define CCU41_IN2_CCU41_ST1 14 +#define CCU41_IN2_CCU41_ST2 20 +#define CCU41_IN2_CCU41_ST3 15 +#define CCU41_IN2_ERU0_IOUT2 10 +#define CCU41_IN2_ERU0_PDOUT2 9 +#define CCU41_IN2_ERU0_PDOUT3 3 +#define CCU41_IN2_ERU1_IOUT2 23 +#define CCU41_IN2_ERU1_PDOUT2 22 +#define CCU41_IN2_ERU1_PDOUT3 24 +#define CCU41_IN2_P0_6 1 +#define CCU41_IN2_P3_0 0 +#define CCU41_IN2_P4_10 26 +#define CCU41_IN2_P4_2 2 +#define CCU41_IN2_P4_6 21 +#define CCU41_IN2_POSIF1_OUT0 28 +#define CCU41_IN2_POSIF1_OUT1 4 +#define CCU41_IN2_POSIF1_OUT2 5 +#define CCU41_IN2_POSIF1_OUT3 6 +#define CCU41_IN2_POSIF1_OUT4 7 +#define CCU41_IN2_SCU_ACMP1_OUT 18 +#define CCU41_IN2_SCU_ACMP2_OUT 17 +#define CCU41_IN2_SCU_GSC40 8 +#define CCU41_IN3_BCCU0_OUT5 16 +#define CCU41_IN3_BCCU0_OUT8 25 +#define CCU41_IN3_CCU40_ST3 11 +#define CCU41_IN3_CCU41_SR1 19 +#define CCU41_IN3_CCU41_SR3 27 +#define CCU41_IN3_CCU41_ST0 13 +#define CCU41_IN3_CCU41_ST1 14 +#define CCU41_IN3_CCU41_ST2 15 +#define CCU41_IN3_CCU41_ST3 20 +#define CCU41_IN3_CCU81_IGBTO 7 +#define CCU41_IN3_ERU0_IOUT3 10 +#define CCU41_IN3_ERU0_PDOUT2 3 +#define CCU41_IN3_ERU0_PDOUT3 9 +#define CCU41_IN3_ERU1_IOUT3 23 +#define CCU41_IN3_ERU1_PDOUT2 24 +#define CCU41_IN3_ERU1_PDOUT3 22 +#define CCU41_IN3_P0_7 1 +#define CCU41_IN3_P3_0 0 +#define CCU41_IN3_P4_11 26 +#define CCU41_IN3_P4_3 2 +#define CCU41_IN3_P4_7 21 +#define CCU41_IN3_POSIF1_OUT0 28 +#define CCU41_IN3_POSIF1_OUT1 29 +#define CCU41_IN3_POSIF1_OUT3 4 +#define CCU41_IN3_POSIF1_OUT5 5 +#define CCU41_IN3_SCU_ACMP0_OUT 17 +#define CCU41_IN3_SCU_ACMP3_OUT 18 +#define CCU41_IN3_SCU_GSC40 8 +#define CCU41_IN3_VADC0_G0ARBCNT 6 +#endif + +#endif /* XMC1_CCU4_MAP_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_ccu8_map.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_ccu8_map.h new file mode 100644 index 00000000..475e1291 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_ccu8_map.h @@ -0,0 +1,2267 @@ +/** + * @file xmc1_ccu8_map.h + * @date 2015-08-25 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-08-25: + * - Initial version + * + * @endcond + */ + +#ifndef XMC1_CCU8_MAP_H +#define XMC1_CCU8_MAP_H + +#if UC_SERIES != XMC14 +#define XMC_CCU8_SLICE_INPUT_A (0U) +#define XMC_CCU8_SLICE_INPUT_B (1U) +#define XMC_CCU8_SLICE_INPUT_C (2U) +#define XMC_CCU8_SLICE_INPUT_D (3U) +#define XMC_CCU8_SLICE_INPUT_E (4U) +#define XMC_CCU8_SLICE_INPUT_F (5U) +#define XMC_CCU8_SLICE_INPUT_G (6U) +#define XMC_CCU8_SLICE_INPUT_H (7U) +#define XMC_CCU8_SLICE_INPUT_I (8U) +#define XMC_CCU8_SLICE_INPUT_J (9U) +#define XMC_CCU8_SLICE_INPUT_K (10U) +#define XMC_CCU8_SLICE_INPUT_L (11U) +#define XMC_CCU8_SLICE_INPUT_M (12U) +#define XMC_CCU8_SLICE_INPUT_N (13U) +#define XMC_CCU8_SLICE_INPUT_O (14U) +#define XMC_CCU8_SLICE_INPUT_P (15U) +#else +#define XMC_CCU8_SLICE_INPUT_AA (0U) +#define XMC_CCU8_SLICE_INPUT_AB (1U) +#define XMC_CCU8_SLICE_INPUT_AC (2U) +#define XMC_CCU8_SLICE_INPUT_AD (3U) +#define XMC_CCU8_SLICE_INPUT_AE (4U) +#define XMC_CCU8_SLICE_INPUT_AF (5U) +#define XMC_CCU8_SLICE_INPUT_AG (6U) +#define XMC_CCU8_SLICE_INPUT_AH (7U) +#define XMC_CCU8_SLICE_INPUT_AI (8U) +#define XMC_CCU8_SLICE_INPUT_AJ (9U) +#define XMC_CCU8_SLICE_INPUT_AK (10U) +#define XMC_CCU8_SLICE_INPUT_AL (11U) +#define XMC_CCU8_SLICE_INPUT_AM (12U) +#define XMC_CCU8_SLICE_INPUT_AN (13U) +#define XMC_CCU8_SLICE_INPUT_AO (14U) +#define XMC_CCU8_SLICE_INPUT_AP (15U) +#define XMC_CCU8_SLICE_INPUT_AQ (16U) +#define XMC_CCU8_SLICE_INPUT_AR (17U) +#define XMC_CCU8_SLICE_INPUT_AS (18U) +#define XMC_CCU8_SLICE_INPUT_AT (19U) +#define XMC_CCU8_SLICE_INPUT_AU (20U) +#define XMC_CCU8_SLICE_INPUT_AV (21U) +#define XMC_CCU8_SLICE_INPUT_AW (22U) +#define XMC_CCU8_SLICE_INPUT_AX (23U) +#define XMC_CCU8_SLICE_INPUT_AY (24U) +#define XMC_CCU8_SLICE_INPUT_AZ (25U) +#define XMC_CCU8_SLICE_INPUT_BA (26U) +#define XMC_CCU8_SLICE_INPUT_BB (27U) +#define XMC_CCU8_SLICE_INPUT_BC (28U) +#define XMC_CCU8_SLICE_INPUT_BD (29U) +#define XMC_CCU8_SLICE_INPUT_BE (30U) +#define XMC_CCU8_SLICE_INPUT_BF (31U) +#define XMC_CCU8_SLICE_INPUT_BG (32U) +#define XMC_CCU8_SLICE_INPUT_BH (33U) +#define XMC_CCU8_SLICE_INPUT_BI (34U) +#define XMC_CCU8_SLICE_INPUT_BJ (35U) +#define XMC_CCU8_SLICE_INPUT_BK (36U) +#define XMC_CCU8_SLICE_INPUT_BL (37U) +#define XMC_CCU8_SLICE_INPUT_BM (38U) +#define XMC_CCU8_SLICE_INPUT_BN (39U) +#define XMC_CCU8_SLICE_INPUT_BO (40U) +#define XMC_CCU8_SLICE_INPUT_BP (41U) +#define XMC_CCU8_SLICE_INPUT_BQ (42U) +#define XMC_CCU8_SLICE_INPUT_BR (43U) +#define XMC_CCU8_SLICE_INPUT_BS (44U) +#define XMC_CCU8_SLICE_INPUT_BT (45U) +#define XMC_CCU8_SLICE_INPUT_BU (46U) +#define XMC_CCU8_SLICE_INPUT_BV (47U) +#endif + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN24) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN40) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP16) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP38) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN24) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN40) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP16) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP28) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP38) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0 13 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1 14 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == LQFP64) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_P4_0 20 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_P4_1 20 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_P4_2 20 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_ACMP3_OUT 18 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_P4_3 20 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_ACMP3_OUT 17 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_P3_0 0 +#define CCU81_IN0_P4_6 1 +#define CCU81_IN0_POSIF1_OUT2 3 +#define CCU81_IN0_POSIF1_OUT5 4 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_P3_0 0 +#define CCU81_IN1_P4_2 1 +#define CCU81_IN1_POSIF1_OUT2 3 +#define CCU81_IN1_POSIF1_OUT5 4 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_P3_0 0 +#define CCU81_IN2_POSIF1_OUT2 3 +#define CCU81_IN2_POSIF1_OUT5 4 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_ACMP3_OUT 18 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_P3_0 0 +#define CCU81_IN3_P4_10 1 +#define CCU81_IN3_POSIF1_OUT2 3 +#define CCU81_IN3_POSIF1_OUT5 4 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_ACMP3_OUT 17 +#define CCU81_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN40) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN48) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_ACMP3_OUT 18 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_ACMP3_OUT 17 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_P3_0 0 +#define CCU81_IN0_P4_6 1 +#define CCU81_IN0_POSIF1_OUT2 3 +#define CCU81_IN0_POSIF1_OUT5 4 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_P3_0 0 +#define CCU81_IN1_POSIF1_OUT2 3 +#define CCU81_IN1_POSIF1_OUT5 4 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_P3_0 0 +#define CCU81_IN2_POSIF1_OUT2 3 +#define CCU81_IN2_POSIF1_OUT5 4 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_ACMP3_OUT 18 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_P3_0 0 +#define CCU81_IN3_POSIF1_OUT2 3 +#define CCU81_IN3_POSIF1_OUT5 4 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_ACMP3_OUT 17 +#define CCU81_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN64) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_P4_0 20 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_P4_1 20 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_P4_2 20 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_ACMP3_OUT 18 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_P4_3 20 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_ACMP3_OUT 17 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_P3_0 0 +#define CCU81_IN0_P4_6 1 +#define CCU81_IN0_POSIF1_OUT2 3 +#define CCU81_IN0_POSIF1_OUT5 4 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_P3_0 0 +#define CCU81_IN1_P4_2 1 +#define CCU81_IN1_POSIF1_OUT2 3 +#define CCU81_IN1_POSIF1_OUT5 4 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_P3_0 0 +#define CCU81_IN2_POSIF1_OUT2 3 +#define CCU81_IN2_POSIF1_OUT5 4 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_ACMP3_OUT 18 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_P3_0 0 +#define CCU81_IN3_P4_10 1 +#define CCU81_IN3_POSIF1_OUT2 3 +#define CCU81_IN3_POSIF1_OUT5 4 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_ACMP3_OUT 17 +#define CCU81_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == TSSOP38) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == LQFP64) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_P4_0 20 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_P4_1 20 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_P4_2 20 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_ACMP3_OUT 18 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_P4_3 20 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_ACMP3_OUT 17 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_P3_0 0 +#define CCU81_IN0_P4_6 1 +#define CCU81_IN0_POSIF1_OUT2 3 +#define CCU81_IN0_POSIF1_OUT5 4 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_P3_0 0 +#define CCU81_IN1_P4_2 1 +#define CCU81_IN1_POSIF1_OUT2 3 +#define CCU81_IN1_POSIF1_OUT5 4 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_P3_0 0 +#define CCU81_IN2_POSIF1_OUT2 3 +#define CCU81_IN2_POSIF1_OUT5 4 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_ACMP3_OUT 18 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_P3_0 0 +#define CCU81_IN3_P4_10 1 +#define CCU81_IN3_POSIF1_OUT2 3 +#define CCU81_IN3_POSIF1_OUT5 4 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_ACMP3_OUT 17 +#define CCU81_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN48) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_ACMP3_OUT 18 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_ACMP3_OUT 17 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_P3_0 0 +#define CCU81_IN0_P4_6 1 +#define CCU81_IN0_POSIF1_OUT2 3 +#define CCU81_IN0_POSIF1_OUT5 4 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_P3_0 0 +#define CCU81_IN1_POSIF1_OUT2 3 +#define CCU81_IN1_POSIF1_OUT5 4 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_P3_0 0 +#define CCU81_IN2_POSIF1_OUT2 3 +#define CCU81_IN2_POSIF1_OUT5 4 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_ACMP3_OUT 18 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_P3_0 0 +#define CCU81_IN3_POSIF1_OUT2 3 +#define CCU81_IN3_POSIF1_OUT5 4 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_ACMP3_OUT 17 +#define CCU81_IN3_SCU_GSC80 7 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN64) +#define CCU80_IN0_BCCU0_OUT0 8 +#define CCU80_IN0_BCCU0_OUT1 9 +#define CCU80_IN0_BCCU0_OUT2 16 +#define CCU80_IN0_CCU40_GP2 2 +#define CCU80_IN0_CCU40_SR2 10 +#define CCU80_IN0_CCU80_ST0 19 +#define CCU80_IN0_CCU80_ST1 13 +#define CCU80_IN0_CCU80_ST2 14 +#define CCU80_IN0_CCU80_ST3 15 +#define CCU80_IN0_CCU80_ST3B 24 +#define CCU80_IN0_CCU81_GP0 12 +#define CCU80_IN0_ERU0_IOUT0 6 +#define CCU80_IN0_ERU0_PDOUT0 5 +#define CCU80_IN0_ERU0_PDOUT1 11 +#define CCU80_IN0_ERU1_IOUT0 22 +#define CCU80_IN0_ERU1_PDOUT0 21 +#define CCU80_IN0_ERU1_PDOUT1 23 +#define CCU80_IN0_P0_12 0 +#define CCU80_IN0_P0_4 1 +#define CCU80_IN0_P4_0 20 +#define CCU80_IN0_POSIF0_OUT2 3 +#define CCU80_IN0_POSIF0_OUT5 4 +#define CCU80_IN0_SCU_ACMP1_OUT 17 +#define CCU80_IN0_SCU_ACMP2_OUT 18 +#define CCU80_IN0_SCU_GSC80 7 +#define CCU80_IN1_BCCU0_OUT2 8 +#define CCU80_IN1_BCCU0_OUT3 9 +#define CCU80_IN1_BCCU0_OUT7 16 +#define CCU80_IN1_CCU40_SR2 10 +#define CCU80_IN1_CCU41_GP2 2 +#define CCU80_IN1_CCU80_ST0B 24 +#define CCU80_IN1_CCU80_ST1 19 +#define CCU80_IN1_CCU80_ST2 14 +#define CCU80_IN1_CCU80_ST3 15 +#define CCU80_IN1_CCU82_GP0 12 +#define CCU80_IN1_ERU0_IOUT1 6 +#define CCU80_IN1_ERU0_PDOUT0 11 +#define CCU80_IN1_ERU0_PDOUT1 5 +#define CCU80_IN1_ERU1_IOUT1 22 +#define CCU80_IN1_ERU1_PDOUT0 23 +#define CCU80_IN1_ERU1_PDOUT1 21 +#define CCU80_IN1_P0_12 0 +#define CCU80_IN1_P0_5 1 +#define CCU80_IN1_P4_1 20 +#define CCU80_IN1_POSIF0_OUT2 3 +#define CCU80_IN1_POSIF0_OUT5 4 +#define CCU80_IN1_SCU_ACMP1_OUT 18 +#define CCU80_IN1_SCU_ACMP2_OUT 17 +#define CCU80_IN1_SCU_GSC80 7 +#define CCU80_IN2_BCCU0_OUT1 16 +#define CCU80_IN2_BCCU0_OUT4 8 +#define CCU80_IN2_BCCU0_OUT5 9 +#define CCU80_IN2_CCU40_SR3 10 +#define CCU80_IN2_CCU42_GP2 2 +#define CCU80_IN2_CCU80_ST0 13 +#define CCU80_IN2_CCU80_ST1B 24 +#define CCU80_IN2_CCU80_ST2 19 +#define CCU80_IN2_CCU80_ST3 15 +#define CCU80_IN2_CCU83_GP0 12 +#define CCU80_IN2_ERU0_IOUT2 6 +#define CCU80_IN2_ERU0_PDOUT0 11 +#define CCU80_IN2_ERU0_PDOUT2 5 +#define CCU80_IN2_ERU1_IOUT2 22 +#define CCU80_IN2_ERU1_PDOUT0 23 +#define CCU80_IN2_ERU1_PDOUT2 21 +#define CCU80_IN2_P0_10 1 +#define CCU80_IN2_P0_12 0 +#define CCU80_IN2_P4_2 20 +#define CCU80_IN2_POSIF0_OUT2 3 +#define CCU80_IN2_POSIF0_OUT5 4 +#define CCU80_IN2_SCU_ACMP0_OUT 17 +#define CCU80_IN2_SCU_ACMP3_OUT 18 +#define CCU80_IN2_SCU_GSC80 7 +#define CCU80_IN3_BCCU0_OUT6 8 +#define CCU80_IN3_BCCU0_OUT7 9 +#define CCU80_IN3_BCCU0_OUT8 16 +#define CCU80_IN3_CCU40_SR3 10 +#define CCU80_IN3_CCU43_GP2 2 +#define CCU80_IN3_CCU80_GP0 12 +#define CCU80_IN3_CCU80_ST0 13 +#define CCU80_IN3_CCU80_ST1 14 +#define CCU80_IN3_CCU80_ST2 15 +#define CCU80_IN3_CCU80_ST2B 24 +#define CCU80_IN3_CCU80_ST3 19 +#define CCU80_IN3_ERU0_IOUT3 6 +#define CCU80_IN3_ERU0_PDOUT0 11 +#define CCU80_IN3_ERU0_PDOUT3 5 +#define CCU80_IN3_ERU1_IOUT3 22 +#define CCU80_IN3_ERU1_PDOUT0 23 +#define CCU80_IN3_ERU1_PDOUT3 21 +#define CCU80_IN3_P0_12 0 +#define CCU80_IN3_P0_13 1 +#define CCU80_IN3_P4_3 20 +#define CCU80_IN3_POSIF0_OUT2 3 +#define CCU80_IN3_POSIF0_OUT5 4 +#define CCU80_IN3_SCU_ACMP0_OUT 18 +#define CCU80_IN3_SCU_ACMP3_OUT 17 +#define CCU80_IN3_SCU_GSC80 7 +#define CCU81_IN0_BCCU0_OUT0 8 +#define CCU81_IN0_BCCU0_OUT6 9 +#define CCU81_IN0_CCU40_GP2 2 +#define CCU81_IN0_CCU41_SR2 10 +#define CCU81_IN0_CCU81_GP0 12 +#define CCU81_IN0_CCU81_SR0 16 +#define CCU81_IN0_CCU81_ST0 19 +#define CCU81_IN0_CCU81_ST1 13 +#define CCU81_IN0_CCU81_ST2 14 +#define CCU81_IN0_CCU81_ST3 15 +#define CCU81_IN0_CCU81_ST3B 24 +#define CCU81_IN0_ERU0_IOUT0 6 +#define CCU81_IN0_ERU0_PDOUT0 5 +#define CCU81_IN0_ERU0_PDOUT1 11 +#define CCU81_IN0_ERU1_IOUT0 22 +#define CCU81_IN0_ERU1_PDOUT0 21 +#define CCU81_IN0_ERU1_PDOUT1 23 +#define CCU81_IN0_P0_12 20 +#define CCU81_IN0_P3_0 0 +#define CCU81_IN0_P4_6 1 +#define CCU81_IN0_POSIF1_OUT2 3 +#define CCU81_IN0_POSIF1_OUT5 4 +#define CCU81_IN0_SCU_ACMP0_OUT 18 +#define CCU81_IN0_SCU_ACMP1_OUT 17 +#define CCU81_IN0_SCU_GSC80 7 +#define CCU81_IN1_BCCU0_OUT4 8 +#define CCU81_IN1_BCCU0_OUT7 9 +#define CCU81_IN1_CCU41_GP2 2 +#define CCU81_IN1_CCU41_SR2 10 +#define CCU81_IN1_CCU81_SR1 16 +#define CCU81_IN1_CCU81_ST0 13 +#define CCU81_IN1_CCU81_ST0B 24 +#define CCU81_IN1_CCU81_ST1 19 +#define CCU81_IN1_CCU81_ST2 14 +#define CCU81_IN1_CCU81_ST3 15 +#define CCU81_IN1_CCU82_GP0 12 +#define CCU81_IN1_ERU0_IOUT1 6 +#define CCU81_IN1_ERU0_PDOUT0 11 +#define CCU81_IN1_ERU0_PDOUT1 5 +#define CCU81_IN1_ERU1_IOUT1 22 +#define CCU81_IN1_ERU1_PDOUT0 23 +#define CCU81_IN1_ERU1_PDOUT1 21 +#define CCU81_IN1_P0_13 20 +#define CCU81_IN1_P3_0 0 +#define CCU81_IN1_P4_2 1 +#define CCU81_IN1_POSIF1_OUT2 3 +#define CCU81_IN1_POSIF1_OUT5 4 +#define CCU81_IN1_SCU_ACMP1_OUT 18 +#define CCU81_IN1_SCU_ACMP2_OUT 17 +#define CCU81_IN1_SCU_GSC80 7 +#define CCU81_IN2_BCCU0_OUT1 9 +#define CCU81_IN2_BCCU0_OUT5 8 +#define CCU81_IN2_CCU41_SR3 10 +#define CCU81_IN2_CCU42_GP2 2 +#define CCU81_IN2_CCU81_SR2 16 +#define CCU81_IN2_CCU81_ST0 13 +#define CCU81_IN2_CCU81_ST1 14 +#define CCU81_IN2_CCU81_ST1B 24 +#define CCU81_IN2_CCU81_ST2 19 +#define CCU81_IN2_CCU81_ST3 15 +#define CCU81_IN2_CCU83_GP0 12 +#define CCU81_IN2_ERU0_IOUT2 6 +#define CCU81_IN2_ERU0_PDOUT0 11 +#define CCU81_IN2_ERU0_PDOUT2 5 +#define CCU81_IN2_ERU1_IOUT2 22 +#define CCU81_IN2_ERU1_PDOUT0 23 +#define CCU81_IN2_ERU1_PDOUT2 21 +#define CCU81_IN2_P0_10 1 +#define CCU81_IN2_P0_14 20 +#define CCU81_IN2_P3_0 0 +#define CCU81_IN2_POSIF1_OUT2 3 +#define CCU81_IN2_POSIF1_OUT5 4 +#define CCU81_IN2_SCU_ACMP0_OUT 17 +#define CCU81_IN2_SCU_ACMP3_OUT 18 +#define CCU81_IN2_SCU_GSC80 7 +#define CCU81_IN3_BCCU0_OUT2 9 +#define CCU81_IN3_BCCU0_OUT8 8 +#define CCU81_IN3_CCU41_SR3 10 +#define CCU81_IN3_CCU43_GP2 2 +#define CCU81_IN3_CCU80_GP0 12 +#define CCU81_IN3_CCU81_SR3 16 +#define CCU81_IN3_CCU81_ST0 13 +#define CCU81_IN3_CCU81_ST1 14 +#define CCU81_IN3_CCU81_ST2 15 +#define CCU81_IN3_CCU81_ST2B 24 +#define CCU81_IN3_CCU81_ST3 19 +#define CCU81_IN3_ERU0_IOUT3 6 +#define CCU81_IN3_ERU0_PDOUT0 11 +#define CCU81_IN3_ERU0_PDOUT3 5 +#define CCU81_IN3_ERU1_IOUT3 22 +#define CCU81_IN3_ERU1_PDOUT0 23 +#define CCU81_IN3_ERU1_PDOUT3 21 +#define CCU81_IN3_P0_15 20 +#define CCU81_IN3_P3_0 0 +#define CCU81_IN3_P4_10 1 +#define CCU81_IN3_POSIF1_OUT2 3 +#define CCU81_IN3_POSIF1_OUT5 4 +#define CCU81_IN3_SCU_ACMP2_OUT 18 +#define CCU81_IN3_SCU_ACMP3_OUT 17 +#define CCU81_IN3_SCU_GSC80 7 +#endif + +#endif /* XMC1_CCU8_MAP_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_eru_map.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_eru_map.h new file mode 100644 index 00000000..ce1757f8 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_eru_map.h @@ -0,0 +1,1894 @@ +/** + * @file xmc1_eru_map.h + * @date 2015-08-25 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial version + * + * 2015-08-25: + * - Added support for XMC1400 devices + * + * @endcond + */ +#ifndef XMC1_ERU_MAP_H +#define XMC1_ERU_MAP_H + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ +#define ERU0_ETL0 XMC_ERU0, 0 +#define ERU0_ETL1 XMC_ERU0, 1 +#define ERU0_ETL2 XMC_ERU0, 2 +#define ERU0_ETL3 XMC_ERU0, 3 + +#define ERU0_OGU0 XMC_ERU0, 0 +#define ERU0_OGU1 XMC_ERU0, 1 +#define ERU0_OGU2 XMC_ERU0, 2 +#define ERU0_OGU3 XMC_ERU0, 3 + +#if defined(ERU1) +#define ERU1_ETL0 XMC_ERU1, 0 +#define ERU1_ETL1 XMC_ERU1, 1 +#define ERU1_ETL2 XMC_ERU1, 2 +#define ERU1_ETL3 XMC_ERU1, 3 + +#define ERU1_OGU0 XMC_ERU1, 0 +#define ERU1_OGU1 XMC_ERU1, 1 +#define ERU1_OGU2 XMC_ERU1, 2 +#define ERU1_OGU3 XMC_ERU1, 3 +#endif + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN24) +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN40) +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP16) +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP38) +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1200) && (UC_PACKAGE == TSSOP38) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == VQFN40) +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP28) +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP38) +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN24) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN40) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP16) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP28) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN24) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN40) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP16) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP38) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN24) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN40) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP16) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP28) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP38) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == LQFP64) +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_P3_1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL1_INPUTA_P3_3 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_P3_2 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL2_INPUTA_P3_4 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == VQFN48) +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == LQFP64) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL1_INPUTA_P3_1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL1_INPUTA_P3_3 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTA_P3_2 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL2_INPUTA_P3_4 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTA_POSIF1_SR1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN40) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN48) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTA_POSIF1_SR1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN64) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL1_INPUTA_P3_1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL1_INPUTA_P3_3 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTA_P3_2 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL2_INPUTA_P3_4 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTA_POSIF1_SR1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == TSSOP38) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN40) +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CAN0_SR4 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CAN0_SR5 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CAN0_SR6 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CAN0_SR7 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN48) +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CAN0_SR4 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CAN0_SR5 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CAN0_SR6 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CAN0_SR7 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN64) +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_P3_1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL1_INPUTA_P3_3 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_P3_2 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL2_INPUTA_P3_4 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CAN0_SR4 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CAN0_SR5 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CAN0_SR6 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CAN0_SR7 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == LQFP64) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL1_INPUTA_P3_1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL1_INPUTA_P3_3 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTA_P3_2 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL2_INPUTA_P3_4 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTA_POSIF1_SR1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CAN0_SR4 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CAN0_SR5 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CAN0_SR6 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CAN0_SR7 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN48) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTA_POSIF1_SR1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CAN0_SR4 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CAN0_SR5 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CAN0_SR6 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CAN0_SR7 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN64) +#define ERU0_ETL0_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL0_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL0_INPUTA_P2_4 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL0_INPUTA_VADC0_G0BFLOUT0 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL0_INPUTB_ACMP0_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL0_INPUTB_P2_0 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL0_INPUTB_P2_2 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL0_INPUTB_VADC0_G1BFLOUT0 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL1_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL1_INPUTA_P2_5 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL1_INPUTA_VADC0_G0BFLOUT1 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL1_INPUTB_ACMP1_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL1_INPUTB_P2_1 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL1_INPUTB_P2_3 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL1_INPUTB_VADC0_G1BFLOUT1 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL2_INPUTA_ACMP4_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL2_INPUTA_P2_6 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL2_INPUTA_VADC0_G0BFLOUT2 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL2_INPUTB_ACMP2_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL2_INPUTB_P2_10 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL2_INPUTB_P2_11 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL2_INPUTB_VADC0_G1BFLOUT2 XMC_ERU_ETL_INPUT_B3 +#define ERU0_ETL3_INPUTA_ACMP5_OUT XMC_ERU_ETL_INPUT_A2 +#define ERU0_ETL3_INPUTA_ACMP7_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU0_ETL3_INPUTA_P2_7 XMC_ERU_ETL_INPUT_A1 +#define ERU0_ETL3_INPUTA_VADC0_G0BFLOUT3 XMC_ERU_ETL_INPUT_A3 +#define ERU0_ETL3_INPUTB_ACMP6_OUT XMC_ERU_ETL_INPUT_B2 +#define ERU0_ETL3_INPUTB_P2_8 XMC_ERU_ETL_INPUT_B1 +#define ERU0_ETL3_INPUTB_P2_9 XMC_ERU_ETL_INPUT_B0 +#define ERU0_ETL3_INPUTB_VADC0_G1BFLOUT3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL0_INPUTA_ACMP1_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL0_INPUTA_P3_0 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL0_INPUTA_P4_4 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL0_INPUTA_P4_7 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL0_INPUTB_CCU40_ST0 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL0_INPUTB_CCU41_ST0 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL0_INPUTB_CCU80_ST0 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL0_INPUTB_CCU81_ST0 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL1_INPUTA_ACMP3_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL1_INPUTA_P3_1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL1_INPUTA_P3_3 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL1_INPUTA_P4_5 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL1_INPUTB_CCU40_ST1 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL1_INPUTB_CCU41_ST1 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL1_INPUTB_CCU80_ST3 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL1_INPUTB_CCU81_ST3 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL2_INPUTA_ACMP2_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL2_INPUTA_P3_2 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL2_INPUTA_P3_4 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL2_INPUTA_P4_6 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL2_INPUTB_CCU40_ST2 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL2_INPUTB_CCU41_ST2 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL2_INPUTB_CCU80_ST1 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL2_INPUTB_CCU81_ST1 XMC_ERU_ETL_INPUT_B3 +#define ERU1_ETL3_INPUTA_ACMP0_OUT XMC_ERU_ETL_INPUT_A0 +#define ERU1_ETL3_INPUTA_P2_12 XMC_ERU_ETL_INPUT_A2 +#define ERU1_ETL3_INPUTA_P2_13 XMC_ERU_ETL_INPUT_A3 +#define ERU1_ETL3_INPUTA_POSIF1_SR1 XMC_ERU_ETL_INPUT_A1 +#define ERU1_ETL3_INPUTB_CCU40_ST3 XMC_ERU_ETL_INPUT_B0 +#define ERU1_ETL3_INPUTB_CCU41_ST3 XMC_ERU_ETL_INPUT_B1 +#define ERU1_ETL3_INPUTB_CCU80_ST2 XMC_ERU_ETL_INPUT_B2 +#define ERU1_ETL3_INPUTB_CCU81_ST2 XMC_ERU_ETL_INPUT_B3 + +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU0_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU40_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_CCU80_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU1_PERIPHERAL_TRIGGER_VADC_C0SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU40_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU2_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU40_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_CCU80_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU0_OGU3_PERIPHERAL_TRIGGER_VADC_C0SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CAN0_SR4 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU41_SR0 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU0_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CAN0_SR5 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU41_SR1 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU1_PERIPHERAL_TRIGGER_CCU81_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CAN0_SR6 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU41_SR2 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU2_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CAN0_SR7 XMC_ERU_OGU_PERIPHERAL_TRIGGER2 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU41_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER1 +#define ERU1_OGU3_PERIPHERAL_TRIGGER_CCU81_SR3 XMC_ERU_OGU_PERIPHERAL_TRIGGER3 +#endif + +#endif /* XMC1_ERU_MAP_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_flash.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_flash.h new file mode 100644 index 00000000..64406ab5 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_flash.h @@ -0,0 +1,415 @@ +/** + * @file xmc1_flash.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2014-12-10: + * - Initial
+ * 2015-02-20: + * - Updated for Documentation related changes
+ * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * @endcond + * + */ + +#ifndef XMC1_FLASH_H +#define XMC1_FLASH_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ + +#include "xmc_common.h" + +#if UC_FAMILY == XMC1 + +#include + +/** +* @addtogroup XMClib XMC Peripheral Library +* @{ +*/ + +/** +* @addtogroup FLASH +* @{ +*/ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +#define XMC_FLASH_PAGES_PER_SECTOR (16U) /**< Number of pages in a sector. A page consists of 16 blocks.*/ +#define XMC_FLASH_BLOCKS_PER_PAGE (16U) /**< Number of blocks in a page. A block consists of 4 words(16 bytes).*/ + +#define XMC_FLASH_BYTES_PER_SECTOR (4096U) /**< Number of bytes in a sector. (16 pages * 256 bytes = 4096 bytes)*/ +#define XMC_FLASH_BYTES_PER_PAGE (256U) /**< Number of bytes in a page. (16 blocks * 16 bytes = 256 bytes)*/ +#define XMC_FLASH_BYTES_PER_BLOCK (16U) /**< Number of bytes in a block. (128 bits = 16 bytes)*/ + +#define XMC_FLASH_WORDS_PER_SECTOR (1024U) /**< Number of words in a sector. (16 pages * 64 words = 1024 words)*/ +#define XMC_FLASH_WORDS_PER_PAGE (64U) /**< Number of words in a page. (16 blocks * 4 words = 64 words) */ +#define XMC_FLASH_WORDS_PER_BLOCK (4U) /**< Number of words in a block. (128 bit / 32 bit = 4 words) */ + +#define FLASH_BLOCK_ADDR_MASK (15U) /* Bitwise AND with block address is done to check the address alignment. + Applicable to XMC_FLASH_WriteBlocks() and XMC_FLASH_VerifyBlocks() + APIs.*/ +#define FLASH_PAGE_ADDR_MASK (255U) /* Bitwise AND with page address is done to check the address alignment. + Applicable to XMC_FLASH_ErasePages() API.*/ +#define FLASH_SECTOR_ADDR_MASK (4095U) /* Bitwise AND with sector address is done to check the address alignment. + Applicable to XMC_FLASH_EraseSector API.*/ + +#define XMC_FLASH_BASE (0x10001000U) /**< Starting address of flash for XMC1 family of microcontrollers*/ + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +/** + * Defines the status of flash, to verify the flash related API calls. Use type \a XMC_FLASH_STATUS_t for this enum. + * The members defines the respective masked status bits of \a NVMSTATUS register. + */ +typedef enum XMC_FLASH_STATUS +{ + XMC_FLASH_STATUS_OK = 0U, /**< Flash related operation was successfully + completed*/ + XMC_FLASH_STATUS_BUSY = NVM_NVMSTATUS_BUSY_Msk , /**< Cannot execute the flash request because + another operation is in progress*/ + XMC_FLASH_STATUS_SLEEP_MODE = NVM_NVMSTATUS_SLEEP_Msk , /**< Flash is in sleep mode*/ + XMC_FLASH_STATUS_VERIFY_ERROR = NVM_NVMSTATUS_VERR_Msk , /**< Flash reported a verification failure*/ + XMC_FLASH_STATUS_ECC1_READ_ERROR = NVM_NVMSTATUS_ECC1READ_Msk, /**< Flash reports a single bit failure, and it + is automatically corrected.*/ + XMC_FLASH_STATUS_ECC2_READ_ERROR = NVM_NVMSTATUS_ECC2READ_Msk, /**< Flash reported at least two bit failure*/ + XMC_FLASH_STATUS_WRITE_PROTOCOL_ERROR = NVM_NVMSTATUS_WRPERR_Msk , /**< Write/Verify operation on a block is + failed due to protocol violations or write + protected sectors*/ +} XMC_FLASH_STATUS_t; + +/** + * Defines NVM ready interrupt event. Use type \a XMC_FLASH_EVENT_t for this enum. + */ +typedef enum XMC_FLASH_EVENT +{ + XMC_FLASH_EVENT_READY = NVM_NVMCONF_INT_ON_Msk /**< Generates the NVM ready interrupts on flash sequence completion*/ +} XMC_FLASH_EVENT_t; + +/** + * Defines hard read levels for strict data verification. Use type \a XMC_FLASH_HARDREAD_LEVEL_t for this enum. + * These \a hardread levels provide some margin to ensure that the data is really programmed with suitably distinct + * levels for written and erased bits. + */ +typedef enum XMC_FLASH_HARDREAD_LEVEL +{ + XMC_FLASH_HARDREAD_LEVEL_NORMAL = (uint16_t)0x0, /**< No \a hardread level verification enabled (Normal read)*/ + XMC_FLASH_HARDREAD_LEVEL_WRITTEN = (uint16_t)0x1, /**< Enables strict margin compare for written data cells*/ + XMC_FLASH_HARDREAD_LEVEL_ERASED = (uint16_t)0x2 /**< Enables strict margin compare for erased data cells*/ +} XMC_FLASH_HARDREAD_LEVEL_t; + +/********************************************************************************************************************** + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * + * @param address Pointer to the starting address of the flash page from where the erase starts + * @param num_pages Number of pages to be erased.
Range: [1 to (flash size / 256)] + * + * @return None + * + * \parDescription:
+ * Erases a set of flash memory pages.

+ * Erase starts from the specified \a address. + * It erases a maximum number of \a num_pages flash pages. The maximum erasable pages are limited to + * microcontroller flash size. It sets NVMPROG register to continuous page erase mode before erase and resets + * it action back to normal state on completion. Call XMC_FLASH_GetStatus() after calling this API to verify the erase + * operation.\n + * + * \parNote:
+ * Flash will be in busy state during erase operation. Hence no operations on flash are allowed until it completes.\n + * + * \parRelated APIs:
+ * XMC_FLASH_EraseSector(), XMC_FLASH_ErasePage() \n\n\n + * + * \parRelated APIs:
+ * None + * + */ +void XMC_FLASH_ErasePages(uint32_t *address, uint32_t num_pages); + +/** + * + * @param address Pointer to the starting address of flash block from where the write starts. + * @param data Pointer to the source address where targeted data blocks are located. + * @param num_blocks Maximum number of flash block writes needed.
Range: [1 to (flash size / 16)] + * @param verify If \a true, hardware verification after block write is enabled else disabled. + * + * @return None + * + * \parDescription:
+ * Writes a set of data blocks into the flash.\n\n Minimum possible writable area is 16 byte block. It sets the NVMPROG + * register to continuous block write mode before write and resets it action back to normal state on completion. + * Call XMC_FLASH_GetStatus() API after calling this API to verify the erase operation. + * + * \parNote
+ * Flash will be busy state during write is ongoing, hence no operations allowed until it completes. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_FLASH_WriteBlocks(uint32_t *address, const uint32_t *data, uint32_t num_blocks, bool verify); + +/** + * + * @param address Pointer to the starting address of flash block from where the verification starts. + * @param data Pointer to the source address where targeted data blocks are located. + * @param num_blocks Maximum number of flash blocks writes needed.
Range: [1 to (flash size / 16)] + * + * @return None + * + * \parDescription:
+ * Performs verification of written data blocks.\n\n After calling XMC_FLASH_WriteBlocks() API, calling this API will + * verify the correctness of written blocks. It sets the \a NVMPROG register into continuous block write mode before + * write and resets it action back to normal state on completion. It reads back the written data blocks from the flash + * and verify the values against the internal buffer values. Calling XMC_FLASH_GetStatus() API after calling this API + * validates the result of verification. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_FLASH_VerifyBlocks(uint32_t *address, const uint32_t *data, uint32_t num_blocks); + + +/** + * + * @param address Pointer to the starting address of flash block from where the read starts. + * @param data Pointer to the destination address, where the read data blocks to be stored. + * @param num_blocks Number of blocks to be read.
Range: [1 to (flash size / 16)] + * + * @return None + * + * \parDescription:
+ * Reads multiple blocks from flash in one shot, starting from the \a address specified.\n\n The read blocks are stored + * into the locations starting from the \a data address. Calling XMC_FLASH_GetStatus() API after calling this API + * verifies the read operation. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_FLASH_ReadBlocks(uint32_t *address, uint32_t *data, uint32_t num_blocks); + + +/** + * + * @param address Pointer to the flash word address from where the read is expected + * + * @return
+ * a 32bit data word stored in the specified \a address. + * + * \parDescription:
+ * Reads a single word from the specified flash\a address.\n\n Calling XMC_FLASH_GetStatus() API after calling this + * API returns the read status. + * + * \parRelated APIs:
+ * XMC_FLASH_ReadBlocks() + * + */ +__STATIC_INLINE uint32_t XMC_FLASH_ReadWord(const uint32_t *const address) +{ + return *address; +} + +/** + * + * @param address Pointer to the starting address of the page to be erased + * + * @return None + * + * \parDescription:
+ * Erases a single flash page associated to the specified \a address.\n\n XMC1000 Flash can be erased with granularity + * of one page = 16 blocks of 16 Bytes = 256 Bytes using this API. It internally calls the Flash Firmware routine + * \a XMC1000_NvmErasePage(unsigned long pageAddr) to perform the erase operation. Refer XMC1000 reference manual + * for more details on flash firmware routines (Section 25.3). Call XMC_FLASH_GetStatus() API after calling this API, + * to verify the erase operation.\n + * + * \parRelated APIs:
+ * XMC_FLASH_ErasePages() \n\n\n + */ +void XMC_FLASH_ErasePage(uint32_t *address); + +/** + * + * @param address Pointer to the starting address of flash page from where the programming starts. + * @param data Pointer to the source address where targeted data blocks are located. + * + * @return None + * + * \parDescription:
+ * Erases, programs and verifies a single flash page starting from the \a address specified.\n\n XMC1000 Flash can be + * programmed with granularity of one page = 16 blocks of 16 Bytes = 256 Bytes using this API. It internally calls the + * Flash Firmware routine \a XMC1000_NvmProgVerify(unsigned long pageAddr) to perform the programming. Refer XMC1000 + * reference manual of for more details on flash firmware routines (Section 25.3). Call XMC_FLASH_GetStatus() API after + * calling this API, to verify the erase operation. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_FLASH_ProgramVerifyPage(uint32_t *address, const uint32_t *data); + +/** + * + * @param None + * + * @return None + * + * \parDescription:
+ * Enables the flash to enter into sleep mode by resetting the NVMCONF register NVM_ON bit.\n\n Flash can wake up from + * sleep mode on any flash operation completion ready event trigger. To disable the sleep mode any time during execution + * call the API XMC_FLASH_ExitSleepMode().\n + * + * \parRelated APIs:
+ * XMC_FLASH_ExitSleepMode()\n\n\n + * + */ +__STATIC_INLINE void XMC_FLASH_EnterSleepMode(void) +{ + NVM->NVMCONF &= (uint16_t)(~(uint32_t)NVM_NVMCONF_NVM_ON_Msk); +} + +/** + * + * @param None + * + * @return None + * + * \parDescription:
+ * Enables the flash to exit from sleep mode by setting the NVMCONF register NVM_ON bit.\n\n Calling the API + * XMC_FLASH_EnterSleepMode() allows the flash to renter into sleep mode.\n + * + * \parRelated APIs:
+ * XMC_FLASH_EnterSleepMode()\n\n\n + * + */ +__STATIC_INLINE void XMC_FLASH_ExitSleepMode(void) +{ + NVM->NVMCONF |= (uint16_t)NVM_NVMCONF_NVM_ON_Msk; +} + + +/** + * + * @param sector Flash sector number for which the address extraction is needed
Range: [0 to 51] + * + * @return uint32_t Starting address of the sector specified
Range: [0x10001000 to 0x10032000] + * + * \parDescription:
+ * Finds the starting address of the specified \a sector number.\n\n + * + * \parRelated APIs:
+ * None + * + */ +__STATIC_INLINE uint32_t XMC_FLASH_GetSectorAddress(uint32_t sector) +{ + return (XMC_FLASH_BASE + (XMC_FLASH_BYTES_PER_SECTOR * sector)); +} + + +/** + * + * @param num_sectors Number of sectors to be protected
Range: [0 to 51] + * + * @return None + * + * \parDescription:
+ * Protect the flash sectors starting from 0th sector to the specified \a num_sectors.\n\n It sets the NVMCONF register + * SECPROT field with the value specified in \a num_sectors. Changing the protection limit can be achieved by calling + * this API at runtime with a different value of \a num_sectors.\n\n + * + * \parRelated APIs:
+ * None + * + */ +__STATIC_INLINE void XMC_FLASH_SetSectorProtection(uint32_t num_sectors) +{ + NVM->NVMCONF &= (~(uint16_t)NVM_NVMCONF_SECPROT_Msk); + NVM->NVMCONF |= (uint16_t)((uint16_t)num_sectors << NVM_NVMCONF_SECPROT_Pos); +} + + +/** + * + * @param level Hard read levels specified in \a XMC_FLASH_HARDREAD_LEVEL_t. + * + * @return None + * + * \parDescription:
+ * Sets the hard read level for verification process.\n\n It insists the flash to do a strict margin compare + * with the written/erased data against the internal buffer. Sets the NVMCONF register HRLEV field with \a level + * value. This hardread level is used until the end of the verification sequence and, may not be changed in between.\n\n + * + * \parRelated APIs:
+ * None + * + */ +__STATIC_INLINE void XMC_FLASH_SetHardReadLevel(XMC_FLASH_HARDREAD_LEVEL_t level) +{ + NVM->NVMCONF &= (uint16_t)(~(uint16_t)NVM_NVMCONF_HRLEV_Msk); + NVM->NVMCONF |= (uint16_t)(level<< (uint16_t)NVM_NVMCONF_HRLEV_Pos); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif + +#endif /* FLASH_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_gpio.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_gpio.h new file mode 100644 index 00000000..34e52248 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_gpio.h @@ -0,0 +1,305 @@ +/** + * @file xmc1_gpio.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * @endcond + * + */ + +#ifndef XMC1_GPIO_H +#define XMC1_GPIO_H + +/********************************************************************************************************************** + * HEADER FILES + *********************************************************************************************************************/ + +#include "xmc_common.h" + +#if UC_FAMILY == XMC1 + +#include "xmc1_gpio_map.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup GPIO + * @{ + */ + +/********************************************************************************************************************** + * MACROS + *********************************************************************************************************************/ + +#if defined(PORT0) +#define XMC_GPIO_PORT0 ((XMC_GPIO_PORT_t *) PORT0_BASE) +#define XMC_GPIO_CHECK_PORT0(port) (port == XMC_GPIO_PORT0) +#else +#define XMC_GPIO_CHECK_PORT0(port) 0 +#endif + +#if defined(PORT1) +#define XMC_GPIO_PORT1 ((XMC_GPIO_PORT_t *) PORT1_BASE) +#define XMC_GPIO_CHECK_PORT1(port) (port == XMC_GPIO_PORT1) +#else +#define XMC_GPIO_CHECK_PORT1(port) 0 +#endif + +#if defined(PORT2) +#define XMC_GPIO_PORT2 ((XMC_GPIO_PORT_t *) PORT2_BASE) +#define XMC_GPIO_CHECK_PORT2(port) (port == XMC_GPIO_PORT2) +#else +#define XMC_GPIO_CHECK_PORT2(port) 0 +#endif + +#if defined(PORT3) +#define XMC_GPIO_PORT3 ((XMC_GPIO_PORT_t *) PORT3_BASE) +#define XMC_GPIO_CHECK_PORT3(port) (port == XMC_GPIO_PORT3) +#else +#define XMC_GPIO_CHECK_PORT3(port) 0 +#endif + +#if defined(PORT4) +#define XMC_GPIO_PORT4 ((XMC_GPIO_PORT_t *) PORT4_BASE) +#define XMC_GPIO_CHECK_PORT4(port) (port == XMC_GPIO_PORT4) +#else +#define XMC_GPIO_CHECK_PORT4(port) 0 +#endif + +#define XMC_GPIO_CHECK_PORT(port) (XMC_GPIO_CHECK_PORT0(port) || \ + XMC_GPIO_CHECK_PORT1(port) || \ + XMC_GPIO_CHECK_PORT2(port) || \ + XMC_GPIO_CHECK_PORT3(port) || \ + XMC_GPIO_CHECK_PORT4(port)) + +#define XMC_GPIO_CHECK_OUTPUT_PORT(port) XMC_GPIO_CHECK_PORT(port) + +#define XMC_GPIO_CHECK_ANALOG_PORT(port) (port == XMC_GPIO_PORT2) + +#define XMC_GPIO_CHECK_INPUT_HYSTERESIS(hysteresis) ((hysteresis == XMC_GPIO_INPUT_HYSTERESIS_STANDARD) || \ + (hysteresis == XMC_GPIO_INPUT_HYSTERESIS_LARGE)) + +/********************************************************************************************************************** + * ENUMS + *********************************************************************************************************************/ +/** + * Defines the direction and characteristics of a pin. Use type \a XMC_GPIO_MODE_t for this enum. For the operation + * with alternate functions, the port pins are directly connected to input or output functions of the on-chip periphery. + */ +typedef enum XMC_GPIO_MODE +{ + XMC_GPIO_MODE_INPUT_TRISTATE = 0x0UL << PORT_IOCR_PC_Pos, /**< No internal pull device active */ + XMC_GPIO_MODE_INPUT_PULL_DOWN = 0x1UL << PORT_IOCR_PC_Pos, /**< Internal pull-down device active */ + XMC_GPIO_MODE_INPUT_PULL_UP = 0x2UL << PORT_IOCR_PC_Pos, /**< Internal pull-up device active */ + XMC_GPIO_MODE_INPUT_SAMPLING = 0x3UL << PORT_IOCR_PC_Pos, /**< No internal pull device active; Pn_OUTx continuously samples the input value */ + XMC_GPIO_MODE_INPUT_INVERTED_TRISTATE = 0x4UL << PORT_IOCR_PC_Pos, /**< Inverted no internal pull device active */ + XMC_GPIO_MODE_INPUT_INVERTED_PULL_DOWN = 0x5UL << PORT_IOCR_PC_Pos, /**< Inverted internal pull-down device active */ + XMC_GPIO_MODE_INPUT_INVERTED_PULL_UP = 0x6UL << PORT_IOCR_PC_Pos, /**< Inverted internal pull-up device active */ + XMC_GPIO_MODE_INPUT_INVERTED_SAMPLING = 0x7UL << PORT_IOCR_PC_Pos, /**< Inverted no internal pull device active;Pn_OUTx continuously samples the input value */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL = 0x80UL, /**< Push-pull general-purpose output */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN = 0xc0UL, /**< Open-drain general-purpose output */ + XMC_GPIO_MODE_OUTPUT_ALT1 = 0x1UL << PORT_IOCR_PC_Pos, + XMC_GPIO_MODE_OUTPUT_ALT2 = 0x2UL << PORT_IOCR_PC_Pos, + XMC_GPIO_MODE_OUTPUT_ALT3 = 0x3UL << PORT_IOCR_PC_Pos, + XMC_GPIO_MODE_OUTPUT_ALT4 = 0x4UL << PORT_IOCR_PC_Pos, + XMC_GPIO_MODE_OUTPUT_ALT5 = 0x5UL << PORT_IOCR_PC_Pos, + XMC_GPIO_MODE_OUTPUT_ALT6 = 0x6UL << PORT_IOCR_PC_Pos, + XMC_GPIO_MODE_OUTPUT_ALT7 = 0x7UL << PORT_IOCR_PC_Pos, +#if (UC_SERIES == XMC14) + XMC_GPIO_MODE_OUTPUT_ALT8 = 0x8UL << PORT_IOCR_PC_Pos, + XMC_GPIO_MODE_OUTPUT_ALT9 = 0x9UL << PORT_IOCR_PC_Pos, +#endif + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT1, /**< Push-pull alternate output function 1 */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT2, /**< Push-pull alternate output function 2 */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT3 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT3, /**< Push-pull alternate output function 3 */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT4 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT4, /**< Push-pull alternate output function 4 */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT5 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT5, /**< Push-pull alternate output function 5 */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT6 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT6, /**< Push-pull alternate output function 6 */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT7, /**< Push-pull alternate output function 7 */ +#if (UC_SERIES == XMC14) + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT8 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT8, /**< Push-pull alternate output function 8 */ + XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT9 = XMC_GPIO_MODE_OUTPUT_PUSH_PULL | XMC_GPIO_MODE_OUTPUT_ALT9, /**< Push-pull alternate output function 9 */ +#endif + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT1 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT1, /**< Open drain alternate output function 1 */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT2 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT2, /**< Open drain alternate output function 2 */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT3 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT3, /**< Open drain alternate output function 3 */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT4 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT4, /**< Open drain alternate output function 4 */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT5 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT5, /**< Open drain alternate output function 5 */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT6 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT6, /**< Open drain alternate output function 6 */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT7 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT7, /**< Open drain alternate output function 7 */ +#if (UC_SERIES == XMC14) + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT8 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT8, /**< Open drain alternate output function 8 */ + XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT9 = XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN | XMC_GPIO_MODE_OUTPUT_ALT9 /**< Open drain alternate output function 9 */ +#endif +} XMC_GPIO_MODE_t; + +/** + * Configures input hysteresis mode of pin. Use type \a XMC_GPIO_INPUT_HYSTERESIS_t for this enum. + * Selecting the appropriate pad hysteresis allows optimized pad oscillation behavior + * for touch-sensing applications. + */ +typedef enum XMC_GPIO_INPUT_HYSTERESIS +{ + XMC_GPIO_INPUT_HYSTERESIS_STANDARD = 0x0U, /**< Standard hysteresis */ + XMC_GPIO_INPUT_HYSTERESIS_LARGE = 0x4U /**< Large hysteresis */ +} XMC_GPIO_INPUT_HYSTERESIS_t; + + +/********************************************************************************************************************** + * DATA STRUCTURES + *********************************************************************************************************************/ +/** + * Structure points port hardware registers. Use type XMC_GPIO_PORT_t for this structure. + */ +typedef struct XMC_GPIO_PORT { + __IO uint32_t OUT; /**< The port output register determines the value of a GPIO pin when it is + selected by Pn_IOCRx as output */ + __O uint32_t OMR; /**< The port output modification register contains control bits that make it + possible to individually set, reset, or toggle the logic state of a single port + line*/ + __I uint32_t RESERVED0[2]; + __IO uint32_t IOCR[4]; /**< The port input/output control registers select the digital output and input + driver functionality and characteristics of a GPIO port pin */ + __I uint32_t RESERVED1; + __I uint32_t IN; /**< The logic level of a GPIO pin can be read via the read-only port input register + Pn_IN */ + __I uint32_t RESERVED2[6]; + __IO uint32_t PHCR[2]; /**< Pad hysteresis control register */ + __I uint32_t RESERVED3[6]; + __IO uint32_t PDISC; /**< Pin Function Decision Control Register is to disable/enable the digital pad + structure in shared analog and digital ports*/ + __I uint32_t RESERVED4[3]; + __IO uint32_t PPS; /**< Pin Power Save Register */ + __IO uint32_t HWSEL; /**< Pin Hardware Select Register */ +} XMC_GPIO_PORT_t; + +/** + * Structure initializes port pin. Use type XMC_GPIO_CONFIG_t for this structure. + */ +typedef struct XMC_GPIO_CONFIG +{ + XMC_GPIO_MODE_t mode; /**< Defines the direction and characteristics of a pin */ + XMC_GPIO_INPUT_HYSTERESIS_t input_hysteresis; /**< Defines input pad hysteresis of a pin */ + XMC_GPIO_OUTPUT_LEVEL_t output_level; /**< Defines output level of a pin */ +} XMC_GPIO_CONFIG_t; + +/********************************************************************************************************************** + * API PROTOTYPES + *********************************************************************************************************************/ +__STATIC_INLINE bool XMC_GPIO_IsModeValid(XMC_GPIO_MODE_t mode) +{ + return ((mode == XMC_GPIO_MODE_INPUT_TRISTATE) || + (mode == XMC_GPIO_MODE_INPUT_PULL_DOWN) || + (mode == XMC_GPIO_MODE_INPUT_PULL_UP) || + (mode == XMC_GPIO_MODE_INPUT_SAMPLING) || + (mode == XMC_GPIO_MODE_INPUT_INVERTED_TRISTATE) || + (mode == XMC_GPIO_MODE_INPUT_INVERTED_PULL_DOWN) || + (mode == XMC_GPIO_MODE_INPUT_INVERTED_PULL_UP) || + (mode == XMC_GPIO_MODE_INPUT_INVERTED_SAMPLING) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT1) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT3) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT4) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT5) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT6) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7) || +#if (UC_SERIES == XMC14) + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT8) || + (mode == XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT9) || +#endif + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT1) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT2) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT3) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT4) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT5) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT6) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT7) +#if (UC_SERIES == XMC14) + || (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT8) || + (mode == XMC_GPIO_MODE_OUTPUT_OPEN_DRAIN_ALT9) +#endif + ); +} + + +/** + * @brief Sets pad hysteresis. + * @param port Constant pointer pointing to GPIO port, to access hardware register Pn_PHCR. + * @param pin Port pin number. + * @param hysteresis input hysteresis selection. Refer data structure @ref XMC_GPIO_INPUT_HYSTERESIS_t + * for details. + * + * @return None + * + * \parDescription:
+ * Sets port pin input hysteresis. It configures hardware registers Pn_PHCR.\a hysteresis is initially configured during + * initialization in XMC_GPIO_Init(). Call this API to alter pad hysteresis as needed later in the program. + * + * \parRelated APIs:
+ * None + * + * \parNote:
+ * Prior to this api, user has to configure port pin to input mode using XMC_GPIO_SetMode(). + * + */ + +void XMC_GPIO_SetInputHysteresis(XMC_GPIO_PORT_t *const port, + const uint8_t pin, + const XMC_GPIO_INPUT_HYSTERESIS_t hysteresis); + +/** + * @} (end addtogroup GPIO) + */ + +/** + * @} (end addtogroup XMClib) + */ + +#endif /* UC_FAMILY == XMC1 */ + +#endif /* XMC1_GPIO_H */ + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_gpio_map.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_gpio_map.h new file mode 100644 index 00000000..22a8183e --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_gpio_map.h @@ -0,0 +1,7063 @@ +/** + * @file xmc1_gpio_map.h + * @date 2016-08-22 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft + * + * 2015-06-20: + * - Updated copyright information + * + * 2015-08-25: + * - Added XMC1400 + * + * 2016-03-09: + * - Fixed VADC_EMUX signals + * - Added P1_6_AF_BCCU0_OUT2 for (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN40) + * - Added HWCTRL_U1C0_DOUTx for XMC14xx + * + * 2016-08-22: + * - Added P1_5_AF_U0C0_DOUT0 for XMC14xx + * - Add missing P4_5_AF_BCCU0_OUT8 for XMC1402/04 64/48 pins package + * + * @endcond + * + * @brief XMC pin mapping definitions + */ + +#ifndef XMC1_GPIO_MAP_H +#define XMC1_GPIO_MAP_H + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN24) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN40) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP16) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP38) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1200) && (UC_PACKAGE == TSSOP38) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == VQFN40) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP28) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP38) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN24) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN40) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP16) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP28) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN24) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN40) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP16) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP38) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN24) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN40) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP16) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP28) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP38) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == LQFP64) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P1_7 XMC_GPIO_PORT1, 7 +#define P1_8 XMC_GPIO_PORT1, 8 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P3_1 XMC_GPIO_PORT3, 1 +#define P3_2 XMC_GPIO_PORT3, 2 +#define P3_3 XMC_GPIO_PORT3, 3 +#define P3_4 XMC_GPIO_PORT3, 4 +#define P4_0 XMC_GPIO_PORT4, 0 +#define P4_1 XMC_GPIO_PORT4, 1 +#define P4_2 XMC_GPIO_PORT4, 2 +#define P4_3 XMC_GPIO_PORT4, 3 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 +#define P4_8 XMC_GPIO_PORT4, 8 +#define P4_9 XMC_GPIO_PORT4, 9 +#define P4_10 XMC_GPIO_PORT4, 10 +#define P4_11 XMC_GPIO_PORT4, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_7_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_7_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_7_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_8_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_8_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_8_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_LEDTS2_COL6 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_LEDTS2_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_1_AF_LEDTS2_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_1_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_2_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_2_AF_LEDTS2_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_3_AF_LEDTS2_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_3_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_4_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_4_AF_LEDTS2_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_4_AF_U1C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_4_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_0_AF_LEDTS2_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_0_AF_ERU1_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_0_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_1_AF_LEDTS2_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_1_AF_ERU1_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_1_AF_U1C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_2_AF_ERU1_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_2_AF_U1C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_3_AF_ERU1_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_3_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_LEDTS2_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_4_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_LEDTS2_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_5_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_LEDTS2_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_6_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_LEDTS2_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_8_AF_LEDTS2_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_8_AF_LEDTS2_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_8_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_8_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_9_AF_LEDTS2_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_9_AF_LEDTS2_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_9_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_9_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_9_AF_U1C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_10_AF_LEDTS2_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_10_AF_LEDTS2_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_10_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_10_AF_U1C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_11_AF_LEDTS2_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_11_AF_LEDTS2_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_11_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_11_AF_U1C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_1_HWCTRL_U1C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_2_HWCTRL_U1C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_3_HWCTRL_U1C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_4_HWCTRL_U1C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P4_4_HWCTRL_LEDTS2_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_5_HWCTRL_LEDTS2_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_6_HWCTRL_LEDTS2_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_7_HWCTRL_LEDTS2_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_8_HWCTRL_LEDTS2_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_9_HWCTRL_LEDTS2_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_10_HWCTRL_LEDTS2_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_11_HWCTRL_LEDTS2_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == VQFN48) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_LEDTS2_COL6 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_LEDTS2_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_LEDTS2_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_4_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_LEDTS2_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_5_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_LEDTS2_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_6_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P4_4_HWCTRL_LEDTS2_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_5_HWCTRL_LEDTS2_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_6_HWCTRL_LEDTS2_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_7_HWCTRL_LEDTS2_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == LQFP64) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P1_7 XMC_GPIO_PORT1, 7 +#define P1_8 XMC_GPIO_PORT1, 8 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P3_1 XMC_GPIO_PORT3, 1 +#define P3_2 XMC_GPIO_PORT3, 2 +#define P3_3 XMC_GPIO_PORT3, 3 +#define P3_4 XMC_GPIO_PORT3, 4 +#define P4_0 XMC_GPIO_PORT4, 0 +#define P4_1 XMC_GPIO_PORT4, 1 +#define P4_2 XMC_GPIO_PORT4, 2 +#define P4_3 XMC_GPIO_PORT4, 3 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 +#define P4_8 XMC_GPIO_PORT4, 8 +#define P4_9 XMC_GPIO_PORT4, 9 +#define P4_10 XMC_GPIO_PORT4, 10 +#define P4_11 XMC_GPIO_PORT4, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_7_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_7_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_7_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_7_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_7_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_8_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_8_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_8_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_8_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_8_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_8_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_1_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_1_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_1_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_1_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_2_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_2_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_2_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_2_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_3_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_3_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_3_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_4_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_4_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_4_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_4_AF_U1C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_4_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_4_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_0_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_0_AF_ERU1_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_0_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_1_AF_ERU1_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_1_AF_U1C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_1_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_2_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_2_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_2_AF_ERU1_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_2_AF_U1C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_2_AF_CCU81_OUT12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_3_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_3_AF_ERU1_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_3_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_3_AF_CCU81_OUT13 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_4_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_6_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_6_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU81_OUT02 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_7_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_7_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU81_OUT03 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_8_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_8_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_8_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_8_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_9_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_9_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_9_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_9_AF_U1C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_9_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_10_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_10_AF_U1C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_10_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_10_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_11_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_11_AF_U1C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_11_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_11_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_1_HWCTRL_U1C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_2_HWCTRL_U1C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_3_HWCTRL_U1C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_4_HWCTRL_U1C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN40) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN48) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_4_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_6_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_6_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU81_OUT02 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_7_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_7_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU81_OUT03 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN64) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P1_7 XMC_GPIO_PORT1, 7 +#define P1_8 XMC_GPIO_PORT1, 8 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P3_1 XMC_GPIO_PORT3, 1 +#define P3_2 XMC_GPIO_PORT3, 2 +#define P3_3 XMC_GPIO_PORT3, 3 +#define P3_4 XMC_GPIO_PORT3, 4 +#define P4_0 XMC_GPIO_PORT4, 0 +#define P4_1 XMC_GPIO_PORT4, 1 +#define P4_2 XMC_GPIO_PORT4, 2 +#define P4_3 XMC_GPIO_PORT4, 3 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 +#define P4_8 XMC_GPIO_PORT4, 8 +#define P4_9 XMC_GPIO_PORT4, 9 +#define P4_10 XMC_GPIO_PORT4, 10 +#define P4_11 XMC_GPIO_PORT4, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_7_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_7_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_7_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_7_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_7_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_8_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_8_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_8_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_8_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_8_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_8_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_1_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_1_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_1_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_1_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_2_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_2_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_2_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_2_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_3_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_3_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_3_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_4_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_4_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_4_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_4_AF_U1C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_4_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_4_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_0_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_0_AF_ERU1_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_0_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_1_AF_ERU1_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_1_AF_U1C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_1_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_2_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_2_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_2_AF_ERU1_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_2_AF_U1C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_2_AF_CCU81_OUT12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_3_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_3_AF_ERU1_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_3_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_3_AF_CCU81_OUT13 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_4_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_6_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_6_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU81_OUT02 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_7_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_7_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU81_OUT03 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_8_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_8_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_8_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_8_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_9_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_9_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_9_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_9_AF_U1C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_9_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_10_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_10_AF_U1C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_10_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_10_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_11_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_11_AF_U1C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_11_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_11_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_1_HWCTRL_U1C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_2_HWCTRL_U1C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_3_HWCTRL_U1C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_4_HWCTRL_U1C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == TSSOP38) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN40) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_4_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN48) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_4_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN64) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P1_7 XMC_GPIO_PORT1, 7 +#define P1_8 XMC_GPIO_PORT1, 8 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P3_1 XMC_GPIO_PORT3, 1 +#define P3_2 XMC_GPIO_PORT3, 2 +#define P3_3 XMC_GPIO_PORT3, 3 +#define P3_4 XMC_GPIO_PORT3, 4 +#define P4_0 XMC_GPIO_PORT4, 0 +#define P4_1 XMC_GPIO_PORT4, 1 +#define P4_2 XMC_GPIO_PORT4, 2 +#define P4_3 XMC_GPIO_PORT4, 3 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 +#define P4_8 XMC_GPIO_PORT4, 8 +#define P4_9 XMC_GPIO_PORT4, 9 +#define P4_10 XMC_GPIO_PORT4, 10 +#define P4_11 XMC_GPIO_PORT4, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_4_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_7_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_7_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_8_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_8_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_8_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_1_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_2_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_3_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_4_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_4_AF_U1C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_4_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_0_AF_ERU1_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_0_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_1_AF_ERU1_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_1_AF_U1C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_2_AF_ERU1_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_2_AF_U1C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_3_AF_ERU1_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_3_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_8_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_8_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_9_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_9_AF_U1C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_9_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_10_AF_U1C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_11_AF_U1C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT7 + +/* HW control options */ +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_1_HWCTRL_U1C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_2_HWCTRL_U1C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_3_HWCTRL_U1C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_4_HWCTRL_U1C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == LQFP64) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P1_7 XMC_GPIO_PORT1, 7 +#define P1_8 XMC_GPIO_PORT1, 8 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P3_1 XMC_GPIO_PORT3, 1 +#define P3_2 XMC_GPIO_PORT3, 2 +#define P3_3 XMC_GPIO_PORT3, 3 +#define P3_4 XMC_GPIO_PORT3, 4 +#define P4_0 XMC_GPIO_PORT4, 0 +#define P4_1 XMC_GPIO_PORT4, 1 +#define P4_2 XMC_GPIO_PORT4, 2 +#define P4_3 XMC_GPIO_PORT4, 3 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 +#define P4_8 XMC_GPIO_PORT4, 8 +#define P4_9 XMC_GPIO_PORT4, 9 +#define P4_10 XMC_GPIO_PORT4, 10 +#define P4_11 XMC_GPIO_PORT4, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_4_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_7_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_7_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_7_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_7_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_7_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_7_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_8_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_8_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_8_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_8_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_8_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_8_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_12_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_LEDTS2_COL6 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_LEDTS2_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_0_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_1_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_1_AF_LEDTS2_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_1_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_1_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_1_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_2_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_2_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_2_AF_LEDTS2_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_2_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_2_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_3_AF_LEDTS2_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_3_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_3_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_3_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_4_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_4_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_4_AF_LEDTS2_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_4_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_4_AF_U1C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_4_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_4_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_0_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_0_AF_LEDTS2_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_0_AF_ERU1_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_0_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_1_AF_LEDTS2_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_1_AF_ERU1_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_1_AF_U1C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_1_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_2_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_2_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_2_AF_ERU1_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_2_AF_U1C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_2_AF_CCU81_OUT12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_3_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_3_AF_ERU1_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_3_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_3_AF_CCU81_OUT13 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_4_AF_LEDTS2_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_4_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_4_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_5_AF_LEDTS2_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_5_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_6_AF_LEDTS2_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_6_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_6_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_6_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU81_OUT02 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_7_AF_LEDTS2_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_7_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_7_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU81_OUT03 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_8_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_8_AF_LEDTS2_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_8_AF_LEDTS2_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_8_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_8_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_8_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_8_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_8_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_9_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_9_AF_LEDTS2_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_9_AF_LEDTS2_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_9_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_9_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_9_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_9_AF_U1C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_9_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_9_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_10_AF_LEDTS2_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_10_AF_LEDTS2_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_10_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_10_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_10_AF_U1C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_10_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_10_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_11_AF_LEDTS2_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_11_AF_LEDTS2_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_11_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_11_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_11_AF_U1C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_11_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_11_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_1_HWCTRL_U1C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_2_HWCTRL_U1C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_3_HWCTRL_U1C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_4_HWCTRL_U1C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P4_4_HWCTRL_LEDTS2_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_5_HWCTRL_LEDTS2_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_6_HWCTRL_LEDTS2_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_7_HWCTRL_LEDTS2_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_8_HWCTRL_LEDTS2_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_9_HWCTRL_LEDTS2_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_10_HWCTRL_LEDTS2_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_11_HWCTRL_LEDTS2_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN48) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_4_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_12_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_LEDTS2_COL6 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_LEDTS2_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_0_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_4_AF_LEDTS2_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_4_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_4_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_5_AF_LEDTS2_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_5_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_6_AF_LEDTS2_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_6_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_6_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_6_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU81_OUT02 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_7_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_7_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU81_OUT03 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P4_4_HWCTRL_LEDTS2_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_5_HWCTRL_LEDTS2_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_6_HWCTRL_LEDTS2_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_7_HWCTRL_LEDTS2_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN64) +#define P0_0 XMC_GPIO_PORT0, 0 +#define P0_1 XMC_GPIO_PORT0, 1 +#define P0_2 XMC_GPIO_PORT0, 2 +#define P0_3 XMC_GPIO_PORT0, 3 +#define P0_4 XMC_GPIO_PORT0, 4 +#define P0_5 XMC_GPIO_PORT0, 5 +#define P0_6 XMC_GPIO_PORT0, 6 +#define P0_7 XMC_GPIO_PORT0, 7 +#define P0_8 XMC_GPIO_PORT0, 8 +#define P0_9 XMC_GPIO_PORT0, 9 +#define P0_10 XMC_GPIO_PORT0, 10 +#define P0_11 XMC_GPIO_PORT0, 11 +#define P0_12 XMC_GPIO_PORT0, 12 +#define P0_13 XMC_GPIO_PORT0, 13 +#define P0_14 XMC_GPIO_PORT0, 14 +#define P0_15 XMC_GPIO_PORT0, 15 +#define P1_0 XMC_GPIO_PORT1, 0 +#define P1_1 XMC_GPIO_PORT1, 1 +#define P1_2 XMC_GPIO_PORT1, 2 +#define P1_3 XMC_GPIO_PORT1, 3 +#define P1_4 XMC_GPIO_PORT1, 4 +#define P1_5 XMC_GPIO_PORT1, 5 +#define P1_6 XMC_GPIO_PORT1, 6 +#define P1_7 XMC_GPIO_PORT1, 7 +#define P1_8 XMC_GPIO_PORT1, 8 +#define P2_0 XMC_GPIO_PORT2, 0 +#define P2_1 XMC_GPIO_PORT2, 1 +#define P2_2 XMC_GPIO_PORT2, 2 +#define P2_3 XMC_GPIO_PORT2, 3 +#define P2_4 XMC_GPIO_PORT2, 4 +#define P2_5 XMC_GPIO_PORT2, 5 +#define P2_6 XMC_GPIO_PORT2, 6 +#define P2_7 XMC_GPIO_PORT2, 7 +#define P2_8 XMC_GPIO_PORT2, 8 +#define P2_9 XMC_GPIO_PORT2, 9 +#define P2_10 XMC_GPIO_PORT2, 10 +#define P2_11 XMC_GPIO_PORT2, 11 +#define P2_12 XMC_GPIO_PORT2, 12 +#define P2_13 XMC_GPIO_PORT2, 13 +#define P3_0 XMC_GPIO_PORT3, 0 +#define P3_1 XMC_GPIO_PORT3, 1 +#define P3_2 XMC_GPIO_PORT3, 2 +#define P3_3 XMC_GPIO_PORT3, 3 +#define P3_4 XMC_GPIO_PORT3, 4 +#define P4_0 XMC_GPIO_PORT4, 0 +#define P4_1 XMC_GPIO_PORT4, 1 +#define P4_2 XMC_GPIO_PORT4, 2 +#define P4_3 XMC_GPIO_PORT4, 3 +#define P4_4 XMC_GPIO_PORT4, 4 +#define P4_5 XMC_GPIO_PORT4, 5 +#define P4_6 XMC_GPIO_PORT4, 6 +#define P4_7 XMC_GPIO_PORT4, 7 +#define P4_8 XMC_GPIO_PORT4, 8 +#define P4_9 XMC_GPIO_PORT4, 9 +#define P4_10 XMC_GPIO_PORT4, 10 +#define P4_11 XMC_GPIO_PORT4, 11 + + +/* Alternate Output Function */ +#define P0_0_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_0_AF_LEDTS0_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_0_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_0_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_0_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_1_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_1_AF_LEDTS0_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_1_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_1_AF_SCU_VDROP XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_1_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_2_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_2_AF_LEDTS0_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_2_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_2_AF_CCU80_OUT02 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_2_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_2_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_3_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_3_AF_LEDTS0_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_3_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_3_AF_CCU80_OUT03 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_3_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_3_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_4_AF_LEDTS0_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_4_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_4_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_4_AF_CCU80_OUT13 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_4_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_4_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_4_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_4_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_5_AF_LEDTS0_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_5_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_5_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_5_AF_CCU80_OUT12 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_5_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_5_AF_VADC_EMUX10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_5_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_6_AF_LEDTS0_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_6_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_6_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_6_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_6_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_6_AF_VADC_EMUX11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_6_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_7_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_7_AF_LEDTS0_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_7_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_7_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_7_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_7_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_7_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_7_AF_VADC_EMUX12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_7_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_8_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_8_AF_LEDTS1_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_8_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_8_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_8_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_8_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_8_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_8_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_8_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_9_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_9_AF_LEDTS1_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_9_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_9_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_9_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_9_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_9_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_9_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_9_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_10_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_10_AF_LEDTS1_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_10_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_10_AF_CCU80_OUT22 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_10_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_10_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_10_AF_CCU81_OUT22 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_11_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_11_AF_LEDTS1_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_11_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_11_AF_U0C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_11_AF_CCU80_OUT23 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_11_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_11_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_11_AF_CCU81_OUT23 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P0_12_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_12_AF_LEDTS1_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_12_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_12_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_12_AF_CCU80_OUT33 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_12_AF_U0C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_12_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_12_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_13_AF_WDT_REQUEST XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_13_AF_LEDTS1_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_13_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_13_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_13_AF_CCU80_OUT32 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_13_AF_U0C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_13_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_13_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_14_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_14_AF_LEDTS1_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_14_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_14_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_14_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_14_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_14_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_14_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P0_15_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P0_15_AF_LEDTS1_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P0_15_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P0_15_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P0_15_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P0_15_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P0_15_AF_U0C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P0_15_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_0_AF_LEDTS0_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_0_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_0_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_0_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_1_AF_LEDTS0_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_1_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_1_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_1_AF_U0C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_1_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_2_AF_LEDTS0_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_2_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_2_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_2_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_2_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_2_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_3_AF_LEDTS0_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_3_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_3_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_3_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_3_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_3_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_3_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_4_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_4_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_4_AF_LEDTS0_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_4_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_4_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_4_AF_U0C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_4_AF_U0C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_4_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_5_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_5_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_5_AF_LEDTS0_COLA XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_5_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_5_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_5_AF_U0C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_5_AF_U0C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_5_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_6_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_6_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_6_AF_LEDTS0_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_6_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P1_6_AF_U0C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_6_AF_U0C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_6_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_7_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_7_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_7_AF_LEDTS0_COL6 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_7_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_7_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_7_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P1_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P1_8_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P1_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P1_8_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P1_8_AF_VADC_EMUX02 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P1_8_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P1_8_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P1_8_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_0_AF_ERU0_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_0_AF_ERU0_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_0_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_0_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_0_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_0_AF_U0C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_0_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_0_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_1_AF_ERU0_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_1_AF_ERU0_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_1_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_1_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_1_AF_U0C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_1_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_1_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_1_AF_CAN_N0_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_10_AF_ERU0_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_10_AF_ERU0_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_10_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_10_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_10_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_10_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_10_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_11_AF_ERU0_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_11_AF_ERU0_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_11_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_11_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P2_11_AF_U0C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_11_AF_U0C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_11_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P2_12_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_12_AF_VADC_EMUX00 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_12_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_12_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_12_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_12_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_12_AF_LEDTS2_COL6 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P2_13_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P2_13_AF_U1C0_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P2_13_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P2_13_AF_VADC_EMUX01 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P2_13_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P2_13_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P2_13_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_0_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_0_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_0_AF_LEDTS2_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_0_AF_CCU80_OUT21 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_0_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_0_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_1_AF_BCCU0_OUT1 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_1_AF_U1C1_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_1_AF_LEDTS2_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_1_AF_CCU80_OUT20 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_1_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_1_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_2_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_2_AF_U1C1_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_2_AF_LEDTS2_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_2_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_2_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_2_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_3_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_3_AF_LEDTS2_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_3_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_3_AF_U1C1_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_3_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P3_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P3_4_AF_BCCU0_OUT6 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P3_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P3_4_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT3 +#define P3_4_AF_LEDTS2_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P3_4_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P3_4_AF_U1C1_MCLKOUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P3_4_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P3_4_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_0_AF_ERU1_PDOUT0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_0_AF_LEDTS2_COL5 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_0_AF_ERU1_GOUT0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_0_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_0_AF_ACMP1_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_0_AF_U1C1_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_0_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_0_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_1_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_1_AF_ERU1_PDOUT1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_1_AF_LEDTS2_COL4 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_1_AF_ERU1_GOUT1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_1_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_1_AF_ACMP3_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_1_AF_U1C1_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_1_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_1_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_2_AF_BCCU0_OUT4 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_2_AF_ERU1_PDOUT2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_2_AF_CCU81_OUT20 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_2_AF_ERU1_GOUT2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_2_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_2_AF_ACMP2_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_2_AF_U1C1_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_2_AF_CCU81_OUT12 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_2_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_3_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_3_AF_ERU1_PDOUT3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_3_AF_CCU81_OUT21 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_3_AF_ERU1_GOUT3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_3_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_3_AF_ACMP0_OUT XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_3_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_3_AF_CCU81_OUT13 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_3_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_4_AF_BCCU0_OUT0 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_4_AF_LEDTS2_LINE0 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_4_AF_LEDTS1_COLA XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_4_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_4_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_4_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_4_AF_CCU41_OUT0 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_5_AF_BCCU0_OUT8 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_5_AF_LEDTS2_LINE1 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_5_AF_LEDTS1_COL6 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_5_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_5_AF_U1C0_DOUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_5_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_5_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_5_AF_CCU41_OUT1 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_6_AF_BCCU0_OUT2 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_6_AF_LEDTS2_LINE2 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_6_AF_CCU81_OUT10 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_6_AF_LEDTS1_COL5 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_6_AF_CCU80_OUT10 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_6_AF_U1C0_SCLKOUT XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_6_AF_CCU81_OUT02 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_6_AF_CCU41_OUT2 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_7_AF_BCCU0_OUT5 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_7_AF_LEDTS2_LINE3 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_7_AF_CCU81_OUT11 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_7_AF_LEDTS1_COL4 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_7_AF_CCU80_OUT11 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_7_AF_U1C0_SELO0 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_7_AF_CCU81_OUT03 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_7_AF_CCU41_OUT3 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_8_AF_BCCU0_OUT7 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_8_AF_LEDTS2_LINE4 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_8_AF_LEDTS2_COL3 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_8_AF_LEDTS1_COL3 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_8_AF_CCU80_OUT30 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_8_AF_CCU40_OUT0 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_8_AF_U1C0_SELO1 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_8_AF_CCU81_OUT30 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_8_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_9_AF_BCCU0_OUT3 XMC_GPIO_MODE_OUTPUT_ALT1 +#define P4_9_AF_LEDTS2_LINE5 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_9_AF_LEDTS2_COL2 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_9_AF_LEDTS1_COL2 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_9_AF_CCU80_OUT31 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_9_AF_CCU40_OUT1 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_9_AF_U1C0_SELO2 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_9_AF_CCU81_OUT31 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_9_AF_CAN_N1_TXD XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_10_AF_LEDTS2_LINE6 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_10_AF_LEDTS2_COL1 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_10_AF_LEDTS1_COL1 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_10_AF_CCU80_OUT00 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_10_AF_CCU40_OUT2 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_10_AF_U1C0_SELO3 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_10_AF_CCU81_OUT32 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_10_AF_CCU81_OUT00 XMC_GPIO_MODE_OUTPUT_ALT9 +#define P4_11_AF_LEDTS2_LINE7 XMC_GPIO_MODE_OUTPUT_ALT2 +#define P4_11_AF_LEDTS2_COL0 XMC_GPIO_MODE_OUTPUT_ALT3 +#define P4_11_AF_LEDTS1_COL0 XMC_GPIO_MODE_OUTPUT_ALT4 +#define P4_11_AF_CCU80_OUT01 XMC_GPIO_MODE_OUTPUT_ALT5 +#define P4_11_AF_CCU40_OUT3 XMC_GPIO_MODE_OUTPUT_ALT6 +#define P4_11_AF_U1C0_SELO4 XMC_GPIO_MODE_OUTPUT_ALT7 +#define P4_11_AF_CCU81_OUT33 XMC_GPIO_MODE_OUTPUT_ALT8 +#define P4_11_AF_CCU81_OUT01 XMC_GPIO_MODE_OUTPUT_ALT9 + +/* HW control options */ +#define P0_0_HWCTRL_LEDTS0_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_1_HWCTRL_LEDTS0_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_2_HWCTRL_LEDTS0_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_3_HWCTRL_LEDTS0_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_4_HWCTRL_LEDTS0_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_5_HWCTRL_LEDTS0_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_6_HWCTRL_LEDTS0_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_7_HWCTRL_LEDTS0_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_8_HWCTRL_LEDTS1_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_9_HWCTRL_LEDTS1_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_10_HWCTRL_LEDTS1_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_11_HWCTRL_LEDTS1_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_12_HWCTRL_LEDTS1_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_13_HWCTRL_LEDTS1_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_14_HWCTRL_LEDTS1_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P0_15_HWCTRL_LEDTS1_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P1_0_HWCTRL_U0C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_1_HWCTRL_U0C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_2_HWCTRL_U0C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P1_3_HWCTRL_U0C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_1_HWCTRL_U1C0_DOUT3 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_2_HWCTRL_U1C0_DOUT2 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_3_HWCTRL_U1C0_DOUT1 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P3_4_HWCTRL_U1C0_DOUT0 XMC_GPIO_HWCTRL_PERIPHERAL2 +#define P4_4_HWCTRL_LEDTS2_TSIN0 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_5_HWCTRL_LEDTS2_TSIN1 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_6_HWCTRL_LEDTS2_TSIN2 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_7_HWCTRL_LEDTS2_TSIN3 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_8_HWCTRL_LEDTS2_TSIN4 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_9_HWCTRL_LEDTS2_TSIN5 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_10_HWCTRL_LEDTS2_TSIN6 XMC_GPIO_HWCTRL_PERIPHERAL1 +#define P4_11_HWCTRL_LEDTS2_TSIN7 XMC_GPIO_HWCTRL_PERIPHERAL1 +#endif + +#endif /* XMC1_GPIO_MAP_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_rtc.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_rtc.h new file mode 100644 index 00000000..d76a8bf5 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_rtc.h @@ -0,0 +1,108 @@ +/** + * @file xmc1_rtc.h + * @date 2015-05-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial version + * + * 2015-05-20: + * - Documentation updates
+ * + * @endcond + * + */ + +#ifndef XMC1_RTC_H +#define XMC1_RTC_H + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup RTC + * @{ + */ + +/********************************************************************************************************************* + * ENUMS + *********************************************************************************************************************/ + +/** + * Debug mode status values + */ +typedef enum XMC_RTC_DEBUG_MODE +{ + XMC_RTC_RUN_IN_DEBUG_MODE = 0U, /**< RTC is not stopped during halting mode debug */ + XMC_RTC_STOP_IN_DEBUG_MODE = 1U /**< RTC is stopped during halting mode debug */ +} XMC_RTC_DEBUG_MODE_t; + +/********************************************************************************************************************* + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param debug_mode Debug mode value containing in (::XMC_RTC_DEBUG_MODE_t) to be set + * @return None + * + * \parDescription:
+ * Configures the RTC into running or stopping mode during halting mode debug
+ * + * \par + * The function sets the CTR.SUS bitfield to configure the RTC into running + * or stopping mode during halting mode debug. + */ +void XMC_RTC_SetDebugMode(const XMC_RTC_DEBUG_MODE_t debug_mode); + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* XMC1_RTC_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_scu.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_scu.h new file mode 100644 index 00000000..7bf0b034 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_scu.h @@ -0,0 +1,1341 @@ +/** + * @file xmc1_scu.h + * @date 2017-03-28 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial + * + * 2015-05-20: + * - Description updated
+ * + * 2015-06-20: + * - XMC_SCU_INTERRUPT_EVENT enum elements are typecasted to int64_t + * + * 2015-06-20: + * - Added support for XMC1400 + * + * 2015-11-30: + * - Documentation improved + * + * 2015-12-09: + * - Added XMC_SCU_EnablePrefetchUnit and XMC_SCU_DisablePrefetchUnit + * + * 2016-03-09: + * - Added XMC_SCU_POWER_EnableMonitor/XMC_SCU_POWER_DisableMonitor + * + * 2017-03-28: + * - Fixed prescaler formula comments for XMC_SCU_CLOCK_EnableDCO1ExtRefCalibration() + * - Added XMC_SCU_SetBMI() + * + * @endcond + * + */ + +#ifndef XMC1_SCU_H +#define XMC1_SCU_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include "xmc_common.h" + +#if UC_FAMILY == XMC1 + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup SCU + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +/* + * List of events + */ +#define XMC_SCU_INTERRUPT_EVENT_WDT_WARN SCU_INTERRUPT_SRMSK_PRWARN_Msk /**< WDT pre-warning event. */ +#define XMC_SCU_INTERRUPT_EVENT_RTC_PERIODIC SCU_INTERRUPT_SRCLR_PI_Msk /**< RTC periodic event. */ +#define XMC_SCU_INTERRUPT_EVENT_RTC_ALARM SCU_INTERRUPT_SRCLR_AI_Msk /**< RTC alarm event. */ +#define XMC_SCU_INTERRUPT_EVENT_VDDPI SCU_INTERRUPT_SRMSK_VDDPI_Msk /**< VDDP pre-warning event. */ +#if defined(COMPARATOR) +#define XMC_SCU_INTERRUPT_EVENT_ACMP0 SCU_INTERRUPT_SRMSK_ACMP0I_Msk /**< Analog comparator-0 output event. */ +#define XMC_SCU_INTERRUPT_EVENT_ACMP1 SCU_INTERRUPT_SRMSK_ACMP1I_Msk /**< Analog comparator-1 output event. */ +#define XMC_SCU_INTERRUPT_EVENT_ACMP2 SCU_INTERRUPT_SRMSK_ACMP2I_Msk /**< Analog comparator-2 output event. */ +#if (UC_SERIES == XMC14) || defined(DOXYGEN) +#define XMC_SCU_INTERRUPT_EVENT_ACMP3 (((int64_t)SCU_INTERRUPT_SRMSK1_ACMP3I_Msk) << 32U) /**< Analog comparator-3 output event. @note Only available for XMC1400 series */ +#endif +#endif +#define XMC_SCU_INTERRUPT_EVENT_VDROP SCU_INTERRUPT_SRMSK_VDROPI_Msk /**< VDROP event. */ +#if UC_SERIES != XMC11 +#define XMC_SCU_INTERRUPT_EVENT_ORC0 SCU_INTERRUPT_SRMSK_ORC0I_Msk /**< Out of range comparator-0 event. */ +#define XMC_SCU_INTERRUPT_EVENT_ORC1 SCU_INTERRUPT_SRMSK_ORC1I_Msk /**< Out of range comparator-1 event. */ +#define XMC_SCU_INTERRUPT_EVENT_ORC2 SCU_INTERRUPT_SRMSK_ORC2I_Msk /**< Out of range comparator-2 event. */ +#define XMC_SCU_INTERRUPT_EVENT_ORC3 SCU_INTERRUPT_SRMSK_ORC3I_Msk /**< Out of range comparator-3 event. */ +#define XMC_SCU_INTERRUPT_EVENT_ORC4 SCU_INTERRUPT_SRMSK_ORC4I_Msk /**< Out of range comparator-4 event. */ +#define XMC_SCU_INTERRUPT_EVENT_ORC5 SCU_INTERRUPT_SRMSK_ORC5I_Msk /**< Out of range comparator-5 event. */ +#define XMC_SCU_INTERRUPT_EVENT_ORC6 SCU_INTERRUPT_SRMSK_ORC6I_Msk /**< Out of range comparator-6 event. */ +#define XMC_SCU_INTERRUPT_EVENT_ORC7 SCU_INTERRUPT_SRMSK_ORC7I_Msk /**< Out of range comparator-7 event. */ +#endif +#define XMC_SCU_INTERRUPT_EVENT_LOCI SCU_INTERRUPT_SRMSK_LOCI_Msk /**< Loss of clock event. */ +#define XMC_SCU_INTERRUPT_EVENT_PESRAM SCU_INTERRUPT_SRMSK_PESRAMI_Msk /**< PSRAM Parity error event. */ +#define XMC_SCU_INTERRUPT_EVENT_PEUSIC0 SCU_INTERRUPT_SRMSK_PEU0I_Msk /**< USIC0 Parity error event. */ +#if defined(USIC1) +#define XMC_SCU_INTERRUPT_EVENT_PEUSIC1 (((int64_t)SCU_INTERRUPT_SRMSK1_PEU1I_Msk) << 32U) /**< USIC1 Parity error event. */ +#endif +#define XMC_SCU_INTERRUPT_EVENT_FLASH_ERROR SCU_INTERRUPT_SRMSK_FLECC2I_Msk /**< Flash ECC double bit error event. */ +#define XMC_SCU_INTERRUPT_EVENT_FLASH_COMPLETED SCU_INTERRUPT_SRCLR_FLCMPLTI_Msk /**< Flash operation completion event. */ +#define XMC_SCU_INTERRUPT_EVENT_VCLIP SCU_INTERRUPT_SRMSK_VCLIPI_Msk /**< VCLIP event. */ +#define XMC_SCU_INTERRUPT_EVENT_STDBYCLKFAIL SCU_INTERRUPT_SRMSK_SBYCLKFI_Msk /**< Standby clock failure event. */ +#define XMC_SCU_INTERRUPT_EVENT_RTCCTR_UPDATED SCU_INTERRUPT_SRMSK_RTC_CTR_Msk /**< RTCCTR register update event. */ +#define XMC_SCU_INTERRUPT_EVENT_RTCATIM0_UPDATED SCU_INTERRUPT_SRMSK_RTC_ATIM0_Msk /**< RTCATIM0 register update event. */ +#define XMC_SCU_INTERRUPT_EVENT_RTCATIM1_UPDATED SCU_INTERRUPT_SRMSK_RTC_ATIM1_Msk /**< RTCATIM1 register update event. */ +#define XMC_SCU_INTERRUPT_EVENT_RTCTIM0_UPDATED SCU_INTERRUPT_SRMSK_RTC_TIM0_Msk /**< RTCTIM0 register update event. */ +#define XMC_SCU_INTERRUPT_EVENT_RTCTIM1_UPDATED SCU_INTERRUPT_SRMSK_RTC_TIM1_Msk /**< RTCTIM1 register update event. */ +#define XMC_SCU_INTERRUPT_EVENT_TSE_DONE SCU_INTERRUPT_SRMSK_TSE_DONE_Msk /**< Temperature measurement Completion event. */ +#define XMC_SCU_INTERRUPT_EVENT_TSE_HIGH SCU_INTERRUPT_SRMSK_TSE_HIGH_Msk /**< Temperature too high event. */ +#define XMC_SCU_INTERRUPT_EVENT_TSE_LOW SCU_INTERRUPT_SRMSK_TSE_LOW_Msk /**< Temperature too low event. */ +#if defined(CAN) +#define XMC_SCU_INTERRUPT_EVENT_PEMCAN (((int64_t)SCU_INTERRUPT_SRMSK1_PEMCI_Msk) << 32U) /**< MultiCAN SRAM Parity Error Event. */ +#endif +#if (UC_SERIES == XMC14) || defined(DOXYGEN) +#define XMC_SCU_INTERRUPT_EVENT_LOSS_EXT_CLOCK (((int64_t)SCU_INTERRUPT_SRMSK1_LOECI_Msk) << 32U) /**< Loss of external OSC_HP clock event. @note Only available for XMC1400 series */ +#define XMC_SCU_INTERRUPT_EVENT_DCO1_OUT_SYNC (((int64_t)SCU_INTERRUPT_SRMSK1_DCO1OFSI_Msk) << 32U) /**< DCO1 Out of SYNC Event. @note Only available for XMC1400 series */ +#endif + +/* + * These are the flags which may be passed to XMC_SCU_SetBMI(). + */ +#if defined(CAN) || defined(DOXYGEN) +#define XMC_SCU_BMI_HWCFG_CAN_BSL (0x0080U) /**< CAN Bootstrap Loader Start-up Mode */ +#define XMC_SCU_BMI_HWCFG_CAN_BSLTO (0x0090U) /**< CAN Bootstrap Loader Start-up Mode with time-out */ +#define XMC_SCU_BMI_HWCFG_SBSL_CANOPEN (0x00A0U) /**< Secure Bootstrap Loader Start-up Mode over CANopen */ +#endif + +#define XMC_SCU_BMI_HWCFG_ASC_BSL (0x00C0U) /**< ASC Bootstrap Loader Start-up Mode */ +#define XMC_SCU_BMI_HWCFG_UPM (0x00C1U) /**< User productive Start-up Mode */ +#define XMC_SCU_BMI_HWCFG_UMD (0x00C3U) /**< User Start-up Mode with debug enabled */ +#define XMC_SCU_BMI_HWCFG_UMHAR (0x00C7U) /**< User Start-up Mode with debug enabled and halt after reset (HAR) */ +#define XMC_SCU_BMI_HWCFG_SSC_BSL (0x00C8U) /**< SSC Bootstrap Loader Start-up Mode */ +#define XMC_SCU_BMI_HWCFG_ASC_BSLTO (0x00D0U) /**< ASC BSL Start-up Mode with time-out */ +#define XMC_SCU_BMI_HWCFG_SSC_BSLTO (0x00D8U) /**< SSC BSL Start-up Mode with time-out */ +#define XMC_SCU_BMI_HWCFG_SBSL (0x00FAU) /**< Secure Bootstrap Loader Start-up Mode over ASC */ + +#define XMC_SCU_BMI_DAPTYP_SWD (0U << 8) /**< Serial wire debug (SWD) interface is selected */ +#define XMC_SCU_BMI_DAPTYP_SPD (1U << 8) /**< Single pin debug (SPD) interface is selected */ + +#define XMC_SCU_BMI_DAPDIS_CHANNEL_0 (0U << 9) /**< SWD/SPD_0 pin is selected */ +#define XMC_SCU_BMI_DAPDIS_CHANNEL_1 (1U << 9) /**< SWD/SPD_1 pin is selected */ + +#if defined(CAN) || defined(DOXYGEN) +#define XMC_SCU_BMI_CANCLK_DCO1 (0U << 11) /**< Synchronous CAN clock via internal oscillator (DCO1) with enabled trimming via external reference is selected */ +#define XMC_SCU_BMI_CANCLK_OSCHP (1U << 11) /**< Synchronous CAN clock via external oscillator (OSC_HP) is selected */ +#endif + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/** + * Defines the cause of last reset. The cause of last reset gets automatically stored in + * the \a SCU_RSTSTAT register and can be checked by user software to determine the state of the system and for debug + * purpose. All the enum items are tabulated as per bits present in \a SCU_RSTSTAT register. + * Use type \a XMC_SCU_RESET_REASON_t for accessing these enum parameters. + */ +typedef enum XMC_SCU_RESET_REASON +{ + XMC_SCU_RESET_REASON_PORST = (1UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos), /**< Reset due to Power On reset. */ + XMC_SCU_RESET_REASON_MASTER = (2UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos), /**< Reset due to Master reset. */ + XMC_SCU_RESET_REASON_SW = (4UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos), /**< Reset due to Software initiated reset. */ + XMC_SCU_RESET_REASON_LOCKUP = (8UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos), /**< Reset due to CPU lockup. */ + XMC_SCU_RESET_REASON_FLASH = (16UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos), /**< Reset due to flash error. */ + XMC_SCU_RESET_REASON_WATCHDOG = (32UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos), /**< Reset due to watchdog. */ + XMC_SCU_RESET_REASON_CLOCK_LOSS = (64UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos), /**< Reset due to clock loss. */ + XMC_SCU_RESET_REASON_PARITY_ERROR = (128UL << SCU_RESET_RSTSTAT_RSTSTAT_Pos) /**< Reset due to RAM parity error. */ +} XMC_SCU_RESET_REASON_t; + +/** + * Defines the reset sources that can cause device reset. These enums can be used to configure reset source in reset + * control \a RSTCON register which enables different reset sources to identify the reset cause. The \a SCU_RSTSTAT + * register can be checked by user software to determine the state of the system and for debug + * purpose. Use type \a XMC_SCU_SYSTEM_RESET_REQUEST_t for accessing these enum parameters. + */ +typedef enum XMC_SCU_SYSTEM_RESET_REQUEST +{ + XMC_SCU_RESET_REQUEST_FLASH_ECC_ERROR = SCU_RESET_RSTCON_ECCRSTEN_Msk, /**< Reset when ECC double bit error occurs.*/ + XMC_SCU_RESET_REQUEST_CLOCK_LOSS = SCU_RESET_RSTCON_LOCRSTEN_Msk, /**< Reset when loss of clock occurs.*/ + XMC_SCU_RESET_REQUEST_SRAM_PARITY_ERROR = SCU_RESET_RSTCON_SPERSTEN_Msk, /**< Reset when SRAM parity error occurs.*/ + XMC_SCU_RESET_REQUEST_USIC_SRAM_PARITY_ERROR = SCU_RESET_RSTCON_U0PERSTEN_Msk /**< Reset when USIC0 memory parity error occurs.*/ +} XMC_SCU_SYSTEM_RESET_REQUEST_t; + +/** + * Defines list of events that can generate SCU interrupt. These enums can be used to configure events + * in \a SRMSK register for assertion of interrupt. All the enum items are tabulated as per bits present + * in \a SRMSK register. Use type \a XMC_SCU_INTERRUPT_EVENT_t for accessing these enum parameters. These + * enums can also be used for checking the status of events from the \a SRSTAT register. + */ +#if (UC_SERIES == XMC14) +typedef uint64_t XMC_SCU_INTERRUPT_EVENT_t; +#else +typedef uint32_t XMC_SCU_INTERRUPT_EVENT_t; +#endif + +/** + * Defines possible sources of RTC clock. These enums can be used to configure \a RTCCLKSEL bits of \a CLKCR Clock Control + * Register. Use type \a XMC_SCU_CLOCK_RTCCLKSRC_t for accessing these enum parameters. + */ +typedef enum XMC_SCU_CLOCK_RTCCLKSRC +{ + XMC_SCU_CLOCK_RTCCLKSRC_DCO2 = (0x0UL << SCU_CLK_CLKCR_RTCCLKSEL_Pos), /**< RTC clock source is standby clock. */ + XMC_SCU_CLOCK_RTCCLKSRC_ERU_IOUT0 = (0x1UL << SCU_CLK_CLKCR_RTCCLKSEL_Pos), /**< RTC clock source is external clock from + ERU0.IOUT0. */ + XMC_SCU_CLOCK_RTCCLKSRC_ACMP0_OUT = (0x2UL << SCU_CLK_CLKCR_RTCCLKSEL_Pos), /**< RTC clock source is external clock from + ACMP0.OUT. */ + XMC_SCU_CLOCK_RTCCLKSRC_ACMP1_OUT = (0x3UL << SCU_CLK_CLKCR_RTCCLKSEL_Pos), /**< RTC clock source is external clock from + ACMP1.OUT. */ + XMC_SCU_CLOCK_RTCCLKSRC_ACMP2_OUT = (0x4UL << SCU_CLK_CLKCR_RTCCLKSEL_Pos), /**< RTC clock source is external clock from + ACMP2.OUT. */ +#if (UC_SERIES == XMC14) || defined(DOXYGEN) + XMC_SCU_CLOCK_RTCCLKSRC_OSCLP = (0x5UL << SCU_CLK_CLKCR_RTCCLKSEL_Pos) /**< 32.768kHz XTAL clock via OSC_LP. @note Only available for XMC1400 series */ +#endif +} XMC_SCU_CLOCK_RTCCLKSRC_t; + +/** + * Defines possible sources of peripheral clock (PCLK). These enums can be used to configure \a PCLKSEL bits of \a CLKCR + * Clock Control Register. Use type \a XMC_SCU_CLOCK_PCLKSRC_t for accessing these enum parameters. + */ +typedef enum XMC_SCU_CLOCK_PCLKSRC +{ + XMC_SCU_CLOCK_PCLKSRC_MCLK = (0UL << SCU_CLK_CLKCR_PCLKSEL_Pos), /**< MCLK as the source for PCLK. */ + XMC_SCU_CLOCK_PCLKSRC_DOUBLE_MCLK = (1UL << SCU_CLK_CLKCR_PCLKSEL_Pos) /**< Source of PCLK is twice the MCLK. */ +} XMC_SCU_CLOCK_PCLKSRC_t; + +#if (UC_SERIES == XMC14) || defined(DOXYGEN) +/** + * DCLK clock source selection + * @note Only available in XMC1400 series + */ +typedef enum XMC_SCU_CLOCK_DCLKSRC +{ + XMC_SCU_CLOCK_DCLKSRC_DCO1 = 0UL << SCU_CLK_CLKCR1_DCLKSEL_Pos, /**< Internal oscillator DCO1 (48MHz) */ + XMC_SCU_CLOCK_DCLKSRC_EXT_XTAL = 1UL << SCU_CLK_CLKCR1_DCLKSEL_Pos, /**< External crystal oscillator */ +} XMC_SCU_CLOCK_DCLKSRC_t; + +/** + * OSCHP mode + * @note Only available in XMC1400 series + */ +typedef enum XMC_SCU_CLOCK_OSCHP_MODE +{ + XMC_SCU_CLOCK_OSCHP_MODE_OSC = 0UL << SCU_ANALOG_ANAOSCHPCTRL_MODE_Pos, /**< Oscillator is enabled and in active power mode with shaper enabled */ + XMC_SCU_CLOCK_OSCHP_MODE_DIRECT = 1UL << SCU_ANALOG_ANAOSCHPCTRL_MODE_Pos, /**< Oscillator in power down mode with shaper enabled */ + XMC_SCU_CLOCK_OSCHP_MODE_DISABLED = 3UL << SCU_ANALOG_ANAOSCHPCTRL_MODE_Pos, /**< Oscillator in power down mode with shaper enabled */ +} XMC_SCU_CLOCK_OSCHP_MODE_t; + +/** + * OSCLP mode + * @note Only available in XMC1400 series + */ +typedef enum XMC_SCU_CLOCK_OSCLP_MODE +{ + XMC_SCU_CLOCK_OSCLP_MODE_OSC = 0UL << SCU_ANALOG_ANAOSCLPCTRL_MODE_Pos, /**< Oscillator is enabled and in active power mode with shaper enabled */ + XMC_SCU_CLOCK_OSCLP_MODE_DISABLED = 3UL << SCU_ANALOG_ANAOSCLPCTRL_MODE_Pos, /**< Oscillator in power down mode with shaper enabled */ +} XMC_SCU_CLOCK_OSCLP_MODE_t; + +/** + * Clock source for synchronization + * @note Only available in XMC1400 series + */ +typedef enum XMC_SCU_CLOCK_SYNC_CLKSRC +{ + XMC_SCU_CLOCK_SYNC_CLKSRC_OSCLP = 0U << SCU_ANALOG_ANASYNC1_XTAL_SEL_Pos, + XMC_SCU_CLOCK_SYNC_CLKSRC_OSCHP = 1U << SCU_ANALOG_ANASYNC1_XTAL_SEL_Pos, +} XMC_SCU_CLOCK_SYNC_CLKSRC_t; + +#endif /* (UC_SERIES == XMC14) */ + +/** + * Defines the list of peripherals that support clock gating. After a master reset, only core, memories, SCU + * and PORT peripheral are not clock gated. The rest of the peripherals are by default clock gated. + * All the enum items are tabulated as per bits present in \a CGATSTAT0 register. + * Use type \a XMC_SCU_PERIPHERAL_CLOCK_t for accessing these enum parameters. + * @note Peripherals availability depends on device + */ +typedef enum XMC_SCU_PERIPHERAL_CLOCK +{ +#if defined(VADC) + XMC_SCU_PERIPHERAL_CLOCK_VADC = SCU_CLK_CGATSTAT0_VADC_Msk, /**< VADC peripheral clock gate. */ +#endif +#if defined(CCU80) + XMC_SCU_PERIPHERAL_CLOCK_CCU80 = SCU_CLK_CGATSTAT0_CCU80_Msk, /**< CCU80 peripheral clock gate. */ +#endif +#if defined(CCU40) + XMC_SCU_PERIPHERAL_CLOCK_CCU40 = SCU_CLK_CGATSTAT0_CCU40_Msk, /**< CCU40 peripheral clock gate. */ +#endif +#if defined(USIC0) + XMC_SCU_PERIPHERAL_CLOCK_USIC0 = SCU_CLK_CGATSTAT0_USIC0_Msk, /**< USIC0 peripheral clock gate. */ +#endif +#if defined(BCCU0) + XMC_SCU_PERIPHERAL_CLOCK_BCCU0 = SCU_CLK_CGATSTAT0_BCCU0_Msk, /**< BCCU0 peripheral clock gate. */ +#endif +#if defined(LEDTS0) + XMC_SCU_PERIPHERAL_CLOCK_LEDTS0 = SCU_CLK_CGATSTAT0_LEDTS0_Msk, /**< LEDTS0 peripheral clock gate. */ +#endif +#if defined(LEDTS1) + XMC_SCU_PERIPHERAL_CLOCK_LEDTS1 = SCU_CLK_CGATSTAT0_LEDTS1_Msk, /**< LEDTS1 peripheral clock gate. */ +#endif +#if defined(POSIF0) + XMC_SCU_PERIPHERAL_CLOCK_POSIF0 = SCU_CLK_CGATSTAT0_POSIF0_Msk, /**< POSIF0 peripheral clock gate. */ +#endif +#if defined(MATH) + XMC_SCU_PERIPHERAL_CLOCK_MATH = SCU_CLK_CGATSTAT0_MATH_Msk, /**< MATH peripheral clock gate. */ +#endif + XMC_SCU_PERIPHERAL_CLOCK_WDT = SCU_CLK_CGATSTAT0_WDT_Msk, /**< WDT peripheral clock gate. */ + XMC_SCU_PERIPHERAL_CLOCK_RTC = SCU_CLK_CGATSTAT0_RTC_Msk, /**< RTC peripheral clock gate. */ +#if defined(CCU81) + XMC_SCU_PERIPHERAL_CLOCK_CCU81 = SCU_CLK_CGATSTAT0_CCU81_Msk, /**< CCU80 peripheral clock gate. */ +#endif +#if defined(CCU41) + XMC_SCU_PERIPHERAL_CLOCK_CCU41 = SCU_CLK_CGATSTAT0_CCU41_Msk, /**< CCU80 peripheral clock gate. */ +#endif +#if defined(USIC1) + XMC_SCU_PERIPHERAL_CLOCK_USIC1 = SCU_CLK_CGATSTAT0_USIC1_Msk, /**< USIC0 peripheral clock gate. */ +#endif +#if defined(LEDTS2) + XMC_SCU_PERIPHERAL_CLOCK_LEDTS2 = SCU_CLK_CGATSTAT0_LEDTS2_Msk, /**< LEDTS1 peripheral clock gate. */ +#endif +#if defined(POSIF1) + XMC_SCU_PERIPHERAL_CLOCK_POSIF1 = SCU_CLK_CGATSTAT0_POSIF1_Msk, /**< POSIF0 peripheral clock gate. */ +#endif +#if defined(CAN) + XMC_SCU_PERIPHERAL_CLOCK_MCAN = SCU_CLK_CGATSTAT0_MCAN0_Msk, /**< POSIF0 peripheral clock gate. */ +#endif +} XMC_SCU_PERIPHERAL_CLOCK_t; + + +/** + * Defines options for Capture/Compare unit timer slice trigger that enables synchronous start function available on the \a SCU, + * \a CCUCON register. Use type \a XMC_SCU_CCU_TRIGGER_t for accessing these enum parameters. + */ +typedef enum XMC_SCU_CCU_TRIGGER +{ + XMC_SCU_CCU_TRIGGER_CCU40 = SCU_GENERAL_CCUCON_GSC40_Msk, /**< Trigger CCU40 peripheral. */ +#if defined(CCU80) + XMC_SCU_CCU_TRIGGER_CCU80 = SCU_GENERAL_CCUCON_GSC80_Msk, /**< Trigger CCU80 peripheral. */ +#endif +#if defined(CCU41) + XMC_SCU_CCU_TRIGGER_CCU41 = SCU_GENERAL_CCUCON_GSC41_Msk, /**< Trigger CCU40 peripheral. */ +#endif +#if defined(CCU81) + XMC_SCU_CCU_TRIGGER_CCU81 = SCU_GENERAL_CCUCON_GSC81_Msk, /**< Trigger CCU80 peripheral. */ +#endif +} XMC_SCU_CCU_TRIGGER_t; + +#if (UC_SERIES == XMC14) || defined(DOXYGEN) +/** + * Selects the service request connected to the interrupt node. + * @image html "xmc1400_irqmux.png" + * @note Only available for XMC1400 series + */ +typedef enum XMC_SCU_IRQCTRL +{ + XMC_SCU_IRQCTRL_SCU_SR0_IRQ0 = (0U << 8U) | 0U, /**< SCU_SR0 connected to IRQ0 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR0_IRQ0 = (0U << 8U) | 1U, /**< CAN0_SR0 connected to IRQ0 */ +#endif + XMC_SCU_IRQCTRL_CCU40_SR0_IRQ0 = (0U << 8U) | 2U, /**< CCU40_SR0 connected to IRQ0 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_SCU_SR0_OR_CAN0_SR0_IRQ0 = (0U << 8U) | 3U, /**< SCU_SR0 and CAN_SR0 are both connected to IRQ0*/ +#endif + + XMC_SCU_IRQCTRL_SCU_SR1_IRQ1 = (1U << 8U) | 0U, /**< SCU_SR1 connected to IRQ1 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR1_IRQ1 = (1U << 8U) | 1U, /**< CAN0_SR1 connected to IRQ1 */ +#endif +#if defined(CCU80) + XMC_SCU_IRQCTRL_CCU80_SR0_IRQ1 = (1U << 8U) | 2U, /**< CCU80_SR0 connected to IRQ1 */ +#endif +#if defined(CAN) + XMC_SCU_IRQCTRL_SCU_SR1_OR_CAN0_SR1_IRQ1 = (1U << 8U) | 3U, /**< SCU_SR1 and CAN0_SR1 connected to IRQ1 */ +#endif + + XMC_SCU_IRQCTRL_SCU_SR2_IRQ2 = (2U << 8U) | 0U, /**< SCU_SR2 connected to IRQ2 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR2_IRQ2 = (2U << 8U) | 1U, /**< CAN0_SR2 connected to IRQ2 */ +#endif +#if defined(CCU80) + XMC_SCU_IRQCTRL_CCU80_SR1_IRQ2 = (2U << 8U) | 2U, /**< CCU80_SR1 connected to IRQ2 */ +#endif +#if defined(CAN) + XMC_SCU_IRQCTRL_SCU_SR2_OR_CAN0_SR2_IRQ2 = (2U << 8U) | 3U, /**< SCU_SR2 and CAN0_SR2 connected to IRQ2 */ +#endif + + XMC_SCU_IRQCTRL_ERU0_SR0_IRQ3 = (3U << 8U) | 0U, /**< ERU0_SR0 connected to IRQ3 */ + XMC_SCU_IRQCTRL_ERU1_SR0_IRQ3 = (3U << 8U) | 1U, /**< ERU1_SR0 connected to IRQ3 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR0_IRQ3 = (3U << 8U) | 2U, /**< CAN0_SR0 connected to IRQ3 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR0_OR_ERU1_SR0_IRQ3 = (3U << 8U) | 3U, /**< ERU0_SR0 and ERU1_SR0 connected to IRQ3 */ + + XMC_SCU_IRQCTRL_ERU0_SR1_IRQ4 = (4U << 8U) | 0U, /**< ERU0_SR1 connected to IRQ4 */ + XMC_SCU_IRQCTRL_ERU1_SR1_IRQ4 = (4U << 8U) | 1U, /**< ERU1_SR1 connected to IRQ4 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR1_IRQ4 = (4U << 8U) | 2U, /**< CAN0_SR1 connected to IRQ4 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR1_OR_ERU1_SR1_IRQ4 = (4U << 8U) | 3U, /**< ERU0_SR1 and ERU1_SR1 connected to IRQ4 */ + + XMC_SCU_IRQCTRL_ERU0_SR2_IRQ5 = (5U << 8U) | 0U, /**< ERU0_SR2 connected to IRQ5 */ + XMC_SCU_IRQCTRL_ERU1_SR2_IRQ5 = (5U << 8U) | 1U, /**< ERU1_SR2 connected to IRQ5 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR2_IRQ5 = (5U << 8U) | 2U, /**< CAN0_SR2 connected to IRQ5 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR2_OR_ERU1_SR2_IRQ5 = (5U << 8U) | 3U, /**< ERU0_SR2 and ERU1_SR2 connected to IRQ5 */ + + XMC_SCU_IRQCTRL_ERU0_SR3_IRQ6 = (6U << 8U) | 0U, /**< ERU0_SR3 connected to IRQ6 */ + XMC_SCU_IRQCTRL_ERU1_SR3_IRQ6 = (6U << 8U) | 1U, /**< ERU1_SR3 connected to IRQ6 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR3_IRQ6 = (6U << 8U) | 2U, /**< CAN0_SR3 connected to IRQ6 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR3_OR_ERU1_SR3_IRQ6 = (6U << 8U) | 3U, /**< ERU0_SR3 and ERU1_SR3 connected to IRQ6 */ + +#if defined(MATH) + XMC_SCU_IRQCTRL_MATH_SR0_IRQ7 = (7U << 8U) | 0U, /**< MATH_SR0 connected to IRQ7 */ +#endif +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR3_IRQ7 = (7U << 8U) | 1U, /**< CAN0_SR3 connected to IRQ7 */ +#endif + XMC_SCU_IRQCTRL_CCU40_SR1_IRQ7 = (7U << 8U) | 2U, /**< CCU40_SR1 connected to IRQ7 */ +#if defined(MATH) && defined(CAN) + XMC_SCU_IRQCTRL_MATH_SR0_OR_CAN0_SR3_IRQ7 = (7U << 8U) | 3U, /**< MATH_SR0 and CAN0_SR3 connected to IRQ7 */ +#endif + +#if defined(LEDTS2) + XMC_SCU_IRQCTRL_LEDTS2_SR0_IRQ8 = (8U << 8U) | 0U, /**< LEDTS2_SR0 connected to IRQ8 */ +#endif + XMC_SCU_IRQCTRL_CCU40_SR0_IRQ8 = (8U << 8U) | 1U, /**< CCU40_SR0 connected to IRQ8 */ +#if defined(CCU80) + XMC_SCU_IRQCTRL_CCU80_SR0_IRQ8 = (8U << 8U) | 2U, /**< CCU80_SR0 connected to IRQ8 */ +#endif +#if defined(LEDTS2) + XMC_SCU_IRQCTRL_LEDTS2_SR0_OR_CCU40_SR0_IRQ8 = (8U << 8U) | 3U, /**< LEDTS2_SR0 and CCU40_SR0 connected to IRQ8 */ +#endif + + XMC_SCU_IRQCTRL_USIC0_SR0_IRQ9 = (9U << 8U) | 0U, /**< USIC0_SR0 connected to IRQ9 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC1_SR0_IRQ9 = (9U << 8U) | 1U, /**< USIC1_SR0 connected to IRQ9 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR0_IRQ9 = (9U << 8U) | 2U, /**< ERU0_SR0 connected to IRQ9 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC0_SR0_OR_USIC1_SR0_IRQ9 = (9U << 8U) | 3U, /**< USIC0_SR0 and USIC1_SR0 connected to IRQ9 */ +#endif + + XMC_SCU_IRQCTRL_USIC0_SR1_IRQ10 = (10U << 8U) | 0U, /**< USIC0_SR1 connected to IRQ10 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC1_SR1_IRQ10 = (10U << 8U) | 1U, /**< USIC1_SR1 connected to IRQ10 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR1_IRQ10 = (10U << 8U) | 2U, /**< ERU0_SR1 connected to IRQ10 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC0_SR1_OR_USIC1_SR1_IRQ10 = (10U << 8U) | 3U, /**< USIC0_SR1 and USIC1_SR1 connected to IRQ10 */ +#endif + + XMC_SCU_IRQCTRL_USIC0_SR2_IRQ11 = (11U << 8U) | 0U, /**< USIC0_SR2 connected to IRQ11 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC1_SR2_IRQ11 = (11U << 8U) | 1U, /**< USIC1_SR2 connected to IRQ11 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR2_IRQ11 = (11U << 8U) | 2U, /**< ERU0_SR2 connected to IRQ11 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC0_SR2_OR_USIC1_SR2_IRQ11 = (11U << 8U) | 3U, /**< USIC0_SR2 and USIC1_SR2 connected to IRQ11 */ +#endif + + XMC_SCU_IRQCTRL_USIC0_SR3_IRQ12 = (12U << 8U) | 0U, /**< USIC0_SR3 connected to IRQ12 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC1_SR3_IRQ12 = (12U << 8U) | 1U, /**< USIC1_SR3 connected to IRQ12 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR3_IRQ12 = (12U << 8U) | 2U, /**< ERU0_SR3 connected to IRQ12 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC0_SR3_OR_USIC1_SR3_IRQ12 = (12U << 8U) | 3U, /**< USIC0_SR3 and USIC1_SR3 connected to IRQ12 */ +#endif + + XMC_SCU_IRQCTRL_USIC0_SR4_IRQ13 = (13U << 8U) | 0U, /**< USIC0_SR4 connected to IRQ13 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC1_SR4_IRQ13 = (13U << 8U) | 1U, /**< USIC1_SR4 connected to IRQ13 */ +#endif +#if defined(CCU80) + XMC_SCU_IRQCTRL_CCU80_SR1_IRQ13 = (13U << 8U) | 2U, /**< CCU80_SR1 connected to IRQ13 */ +#endif +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC0_SR4_OR_USIC1_SR4_IRQ13 = (13U << 8U) | 3U, /**< USIC0_SR4 and USIC1_SR4 connected to IRQ13 */ +#endif + + XMC_SCU_IRQCTRL_USIC0_SR5_IRQ14 = (14U << 8U) | 0U, /**< USIC0_SR5 connected to IRQ14 */ +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC1_SR5_IRQ14 = (14U << 8U) | 1U, /**< USIC1_SR5 connected to IRQ14 */ +#endif +#if defined(POSIF0) + XMC_SCU_IRQCTRL_POSIF0_SR0_IRQ14 = (14U << 8U) | 2U, /**< POSIF0_SR0 connected to IRQ14 */ +#endif +#if defined(USIC1) + XMC_SCU_IRQCTRL_USIC0_SR5_OR_USIC1_SR5_IRQ14 = (14U << 8U) | 3U, /**< USIC0_SR5 and USIC1_SR5 connected to IRQ14 */ +#endif + + XMC_SCU_IRQCTRL_VADC0_C0SR0_IRQ15 = (15U << 8U) | 0U, /**< VADC0_C0SR0 connected to IRQ15 */ + XMC_SCU_IRQCTRL_USIC0_SR0_IRQ15 = (15U << 8U) | 1U, /**< USIC0_SR0 connected to IRQ15 */ +#if defined(POSIF0) + XMC_SCU_IRQCTRL_POSIF0_SR1_IRQ15 = (15U << 8U) | 2U, /**< POSIF0_SR1 connected to IRQ15 */ +#endif + XMC_SCU_IRQCTRL_VADC0_C0SR0_OR_USIC0_SR0_IRQ15 = (15U << 8U) | 3U, /**< VADC0_C0SR0 and USIC0_SR0 connected to IRQ15 */ + + XMC_SCU_IRQCTRL_VADC0_C0SR1_IRQ16 = (16U << 8U) | 0U, /**< VADC0_C0SR1 connected to IRQ16 */ + XMC_SCU_IRQCTRL_USIC0_SR1_IRQ16 = (16U << 8U) | 1U, /**< USIC0_SR1 connected to IRQ16 */ + XMC_SCU_IRQCTRL_CCU40_SR2_IRQ16 = (16U << 8U) | 2U, /**< CCU40_SR2 connected to IRQ16 */ + XMC_SCU_IRQCTRL_VADC0_C0SR1_OR_USIC0_SR1_IRQ16 = (16U << 8U) | 3U, /**< VADC0_C0SR1 and USIC0_SR1 connected to IRQ16 */ + + XMC_SCU_IRQCTRL_VADC0_G0SR0_IRQ17 = (17U << 8U) | 0U, /**< VADC0_G0SR0 connected to IRQ17 */ + XMC_SCU_IRQCTRL_USIC0_SR2_IRQ17 = (17U << 8U) | 1U, /**< USIC0_SR2 connected to IRQ17 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR0_IRQ17 = (17U << 8U) | 2U, /**< CAN0_SR0 connected to IRQ17 */ +#endif + XMC_SCU_IRQCTRL_VADC0_G0SR0_OR_USIC0_SR2_IRQ17 = (17U << 8U) | 3U, /**< VADC0_G0SR0 and USIC0_SR2 connected to IRQ17 */ + + XMC_SCU_IRQCTRL_VADC0_G0SR1_IRQ18 = (18U << 8U) | 0U, /**< VADC0_G0SR1 connected to IRQ18 */ + XMC_SCU_IRQCTRL_USIC0_SR3_IRQ18 = (18U << 8U) | 1U, /**< USIC0_SR3 connected to IRQ18 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR1_IRQ18 = (18U << 8U) | 2U, /**< CAN0_SR1 connected to IRQ18 */ +#endif + XMC_SCU_IRQCTRL_VADC0_G0SR1_OR_USIC0_SR3_IRQ18 = (18U << 8U) | 3U, /**< VADC0_G0SR1 and USIC0_SR3 connected to IRQ18 */ + + XMC_SCU_IRQCTRL_VADC0_G1SR0_IRQ19 = (19U << 8U) | 0U, /**< VADC0_G1SR0 connected to IRQ19 */ + XMC_SCU_IRQCTRL_USIC0_SR4_IRQ19 = (19U << 8U) | 1U, /**< USIC0_SR4 connected to IRQ19 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR2_IRQ19 = (19U << 8U) | 2U, /**< CAN0_SR2 connected to IRQ19 */ +#endif + XMC_SCU_IRQCTRL_VADC0_G1SR0_OR_USIC0_SR4_IRQ19 = (19U << 8U) | 3U, /**< VADC0_G1SR0 and USIC0_SR4 connected to IRQ19 */ + + XMC_SCU_IRQCTRL_VADC0_G1SR1_IRQ20 = (20U << 8U) | 0U, /**< VADC0_G1SR1 connected to IRQ20 */ + XMC_SCU_IRQCTRL_USIC0_SR5_IRQ20 = (20U << 8U) | 1U, /**< USIC0_SR5 connected to IRQ20 */ +#if defined(CAN) + XMC_SCU_IRQCTRL_CAN0_SR4_IRQ20 = (20U << 8U) | 2U, /**< CAN0_SR4 connected to IRQ20 */ +#endif + XMC_SCU_IRQCTRL_VADC0_G1SR1_OR_USIC0_SR5_IRQ20 = (20U << 8U) | 3U, /**< VADC0_G1SR1 and USIC0_SR5 connected to IRQ20 */ + + XMC_SCU_IRQCTRL_CCU40_SR0_IRQ21 = (21U << 8U) | 0U, /**< CCU40_SR0 connected to IRQ21 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU41_SR0_IRQ21 = (21U << 8U) | 1U, /**< CCU41_SR0 connected to IRQ21 */ +#endif + XMC_SCU_IRQCTRL_USIC0_SR0_IRQ21 = (21U << 8U) | 2U, /**< USIC0_SR0 connected to IRQ21 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU40_SR0_OR_CCU41_SR0_IRQ21 = (21U << 8U) | 3U, /**< CCU40_SR0 and CCU41_SR0 connected to IRQ21 */ +#endif + + XMC_SCU_IRQCTRL_CCU40_SR1_IRQ22 = (22U << 8U) | 0U, /**< CCU40_SR1 connected to IRQ22 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU41_SR1_IRQ22 = (22U << 8U) | 1U, /**< CCU41_SR1 connected to IRQ22 */ +#endif + XMC_SCU_IRQCTRL_USIC0_SR1_IRQ22 = (22U << 8U) | 2U, /**< USIC0_SR1 connected to IRQ22 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU40_SR0_OR_CCU41_SR0_IRQ22 = (22U << 8U) | 3U, /**< CCU40_SR0 and CCU41_SR0 connected to IRQ22 */ +#endif + + XMC_SCU_IRQCTRL_CCU40_SR2_IRQ23 = (23U << 8U) | 0U, /**< CCU40_SR2 connected to IRQ23 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU41_SR2_IRQ23 = (23U << 8U) | 1U, /**< CCU41_SR2 connected to IRQ23 */ +#endif + XMC_SCU_IRQCTRL_USIC0_SR2_IRQ23 = (23U << 8U) | 2U, /**< USIC0_SR2 connected to IRQ23 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU40_SR2_OR_CCU41_SR2_IRQ23 = (23U << 8U) | 3U, /**< CCU40_SR2 and CCU41_SR2 connected to IRQ23 */ +#endif + + XMC_SCU_IRQCTRL_CCU40_SR3_IRQ24 = (24U << 8U) | 0U, /**< CCU40_SR3 connected to IRQ24 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU41_SR3_IRQ24 = (24U << 8U) | 1U, /**< CCU41_SR3 connected to IRQ24 */ +#endif + XMC_SCU_IRQCTRL_USIC0_SR3_IRQ24 = (24U << 8U) | 2U, /**< USIC0_SR3 connected to IRQ24 */ +#if defined(CCU41) + XMC_SCU_IRQCTRL_CCU40_SR3_OR_CCU41_SR3_IRQ24 = (24U << 8U) | 3U, /**< CCU40_SR3 and CCU41_SR3 connected to IRQ24 */ +#endif + +#if defined(CCU80) + XMC_SCU_IRQCTRL_CCU80_SR0_IRQ25 = (25U << 8U) | 0U, /**< CCU80_SR0 connected to IRQ25 */ +#endif +#if defined(CCU81) + XMC_SCU_IRQCTRL_CCU81_SR0_IRQ25 = (25U << 8U) | 1U, /**< CCU81_SR0 connected to IRQ25 */ +#endif + XMC_SCU_IRQCTRL_USIC0_SR4_IRQ25 = (25U << 8U) | 2U, /**< USIC0_SR4 connected to IRQ25 */ +#if defined(CCU80) && defined(CCU81) + XMC_SCU_IRQCTRL_CCU80_SR0_OR_CCU81_SR0_IRQ25 = (25U << 8U) | 3U, /**< CCU80_SR0 and CCU81_SR0 connected to IRQ25 */ +#endif + +#if defined(CCU80) + XMC_SCU_IRQCTRL_CCU80_SR1_IRQ26 = (26U << 8U) | 0U, /**< CCU80_SR1 connected to IRQ26 */ +#endif +#if defined(CCU81) + XMC_SCU_IRQCTRL_CCU81_SR1_IRQ26 = (26U << 8U) | 1U, /**< CCU81_SR1 connected to IRQ26 */ +#endif + XMC_SCU_IRQCTRL_USIC0_SR5_IRQ26 = (26U << 8U) | 2U, /**< USIC0_SR5 connected to IRQ26 */ +#if defined(CCU80) && defined(CCU81) + XMC_SCU_IRQCTRL_CCU80_SR1_OR_CCU81_SR1_IRQ26 = (26U << 8U) | 3U, /**< CCU80_SR1 and CCU81_SR1 connected to IRQ26 */ +#endif + +#if defined(POSIF0) + XMC_SCU_IRQCTRL_POSIF0_SR0_IRQ27 = (27U << 8U) | 0U, /**< POSIF0_SR0 connected to IRQ27 */ +#endif +#if defined(POSIF1) + XMC_SCU_IRQCTRL_POSIF1_SR0_IRQ27 = (27U << 8U) | 1U, /**< POSIF1_SR0 connected to IRQ27 */ +#endif + XMC_SCU_IRQCTRL_CCU40_SR3_IRQ27 = (27U << 8U) | 2U, /**< CCU40_SR3 connected to IRQ27 */ +#if defined(POSIF0) && defined(POSIF1) + XMC_SCU_IRQCTRL_POSIF0_SR0_OR_POSIF1_SR0_IRQ27 = (27U << 8U) | 3U, /**< POSIF0_SR0 and POSIF1_SR0 connected to IRQ27 */ +#endif + +#if defined(POSIF0) + XMC_SCU_IRQCTRL_POSIF0_SR1_IRQ28 = (28U << 8U) | 0U, /**< POSIF0_SR1 connected to IRQ28 */ +#endif +#if defined(POSIF1) + XMC_SCU_IRQCTRL_POSIF1_SR1_IRQ28 = (28U << 8U) | 1U, /**< POSIF1_SR1 connected to IRQ28 */ +#endif + XMC_SCU_IRQCTRL_ERU0_SR0_IRQ28 = (28U << 8U) | 2U, /**< ERU0_SR0 connected to IRQ28 */ +#if defined(POSIF0) && defined(POSIF1) + XMC_SCU_IRQCTRL_POSIF0_SR1_OR_POSIF1_SR1_IRQ28 = (28U << 8U) | 3U, /**< POSIF0_SR1 and POSIF1_SR1 connected to IRQ28 */ +#endif + +#if defined(LEDTS0) + XMC_SCU_IRQCTRL_LEDTS0_SR0_IRQ29 = (29U << 8U) | 0U, /**< LEDTS0_SR0 connected to IRQ29 */ +#endif + XMC_SCU_IRQCTRL_CCU40_SR1_IRQ29 = (29U << 8U) | 1U, /**< CCU40_SR1 connected to IRQ29 */ + XMC_SCU_IRQCTRL_ERU0_SR1_IRQ29 = (29U << 8U) | 2U, /**< ERU0_SR1 connected to IRQ29 */ +#if defined(LEDTS0) + XMC_SCU_IRQCTRL_LEDTS0_SR0_OR_CCU40_SR1_IRQ29 = (29U << 8U) | 3U, /**< LEDTS0_SR0 and CCU40_SR1 connected to IRQ29 */ +#endif + +#if defined(LEDTS1) + XMC_SCU_IRQCTRL_LEDTS1_SR0_IRQ30 = (30U << 8U) | 0U, /**< LEDTS1_SR0 connected to IRQ30 */ +#endif + XMC_SCU_IRQCTRL_CCU40_SR2_IRQ30 = (30U << 8U) | 1U, /**< CCU40_SR2 connected to IRQ30 */ + XMC_SCU_IRQCTRL_ERU0_SR2_IRQ30 = (30U << 8U) | 2U, /**< ERU0_SR2 connected to IRQ30 */ +#if defined(LEDTS1) + XMC_SCU_IRQCTRL_LEDTS0_SR0_OR_CCU40_SR1_IRQ30 = (30U << 8U) | 3U, /**< LEDTS0_SR0 and CCU40_SR1 connected to IRQ30 */ +#endif + +#if defined(BCCU0) + XMC_SCU_IRQCTRL_BCCU0_SR0_IRQ31 = (31U << 8U) | 0U, /**< BCCU0_SR0 connected to IRQ31 */ +#endif + XMC_SCU_IRQCTRL_CCU40_SR3_IRQ31 = (31U << 8U) | 1U, /**< CCU40_SR3 connected to IRQ31 */ + XMC_SCU_IRQCTRL_ERU0_SR3_IRQ31 = (31U << 8U) | 2U, /**< ERU0_SR3 connected to IRQ31 */ +#if defined(BCCU0) + XMC_SCU_IRQCTRL_BCCU0_SR0_OR_CCU40_SR3_IRQ31 = (31U << 8U) | 3U, /**< BCCU0_SR0 and CCU40_SR3 connected to IRQ31 */ +#endif +} XMC_SCU_IRQCTRL_t; +#endif /* XMC_SERIES = XMC14 */ + +/** TODO + * + */ +typedef enum XMC_SCU_POWER_MONITOR_RANGE +{ + XMC_SCU_POWER_MONITOR_RANGE_2_25V = 0U << SCU_ANALOG_ANAVDEL_VDEL_SELECT_Pos, /**< */ + XMC_SCU_POWER_MONITOR_RANGE_3_00V = 1U << SCU_ANALOG_ANAVDEL_VDEL_SELECT_Pos, /**< */ + XMC_SCU_POWER_MONITOR_RANGE_4_40V = 2U << SCU_ANALOG_ANAVDEL_VDEL_SELECT_Pos /**< */ +} XMC_SCU_POWER_MONITOR_RANGE_t; + +/** TODO + * + */ +typedef enum XMC_SCU_POWER_MONITOR_DELAY +{ + XMC_SCU_POWER_MONITOR_DELAY_1US = 0U << SCU_ANALOG_ANAVDEL_VDEL_TIM_ADJ_Pos, /**< */ + XMC_SCU_POWER_MONITOR_DELAY_500NS = 1U << SCU_ANALOG_ANAVDEL_VDEL_TIM_ADJ_Pos, /**< */ + XMC_SCU_POWER_MONITOR_DELAY_250NS = 2U << SCU_ANALOG_ANAVDEL_VDEL_TIM_ADJ_Pos, /**< */ + XMC_SCU_POWER_MONITOR_DELAY_NONE = 3U << SCU_ANALOG_ANAVDEL_VDEL_TIM_ADJ_Pos /**< */ +} XMC_SCU_POWER_MONITOR_DELAY_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ +/** + * Defines a data structure for initializing the data of the supply voltage monitoring block. + * Supply voltage monitoring block consists of 2 detectors namely External voltage detector (VDEL) and External brownout + * detector (BDE) in the EVR that are used to monitor the VDDP. \a VDEL detector compares the supply voltage against a + * pre-warning threshold voltage. + * Use type \a XMC_SCU_SUPPLYMONITOR_t for accessing these structure parameters. + */ +typedef struct XMC_SCU_SUPPLYMONITOR +{ + uint32_t ext_supply_threshold; /**< External supply range (VDEL Range Select).\n + \b Range: +

*/ + uint32_t ext_supply_monitor_speed; /**< Speed of the voltage monitor(VDEL Timing Setting).\n + \b Range: +
    +
  • 00B sets monitor speed typ 1us - slowest response time +
  • 01B sets monitor speed typ 500n +
  • 10B sets monitor speed typ 250n +
  • 11B sets monitor speed with no delay - fastest response time. +
*/ + bool enable_prewarning_int; /**< Configure pre-warning interrupt generation.\n + \b Range: +
    +
  • \a true to enable the interrupt. +
  • \a false to disable the interrupt. +
*/ + bool enable_vdrop_int; /**< Configure VDROP interrupt generation.\n + \b Range: +
    +
  • \a true to enable the interrupt. +
  • \a false to disable the interrupt. +
*/ + bool enable_vclip_int; /**< Configure VCLIP interrupt.\n + \b Range: +
    +
  • \a true to enable the interrupt. +
  • \a false to disable the interrupt. +
*/ + bool enable_at_init; /**< Whether the monitor has to be enabled (VDEL unit Enable) after initialization.\n + \b Range: +
    +
  • \a true to enable after initialization. +
  • \a false to enable after initialization. +
*/ +} XMC_SCU_SUPPLYMONITOR_t; + +/** + * Defines a data structure for initializing the data of the clock functional block. + * Clock functional block configures clock dividers, peripheral and RTC clock source by configuring corresponding + * bits in \a CLKCR clock control register. + * Use type \a XMC_SCU_CLOCK_CONFIG_t for accessing these structure parameters. + */ +typedef struct XMC_SCU_CLOCK_CONFIG +{ +#if (UC_SERIES == XMC14) + uint16_t fdiv; /**< Fractional clock divider (FDIV). \b Range: 0 to 1023. */ +#else + uint8_t fdiv; /**< Fractional clock divider (FDIV). \b Range: 0 to 255. @note XMC1400 series extends the range to 1023 */ +#endif + uint8_t idiv; /**< Integer clock divider (IDIV). \b Range: 0 to 255. */ +#if (UC_SERIES == XMC14) || defined(DOXYGEN) + XMC_SCU_CLOCK_DCLKSRC_t dclk_src; /**< DCLK clock source selection. @note Only available in XMC1400 series */ + XMC_SCU_CLOCK_OSCHP_MODE_t oschp_mode; /**< OSCHP mode. @note Only available in XMC1400 series */ + XMC_SCU_CLOCK_OSCLP_MODE_t osclp_mode; /**< OSCLP mode. @note Only available in XMC1400 series */ +#endif + XMC_SCU_CLOCK_PCLKSRC_t pclk_src; /**< Source of PCLK Clock */ + XMC_SCU_CLOCK_RTCCLKSRC_t rtc_src; /**< Source of RTC Clock */ +} XMC_SCU_CLOCK_CONFIG_t; + +/** + * Defines the data structure for initializing the deep sleep mode. + * During deep sleep mode peripheral clock is disabled and flash is powered down. + * Use type \a XMC_SCU_CLOCK_DEEP_SLEEP_t for accessing these structure parameters. + */ +typedef struct XMC_SCU_CLOCK_DEEP_SLEEP +{ + bool flash_power_down; /**< Whether the device flash memory has to be powered down + during deep sleep mode.\n + \b Range: Set true to disable flash in deep sleep mode.*/ + uint32_t clock_gating_mask; /**< Configures mask value of clocks to be gated during deep sleep.\n + \b Range: Use type @ref XMC_SCU_PERIPHERAL_CLOCK_t to get the bitmask + of the peripheral clocks. Multiple peripherals can be combined by + using the \a OR operation.*/ +} XMC_SCU_CLOCK_DEEP_SLEEP_t; + +/********************************************************************************************************************* + * API PROTOTYPES + ********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * + * @param freq_khz Required MCLK frequency value in kHz.\n + * \b Range: XMC11/XMC12/XMC13 Device: 125 to 32000. + * XMC14 Device: 188 to 48000 when DCO1 is clock source for clock control unit. + * 79 to 48000 when OSC_HP is clock source for clock control unit.\n + * + * @return None + * + * \parDescription
+ * This API configures main clock (MCLK) frequency to requested frequency value.\n\n + * The API configures main clock by setting \a IDIV and \a FDIV bit's of the \a CLKCR register for + * XMC11/XMC12/XMC13/XMC14 Device and with additional \a FDIV bit (FDIV[9:8]) of the \a CLKCR1 register settings + * for XMC14 device. + * \parRelated APIs:
+ * XMC_SCU_CLOCK_ScaleMCLKFrequency()\n\n\n + */ +void XMC_SCU_CLOCK_SetMCLKFrequency(uint32_t freq_khz); + +/** + * + * @param idiv Divider value.\n + * \b Range: 0 to 255.\n + * @param fdiv Fractional Divider value.\n + * \b Range: XMC11/XMC12/XMC13 Device: 0 to 255. + * XMC14 Device: 0 to 1023.\n + * + * @return None + * + * \parDescription
+ * This API configures main clock (MCLK) frequency by updating user provided divider values.\n\n + * The API configures main clock by setting \a IDIV and \a FDIV bit's of the \a CLKCR register for + * XMC11/XMC12/XMC13/XMC14 Device and with additional \a FDIV bit (FDIV[9:8]) of the \a CLKCR1 register settings + * for XMC14 device. + * \parRelated APIs:
+ * XMC_SCU_CLOCK_SetMCLKFrequency()\n\n\n + */ +void XMC_SCU_CLOCK_ScaleMCLKFrequency(uint32_t idiv, uint32_t fdiv); + +/** + * + * @return None + * + * \parDescription
+ * Locks access to protected bit fields of the SCU.\n\n + * The bit protection scheme prevents changing selected register bits by unauthorized code. + * Bit protection scheme is enabled by writing 000000C3H to \a PASSWD register. By writing + * this value, the API is setting the \a MODE bit field to bit protection enabled state.\n + * List of Protected Register Bit Fields are mentioned below. \n + * + * + * + * + * + * + * + * + *
\a Register \a Bit fields
SCU_CLKCR FDIV, IDIV, PCLKSEL, RTCLKSEL
SCU_CGATSET0 All bits
SCU_CGATCLR0 All bits
SCU_ANAOFFSET ADJL_OFFSET
VADC0_ACCPROT0 All bits
VADC0_ACCPROT1 All bits
+ * + * \parRelated APIs:
+ * XMC_SCU_UnlockProtectedBits() \n\n\n + */ +void XMC_SCU_LockProtectedBits(void); + +/** + * + * @return None + * + * \parDescription
+ * Unlocks access to protected bit fields of the SCU.\n\n + * The bit protection scheme prevents changing selected register bits by unauthorized code. + * Bit protection scheme can be temporarily(for 32 MCLK cycles) disabled by writing 000000C0H to \a PASSWD register. + * By writing this value, the API is setting the \a MODE bit field to bit protection disabled state. The API + * waits for the protection to be disabled after changing the \a MODE.\n + * User can change the values of the protected bit fields within 32 MCLK cycles. After 32 MCLK cycles the lock will + * be enabled automatically. + * List of Protected Register Bit Fields are mentioned below. \n + * + * + * + * + * + * + * + * + *
\a Register \a Bit fields
SCU_CLKCR FDIV, IDIV, PCLKSEL, RTCLKSEL
SCU_CGATSET0 All bits
SCU_CGATCLR0 All bits
SCU_ANAOFFSET ADJL_OFFSET
VADC0_ACCPROT0 All bits
VADC0_ACCPROT1 All bits
+ * + * \parRelated APIs:
+ * XMC_SCU_LockProtectedBits() \n\n\n + */ +void XMC_SCU_UnlockProtectedBits(void); + +/** + * + * @param obj Pointer to data structure consisting voltage monitoring block configuration.\n + * \b Range: Use type @ref XMC_SCU_SUPPLYMONITOR_t for detailed description of structure members. + * + * @return None + * + * \parDescription
+ * Initializes power supply monitoring unit.\n\n + * Supply voltage monitoring block consist of 2 detectors namely External voltage detector (VDEL) and External brownout + * detector (BDE) in the EVR that are used to monitor the VDDP. \a VDEL detector compares the supply voltage against a + * pre-warning threshold voltage \a ext_supply_threshold. The threshold level is programmable via register \a ANAVDEL.VDEL_SELECT. An interrupt + * if enabled via \a enable_prewarning_int, will be triggered if a level below this threshold is detected and the flag, VDDPI, + * in SRRAW register bit is set. Similarly interrupts can be enabled for the events of VCLIP and prewarning, using the structure members, + * \a enable_vclip_int and \a enable_prewarning_int. The handlers for these interrupts have to be explicitly defined using + * the API XMC_SCU_INTERRUPT_SetEventHandler(). + * \parRelated APIs:
+ * XMC_SCU_INTERRUPT_SetEventHandler()\n\n\n + */ +void XMC_SCU_SupplyMonitorInit(const XMC_SCU_SUPPLYMONITOR_t *obj); + +/** + * @param limit Kelvin degree temperature lower compare limit in range [233,388] + * @return XMC_SCU_STATUS_t status of limit installation + * + * \parDescription
+ * Set lower temperature compare limit. + * A low temperature interrupt (SCU_IRQ1) is triggered if Tchip < limit and the event and interrupt are enabled. + * Alternatively XMC_SCU_LowTemperature() can be used to check the status. + * \parRelated APIs:
+ * XMC_SCU_LowTemperature()\n\n\n + * + **/ +XMC_SCU_STATUS_t XMC_SCU_SetTempLowLimit(uint32_t limit); + +/** + * @param limit Kelvin degree temperature higher compare limit in range [233,388] + * @return XMC_SCU_STATUS_t status of limit installation + * + * \parDescription
+ * Set higher temperature compare limit. + * A high temperature interrupt (SCU_IRQ1) is triggered if Tchip > limit and the event and interrupt are enabled. + * Alternatively XMC_SCU_HighTemperature() can be used to check the status. + * \parRelated APIs:
+ * XMC_SCU_HighTemperature()\n\n\n + * + **/ +XMC_SCU_STATUS_t XMC_SCU_SetTempHighLimit(uint32_t limit); + +/** + * + * @param lower_temp Lower threshold value for the die temperature.\n + * \b Range: 0 to 65535(16 bit unsigned value). + * @param upper_temp Upper threshold value for the die temperature.\n + * \b Range: 0 to 65535(16 bit unsigned value). + * + * @return None + * + * \parDescription
+ * Configures upper and lower thresholds of die temperature as raw digital values into temperature sensor.\n\n + * The API configures \a ANATSEIH and \a ANATSEIL registers for upper and lower die temperature threshold limits + * respectively.\n + * It is recommended to use following steps:\n + * - Call \a XMC_SCU_StopTempMeasurement to stop temperature measurement if it was started previously.\n + * - Call \a XMC_SCU_SetRawTempLimits with desired lower and upper temperature threshold limit values.\n + * - Finally call \a XMC_SCU_StartTempMeasurement to start temperature measurement.\n + * + * \parRelated APIs:
+ * XMC_SCU_StopTempMeasurement(), XMC_SCU_StartTempMeasurement() \n\n\n + */ +void XMC_SCU_SetRawTempLimits(const uint32_t lower_temp, const uint32_t upper_temp); + +// /* API to program temperature limits in centigrade into temperature sensor unit */ // need to implement in future +// void XMC_SCU_SetTempLimits(const uint32_t lower_temp, const uint32_t upper_temp); +/** + * + * @return XMC_SCU_STATUS_t Status of starting the temperature measurement.\n + * \b Range: Use type @ref XMC_SCU_STATUS_t to identify the result.\n + * XMC_SCU_STATUS_OK- Temperature measurement started successfully.\n + * Always returns the above status. + * + * \parDescription
+ * Starts die temperature measurement using internal temperature sensor.\n\n + * The API, enables die temperature measurement and waits for about 10000 cycles until + * temperature measurement result is available on \a SCU_ANALOG->ANATSEMON bit fields.\n + * It is recommended to use following steps:\n + * - Call \a XMC_SCU_StopTempMeasurement to stop temperature measurement if it was started previously.\n + * - Call \a XMC_SCU_SetRawTempLimits with desired lower and upper temperature threshold limit values if it is needed.\n + * - Call \a XMC_SCU_StartTempMeasurement to start temperature measurement.\n + * - Read die temperature value using \a XMC_SCU_GetTemperature API.\n + * \parRelated APIs:
+ * XMC_SCU_StopTempMeasurement(), XMC_SCU_SetRawTempLimits(), XMC_SCU_GetTemperature() \n\n\n + */ +void XMC_SCU_StartTempMeasurement(void); + +/** + * @return None + * + * \parDescription
+ * Stops the die temperature measurement.\n\n + * Die temperature measurement is stopped by disabling the sensor using \a TSE_EN bit of + * \a ANATSECTRL register. + * \parRelated APIs:
+ * XMC_SCU_StartTempMeasurement(), XMC_SCU_SetRawTempLimits(), XMC_SCU_GetTemperature() \n\n\n + */ +void XMC_SCU_StopTempMeasurement(void); + +/** + * + * @return bool Result of checking whether the die temperature is more than the upper threshold.\n + * \b Range: \a false if temperature is below the upper threshold. \a true if temperature + * has exceeded the upper threshold configured in \a ANATSEIH register. + * + * \parDescription
+ * Check if the temperature has exceeded the upper threshold value.\n\n + * The API checks for \a TSE_HIGH bit (TSE Compare High Temperature Event Status bit) of \a SRRAW register. + * The bit will be set when the \a TSE_MON value in \a ANATSEMON register exceeds the value of + * \a TSE_IH value in \a ANATSEIH register. + * \parRelated APIs:
+ * XMC_SCU_StartTempMeasurement(), XMC_SCU_SetRawTempLimits(), XMC_SCU_GetTemperature(), XMC_SCU_LowTemperature() \n\n\n + */ +bool XMC_SCU_HighTemperature(void); + +/** + * + * @return bool Result of checking whether the die temperature is less than the lower threshold.\n + * \b Range: \a false if temperature is higher than the lower threshold. \a true if temperature + * has dropped below the lower threshold configured in \a ANATSEIL register. + * + * \parDescription
+ * Check if the temperature has dropped below the lower threshold value.\n\n + * The API checks for \a TSE_LOW bit (TSE Compare Low Temperature Event Status bit) of \a SRRAW register. + * The bit will be set when the \a TSE_MON value in \a ANATSEMON register drops below the value of + * \a TSE_IL value in \a ANATSEIL register. + * \parRelated APIs:
+ * XMC_SCU_StartTempMeasurement(), XMC_SCU_SetRawTempLimits(), XMC_SCU_GetTemperature(), XMC_SCU_HighTemperature() \n\n\n + */ +bool XMC_SCU_LowTemperature(void); + +/** + * @return uint32_t Raw die temperature value. \b Range: 16 bit value. + * + * \parDescription
+ * Provides the raw die temperature value.\n\n + * The API reads temperature measurement result from \a SCU_ANALOG->ANATSEMON bit fields. + * \parRelated APIs:
+ * XMC_SCU_StartTempMeasurement() \n\n\n + */ +uint32_t XMC_SCU_GetTemperature(void); + +/** + * @return uint32_t Calculate die temperature value. \b Range: 16 bit value. + * + * \parDescription
+ * Calculates the die temperature value using ROM function.\n\n + * \parRelated APIs:
+ * XMC_SCU_StartTempMeasurement() \n\n\n + */ +uint32_t XMC_SCU_CalcTemperature(void); + +/** + * + * @return true DTS Measurement Done + * @return false DTS Measurement not Done + * + * \parDescription
+ * This functions checks the status of the DTS Measurement completion.\n\n + * \parRelated APIs:
+ * XMC_SCU_StartTempMeasurement() \n\n\n + */ +__STATIC_INLINE bool XMC_SCU_IsTempMeasurementDone(void) +{ + return ((SCU_INTERRUPT->SRRAW & SCU_INTERRUPT_SRRAW_TSE_DONE_Msk) != 0U); +} + +/** + * @return None + * + * \parDescription
+ * Trigger device master reset.\n\n + * The API triggers master reset by setting the \a MRSTEN bit of \a RSTCON register. + * It also internally triggers system reset. Almost all the logics of the device are affected by this reset. + * \parRelated APIs:
+ * XMC_SCU_RESET_EnableResetRequest() \n\n\n + */ +__STATIC_INLINE void XMC_SCU_RESET_AssertMasterReset(void) +{ + SCU_RESET->RSTCON |= SCU_RESET_RSTCON_MRSTEN_Msk; +} +/** + * + * @param request Reset source to trigger the device reset.\n + * \b Range: Use type @ref XMC_SCU_SYSTEM_RESET_REQUEST_t to identify the reset source.\n + * XMC_SCU_RESET_REQUEST_FLASH_ECC_ERROR- Reset when flash memory double bit error is detected.\n + * XMC_SCU_RESET_REQUEST_CLOCK_LOSS- Reset when loss of clock is detected.\n + * XMC_SCU_RESET_REQUEST_SRAM_PARITY_ERROR- Reset when SRAM parity error is detected.\n + * XMC_SCU_RESET_REQUEST_USIC_SRAM_PARITY_ERROR- Reset when USIC0 SRAM parity error is detected.\n + * + * @return None + * + * \parDescription
+ * Configures trigger for system reset from the selected source.\n\n + * The API configures the reset source specific bit in the \a RSTCON register. + * Multiple reset sources can be combined using \a OR operation. By enabling + * the reset using this API will not trigger the reset. The reset will happen when + * the configured source event is detected. + * \parRelated APIs:
+ * XMC_SCU_RESET_AssertMasterReset() \n\n\n + */ +__STATIC_INLINE void XMC_SCU_RESET_EnableResetRequest(uint32_t request) +{ + SCU_RESET->RSTCON |= request; +} + +/** + * + * @return uint32_t Fast peripheral clock frequency in Hertz. + * + * \parDescription
+ * Provides the clock frequency of peripherals on the peripheral bus that are using a shared functional clock.\n\n + * The value is derived using the bitfield \a PCLKSEL from \a CLKCR register. Peripheral clock + * can have 2 times the frequency of system clock if the \a PCLKSEL is set. + * \parRelated APIs:
+ * XMC_SCU_CLOCK_SetFastPeripheralClockSource() \n\n\n + */ +uint32_t XMC_SCU_CLOCK_GetFastPeripheralClockFrequency(void); + +/** + * + * @param source Fast peripheral clock source.\n + * \b Range: Use type @ref XMC_SCU_CLOCK_PCLKSRC_t to identify the clock source.\n + * XMC_SCU_CLOCK_PCLKSRC_MCLK- Use MCLK as the peripheral clock.\n + * XMC_SCU_CLOCK_PCLKSRC_DOUBLE_MCLK- peripheral clock will be 2 times the MCLK frequency. + * + * @return None + * + * \parDescription
+ * Configures the source of peripheral clock. \n\n + * The peripheral clock can be either same as MCLK or twice the frequency of MCLK. + * \parRelated APIs:
+ * XMC_SCU_CLOCK_GetFastPeripheralClockFrequency() \n\n\n + */ +void XMC_SCU_CLOCK_SetFastPeripheralClockSource(const XMC_SCU_CLOCK_PCLKSRC_t source); + +/** + * + * @param temperature measured temperature using the on-chip temperature sensor + * + * @return None + * + * \parDescription
+ * DCO1 clock frequency can be calibrated during runtime to achieve a better accuracy. + * This function start the DCO1 calibration based on temperature. + * + */ +void XMC_SCU_CLOCK_CalibrateOscillatorOnTemperature(int32_t temperature); + +#if (UC_SERIES == XMC14) || defined(DOXYGEN) +/** + * + * @param sync_clk Clock source selected as external reference. @ref XMC_SCU_CLOCK_SYNC_CLKSRC_t + * @param prescaler integer(\f$\frac{3000 \times f_{OSC}[MHz]}{48}\f$) + * @param syn_preload integer(\f$\frac{48 \times prescaler}{f_{OSC}[MHz]}\f$) + * + * @return None + * + * \parDescription
+ * DCO1 clock frequency can be calibrated during runtime to achieve a better accuracy. + * This function starts the automatic DCO1 calibration based on the selected clock source. + * @note Only available for XMC1400 series + */ +void XMC_SCU_CLOCK_EnableDCO1ExtRefCalibration(XMC_SCU_CLOCK_SYNC_CLKSRC_t sync_clk, uint32_t prescaler, uint32_t syn_preload); + +/** + * + * @return None + * + * \parDescription
+ * This function stops the automatic DCO1 calibration based on the selected clock source. + * @note Only available for XMC1400 series + */ +void XMC_SCU_CLOCK_DisableDCO1ExtRefCalibration(void); + +/** + * + * @return true DCO1 is synchronized to the selected XTAL frequency + * @return false Actual DCO1 frequency is out of target + * + * \parDescription
+ * This functions checks the status of the synchronisation + * @note Only available for XMC1400 series + */ +bool XMC_SCU_CLOCK_IsDCO1ExtRefCalibrationReady(void); + +/** + * + * @return None + * + * \parDescription
+ * This function enables the watchdog on the DCO1 frequency + * @note Only available for XMC1400 series + */ +void XMC_SCU_CLOCK_EnableDCO1OscillatorWatchdog(void); + +/** + * + * @return None + * + * \parDescription
+ * This function disables the watchdog on the DCO1 frequency + * @note Only available for XMC1400 series + */ +void XMC_SCU_CLOCK_DisableDCO1OscillatorWatchdog(void); + +/** + * + * @return None + * + * \parDescription
+ * This function clears the status of the watchdog on the DCO1 frequency + * @note Only available for XMC1400 series + */ +void XMC_SCU_CLOCK_ClearDCO1OscillatorWatchdogStatus(void); + +/* + * + * @return true The OSC frequency is usable + * @return false The OSC frequency is not usable. Frequency is too high or too low + * + * \parDescription
+ * This function checks if the DCO1 frequency is in the limits of the watchdog + * @note Only available for XMC1400 series + */ +bool XMC_SCU_CLOCK_IsDCO1ClockFrequencyUsable(void); + +/** + * This function selects service request source for a NVIC interrupt node. + * The XMC1400 series has up to 54 peripheral service requests. + * The Cortex M0 however has 32 interrupts available for peripherals. + * This function allows you to select which 32 peripheral requests of the 54 the CPU should react on. + * + * @param irq_number Interrupt number, 0 to 31 + * @param source Peripheral service request. See @ref XMC_SCU_IRQCTRL_t + * + * @note Only available for XMC1400 series + */ +void XMC_SCU_SetInterruptControl(uint8_t irq_number, XMC_SCU_IRQCTRL_t source); + +/** + * This function enables the Prefetch Unit (PFU). + * The purpose of the Prefetch unit is to reduce the Flash latency gap at higher system + * frequencies to increase the instruction per cycle performance. + * + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_SCU_EnablePrefetchUnit(void) +{ + SCU_GENERAL->PFUCR &= ~SCU_GENERAL_PFUCR_PFUBYP_Msk; +} + +/** + * This function disables the Prefetch Unit (PFU). + * The purpose of the Prefetch unit is to reduce the Flash latency gap at higher system + * frequencies to increase the instruction per cycle performance. + * + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_SCU_DisablePrefetchUnit(void) +{ + SCU_GENERAL->PFUCR |= SCU_GENERAL_PFUCR_PFUBYP_Msk; +} + +#endif + +/** + * + * @param range VDEL Range Select ::XMC_SCU_POWER_MONITOR_RANGE_t + * @param delay VDEL Timing Setting ::XMC_SCU_POWER_MONITOR_DELAY_t + * @return None + * + * \parDescription
+ * Enables VDEL detector. VDEL detector compares the supply voltage against a pre-warning threshold voltage + * + * @note Brown Out Trap need to be enabled previously + */ +__STATIC_INLINE void XMC_SCU_POWER_EnableMonitor(XMC_SCU_POWER_MONITOR_RANGE_t range, XMC_SCU_POWER_MONITOR_DELAY_t delay) +{ + SCU_ANALOG->ANAVDEL = SCU_ANALOG_ANAVDEL_VDEL_EN_Msk | + (uint32_t)range | + (uint32_t)delay; +} + +/** + * + * @return None + * + * \parDescription
+ * Disables VDEL detector + */ +__STATIC_INLINE void XMC_SCU_POWER_DisableMonitor(void) +{ + SCU_ANALOG->ANAVDEL &= ~SCU_ANALOG_ANAVDEL_VDEL_EN_Msk; +} + +/** + * + * @param flags may be any of:
+ * \ref XMC_SCU_BMI_HWCFG_CAN_BSL (only available for XMC1400 series with CAN Module)
+ * \ref XMC_SCU_BMI_HWCFG_CAN_BSLTO (only available for XMC1400 series with CAN Module)
+ * \ref XMC_SCU_BMI_HWCFG_SBSL_CANOPEN (only available for XMC1400 series with CAN Module)
+ * \ref XMC_SCU_BMI_HWCFG_ASC_BSL
+ * \ref XMC_SCU_BMI_HWCFG_UPM
+ * \ref XMC_SCU_BMI_HWCFG_UMD
+ * \ref XMC_SCU_BMI_HWCFG_UMHAR
+ * \ref XMC_SCU_BMI_HWCFG_SSC_BSL
+ * \ref XMC_SCU_BMI_HWCFG_ASC_BSLTO
+ * \ref XMC_SCU_BMI_HWCFG_SSC_BSLTO
+ * \ref XMC_SCU_BMI_HWCFG_SBSL

+ * optionally OR'd together with any of:
+ * \ref XMC_SCU_BMI_DAPTYP_SWD
+ * \ref XMC_SCU_BMI_DAPTYP_SPD

+ * optionally OR'd together with any of:
+ * \ref XMC_SCU_BMI_DAPDIS_CHANNEL_0
+ * \ref XMC_SCU_BMI_DAPDIS_CHANNEL_1

+ * @image html "xmc1000_debugif.png" + * optionally OR'd together with any of (only available for XMC1400 series with CAN Module):
+ * \ref XMC_SCU_BMI_CANCLK_DCO1
+ * \ref XMC_SCU_BMI_CANCLK_OSCHP

+ * + * @param timeout Only relevant if a start up mode is selected that uses timeout. The time-out duration is BSLTO*2664000 MCLK cycles, the supported time-out range is 0.3-5s (333...4995ms) + * @return false only upon error, if OK the procedure triggers a reset and does not return to calling routine + * + * \parDescription
+ * This procedure initiates installation of a new BMI value. In particular, it can be used as + * well as to restore the state upon delivery for a device already in User Productive mode. + * + * @code + * // Switch to ASC Bootstrap Loader + * XMC_SCU_SetBMI(XMC_SCU_BMI_HWCFG_ASC_BSL, 0); + * + * // Switch to Debug user mode SWD1 (pins P1.3 and P1.2) + * XMC_SCU_SetBMI(XMC_SCU_BMI_HWCFG_UMD | XMC_SCU_BMI_DAPTYP_SWD | XMC_SCU_BMI_DAPDIS_CHANNEL_1, 0); + * @endcode + */ +uint32_t XMC_SCU_SetBMI(uint32_t flags, uint8_t timeout); + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* UC_FAMILY == XMC1 */ + +#endif /* XMC1_SCU_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_usic_map.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_usic_map.h new file mode 100644 index 00000000..4362cf9d --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc1_usic_map.h @@ -0,0 +1,3598 @@ +/** + * @file xmc1_usic_map.h + * @date 2016-08-22 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial version + * + * 2015-08-25: + * - Added XMC1400 + * + * 2016-06-17: + * - Added support for XMC1201 TSSOP28, XMC1302 TSSOP28, XMC1402 TSSOP38, XMC1403 VQFN40 + * + * 2016-08-22: + * - Added USIC1_C0_DX1_P3_4 for XMC14xx 64 pins package + * + * @endcond + * + */ + +#ifndef XMC1_USIC_MAP_H +#define XMC1_USIC_MAP_H + +/********************************************************************************************************************** + * MACROS + *********************************************************************************************************************/ + +#define USIC_INPUT_ALWAYS_1 7 + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN24) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == VQFN40) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP16) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1100) && (UC_PACKAGE == TSSOP38) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1200) && (UC_PACKAGE == TSSOP38) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == VQFN40) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP28) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1201) && (UC_PACKAGE == TSSOP38) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN24) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == VQFN40) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP16) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1202) && (UC_PACKAGE == TSSOP28) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN24) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == VQFN40) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP16) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1301) && (UC_PACKAGE == TSSOP38) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN24) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == VQFN40) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP16) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP28) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1302) && (UC_PACKAGE == TSSOP38) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == LQFP64) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P3_3 4 +#define USIC1_C0_DX0_P3_4 5 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P3_4 4 +#define USIC1_C0_DX1_P4_3 1 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P3_1 5 +#define USIC1_C0_DX2_P4_10 3 +#define USIC1_C0_DX2_P4_11 4 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX2_P4_8 1 +#define USIC1_C0_DX2_P4_9 2 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P1_8 1 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX3_P3_2 2 +#define USIC1_C0_DX3_P4_0 3 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P1_8 1 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_P3_2 2 +#define USIC1_C0_DX4_P4_0 3 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P1_7 1 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_P4_1 2 +#define USIC1_C0_DX5_P4_2 3 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX0_P3_1 5 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P1_8 2 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_P1_7 2 +#define USIC1_C1_DX2_P3_3 0 +#define USIC1_C1_DX2_P3_4 1 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX3_P3_2 3 +#define USIC1_C1_DX3_P4_11 0 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_P3_2 3 +#define USIC1_C1_DX4_P4_11 0 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_10 0 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1401) && (UC_PACKAGE == VQFN48) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == LQFP64) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P3_3 4 +#define USIC1_C0_DX0_P3_4 5 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P3_4 4 +#define USIC1_C0_DX1_P4_3 1 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P3_1 5 +#define USIC1_C0_DX2_P4_10 3 +#define USIC1_C0_DX2_P4_11 4 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX2_P4_8 1 +#define USIC1_C0_DX2_P4_9 2 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P1_8 1 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX3_P3_2 2 +#define USIC1_C0_DX3_P4_0 3 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P1_8 1 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_P3_2 2 +#define USIC1_C0_DX4_P4_0 3 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P1_7 1 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_P4_1 2 +#define USIC1_C0_DX5_P4_2 3 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX0_P3_1 5 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P1_8 2 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_P1_7 2 +#define USIC1_C1_DX2_P3_3 0 +#define USIC1_C1_DX2_P3_4 1 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX3_P3_2 3 +#define USIC1_C1_DX3_P4_11 0 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_P3_2 3 +#define USIC1_C1_DX4_P4_11 0 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_10 0 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN40) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN48) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == VQFN64) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P3_3 4 +#define USIC1_C0_DX0_P3_4 5 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P3_4 4 +#define USIC1_C0_DX1_P4_3 1 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P3_1 5 +#define USIC1_C0_DX2_P4_10 3 +#define USIC1_C0_DX2_P4_11 4 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX2_P4_8 1 +#define USIC1_C0_DX2_P4_9 2 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P1_8 1 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX3_P3_2 2 +#define USIC1_C0_DX3_P4_0 3 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P1_8 1 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_P3_2 2 +#define USIC1_C0_DX4_P4_0 3 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P1_7 1 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_P4_1 2 +#define USIC1_C0_DX5_P4_2 3 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX0_P3_1 5 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P1_8 2 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_P1_7 2 +#define USIC1_C1_DX2_P3_3 0 +#define USIC1_C1_DX2_P3_4 1 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX3_P3_2 3 +#define USIC1_C1_DX3_P4_11 0 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_P3_2 3 +#define USIC1_C1_DX4_P4_11 0 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_10 0 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1402) && (UC_PACKAGE == TSSOP38) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN40) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN48) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN64) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P3_3 4 +#define USIC1_C0_DX0_P3_4 5 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P3_4 4 +#define USIC1_C0_DX1_P4_3 1 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P3_1 5 +#define USIC1_C0_DX2_P4_10 3 +#define USIC1_C0_DX2_P4_11 4 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX2_P4_8 1 +#define USIC1_C0_DX2_P4_9 2 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P1_8 1 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX3_P3_2 2 +#define USIC1_C0_DX3_P4_0 3 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P1_8 1 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_P3_2 2 +#define USIC1_C0_DX4_P4_0 3 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P1_7 1 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_P4_1 2 +#define USIC1_C0_DX5_P4_2 3 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX0_P3_1 5 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P1_8 2 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_P1_7 2 +#define USIC1_C1_DX2_P3_3 0 +#define USIC1_C1_DX2_P3_4 1 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX3_P3_2 3 +#define USIC1_C1_DX3_P4_11 0 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_P3_2 3 +#define USIC1_C1_DX4_P4_11 0 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_10 0 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == LQFP64) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P3_3 4 +#define USIC1_C0_DX0_P3_4 5 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P3_4 4 +#define USIC1_C0_DX1_P4_3 1 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P3_1 5 +#define USIC1_C0_DX2_P4_10 3 +#define USIC1_C0_DX2_P4_11 4 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX2_P4_8 1 +#define USIC1_C0_DX2_P4_9 2 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P1_8 1 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX3_P3_2 2 +#define USIC1_C0_DX3_P4_0 3 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P1_8 1 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_P3_2 2 +#define USIC1_C0_DX4_P4_0 3 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P1_7 1 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_P4_1 2 +#define USIC1_C0_DX5_P4_2 3 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX0_P3_1 5 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P1_8 2 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_P1_7 2 +#define USIC1_C1_DX2_P3_3 0 +#define USIC1_C1_DX2_P3_4 1 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX3_P3_2 3 +#define USIC1_C1_DX3_P4_11 0 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_P3_2 3 +#define USIC1_C1_DX4_P4_11 0 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_10 0 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN48) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN64) +#define USIC0_C0_DX0_DX3INS 6 +#define USIC0_C0_DX0_P0_14 0 +#define USIC0_C0_DX0_P0_15 1 +#define USIC0_C0_DX0_P1_0 2 +#define USIC0_C0_DX0_P1_1 3 +#define USIC0_C0_DX0_P2_0 4 +#define USIC0_C0_DX0_P2_1 5 +#define USIC0_C0_DX1_DX0INS 5 +#define USIC0_C0_DX1_DX4INS 6 +#define USIC0_C0_DX1_P0_14 0 +#define USIC0_C0_DX1_P0_7 2 +#define USIC0_C0_DX1_P0_8 1 +#define USIC0_C0_DX1_P1_1 3 +#define USIC0_C0_DX1_P2_0 4 +#define USIC0_C0_DX2_DX5INS 6 +#define USIC0_C0_DX2_P0_0 0 +#define USIC0_C0_DX2_P0_10 2 +#define USIC0_C0_DX2_P0_11 3 +#define USIC0_C0_DX2_P0_12 4 +#define USIC0_C0_DX2_P0_13 5 +#define USIC0_C0_DX2_P0_9 1 +#define USIC0_C0_DX3_DOUT0 6 +#define USIC0_C0_DX3_DX5INS 5 +#define USIC0_C0_DX3_P2_10 2 +#define USIC0_C0_DX3_P2_2 0 +#define USIC0_C0_DX3_P2_4 1 +#define USIC0_C0_DX3_P2_6 4 +#define USIC0_C0_DX3_P2_8 3 +#define USIC0_C0_DX4_DX5INS 5 +#define USIC0_C0_DX4_P2_10 2 +#define USIC0_C0_DX4_P2_2 0 +#define USIC0_C0_DX4_P2_4 1 +#define USIC0_C0_DX4_P2_6 4 +#define USIC0_C0_DX4_P2_8 3 +#define USIC0_C0_DX4_SCLKOUT 6 +#define USIC0_C0_DX5_P1_4 4 +#define USIC0_C0_DX5_P1_6 5 +#define USIC0_C0_DX5_P2_3 1 +#define USIC0_C0_DX5_P2_5 3 +#define USIC0_C0_DX5_P2_7 2 +#define USIC0_C0_DX5_P2_9 0 +#define USIC0_C0_DX5_SELO0 6 +#define USIC0_C1_DX0_DX3INS 6 +#define USIC0_C1_DX0_P0_6 2 +#define USIC0_C1_DX0_P0_7 3 +#define USIC0_C1_DX0_P1_2 1 +#define USIC0_C1_DX0_P1_3 0 +#define USIC0_C1_DX0_P2_10 5 +#define USIC0_C1_DX0_P2_11 4 +#define USIC0_C1_DX1_DX0INS 5 +#define USIC0_C1_DX1_DX4INS 6 +#define USIC0_C1_DX1_P0_7 2 +#define USIC0_C1_DX1_P0_8 1 +#define USIC0_C1_DX1_P1_3 0 +#define USIC0_C1_DX1_P2_11 4 +#define USIC0_C1_DX2_DX5INS 6 +#define USIC0_C1_DX2_P0_0 0 +#define USIC0_C1_DX2_P0_10 2 +#define USIC0_C1_DX2_P0_11 3 +#define USIC0_C1_DX2_P0_9 1 +#define USIC0_C1_DX2_P1_1 4 +#define USIC0_C1_DX2_P2_0 5 +#define USIC0_C1_DX3_DOUT0 6 +#define USIC0_C1_DX3_DX5INS 5 +#define USIC0_C1_DX3_P2_1 0 +#define USIC0_C1_DX3_P2_3 2 +#define USIC0_C1_DX3_P2_5 4 +#define USIC0_C1_DX3_P2_7 3 +#define USIC0_C1_DX3_P2_9 1 +#define USIC0_C1_DX4_DX5INS 5 +#define USIC0_C1_DX4_P2_1 0 +#define USIC0_C1_DX4_P2_3 2 +#define USIC0_C1_DX4_P2_5 4 +#define USIC0_C1_DX4_P2_7 3 +#define USIC0_C1_DX4_P2_9 1 +#define USIC0_C1_DX4_SCLKOUT 6 +#define USIC0_C1_DX5_P1_4 4 +#define USIC0_C1_DX5_P1_5 5 +#define USIC0_C1_DX5_P2_2 0 +#define USIC0_C1_DX5_P2_4 1 +#define USIC0_C1_DX5_P2_6 3 +#define USIC0_C1_DX5_P2_8 2 +#define USIC0_C1_DX5_SR0 6 +#define USIC1_C0_DX0_DX3INS 6 +#define USIC1_C0_DX0_P0_2 0 +#define USIC1_C0_DX0_P0_3 1 +#define USIC1_C0_DX0_P3_3 4 +#define USIC1_C0_DX0_P3_4 5 +#define USIC1_C0_DX0_P4_4 2 +#define USIC1_C0_DX0_P4_5 3 +#define USIC1_C0_DX1_DX0INS 5 +#define USIC1_C0_DX1_DX4INS 6 +#define USIC1_C0_DX1_P0_2 0 +#define USIC1_C0_DX1_P3_4 4 +#define USIC1_C0_DX1_P4_3 1 +#define USIC1_C0_DX1_P4_5 2 +#define USIC1_C0_DX1_P4_6 3 +#define USIC1_C0_DX2_DX5INS 6 +#define USIC1_C0_DX2_P3_1 5 +#define USIC1_C0_DX2_P4_10 3 +#define USIC1_C0_DX2_P4_11 4 +#define USIC1_C0_DX2_P4_7 0 +#define USIC1_C0_DX2_P4_8 1 +#define USIC1_C0_DX2_P4_9 2 +#define USIC1_C0_DX3_DOUT0 6 +#define USIC1_C0_DX3_DX5INS 5 +#define USIC1_C0_DX3_P1_8 1 +#define USIC1_C0_DX3_P2_12 0 +#define USIC1_C0_DX3_P2_3 4 +#define USIC1_C0_DX3_P3_2 2 +#define USIC1_C0_DX3_P4_0 3 +#define USIC1_C0_DX4_DX5INS 5 +#define USIC1_C0_DX4_P1_8 1 +#define USIC1_C0_DX4_P2_12 0 +#define USIC1_C0_DX4_P2_3 4 +#define USIC1_C0_DX4_P3_2 2 +#define USIC1_C0_DX4_P4_0 3 +#define USIC1_C0_DX4_SCLKOUT 6 +#define USIC1_C0_DX5_P1_7 1 +#define USIC1_C0_DX5_P2_13 0 +#define USIC1_C0_DX5_P2_2 4 +#define USIC1_C0_DX5_P2_4 5 +#define USIC1_C0_DX5_P4_1 2 +#define USIC1_C0_DX5_P4_2 3 +#define USIC1_C0_DX5_SELO0 6 +#define USIC1_C1_DX0_DX3INS 6 +#define USIC1_C1_DX0_P0_0 0 +#define USIC1_C1_DX0_P0_1 1 +#define USIC1_C1_DX0_P2_12 2 +#define USIC1_C1_DX0_P2_13 3 +#define USIC1_C1_DX0_P3_0 4 +#define USIC1_C1_DX0_P3_1 5 +#define USIC1_C1_DX1_DX0INS 5 +#define USIC1_C1_DX1_DX4INS 6 +#define USIC1_C1_DX1_P0_1 0 +#define USIC1_C1_DX1_P1_8 2 +#define USIC1_C1_DX1_P2_12 1 +#define USIC1_C1_DX1_P3_0 3 +#define USIC1_C1_DX2_DX5INS 6 +#define USIC1_C1_DX2_P1_7 2 +#define USIC1_C1_DX2_P3_3 0 +#define USIC1_C1_DX2_P3_4 1 +#define USIC1_C1_DX2_SR0 5 +#define USIC1_C1_DX3_DOUT0 6 +#define USIC1_C1_DX3_DX5INS 5 +#define USIC1_C1_DX3_P0_15 1 +#define USIC1_C1_DX3_P2_4 2 +#define USIC1_C1_DX3_P2_6 4 +#define USIC1_C1_DX3_P3_2 3 +#define USIC1_C1_DX3_P4_11 0 +#define USIC1_C1_DX4_DX5INS 5 +#define USIC1_C1_DX4_P0_15 1 +#define USIC1_C1_DX4_P2_4 2 +#define USIC1_C1_DX4_P2_6 4 +#define USIC1_C1_DX4_P3_2 3 +#define USIC1_C1_DX4_P4_11 0 +#define USIC1_C1_DX4_SCLKOUT 6 +#define USIC1_C1_DX5_P0_14 1 +#define USIC1_C1_DX5_P2_3 2 +#define USIC1_C1_DX5_P2_5 3 +#define USIC1_C1_DX5_P2_7 4 +#define USIC1_C1_DX5_P4_10 0 +#define USIC1_C1_DX5_P4_4 5 +#define USIC1_C1_DX5_SELO0 6 +#endif + +#endif /* XMC1_USIC_MAP_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_acmp.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_acmp.h new file mode 100644 index 00000000..41d65273 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_acmp.h @@ -0,0 +1,424 @@ +/** + * @file xmc_acmp.h + * @date 2015-09-02 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2014-12-10: + * - Initial version + * 2015-02-20: + * - Removed unused declarations
+ * 2015-05-08: + * - Fixed sequence problem of low power mode in XMC_ACMP_Init() API
+ * - Fixed wrong register setting in XMC_ACMP_SetInput() API
+ * - Removed return type variable and by default comparator enable from XMC_ACMP_Init() API.
+ * Additional call to XMC_ACMP_EnableComparator() API needed to start Comparator after Init.
+ * 2015-06-04: + * - Removed return type variable and by default comparator enable from XMC_ACMP_Init() API.
+ * - Divided XMC_ACMP_SetInput into two 3 APIs to reduce the code size and complexity as stated below
+ * (a)XMC_ACMP_EnableReferenceDivider
+ * (b)XMC_ACMP_DisableReferenceDivider
+ * (c)XMC_ACMP_SetInput
+ * - Optimized enable and disable API's and moved to header file as static inline APIs. + * - XMC_ACMP_t typedef changed to structure which overrides the standard header file structure. + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * 2015-06-26: + * - API help documentation modified. + * 2015-09-02: + * - API help documentation modified for XMC1400 device support. + * @endcond + * + */ + +#ifndef XMC_ACMP_H +#define XMC_ACMP_H + + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup ACMP + * @brief Analog Comparator(ACMP) low level driver for XMC1 family of microcontrollers.
+ * + * The ACMP module consists of minimum of 3 analog comparators. Each analog comparator has two inputs, INP and INN. + * Input INP is compared with input INN in the pad voltage domain. + * It generates a digital comparator output signal. The digital comparator output signal is shifted down from VDDP + * power supply voltage level to VDDC core voltage level. The ACMP module provides the following functionalities.\n + * -# Monitor external voltage level + * -# Operates in low power mode + * -# Provides Inverted ouput option\n + + * \par The ACMP low level driver funtionalities + *
    + *
  1. Initializes an instance of analog comparator module with the @ref XMC_ACMP_CONFIG_t configuration structure + * using the API XMC_ACMP_Init().
  2. + *
  3. Programs the source of input(INP) specified by @ref XMC_ACMP_INP_SOURCE_t parameter using the API + * XMC_ACMP_SetInput().
  4. + *
  5. Sets the low power mode of operation using XMC_ACMP_SetLowPowerMode() API.
  6. + *
+ * @{ + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +/* If ACMP is available*/ +#if defined (COMPARATOR) + +#define XMC_ACMP0 (XMC_ACMP_t*)COMPARATOR /**< Comparator module base address defined*/ + +#if UC_SERIES == XMC14 +#define XMC_ACMP_MAX_INSTANCES (4U) /* Maximum number of Analog Comparators available*/ +#else +#define XMC_ACMP_MAX_INSTANCES (3U) /* Maximum number of Analog Comparators available*/ +#endif + +/* Checks if the pointer being passed is valid*/ +#define XMC_ACMP_CHECK_MODULE_PTR(PTR) (((PTR)== (XMC_ACMP_t*)COMPARATOR)) + +/* Checks if the instance being addressed is valid*/ +#define XMC_ACMP_CHECK_INSTANCE(INST) (((INST)< XMC_ACMP_MAX_INSTANCES)) + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/** + * Defines the return value of an API. + */ +typedef enum XMC_ACMP_STATUS +{ + XMC_ACMP_STATUS_SUCCESS = 0U, /**< API completes the execution successfully */ + XMC_ACMP_STATUS_ERROR , /**< API cannot fulfill the request */ +} XMC_ACMP_STATUS_t; + +/** + * Defines the hysteresis voltage levels to reduce noise sensitivity. + */ +typedef enum XMC_ACMP_HYSTERESIS +{ + XMC_ACMP_HYSTERESIS_OFF = 0U, /**< No hysteresis */ + XMC_ACMP_HYSTERESIS_10 , /**< Hysteresis = 10mv */ + XMC_ACMP_HYSTERESIS_15 , /**< Hysteresis = 15mv */ + XMC_ACMP_HYSTERESIS_20 /**< Hysteresis = 20mv */ +} XMC_ACMP_HYSTERESIS_t; + +/** + * Defines the comparator output status options. + */ +typedef enum XMC_ACMP_COMP_OUT +{ + XMC_ACMP_COMP_OUT_NO_INVERSION = 0U, /**< ACMP output is HIGH when, Input Positive(INP) greater than Input + Negative(INN). Vplus > Vminus */ + XMC_ACMP_COMP_OUT_INVERSION /**< ACMP output is HIGH when, Input Negative(INN) greater than Input + Positive(INP). Vminus > Vplus*/ +} XMC_ACMP_COMP_OUT_t; + +/** + * Defines the analog comparator input connection method. + */ +typedef enum XMC_ACMP_INP_SOURCE +{ + XMC_ACMP_INP_SOURCE_STANDARD_PORT = 0U, /**< Input is connected to port */ + XMC_ACMP_INP_SOURCE_ACMP1_INP_PORT = (uint16_t)(COMPARATOR_ANACMP0_ACMP0_SEL_Msk) /**< Input is connected to port + and ACMP1 INP */ +} XMC_ACMP_INP_SOURCE_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + + +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * ACMP module + */ +typedef struct { + __IO uint32_t ORCCTRL; + __I uint32_t RESERVED[726]; + __IO uint32_t ANACMP[XMC_ACMP_MAX_INSTANCES]; +} XMC_ACMP_t; + +/** + * Structure for initializing the ACMP module. It configures the ANACMP register of the respective input. + */ +typedef struct XMC_ACMP_CONFIG +{ + union + { + struct + { + uint32_t : 1; + uint32_t filter_disable : 1; /**< Comparator filter option for removing glitches. By default this option + is selected in ANACMP register. Setting this option disables the filter */ + uint32_t : 1; + uint32_t output_invert : 1; /**< Option to invert the comparator output. Use XMC_@ref XMC_ACMP_COMP_OUT_t type*/ + uint32_t hysteresis : 2; /**< Hysteresis voltage to reduce noise sensitivity. Select the voltage levels + from the values defined in @ref XMC_ACMP_HYSTERESIS_t. */ + uint32_t : 26; + }; + uint32_t anacmp; + }; +} XMC_ACMP_CONFIG_t; + +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif + +#ifdef __cplusplus + extern "C" { +#endif + +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ + +/** + * @param peripheral Constant pointer to analog comparator module, of @ref XMC_ACMP_t type. Use @ref XMC_ACMP0 macro. + * @param instance ACMP instance number.
+ * Range:
0 - ACMP0
+ * 1 - ACMP1
+ * 2 - ACMP2
+ * 3 - ACMP3 - Only applicable for XMC1400 devices
+ * + * @param config Pointer to configuration data. Refer data structure @ref XMC_ACMP_CONFIG_t for settings. + * @return + * None
+ * + * \parDescription:
+ * Initializes an instance of analog comparator module.
\n + * Configures the ANACMP resister with hysteresis, comparator filter and inverted comparator output. + * + * \parRelated APIs:
+ * None. + */ +void XMC_ACMP_Init(XMC_ACMP_t *const peripheral, uint32_t instance, const XMC_ACMP_CONFIG_t *const config); + +/** + * @param peripheral Constant pointer to analog comparator module, of @ref XMC_ACMP_t type. Use @ref XMC_ACMP0 macro. + * @param instance ACMP instance number.
+ * Range:
0 - ACMP0
+ * 1 - ACMP1
+ * 2 - ACMP2
+ * 3 - ACMP3 - Only applicable for XMC1400 devices
+ * @return + * None
+ * + * \parDescription:
+ * Enables an instance of ACMP module.
\n + * Starts the comparator by setting CMP_EN bit of respective ANACMP \a instance register. The \a instance number + * determines which analog comparator to be switched on. Call this API after the successful completion of the comparator + * initilization and input selection. + * + * \parRelated APIs:
+ * XMC_ACMP_DisableComparator().
+ */ +__STATIC_INLINE void XMC_ACMP_EnableComparator(XMC_ACMP_t *const peripheral, uint32_t instance) +{ + XMC_ASSERT("XMC_ACMP_EnableComparator:Wrong module pointer", XMC_ACMP_CHECK_MODULE_PTR(peripheral)) + XMC_ASSERT("XMC_ACMP_EnableComparator:Wrong instance number", XMC_ACMP_CHECK_INSTANCE(instance) ) + + peripheral->ANACMP[instance] |= (uint16_t)COMPARATOR_ANACMP0_CMP_EN_Msk; + +} + + +/** + * @param peripheral Constant pointer to analog comparator module, of @ref XMC_ACMP_t type. Use @ref XMC_ACMP0 macro. + * @param instance ACMP instance number.
+ * Range:
0 - ACMP0
+ * 1 - ACMP1
+ * 2 - ACMP2
+ * 3 - ACMP3 - Only applicable for XMC1400 devices
+ * @return + * None
+ * \parDescription:
+ * Disables an instance of ACMP module.
\n + * Stops the comparator by resetting CMP_EN bit of respective ANACMP \a instance register. The \a instance number + * determines which analog comparator to be switched off. + * + * \parRelated APIs:
+ * XMC_ACMP_EnableComparator(). + */ +__STATIC_INLINE void XMC_ACMP_DisableComparator(XMC_ACMP_t *const peripheral, uint32_t instance) +{ + XMC_ASSERT("XMC_ACMP_DisableComparator:Wrong module pointer", XMC_ACMP_CHECK_MODULE_PTR(peripheral)) + XMC_ASSERT("XMC_ACMP_DisableComparator:Wrong instance number", XMC_ACMP_CHECK_INSTANCE(instance) ) + + peripheral->ANACMP[instance] &= (uint16_t)(~((uint32_t)COMPARATOR_ANACMP0_CMP_EN_Msk)); +} + +/** + * @param None + * @return + * None
+ * + * \parDescription:
+ * Enables the reference divider for analog comparator instance 1.
\n + * ACMP1 input INP is driven by an internal reference voltage by setting DIV_EN bit of ANACMP1 register. + * Other comparator instances can also share this reference divider option by calling the XMC_ACMP_SetInput() API. + * + * \parRelated APIs:
+ * XMC_ACMP_SetInput(). + */ +__STATIC_INLINE void XMC_ACMP_EnableReferenceDivider(void) +{ + /* Enable the divider switch and connect the divided reference to ACMP1.INP */ + COMPARATOR->ANACMP1 |= (uint16_t)(COMPARATOR_ANACMP1_REF_DIV_EN_Msk); +} + +/** + * @param None + * @return + * None
+ * + * \parDescription:
+ * Disables the reference divider for analog comparator instance 1.
\n + * ACMP1 input INP is disconnected from the reference divider. This is achieved by reseting DIV_EN bit of ANACMP1 + * register. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_ACMP_DisableReferenceDivider(void) +{ + /* Disable the divider switch and use ACMP1.INP as standard port*/ + COMPARATOR->ANACMP1 &= (uint16_t)(~(COMPARATOR_ANACMP1_REF_DIV_EN_Msk)); +} + +/** + * @param peripheral Constant pointer to analog comparator module, of @ref XMC_ACMP_t type. Use @ref XMC_ACMP0 macro. + * @param instance ACMP instance number.
+ * Range:
0 - ACMP0
+ * 2 - ACMP2
+ * 3 - ACMP3 - Only applicable for XMC1400 devices
+ * @param source ACMP input source selection options.
+ * Range:
XMC_ACMP_INP_SOURCE_STANDARD_PORT - Input is connected to port
+ * XMC_ACMP_INP_SOURCE_ACMP1_INP_PORT - Input is connected to port and ACMP1 INP
+ * @return + * None
+ * + * \parDescription:
+ * Sets the analog comparartor input selection for ACMP0, ACMP2 instances.
\n + * Apart from ACMP1 instance, each ACMP instances can be connected to its own port and ACMP1 INP. + * Calling @ref XMC_ACMP_EnableReferenceDivider() API, after this API can share the reference divider to one of the + * comparartor input as explained in the following options.
+ * The hardware options to set input are listed below.
+ *
    + *
  1. The comparator inputs aren't connected to other ACMP1 comparator inputs.
  2. + *
  3. Can program the comparator-0 to connect ACMP0.INP to ACMP1.INP in XMC1200 AA or XMC1300 AA
  4. + *
  5. Can program the comparator-0 to connect ACMP0.INN to ACMP1.INP in XMC1200 AB or XMC1300 AB or XMC1400 AA
  6. + *
  7. Can program the comparator-2 to connect ACMP2.INP to ACMP1.INP
  8. + *

+ * Directly accessed registers are ANACMP0, ANACMP2 according to the availability of instance in the devices. + * + * \parRelated APIs:
+ * @ref XMC_ACMP_EnableReferenceDivider.
+ * @ref XMC_ACMP_DisableReferenceDivider. + */ +void XMC_ACMP_SetInput(XMC_ACMP_t *const peripheral, uint32_t instance, const XMC_ACMP_INP_SOURCE_t source); + + +/** + * @param None + * @return + * None
+ * + * \parDescription:
+ * Set the comparartors to operate in low power mode, by setting the LPWR bit of ANACMP0 register.
\n + * The low power mode is controlled by ACMP0 instance. Low power mode is applicable for all instances of the + * comparator. In low power mode, blanking time will be introduced to ensure the stability of comparartor output. This + * will slow down the comparator operation. + * + * \parRelated APIs:
+ * XMC_ACMP_ClearLowPowerMode(). + */ +__STATIC_INLINE void XMC_ACMP_SetLowPowerMode(void) +{ + COMPARATOR->ANACMP0 |= (uint16_t)COMPARATOR_ANACMP0_CMP_LPWR_Msk; +} + +/** + * @param None + * @return + * None
+ * + * \parDescription:
+ * Exits the low power mode by reseting LPWR bit of ANACMP0 register.
\n + * The low power mode is controlled by ACMP0 module. Low power mode is applicable for all instances of the + * comparator. To re-enable the low power mode, call the related API @ref XMC_ACMP_SetLowPowerMode(). + * + * \parRelated APIs:
+ * XMC_ACMP_SetLowPowerMode(). + */ +__STATIC_INLINE void XMC_ACMP_ClearLowPowerMode(void) +{ + COMPARATOR->ANACMP0 &= (uint16_t)(~(uint16_t)COMPARATOR_ANACMP0_CMP_LPWR_Msk); +} + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* If ACMP is available*/ + +#endif /* XMC_ACMP_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_bccu.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_bccu.h new file mode 100644 index 00000000..87368e3a --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_bccu.h @@ -0,0 +1,1976 @@ +/** + * @file xmc_bccu.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-19: + * - Initial draft
+ * - Documentation improved
+ * + * 2015-05-08: + * - Minor bug fix in XMC_BCCU_ClearEventFlag(). + * - New APIs are added: XMC_BCCU_DIM_ReadDimDivider(), XMC_BCCU_DIM_GetDimCurve(), XMC_BCCU_IsDitherEnable()
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * Detailed description of file:
+ * APIs for the functional blocks of BCCU have been defined:
+ * -- GLOBAL configuration
+ * -- Clock configuration, Function/Event configuration, Interrupt configuration
+ * + * @endcond + * + */ + +#ifndef XMC_BCCU_H +#define XMC_BCCU_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup BCCU + * @brief Brightness and Color Control Unit (BCCU) driver for the XMC1 microcontroller family. + * + * The Brightness and Color Control Unit (BCCU) is a dimming control peripheral for LED lighting applications. The BCCU + * module can be used to control multiple LED channels. Every channel generates one-bit sigma-delta bit stream with a + * user adjustable 12-bit average value. The dimming engine changes the brightness gradually (exponential curve) to appear + * natural to the human eye. It supports color control by adjusting the relative intensity of selected channels using a + * linear walk scheme for smooth color changes. It also supports high-power multi-channel LED lamps by optionally packing + * the bitstream. The optional packer which decreases the average rate of output switching by enforcing a defined on-time. + * The BCCU module generates two trigger signals to the ADC (BCCU_TRIGOUT0 and BCCU_TRIGOU1) to start conversions in a + * synchronized manner. The module can also be used as a multi-channel digital-analog converter with low-pass filters on the + * outputs. The BCCU module supports 3 independent dimming engines, 9 independent channels, Trap functions and 2 ADC + * triggering modes. + * + * The driver is divided into global control (BCCU), channel control (BCCU_CH) and dimming control (BCCU_DIM). + * + * BCCU features: + * -# Configuration structure XMC_BCCU_GLOBAL_CONFIG_t and initialization function XMC_BCCU_GlobalInit() + * -# Allows configuring of clock settings (Fast clock, Bit clock and Dimming clock). XMC_BCCU_SetFastClockPrescaler(), + * -# XMC_BCCU_SelectBitClock(), XMC_BCCU_SetDimClockPrescaler(). + * -# Allows configuring global trigger settings. XMC_BCCU_ConfigGlobalTrigger() + * -# Allows enabling multiple channels together. XMC_BCCU_ConcurrentEnableChannels() + * -# Allows enabling single channel. XMC_BCCU_EnableChannel() + * -# Allows configuring global dimming level. XMC_BCCU_SetGlobalDimmingLevel() + * -# Starts linear walk for multiple channels together. XMC_BCCU_ConcurrentStartLinearWalk(). + * -# Starts linear walk for single channel. XMC_BCCU_StartLinearWalk(). + * -# Starts dimming for multiple dimming engines together. XMC_BCCU_ConcurrentStartDimming(). + * -# Starts dimming for single dimming engine. XMC_BCCU_StartDimming(). + * + * BCCU_CH features: + * -# Configuration structure (XMC_BCCU_CH_t and initialization function XMC_BCCU_CH_Init() + * -# Allows selecting dimming engine. XMC_BCCU_CH_SelectDimEngine(). + * -# Allows setting target channel intensity. XMC_BCCU_CH_SetTargetIntensity(). + * -# Allows knowing the status of linear walk completion. XMC_BCCU_IsLinearWalkComplete() + * -# Allows setting flicker watchdog. XMC_BCCU_CH_EnableFlickerWatchdog(). + * -# Allows configuring packer settings. XMC_BCCU_CH_EnablePacker(), XMC_BCCU_CH_SetPackerThreshold(), + * XMC_BCCU_CH_SetPackerOffCompare(), XMC_BCCU_CH_SetPackerOffCounte(), XMC_BCCU_CH_SetPackerOnCounter() + * -# Allows selecting dimming bypass. XMC_BCCU_CH_DisableDimmingBypass() + * + * BCCU_DIM features: + * -# Configuration structure (XMC_BCCU_DIM_t and initialization function XMC_BCCU_DIM_Init() + * -# Allows setting target dimming engine intensity. XMC_BCCU_DIM_SetTargetDimmingLevel(). + * XMC_BCCU_DIM_SetTargetDimmingLevel + * -# Allows knowing the status of dimming completion. XMC_BCCU_IsDimmingFinished() + * -# Allows configuring dimming divider. XMC_BCCU_DIM_SetDimDivider() + * -# Allows configuring dimming curve. XMC_BCCU_DIM_ConfigDimCurve() + * + * Recommended programming sequence: + * -# Set output passive and active levels using XMC_BCCU_ConcurrentSetOutputPassiveLevel() or XMC_BCCU_SetOutputPassiveLevel() + * -# Initializes global features using XMC_BCCU_GlobalInit() + * -# Initializes channel features using XMC_BCCU_CH_Init() + * -# Initializes dimming engine using XMC_BCCU_DIM_Init() + * -# Enable channels using XMC_BCCU_ConcurrentEnableChannels() or XMC_BCCU_EnableChannel() + * -# Enable dimming engines using XMC_BCCU_ConcurrentEnableDimmingEngine() or XMC_BCCU_EnableDimmingEngine() + * -# Configure channel linear walk prescaler using XMC_BCCU_CH_SetLinearWalkPrescaler() + * -# Configure dimming divider using XMC_BCCU_DIM_SetDimDivider() + * -# Set target intensities of channels using XMC_BCCU_CH_SetTargetIntensity() + * -# Set target dim levels of dimming engines using XMC_BCCU_DIM_SetTargetDimmingLevel() + * -# Start linear walk of the channels using XMC_BCCU_ConcurrentStartLinearWalk() or XMC_BCCU_StartLinearWalk() + * -# Start dimming of the dimming engines using XMC_BCCU_ConcurrentStartDimming() or XMC_BCCU_StartDimming() + * -# Check the status of linear walk completion using XMC_BCCU_IsLinearWalkComplete() + * -# Check the status of dimming completion XMC_BCCU_IsDimmingFinished() + * @{ + */ + +#if defined (BCCU0) + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +/** + * Defines the status of BCCU driver, to verify the related API calls. Use type \a XMC_BCCU_STATUS_t for this enum. + */ + typedef enum { + XMC_BCCU_STATUS_SUCCESS = 0U, /**< Operation completed successfully */ + XMC_BCCU_STATUS_ERROR = 1U, /**< Operation has some errors */ +} XMC_BCCU_STATUS_t; + +/** + * Provides the options to select bit clock mode. + */ +typedef enum { + XMC_BCCU_BCLK_MODE_NORMAL = 0U, /**< Normal Mode: Bit clock runs at 1/4 of fast clock */ + XMC_BCCU_BCLK_MODE_FAST = 1U, /**< Fast Mode: Bit clock runs at same as fast clock */ +} XMC_BCCU_BCLK_MODE_t; + +/** + * Provides the options to select trigger mode. + */ +typedef enum { + XMC_BCCU_TRIGMODE0 = 0U, /**< Mode0: Trigger on Any Channel using OR logic */ + XMC_BCCU_TRIGMODE1 = 1U, /**< Mode1: Trigger on Active channel using round-robin*/ +} XMC_BCCU_TRIGMODE_t; + +/** + * Provides the options to select trigger delay, and only be used if Bit clock in Normal mode + */ +typedef enum { + XMC_BCCU_TRIGDELAY_NO_DELAY = 0U, /**< BCCU trigger occurs on channel trigger(without delay) */ + XMC_BCCU_TRIGDELAY_QUARTER_BIT = 1U, /**< BCCU trigger occurs on 1/4 bit time delayed after channel trigger */ + XMC_BCCU_TRIGDELAY_HALF_BIT = 2U, /**< BCCU trigger occurs on 1/2 bit time delayed after channel trigger */ +} XMC_BCCU_TRIGDELAY_t; + +/** + * Provides the options to select suspend mode + */ +typedef enum { + XMC_BCCU_SUSPEND_MODE_IGNORE = 0U, /**< Request ignored, and module cannot get suspended */ + XMC_BCCU_SUSPEND_MODE_FREEZE = 1U, /**< All running channels gets stopped, and freeze into a last state (without safe stop) + */ + XMC_BCCU_SUSPEND_MODE_SAFE_FREEZE = 2U, /**< All running channels gets stopped, and freeze into a last state (with safe + stop) */ +} XMC_BCCU_SUSPEND_MODE_t; + +/** + * Provides the options to select trap edge + */ +typedef enum { + XMC_BCCU_TRAPEDGE_RISING = 0U, /**< Trap on rising edge of the BCCU.TRAPL signal */ + XMC_BCCU_TRAPEDGE_FALLING = 1U, /**< Trap on falling edge of the BCCU.TRAPL signal */ +} XMC_BCCU_TRAPEDGE_t; + +/** + * Provides the options to enable/disable the events. + * The members can be combined using 'OR' operator for multiple selection.
+ */ +typedef enum { + XMC_BCCU_EVENT_TRIGGER0 = 0x1U, /**< Trigger 0 event */ + XMC_BCCU_EVENT_TRIGGER1 = 0x2U, /**< Trigger 1 event */ + XMC_BCCU_EVENT_FIFOFULL = 0x4U, /**< FIFO Full event */ + XMC_BCCU_EVENT_FIFOEMPTY = 0x8U, /**< FIFO Empty event */ + XMC_BCCU_EVENT_TRAP = 0x10U, /**< Trap event */ +} XMC_BCCU_EVENT_t; + +/** + * Provides the options to know the status of the event flags. + * The members can be combined using 'OR' operator for multiple selection.
+ */ +typedef enum { + XMC_BCCU_EVENT_STATUS_TRIGGER0 = 0x1U, /**< Trigger 0 Event flag status */ + XMC_BCCU_EVENT_STATUS_TRIGGER1 = 0x2U, /**< Trigger 1 Event flag status */ + XMC_BCCU_EVENT_STATUS_FIFOFULL = 0x4U, /**< FIFO Full Event flag status */ + XMC_BCCU_EVENT_STATUS_FIFOEMPTY = 0x8U, /**< FIFO Empty Event flag status */ + XMC_BCCU_EVENT_STATUS_TRAP = 0x10U, /**< Trap Event flag status (Without Trap Set) */ + XMC_BCCU_EVENT_STATUS_TRAP_STATE = 0x40U, /**< Trap state flag status */ +} XMC_BCCU_EVENT_STATUS_t; + +/** + * Provides the options to know the status of trap occurrence + */ +typedef enum { + XMC_BCCU_TRAP_STATUS_DEACTIVE = 0x0U, /**< BCCU module is not in a Trap State */ + XMC_BCCU_TRAP_STATUS_ACTIVE = 0x1U, /**< BCCU module is in a Trap State */ +} XMC_BCCU_TRAP_STATUS_t; + +/** + * Provides the options to know the current level of trap + */ +typedef enum { + XMC_BCCU_TRAP_LEVEL_LOW = 0x0U, /**< BCCU.TRAPL is Low */ + XMC_BCCU_TRAP_LEVEL_HIGH = 0x1U, /**< BCCU.TRAPL is High */ +} XMC_BCCU_TRAP_LEVEL_t; + +/** + * Provides the options to select flicker watchdog enable/disable + */ +typedef enum { + XMC_BCCU_CH_FLICKER_WD_DS = 0U, /**< Disable: No control over a sigma-delta modulator output */ + XMC_BCCU_CH_FLICKER_WD_EN = 1U, /**< Enable: Limit consecutive zeros at sigma-delta modulator output */ +} XMC_BCCU_CH_FLICKER_WD_t; + +/** + * Provides the options to select gating functionality enable/disable, and be used for peak-current control + */ +typedef enum { + XMC_BCCU_CH_GATING_FUNC_DISABLE = 0U, /**< Disable: No control over a BCCU module output */ + XMC_BCCU_CH_GATING_FUNC_ENABLE = 1U, /**< Enable: External gating signal which controls BCCU module output */ +} XMC_BCCU_CH_GATING_FUNC_t; + +/** + * Provides the options to bypass dimming engine + */ +typedef enum { + XMC_BCCU_CH_DIMMING_ENGINE_BYPASS_DISABLE = 0U, /**< Disable: Brightness = Dimming Level * Intensity */ + XMC_BCCU_CH_DIMMING_ENGINE_BYPASS_ENABLE = 1U, /**< Enable: Brightness = Intensity */ +} XMC_BCCU_CH_DIMMING_ENGINE_BYPASS_t; + +/** + * Provides the options to select passive level of the channel output + */ +typedef enum{ + XMC_BCCU_CH_ACTIVE_LEVEL_HIGH = 0U, /**< Default passive level of the channel is low */ + XMC_BCCU_CH_ACTIVE_LEVEL_LOW = 1U, /**< Default passive level of the channel is high */ +} XMC_BCCU_CH_ACTIVE_LEVEL_t; + +/** + * Provides the options to select trigger edge + */ +typedef enum +{ + XMC_BCCU_CH_TRIG_EDGE_PASS_TO_ACT = 0U, /**< Trigger on output transition from passive to active */ + XMC_BCCU_CH_TRIG_EDGE_ACT_TO_PASS = 1U, /**< Trigger on output transition from active to passive */ +} XMC_BCCU_CH_TRIG_EDGE_t; + +/** + * Provides the options to select source of trap input + */ +typedef enum +{ + XMC_BCCU_CH_TRAP_INA = 0x0U, /**< Trap INA */ + XMC_BCCU_CH_TRAP_INB = 0x1U, /**< Trap INB */ + XMC_BCCU_CH_TRAP_INC = 0x2U, /**< Trap INC */ + XMC_BCCU_CH_TRAP_IND = 0x3U, /**< Trap IND */ + XMC_BCCU_CH_TRAP_INE = 0x4U, /**< Trap INE */ + XMC_BCCU_CH_TRAP_INF = 0x5U, /**< Trap INF */ + XMC_BCCU_CH_TRAP_ING = 0x6U, /**< Trap ING */ + XMC_BCCU_CH_TRAP_INH = 0x7U, /**< Trap INH */ + XMC_BCCU_CH_TRAP_INI = 0x8U, /**< Trap INI */ + XMC_BCCU_CH_TRAP_INJ = 0x9U, /**< Trap INJ */ + XMC_BCCU_CH_TRAP_INK = 0xAU, /**< Trap INK */ + XMC_BCCU_CH_TRAP_INL = 0xBU, /**< Trap INL */ + XMC_BCCU_CH_TRAP_INM = 0xCU, /**< Trap INM */ + XMC_BCCU_CH_TRAP_INN = 0xDU, /**< Trap INN */ + XMC_BCCU_CH_TRAP_INO = 0xEU, /**< Trap INO */ + XMC_BCCU_CH_TRAP_INP = 0xFU, /**< Trap INP */ +} XMC_BCCU_CH_TRAP_IN_t; + +/** + * Provides the options to select edge for trap occurrence + */ +typedef enum +{ + XMC_BCCU_CH_TRAP_EDGE_RISING = 0U, /**< Trap on rising edge of the BCCU.TRAPL signal */ + XMC_BCCU_CH_TRAP_EDGE_FALLING = 1U /**< Trap on falling edge of the BCCU.TRAPL signal */ +} XMC_BCCU_CH_TRAP_EDGE_t; + +/** + * Provides the options to select trigger output, and only be used in XMC_BCCU_TRIGMODE1 + */ +typedef enum { + XMC_BCCU_CH_TRIGOUT0 = 0U, /**< Trigger occurrence on BCCU_TRIGOUT0 signal */ + XMC_BCCU_CH_TRIGOUT1 = 1U, /**< Trigger occurrence on BCCU_TRIGOUT1 signal */ +} XMC_BCCU_CH_TRIGOUT_t; + +/** + * Provides the options to select dimming source of the channel + */ +typedef enum { + XMC_BCCU_CH_DIMMING_SOURCE_GLOBAL = 7U, /**< Global Dimming Engine */ + XMC_BCCU_CH_DIMMING_SOURCE_DE0 = 0U, /**< Dimming Engine 0 */ + XMC_BCCU_CH_DIMMING_SOURCE_DE1 = 1U, /**< Dimming Engine 1 */ + XMC_BCCU_CH_DIMMING_SOURCE_DE2 = 2U, /**< Dimming Engine 2 */ +} XMC_BCCU_CH_DIMMING_SOURCE_t; + +/** + * Provides the options to select exponential dimming curve + */ +typedef enum { + XMC_BCCU_DIM_CURVE_COARSE = 0U, /**< Coarse curve: Slope of the linear pieces doubles every time, when it passes specific + thresholds of 16, 32, 64, 128, 256, 512, 1024, 2048 */ + XMC_BCCU_DIM_CURVE_FINE = 1U, /**< Fine Curve: More pieces and different line slopes */ +} XMC_BCCU_DIM_CURVE_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ +/** + * Redefinition of BCCU module structure; pointer to bccu module base address + */ +typedef BCCU_Type XMC_BCCU_t; + +/** + * Redefinition of BCCU module channel structure; pointer to bccu module channel Base address + */ +typedef BCCU_CH_Type XMC_BCCU_CH_t; + +/** + * Redefinition of BCCU module dimming engine structure; pointer to bccu module dimming engine base address + */ +typedef BCCU_DE_Type XMC_BCCU_DIM_t; + +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * Configures a global setting of the BCCU module. + */ +typedef struct XMC_BCCU_GLOBAL_CONFIG +{ + union{ + struct{ + uint32_t trig_mode:1; /**< Selects trigger Mode. Use type @ref XMC_BCCU_TRIGMODE_t */ + uint32_t : 1; + uint32_t trig_delay:2; /**< Selects trigger delay between channel & module trigger. \n Use type @ref + XMC_BCCU_TRIGDELAY_t */ + uint32_t : 12; + uint32_t maxzero_at_output:12; /**< Configures maximum 0's allowed at modulator output */ + }; + uint32_t globcon; /* Not to use */ + }; + union{ + struct{ + uint32_t fclk_ps:12; /**< Configures the ratio between fast clock and module clock */ + uint32_t : 3; + uint32_t bclk_sel:1; /**< Selects the bit clock. Use type @ref XMC_BCCU_BCLK_MODE_t */ + uint32_t dclk_ps:12; /**< Configures the ratio between dimmer clock and module clock */ + }; + uint32_t globclk; /* Not to use */ + }; + uint32_t global_dimlevel; /**< Configures global dimming engine dimming level */ +} XMC_BCCU_GLOBAL_CONFIG_t; + + +/** + * Configures global trigger settings of the BCCU module. + */ +typedef struct XMC_BCCU_TRIG_CONFIG +{ + XMC_BCCU_TRIGMODE_t mode; /**< Selects global trigger mode which decides when to occur BCCU trigger */ + XMC_BCCU_TRIGDELAY_t delay; /**< Selects global trigger delay between channel trigger & BCCU trigger */ + uint16_t mask_chans; /**< Channel mask to configure trigger settings for multiple channels For example: + If channel 0 and 7, wants to configure then the channel mask is 01000 0001 = 0x81\n*/ + uint16_t mask_trig_lines; /**< Trigger line mask */ +} XMC_BCCU_TRIG_CONFIG_t; + +/** + * Configures channel settings of the BCCU module. + */ +#ifdef DOXYGEN +typedef struct XMC_BCCU_CH_CONFIG +{ + uint32_t pack_thresh:3; /**< Configures packer threshold value of FIFO */ + uint32_t pack_en:1; /**< Enables a packed output bitstream */ + uint32_t dim_sel:3; /**< Selects a dimming engine source of the channel. \n Use type @ref XMC_BCCU_CH_DIMMING_SOURCE_t */ + uint32_t dim_bypass:1; /**< Selects dimming engine bypass enable. \n Use type @ref XMC_BCCU_CH_DIMMING_ENGINE_BYPASS_t */ + uint32_t gate_en:1; /**< Selects gating enable. Use type @ref XMC_BCCU_CH_GATING_FUNC_t */ + uint32_t flick_wd_en:1; /**< Selects flicker watchdog enable. Use type @ref XMC_BCCU_CH_FLICKER_WD_t */ + uint32_t trig_edge:1; /**< Selects trigger edge. Use type @ref XMC_BCCU_CH_TRIG_EDGE_t */ + uint32_t force_trig_en:1; /**< Selects force trigger enable; generates a trigger if modulator output do not change\n for + 256 bclk cycles */ + uint32_t pack_offcmp_lev:8; /**< Configures a packer off-time compare level. When the off-time counter reaches this, the + measured on & off time counters are stored into FIFO */ + uint32_t pack_oncmp_lev:8; /**< Configures a packer on-time compare level. When the on-time counter reaches this,\n + the measured on & off time counters are stored into FIFO */ + uint32_t pack_offcnt_val:8; /**< Configures an initial packer off-time counter level, only if channel is disabled.
+ Controls phase shift of the modulator output */ + uint32_t pack_oncnt_val:8; /**< Configures an initial packer on-time counter level, only if channel is disabled.
+ Controls phase shift of the modulator output */ +}XMC_BCCU_CH_CONFIG_t; +#endif + +typedef struct XMC_BCCU_CH_CONFIG +{ + union{ + struct{ + uint32_t pack_thresh:3; /**< Configures packer threshold value of FIFO */ + uint32_t pack_en:1; /**< Enables a packed output bitstream */ + uint32_t dim_sel:3; /**< Selects a dimming engine source of the channel. \n Use type @ref XMC_BCCU_CH_DIMMING_SOURCE_t + */ + uint32_t dim_bypass:1; /**< Selects dimming engine bypass enable. \n Use type @ref XMC_BCCU_CH_DIMMING_ENGINE_BYPASS_t */ + uint32_t gate_en:1; /**< Selects gating enable. Use type @ref XMC_BCCU_CH_GATING_FUNC_t */ + uint32_t flick_wd_en:1; /**< Selects flicker watchdog enable. Use type @ref XMC_BCCU_CH_FLICKER_WD_t */ + uint32_t trig_edge:1; /**< Selects trigger edge. Use type @ref XMC_BCCU_CH_TRIG_EDGE_t */ + uint32_t force_trig_en:1; /**< Selects force trigger enable; generates a trigger if modulator output do not change\n + for 256 bclk cycles */ + }; + uint32_t chconfig; /* Not to use */ + }; + union{ + struct{ + uint32_t pack_offcmp_lev:8; /**< Configures a packer off-time compare level. When the off-time counter reaches \n + this, the measured on & off time counters are stored into FIFO */ + uint32_t : 8; + uint32_t pack_oncmp_lev:8; /**< Configures a packer on-time compare level. When the on-time counter reaches this,\n + the measured on & off time counters are stored into FIFO */ + }; + uint32_t pkcmp; /* Not to use */ + }; + union{ + struct{ + uint32_t pack_offcnt_val:8; /**< Configures an initial packer off-time counter level, only if channel is disabled.
+ Controls phase shift of the modulator output */ + uint32_t : 8; + uint32_t pack_oncnt_val:8; /**< Configures an initial packer on-time counter level, only if channel is disabled.
+ Controls phase shift of the modulator output */ + }; + uint32_t pkcntr; /* Not to use */ + }; +}XMC_BCCU_CH_CONFIG_t; + +/** + * Configures dimming engine settings of the BCCU module. + */ +#ifdef DOXYGEN +typedef struct XMC_BCCU_DIM_CONFIG +{ + uint32_t dim_div:10; /**< Configures a dimming clock divider, used to adjust the fade rate. If 0, the dimming level
+ as same as target dimming level on shadow transfer */ + uint32_t dither_en:1; /**< Selects a dither enable. Dithering added for every dimming step if dimming level < 128. */ + uint32_t cur_sel:1; /**< Selects a type of exponential curve. Use type @ref XMC_BCCU_DIM_CURVE_t. If dither
+ enabled, the configuration is being ignored */ +}XMC_BCCU_DIM_CONFIG_t; +#endif + +typedef struct XMC_BCCU_DIM_CONFIG +{ + union{ + struct{ + uint32_t dim_div:10; /**< Configures a dimming clock divider, used to adjust the fade rate. If 0, the dimming level
+ as same as target dimming level on shadow transfer */ + uint32_t : 6; + uint32_t dither_en:1; /**< Selects a dither enable. Dithering added for every dimming step if dimming level < 128. */ + uint32_t cur_sel:1; /**< Selects a type of exponential curve. Use type @ref XMC_BCCU_DIM_CURVE_t. If dither
+ enabled, the configuration is being ignored */ + }; + uint32_t dtt; /* Not to use */ + }; +}XMC_BCCU_DIM_CONFIG_t; + +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif +/********************************************************************************************************************* + * API PROTOTYPES + ********************************************************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param config Pointer to constant bccu global configuration data structure. Use type @ref XMC_BCCU_GLOBAL_CONFIG_t. + * + * @return None + * + * \parDescription:
+ * Initializes three main clocks (fast clock, bit clock, dimmer clock) by using \a fclk_ps \a bclk_sel \a dclk_ps parameters + * and writing into a GLOBCLK register.\n + * And also configures a trigger mode, trigger delay, maximum 0's allowed at modulator output by writing into a GLOBCON + * register.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_Init(), XMC_BCCU_DIM_Init()\n\n\n +*/ +void XMC_BCCU_GlobalInit (XMC_BCCU_t *const bccu, const XMC_BCCU_GLOBAL_CONFIG_t *const config); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mode Trigger mode selection. \b Range: XMC_BCCU_TRIGMODE0, XMC_BCCU_TRIGMODE1.\n + * 1. XMC_BCCU_TRIGMODE0 - Trigger on Any Channel + * 2. XMC_BCCU_TRIGMODE1 - Trigger on Active channel + * @param delay Delay to avoid sampling during switching noise. Use type @ref XMC_BCCU_TRIGDELAY_t. \n + * \b Range: XMC_BCCU_NO_DELAY, XMC_BCCU_QUARTER_BIT_DELAY, XMC_BCCU_HALF_BIT_DELAY. + * + * @return None + * + * \parDescription:
+ * Configures trigger mode and trigger delay by writing register bits GLOBCON.TM, GLOBCON.TRDEL. \a mode and \a delay + * parameters which decides when to trigger a conversion of vadc module for voltage measurement. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableChannelTrigger(), XMC_BCCU_ReadGlobalTrigger(), XMC_BCCU_ConcurrentConfigTrigger(), XMC_BCCU_GlobalInit(), + * XMC_BCCU_ReadLastTrigChanNr(), XMC_BCCU_GetChannelOutputLvlAtLastTrigger(), XMC_BCCU_CH_ConfigTrigger()\n\n\n + */ +void XMC_BCCU_ConfigGlobalTrigger(XMC_BCCU_t *const bccu, XMC_BCCU_TRIGMODE_t mode, XMC_BCCU_TRIGDELAY_t delay); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Source of Trigger mode. \b Range: 0 or 1 \n + * 0 - Trigger mode 0 (Trigger on Any Channel) \n + * 1 - Trigger mode 1 (Trigger on Active Channel)\n\n + * \parDescription:
+ * Retrieves global trigger mode of the BCCU module by reading the register bit GLOBCON_TM. Use XMC_BCCU_TRIGMODE_t type to + * validate a returned value.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConfigGlobalTrigger(), XMC_BCCU_ConcurrentConfigTrigger(), XMC_BCCU_GlobalInit()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadGlobalTrigger (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(bccu->GLOBCON & BCCU_GLOBCON_TM_Msk); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param input Trap input selection. Use type @ref XMC_BCCU_TRIGDELAY_t. + * \b Range: XMC_BCCU_TRIGDELAY_NO_DELAY, XMC_BCCU_TRIGDELAY_QUARTER_BIT, XMC_BCCU_TRIGDELAY_HALF_BIT. + * + * @return None + * + * \parDescription:
+ * Selects input of trap functionality by writing register bit GLOBCON_TRAPIS. The trap functionality is used to switch + * off the connected power devices when trap input becomes active.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetTrapEdge(), XMC_BCCU_ReadTrapInput(), XMC_BCCU_EnableTrap(), XMC_BCCU_ConcurrentEnableTrap()\n\n\n + */ +void XMC_BCCU_SelectTrapInput (XMC_BCCU_t *const bccu, XMC_BCCU_CH_TRAP_IN_t input); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Source of trap input. \b Range: 0 to 15 \n + * 0 - TRAPINA \n + * 1 - TRAPINB and so on. \n + * \parDescription:
+ * Retrieves trap input of the channel by reading the register bit GLOBCON_TRAPIS. Use XMC_BCCU_CH_TRAP_IN_t type to + * validate a returned value.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SelectTrapInput()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadTrapInput (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(( (bccu->GLOBCON) & BCCU_GLOBCON_TRAPIS_Msk) >> BCCU_GLOBCON_TRAPIS_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param edge Trap edge selection. Use type @ref XMC_BCCU_CH_TRAP_EDGE_t. \n + * \b Range: XMC_BCCU_CH_TRAP_EDGE_RISING, XMC_BCCU_CH_TRAP_EDGE_FALLING. + * + * @return None + * + * \parDescription:
+ * Selects active edge which detects trap on TRAPL signal by writing register bit GLOBCON_TRAPED.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SelectTrapInput(), XMC_BCCU_ReadTrapEdge(), XMC_BCCU_EnableTrap(), XMC_BCCU_ConcurrentEnableTrap()\n\n\n + */ +void XMC_BCCU_SetTrapEdge (XMC_BCCU_t *const bccu, XMC_BCCU_CH_TRAP_EDGE_t edge); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Trap edge selection. \b Range: 0 or 1 \n + * 0 - XMC_BCCU_CH_TRAP_EDGE_RISING \n + * 1 - XMC_BCCU_CH_TRAP_EDGE_FALLING. \n + * \parDescription:
+ * Retrieves trap edge by reading the register bit GLOBCON_TRAPED. Use XMC_BCCU_CH_TRAP_EDGE_t type to + * validate a returned value.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetTrapEdge()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadTrapEdge (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(( (bccu->GLOBCON) & BCCU_GLOBCON_TRAPED_Msk) >> BCCU_GLOBCON_TRAPED_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mode Suspend mode selection. Use type @ref XMC_BCCU_SUSPEND_MODE_t. \n + * \b Range: XMC_BCCU_SUSPEND_MODE_IGNORE, XMC_BCCU_SUSPEND_MODE_FREEZE, XMC_BCCU_USPEND_MODE_SAFE_FREEZE. \n + * + * @return None + * + * \parDescription:
+ * Configures suspend mode by writing register bit GLOBCON_SUSCFG.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ReadSuspendMode()\n\n\n + */ +void XMC_BCCU_ConfigSuspendMode (XMC_BCCU_t *const bccu, XMC_BCCU_SUSPEND_MODE_t mode); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Trap edge selection. \b Range: 0, 1, 2 \n + * 0 - XMC_BCCU_SUSPEND_MODE_IGNORE \n + * 1 - XMC_BCCU_SUSPEND_MODE_FREEZE. \n + * 2 - XMC_BCCU_USPEND_MODE_SAFE_FREEZE. \n + * \parDescription:
+ * Retrieves the state of suspend mode by reading the register bit GLOBCON_TRAPIS. Use XMC_BCCU_SUSPEND_MODE_t type to + * validate a returned value.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConfigSuspendMode()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadSuspendMode (XMC_BCCU_t *const bccu) +{ + return (uint32_t)( ((bccu->GLOBCON) & BCCU_GLOBCON_SUSCFG_Msk) >> BCCU_GLOBCON_SUSCFG_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Last triggered channel number. \b Range: 0 to 8\n + * 0 - BCCU Channel 0\n + * 1 - BCCU Channel 1 and so on.\n + * \parDescription:
+ * Retrieves last triggered channel number of a BCCU module by reading the register bit GLOBCON_LTRS.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_GetChannelOutputLvlAtLastTrigger(), XMC_BCCU_ConfigGlobalTrigger(), XMC_BCCU_ConcurrentConfigTrigger(), + * XMC_BCCU_ReadGlobalTrigger(), XMC_BCCU_GlobalInit()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadLastTrigChanNr (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(( (bccu->GLOBCON) & BCCU_GLOBCON_LTRS_Msk) >> BCCU_GLOBCON_LTRS_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param threshold_no Number of consecutive zeroes at modulator output. \b Range: 0 to 4095. + * + * @return None + * + * \parDescription:
+ * Configures number of consecutive zeroes allowed at modulator output (flicker watch-dog number) by writing register + * bit GLOBCON_WDMBN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_EnableFlickerWatchdog(), XMC_BCCU_ReadFlickerWDThreshold(), XMC_BCCU_CH_Init(), XMC_BCCU_CH_DisableFlickerWatchdog()\n\n\n + */ +void XMC_BCCU_SetFlickerWDThreshold (XMC_BCCU_t *const bccu, uint32_t threshold_no); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Number of consecutive zeroes at modulator output. \b Range: 0 to 4095 \n + * \parDescription:
+ * Retrieves number of consecutive zeroes at modulator output (flicker watchdog number) by reading the register bit + * GLOBCON_WDMBN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetFlickerWDThreshold(), XMC_BCCU_CH_EnableFlickerWatchdog(), XMC_BCCU_CH_Init(), XMC_BCCU_CH_DisableFlickerWatchdog()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadFlickerWDThreshold (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(( (bccu->GLOBCON) & BCCU_GLOBCON_WDMBN_Msk) >> BCCU_GLOBCON_WDMBN_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param div Prescaler factor. \b Range: 0 to 4095. + * + * @return None + * + * \parDescription:
+ * Configures trigger functionality clock prescaler factor of a BCCU module by writing register bit GLOBCLK_FCLK_PS.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetDimClockPrescaler(), XMC_BCCU_SelectBitClock(), XMC_BCCU_ReadFastClock()\n\n\n +*/ +void XMC_BCCU_SetFastClockPrescaler (XMC_BCCU_t *const bccu, uint32_t div); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Prescaler factor. \b Range: 0 to 4095 + * \parDescription:
+ * Retrieves fast clock prescaler factor of a BCCU module by reading the register bit GLOBCLK_FCLK_PS. The fast clock is + * derived from the bccu clock by prescaler factor i.e. fdclk = fbccu_clk / prescaler factor.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetFastClockPrescaler(), XMC_BCCU_ReadBitClock(), XMC_BCCU_ReadDimClock()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadFastClock (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(((bccu->GLOBCLK) & BCCU_GLOBCLK_FCLK_PS_Msk) >> BCCU_GLOBCLK_FCLK_PS_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param div Prescaler factor. \b Range: 0 to 4095. + * + * @return None + * + * \parDescription:
+ * Configures dimmer clock prescaler factor of a BCCU module by writing register bit GLOBCLK_DCLK_PS.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_SetDimDivider(), XMC_BCCU_SetFastClockPrescaler(), XMC_BCCU_SelectBitClock(), XMC_BCCU_ReadDimClock()\n\n\n + */ +void XMC_BCCU_SetDimClockPrescaler (XMC_BCCU_t *const bccu, uint32_t div); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Prescaler factor. \b Range: 0 to 4095 + * \parDescription:
+ * Retrieves dimmer clock prescaler factor of a BCCU module by reading the register bit GLOBCLK_DCLK_PS. The dim clock is + * derived from the bccu clock by prescaler factor. \n i.e. fdclk = fbccu_clk / prescaler factor.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetDimClockPrescaler(), XMC_BCCU_ReadBitClock(), XMC_BCCU_ReadFastClock()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadDimClock (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(((bccu->GLOBCLK) & BCCU_GLOBCLK_DCLK_PS_Msk) >> BCCU_GLOBCLK_DCLK_PS_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param div Prescaler factor. Use type @ref XMC_BCCU_BCLK_MODE_t. \n + * \b Range: XMC_BCCU_BCLK_MODE_NORMAL or XMC_BCCU_BCLK_MODE_FAST. \n + * @return None + * + * \parDescription:
+ * Configures modulator output (bit-time) clock prescaler factor of a BCCU module by writing register bit GLOBCLK_BCS.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetFastClockPrescaler(), XMC_BCCU_SetDimClockPrescaler(), XMC_BCCU_ReadBitClock()\n\n\n + */ +void XMC_BCCU_SelectBitClock (XMC_BCCU_t *const bccu, XMC_BCCU_BCLK_MODE_t div); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Prescaler factor. \b Range: 0 or 1 \n + * 0 - XMC_BCCU_BCLK_MODE_NORMAL \n + * 1 - XMC_BCCU_BCLK_MODE_FAST \n + * \parDescription:
+ * Retrieves modulator output (bit-time) clock prescaler factor of a BCCU module by reading the register bit GLOBCLK_BCS. + * Use XMC_BCCU_BCLK_MODE_t type to validate a returned value.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SelectBitClock(), XMC_BCCU_ReadDimClock(), XMC_BCCU_ReadFastClock()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadBitClock (XMC_BCCU_t *const bccu) +{ + return (uint32_t)(((bccu->GLOBCLK) & BCCU_GLOBCLK_BCS_Msk) >> BCCU_GLOBCLK_BCS_Pos); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Channel mask to enable multiple channels.\n + * For example: If channel 0, channel 7, channel 1 wants to enable at a same time, \n + * then channel mask is 01000 0011 = 0x83\n + * ------------------------------------------------------------------------------------------------------\n + * | Chan8 | Chan7 | Chan6 | Chan5 | Chan4 | Chan3 | Chan2 | Chan1 | Chan0 |\n + * ------------------------------------------------------------------------------------------------------\n + * + * @return None + * + * \parDescription:
+ * Enables multiple channels at a same time using \a mask by writing a register CHEN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableChannel(), XMC_BCCU_ConcurrentDisableChannels()\n\n\n + */ +void XMC_BCCU_ConcurrentEnableChannels (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Channel mask to disable multiple channels.\n + * For example: If channel 0, channel 7, channel 1 wants to disable at a same time, \n + * then channel mask is 01000 0011 = 0x83\n + * ------------------------------------------------------------------------------------------------------\n + * | Chan8 | Chan7 | Chan6 | Chan5 | Chan4 | Chan3 | Chan2 | Chan1 | Chan0 |\n + * ------------------------------------------------------------------------------------------------------\n + * + * @return None + * + * \parDescription:
+ * Disables multiple channels at a same time using \a mask by writing a register CHEN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConcurrentEnableChannels(), XMC_BCCU_DisableChannel()\n\n\n + */ +void XMC_BCCU_ConcurrentDisableChannels (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_mask Channel mask to enable multiple channels.\n + * For example: If channel 0, channel 7, channel 1 wants to enable at a same time, \n + * then channel mask is 01000 0011 = 0x83\n + * ------------------------------------------------------------------------------------------------------\n + * | Chan8 | Chan7 | Chan6 | Chan5 | Chan4 | Chan3 | Chan2 | Chan1 | Chan0 |\n + * ------------------------------------------------------------------------------------------------------\n + * @param level Passive level selection. Use type @ref XMC_BCCU_CH_ACTIVE_LEVEL_t.\n + * \b Range: XMC_BCCU_CH_ACTIVE_LEVEL_HIGH or XMC_BCCU_CH_ACTIVE_LEVEL_LOW + * + * @return None + * + * \parDescription:
+ * Configures passive levels of multiple channels at a same time using \a mask by writing a register bit CHOCON_CHyOP.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetOutputPassiveLevel()\n\n\n + */ +void XMC_BCCU_ConcurrentSetOutputPassiveLevel(XMC_BCCU_t *const bccu, uint32_t chan_mask, XMC_BCCU_CH_ACTIVE_LEVEL_t level); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Channel mask to enable multiple channels trap functionality.\n + * For example: If channel 0, channel 7, channel 1 wants to enable a trap functionality at a same time, \n + * then channel mask is 01000 0011 = 0x83\n + * ------------------------------------------------------------------------------------------------------\n + * | Chan8 | Chan7 | Chan6 | Chan5 | Chan4 | Chan3 | Chan2 | Chan1 | Chan0 |\n + * ------------------------------------------------------------------------------------------------------\n + * + * @return None + * + * \parDescription:
+ * Enables multiple channels trap functionality at the same time using \a mask by writing a register bit CHOCON_CHyTPE.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableTrap(), XMC_BCCU_ConcurrentDisableTrap(), XMC_BCCU_SelectTrapInput(), XMC_BCCU_SetTrapEdge()\n\n\n + */ +void XMC_BCCU_ConcurrentEnableTrap (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Channel mask to disable multiple channels trap functionality. + * For example: If channel 0, channel 7, channel 1 wants to disable a trap functionality at a same time, \n + * then channel mask is 01000 0011 = 0x83\n + * ------------------------------------------------------------------------------------------------------\n + * | Chan8 | Chan7 | Chan6 | Chan5 | Chan4 | Chan3 | Chan2 | Chan1 | Chan0 |\n + * ------------------------------------------------------------------------------------------------------\n + * + * @return None + * + * \parDescription:
+ * Disables multiple channels trap functionality at the same time using \a mask by writing a register bit CHOCON_CHyTPE.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DisableTrap(), XMC_BCCU_ConcurrentEnableTrap()\n\n\n + */ +void XMC_BCCU_ConcurrentDisableTrap (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param trig Pointer to a trigger configuration data structure. Use type @ref XMC_BCCU_TRIG_CONFIG_t. + * + * @return None + * + * \parDescription:
+ * Configures global trigger settings: trigger mode, trigger delay, individual trigger lines and channel mask by writing a \n + * registers GLOBCON and CHTRIG. Trigger mode decides when to generate a BCCU trigger, trigger delay postpones the channel \n + * trigger by 1/4, or 1/2 bclk cycles\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConfigGlobalTrigger(), XMC_BCCU_ReadLastTrigChanNr(), XMC_BCCU_ReadGlobalTrigger(), XMC_BCCU_GlobalInit()\n\n\n + */ +void XMC_BCCU_ConcurrentConfigTrigger (XMC_BCCU_t *const bccu, XMC_BCCU_TRIG_CONFIG_t *trig); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Channel mask to start a linear walk for multiple channels at a same time.\n + * For example: If channel 0, channel 7, channel 1 wants to start a linear walk at a same time, \n + * then channel mask is 01000 0011 = 0x83\n + * ------------------------------------------------------------------------------------------------------\n + * | Chan8 | Chan7 | Chan6 | Chan5 | Chan4 | Chan3 | Chan2 | Chan1 | Chan0 |\n + * ------------------------------------------------------------------------------------------------------\n + * + * @return None + * + * \parDescription:
+ * After channel initialization, the outcome of executing the API starts changing the color smoothly towards to target \n + * for multiple channels at a same time using \a mask by writing a register CHSTRCON.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_StartLinearWalk(), XMC_BCCU_ConcurrentAbortLinearWalk()\n\n\n + */ +void XMC_BCCU_ConcurrentStartLinearWalk (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Channel mask to stop a linear walk for multiple channels at a same time.\n + * For example: If channel 0, channel 7, channel 1 wants to abort a linear walk at a same time, \n + * then channel mask is 01000 0011 = 0x83\n + * ------------------------------------------------------------------------------------------------------\n + * | Chan8 | Chan7 | Chan6 | Chan5 | Chan4 | Chan3 | Chan2 | Chan1 | Chan0 |\n + * ------------------------------------------------------------------------------------------------------\n + * + * @return None + * + * \parDescription:
+ * When the linear walk in progress, the outcome of executing the API is stopping the linear walk (i.e. color change) + * immediately for multiple channels at a same time using \a mask by writing a register CHSTRCON.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_AbortLinearWalk(), XMC_BCCU_ConcurrentStartLinearWalk()\n\n\n + */ +void XMC_BCCU_ConcurrentAbortLinearWalk (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Dimming engine mask to enable multiple dimming engine at a same time.\n + * For example: If dimming engine 0, channel 2 wants to enable a dimming at a same time, + * then dimming engine mask is 0101 = 0x03\n + * --------------------------\n + * | DE2 | DE1 | DE0 |\n + * --------------------------\n + * + * @return None + * + * \parDescription:
+ * Enables multiple dimming engines at a same time using \a mask by writing a register DEEN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableDimmingEngine(), XMC_BCCU_ConcurrentDisableDimmingEngine()\n\n\n + */ +void XMC_BCCU_ConcurrentEnableDimmingEngine (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Dimming engine mask to disable multiple dimming engine at a same time.\n + * For example: If dimming engine 0, channel 2 wants to disable a dimming at a same time, + * then dimming engine mask is 0101 = 0x03\n + * --------------------------\n + * | DE2 | DE1 | DE0 |\n + * --------------------------\n + * + * @return None + * + * \parDescription:
+ * Disables multiple dimming engines at a same time using \a mask by writing a register DEEN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DisableDimmingEngine(), XMC_BCCU_ConcurrentEnableDimmingEngine()\n\n\n + */ +void XMC_BCCU_ConcurrentDisableDimmingEngine (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Dimming engine mask to start a dimming for multiple dimming engines at a same time.\n + * For example: If dimming engine 0, channel 2 wants to start a dimming at a same time, + * then dimming engine mask is 0101 = 0x03\n + * --------------------------\n + * | DE2 | DE1 | DE0 |\n + * --------------------------\n + * + * @return None + * + * \parDescription:
+ * After dimming engine initialization, the outcome of executing the API starts changing the brightness towards to target + * for multiple dimming engines at a same time using \a mask by writing a register DESTRCON.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_StartDimming(), XMC_BCCU_ConcurrentAbortDimming()\n\n\n + */ +void XMC_BCCU_ConcurrentStartDimming (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param mask Dimming engine mask to abort a dimming for multiple dimming engines at a same time.\n + * For example: If dimming engine 0, channel 2 wants to abort a dimming at a same time, + * then dimming engine mask is 0101 = 0x03\n + * --------------------------\n + * | DE2 | DE1 | DE0 |\n + * --------------------------\n + * + * @return None + * + * \parDescription:
+ * When the dimming in progress, the outcome of executing the API is stopping the dimming (i.e. fading) + * immediately for specific dimming engine number \a dim_no by writing a register DESTRCON.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_AbortDimming(), XMC_BCCU_ConcurrentStartDimming()\n\n\n + */ +void XMC_BCCU_ConcurrentAbortDimming (XMC_BCCU_t *const bccu, uint32_t mask); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param level Dimming level of global dimming engine. \b Range: 0 to 4095\n + * + * @return None + * + * \parDescription:
+ * Configures a global dimming level by writing a register GLOBDIM. This is useful only if global dimming engine selected. + * Otherwise the configuration is ignored. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_SetTargetDimmingLevel()\n\n\n + */ +void XMC_BCCU_SetGlobalDimmingLevel (XMC_BCCU_t *const bccu, uint32_t level); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param event Event mask to enable multiple events at a time using ORed values of @ref XMC_BCCU_EVENT_t.\n + * For example: If XMC_BCCU_EVENT_TRIGGER0, XMC_BCCU_EVENT_TRIGGER1, XMC_BCCU_EVENT_FIFOEMPTY wants to enable + * at a same time,\n then event mask is = (XMC_BCCU_EVENT_TRIGGER0 | XMC_BCCU_EVENT_TRIGGER1 | + * XMC_BCCU_EVENT_FIFOEMPTY) \n + * + * @return None + * + * \parDescription:
+ * Enables multiple interrupt events at a same time using ORed values of @ref XMC_BCCU_EVENT_t by writing a register EVIER.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DisableInterrupt()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_EnableInterrupt (XMC_BCCU_t *const bccu, uint32_t event) +{ + bccu->EVIER |= event; +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param event Event mask to disable multiple events at a time using ORed values of @ref XMC_BCCU_EVENT_t.\n + * For example: If XMC_BCCU_EVENT_TRIGGER0, XMC_BCCU_EVENT_TRIGGER1, XMC_BCCU_EVENT_FIFOEMPTY wants to disable\n + * at a same time, then event mask is = (XMC_BCCU_EVENT_TRIGGER0 | XMC_BCCU_EVENT_TRIGGER1 | + * XMC_BCCU_EVENT_FIFOEMPTY) \n + * + * @return None + * + * \parDescription:
+ * Disables multiple interrupt events at a same time using ORed values of @ref XMC_BCCU_EVENT_t by writing a register EVIER.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableInterrupt()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_DisableInterrupt (XMC_BCCU_t *const bccu, uint32_t event) +{ + bccu->EVIER &= (uint32_t)~(event); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * + * @return Interrupt events flags at a same time using ORed values of @ref XMC_BCCU_EVENT_t. + * \parDescription:
+ * Retrieves interrupt event flags at the same time using ORed values of @ref XMC_BCCU_EVENT_t by reading the register \n + * EVFR. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetEventFlag()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_ReadEventFlag (XMC_BCCU_t *const bccu) +{ + return (bccu->EVFR); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param flag_type Event flag mask to configure multiple events at a time using ORed values of @ref + * XMC_BCCU_EVENT_STATUS_t.\n + * For example: If XMC_BCCU_EVENT_STATUS_TRIGGER0, XMC_BCCU_EVENT_STATUS_TRIGGER1, XMC_BCCU_EVENT_STATUS_FIFOEMPTY + * wants to configure at a same time, then event mask is = (XMC_BCCU_EVENT_STATUS_TRIGGER0 | XMC_BCCU_EVENT_STATUS_TRIGGER1 | + * XMC_BCCU_EVENT_STATUS_FIFOEMPTY) \n + * + * @return None + * + * \parDescription:
+ * Configures multiple interrupt event flags at a same time using ORed values of @ref XMC_BCCU_EVENT_STATUS_t by writing a register EVFSR.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ClearEventFlag(), XMC_BCCU_ReadEventFlag()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_SetEventFlag (XMC_BCCU_t *const bccu, uint32_t flag_type) +{ + bccu->EVFSR = flag_type; +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param flag_type event flag mask to clear multiple events at a time using ORed values of @ref + * XMC_BCCU_EVENT_STATUS_t.\n + * For example: If XMC_BCCU_EVENT_STATUS_TRIGGER0, XMC_BCCU_EVENT_STATUS_TRIGGER1, XMC_BCCU_EVENT_STATUS_FIFOEMPTY + * wants to clear at a same time, then event mask is = (XMC_BCCU_EVENT_STATUS_TRIGGER0 | XMC_BCCU_EVENT_STATUS_TRIGGER1 | + * XMC_BCCU_EVENT_STATUS_FIFOEMPTY) \n + * + * @return None + * + * \parDescription:
+ * Clears multiple interrupt event flags at a same time using ORed values of @ref XMC_BCCU_EVENT_STATUS_t by writing a + * register EVFSR.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetEventFlag()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_ClearEventFlag (XMC_BCCU_t *const bccu, uint32_t flag_type) +{ + bccu->EVFCR = flag_type; +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Specific channel number to enable. \b Range: 0 to 8\n + * + * @return None + * + * \parDescription:
+ * Enables a specific channel number using \a chan_no by writing a register CHEN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConcurrentEnableChannels(), XMC_BCCU_DisableChannel()\n\n\n + */ +void XMC_BCCU_EnableChannel (XMC_BCCU_t *const bccu, uint32_t chan_no); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Specific channel number to disable. \b Range: 0 to 8\n + * + * @return None + * + * \parDescription:
+ * Disables a specific channel number using \a chan_no by writing a register CHEN.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConcurrentDisableChannels(), XMC_BCCU_EnableChannel()\n\n\n + */ +void XMC_BCCU_DisableChannel (XMC_BCCU_t *const bccu, uint32_t chan_no); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Specific channel number to enable specific channel. \b Range: 0 to 8\n + * @param level Passive level selection. Use type @ref XMC_BCCU_CH_ACTIVE_LEVEL_t.\n + * \b Range: XMC_BCCU_CH_ACTIVE_LEVEL_HIGH or XMC_BCCU_CH_ACTIVE_LEVEL_LOW + * + * @return None + * + * \parDescription:
+ * Configures passive level of specific channel using \a chan_no by writing a register bit CHOCON_CHyOP.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConcurrentSetOutputPassiveLevel()\n\n\n + */ +void XMC_BCCU_SetOutputPassiveLevel(XMC_BCCU_t *const bccu, uint32_t chan_no, XMC_BCCU_CH_ACTIVE_LEVEL_t level); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Channel number to enable specific channel trap functionality. \b Range: 0 to 8 + * + * @return None + * + * \parDescription:
+ * Enables specific channel trap functionality using \a chan_no by writing a register bit CHOCON_CHyTPE.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DisableTrap(), XMC_BCCU_ConcurrentEnableTrap(), XMC_BCCU_SelectTrapInput(), XMC_BCCU_SetTrapEdge()\n\n\n + */ +void XMC_BCCU_EnableTrap (XMC_BCCU_t *const bccu, uint32_t chan_no); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Channel number to disable specific channel trap functionality. \b Range: 0 to 8 + * + * @return None + * + * \parDescription:
+ * Disables specific channel trap functionality using \a chan_no by writing a register bit CHOCON_CHyTPE.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableTrap(), XMC_BCCU_ConcurrentDisableTrap()\n\n\n + */ +void XMC_BCCU_DisableTrap (XMC_BCCU_t *const bccu, uint32_t chan_no); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Channel number to trigger a specific channel. \b Range: 0 to 8 + * @param trig_line Trigger line number to trigger a vadc. Use type @ref XMC_BCCU_CH_TRIGOUT_t.\n + * \b Range: XMC_BCCU_CH_TRIGOUT0 or XMC_BCCU_CH_TRIGOUT1 + * + * @return None + * + * \parDescription:
+ * Enables specific channel trigger using \a chan_no by writing a register bit CHOCON_CHyTPE.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ConfigGlobalTrigger(), XMC_BCCU_DisableChannelTrigger(), XMC_BCCU_CH_ConfigTrigger()\n\n\n + */ +void XMC_BCCU_EnableChannelTrigger (XMC_BCCU_t *const bccu, uint32_t chan_no, XMC_BCCU_CH_TRIGOUT_t trig_line); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Channel number to trigger a specific channel. \b Range: 0 to 8 + * + * @return None + * + * \parDescription:
+ * Disables specific channel trigger using \a chan_no by writing a register bit CHOCON_CHyTPE.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableChannelTrigger()\n\n\n + */ +void XMC_BCCU_DisableChannelTrigger (XMC_BCCU_t *const bccu, uint32_t chan_no); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param config Pointer to constant bccu channel configuration data structure. Use type @ref XMC_BCCU_CH_CONFIG_t. + * + * @return None + * + * \parDescription:
+ * Configures dimming engine source, dimming bypass selection, channel trigger edge, flicker watchdog selection and force + * trigger selection by using \a dim_sel, \a dim_bypass, \a trig_edge, \a flick_wd_en, \a force_trig_en by writing into a + * CHCONFIG register. And also configures packer settings: threshold, off and on compare levels, initial values of off & on + * counters, by writing into a CHCONFIG, PKCMP and PKCNTR registers.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_GlobalInit(), XMC_BCCU_DIM_Init()\n\n\n + */ +void XMC_BCCU_CH_Init (XMC_BCCU_CH_t *const channel, const XMC_BCCU_CH_CONFIG_t *const config); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param edge Output transition selection. Use type @ref XMC_BCCU_CH_TRIG_EDGE_t. \n + * \b Range: XMC_BCCU_CH_TRIG_EDGE_PASS_TO_ACT or XMC_BCCU_CH_TRIG_EDGE_ACT_TO_PASS\n + * @param force_trig_en Forcing a trigger at output. \b Range: 0 or 1\n + * Generates a trigger if modulator output do not change for 256 bclk cycles\n + * + * @return None + * + * \parDescription:
+ * Configures global trigger settings: trigger edge, force trigger enable by writing a register CHCONFIG. + * And also configures force trigger enable, generates a trigger if modulator output do not change for 256 bclk cycles + * + * \parRelated APIs:
+ * XMC_BCCU_ConfigGlobalTrigger(), XMC_BCCU_EnableChannelTrigger()\n\n\n + */ +void XMC_BCCU_CH_ConfigTrigger (XMC_BCCU_CH_t *const channel, XMC_BCCU_CH_TRIG_EDGE_t edge, uint32_t force_trig_en); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Specific channel number to start color change \b Range: 0 to 8\n + * + * @return None + * + * \parDescription:
+ * After channel initialization, the outcome of executing the API starts changing the color smoothly towards to target + * by writing a register bit CHSTRCON_CHyS.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_AbortLinearWalk(), XMC_BCCU_CH_SetTargetIntensity(), XMC_BCCU_IsLinearWalkComplete(), + * XMC_BCCU_ConcurrentStartLinearWalk()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_StartLinearWalk (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + bccu->CHSTRCON |= (uint32_t)(BCCU_CHSTRCON_CH0S_Msk << chan_no); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Specific channel number to stop color change \b Range: 0 to 8\n + * + * @return None + * + * \parDescription:
+ * When the linear walk in progress, the outcome of executing the API is stopping the linear walk (i.e. color change) + * immediately for specific channels number using \a mask by writing a register CHSTRCON_CHyA.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_StartLinearWalk(), XMC_BCCU_ConcurrentAbortLinearWalk()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_AbortLinearWalk (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + bccu->CHSTRCON |= (uint32_t)(BCCU_CHSTRCON_CH0A_Msk << chan_no); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Specific channel number to get an output level on last trigger. \b Range: 0 to 8\n + * + * @return Trap channel output level. \b Range: 0 or 1 + * \parDescription:
+ * Retrieves output level of specific channel number when last trigger occurred by reading the register bit LTCHOL_LTOLy. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_ReadLastTrigChanNr(), XMC_BCCU_ConfigGlobalTrigger(), XMC_BCCU_ConcurrentConfigTrigger(), + * XMC_BCCU_ReadGlobalTrigger(), XMC_BCCU_GlobalInit()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_GetChannelOutputLvlAtLastTrigger (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + return (uint32_t)((bccu->LTCHOL & (BCCU_LTCHOL_LTOL0_Msk << chan_no)) >> chan_no); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param clk_div Prescaler factor. \b Range: 0 to 1023 + * + * @return None + * + * \parDescription:
+ * configure the linear walker clock prescaler factor by writing register bit CHCONFIG_LINPRES.\n\n + * + */ +void XMC_BCCU_CH_SetLinearWalkPrescaler (XMC_BCCU_CH_t *const channel, uint32_t clk_div); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param chan_no Channel number to know the linear walk completion status. \b Range: 0 to 8\n + * + * @return Linear walk completion status. \b Range: 0-Completed or 1-intensity start changing towards the target + * \parDescription:
+ * Retrieves linear walk completion status for specific channel using \a chan_no by reading the register bit CHSTRCON_CHyS. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetTargetIntensity(), XMC_BCCU_StartLinearWalk()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_IsLinearWalkComplete (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + return (uint32_t)((bccu->CHSTRCON & (BCCU_CHSTRCON_CH0S_Msk << chan_no)) >> chan_no); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param ch_int Target channel intensity. \b Range: 0 to 4095 + * + * @return None + * + * \parDescription:
+ * Configures target channel intensity by writing register INTS, only be written if no shadow transfer of linear walk. + * Use XMC_BCCU_IsLinearWalkComplete() to know shadow transfer finished \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_IsLinearWalkComplete(), XMC_BCCU_StartLinearWalk(), XMC_BCCU_CH_ReadIntensity()\n\n\n + */ +void XMC_BCCU_CH_SetTargetIntensity (XMC_BCCU_CH_t *const channel, uint32_t ch_int); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return Current channel intensity. \b Range: 0 or 4095 + * \parDescription:
+ * Retrieves current channel intensity by reading the register INT.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetTargetIntensity()\n\n\n + */ +uint32_t XMC_BCCU_CH_ReadIntensity (XMC_BCCU_CH_t *const channel); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param thresh Packer threshold value of FIFO. It defines number of queue stages must be filled before output generator + * starts generating the pulses. Until that, only off-bits are generated at the output.\n + * @param off_comp Packer off-time compare level. When the off-time counter reaches this, the measured on off time + * counters are stored into FIFO + * @param on_comp Packer on-time compare level. When the on-time counter reaches this, the measured on & off time + * counters are stored into FIFO + * + * @return None + * + * \parDescription:
+ * Enables packer by writing register bit CHCONFIG_PEN. And also configures packer threshold, off and on compare levels + * by writing register PKCMP. The main purpose of the packer is to decrease the average rate of switching of the output + * signal, to decrease the load on external switching circuits and improve EMC behavior\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_DisablePacker(), XMC_BCCU_CH_SetPackerThreshold(), XMC_BCCU_CH_SetPackerOffCompare(), XMC_BCCU_CH_SetPackerOnCompare\n\n\n + */ +void XMC_BCCU_CH_EnablePacker (XMC_BCCU_CH_t *const channel, uint32_t thresh, uint32_t off_comp, uint32_t on_comp); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param val Packer threshold value of FIFO + * + * @return None + * + * \parDescription:
+ * Configures packer threshold by writing register bit CHCONFIG_PKTH\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerOffCompare(), XMC_BCCU_CH_SetPackerOnCompare, XMC_BCCU_CH_ReadPackerThreshold()\n\n\n + */ +void XMC_BCCU_CH_SetPackerThreshold (XMC_BCCU_CH_t *const channel, uint32_t val); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param level Packer off-time compare level. When the off-time counter reaches this, the measured on & off time counters + * are stored into FIFO + * + * @return None + * + * \parDescription:
+ * Configures packer off compare level by writing register bit PKCMP_OFFCMP\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerThreshold(), XMC_BCCU_CH_SetPackerOnCompare(), XMC_BCCU_CH_SetPackerOffCounter(), + * XMC_BCCU_CH_ReadPackerOffCompare()\n\n\n + */ +void XMC_BCCU_CH_SetPackerOffCompare (XMC_BCCU_CH_t *const channel, uint32_t level); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param level Packer on-time compare level. When the on-time counter reaches this, the measured on & off time counters + * are stored into FIFO + * + * @return None + * + * \parDescription:
+ * Configures packer on compare level by writing register bit PKCMP_ONCMP\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerThreshold(), XMC_BCCU_CH_SetPackerOffCompare(), XMC_BCCU_CH_SetPackerOnCounter(), + * XMC_BCCU_CH_ReadPackerOnCompare()\n\n\n + */ +void XMC_BCCU_CH_SetPackerOnCompare (XMC_BCCU_CH_t *const channel, uint32_t level); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return Packer threshold value of FIFO + * \parDescription:
+ * Retrieves packer threshold value by reading the register bit CHCONFIG_PKTH.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerThreshold()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_CH_ReadPackerThreshold (XMC_BCCU_CH_t *const channel) +{ + return (uint32_t)((channel->CHCONFIG) & BCCU_CH_CHCONFIG_PKTH_Msk); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return Packer off-time compare level. When the off-time counter reaches this, the measured on & off time counters + * are stored into FIFO + * \parDescription:
+ * Retrieves packer off compare level by reading the register bit PKCMP_OFFCMP.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerOffCompare()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_CH_ReadPackerOffCompare (XMC_BCCU_CH_t *const channel) +{ + return (uint32_t)((channel->PKCMP) & BCCU_CH_PKCMP_OFFCMP_Msk); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return Packer on-time compare level. When the on-time counter reaches this,
+ * the measured on & off time counters are stored into FIFO + * \parDescription:
+ * Retrieves packer on compare level by reading the register bit PKCMP_ONCMP.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerOnCompare()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_CH_ReadPackerOnCompare (XMC_BCCU_CH_t *const channel) +{ + return (uint32_t)(((channel->PKCMP) & BCCU_CH_PKCMP_ONCMP_Msk) >> BCCU_CH_PKCMP_ONCMP_Pos); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return None + * + * \parDescription:
+ * Disables packer by clearing writing register bit CHCONFIG_PEN. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_EnablePacker()\n\n\n + */ +void XMC_BCCU_CH_DisablePacker (XMC_BCCU_CH_t *const channel); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param cnt_val Configures an initial packer off-time counter level, only if channel is disabled. Controls phase + * shift of the modulator output + * + * @return None + * + * \parDescription:
+ * Configures packer initial off counter value by writing register bit PKCNTR_OFFCNTVAL\n + * Note: Shall only be called if channel disabled.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerOnCounter(), XMC_BCCU_CH_SetPackerOffCompare()\n\n\n + */ +void XMC_BCCU_CH_SetPackerOffCounter (XMC_BCCU_CH_t *const channel, uint32_t cnt_val); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param cnt_val Configures an initial packer on-time counter level, only if channel is disabled. Controls phase shift + * of the modulator output + * + * @return None + * + * \parDescription:
+ * Configures packer initial on counter value by writing register bit PKCNTR_ONCNTVAL\n + * Note: Shall only be called if channel disabled.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SetPackerOffCounter(), XMC_BCCU_CH_SetPackerOnCompare()\n\n\n + */ +void XMC_BCCU_CH_SetPackerOnCounter (XMC_BCCU_CH_t *const channel, uint32_t cnt_val); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * @param sel Selects a dimming engine source of the channel. Use type @ref XMC_BCCU_CH_DIMMING_SOURCE_t + * + * @return None + * + * \parDescription:
+ * Configures dimming engine source by writing register bit CHCONFIG_DSEL\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_EnableDimmingBypass()\n\n\n + */ +void XMC_BCCU_CH_SelectDimEngine (XMC_BCCU_CH_t *const channel, XMC_BCCU_CH_DIMMING_SOURCE_t sel); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return None + * + * \parDescription:
+ * Enables dimming engine bypass by writing register bit CHCONFIG_DBP. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_SelectDimEngine(), XMC_BCCU_CH_DisableDimmingBypass()\n\n\n + */ +void XMC_BCCU_CH_EnableDimmingBypass (XMC_BCCU_CH_t *const channel); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return None + * + * \parDescription:
+ * Disables dimming engine bypass by clearing register bit CHCONFIG_DBP. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_EnableDimmingBypass()\n\n\n + */ +void XMC_BCCU_CH_DisableDimmingBypass (XMC_BCCU_CH_t *const channel); + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return None + * + * \parDescription:
+ * Enables gating feature by writing register bit CHCONFIG_GEN. The gating feature is used to enable fast control schemes, + * such as peak-current control and this has been controlled by Analog Comparator module.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_DisableGating()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_CH_EnableGating (XMC_BCCU_CH_t *const channel) +{ + channel->CHCONFIG |= (uint32_t)(BCCU_CH_CHCONFIG_GEN_Msk); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return None + * + * \parDescription:
+ * Disables gating feature by writing register bit CHCONFIG_GEN. The gating feature is used to enable/disable fast control + * schemes, such as peak-current control and this has been controlled by Analog Comparator module. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_CH_EnableGating()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_CH_DisableGating (XMC_BCCU_CH_t *const channel) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_GEN_Msk); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return None + * + * \parDescription:
+ * Enables flicker watchdog by writing register bit CHCONFIG_WEN. And limits the sigma-delta modulator output\n + * according to Watchdog threshold\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetFlickerWDThreshold(), XMC_BCCU_ReadFlickerWDThreshold(), XMC_BCCU_CH_Init(), + * XMC_BCCU_CH_DisableFlickerWatchdog()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_CH_EnableFlickerWatchdog (XMC_BCCU_CH_t *const channel) +{ + channel->CHCONFIG |= (uint32_t)(BCCU_CH_CHCONFIG_WEN_Msk); +} + +/** + * + * @param channel Base address of the bccu channel. \b Range: BCCU0_CH0, BCCU0_CH1.. + * + * @return None + * + * \parDescription:
+ * Disables flicker watchdog by writing register bit CHCONFIG_WEN. No limits the sigma-delta modulator output + * according to Watchdog threshold\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetFlickerWDThreshold(), XMC_BCCU_ReadFlickerWDThreshold(), XMC_BCCU_CH_Init(), + * XMC_BCCU_CH_EnableFlickerWatchdog()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_CH_DisableFlickerWatchdog (XMC_BCCU_CH_t *const channel) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_WEN_Msk); +} + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * @param config Pointer to constant dimming engine configuration data structure. Use type @ref XMC_BCCU_DIM_CONFIG_t. + * + * @return None + * + * \parDescription:
+ * Configures dimming clock divider to adjust the fade rate, dither selection and exponential curve selection using \a + * dim_div, \a dither_en, \a cur_sel parameters and by writing into a DTT register.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_GlobalInit(), XMC_BCCU_CH_Init()\n\n\n + */ +void XMC_BCCU_DIM_Init (XMC_BCCU_DIM_t *const dim_engine, const XMC_BCCU_DIM_CONFIG_t *const config); + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param dim_no Specific dimming engine number to enable. \b Range: 0 to 2\n + * + * @return None + * + * \parDescription:
+ * Enables a specific dimming engine number using \a dim_no by writing a register bit DEEN_EDEy.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DisableDimmingEngine(), XMC_BCCU_ConcurrentEnableDimmingEngine()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_EnableDimmingEngine (XMC_BCCU_t *const bccu, uint32_t dim_no) +{ + bccu->DEEN |= (uint32_t)(BCCU_DEEN_EDE0_Msk << dim_no); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param dim_no Specific dimming engine number to disable. \b Range: 0 to 2\n + * + * @return None + * + * \parDescription:
+ * Disables a specific dimming engine number using \a dim_no by clearing a register bit DEEN_EDEy.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_EnableDimmingEngine(), XMC_BCCU_ConcurrentDisableDimmingEngine()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_DisableDimmingEngine (XMC_BCCU_t *const bccu, uint32_t dim_no) +{ + bccu->DEEN &= ~(uint32_t)(BCCU_DEEN_EDE0_Msk << dim_no); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param dim_no Specific dimming engine number to start dimming process \b Range: 0 to 2\n + * + * @return None + * + * \parDescription:
+ * After dimming engine initialization, the outcome of executing the API starts changing the brightness towards to target + * by writing a register bit DESTRCON_DEyS.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_AbortDimming(), XMC_BCCU_ConcurrentStartDimming()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_StartDimming (XMC_BCCU_t *const bccu, uint32_t dim_no) +{ + bccu->DESTRCON = (uint32_t)(BCCU_DESTRCON_DE0S_Msk << dim_no); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param dim_no Specific dimming engine number to stop dimming process \b Range: 0 to 2\n + * + * @return None + * + * \parDescription:
+ * When the dimming in progress, the outcome of executing the API is stopping the dimming (i.e. fading) + * immediately for specific dimming engine number \a dim_no by writing a register bit DESTRCON_DEyA.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_StartDimming(), XMC_BCCU_ConcurrentAbortDimming()\n\n\n + */ +__STATIC_INLINE void XMC_BCCU_AbortDimming (XMC_BCCU_t *const bccu, uint32_t dim_no) +{ + bccu->DESTRCON = (uint32_t)(BCCU_DESTRCON_DE0A_Msk << dim_no); +} + +/** + * + * @param bccu Base address of the bccu module. \b Range: BCCU0 + * @param dim_no Specific dimming engine number to know the dimming status. \b Range: 0 to 2\n + * + * @return Dimming completion status. \b Range: 0-Completed or 1-start change towards the target + * \parDescription:
+ * Retrieves dimming completion status for specific dimming engine number using \a dim_no by reading the register bit + * DESTRCON_DEyS. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_SetTargetDimmingLevel(), XMC_BCCU_StartDimming()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_IsDimmingFinished (XMC_BCCU_t *const bccu, uint32_t dim_no) +{ + return (uint32_t)((bccu->DESTRCON & (BCCU_DESTRCON_DE0S_Msk << dim_no)) >> dim_no); +} + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * @param level Target dimming level. \b Range: 0 to 4095 + * + * @return None + * + * \parDescription:
+ * Configures target dimming level by writing register DLS, only be written if no shadow transfer of dimming. + * Use XMC_BCCU_IsDimmingFinished() to know shadow transfer finished \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_StartDimming(), XMC_BCCU_IsDimmingFinished(), XMC_BCCU_SetGlobalDimmingLevel(), \n + * XMC_BCCU_DIM_ReadDimmingLevel()\n\n\n + */ +void XMC_BCCU_DIM_SetTargetDimmingLevel (XMC_BCCU_DIM_t *const dim_engine, uint32_t level); + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * + * @return Current dimming level. \b Range: 0 or 4095 + * \parDescription:
+ * Retrieves current dimming level by reading the register DE_DL_DLEV.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_SetTargetDimmingLevel()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_DIM_ReadDimmingLevel (XMC_BCCU_DIM_t *const dim_engine) +{ + return (uint32_t)(dim_engine->DL & BCCU_DE_DL_DLEV_Msk); +} + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * @param div Dimming clock divider, used to adjust the fade rate. If 0, the dimming level + as same as target dimming level on shadow transfer\n + * + * @return None + * + * \parDescription:
+ * Configures dimming clock divider by writing register bit DE_DTT_DIMDIV.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_SetDimClockPrescaler(), XMC_BCCU_DIM_ReadDimDivider()\n\n\n + */ +void XMC_BCCU_DIM_SetDimDivider (XMC_BCCU_DIM_t *const dim_engine, uint32_t div); + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * + * @return Dimming clock divider value. \b Range: 0 to 1023 + * \parDescription:
+ * Retrieves dimming clock divider value by reading the register BCCU_DE_DTT_DIMDIV.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_SetDimDivider()\n\n\n + */ + __STATIC_INLINE uint32_t XMC_BCCU_DIM_ReadDimDivider(XMC_BCCU_DIM_t *const dim_engine) +{ + return (uint32_t)(dim_engine->DTT & BCCU_DE_DTT_DIMDIV_Msk); +} + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * @param dither_en Dither enable. Dithering added for every dimming step if dimming level < 128.
+ * @param sel Type of exponential curve. Use type @ref XMC_BCCU_DIM_CURVE_t. Note: If dither + enabled, the configuration is being ignored\n + * + * @return None + * + * \parDescription:
+ * Configures dimming clock curve by writing register bit DE_DTT_CSEL.\n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_Init()\n\n\n + */ +void XMC_BCCU_DIM_ConfigDimCurve (XMC_BCCU_DIM_t *const dim_engine, uint32_t dither_en, XMC_BCCU_DIM_CURVE_t sel); + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * + * @return Type of exponential curve \b Range: XMC_BCCU_DIM_CURVE_COARSE or XMC_BCCU_DIM_CURVE_FINE + * \parDescription:
+ * Retrieves exponential curve type by reading the register bit BCCU_DE_DTT_CSEL. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_ConfigDimCurve(), XMC_BCCU_IsDitherEnable()\n\n\n + */ +__STATIC_INLINE XMC_BCCU_DIM_CURVE_t XMC_BCCU_DIM_GetDimCurve (XMC_BCCU_DIM_t *const dim_engine) +{ + return (XMC_BCCU_DIM_CURVE_t)((dim_engine->DTT & BCCU_DE_DTT_CSEL_Msk) >> BCCU_DE_DTT_CSEL_Pos); +} + +/** + * + * @param dim_engine Base address of the bccu dimming engine. \b Range: BCCU0_DE0, BCCU0_DE1, BCCU0_DE2 + * + * @return Dither enable status. \b Range: 1-Enabled or 0-Disabled + * \parDescription:
+ * Retrieves dither enable status by reading the register bit BCCU_DE_DTT_DTEN. \n\n + * + * \parRelated APIs:
+ * XMC_BCCU_DIM_ConfigDimCurve(), XMC_BCCU_DIM_GetDimCurve()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_BCCU_IsDitherEnable(XMC_BCCU_DIM_t *const dim_engine) +{ + return (uint32_t)((dim_engine->DTT & BCCU_DE_DTT_DTEN_Msk) >> BCCU_DE_DTT_DTEN_Pos); +} + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* BCCU0 */ + +#endif /* XMC_BCCU_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_can.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_can.h new file mode 100644 index 00000000..7e6048fd --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_can.h @@ -0,0 +1,2198 @@ +/** + * @file xmc_can.h + * @date 2016-06-07 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * - Documentation improved
+ * + * 2015-05-20: + * - New elements have added in XMC_CAN_MO_t data structure
+ * - XMC_CAN_MO_Config() signature has changed
+ * - XMC_CAN_STATUS_t enum structure has updated.
+ * + * 2015-06-20: + * - New APIs added: XMC_CAN_NODE_ClearStatus(),XMC_CAN_MO_ReceiveData(), XMC_CAN_GATEWAY_InitDesObject().
+ * - Removed version macros and declaration of GetDriverVersion API + * + * 2015-07-09: + * - New API added: XMC_CAN_NODE_Enable.
+ * + * 2015-09-01: + * - Removed fCANB clock support
+ * + * 2015-09-15: + * - Added "xmc_can_map.h" include
+ * + * 2016-06-07: + * - Added XMC_CAN_IsPanelControlReady() + * + * Details of use for node configuration related APIs
+ * Please use the XMC_CAN_NODE_SetInitBit() and XMC_CAN_NODE_EnableConfigurationChange() before calling node configuration + * related APIs. + * XMC_CAN_NODE_DisableConfigurationChange() and XMC_CAN_NODE_ResetInitBit() can be called for disable the configuration + * change and enable the node for communication afterwards. + * Do not use this when configuring the nominal bit time with XMC_CAN_NODE_NominalBitTimeConfigure(). In this case the + * Enable/Disable node configuration change is taken in account. + * + * Example Usage: + * @code + * //disabling the Node + * XMC_CAN_NODE_SetInitBit(CAN_NODE0) + * //allowing the configuration change + * XMC_CAN_NODE_EnableConfigurationChange(CAN_NODE0) + * //Node configuration + * XMC_CAN_NODE_FrameCounterConfigure(CAN_NODE0,&can_node_frame_counter); + * XMC_CAN_NODE_EnableLoopBack(CAN_NODE0) + * //disable configuration + * XMC_CAN_NODE_DisableConfigurationChange(CAN_NODE0) + * //Enabling node for communication + * XMC_CAN_NODE_ResetInitBit(CAN_NODE0) + * @endcode + * + * 2016-06-20: + * - Fixed bug in XMC_CAN_MO_Config()
+ * @endcond + * + */ + +#ifndef XMC_CAN_H +#define XMC_CAN_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include "xmc_common.h" + +#if defined(CAN) + +#include "xmc_scu.h" +#include "xmc_can_map.h" +#include + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup CAN + * @brief Controller Area Network Controller (CAN) driver for the XMC microcontroller family. + * + * CAN driver provides transfer of CAN frames in accordance with CAN specificetion V2.0 B (active). Each CAN node + * can receive and transmit standard frames with 11-bit identifiers as well as extended frames with 29-bit identifiers. + * All CAN nodes share a common set of message objects. Each message object can be individually allocated to one of the + * CAN nodes. + * Besides serving as a storage container for incoming and outgoing frames, message objects can be combined to build + * gateways between + * the CAN nodes or to setup a FIFO buffer. The CAN module provides Analyzer mode,Loop-back mode and bit timming for + * node analysis. + * + * The driver is divided into five sections: + * \par CAN Global features: + * -# Allows to configure module frequency using function XMC_CAN_Init(). + * -# Allows to configure Module interrupt using configuration structure XMC_CAN_NODE_INTERRUPT_TRIGGER_t and function + * XMC_CAN_EventTrigger(). + * + * \par CAN_NODE features: + * -# Allows to set baud rate by configuration structure XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t and Baudrate Configuration + * function XMC_CAN_NODE_NominalBitTimeConfigure(). + * -# Allows to configure loop-back mode using fuction XMC_CAN_NODE_EnableLoopBack(). + * -# Allows to configure CAN Node analyzer using function XMC_CAN_NODE_SetAnalyzerMode(). + * -# Allows CAN node events enable/ disable by enum structure XMC_CAN_NODE_EVENT_t and functions XMC_CAN_NODE_EnableEvent() + * and XMC_CAN_NODE_DisableEvent(). + * -# Provides bit timming analysis, configuration structure XMC_CAN_NODE_FRAME_COUNTER_t and function + * XMC_CAN_NODE_FrameCounterConfigure(). + * + * \par CAN_MO features: + * -# Allows message object initialization by configuration structure XMC_CAN_MO_t and function XMC_CAN_MO_Config(). + * -# Allows transfer of message objects using functions XMC_CAN_MO_Transmit() and XMC_CAN_MO_Receive(). + * -# Allows to configure Single Data Transfer and Single Transmit Trial using functions + * XMC_CAN_MO_EnableSingleTransmitTrial() and XMC_CAN_MO_EnableSingleTransmitTrial(). + * -# Allows to configure MO events using function XMC_CAN_MO_EnableEvent(). + * + * \par CAN_FIFO features: + * -# Allows message object FIFO structure by configuration structure XMC_CAN_FIFO_CONFIG_t and functions + * XMC_CAN_TXFIFO_ConfigMOBaseObject() , XMC_CAN_RXFIFO_ConfigMOBaseObject() and XMC_CAN_TXFIFO_Transmit(). + * + * \par CAN_GATEWAY features: + * -# Provides Gateway mode, configuration structure XMC_CAN_GATEWAY_CONFIG_t and function XMC_CAN_GATEWAY_InitSourceObject(). + * + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_CAN_MO_MOAR_STDID_Pos (18U) /**< Standard Identifier bitposition */ + +#define XMC_CAN_MO_MOAR_STDID_Msk ((0x000007FFUL) << XMC_CAN_MO_MOAR_STDID_Pos) /**< Standard Identifier bitMask */ + +#define CAN_NODE_NIPR_Msk (0x7UL) /**< Node event mask */ + +#define CAN_MO_MOIPR_Msk (0x7U) /**< Message Object event mask */ + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +/** + * Defines the status of CAN, to verify the CAN related API calls. Use type \a XMC_CAN_STATUS_t for this enum. +*/ +typedef enum XMC_CAN_STATUS +{ + XMC_CAN_STATUS_SUCCESS, /**< Driver accepted application request*/ + XMC_CAN_STATUS_ERROR, /**< Returned when unknown error occurred */ + XMC_CAN_STATUS_BUSY, /**< Driver is busy and can not handle request*/ + XMC_CAN_STATUS_MO_NOT_ACCEPTABLE, /**< Message object type not allowed*/ + XMC_CAN_STATUS_MO_DISABLED /**< Returned if Message object is disabled */ +} XMC_CAN_STATUS_t; + +/** +* Defines CAN module Panel Commands . Use type \a XMC_CAN_PANCMD_t for this enum. +*/ +typedef enum XMC_CAN_PANCMD +{ + XMC_CAN_PANCMD_INIT_LIST = 1U, /**< Command to initialize a list */ + XMC_CAN_PANCMD_STATIC_ALLOCATE = 2U, /**< Command to activate static allocation */ + XMC_CAN_PANCMD_DYNAMIC_ALLOCATE = 3U, /**< Command to activate dynamic allocation */ + + XMC_CAN_PANCMD_STATIC_INSERT_BEFORE = 4U, /**< Remove a message object from the list and insert it before a given object.*/ + XMC_CAN_PANCMD_DYNAMIC_INSERT_BEFORE = 5U, /**< Command to activate dynamic allocation */ + XMC_CAN_PANCMD_STATIC_INSERT_BEHIND = 6U, /**< Command to activate dynamic allocation */ + XMC_CAN_PANCMD_DYNAMIC_INSERT_BEHIND = 7U /**< Command to activate dynamic allocation */ +} XMC_CAN_PANCMD_t; + +/** +* Defines loop Back Mode, to enable/disable an in-system test of the MultiCAN module . +* Use type \a XMC_CAN_LOOKBACKMODE_t for this enum. +*/ +typedef enum XMC_CAN_LOOKBACKMODE +{ + XMC_CAN_LOOKBACKMODE_ENABLED, /**< Each CAN node can be connected to the internal CAN bus */ + XMC_CAN_LOOKBACKMODE_DISABLED /**< Each CAN node can be connected to the external CAN bus */ +} XMC_CAN_LOOKBACKMODE_t; + +/** + * Defines Message Object direction. Use type \a XMC_CAN_MO_TYPE_t for this enum. + */ +typedef enum XMC_CAN_MO_TYPE +{ + XMC_CAN_MO_TYPE_RECMSGOBJ, /**< Receive Message Object selected */ + XMC_CAN_MO_TYPE_TRANSMSGOBJ /**< Transmit Message Object selected */ +} XMC_CAN_MO_TYPE_t; + +/** + * Defines Data frame types. Use type \a XMC_CAN_FRAME_TYPE_t for this enum. + */ +typedef enum XMC_CAN_FRAME_TYPE +{ + XMC_CAN_FRAME_TYPE_STANDARD_11BITS, /**< Standard type identifier*/ + XMC_CAN_FRAME_TYPE_EXTENDED_29BITS /**< Extended type identifier*/ +} XMC_CAN_FRAME_TYPE_t; + + +/** + * Defines arbitration mode for transmit acceptance filtering. Use type \a XMC_CAN_ARBITRATION_MODE_t for this enum. + */ +typedef enum XMC_CAN_ARBITRATION_MODE +{ + XMC_CAN_ARBITRATION_MODE_ORDER_BASED_PRIO_1 = 1U, /**< Transmit acceptance based in the order(prio) */ + XMC_CAN_ARBITRATION_MODE_IDE_DIR_BASED_PRIO_2 = 2U, /**< Transmit acceptance filtering is based on the CAN identifier */ + XMC_CAN_ARBITRATION_MODE_ORDER_BASED_PRIO_3 = 3U /**< Transmit acceptance based in the order */ +} XMC_CAN_ARBITRATION_MODE_t; + +/** + * Defines the operation mode of the frame counter. Use type \a XMC_CAN_FRAME_COUNT_MODE_t for this enum. + */ +typedef enum XMC_CAN_FRAME_COUNT_MODE +{ + XMC_CAN_FRAME_COUNT_MODE = 0U, /**< Frame Count Mode */ + XMC_CAN_FRAME_COUNT_MODE_TIME_STAMP = 1U, /**< The frame counter is incremented with the beginning of a new bit time*/ + XMC_CAN_FRAME_COUNT_MODE_BIT_TIMING = 2U /**< Used for baud rate detection and analysis of the bit timing */ +} XMC_CAN_FRAME_COUNT_MODE_t; + +/** + * Defines the Divider Modes. Use type \a XMC_CAN_DM_t for this enum. + */ +typedef enum XMC_CAN_DM +{ + XMC_CAN_DM_NORMAL = 1U, /**< Normal divider mode */ + XMC_CAN_DM_FRACTIONAL = 2U, /**< Fractional divider mode */ + XMC_CAN_DM_OFF = 3U /**< Divider Mode in off-state*/ +} XMC_CAN_DM_t; + +/** + * Defines mask value for CAN Message Object set status. Use type \a XMC_CAN_MO_SET_STATUS_t for this enum. + */ +typedef enum XMC_CAN_MO_SET_STATUS +{ + XMC_CAN_MO_SET_STATUS_RX_PENDING = CAN_MO_MOCTR_SETRXPND_Msk, /**< Set receive pending */ + XMC_CAN_MO_SET_STATUS_TX_PENDING = CAN_MO_MOCTR_SETTXPND_Msk, /**< Set transmit pending */ + XMC_CAN_MO_SET_STATUS_RX_UPDATING = CAN_MO_MOCTR_SETRXUPD_Msk, /**< Set receive updating */ + XMC_CAN_MO_SET_STATUS_NEW_DATA = CAN_MO_MOCTR_SETNEWDAT_Msk, /**< Set new data */ + XMC_CAN_MO_SET_STATUS_MESSAGE_LOST = CAN_MO_MOCTR_SETMSGLST_Msk, /**< Set message lost */ + XMC_CAN_MO_SET_STATUS_MESSAGE_VALID = CAN_MO_MOCTR_SETMSGVAL_Msk, /**< Set message valid */ + XMC_CAN_MO_SET_STATUS_RX_TX_SELECTED = CAN_MO_MOCTR_SETRTSEL_Msk, /**< Set transmit/receive selected */ + XMC_CAN_MO_SET_STATUS_RX_ENABLE = CAN_MO_MOCTR_SETRXEN_Msk, /**< Set receive enable */ + XMC_CAN_MO_SET_STATUS_TX_REQUEST = CAN_MO_MOCTR_SETTXRQ_Msk, /**< Set transmit request */ + XMC_CAN_MO_SET_STATUS_TX_ENABLE0 = CAN_MO_MOCTR_SETTXEN0_Msk, /**< Set transmit enable 0 */ + XMC_CAN_MO_SET_STATUS_TX_ENABLE1 = CAN_MO_MOCTR_SETTXEN1_Msk, /**< Set transmit enable 1 */ + XMC_CAN_MO_SET_STATUS_MESSAGE_DIRECTION = CAN_MO_MOCTR_SETDIR_Msk /**< Set message direction */ +} XMC_CAN_MO_SET_STATUS_t; + +/** + * Defines mask value for CAN Message Object reset status. Use type \a XMC_CAN_MO_RESET_STATUS_t for this enum. + */ +typedef enum XMC_CAN_MO_RESET_STATUS +{ + XMC_CAN_MO_RESET_STATUS_RX_PENDING = CAN_MO_MOCTR_RESRXPND_Msk, /**< Reset receive pending */ + XMC_CAN_MO_RESET_STATUS_TX_PENDING = CAN_MO_MOCTR_RESTXPND_Msk, /**< Reset transmit pending */ + XMC_CAN_MO_RESET_STATUS_RX_UPDATING = CAN_MO_MOCTR_RESRXUPD_Msk, /**< Reset receive updating */ + XMC_CAN_MO_RESET_STATUS_NEW_DATA = CAN_MO_MOCTR_RESNEWDAT_Msk, /**< Reset new data */ + XMC_CAN_MO_RESET_STATUS_MESSAGE_LOST = CAN_MO_MOCTR_RESMSGLST_Msk, /**< Reset message lost */ + XMC_CAN_MO_RESET_STATUS_MESSAGE_VALID = CAN_MO_MOCTR_RESMSGVAL_Msk, /**< Reset message valid */ + XMC_CAN_MO_RESET_STATUS_RX_TX_SELECTED = CAN_MO_MOCTR_RESRTSEL_Msk, /**< Reset transmit/receive selected */ + XMC_CAN_MO_RESET_STATUS_RX_ENABLE = CAN_MO_MOCTR_RESRXEN_Msk, /**< Reset receive enable */ + XMC_CAN_MO_RESET_STATUS_TX_REQUEST = CAN_MO_MOCTR_RESTXRQ_Msk, /**< Reset transmit request */ + XMC_CAN_MO_RESET_STATUS_TX_ENABLE0 = CAN_MO_MOCTR_RESTXEN0_Msk, /**< Reset transmit enable 0 */ + XMC_CAN_MO_RESET_STATUS_TX_ENABLE1 = CAN_MO_MOCTR_RESTXEN1_Msk, /**< Reset transmit enable 1 */ + XMC_CAN_MO_RESET_STATUS_MESSAGE_DIRECTION = CAN_MO_MOCTR_RESDIR_Msk /**< Reset message direction */ +} XMC_CAN_MO_RESET_STATUS_t; + +/** + * Defines mask value for CAN Message Object status. Use type \a XMC_CAN_MO_STATUS_t for this enum. + */ +typedef enum XMC_CAN_MO_STATUS +{ + XMC_CAN_MO_STATUS_RX_PENDING = CAN_MO_MOSTAT_RXPND_Msk, /**< Defines message has been successfully received or not received */ + XMC_CAN_MO_STATUS_TX_PENDING = CAN_MO_MOSTAT_TXPND_Msk, /**< Defines message has been successfully transmitted or not transmitted */ + XMC_CAN_MO_STATUS_RX_UPDATING = CAN_MO_MOSTAT_RXUPD_Msk, /**< Defines Message identifier, DLC, and data of the message object are currently updated or not updated */ + XMC_CAN_MO_STATUS_NEW_DATA = CAN_MO_MOSTAT_NEWDAT_Msk, /**< Defines no update of the message object since last flag reset or Message object has been updated */ + XMC_CAN_MO_STATUS_MESSAGE_LOST = CAN_MO_MOSTAT_MSGLST_Msk, /**< CAN message is lost because NEWDAT has become set again when it has already been set or No CAN message is lost */ + XMC_CAN_MO_STATUS_MESSAGE_VALID = CAN_MO_MOSTAT_MSGVAL_Msk, /**< Message valid */ + XMC_CAN_MO_STATUS_RX_TX_SELECTED = CAN_MO_MOSTAT_RTSEL_Msk, /**< Transmit/Receive selected */ + XMC_CAN_MO_STATUS_RX_ENABLE = CAN_MO_MOSTAT_RXEN_Msk, /**< Receive enable */ + XMC_CAN_MO_STATUS_TX_REQUEST = CAN_MO_MOSTAT_TXRQ_Msk, /**< Transmit request */ + XMC_CAN_MO_STATUS_TX_ENABLE0 = CAN_MO_MOSTAT_TXEN0_Msk, /**< Transmit enable 0 */ + XMC_CAN_MO_STATUS_TX_ENABLE1 = CAN_MO_MOSTAT_TXEN1_Msk, /**< Transmit enable 1 */ + XMC_CAN_MO_STATUS_MESSAGE_DIRECTION = CAN_MO_MOSTAT_DIR_Msk, /**< Message direction */ + XMC_CAN_MO_STATUS_LIST = CAN_MO_MOSTAT_LIST_Msk, /**< List allocation */ + XMC_CAN_MO_STATUS_POINTER_TO_PREVIOUS_MO = CAN_MO_MOSTAT_PPREV_Msk, /**< Pointer to previous Message Object */ + XMC_CAN_MO_STATUS_POINTER_TO_NEXT_MO = (int32_t)CAN_MO_MOSTAT_PNEXT_Msk /**< Pointer to next Message Object */ +} XMC_CAN_MO_STATUS_t; + +/** + * Defines mask value for CAN Node status. Use type \a XMC_CAN_NODE_STATUS_t for this enum. + */ +typedef enum XMC_CAN_NODE_STATUS +{ + XMC_CAN_NODE_STATUS_LAST_ERROR_CODE = CAN_NODE_NSR_LEC_Msk, /**< Last Error Code */ + XMC_CAN_NODE_STATUS_TX_OK = CAN_NODE_NSR_TXOK_Msk, /**< Message transmitted successfully */ + XMC_CAN_NODE_STATUS_RX_OK = CAN_NODE_NSR_RXOK_Msk, /**< Message received successfully */ + XMC_CAN_NODE_STATUS_ALERT_WARNING = CAN_NODE_NSR_ALERT_Msk, /**< Alert warning */ + XMC_CAN_NODE_STATUS_ERROR_WARNING_STATUS = CAN_NODE_NSR_EWRN_Msk, /**< Error warning status */ + XMC_CAN_NODE_STATUS_BUS_OFF= CAN_NODE_NSR_BOFF_Msk, /**< Bus-off status */ + XMC_CAN_NODE_STATUS_LIST_LENGTH_ERROR = CAN_NODE_NSR_LLE_Msk, /**< List length error */ + XMC_CAN_NODE_STATUS_LIST_OBJECT_ERROR = CAN_NODE_NSR_LOE_Msk, /**< List object error */ +#if !defined(MULTICAN_PLUS) + XMC_CAN_NODE_STATUS_SUSPENDED_ACK = CAN_NODE_NSR_SUSACK_Msk /**< Suspend Acknowledge */ +#endif +} XMC_CAN_NODE_STATUS_t; + +/** + * Defines mask value for CAN Node control like initialization, node disable and analyzer mode . + * Use type \a XMC_CAN_NODE_CONTROL_t for this enum. + */ +typedef enum XMC_CAN_NODE_CONTROL +{ + XMC_CAN_NODE_CONTROL_NODE_INIT = CAN_NODE_NCR_INIT_Msk, /**< Node initialization */ + XMC_CAN_NODE_CONTROL_TX_INT_ENABLE = CAN_NODE_NCR_TRIE_Msk, /**< Transfer event enable */ + XMC_CAN_NODE_CONTROL_LEC_INT_ENABLE = CAN_NODE_NCR_LECIE_Msk, /**< LEC Indicated Error Event Enable */ + XMC_CAN_NODE_CONTROL_ALERT_INT_ENABLE = CAN_NODE_NCR_ALIE_Msk, /**< Alert Event Enable */ + XMC_CAN_NODE_CONTROL_CAN_DISABLE = CAN_NODE_NCR_CANDIS_Msk, /**< CAN disable */ + XMC_CAN_NODE_CONTROL_CONF_CHANGE_ENABLE= CAN_NODE_NCR_CCE_Msk, /**< Configuration change enable */ + XMC_CAN_NODE_CONTROL_CAN_ANALYZER_NODEDE = CAN_NODE_NCR_CALM_Msk, /**< CAN Analyzer mode */ +#if !defined(MULTICAN_PLUS) + XMC_CAN_NODE_CONTROL_SUSPENDED_ENABLE = CAN_NODE_NCR_SUSEN_Msk /**< Suspend Enable */ +#endif +} XMC_CAN_NODE_CONTROL_t; + +/** + * Defines mask value for CAN Node events. Use type \a XMC_CAN_NODE_EVENT_t for this enum. + */ +typedef enum XMC_CAN_NODE_EVENT +{ + XMC_CAN_NODE_EVENT_TX_INT = CAN_NODE_NCR_TRIE_Msk, /**< Node Transfer OK Event */ + XMC_CAN_NODE_EVENT_ALERT = CAN_NODE_NCR_ALIE_Msk, /**< Node Alert Event */ + XMC_CAN_NODE_EVENT_LEC = CAN_NODE_NCR_LECIE_Msk, /**< Last Error code Event */ + XMC_CAN_NODE_EVENT_CFCIE = CAN_NODE_NFCR_CFCIE_Msk /**< CAN Frame Count Event */ +} XMC_CAN_NODE_EVENT_t; + +/** + * Defines mask value for CAN node pointer events position. Use type \a XMC_CAN_NODE_POINTER_EVENT_t for this enum. + */ +typedef enum XMC_CAN_NODE_POINTER_EVENT +{ + XMC_CAN_NODE_POINTER_EVENT_ALERT = CAN_NODE_NIPR_ALINP_Pos, /**< Node Alert Event node pointer */ + XMC_CAN_NODE_POINTER_EVENT_LEC = CAN_NODE_NIPR_LECINP_Pos, /**< Last Error code Event node pointer */ + XMC_CAN_NODE_POINTER_EVENT_TRANSFER_OK = CAN_NODE_NIPR_TRINP_Pos, /**< Transmit Event node pointer */ + XMC_CAN_NODE_POINTER_EVENT_FRAME_COUNTER = CAN_NODE_NIPR_CFCINP_Pos /**< CAN Frame Count Event node pointer */ +} XMC_CAN_NODE_POINTER_EVENT_t; + +/** + * Defines CAN Message Object event node pointer position. Use type \a XMC_CAN_MO_POINTER_EVENT_t for this enum. + */ +typedef enum XMC_CAN_MO_POINTER_EVENT +{ + XMC_CAN_MO_POINTER_EVENT_TRANSMIT = CAN_MO_MOIPR_TXINP_Pos, /**< Transmit Event node pointer */ + XMC_CAN_MO_POINTER_EVENT_RECEIVE = CAN_MO_MOIPR_RXINP_Pos /**< Receive Event node pointer */ +} XMC_CAN_MO_POINTER_EVENT_t; + +/** + * Defines mask value for CAN Message Object event type. Use type \a XMC_CAN_MO_EVENT_t for this enum. + */ +typedef enum XMC_CAN_MO_EVENT +{ + XMC_CAN_MO_EVENT_TRANSMIT = CAN_MO_MOFCR_TXIE_Msk, /**< Message Object transmit event */ + XMC_CAN_MO_EVENT_RECEIVE = CAN_MO_MOFCR_RXIE_Msk, /**< Message Object receive event */ + XMC_CAN_MO_EVENT_OVERFLOW = CAN_MO_MOFCR_OVIE_Msk, /**< Message Object overflow event */ +} XMC_CAN_MO_EVENT_t; + +/** + * Defines the possible receive inputs. Use type \a XMC_CAN_NODE_RECEIVE_INPUT_t for this enum. + */ +typedef enum XMC_CAN_NODE_RECEIVE_INPUT +{ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCA, /**< CAN Receive Input A */ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCB, /**< CAN Receive Input B */ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCC, /**< CAN Receive Input C */ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCD, /**< CAN Receive Input D */ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCE, /**< CAN Receive Input E */ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCF, /**< CAN Receive Input F */ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCG, /**< CAN Receive Input G */ + XMC_CAN_NODE_RECEIVE_INPUT_RXDCH /**< CAN Receive Input H */ +} XMC_CAN_NODE_RECEIVE_INPUT_t; + +/** + * Defines last error transfer direction. Use type \a XMC_CAN_NODE_LAST_ERROR_DIR_t for this enum. + */ +typedef enum XMC_CAN_NODE_LAST_ERROR_DIR +{ + XMC_CAN_NODE_LAST_ERROR_DIR_WHILE_NODE_RECEPCION, /**< The last error occurred while the CAN node x was receiver */ + XMC_CAN_NODE_LAST_ERROR_DIR_WHILE_NODE_TRANSMISSION /**< The last error occurred while the CAN node x was transmitter */ +} XMC_CAN_NODE_LAST_ERROR_DIR_t; + + +/** + * Defines last error increment. Use type \a XMC_CAN_NODE_LAST_ERROR_INC_t for this enum. + */ +typedef enum XMC_CAN_NODE_LAST_ERROR_INC +{ + XMC_CAN_NODE_LAST_ERROR_INC_1, /**< The last error led to an error counter increment of 1. */ + XMC_CAN_NODE_LAST_ERROR_INC_8 /**< The last error led to an error counter increment of 8. */ +} XMC_CAN_NODE_LAST_ERROR_INC_t; + +/** + * Defines interrupt request on interrupt output line INT_O[n]. Use type \a XMC_CAN_NODE_INTERRUPT_TRIGGER_t for this enum. + */ +typedef enum XMC_CAN_NODE_INTERRUPT_TRIGGER +{ + XMC_CAN_NODE_INTR_TRIGGER_0 = 0x1U, + XMC_CAN_NODE_INTR_TRIGGER_1 = 0x2U, + XMC_CAN_NODE_INTR_TRIGGER_2 = 0x4U, + XMC_CAN_NODE_INTR_TRIGGER_3 = 0x8U, + XMC_CAN_NODE_INTR_TRIGGER_4 = 0x16U, + XMC_CAN_NODE_INTR_TRIGGER_5 = 0x32U, + XMC_CAN_NODE_INTR_TRIGGER_6 = 0x64U, + XMC_CAN_NODE_INTR_TRIGGER_7 = 0x128U, +} XMC_CAN_NODE_INTERRUPT_TRIGGER_t; + +#if defined(MULTICAN_PLUS) || defined(DOXYGEN) +/** + * Defines the Clock source used for the MCAN peripheral. @note Only available for XMC1400, XMC4800 and XMC4700 series + */ +typedef enum XMC_CAN_CANCLKSRC +{ +#if UC_FAMILY == XMC4 + XMC_CAN_CANCLKSRC_FPERI = 0x1U, + XMC_CAN_CANCLKSRC_FOHP = 0x2U, +#else + XMC_CAN_CANCLKSRC_MCLK = 0x1U, + XMC_CAN_CANCLKSRC_FOHP = 0x2U +#endif +} XMC_CAN_CANCLKSRC_t; +#endif + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ +/** + * Defines CAN node Nominal Bit Time. Use type \a XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t for this structure. +*/ +typedef struct XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG +{ + uint32_t can_frequency; /**< Frequency of the CAN module(fCAN). \a can_frequency shall be range of 5MHz to 120MHz */ + uint32_t baudrate; /**< Specifies the node baud rate. Unit: baud \a baudrate shall be range of 100Kbps to 1000Kbps*/ + uint16_t sample_point; /**< Sample point is used to compensate mismatch between transmitter and receiver clock phases detected in + the synchronization segment. Sample point. Range = [0, 10000] with respect [0%, 100%] of the total bit time.*/ + uint16_t sjw; /**< (Re) Synchronization Jump Width. Range:0-3 */ +} XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t; + +/** + * Defines base, top and bottom of CAN Message Object FIFO Structure. Use type \a XMC_CAN_FIFO_CONFIG_t for this structure. + * A FIFO consists of one base object and n slave objects. + */ +typedef struct XMC_CAN_FIFO_CONFIG +{ + uint8_t fifo_bottom; /**< points to the first element(slave object) in a FIFO structure.Range :0-63*/ + uint8_t fifo_top; /**< points to the last element(slave object) in a FIFO structure. Range :0-63*/ + uint8_t fifo_base; /**< points to the actual target object(Base object) within a FIFO/Gateway structure. Range :0-63*/ +} XMC_CAN_FIFO_CONFIG_t; + +/** + * Defines CAN Gateway FIFO structure and provides additional options for gateway destination object. + * Use type \a XMC_CAN_GATEWAY_CONFIG_t for this structure. + */ +typedef struct XMC_CAN_GATEWAY_CONFIG +{ + uint8_t gateway_bottom; /**< points to the first element(gateway destination object) in a FIFO structure. Range :0-63*/ + uint8_t gateway_top; /**< points to the last element(gateway destination object) in a FIFO structure. Range :0-63*/ + uint8_t gateway_base; /**< points to the actual target object within a FIFO/Gateway structure. Range :0-63*/ + bool gateway_data_frame_send; /**< TXRQ updated in the gateway destination object after the internal transfer from the gateway source + to the gateway destination object */ + bool gateway_identifier_copy; /**< The identifier of the gateway source object (after storing the received frame in the source) is copied + to the gateway destination object. */ + + bool gateway_data_length_code_copy; /**< Data length code of the gateway source object (after storing the received frame in the source) is copied to the + gateway destination object */ + bool gateway_data_copy; /**< Data fields in registers MODATALn and MODATAHn of the gateway source object (after storing the received frame in the source) + are copied to the gateway destination.*/ + +} XMC_CAN_GATEWAY_CONFIG_t; + +/** +* Defines CAN Global Initialization structure +*/ +typedef CAN_GLOBAL_TypeDef XMC_CAN_t; + +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * Defines frame counter configuration. Use type \a XMC_CAN_NODE_FRAME_COUNTER_t for this structure. + * It provides configuration of frame counter that counts transmitted/received CAN frames or obtains information about the time + * when a frame has been started to transmit or be received by the CAN node. +*/ +typedef struct XMC_CAN_NODE_FRAME_COUNTER +{ + + union{ + struct{ + uint32_t : 16; + uint32_t can_frame_count_selection:3; /**< Defines function of the frame counter */ + uint32_t can_frame_count_mode:2; /**< Determines the operation mode of the frame counter */ + uint32_t : 11; + }; + uint32_t nfcr; + + }; +} XMC_CAN_NODE_FRAME_COUNTER_t; + +/** + *Defines Node Runtime structure. +*/ +typedef CAN_NODE_TypeDef XMC_CAN_NODE_t; /**< pointer to the Node CAN register */ + +/** + * Defines CAN Message Object runtime elements. Use type \a XMC_CAN_MO_t for this structure. + */ +typedef struct XMC_CAN_MO +{ + CAN_MO_TypeDef *can_mo_ptr; /**< Pointer to the Message Object CAN register */ + union{ + struct{ + uint32_t can_identifier:29; /**< standard (11 bit)/Extended (29 bit) message identifier */ + uint32_t can_id_mode:1; /**< Standard/Extended identifier support */ + uint32_t can_priority:2; /**< Arbitration Mode/Priority */ + }; + uint32_t mo_ar; + }; + union{ + struct{ + uint32_t can_id_mask:29; /**< CAN Identifier of Message Object */ + uint32_t can_ide_mask:1; /**< Identifier Extension Bit of Message Object */ + }; + uint32_t mo_amr; + }; + uint8_t can_data_length; /**< Message data length, Range:0-8 */ + + union{ + + uint8_t can_data_byte[8]; /**< Each position of the array represents a data byte*/ + uint16_t can_data_word[4]; /**< Each position of the array represents a 16 bits data word*/ + uint32_t can_data[2]; /**< can_data[0] lower 4 bytes of the data. can_data[1], higher 4 bytes + of the data */ + uint64_t can_data_long; /** Data of the Message Object*/ + }; + + XMC_CAN_MO_TYPE_t can_mo_type; /**< Message Type */ + +} XMC_CAN_MO_t; +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * + * @param obj Pointer pointing to XMC_CAN Global Initialization structure. Defines CAN global registers,refer CAN_NODE_TypeDef + * for details. + * + * @return None + * + * \parDescription:
+ * Disables CAN module. In disabled state, no registers of CAN module can be read or written except the CAN_CLC register. + * + * \parRelated APIs:
+ * XMC_CAN_Enable()\n\n\n + * + */ + +void XMC_CAN_Disable(XMC_CAN_t *const obj); + +/** + * + * @param obj Pointer pointing to XMC_CAN Global Initialization structure. Defines CAN global registers,refer CAN_NODE_TypeDef + * for details. + * + * @return None + * + * \parDescription:
+ * Enables CAN module and initializes all CAN registers to reset values. It is required to re-configure desired CAN nodes, + * before any data transfer. It configures CAN_CLC.DISR bit. + * + * \parRelated APIs:
+ * XMC_CAN_Disable()\n\n\n + * + */ + +void XMC_CAN_Enable(XMC_CAN_t *const obj); + +/** + * + * @param obj Pointer pointing to XMC_CAN Global Initialization structure. Defines CAN global registers,refer CAN_NODE_TypeDef + * for details. + * + * @param node_num CAN node number,Range : 0-2 + * @param mo_num CAN Message Object number,Range : 0-63 + * + * @return None + * + * \parDescription:
+ * Allocates Message Object from free list to node list. Each \a node_num is linked to one unique list of message objects. + * A CAN node performs message transfer only with the \a mo_num message objects that are allocated to the list of the CAN node. + * It configures PANCTR register. + * + * \parRelated APIs:
+ * None + * + */ + +void XMC_CAN_AllocateMOtoNodeList(XMC_CAN_t *const obj, const uint8_t node_num, const uint8_t mo_num); + +/** + * + * @param obj Pointer pointing to XMC_CAN Global Initialization structure. Defines CAN global registers,refer CAN_NODE_TypeDef + * for details. + * + * @return Ready status of list controller + * + * \parDescription:
+ * Returns ready status of the list controller + * + * \parRelated APIs:
+ * XMC_CAN_PanelControl() + * + */ +__STATIC_INLINE bool XMC_CAN_IsPanelControlReady(XMC_CAN_t *const obj) +{ + return (bool)((obj->PANCTR & (CAN_PANCTR_BUSY_Msk | CAN_PANCTR_RBUSY_Msk)) == 0); +} + +/** + * + * @param obj Pointer pointing to XMC_CAN Global Initialization structure. Defines CAN global registers,refer CAN_NODE_TypeDef + * for details. + * + * @param pancmd panal command selection. Refer @ref XMC_CAN_PANCMD_t for valid values. + * @param arg1 Panel Argument 1,Range : 0-2 + * @param arg2 Panel Argument 2, Range : 0-63 + * + * @return None + * + * \parDescription:
+ * Configures the panel command and panel arguments. A panel operation consists of a command code (PANCMD) and up to two + * panel arguments (PANAR1, PANAR2). Commands that have a return value deliver it to the PANAR1 bit field. Commands that + * return an error flag deliver it to bit 31 of the Panel Control Register, this means bit 7 of PANAR2. \a arg1 represents + * panel argument PANAR1,\a arg2 represents panel argument PANAR2 and \a pancmd represents command code. It configures PANCTR + * register. + * + * \parRelated APIs:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_PanelControl(XMC_CAN_t *const obj, + const XMC_CAN_PANCMD_t pancmd, + const uint8_t arg1, + const uint8_t arg2) +{ + obj->PANCTR = (((uint32_t)pancmd << CAN_PANCTR_PANCMD_Pos) & (uint32_t)CAN_PANCTR_PANCMD_Msk) | + (((uint32_t)arg1 << CAN_PANCTR_PANAR1_Pos) & (uint32_t)CAN_PANCTR_PANAR1_Msk) | + (((uint32_t)arg2 << CAN_PANCTR_PANAR2_Pos) & (uint32_t)CAN_PANCTR_PANAR2_Msk); +} + + +/** + * + * @param obj Pointer pointing to XMC_CAN Global Initialization structure. Defines CAN global registers,refer CAN_NODE_TypeDef + * for details. + * + * @param service_requestr Interrupt trigger number selection. Refer @ref XMC_CAN_NODE_INTERRUPT_TRIGGER_t for valid values. + * Multiple interrupt trigger events can be ORed. + * + * @return None + * + * \parDescription:
+ * Configures multiple interrupt requests with a single write operation. \a service_requestr represents single interrupt + * request or multiple.It configures MITR register. + * + * \parRelated APIs:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_EventTrigger(XMC_CAN_t *const obj,const XMC_CAN_NODE_INTERRUPT_TRIGGER_t service_requestr) +{ + obj->MITR = ((uint32_t)service_requestr << CAN_MITR_IT_Pos) & (uint32_t)CAN_MITR_IT_Msk; +} + + + + /*INIT APIs*/ + +/** + * + * @param obj Pointer pointing to XMC_CAN Global Initialization structure. Defines CAN global registers,refer CAN_NODE_TypeDef + * for details. + * + * @param can_frequency CAN module frequency(fCAN). Range : 5MHz to 120MHz + * + * @return None + * + * \parDescription:
+ * Configures clock rate of the module timer clock fCAN. Altering CAN module \a can_frequency shall affects baud rate, + * call XMC_CAN_NODE_NominalBitTimeConfigure() to configure baud rate for current CAN frequency.It configures FDR register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_NominalBitTimeConfigure()\n\n\n + * + */ + + +#if defined(MULTICAN_PLUS) +void XMC_CAN_Init(XMC_CAN_t *const obj, XMC_CAN_CANCLKSRC_t clksrc, uint32_t can_frequency); +/** + * + */ +XMC_CAN_CANCLKSRC_t XMC_CAN_GetBaudrateClockSource(XMC_CAN_t *const obj); +/** + * + */ +void XMC_CAN_SetBaudrateClockSource(XMC_CAN_t *const obj,const XMC_CAN_CANCLKSRC_t source); +/** + * + */ +uint32_t XMC_CAN_GetBaudrateClockFrequency(XMC_CAN_t *const obj); +#else +void XMC_CAN_Init(XMC_CAN_t *const obj, uint32_t can_frequency); +#endif + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Initializes CAN message object. Initialization includes configuring Message Object identifier type, Message Object + * identifier value, Message Object type, and transfer requests. It configures FDR register. + * + * \parRelated APIs:
+ * None + * + */ + +void XMC_CAN_MO_Config(const XMC_CAN_MO_t *const can_mo); + + + /*NODE APIs*/ + + +/** + * + * @param can_node Pointer pointing to CAN_NODE Structure. Defines CAN_NODE registers. + * @param ptr_event CAN_NODE interrupt pointer position. Refer @ref XMC_CAN_NODE_POINTER_EVENT_t structure for valid values. + * @param service_request Interrupt service request number. Range : 0-7 + * + * @return None + * + * \parDescription:
+ * Configures node interrupt pointer \a service_request for CAN Node events \a ptr_event. It configures NIPR register. + * + * \parRelated APIs:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_SetEventNodePointer(XMC_CAN_NODE_t *const can_node, + const XMC_CAN_NODE_POINTER_EVENT_t ptr_event, + const uint32_t service_request) +{ + can_node->NIPR = (uint32_t)((can_node->NIPR) & ~(uint32_t)(CAN_NODE_NIPR_Msk << (uint32_t)ptr_event)) | (service_request << (uint32_t)ptr_event); +} + + +/** + * + * @param can_node Pointer pointing to CAN_NODE Structure. Defines CAN_NODE registers. Range :CAN_NODE0-CAN_NODE2 + * @param can_bit_time Nominal bit time configuration data structure. Refer @ref XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t for details. + * + * @return None + * + * \parDescription:
+ * Configures CAN node Baudrate. \a can_bit_time specifies required baudrate for a specified \a can_node. + * It configures NBTR register. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_CAN_NODE_NominalBitTimeConfigure (XMC_CAN_NODE_t *const can_node, + const XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t *const can_bit_time); + +/** + * @param can_node Pointer pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param input CAN receive input selection. Refer @ref XMC_CAN_NODE_RECEIVE_INPUT_t for details. + * + * @return None + * + * \parDescription:
+ * \a input specifies CAN input receive pin. This API Configures NPCRx register,it is required to call + * XMC_CAN_NODE_EnableConfigurationChange(), before configuring NPCRx register, call XMC_CAN_NODE_DisableConfigurationChange() + * API after configuring NPCRx register. CAN input receive pins which falls under analog port pins should call + * XMC_GPIO_EnableDigitalInput(),to enable digital pad. + * + *\parRelated APIs:
+ * None + * + * \parNote:
+ * NPCRx can be written only if bit NCRx.CCE is set. + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_SetReceiveInput(XMC_CAN_NODE_t *const can_node, + const XMC_CAN_NODE_RECEIVE_INPUT_t input) +{ + can_node->NPCR = ((can_node->NPCR) & ~(uint32_t)(CAN_NODE_NPCR_RXSEL_Msk)) | + (((uint32_t)input << CAN_NODE_NPCR_RXSEL_Pos) & (uint32_t)CAN_NODE_NPCR_RXSEL_Msk); +} + + +/** + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Enable Node \a can_node in Loop-Back Mode. A Node is connected to an internal (virtual) loop-back CAN bus. All CAN + * nodes which are in Loop- Back Mode are connected to this virtual CAN bus so that they can communicate with each + * other internally. The external transmit line is forced recessive in Loop-Back Mode. This API Configures NPCRx register. + * call XMC_CAN_NODE_EnableConfigurationChange() API before NPCRx configuration, same way XMC_CAN_NODE_DisableConfigurationChange() + * API after NPCRx configuration configuration. + * + * \parRelated APIs:
] + * XMC_CAN_NODE_DisableLoopBack(). + * + * \parNote:
+ * NPCRx can be written only if bit NCRx.CCE is set. + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_EnableLoopBack(XMC_CAN_NODE_t *const can_node) +{ + can_node->NPCR |= (uint32_t)CAN_NODE_NPCR_LBM_Msk; +} + + +/** + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Disable Node Loop-Back Mode, disables internal (virtual) loop-back CAN bus. This API Configures NPCRx register. + * Call XMC_CAN_NODE_EnableConfigurationChange() API before NPCRx configuration, same way XMC_CAN_NODE_DisableConfigurationChange() + * API after NPCRx configuration. + * + * \parRelated APIs:
] + * XMC_CAN_NODE_EnableLoopBack() + * + * + * \parNote:
+ * NPCRx can be written only if bit NCRx.CCE is set. + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_DisableLoopBack(XMC_CAN_NODE_t *const can_node) +{ + can_node->NPCR &= ~(uint32_t)CAN_NODE_NPCR_LBM_Msk; +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param event CAN node event mask value. Refer @ref XMC_CAN_NODE_EVENT_t structure for valid values. + * multiple events can be ORed. + * + * @return None + * + * \parDescription:
+ * Enable CAN Node events. It configures NFCR register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_DisableEvent() + * + */ + +void XMC_CAN_NODE_EnableEvent(XMC_CAN_NODE_t *const can_node, const XMC_CAN_NODE_EVENT_t event); + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param event CAN node event mask value. Refer @ref XMC_CAN_NODE_EVENT_t structure for valid values. + * multiple events can be ORed. + * + * @return None + * + * \parDescription:
+ * Disable CAN Node events. It configures NFCR register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_EnableEvent() + * + */ + +void XMC_CAN_NODE_DisableEvent(XMC_CAN_NODE_t *const can_node, const XMC_CAN_NODE_EVENT_t event); + + +/** + * + * @param node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return XMC_CAN_NODE_LAST_ERROR_DIR_t Last error transfer direction. Refer @ref XMC_CAN_NODE_LAST_ERROR_DIR_t. + * + * \parDescription:
+ * Returns NODE Last Error occurred during Transmit/receive direction. It returns value of NFCR register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_GetLastErrTransferInc()\n\n\n + * + */ + +__STATIC_INLINE XMC_CAN_NODE_LAST_ERROR_DIR_t XMC_CAN_NODE_GetLastErrTransferDir(XMC_CAN_NODE_t *const node) +{ + return (XMC_CAN_NODE_LAST_ERROR_DIR_t)(((node->NECNT) & CAN_NODE_NECNT_LETD_Msk) >> CAN_NODE_NECNT_LETD_Pos); +} + + +/** + * + * @param node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return XMC_CAN_NODE_LAST_ERROR_INC_t Last error transfer increment. Refer @ref XMC_CAN_NODE_LAST_ERROR_INC_t. + * + * \parDescription:
+ * Returns NODE Last Error Transfer Increment. It returns value of NFCR register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_GetLastErrTransferDir()\n\n\n + * + */ + +__STATIC_INLINE XMC_CAN_NODE_LAST_ERROR_INC_t XMC_CAN_NODE_GetLastErrTransferInc(XMC_CAN_NODE_t *const node) +{ + return (XMC_CAN_NODE_LAST_ERROR_INC_t)(((node->NECNT) & CAN_NODE_NECNT_LEINC_Msk)>> CAN_NODE_NECNT_LEINC_Pos); +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param error_warning_level Error Warning level value. Range :0-255. + * + * @return None + * + * \parDescription:
+ * Configures error warning level in order to set the corresponding error warning bit EWRN. It configures \a error_warning_level + * into NECNT register. Before this configuration call XMC_CAN_NODE_EnableConfigurationChange() API. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_GetErrorWarningLevel()\n\n\n + * + * \parNote:
+ * NECNTx can be written only if bit NCRx.CCE is set. + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_SetErrorWarningLevel(XMC_CAN_NODE_t *const can_node, uint8_t error_warning_level) +{ + can_node->NECNT = ((can_node->NECNT) & ~(uint32_t)(CAN_NODE_NECNT_EWRNLVL_Msk)) | + (((uint32_t)error_warning_level << CAN_NODE_NECNT_EWRNLVL_Pos) & (uint32_t)CAN_NODE_NECNT_EWRNLVL_Msk); +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param can_tec transmit error counter value. Range :0-255 + * + * @return None + * + * \parDescription:
+ * Configures Transmit error counter. It configures \a can_tec into NECNT register. Before this configuration call + * XMC_CAN_NODE_EnableConfigurationChange() API. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_GetTransmitErrorCounter()\n\n\n + * + * \parNote:
+ * NECNTx can be written only if bit NCRx.CCE is set. + * + */ + + +__STATIC_INLINE void XMC_CAN_NODE_SetTransmitErrorCounter(XMC_CAN_NODE_t *const can_node, uint8_t can_tec) +{ + can_node->NECNT = ((can_node->NECNT) & ~(uint32_t)(CAN_NODE_NECNT_TEC_Msk)) | + (((uint32_t)can_tec << CAN_NODE_NECNT_TEC_Pos) & (uint32_t)CAN_NODE_NECNT_TEC_Msk); +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param can_rec receive error counter value. Range :0-255 + * + * @return None + * + * \parDescription:
+ * Configures Receive Error Counter. It configures \a can_rec into NECNT register. Before this configuration call + * XMC_CAN_NODE_EnableConfigurationChange() API. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_GetReceiveErrorCounter()\n\n\n + * + * \parNote:
+ * NECNTx can be written only if bit NCRx.CCE is set. + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_SetReceiveErrorCounter(XMC_CAN_NODE_t *const can_node, uint8_t can_rec) +{ + can_node->NECNT = ((can_node->NECNT) & ~(uint32_t)(CAN_NODE_NECNT_REC_Msk)) | + (((uint32_t)can_rec << CAN_NODE_NECNT_REC_Pos) & (uint32_t)CAN_NODE_NECNT_REC_Msk); +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return uint8_t Error Warning Level. Range :0 - 255 + * + * \parDescription:
+ * Returns error warning level. This determines the threshold value (warning level, default 96) to be reached in order + * to set the corresponding error warning bit EWRN. It reads NECNT register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_SetErrorWarningLevel()\n\n\n + * + */ + + +__STATIC_INLINE uint8_t XMC_CAN_NODE_GetErrorWarningLevel(XMC_CAN_NODE_t *const can_node) +{ + return (uint8_t)((uint32_t)((can_node->NECNT) & CAN_NODE_NECNT_EWRNLVL_Msk) >> CAN_NODE_NECNT_EWRNLVL_Pos); +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return uint8_t transmit error counter value. Range :0 - 255 + * + * \parDescription:
+ * Returns Transmit Error Counter value. If the Bitstream Processor detects an error while a transmit operation is + * running, the Transmit Error Counter is incremented by 8. An increment of 1 is used when the error condition was + * reported by an external CAN node via an Error Frame generation. It reads NECNT register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_SetTransmitErrorCounter() + * + * \parNote:
+ * NECNTx can be written only if bit NCRx.CCE is set. + * + */ + +__STATIC_INLINE uint8_t XMC_CAN_NODE_GetTransmitErrorCounter(XMC_CAN_NODE_t *const can_node) +{ + return (uint8_t)((uint32_t)((can_node->NECNT) & CAN_NODE_NECNT_TEC_Msk) >> CAN_NODE_NECNT_TEC_Pos); +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return uint8_t receive error counter value. + * + * \parDescription:
+ * Returns Receive Error Counter value. It reads NECNT register. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_SetReceiveErrorCounter() + * + */ + +__STATIC_INLINE uint8_t XMC_CAN_NODE_GetReceiveErrorCounter(XMC_CAN_NODE_t *const can_node) +{ + return (uint8_t)((uint32_t)((can_node->NECNT) & CAN_NODE_NECNT_REC_Msk) >> CAN_NODE_NECNT_REC_Pos); +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return uint32_t Current status of the node. + * + * \parDescription:
+ * Returns errors status as well as successfully transferred CAN frames status. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_ClearStatus() + * + */ + +__STATIC_INLINE uint32_t XMC_CAN_NODE_GetStatus(XMC_CAN_NODE_t *const can_node) +{ + return ((can_node->NSR)); +} + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param can_node_status Status to clear.Refer @ref XMC_CAN_NODE_STATUS_t for valid values. + * + * @return None + * + * \parDescription:
+ * Clear errors status as well as successfully transferred CAN frames status. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_GetStatus() + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_ClearStatus(XMC_CAN_NODE_t *const can_node,XMC_CAN_NODE_STATUS_t can_node_status) +{ + can_node->NSR &= ~(uint32_t)can_node_status; +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Allow to change the configuration of the CAN node, like bit timing, CAN bus transmit/receive ports and error + * counters read. It configures NCRx.CCE bit. + * + * \parRelated APIs:
+ * XMC_CAN_NODE_DisableConfigurationChange() + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_EnableConfigurationChange(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR |= (uint32_t)CAN_NODE_NCR_CCE_Msk; +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Forbid to change the configuration of the CAN node. It configures NCRx.CCE bit. + * + * \parRelated API's:
+ * XMC_CAN_NODE_EnableConfigurationChange() + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_DisableConfigurationChange(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR &= ~(uint32_t)CAN_NODE_NCR_CCE_Msk; +} + + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Disable CAN node participation in CAN traffic. Bit INIT is automatically set when the CAN node enters the bus-off + * state. It configures NCR.INIT bit. + * + * \parRelated API's:
+ * XMC_CAN_NODE_ResetInitBit() + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_SetInitBit(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR |= (uint32_t)CAN_NODE_NCR_INIT_Msk; +} + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Enable CAN node participation in CAN traffic. Bit INIT is automatically set when the CAN node enters the bus-off + * state. It configures NCR.INIT bit. + * + * \parRelated API's:
+ * XMC_CAN_NODE_SetInitBit() + * + */ +__STATIC_INLINE void XMC_CAN_NODE_ResetInitBit(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR &= ~(uint32_t)CAN_NODE_NCR_INIT_Msk; +} + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Enable the CAN node, starts the participation in CAN traffic. It configures NCR.CANDIS and the NCR.INIT bits. + * + * \parRelated API's:
+ * None + * + */ +__STATIC_INLINE void XMC_CAN_NODE_Enable(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR &= ~(uint32_t)CAN_NODE_NCR_CANDIS_Msk; + XMC_CAN_NODE_ResetInitBit(can_node); +} + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Disable the CAN node, terminates participation in CAN traffic. It configures NCR.CANDIS bit. + * + * \parRelated API's:
+ * None + * + */ +__STATIC_INLINE void XMC_CAN_NODE_Disable(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR |= (uint32_t)CAN_NODE_NCR_CANDIS_Msk; +} + +/** + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Configure CAN node in Analyzer Mode. This means that messages may be received, but not transmitted. No acknowledge + * is sent on the CAN bus upon frame reception. Active-error flags are sent recessive instead of dominant. + * The transmit line is continuously held at recessive (1) level. XMC_CAN_NODE_SetInitBit() should be called before + * set / reset AnalyzerMode. It configures NCR.CALM bit. + * + * \parRelated API's:
+ * XMC_CAN_NODE_ReSetAnalyzerMode() + * + */ + + +__STATIC_INLINE void XMC_CAN_NODE_SetAnalyzerMode(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR |= (uint32_t)CAN_NODE_NCR_CALM_Msk; +} + + +/** + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Reset the Analyzer mode. CAN node is no more in Analyzer Mode. Please refer XMC_CAN_NODE_SetAnalyzerMode(). + * It configures NCR.CALM bit. XMC_CAN_NODE_SetInitBit() should be called before set / reset AnalyzerMode. + * + * \parRelated API's:
+ * XMC_CAN_NODE_SetAnalyzerMode() + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_ReSetAnalyzerMode(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR &= ~(uint32_t)CAN_NODE_NCR_CALM_Msk; +} + +#if !defined(MULTICAN_PLUS) +/** + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Trigger the suspension of the CAN node. An OCDS(on chip debug support) suspend trigger disables the CAN node: As + * soon as the CAN node becomes bus-idle or bus-off, bit INIT is internally forced to 1 to disable the CAN node. + * The actual value of bit INIT remains unchanged. It configures NCR.SUSEN bit + * + * \parRelated API's:
+ * None + * + *\parNote:
+ * Bit SUSEN is reset via OCDS(on chip debug support) Reset. + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_EnableSuspend(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR |= (uint32_t)CAN_NODE_NCR_SUSEN_Msk; +} +#else +/** + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return None + * + * \parDescription:
+ * Disables the transmission on CAN node x as soon as bus-idle is reached. + * + * \parRelated API's:
+ * None + * + * @note Only available for XMC1400,XMC4800 and XMC4700 series + */ + +__STATIC_INLINE void XMC_CAN_NODE_DisableTransmit(XMC_CAN_NODE_t *const can_node) +{ + can_node->NCR |= (uint32_t)CAN_NODE_NCR_TXDIS_Msk; +} +#endif + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * @param can_node_init frame counter mode selection. Refer @ref XMC_CAN_NODE_FRAME_COUNTER_t for valid values. + * + * @return None + * + * \parDescription:
+ * Configures frame counter functions. Each CAN \a can_node is equipped with a frame counter that counts transmitted/received + * CAN frames or obtains information about the time when a frame has been started to transmit or be received by the CAN + * node. It configures NFCR register. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_NODE_FrameCounterConfigure(XMC_CAN_NODE_t *const can_node, + const XMC_CAN_NODE_FRAME_COUNTER_t *const can_node_init) +{ + can_node->NFCR = (can_node->NFCR & ~(uint32_t)(CAN_NODE_NFCR_CFMOD_Msk | + CAN_NODE_NFCR_CFSEL_Msk)) | + can_node_init->nfcr; +} + + +/** + * + * @param can_node Pointer Pointing to CAN_NODE Structure. Defines CAN_NODE registers, Range :CAN_NODE0-CAN_NODE2. + * + * @return uint16_t current value of the CAN frame counter. Range :0-65535 + * + * \parDescription:
+ * Returns the frame counter value \a can_node of the CAN node. In Frame Count Mode (CFMOD = 00B), this API returns the frame + * count value. In Time Stamp Mode (CFMOD = 01B), this API returns the captured bit time count value, captured with + * the start of a new frame. In all Bit Timing Analysis Modes (CFMOD = 10B), this API always returns the number of + * fCLC clock cycles (measurement result) minus 1. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE uint16_t XMC_CAN_NODE_GetCANFrameCounter(XMC_CAN_NODE_t *const can_node) +{ + return (uint16_t)(((uint32_t)(can_node->NFCR & CAN_NODE_NFCR_CFC_Msk) >> CAN_NODE_NFCR_CFC_Pos)); +} + + /*MO APIs*/ + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return XMC_CAN_STATUS_t CAN Node status. Refer @ref XMC_CAN_STATUS_t structure for details. + * + * @return None + * + * \parDescription:
+ * Configures Data to be transmitted and data length code. + * + * \parRelated API's:
+ * XMC_CAN_MO_Config()\n\n\n + * + */ + + +XMC_CAN_STATUS_t XMC_CAN_MO_UpdateData(const XMC_CAN_MO_t *const can_mo); + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return XMC_CAN_STATUS_t CAN Node status. Refer @ref XMC_CAN_STATUS_t structure for details. + * + * \parDescription:
+ * Configures transmit request for sending data frame. It configures MOCTR register. Data shall be updated + * using XMC_CAN_MO_UpdateData() before calling this API. + * + * \parRelated API's:
+ * XMC_CAN_MO_UpdateData()\n\n\n + * + */ + +XMC_CAN_STATUS_t XMC_CAN_MO_Transmit(const XMC_CAN_MO_t *const can_mo); + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return XMC_CAN_STATUS_t CAN Node status. Refer @ref XMC_CAN_STATUS_t structure for details. + * + * \parDescription:
+ * Reads the Message Object data bytes, into message pointer passed as input parameter \a can_mo. + * can_data[0] of can_mo holds lower 4 bytes, can_data[1] of can_mo holds higher 4 bytes. + * + * \parRelated API's:
+ * None + * + */ + +XMC_CAN_STATUS_t XMC_CAN_MO_Receive(XMC_CAN_MO_t *can_mo); + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return XMC_CAN_STATUS_t CAN Node status. Refer @ref XMC_CAN_STATUS_t structure for details. + * + * \parDescription:
+ * Reads the Message Object data bytes, into message pointer passed as input parameter \a can_mo. + * can_data[0] of can_mo holds lower 4 bytes, can_data[1] of can_mo holds higher 4 bytes. + * + * \parRelated API's:
+ * None + * + */ +XMC_CAN_STATUS_t XMC_CAN_MO_ReceiveData (XMC_CAN_MO_t *can_mo); +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param can_mo_ptr_int Message Object event node pointer selection. Refer @ref XMC_CAN_MO_POINTER_EVENT_t structure + * for valid values. + * @param service_request interrupt output line of multiCAN module. + * + * @return None + * + * \parDescription:
+ * Configures Message Object event node pointer with \a service_request number. It configures MOIPR register. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_MO_SetEventNodePointer(const XMC_CAN_MO_t *const can_mo, + const XMC_CAN_MO_POINTER_EVENT_t can_mo_ptr_int, + const uint32_t service_request) +{ + can_mo->can_mo_ptr->MOIPR = ((can_mo->can_mo_ptr->MOIPR ) & ~(uint32_t)((uint32_t)CAN_MO_MOIPR_Msk << (uint32_t)can_mo_ptr_int)) | + (service_request << (uint32_t)can_mo_ptr_int); +} + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return uint32_t Current Message Object status. + * + * \parDescription:
+ * Returns Message Object status, that indicates message object transfer status and message object list status + * information such as the number of the current message object predecessor and successor message object, as well as + * the list number to which the message object is assigned. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE uint32_t XMC_CAN_MO_GetStatus(const XMC_CAN_MO_t *const can_mo) +{ + return ((can_mo->can_mo_ptr->MOSTAT)); +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param mask Message Object set status selection. Refer @ref XMC_CAN_MO_SET_STATUS_t for details. + * Multiple enums can be ORed. + * @return None + * + * \parDescription:
+ * Configures Message Object set Status. It configures MOCTR register. + * + * \parRelated API's:
+ * XMC_CAN_MO_ResetStatus()\n\n\n + * + */ + +__STATIC_INLINE void XMC_CAN_MO_SetStatus(const XMC_CAN_MO_t *const can_mo, const uint32_t mask) +{ + can_mo->can_mo_ptr->MOCTR = mask; +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param mask Message Object set status selection. Refer @ref XMC_CAN_MO_RESET_STATUS_t for details. + * Multiple enums can be ORed. + * @return None + * + * \parDescription:
+ * Clears Message Object interrupt events. It configures MOCTR register. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_MO_ResetStatus(const XMC_CAN_MO_t *const can_mo,const uint32_t mask) +{ + can_mo->can_mo_ptr->MOCTR = mask; +} + + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param event CAN node Message Object event selection. Refer @ref XMC_CAN_MO_EVENT_t for details. + * + * @return None + * + * \parDescription:
+ * Enable CAN Message Object events. \a event can be ORed multiple Message Object events. It configures MOFCR register. + * + * \parRelated API's:
+ * XMC_CAN_MO_DisableEvent() + * + */ + +__STATIC_INLINE void XMC_CAN_MO_EnableEvent(const XMC_CAN_MO_t *const can_mo, + const uint32_t event) +{ + can_mo->can_mo_ptr->MOFCR |= event; +} + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param event CAN node Message Object event selection. Refer @ref XMC_CAN_MO_EVENT_t for details. + * + * @return None + * + * \parDescription:
+ * Disable CAN Message Object events. \a event can be ORed multiple Message Object events. It configures MOFCR register. + * + * \parRelated API's:
+ * XMC_CAN_MO_EnableEvent() + * + * + */ + +__STATIC_INLINE void XMC_CAN_MO_DisableEvent(const XMC_CAN_MO_t *const can_mo, + const uint32_t event) +{ + can_mo->can_mo_ptr->MOFCR &= ~event; +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Enable the single transmit trial(STT). In STT,TXRQ is cleared on transmission start of message object n. Thus, + * no transmission retry is performed in case of transmission failure. It configures MOFCR.STT bit. + * + * \parRelated API's:
+ * XMC_CAN_MO_DisableSingleTransmitTrial() + * + */ + +__STATIC_INLINE void XMC_CAN_MO_EnableSingleTransmitTrial(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR |= (uint32_t) CAN_MO_MOFCR_STT_Msk; +} + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Disable the single transmit trial(STT). In STT,TXRQ is cleared on transmission start of message object n. Thus, + * no transmission retry is performed in case of transmission failure. It configures MOFCR.STT bit. + * + * \parRelated API's:
+ * XMC_CAN_MO_EnableSingleTransmitTrial() + * + */ + +__STATIC_INLINE void XMC_CAN_MO_DisableSingleTransmitTrial(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR &= ~(uint32_t)CAN_MO_MOFCR_STT_Msk; +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param data_length_code transfer data length. Range:0-8 + * + * @return None + * + * \parDescription:
+ * Configures CAN Message Object Data Length Code. It configures MOFCR register. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_MO_DataLengthCode(const XMC_CAN_MO_t *const can_mo,const uint8_t data_length_code) +{ + can_mo->can_mo_ptr->MOFCR = ((can_mo->can_mo_ptr->MOFCR ) & ~(uint32_t)(CAN_MO_MOFCR_DLC_Msk)) | + (((uint32_t)data_length_code << CAN_MO_MOFCR_DLC_Pos) & (uint32_t)CAN_MO_MOFCR_DLC_Msk); +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param data_length_code transfer data length. Range:0-8 + * + * @return None + * + * \parDescription:
+ * Configures CAN Message Object Data Length Code. It configures MOFCR register. + * + * \parRelated API's:
+ * XMC_CAN_MO_GetDataLengthCode() + * + */ + +__STATIC_INLINE void XMC_CAN_MO_SetDataLengthCode(XMC_CAN_MO_t *const can_mo,const uint8_t data_length_code) +{ + can_mo->can_data_length = data_length_code; + can_mo->can_mo_ptr->MOFCR = ((can_mo->can_mo_ptr->MOFCR ) & ~(uint32_t)(CAN_MO_MOFCR_DLC_Msk)) | + (((uint32_t)data_length_code << CAN_MO_MOFCR_DLC_Pos) & (uint32_t)CAN_MO_MOFCR_DLC_Msk); +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return Data length code + * + * \parDescription:
+ * Gets the Data Length Code. + * + * \parRelated API's:
+ * XMC_CAN_MO_SetDataLengthCode() + * + */ + +__STATIC_INLINE uint8_t XMC_CAN_MO_GetDataLengthCode(const XMC_CAN_MO_t *const can_mo) +{ + return (((can_mo->can_mo_ptr->MOFCR) & (uint32_t)(CAN_MO_MOFCR_DLC_Msk)) >> CAN_MO_MOFCR_DLC_Pos); +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param can_identifier Identifier. + * + * @return None + * + * \parDescription:
+ * Configures CAN Message Object Identifier. It configures MOAR register. + * + * \parRelated API's:
+ * XMC_CAN_MO_GetIdentifier() + * + */ + +void XMC_CAN_MO_SetIdentifier(XMC_CAN_MO_t *const can_mo, const uint32_t can_identifier); + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return CAN MO identifier + * + * \parDescription:
+ * Gets the Identifier of the MO + * + * \parRelated API's:
+ * XMC_CAN_MO_SetIdentifier() + * + */ + +uint32_t XMC_CAN_MO_GetIdentifier(const XMC_CAN_MO_t *const can_mo); + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return Acceptance mask + * + * \parDescription:
+ * Gets the acceptance mask for the CAN MO. + * + * \parRelated API's:
+ * XMC_CAN_MO_SetAcceptanceMask() + * + */ + +uint32_t XMC_CAN_MO_GetAcceptanceMask(const XMC_CAN_MO_t *const can_mo); + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param can_id_mask CAN MO acceptance mask. + * + * @return None + * + * \parDescription:
+ * Sets the acceptance mask of the MO + * + * \parRelated API's:
+ * XMC_CAN_MO_GetAcceptanceMask() + * + */ + +void XMC_CAN_MO_SetAcceptanceMask(XMC_CAN_MO_t *const can_mo,const uint32_t can_id_mask); + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Message object receives frames only with matching IDE bit. + * + * \parRelated API's:
+ * XMC_CAN_MO_AcceptStandardAndExtendedID() + * + */ + +__STATIC_INLINE void XMC_CAN_MO_AcceptOnlyMatchingIDE(XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_ide_mask = 1U; + can_mo->can_mo_ptr->MOAMR |=(uint32_t)(CAN_MO_MOAMR_MIDE_Msk); +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Message object accepts the reception of both, standard and extended frames. + * + * \parRelated API's:
+ * XMC_CAN_MO_AcceptOnlyMatchingIDE() + * + */ + +__STATIC_INLINE void XMC_CAN_MO_AcceptStandardAndExtendedID(XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_ide_mask = 0U; + can_mo->can_mo_ptr->MOAMR &= ~(uint32_t)(CAN_MO_MOAMR_MIDE_Msk); +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Message object handles standard frames with 11-bit identifier. + * + * \parRelated API's:
+ * XMC_CAN_MO_SetExtendedID() + * + * \parNote:
+ * After setting the identifier type user has to set the identifier value by using @ref XMC_CAN_MO_SetIdentifier() API. + */ + +__STATIC_INLINE void XMC_CAN_MO_SetStandardID(XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_id_mode = (uint32_t)XMC_CAN_FRAME_TYPE_STANDARD_11BITS; + can_mo->can_mo_ptr->MOAR &= ~(uint32_t)(CAN_MO_MOAR_IDE_Msk); +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Message object handles extended frames with 29-bit identifier. + * + * \parRelated API's:
+ * XMC_CAN_MO_SetStandardID() + * + * \parNote:
+ * After setting the identifier type user has to set the identifier value by using @ref XMC_CAN_MO_SetIdentifier() API. + * + */ + +__STATIC_INLINE void XMC_CAN_MO_SetExtendedID(XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_id_mode = (uint32_t)XMC_CAN_FRAME_TYPE_EXTENDED_29BITS; + can_mo->can_mo_ptr->MOAR |= (uint32_t)CAN_MO_MOAR_IDE_Msk; +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configuration allows to enable the FIFO Foreign Remote Request. This Specifies TXRQ of the message object referenced + * by the pointer CUR is set on reception of a matching Remote Frame. It configures MOFCR.FRREN register. + * + * \parRelated API's:
+ * XMC_CAN_FIFO_DisableForeingRemoteRequest()\n\n\n + * + */ + +__STATIC_INLINE void XMC_CAN_FIFO_EnableForeignRemoteRequest(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR |= (uint32_t)CAN_MO_MOFCR_FRREN_Msk; +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configuration allows to disable the FIFO Foreign Remote Request. TXRQ of message object n is set on reception + * of a matching Remote Frame. It configures MOFCR.FRREN register. + * + * \parRelated API's:
+ * XMC_CAN_FIFO_EnableForeignRemoteRequest()\n\n\n + * + */ + +__STATIC_INLINE void XMC_CAN_FIFO_DisableForeingRemoteRequest(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR &= ~(uint32_t)CAN_MO_MOFCR_FRREN_Msk; +} + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configuration allows to enable the FIFO Remote Monitoring. This Specifies identifier, IDE(Identifier Extension) bit, + * and DLC of a matching Remote Frame are copied to transmit object n in order to monitor incoming Remote Frames. + * It configures MOFCR.RMM bit. + * + * \parRelated API's:
+ * XMC_CAN_FIFO_DisableRemoteMonitoring()\n\n\n + * + * \parNote:
+ * Remote monitoring(RMM) applies only to transmit objects and has no effect on receive objects. + * + */ +__STATIC_INLINE void XMC_CAN_FIFO_EnableRemoteMonitoring(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR |= (uint32_t)CAN_MO_MOFCR_RMM_Msk; +} + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configuration allows to disable the FIFO Remote Monitoring. This Specifies Identifier, Identifier Extension bit, + * and DLC of message object n remain unchanged upon the reception of a matching Remote Frame. + * It configures MOFCR.RMM bit. + * + * \parRelated API's:
+ * XMC_CAN_FIFO_EnableRemoteMonitoring()\n\n\n + * + * \parNote:
+ * Remote monitoring(RMM) applies only to transmit objects and has no effect on receive objects. + * + */ + +__STATIC_INLINE void XMC_CAN_FIFO_DisableRemoteMonitoring(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR &= ~(uint32_t)CAN_MO_MOFCR_RMM_Msk; +} + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param select_pointer Selected Message Object number. Range:0-63 + * + * @return None + * + * \parDescription:
+ * Set Object Select Pointer. If the current pointer CUR of FIFO base object becomes equal \a select_pointer, + * a FIFO overflow interrupt request is generated. Used for FIFO monitoring purpose. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_FIFO_SetSELMO(const XMC_CAN_MO_t *const can_mo,const uint8_t select_pointer) +{ + can_mo->can_mo_ptr->MOFGPR = ((can_mo->can_mo_ptr->MOFGPR ) & ~(uint32_t)(CAN_MO_MOFGPR_SEL_Msk)) | + (((uint32_t)select_pointer << CAN_MO_MOFGPR_SEL_Pos) & (uint32_t)CAN_MO_MOFGPR_SEL_Msk); +} + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return uint8_t Current Message Object Number. Range:0-63 + * + * \parDescription:
+ * Returns the current FIFO Message Object,points to the actual target object within a FIFO/Gateway structure. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE uint8_t XMC_CAN_FIFO_GetCurrentMO(const XMC_CAN_MO_t *const can_mo) +{ + return (uint8_t)((uint32_t)(can_mo->can_mo_ptr->MOFGPR & CAN_MO_MOFGPR_CUR_Msk) >> CAN_MO_MOFGPR_CUR_Pos); +} + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configuration allows to enable the Single Data Transfer of the FIFO Message Object. If SDT = 1 and message object n + * is not a FIFO base object, then MSGVAL is reset when this object has taken part in a successful data transfer + * (receive or transmit). If SDT = 1 and message object n is a FIFO base object, then MSGVAL is reset when the pointer + * to the current object CUR reaches the value of SEL in the FIFO/Gateway Pointer Register. It configures MOFCR.SDT bit. + * + * \parRelated API's:
+ * XMC_CAN_FIFO_DisableSingleDataTransfer() + * + */ + +__STATIC_INLINE void XMC_CAN_FIFO_EnableSingleDataTransfer(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR |= (uint32_t)CAN_MO_MOFCR_SDT_Msk; +} + + +/** + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configuration allows to disable the Single Data Transfer of the FIFO Message Object, with this configuration bit + * MSGVAL is not affected. It configures MOFCR.SDT bit. + * + * \parRelated API's:
+ * XMC_CAN_FIFO_EnableSingleDataTransfer() + * + */ + +__STATIC_INLINE void XMC_CAN_FIFO_DisableSingleDataTransfer(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOFCR &= ~(uint32_t)CAN_MO_MOFCR_SDT_Msk; +} + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param can_fifo CAN FIFO configuration data structure. Refer @ref XMC_CAN_FIFO_CONFIG_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configures the transmit FIFO. A FIFO consists of one base object and n slave objects. Please refer + * reference manual \b Transmit FIFO for more info. + * + * \parRelated API's:
+ * None. + * + */ + +void XMC_CAN_TXFIFO_ConfigMOBaseObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_FIFO_CONFIG_t can_fifo); + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param can_fifo CAN FIFO configuration data structure. Refer @ref XMC_CAN_FIFO_CONFIG_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configures the base object of receive FIFO. + * + * \parRelated API's:
+ * None + */ + +void XMC_CAN_RXFIFO_ConfigMOBaseObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_FIFO_CONFIG_t can_fifo); + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param can_fifo CAN FIFO configuration data structure. Refer @ref XMC_CAN_FIFO_CONFIG_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configures the slave object of transmit FIFO. + * + * \parRelated API's:
+ * None + * + */ +void XMC_CAN_TXFIFO_ConfigMOSlaveObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_FIFO_CONFIG_t can_fifo); + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configures the slave Object of receive FIFO. It configures MOCTR.RESRXEN bit. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_RXFIFO_ConfigMOSlaveObject(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOCTR = (uint32_t)CAN_MO_MOCTR_RESRXEN_Msk; +} + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * @param can_gateway CAN gateway configuration data structure. Refer XMC_CAN_GATEWAY_CONFIG_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configures the Gateway source object. The Gateway Mode \a can_gateway makes it possible to establish an automatic + * information transfer between two independent CAN buses without CPU interaction. Please refer reference manual + * \b GatewayMode for more info. + * + * \parRelated API's:
+ * None + * + */ + +void XMC_CAN_GATEWAY_InitSourceObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_GATEWAY_CONFIG_t can_gateway); + + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return None + * + * \parDescription:
+ * Configures the Gateway destination object. The Gateway Mode \a can_gateway makes it possible to establish an automatic + * information transfer between two independent CAN buses without CPU interaction. Please refer reference manual + * \b GatewayMode for more info. + * + * \parRelated API's:
+ * None + * + */ + +__STATIC_INLINE void XMC_CAN_GATEWAY_InitDesObject(const XMC_CAN_MO_t *const can_mo) +{ + can_mo->can_mo_ptr->MOCTR = CAN_MO_MOCTR_RESRXEN_Msk | + CAN_MO_MOCTR_RESNEWDAT_Msk; +} + +/** + * + * @param can_mo Pointer to Message Object structure. Refer @ref XMC_CAN_MO_t data structure for details. + * + * @return XMC_CAN_STATUS_t CAN Node status. Refer @ref XMC_CAN_STATUS_t structure for details. + * + * \parDescription:
+ * To transmit Message Object from the FIFO. Prior to this CAN node Message Object FIFO structure shall be made using + * XMC_CAN_TXFIFO_ConfigMOBaseObject(), XMC_CAN_TXFIFO_ConfigMOSlaveObject(),XMC_CAN_RXFIFO_ConfigMOBaseObject() API's. + * Please refer reference manual \b MessageObject \b FIFOStructure for more info. + * + * + */ +XMC_CAN_STATUS_t XMC_CAN_TXFIFO_Transmit(const XMC_CAN_MO_t *const can_mo); + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(CAN) */ + +#endif /* XMC_CAN_H */ + + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_can_map.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_can_map.h new file mode 100644 index 00000000..a8bff4d6 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_can_map.h @@ -0,0 +1,629 @@ +/** + * @file xmc_can_map.h + * @date 2015-10-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-10-20: + * - Removed "const" in the MOs for avoiding compiler warnings + * + * 2015-09-15: + * - Initial version + * + * @endcond + * + */ + +#ifndef XMC_CAN_MAP_H +#define XMC_CAN_MAP_H + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN48) +#define CAN_NODE0_RXD_P0_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P0_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P0_14 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE0_RXD_P0_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE0_RXD_P2_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE0_RXD_P2_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE0_RXD_P1_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE0_RXD_P1_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#define CAN_NODE1_RXD_P0_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P0_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_10 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE1_RXD_P2_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE1_RXD_P1_2 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE1_RXD_P1_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#endif + +#if (UC_DEVICE == XMC1403) && (UC_PACKAGE == VQFN64) +#define CAN_NODE0_RXD_P0_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P0_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P0_14 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE0_RXD_P0_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE0_RXD_P2_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE0_RXD_P2_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE0_RXD_P1_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE0_RXD_P1_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#define CAN_NODE1_RXD_P0_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P0_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P4_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P4_9 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_P2_10 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE1_RXD_P2_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE1_RXD_P1_2 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE1_RXD_P1_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#endif + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN48) +#define CAN_NODE0_RXD_P0_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P0_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P0_14 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE0_RXD_P0_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE0_RXD_P2_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE0_RXD_P2_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE0_RXD_P1_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE0_RXD_P1_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#define CAN_NODE1_RXD_P0_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P0_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_10 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE1_RXD_P2_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE1_RXD_P1_2 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE1_RXD_P1_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#endif + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == VQFN64) +#define CAN_NODE0_RXD_P0_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P0_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P0_14 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE0_RXD_P0_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE0_RXD_P2_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE0_RXD_P2_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE0_RXD_P1_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE0_RXD_P1_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#define CAN_NODE1_RXD_P0_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P0_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P4_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P4_9 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_P2_10 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE1_RXD_P2_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE1_RXD_P1_2 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE1_RXD_P1_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#endif + +#if (UC_DEVICE == XMC1404) && (UC_PACKAGE == LQFP64) +#define CAN_NODE0_RXD_P0_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P0_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P0_14 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE0_RXD_P0_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE0_RXD_P2_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE0_RXD_P2_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE0_RXD_P1_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE0_RXD_P1_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#define CAN_NODE1_RXD_P0_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P0_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P4_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P4_9 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_P2_10 XMC_CAN_NODE_RECEIVE_INPUT_RXDCE +#define CAN_NODE1_RXD_P2_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE1_RXD_P1_2 XMC_CAN_NODE_RECEIVE_INPUT_RXDCG +#define CAN_NODE1_RXD_P1_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCH +#endif + +#if (UC_DEVICE == XMC4100) && (UC_PACKAGE == LQFP64) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + +#if (UC_DEVICE == XMC4100) && (UC_PACKAGE == LQFP64) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + +#if (UC_DEVICE == XMC4100) && (UC_PACKAGE == VQFN48) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + +#if (UC_DEVICE == XMC4108) && (UC_PACKAGE == LQFP64) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#endif + + +#if (UC_DEVICE == XMC4108) && (UC_PACKAGE == VQFN48) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#endif + + +#if (UC_DEVICE == XMC4200) && (UC_PACKAGE == LQFP64) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4200) && (UC_PACKAGE == VQFN48) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4400) && (UC_PACKAGE == LQFP100) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4400) && (UC_PACKAGE == LQFP64) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4402) && (UC_PACKAGE == LQFP100) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4402) && (UC_PACKAGE == LQFP64) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4500) && (UC_PACKAGE == BGA144) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P3_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P3_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE2_RXD_P1_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE2_RXD_P3_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE2_RXD_P4_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE2_RXD_CAN1INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4500) && (UC_PACKAGE == LQFP100) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE2_RXD_P1_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE2_RXD_CAN1INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4500) && (UC_PACKAGE == LQFP144) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P3_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P3_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE2_RXD_P1_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE2_RXD_P3_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE2_RXD_P4_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE2_RXD_CAN1INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + + +#if (UC_DEVICE == XMC4502) && (UC_PACKAGE == LQFP100) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE2_RXD_P1_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE2_RXD_CAN1INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + +#if (UC_DEVICE == XMC4800) && (UC_PACKAGE == LQFP144) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P3_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P3_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE2_RXD_P1_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE2_RXD_P3_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE2_RXD_P4_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE2_RXD_CAN1INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE3_RXD_P0_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE3_RXD_P6_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE4_RXD_P2_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE4_RXD_P14_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE5_RXD_P5_10 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE5_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#endif + +#if (UC_DEVICE == XMC4800) && (UC_PACKAGE == LQFP100) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P3_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE2_RXD_P1_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE2_RXD_CAN1INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE3_RXD_P0_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE3_RXD_P6_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE4_RXD_P2_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE4_RXD_P14_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE5_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#endif + +#if (UC_DEVICE == XMC4800) && (UC_PACKAGE == LFBGA196) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P3_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P3_11 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE2_RXD_P1_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE2_RXD_P3_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE2_RXD_P4_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE2_RXD_CAN1INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#define CAN_NODE3_RXD_P0_8 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE3_RXD_P6_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE3_RXD_P7_1 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE4_RXD_P2_15 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE4_RXD_P14_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE4_RXD_P7_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE5_RXD_P5_10 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE5_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE5_RXD_P8_0 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#endif + +#if (UC_DEVICE == XMC4300) && (UC_PACKAGE == LQFP100) +#define CAN_NODE0_RXD_P1_5 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE0_RXD_P14_3 XMC_CAN_NODE_RECEIVE_INPUT_RXDCB +#define CAN_NODE0_RXD_P3_12 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P2_6 XMC_CAN_NODE_RECEIVE_INPUT_RXDCA +#define CAN_NODE1_RXD_P1_13 XMC_CAN_NODE_RECEIVE_INPUT_RXDCC +#define CAN_NODE1_RXD_P1_4 XMC_CAN_NODE_RECEIVE_INPUT_RXDCD +#define CAN_NODE1_RXD_CAN0INS XMC_CAN_NODE_RECEIVE_INPUT_RXDCF +#endif + +#if (UC_SERIES == XMC47) || (UC_SERIES == XMC48) || (UC_SERIES == XMC43)|| (UC_SERIES == XMC14) +#define CAN_MO0 ((CAN_MO_TypeDef *)&(CAN_MO->MO[0])) +#define CAN_MO1 ((CAN_MO_TypeDef *)&(CAN_MO->MO[1])) +#define CAN_MO2 ((CAN_MO_TypeDef *)&(CAN_MO->MO[2])) +#define CAN_MO3 ((CAN_MO_TypeDef *)&(CAN_MO->MO[3])) +#define CAN_MO4 ((CAN_MO_TypeDef *)&(CAN_MO->MO[4])) +#define CAN_MO5 ((CAN_MO_TypeDef *)&(CAN_MO->MO[5])) +#define CAN_MO6 ((CAN_MO_TypeDef *)&(CAN_MO->MO[6])) +#define CAN_MO7 ((CAN_MO_TypeDef *)&(CAN_MO->MO[7])) +#define CAN_MO8 ((CAN_MO_TypeDef *)&(CAN_MO->MO[8])) +#define CAN_MO9 ((CAN_MO_TypeDef *)&(CAN_MO->MO[9])) +#define CAN_MO10 ((CAN_MO_TypeDef *)&(CAN_MO->MO[10])) +#define CAN_MO11 ((CAN_MO_TypeDef *)&(CAN_MO->MO[11])) +#define CAN_MO12 ((CAN_MO_TypeDef *)&(CAN_MO->MO[12])) +#define CAN_MO13 ((CAN_MO_TypeDef *)&(CAN_MO->MO[13])) +#define CAN_MO14 ((CAN_MO_TypeDef *)&(CAN_MO->MO[14])) +#define CAN_MO15 ((CAN_MO_TypeDef *)&(CAN_MO->MO[15])) +#define CAN_MO16 ((CAN_MO_TypeDef *)&(CAN_MO->MO[16])) +#define CAN_MO17 ((CAN_MO_TypeDef *)&(CAN_MO->MO[17])) +#define CAN_MO18 ((CAN_MO_TypeDef *)&(CAN_MO->MO[18])) +#define CAN_MO19 ((CAN_MO_TypeDef *)&(CAN_MO->MO[19])) +#define CAN_MO20 ((CAN_MO_TypeDef *)&(CAN_MO->MO[20])) +#define CAN_MO21 ((CAN_MO_TypeDef *)&(CAN_MO->MO[21])) +#define CAN_MO22 ((CAN_MO_TypeDef *)&(CAN_MO->MO[22])) +#define CAN_MO23 ((CAN_MO_TypeDef *)&(CAN_MO->MO[23])) +#define CAN_MO24 ((CAN_MO_TypeDef *)&(CAN_MO->MO[24])) +#define CAN_MO25 ((CAN_MO_TypeDef *)&(CAN_MO->MO[25])) +#define CAN_MO26 ((CAN_MO_TypeDef *)&(CAN_MO->MO[26])) +#define CAN_MO27 ((CAN_MO_TypeDef *)&(CAN_MO->MO[27])) +#define CAN_MO28 ((CAN_MO_TypeDef *)&(CAN_MO->MO[28])) +#define CAN_MO29 ((CAN_MO_TypeDef *)&(CAN_MO->MO[29])) +#define CAN_MO30 ((CAN_MO_TypeDef *)&(CAN_MO->MO[30])) +#define CAN_MO31 ((CAN_MO_TypeDef *)&(CAN_MO->MO[31])) +#endif + + +#if (UC_SERIES == XMC47) || (UC_SERIES == XMC48)|| (UC_SERIES == XMC43) +#define CAN_MO32 ((CAN_MO_TypeDef *)&(CAN_MO->MO[32])) +#define CAN_MO33 ((CAN_MO_TypeDef *)&(CAN_MO->MO[33])) +#define CAN_MO34 ((CAN_MO_TypeDef *)&(CAN_MO->MO[34])) +#define CAN_MO35 ((CAN_MO_TypeDef *)&(CAN_MO->MO[35])) +#define CAN_MO36 ((CAN_MO_TypeDef *)&(CAN_MO->MO[36])) +#define CAN_MO37 ((CAN_MO_TypeDef *)&(CAN_MO->MO[37])) +#define CAN_MO38 ((CAN_MO_TypeDef *)&(CAN_MO->MO[38])) +#define CAN_MO39 ((CAN_MO_TypeDef *)&(CAN_MO->MO[39])) +#define CAN_MO40 ((CAN_MO_TypeDef *)&(CAN_MO->MO[40])) +#define CAN_MO41 ((CAN_MO_TypeDef *)&(CAN_MO->MO[41])) +#define CAN_MO42 ((CAN_MO_TypeDef *)&(CAN_MO->MO[42])) +#define CAN_MO43 ((CAN_MO_TypeDef *)&(CAN_MO->MO[43])) +#define CAN_MO44 ((CAN_MO_TypeDef *)&(CAN_MO->MO[44])) +#define CAN_MO45 ((CAN_MO_TypeDef *)&(CAN_MO->MO[45])) +#define CAN_MO46 ((CAN_MO_TypeDef *)&(CAN_MO->MO[46])) +#define CAN_MO47 ((CAN_MO_TypeDef *)&(CAN_MO->MO[47])) +#define CAN_MO48 ((CAN_MO_TypeDef *)&(CAN_MO->MO[48])) +#define CAN_MO49 ((CAN_MO_TypeDef *)&(CAN_MO->MO[49])) +#define CAN_MO50 ((CAN_MO_TypeDef *)&(CAN_MO->MO[50])) +#define CAN_MO51 ((CAN_MO_TypeDef *)&(CAN_MO->MO[51])) +#define CAN_MO52 ((CAN_MO_TypeDef *)&(CAN_MO->MO[52])) +#define CAN_MO53 ((CAN_MO_TypeDef *)&(CAN_MO->MO[53])) +#define CAN_MO54 ((CAN_MO_TypeDef *)&(CAN_MO->MO[54])) +#define CAN_MO55 ((CAN_MO_TypeDef *)&(CAN_MO->MO[55])) +#define CAN_MO56 ((CAN_MO_TypeDef *)&(CAN_MO->MO[56])) +#define CAN_MO57 ((CAN_MO_TypeDef *)&(CAN_MO->MO[57])) +#define CAN_MO58 ((CAN_MO_TypeDef *)&(CAN_MO->MO[58])) +#define CAN_MO59 ((CAN_MO_TypeDef *)&(CAN_MO->MO[59])) +#define CAN_MO60 ((CAN_MO_TypeDef *)&(CAN_MO->MO[60])) +#define CAN_MO61 ((CAN_MO_TypeDef *)&(CAN_MO->MO[61])) +#define CAN_MO62 ((CAN_MO_TypeDef *)&(CAN_MO->MO[62])) +#define CAN_MO63 ((CAN_MO_TypeDef *)&(CAN_MO->MO[63])) +#if (UC_SERIES != XMC43) +#define CAN_MO64 ((CAN_MO_TypeDef *)&(CAN_MO->MO[64])) +#define CAN_MO65 ((CAN_MO_TypeDef *)&(CAN_MO->MO[65])) +#define CAN_MO66 ((CAN_MO_TypeDef *)&(CAN_MO->MO[66])) +#define CAN_MO67 ((CAN_MO_TypeDef *)&(CAN_MO->MO[67])) +#define CAN_MO68 ((CAN_MO_TypeDef *)&(CAN_MO->MO[68])) +#define CAN_MO69 ((CAN_MO_TypeDef *)&(CAN_MO->MO[69])) +#define CAN_MO70 ((CAN_MO_TypeDef *)&(CAN_MO->MO[70])) +#define CAN_MO71 ((CAN_MO_TypeDef *)&(CAN_MO->MO[71])) +#define CAN_MO72 ((CAN_MO_TypeDef *)&(CAN_MO->MO[72])) +#define CAN_MO73 ((CAN_MO_TypeDef *)&(CAN_MO->MO[73])) +#define CAN_MO74 ((CAN_MO_TypeDef *)&(CAN_MO->MO[74])) +#define CAN_MO75 ((CAN_MO_TypeDef *)&(CAN_MO->MO[75])) +#define CAN_MO76 ((CAN_MO_TypeDef *)&(CAN_MO->MO[76])) +#define CAN_MO77 ((CAN_MO_TypeDef *)&(CAN_MO->MO[77])) +#define CAN_MO78 ((CAN_MO_TypeDef *)&(CAN_MO->MO[78])) +#define CAN_MO79 ((CAN_MO_TypeDef *)&(CAN_MO->MO[79])) +#define CAN_MO80 ((CAN_MO_TypeDef *)&(CAN_MO->MO[80])) +#define CAN_MO81 ((CAN_MO_TypeDef *)&(CAN_MO->MO[81])) +#define CAN_MO82 ((CAN_MO_TypeDef *)&(CAN_MO->MO[82])) +#define CAN_MO83 ((CAN_MO_TypeDef *)&(CAN_MO->MO[83])) +#define CAN_MO84 ((CAN_MO_TypeDef *)&(CAN_MO->MO[84])) +#define CAN_MO85 ((CAN_MO_TypeDef *)&(CAN_MO->MO[85])) +#define CAN_MO86 ((CAN_MO_TypeDef *)&(CAN_MO->MO[86])) +#define CAN_MO87 ((CAN_MO_TypeDef *)&(CAN_MO->MO[87])) +#define CAN_MO88 ((CAN_MO_TypeDef *)&(CAN_MO->MO[88])) +#define CAN_MO89 ((CAN_MO_TypeDef *)&(CAN_MO->MO[89])) +#define CAN_MO90 ((CAN_MO_TypeDef *)&(CAN_MO->MO[90])) +#define CAN_MO91 ((CAN_MO_TypeDef *)&(CAN_MO->MO[91])) +#define CAN_MO92 ((CAN_MO_TypeDef *)&(CAN_MO->MO[92])) +#define CAN_MO93 ((CAN_MO_TypeDef *)&(CAN_MO->MO[93])) +#define CAN_MO94 ((CAN_MO_TypeDef *)&(CAN_MO->MO[94])) +#define CAN_MO95 ((CAN_MO_TypeDef *)&(CAN_MO->MO[95])) +#define CAN_MO96 ((CAN_MO_TypeDef *)&(CAN_MO->MO[96])) +#define CAN_MO97 ((CAN_MO_TypeDef *)&(CAN_MO->MO[97])) +#define CAN_MO98 ((CAN_MO_TypeDef *)&(CAN_MO->MO[98])) +#define CAN_MO99 ((CAN_MO_TypeDef *)&(CAN_MO->MO[99])) +#define CAN_MO100 ((CAN_MO_TypeDef *)&(CAN_MO->MO[100])) +#define CAN_MO101 ((CAN_MO_TypeDef *)&(CAN_MO->MO[101])) +#define CAN_MO102 ((CAN_MO_TypeDef *)&(CAN_MO->MO[102])) +#define CAN_MO103 ((CAN_MO_TypeDef *)&(CAN_MO->MO[103])) +#define CAN_MO104 ((CAN_MO_TypeDef *)&(CAN_MO->MO[104])) +#define CAN_MO105 ((CAN_MO_TypeDef *)&(CAN_MO->MO[105])) +#define CAN_MO106 ((CAN_MO_TypeDef *)&(CAN_MO->MO[106])) +#define CAN_MO107 ((CAN_MO_TypeDef *)&(CAN_MO->MO[107])) +#define CAN_MO108 ((CAN_MO_TypeDef *)&(CAN_MO->MO[108])) +#define CAN_MO109 ((CAN_MO_TypeDef *)&(CAN_MO->MO[109])) +#define CAN_MO110 ((CAN_MO_TypeDef *)&(CAN_MO->MO[110])) +#define CAN_MO111 ((CAN_MO_TypeDef *)&(CAN_MO->MO[111])) +#define CAN_MO112 ((CAN_MO_TypeDef *)&(CAN_MO->MO[112])) +#define CAN_MO113 ((CAN_MO_TypeDef *)&(CAN_MO->MO[113])) +#define CAN_MO114 ((CAN_MO_TypeDef *)&(CAN_MO->MO[114])) +#define CAN_MO115 ((CAN_MO_TypeDef *)&(CAN_MO->MO[115])) +#define CAN_MO116 ((CAN_MO_TypeDef *)&(CAN_MO->MO[116])) +#define CAN_MO117 ((CAN_MO_TypeDef *)&(CAN_MO->MO[117])) +#define CAN_MO118 ((CAN_MO_TypeDef *)&(CAN_MO->MO[118])) +#define CAN_MO119 ((CAN_MO_TypeDef *)&(CAN_MO->MO[119])) +#define CAN_MO120 ((CAN_MO_TypeDef *)&(CAN_MO->MO[120])) +#define CAN_MO121 ((CAN_MO_TypeDef *)&(CAN_MO->MO[121])) +#define CAN_MO122 ((CAN_MO_TypeDef *)&(CAN_MO->MO[122])) +#define CAN_MO123 ((CAN_MO_TypeDef *)&(CAN_MO->MO[123])) +#define CAN_MO124 ((CAN_MO_TypeDef *)&(CAN_MO->MO[124])) +#define CAN_MO125 ((CAN_MO_TypeDef *)&(CAN_MO->MO[125])) +#define CAN_MO126 ((CAN_MO_TypeDef *)&(CAN_MO->MO[126])) +#define CAN_MO127 ((CAN_MO_TypeDef *)&(CAN_MO->MO[127])) +#define CAN_MO128 ((CAN_MO_TypeDef *)&(CAN_MO->MO[128])) +#define CAN_MO129 ((CAN_MO_TypeDef *)&(CAN_MO->MO[129])) +#define CAN_MO130 ((CAN_MO_TypeDef *)&(CAN_MO->MO[130])) +#define CAN_MO131 ((CAN_MO_TypeDef *)&(CAN_MO->MO[131])) +#define CAN_MO132 ((CAN_MO_TypeDef *)&(CAN_MO->MO[132])) +#define CAN_MO133 ((CAN_MO_TypeDef *)&(CAN_MO->MO[133])) +#define CAN_MO134 ((CAN_MO_TypeDef *)&(CAN_MO->MO[134])) +#define CAN_MO135 ((CAN_MO_TypeDef *)&(CAN_MO->MO[135])) +#define CAN_MO136 ((CAN_MO_TypeDef *)&(CAN_MO->MO[136])) +#define CAN_MO137 ((CAN_MO_TypeDef *)&(CAN_MO->MO[137])) +#define CAN_MO138 ((CAN_MO_TypeDef *)&(CAN_MO->MO[138])) +#define CAN_MO139 ((CAN_MO_TypeDef *)&(CAN_MO->MO[139])) +#define CAN_MO140 ((CAN_MO_TypeDef *)&(CAN_MO->MO[140])) +#define CAN_MO141 ((CAN_MO_TypeDef *)&(CAN_MO->MO[141])) +#define CAN_MO142 ((CAN_MO_TypeDef *)&(CAN_MO->MO[142])) +#define CAN_MO143 ((CAN_MO_TypeDef *)&(CAN_MO->MO[143])) +#define CAN_MO144 ((CAN_MO_TypeDef *)&(CAN_MO->MO[144])) +#define CAN_MO145 ((CAN_MO_TypeDef *)&(CAN_MO->MO[145])) +#define CAN_MO146 ((CAN_MO_TypeDef *)&(CAN_MO->MO[146])) +#define CAN_MO147 ((CAN_MO_TypeDef *)&(CAN_MO->MO[147])) +#define CAN_MO148 ((CAN_MO_TypeDef *)&(CAN_MO->MO[148])) +#define CAN_MO149 ((CAN_MO_TypeDef *)&(CAN_MO->MO[149])) +#define CAN_MO150 ((CAN_MO_TypeDef *)&(CAN_MO->MO[150])) +#define CAN_MO151 ((CAN_MO_TypeDef *)&(CAN_MO->MO[151])) +#define CAN_MO152 ((CAN_MO_TypeDef *)&(CAN_MO->MO[152])) +#define CAN_MO153 ((CAN_MO_TypeDef *)&(CAN_MO->MO[153])) +#define CAN_MO154 ((CAN_MO_TypeDef *)&(CAN_MO->MO[154])) +#define CAN_MO155 ((CAN_MO_TypeDef *)&(CAN_MO->MO[155])) +#define CAN_MO156 ((CAN_MO_TypeDef *)&(CAN_MO->MO[156])) +#define CAN_MO157 ((CAN_MO_TypeDef *)&(CAN_MO->MO[157])) +#define CAN_MO158 ((CAN_MO_TypeDef *)&(CAN_MO->MO[158])) +#define CAN_MO159 ((CAN_MO_TypeDef *)&(CAN_MO->MO[159])) +#define CAN_MO160 ((CAN_MO_TypeDef *)&(CAN_MO->MO[160])) +#define CAN_MO161 ((CAN_MO_TypeDef *)&(CAN_MO->MO[161])) +#define CAN_MO162 ((CAN_MO_TypeDef *)&(CAN_MO->MO[162])) +#define CAN_MO163 ((CAN_MO_TypeDef *)&(CAN_MO->MO[163])) +#define CAN_MO164 ((CAN_MO_TypeDef *)&(CAN_MO->MO[164])) +#define CAN_MO165 ((CAN_MO_TypeDef *)&(CAN_MO->MO[165])) +#define CAN_MO166 ((CAN_MO_TypeDef *)&(CAN_MO->MO[166])) +#define CAN_MO167 ((CAN_MO_TypeDef *)&(CAN_MO->MO[167])) +#define CAN_MO168 ((CAN_MO_TypeDef *)&(CAN_MO->MO[168])) +#define CAN_MO169 ((CAN_MO_TypeDef *)&(CAN_MO->MO[169])) +#define CAN_MO170 ((CAN_MO_TypeDef *)&(CAN_MO->MO[170])) +#define CAN_MO171 ((CAN_MO_TypeDef *)&(CAN_MO->MO[171])) +#define CAN_MO172 ((CAN_MO_TypeDef *)&(CAN_MO->MO[172])) +#define CAN_MO173 ((CAN_MO_TypeDef *)&(CAN_MO->MO[173])) +#define CAN_MO174 ((CAN_MO_TypeDef *)&(CAN_MO->MO[174])) +#define CAN_MO175 ((CAN_MO_TypeDef *)&(CAN_MO->MO[175])) +#define CAN_MO176 ((CAN_MO_TypeDef *)&(CAN_MO->MO[176])) +#define CAN_MO177 ((CAN_MO_TypeDef *)&(CAN_MO->MO[177])) +#define CAN_MO178 ((CAN_MO_TypeDef *)&(CAN_MO->MO[178])) +#define CAN_MO179 ((CAN_MO_TypeDef *)&(CAN_MO->MO[179])) +#define CAN_MO180 ((CAN_MO_TypeDef *)&(CAN_MO->MO[180])) +#define CAN_MO181 ((CAN_MO_TypeDef *)&(CAN_MO->MO[181])) +#define CAN_MO182 ((CAN_MO_TypeDef *)&(CAN_MO->MO[182])) +#define CAN_MO183 ((CAN_MO_TypeDef *)&(CAN_MO->MO[183])) +#define CAN_MO184 ((CAN_MO_TypeDef *)&(CAN_MO->MO[184])) +#define CAN_MO185 ((CAN_MO_TypeDef *)&(CAN_MO->MO[185])) +#define CAN_MO186 ((CAN_MO_TypeDef *)&(CAN_MO->MO[186])) +#define CAN_MO187 ((CAN_MO_TypeDef *)&(CAN_MO->MO[187])) +#define CAN_MO188 ((CAN_MO_TypeDef *)&(CAN_MO->MO[188])) +#define CAN_MO189 ((CAN_MO_TypeDef *)&(CAN_MO->MO[189])) +#define CAN_MO190 ((CAN_MO_TypeDef *)&(CAN_MO->MO[190])) +#define CAN_MO191 ((CAN_MO_TypeDef *)&(CAN_MO->MO[191])) +#define CAN_MO192 ((CAN_MO_TypeDef *)&(CAN_MO->MO[192])) +#define CAN_MO193 ((CAN_MO_TypeDef *)&(CAN_MO->MO[193])) +#define CAN_MO194 ((CAN_MO_TypeDef *)&(CAN_MO->MO[194])) +#define CAN_MO195 ((CAN_MO_TypeDef *)&(CAN_MO->MO[195])) +#define CAN_MO196 ((CAN_MO_TypeDef *)&(CAN_MO->MO[196])) +#define CAN_MO197 ((CAN_MO_TypeDef *)&(CAN_MO->MO[197])) +#define CAN_MO198 ((CAN_MO_TypeDef *)&(CAN_MO->MO[198])) +#define CAN_MO199 ((CAN_MO_TypeDef *)&(CAN_MO->MO[199])) +#define CAN_MO200 ((CAN_MO_TypeDef *)&(CAN_MO->MO[200])) +#define CAN_MO201 ((CAN_MO_TypeDef *)&(CAN_MO->MO[201])) +#define CAN_MO202 ((CAN_MO_TypeDef *)&(CAN_MO->MO[202])) +#define CAN_MO203 ((CAN_MO_TypeDef *)&(CAN_MO->MO[203])) +#define CAN_MO204 ((CAN_MO_TypeDef *)&(CAN_MO->MO[204])) +#define CAN_MO205 ((CAN_MO_TypeDef *)&(CAN_MO->MO[205])) +#define CAN_MO206 ((CAN_MO_TypeDef *)&(CAN_MO->MO[206])) +#define CAN_MO207 ((CAN_MO_TypeDef *)&(CAN_MO->MO[207])) +#define CAN_MO208 ((CAN_MO_TypeDef *)&(CAN_MO->MO[208])) +#define CAN_MO209 ((CAN_MO_TypeDef *)&(CAN_MO->MO[209])) +#define CAN_MO210 ((CAN_MO_TypeDef *)&(CAN_MO->MO[210])) +#define CAN_MO211 ((CAN_MO_TypeDef *)&(CAN_MO->MO[211])) +#define CAN_MO212 ((CAN_MO_TypeDef *)&(CAN_MO->MO[212])) +#define CAN_MO213 ((CAN_MO_TypeDef *)&(CAN_MO->MO[213])) +#define CAN_MO214 ((CAN_MO_TypeDef *)&(CAN_MO->MO[214])) +#define CAN_MO215 ((CAN_MO_TypeDef *)&(CAN_MO->MO[215])) +#define CAN_MO216 ((CAN_MO_TypeDef *)&(CAN_MO->MO[216])) +#define CAN_MO217 ((CAN_MO_TypeDef *)&(CAN_MO->MO[217])) +#define CAN_MO218 ((CAN_MO_TypeDef *)&(CAN_MO->MO[218])) +#define CAN_MO219 ((CAN_MO_TypeDef *)&(CAN_MO->MO[219])) +#define CAN_MO220 ((CAN_MO_TypeDef *)&(CAN_MO->MO[220])) +#define CAN_MO221 ((CAN_MO_TypeDef *)&(CAN_MO->MO[221])) +#define CAN_MO222 ((CAN_MO_TypeDef *)&(CAN_MO->MO[222])) +#define CAN_MO223 ((CAN_MO_TypeDef *)&(CAN_MO->MO[223])) +#define CAN_MO224 ((CAN_MO_TypeDef *)&(CAN_MO->MO[224])) +#define CAN_MO225 ((CAN_MO_TypeDef *)&(CAN_MO->MO[225])) +#define CAN_MO226 ((CAN_MO_TypeDef *)&(CAN_MO->MO[226])) +#define CAN_MO227 ((CAN_MO_TypeDef *)&(CAN_MO->MO[227])) +#define CAN_MO228 ((CAN_MO_TypeDef *)&(CAN_MO->MO[228])) +#define CAN_MO229 ((CAN_MO_TypeDef *)&(CAN_MO->MO[229])) +#define CAN_MO230 ((CAN_MO_TypeDef *)&(CAN_MO->MO[230])) +#define CAN_MO231 ((CAN_MO_TypeDef *)&(CAN_MO->MO[231])) +#define CAN_MO232 ((CAN_MO_TypeDef *)&(CAN_MO->MO[232])) +#define CAN_MO233 ((CAN_MO_TypeDef *)&(CAN_MO->MO[233])) +#define CAN_MO234 ((CAN_MO_TypeDef *)&(CAN_MO->MO[234])) +#define CAN_MO235 ((CAN_MO_TypeDef *)&(CAN_MO->MO[235])) +#define CAN_MO236 ((CAN_MO_TypeDef *)&(CAN_MO->MO[236])) +#define CAN_MO237 ((CAN_MO_TypeDef *)&(CAN_MO->MO[237])) +#define CAN_MO238 ((CAN_MO_TypeDef *)&(CAN_MO->MO[238])) +#define CAN_MO239 ((CAN_MO_TypeDef *)&(CAN_MO->MO[239])) +#define CAN_MO240 ((CAN_MO_TypeDef *)&(CAN_MO->MO[240])) +#define CAN_MO241 ((CAN_MO_TypeDef *)&(CAN_MO->MO[241])) +#define CAN_MO242 ((CAN_MO_TypeDef *)&(CAN_MO->MO[242])) +#define CAN_MO243 ((CAN_MO_TypeDef *)&(CAN_MO->MO[243])) +#define CAN_MO244 ((CAN_MO_TypeDef *)&(CAN_MO->MO[244])) +#define CAN_MO245 ((CAN_MO_TypeDef *)&(CAN_MO->MO[245])) +#define CAN_MO246 ((CAN_MO_TypeDef *)&(CAN_MO->MO[246])) +#define CAN_MO247 ((CAN_MO_TypeDef *)&(CAN_MO->MO[247])) +#define CAN_MO248 ((CAN_MO_TypeDef *)&(CAN_MO->MO[248])) +#define CAN_MO249 ((CAN_MO_TypeDef *)&(CAN_MO->MO[249])) +#define CAN_MO250 ((CAN_MO_TypeDef *)&(CAN_MO->MO[250])) +#define CAN_MO251 ((CAN_MO_TypeDef *)&(CAN_MO->MO[251])) +#define CAN_MO252 ((CAN_MO_TypeDef *)&(CAN_MO->MO[252])) +#define CAN_MO253 ((CAN_MO_TypeDef *)&(CAN_MO->MO[253])) +#define CAN_MO254 ((CAN_MO_TypeDef *)&(CAN_MO->MO[254])) +#define CAN_MO255 ((CAN_MO_TypeDef *)&(CAN_MO->MO[255])) +#endif +#endif + +#endif /* XMC_CAN_MAP_H*/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_ccu4.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_ccu4.h new file mode 100644 index 00000000..5d5c02c8 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_ccu4.h @@ -0,0 +1,2386 @@ +/** + * @file xmc_ccu4.h + * @date 2016-05-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * - Documentation updates
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-07-22: + * - XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent() is updated to support XMC14 device.
+ * + * 2015-08-17: + * - XMC_CCU4_SLICE_PRESCALER_t enum is added to set the prescaler divider.
+ * - XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_t enum item names are updated according to the guidelines.
+ * - XMC_CCU4_EnableShadowTransfer() API is made as inline, to improve the speed.
+ * + * 2015-09-29: + * - In XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_t, two more enum items are added to support external count direction + * settings. + * + * 2015-10-07: + * - XMC_CCU4_SLICE_GetEvent() is made as inline. + * - XMC_CCU4_SLICE_MULTI_IRQ_ID_t is added to support the XMC_CCU4_SLICE_EnableMultipleEvents() and + * XMC_CCU4_SLICE_DisableMultipleEvents() APIs. + * - DOC updates for the newly added APIs. + * + * 2016-03-09: + * - Optimization of write only registers + * + * 2016-05-20: + * - Added XMC_CCU4_SLICE_StopClearTimer() + * - Changed implementation of XMC_CCU4_SLICE_StopTimer() and XMC_CCU4_SLICE_ClearTimer() to avoid RMW access + * + * @endcond + */ + +#ifndef XMC_CCU4_H +#define XMC_CCU4_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include "xmc_common.h" +#if defined(CCU40) + +#if UC_FAMILY == XMC1 + #include "xmc1_ccu4_map.h" +#endif + +#if UC_FAMILY == XMC4 + #include "xmc4_ccu4_map.h" +#endif + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup CCU4 + * @brief Capture Compare Unit 4 (CCU4) low level driver for XMC family of microcontrollers
+ * + * The CCU4 peripheral is a major component for systems that need general purpose timers for signal + * monitoring/conditioning and Pulse Width Modulation (PWM) signal generation. Power electronic control systems like + * switched mode power supplies or interruptible power supplies, can easily be implemented with the functions inside the + * CCU4 peripheral.\n + * Each CCU4 module is comprised of four identical 16 bit Capture/Compare Timer slices, CC4y (where y = [0..4]). Each + * timer slice can work in compare mode or in capture mode. + * + * APIs provided in this file cover the following functional blocks of CCU4:\n + * -- Timer configuration, Capture configuration, Function/Event configuration, Interrupt configuration\n + * \par Note: + * 1. SLICE (APIs prefixed with e.g. XMC_CCU4_SLICE_) + * 2. Module (APIs are not having any prefix e.g. XMC_CCU4_) + * + * \par Timer(Compare mode) configuration: + * This section of the LLD provides the configuration structure XMC_CCU4_SLICE_COMPARE_CONFIG_t and the initialization + * function XMC_CCU4_SLICE_CompareInit(). + * + * It can be used to: + * -# Start and Stop the timer. (XMC_CCU4_SLICE_StartTimer(), XMC_CCU4_SLICE_StopTimer()) + * -# Update the period, compare, Dither, Prescaler and Passive values. (XMC_CCU4_SLICE_SetTimerPeriodMatch(), + * XMC_CCU4_SLICE_SetTimerCompareMatch(), XMC_CCU4_SLICE_SetPrescaler(), XMC_CCU4_SLICE_SetDitherCompareValue(), + * XMC_CCU4_SLICE_SetPassiveLevel()) + * -# Enable the slices to support multichannel mode. (XMC_CCU4_SLICE_EnableMultiChannelMode()) + * + * \par Capture configuration: + * This section of the LLD provides the configuration structure XMC_CCU4_SLICE_CAPTURE_CONFIG_t and the initialization + * function XMC_CCU4_SLICE_CaptureInit(). + * + * It can be used to: + * -# Configure the capture functionality. (XMC_CCU4_SLICE_Capture0Config(), XMC_CCU4_SLICE_Capture1Config()) + * -# Read the captured values along with the status, which indicate the value is latest or not. + * (XMC_CCU4_SLICE_GetCaptureRegisterValue()) + * + * \par Function/Event configuration: + * This section of the LLD provides the configuration structure XMC_CCU4_SLICE_EVENT_CONFIG_t.\n + * + * It can be used to: + * -# Enable and Disable the events. (XMC_CCU4_SLICE_EnableEvent(), XMC_CCU4_SLICE_DisableEvent()) + * -# Configure to start and stop the timer on external events.(XMC_CCU4_SLICE_StartConfig(), XMC_CCU4_SLICE_StopConfig()) + * -# Modulation, external load and Gating of the timer output.(XMC_CCU4_SLICE_ModulationConfig(), + * XMC_CCU4_SLICE_LoadConfig(), XMC_CCU4_SLICE_GateConfig()) + * -# Control the count direction of the timer based on the external event. (XMC_CCU4_SLICE_DirectionConfig()) + * -# Count the external events.(XMC_CCU4_SLICE_CountConfig()) + * -# External Trap. Which can be used as protective feature.(XMC_CCU4_SLICE_EnableTrap(), XMC_CCU4_SLICE_DisableTrap(), + * XMC_CCU4_SLICE_TrapConfig()) + * + * \par Interrupt configuration: + * This section of the LLD provides the function to configure the interrupt node to each event (XMC_CCU4_SLICE_SetInterruptNode()) + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +/* Macro to check if the interrupt enum passed is valid */ +#define XMC_CCU4_SLICE_CHECK_INTERRUPT(interrupt) \ + ((interrupt == XMC_CCU4_SLICE_IRQ_ID_PERIOD_MATCH) || \ + (interrupt == XMC_CCU4_SLICE_IRQ_ID_ONE_MATCH) || \ + (interrupt == XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_UP) || \ + (interrupt == XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_DOWN)|| \ + (interrupt == XMC_CCU4_SLICE_IRQ_ID_EVENT0) || \ + (interrupt == XMC_CCU4_SLICE_IRQ_ID_EVENT1) || \ + (interrupt == XMC_CCU4_SLICE_IRQ_ID_EVENT2) || \ + (interrupt == XMC_CCU4_SLICE_IRQ_ID_TRAP)) + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/** + * Typedef for CCU4 Global data structure + */ +typedef CCU4_GLOBAL_TypeDef XMC_CCU4_MODULE_t; + +/** + * Typedef for CCU4 Slice data structure + */ +typedef CCU4_CC4_TypeDef XMC_CCU4_SLICE_t; + +/** + * Return Value of an API + */ +typedef enum XMC_CCU4_STATUS +{ + XMC_CCU4_STATUS_OK = 0U, /**< API fulfils request */ + XMC_CCU4_STATUS_ERROR , /**< API cannot fulfil the request */ + XMC_CCU4_STATUS_RUNNING , /**< The timer slice is currently running */ + XMC_CCU4_STATUS_IDLE /**< The timer slice is currently idle */ +} XMC_CCU4_STATUS_t; + +/** + * CCU4 module clock + */ +typedef enum XMC_CCU4_CLOCK +{ + XMC_CCU4_CLOCK_SCU = 0U, /**< Select the fCCU as the clock */ + XMC_CCU4_CLOCK_EXTERNAL_A , /**< External clock-A */ + XMC_CCU4_CLOCK_EXTERNAL_B , /**< External clock-B */ + XMC_CCU4_CLOCK_EXTERNAL_C /**< External clock-C */ +} XMC_CCU4_CLOCK_t; + +/** + * CCU4 set the shadow transfer type for multichannel mode + */ +typedef enum XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER +{ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE0 = (uint32_t)0x4000000, /**< Shadow transfer through software + only for slice 0*/ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE0 = (uint32_t)0x4000400, /**< Shadow transfer through software + and hardware for slice 0 */ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE1 = (uint32_t)0x8000000, /**< Shadow transfer through software + only for slice 1*/ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE1 = (uint32_t)0x8000800, /**< Shadow transfer through software + and hardware for slice 1 */ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE2 = (uint32_t)0x10000000, /**< Shadow transfer through software + only for slice 2 */ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE2 = (uint32_t)0x10001000, /**< Shadow transfer through software + and hardware for slice 2 */ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE3 = (uint32_t)0x20000000, /**< Shadow transfer through software + only for slice 3*/ + XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE3 = (uint32_t)0x20002000 /**< Shadow transfer through software + and hardware for slice 3 */ +} XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_t; + +/** + * Operational modes of CCU4 slice + */ +typedef enum XMC_CCU4_SLICE_MODE +{ + XMC_CCU4_SLICE_MODE_COMPARE = 0U, /**< slice(CC4y) operates in Compare Mode */ + XMC_CCU4_SLICE_MODE_CAPTURE /**< slice(CC4y) operates in Capture Mode */ +} XMC_CCU4_SLICE_MODE_t; + +/** + * Timer counting modes for the slice + */ +typedef enum XMC_CCU4_SLICE_TIMER_COUNT_MODE +{ + XMC_CCU4_SLICE_TIMER_COUNT_MODE_EA = 0U, /**< Edge Aligned Mode */ + XMC_CCU4_SLICE_TIMER_COUNT_MODE_CA /**< Center Aligned Mode */ +} XMC_CCU4_SLICE_TIMER_COUNT_MODE_t; + +/** + * Timer repetition mode for the slice + */ +typedef enum XMC_CCU4_SLICE_TIMER_REPEAT_MODE +{ + XMC_CCU4_SLICE_TIMER_REPEAT_MODE_REPEAT = 0U, /**< Repetitive mode: continuous mode of operation */ + XMC_CCU4_SLICE_TIMER_REPEAT_MODE_SINGLE /**< Single shot mode: Once a Period match/One match + occurs timer goes to idle state */ +} XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t; + +/** + * Timer counting direction for the CCU4 slice + */ +typedef enum XMC_CCU4_SLICE_TIMER_COUNT_DIR +{ + XMC_CCU4_SLICE_TIMER_COUNT_DIR_UP = 0U, /**< Counting up */ + XMC_CCU4_SLICE_TIMER_COUNT_DIR_DOWN /**< Counting down */ +} XMC_CCU4_SLICE_TIMER_COUNT_DIR_t; + +/** + * Capture mode register sets + */ +typedef enum XMC_CCU4_SLICE_CAP_REG_SET +{ + XMC_CCU4_SLICE_CAP_REG_SET_LOW = 0U, /**< Capture register-0, Capture register-1 used */ + XMC_CCU4_SLICE_CAP_REG_SET_HIGH /**< Capture register-2, Capture register-3 used */ +} XMC_CCU4_SLICE_CAP_REG_SET_t; + +/** + * Prescaler mode + */ +typedef enum XMC_CCU4_SLICE_PRESCALER_MODE +{ + XMC_CCU4_SLICE_PRESCALER_MODE_NORMAL = 0U, /**< Fixed division of module clock */ + XMC_CCU4_SLICE_PRESCALER_MODE_FLOAT /**< Floating divider. */ +} XMC_CCU4_SLICE_PRESCALER_MODE_t; + +/** + * Timer output passive level + */ +typedef enum XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL +{ + XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_LOW = 0U, /**< Passive level = Low */ + XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_HIGH /**< Passive level = High */ +} XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_t; + +/** + * Timer clock Divider + */ +typedef enum XMC_CCU4_SLICE_PRESCALER +{ + XMC_CCU4_SLICE_PRESCALER_1 = 0U, /**< Slice Clock = fccu4 */ + XMC_CCU4_SLICE_PRESCALER_2 , /**< Slice Clock = fccu4/2 */ + XMC_CCU4_SLICE_PRESCALER_4 , /**< Slice Clock = fccu4/4 */ + XMC_CCU4_SLICE_PRESCALER_8 , /**< Slice Clock = fccu4/8 */ + XMC_CCU4_SLICE_PRESCALER_16 , /**< Slice Clock = fccu4/16 */ + XMC_CCU4_SLICE_PRESCALER_32 , /**< Slice Clock = fccu4/32 */ + XMC_CCU4_SLICE_PRESCALER_64 , /**< Slice Clock = fccu4/64 */ + XMC_CCU4_SLICE_PRESCALER_128 , /**< Slice Clock = fccu4/128 */ + XMC_CCU4_SLICE_PRESCALER_256 , /**< Slice Clock = fccu4/256 */ + XMC_CCU4_SLICE_PRESCALER_512 , /**< Slice Clock = fccu4/512 */ + XMC_CCU4_SLICE_PRESCALER_1024 , /**< Slice Clock = fccu4/1024 */ + XMC_CCU4_SLICE_PRESCALER_2048 , /**< Slice Clock = fccu4/2048 */ + XMC_CCU4_SLICE_PRESCALER_4096 , /**< Slice Clock = fccu4/4096 */ + XMC_CCU4_SLICE_PRESCALER_8192 , /**< Slice Clock = fccu4/8192 */ + XMC_CCU4_SLICE_PRESCALER_16384 , /**< Slice Clock = fccu4/16384 */ + XMC_CCU4_SLICE_PRESCALER_32768 /**< Slice Clock = fccu4/32768 */ +} XMC_CCU4_SLICE_PRESCALER_t; + +/** + * External Function list + */ +typedef enum XMC_CCU4_SLICE_FUNCTION +{ + XMC_CCU4_SLICE_FUNCTION_START = 0U, /**< Start function */ + XMC_CCU4_SLICE_FUNCTION_STOP , /**< Stop function */ + XMC_CCU4_SLICE_FUNCTION_CAPTURE_EVENT0 , /**< Capture Event-0 function, CCycapt0 signal is used for event + generation */ + XMC_CCU4_SLICE_FUNCTION_CAPTURE_EVENT1 , /**< Capture Event-1 function, CCycapt1 signal is used for event + generation */ + XMC_CCU4_SLICE_FUNCTION_GATING , /**< Gating function */ + XMC_CCU4_SLICE_FUNCTION_DIRECTION , /**< Direction function */ + XMC_CCU4_SLICE_FUNCTION_LOAD , /**< Load function */ + XMC_CCU4_SLICE_FUNCTION_COUNT , /**< Counting function */ + XMC_CCU4_SLICE_FUNCTION_OVERRIDE , /**< Override function */ + XMC_CCU4_SLICE_FUNCTION_MODULATION , /**< Modulation function */ + XMC_CCU4_SLICE_FUNCTION_TRAP /**< Trap function */ +} XMC_CCU4_SLICE_FUNCTION_t; + +/** + * External Event list + */ +typedef enum XMC_CCU4_SLICE_EVENT +{ + XMC_CCU4_SLICE_EVENT_NONE = 0U, /**< None */ + XMC_CCU4_SLICE_EVENT_0 , /**< Event-0 */ + XMC_CCU4_SLICE_EVENT_1 , /**< Event-1 */ + XMC_CCU4_SLICE_EVENT_2 /**< Event-2 */ +} XMC_CCU4_SLICE_EVENT_t; + +/** + * External Event trigger criteria - Edge sensitivity + */ +typedef enum XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY +{ + XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_NONE = 0U, /**< None */ + XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_RISING_EDGE , /**< Rising Edge of the input signal generates event trigger*/ + XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_FALLING_EDGE , /**< Falling Edge of the input signal generates event + trigger */ + XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_DUAL_EDGE /**< Both Rising and Falling edges cause an event trigger*/ +} XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_t; + +/** + * External Event trigger criteria - Level sensitivity + */ +typedef enum XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY +{ + XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH = 0U, /**< Level sensitive functions react to a high signal level*/ + XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW = 1U, /**< Level sensitive functions react to a low signal level*/ + /* Below enum items can be utilised specific to the functionality */ + XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_COUNT_UP_ON_LOW = 0U, /**< Timer counts up, during Low state of the control signal */ + XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_COUNT_UP_ON_HIGH = 1U /**< Timer counts up, during High state of the control signal */ +} XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_t; + +/** + * Low pass filter Configuration. The External Event input should be stable for a selected number of clock cycles. + */ +typedef enum XMC_CCU4_SLICE_EVENT_FILTER +{ + XMC_CCU4_SLICE_EVENT_FILTER_DISABLED = 0U, /**< No Low Pass Filter */ + XMC_CCU4_SLICE_EVENT_FILTER_3_CYCLES , /**< 3 clock cycles */ + XMC_CCU4_SLICE_EVENT_FILTER_5_CYCLES , /**< 5 clock cycles */ + XMC_CCU4_SLICE_EVENT_FILTER_7_CYCLES /**< 7 clock cycles */ +} XMC_CCU4_SLICE_EVENT_FILTER_t; + +/** + * External Event Input list. This list depicts the possible input connections to the CCU4 slice. + * Interconnects are specific to each device. + */ +typedef uint8_t XMC_CCU4_SLICE_INPUT_t; + +/** + * Actions that can be performed upon detection of an external Timer STOP event + */ +typedef enum XMC_CCU4_SLICE_END_MODE +{ + XMC_CCU4_SLICE_END_MODE_TIMER_STOP = 0U, /**< Stops the timer, without clearing TIMER register */ + XMC_CCU4_SLICE_END_MODE_TIMER_CLEAR , /**< Without stopping timer, clears the TIMER register */ + XMC_CCU4_SLICE_END_MODE_TIMER_STOP_CLEAR /**< Stops the timer and clears the TIMER register */ +} XMC_CCU4_SLICE_END_MODE_t; + +/** + * Actions that can be performed upon detection of an external Timer START event + */ +typedef enum XMC_CCU4_SLICE_START_MODE +{ + XMC_CCU4_SLICE_START_MODE_TIMER_START = 0U, /**< Start the timer from the current count of TIMER register */ + XMC_CCU4_SLICE_START_MODE_TIMER_START_CLEAR /**< Clears the TIMER register and start the timer */ +} XMC_CCU4_SLICE_START_MODE_t; + +/** + * Modulation of timer output signals + */ +typedef enum XMC_CCU4_SLICE_MODULATION_MODE +{ + XMC_CCU4_SLICE_MODULATION_MODE_CLEAR_ST_OUT = 0U, /**< Clear ST and OUT signals */ + XMC_CCU4_SLICE_MODULATION_MODE_CLEAR_OUT /**< Clear only the OUT signal */ +} XMC_CCU4_SLICE_MODULATION_MODE_t; + +/** + * Trap exit mode + */ +typedef enum XMC_CCU4_SLICE_TRAP_EXIT_MODE +{ + XMC_CCU4_SLICE_TRAP_EXIT_MODE_AUTOMATIC = 0U, /**< Clear trap state as soon as the trap signal is de-asserted */ + XMC_CCU4_SLICE_TRAP_EXIT_MODE_SW /**< Clear only when acknowledged by software */ +} XMC_CCU4_SLICE_TRAP_EXIT_MODE_t; + +/** + * Timer clear on capture + */ +typedef enum XMC_CCU4_SLICE_TIMER_CLEAR_MODE +{ + XMC_CCU4_SLICE_TIMER_CLEAR_MODE_NEVER = 0U, /**< Never clear the timer on any capture event */ + XMC_CCU4_SLICE_TIMER_CLEAR_MODE_CAP_HIGH , /**< Clear only when timer value has been captured in C3V and C2V */ + XMC_CCU4_SLICE_TIMER_CLEAR_MODE_CAP_LOW , /**< Clear only when timer value has been captured in C1V and C0V */ + XMC_CCU4_SLICE_TIMER_CLEAR_MODE_ALWAYS /**< Always clear the timer upon detection of any capture event */ +} XMC_CCU4_SLICE_TIMER_CLEAR_MODE_t; + +/** + * Multi Channel Shadow transfer request configuration options + */ +typedef enum XMC_CCU4_SLICE_MCMS_ACTION +{ + XMC_CCU4_SLICE_MCMS_ACTION_TRANSFER_PR_CR = 0U, /**< Transfer Compare and Period Shadow register values to + the actual registers upon MCS xfer request */ + XMC_CCU4_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP = 1U, /**< Transfer Compare, Period and Prescaler Compare Shadow + register values to the actual registers upon MCS xfer + request */ + XMC_CCU4_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP_DIT = 3U /**< Transfer Compare, Period ,Prescaler Compare and Dither + Compare register values to the actual registers upon + MCS xfer request */ +} XMC_CCU4_SLICE_MCMS_ACTION_t; + +/** + * Available Interrupt Event Ids + */ +typedef enum XMC_CCU4_SLICE_IRQ_ID +{ + XMC_CCU4_SLICE_IRQ_ID_PERIOD_MATCH = 0U , /**< Period match counting up */ + XMC_CCU4_SLICE_IRQ_ID_ONE_MATCH = 1U , /**< Period match -> One match counting down */ + XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_UP = 2U , /**< Compare match counting up */ + XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_DOWN = 3U , /**< Compare match counting down */ + XMC_CCU4_SLICE_IRQ_ID_EVENT0 = 8U , /**< Event-0 occurrence */ + XMC_CCU4_SLICE_IRQ_ID_EVENT1 = 9U , /**< Event-1 occurrence */ + XMC_CCU4_SLICE_IRQ_ID_EVENT2 = 10U, /**< Event-2 occurrence */ + XMC_CCU4_SLICE_IRQ_ID_TRAP = 11U /**< Trap occurrence */ +} XMC_CCU4_SLICE_IRQ_ID_t; + +/** + * Available Interrupt Event Ids, which is added to support multi event APIs + */ +typedef enum XMC_CCU4_SLICE_MULTI_IRQ_ID +{ + XMC_CCU4_SLICE_MULTI_IRQ_ID_PERIOD_MATCH = 0x1U, /**< Period match counting up */ + XMC_CCU4_SLICE_MULTI_IRQ_ID_ONE_MATCH = 0x2U, /**< Period match -> One match counting down */ + XMC_CCU4_SLICE_MULTI_IRQ_ID_COMPARE_MATCH_UP = 0x4U, /**< Compare match counting up */ + XMC_CCU4_SLICE_MULTI_IRQ_ID_COMPARE_MATCH_DOWN = 0x8U, /**< Compare match counting down */ + XMC_CCU4_SLICE_MULTI_IRQ_ID_EVENT0 = 0x100U, /**< Event-0 occurrence */ + XMC_CCU4_SLICE_MULTI_IRQ_ID_EVENT1 = 0x200U, /**< Event-1 occurrence */ + XMC_CCU4_SLICE_MULTI_IRQ_ID_EVENT2 = 0x400U, /**< Event-2 occurrence */ +} XMC_CCU4_SLICE_MULTI_IRQ_ID_t; + +/** + * Service Request Lines for CCU4. Event are mapped to these SR lines and these are used to generate the interrupt. + */ +typedef enum XMC_CCU4_SLICE_SR_ID +{ + XMC_CCU4_SLICE_SR_ID_0 = 0U, /**< Service Request Line-0 selected */ + XMC_CCU4_SLICE_SR_ID_1 , /**< Service Request Line-1 selected */ + XMC_CCU4_SLICE_SR_ID_2 , /**< Service Request Line-2 selected */ + XMC_CCU4_SLICE_SR_ID_3 /**< Service Request Line-3 selected */ +} XMC_CCU4_SLICE_SR_ID_t; + +/** + * Slice shadow transfer options. + */ +typedef enum XMC_CCU4_SHADOW_TRANSFER +{ + XMC_CCU4_SHADOW_TRANSFER_SLICE_0 = CCU4_GCSS_S0SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-0 */ + XMC_CCU4_SHADOW_TRANSFER_DITHER_SLICE_0 = CCU4_GCSS_S0DSE_Msk, /**< Transfer Dither compare shadow register value + to actual register for SLICE-0 */ + XMC_CCU4_SHADOW_TRANSFER_PRESCALER_SLICE_0 = CCU4_GCSS_S0PSE_Msk, /**< Transfer Prescaler shadow register value to + actual register for SLICE-0 */ + XMC_CCU4_SHADOW_TRANSFER_SLICE_1 = CCU4_GCSS_S1SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-1 */ + XMC_CCU4_SHADOW_TRANSFER_DITHER_SLICE_1 = CCU4_GCSS_S1DSE_Msk, /**< Transfer Dither compare shadow register value + to actual registers for SLICE-1 */ + XMC_CCU4_SHADOW_TRANSFER_PRESCALER_SLICE_1 = CCU4_GCSS_S1PSE_Msk, /**< Transfer Prescaler shadow register value to + actual register for SLICE-1 */ + XMC_CCU4_SHADOW_TRANSFER_SLICE_2 = CCU4_GCSS_S2SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-2 */ + XMC_CCU4_SHADOW_TRANSFER_DITHER_SLICE_2 = CCU4_GCSS_S2DSE_Msk, /**< Transfer Dither compare shadow register value + to actual register for SLICE-2 */ + XMC_CCU4_SHADOW_TRANSFER_PRESCALER_SLICE_2 = CCU4_GCSS_S2PSE_Msk, /**< Transfer Prescaler shadow register value to + actual register for SLICE-2 */ + XMC_CCU4_SHADOW_TRANSFER_SLICE_3 = CCU4_GCSS_S3SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-3 */ + XMC_CCU4_SHADOW_TRANSFER_DITHER_SLICE_3 = CCU4_GCSS_S3DSE_Msk, /**< Transfer Dither compare shadow register value + to actual register for SLICE-3 */ + XMC_CCU4_SHADOW_TRANSFER_PRESCALER_SLICE_3 = CCU4_GCSS_S3PSE_Msk /**< Transfer Prescaler shadow register value to + actual register for SLICE-3 */ +} XMC_CCU4_SHADOW_TRANSFER_t; + +#if defined(CCU4V3) || defined(DOXYGEN)/* Defined for XMC1400 devices only */ +/** + * Slice shadow transfer mode options. + * @note Only available for XMC1400 series + */ +typedef enum XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE +{ + XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_IN_PERIOD_MATCH_AND_ONE_MATCH = 0U, /**< Shadow transfer is done in Period Match and + One match. */ + XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_ONLY_IN_PERIOD_MATCH = 1U, /**< Shadow transfer is done only in Period Match. */ + XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_ONLY_IN_ONE_MATCH = 2U /**< Shadow transfer is done only in One Match. */ +} XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_t; + + +/** + * Immediate write into configuration register + * @note Only available for XMC1400 series + */ +typedef enum XMC_CCU4_SLICE_WRITE_INTO +{ + XMC_CCU4_SLICE_WRITE_INTO_PERIOD_CONFIGURATION = CCU4_CC4_STC_IRPC_Msk, /**< Immediate or Coherent + Write into Period + Configuration */ + XMC_CCU4_SLICE_WRITE_INTO_COMPARE_CONFIGURATION = CCU4_CC4_STC_IRCC_Msk, /**< Immediate or Coherent + Write into Compare + Configuration */ + XMC_CCU4_SLICE_WRITE_INTO_PASSIVE_LEVEL_CONFIGURATION = CCU4_CC4_STC_IRLC_Msk, /**< Immediate or Coherent + Write into Passive Level + Configuration */ + XMC_CCU4_SLICE_WRITE_INTO_DITHER_VALUE_CONFIGURATION = CCU4_CC4_STC_IRDC_Msk, /**< Immediate or Coherent + Write into Dither Value + Configuration */ + XMC_CCU4_SLICE_WRITE_INTO_FLOATING_PRESCALER_VALUE_CONFIGURATION = CCU4_CC4_STC_IRFC_Msk /**< Immediate or Coherent + Write into Floating Prescaler + Value Configuration */ +} XMC_CCU4_SLICE_WRITE_INTO_t; + + +/** + * Automatic Shadow Transfer request when writing into shadow register + * @note Only available for XMC1400 series + */ +typedef enum XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO +{ + XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_PERIOD_SHADOW = CCU4_CC4_STC_ASPC_Msk, /**< Automatic Shadow + Transfer request when + writing into Period + Shadow Register */ + XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_COMPARE_SHADOW = CCU4_CC4_STC_ASCC_Msk, /**< Automatic Shadow + transfer request + when writing into + Compare Shadow Register */ + XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_PASSIVE_LEVEL = CCU4_CC4_STC_ASLC_Msk, /**< Automatic Shadow transfer + request when writing + into Passive Level Register*/ + XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_DITHER_SHADOW = CCU4_CC4_STC_ASDC_Msk, /**< Automatic Shadow transfer + request when writing + into Dither Shadow Register */ + XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_FLOATING_PRESCALER_SHADOW = CCU4_CC4_STC_ASFC_Msk /**< Automatic Shadow transfer + request when writing + into Floating Prescaler Shadow + register */ + +} XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_t; +#endif +/** + * Used to create Mask needed for Multi-channel Shadow transfer enable/disable + */ +typedef enum XMC_CCU4_SLICE_MASK +{ + XMC_CCU4_SLICE_MASK_SLICE_0 = 1U , /**< SLICE-0 */ + XMC_CCU4_SLICE_MASK_SLICE_1 = 2U , /**< SLICE-1 */ + XMC_CCU4_SLICE_MASK_SLICE_2 = 4U , /**< SLICE-2 */ + XMC_CCU4_SLICE_MASK_SLICE_3 = 8U /**< SLICE-3 */ +} XMC_CCU4_SLICE_MASK_t; + + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/** + * Configuration data structure of an External Event(Event-0/1/2). + * Needed to configure the various aspects of an External Event. + * This structure will not connect the external event with an external function. + */ +typedef struct XMC_CCU4_SLICE_EVENT_CONFIG +{ + XMC_CCU4_SLICE_INPUT_t mapped_input; /**< Required input signal for the Event */ + XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_t edge; /**< Select the event edge of the input signal. + This is needed for an edge sensitive External function.*/ + XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_t level; /**< Select the event level of the input signal. + This is needed for an level sensitive External function.*/ + XMC_CCU4_SLICE_EVENT_FILTER_t duration; /**< Low Pass filter duration in terms of fCCU clock cycles */ +} XMC_CCU4_SLICE_EVENT_CONFIG_t; + +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * Configuration data structure for CCU4 slice. Specifically configures the CCU4 slice to compare mode operation. + * This excludes event and function configuration. + */ +typedef struct XMC_CCU4_SLICE_COMPARE_CONFIG +{ + union + { + struct + { + uint32_t timer_mode : 1; /**< Edge aligned or Centre Aligned. + Accepts enum ::XMC_CCU4_SLICE_TIMER_COUNT_MODE_t */ + uint32_t monoshot : 1; /**< Single shot or Continuous mode . + Accepts enum :: XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t*/ + uint32_t shadow_xfer_clear : 1; /**< Should PR and CR shadow xfer happen when timer is cleared? */ + uint32_t : 10; + uint32_t dither_timer_period: 1; /**< Can the period of the timer dither? */ + uint32_t dither_duty_cycle : 1; /**< Can the compare match of the timer dither? */ + uint32_t : 1; + uint32_t prescaler_mode: 1; /**< Normal or floating prescaler mode. + Accepts enum :: XMC_CCU4_SLICE_PRESCALER_MODE_t*/ + uint32_t : 8; + uint32_t mcm_enable : 1; /**< Multi-Channel mode enable? */ + uint32_t : 6; + }; + uint32_t tc; + }; + uint32_t prescaler_initval : 4; /**< Initial prescaler divider value + Accepts enum :: XMC_CCU4_SLICE_PRESCALER_t */ + uint32_t float_limit : 4; /**< The max value which the prescaler divider can increment to */ + uint32_t dither_limit : 4; /**< The value that determines the spreading of dithering */ + uint32_t passive_level : 1; /**< Configuration of ST and OUT passive levels. + Accepts enum :: XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_t*/ + uint32_t timer_concatenation : 1; /**< Enables the concatenation of the timer if true.*/ +} XMC_CCU4_SLICE_COMPARE_CONFIG_t; + +/** + * Configuration data structure for CCU4 slice. Specifically configures the CCU4 slice to capture mode operation. + * This excludes event and function configuration. + */ +typedef struct XMC_CCU4_SLICE_CAPTURE_CONFIG +{ + union + { + struct + { + uint32_t : 4; + uint32_t fifo_enable : 1; /**< Should the capture registers be setup as a FIFO?(Extended capture mode)*/ + uint32_t timer_clear_mode : 2; /**< How should the timer register be cleared upon detection of capture event? + Accepts enum ::XMC_CCU4_SLICE_TIMER_CLEAR_MODE_t*/ + uint32_t : 4; + uint32_t same_event : 1; /**< Should the capture event for C1V/C0V and C3V/C2V be same capture edge? */ + uint32_t ignore_full_flag : 1; /**< Should updates to capture registers follow full flag rules? */ + uint32_t : 3; + uint32_t prescaler_mode: 1; /**< Normal or floating prescaler Accepts enum :: XMC_CCU4_SLICE_PRESCALER_MODE_t*/ + uint32_t : 15; + }; + uint32_t tc; + }; + uint32_t prescaler_initval : 4; /**< Prescaler divider value */ + uint32_t float_limit : 4; /**< The max value which the prescaler divider can increment to */ + uint32_t timer_concatenation : 1; /**< Enables the concatenation of the timer */ +} XMC_CCU4_SLICE_CAPTURE_CONFIG_t; +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +__STATIC_INLINE bool XMC_CCU4_IsValidModule(const XMC_CCU4_MODULE_t *const module) +{ + bool tmp = false; + + tmp = (module == CCU40); + +#if defined(CCU41) + tmp = tmp || (module == CCU41); +#endif + +#if defined(CCU42) + tmp = tmp || (module == CCU42); +#endif + +#if defined(CCU43) + tmp = tmp || (module == CCU43); +#endif + + return tmp; +} + +__STATIC_INLINE bool XMC_CCU4_IsValidSlice(const XMC_CCU4_SLICE_t *const slice) +{ + bool tmp = false; + + tmp = (slice == CCU40_CC40); +#if defined(CCU40_CC41) + tmp = tmp || (slice == CCU40_CC41); +#endif +#if defined(CCU40_CC42) + tmp = tmp || (slice == CCU40_CC42); +#endif +#if defined(CCU40_CC43) + tmp = tmp || (slice == CCU40_CC43); +#endif +#if defined(CCU41) + tmp = tmp || (slice == CCU41_CC40); +#if defined(CCU41_CC41) + tmp = tmp || (slice == CCU41_CC41); +#endif +#if defined(CCU41_CC42) + tmp = tmp || (slice == CCU41_CC42); +#endif +#if defined(CCU41_CC43) + tmp = tmp || (slice == CCU41_CC43); +#endif +#endif +#if defined(CCU42) + tmp = tmp || (slice == CCU42_CC40); +#if defined(CCU42_CC41) + tmp = tmp || (slice == CCU42_CC41); +#endif +#if defined(CCU42_CC42) + tmp = tmp || (slice == CCU42_CC42); +#endif +#if defined(CCU42_CC43) + tmp = tmp || (slice == CCU42_CC43); +#endif +#endif +#if defined(CCU43) + tmp = tmp || (slice == CCU43_CC40); +#if defined(CCU43_CC41) + tmp = tmp || (slice == CCU43_CC41); +#endif +#if defined(CCU43_CC42) + tmp = tmp || (slice == CCU43_CC42); +#endif +#if defined(CCU43_CC43) + tmp = tmp || (slice == CCU43_CC43); +#endif +#endif + + return tmp; +} + +/** + * @param module Constant pointer to CCU4 module + * @param mcs_action multi-channel shadow transfer request configuration + * @return
+ * None
+ * + * \parDescription:
+ * Initialization of global register GCTRL.
\n + * As part of module initialization, behaviour of the module upon detection + * Multi-Channel Mode trigger is configured. Will also invoke the XMC_CCU4_EnableModule(). + * The API call would bring up the required CCU4 module and also initialize the module for + * the required multi-channel shadow transfer. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_CompareInit()
XMC_CCU4_SLICE_CaptureInit(). + */ +void XMC_CCU4_Init(XMC_CCU4_MODULE_t *const module, const XMC_CCU4_SLICE_MCMS_ACTION_t mcs_action); + +/** + * @param module Constant pointer to CCU4 module + * @param clock Choice of input clock to the module + * @return
+ * None
+ * + * \parDescription:
+ * Selects the Module Clock by configuring GCTRL.PCIS bits.
\n + * There are 3 potential clock sources. This API helps to select the required clock source. + * Call to this API is valid after the XMC_CCU4_Init(). + * + * \parRelated APIs:
+ * None.
+ */ +void XMC_CCU4_SetModuleClock(XMC_CCU4_MODULE_t *const module, const XMC_CCU4_CLOCK_t clock); + +/** + * @param module Constant pointer to CCU4 module + * @return
+ * None
+ * + * \parDescription:
+ * Enables the CCU4 module and brings it to active state.
\n + * Also disables the gating of the clock signal (if applicable depending on the device being selected). + * Invoke this API before any operations are done on the CCU4 module. Invoked from XMC_CCU4_Init(). + * + * \parRelated APIs:
+ * XMC_CCU4_SetModuleClock()
XMC_CCU4_DisableModule()
XMC_CCU4_StartPrescaler(). + */ +void XMC_CCU4_EnableModule(XMC_CCU4_MODULE_t *const module); + +/** + * @param module Constant pointer to CCU4 module + * @return
+ * None
+ * + * \parDescription:
+ * Brings the CCU4 module to reset state and enables gating of the clock signal(if applicable depending + * on the device being selected).
\n + * Invoke this API when a CCU4 module needs to be disabled completely. + * Any operation on the CCU4 module will have no effect after this API is called. + * + * \parRelated APIs:
+ * XMC_CCU4_EnableModule()
XMC_CCU4_DisableModule(). + */ +void XMC_CCU4_DisableModule(XMC_CCU4_MODULE_t *const module); + +/** + * @param module Constant pointer to CCU4 module + * @return
+ * None
+ * + * \parDescription:
+ * Starts the prescaler and restores clocks to the timer slices, by setting GIDLC.SPRB bit.
\n + * Once the input to the prescaler has been chosen and the prescaler divider of all slices programmed, + * the prescaler itself may be started. Invoke this API after XMC_CCU4_Init() + * (Mandatory to fully initialize the module).Directly accessed register is GIDLC. + * + * \parRelated APIs:
+ * XMC_CCU4_Init()
XMC_CCU4_EnableClock()
XMC_CCU4_DisableClock()
XMC_CCU4_StartPrescaler()
+ * XMC_CCU4_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU4_StartPrescaler(XMC_CCU4_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU4_StartPrescaler:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + module->GIDLC |= (uint32_t) CCU4_GIDLC_SPRB_Msk; +} + +/** + * @param module Constant pointer to CCU4 module + * @return
+ * None
+ * + * \parDescription:
+ * Stops the prescaler and blocks clocks to the timer slices, by setting GIDLS.CPRB bit.
\n + * Opposite of the StartPrescaler routine. + * Clears the run bit of the prescaler. Ensures that the module clock is not supplied to + * the slices of the module.Registers directly accessed is GIDLS. + * + * \parRelated APIs:
+ * XMC_CCU4_EnableClock()
XMC_CCU4_DisableClock()
XMC_CCU4_StartPrescaler()
XMC_CCU4_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU4_StopPrescaler(XMC_CCU4_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU4_StopPrescaler:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + module->GIDLS |= (uint32_t) CCU4_GIDLS_CPRB_Msk; +} + +/** + * @param module Constant pointer to CCU4 module + * @return
+ * None
+ * + * \parDescription:
+ * Returns the state of the prescaler, by reading GSTAT.PRB bit.
\n + * This will return true if the prescaler is running. If clock is being supplied to the slices of the + * module then returns as true. + * + * \parRelated APIs:
+ * XMC_CCU4_StartPrescaler()
XMC_CCU4_StopPrescaler()
XMC_CCU4_EnableClock()
XMC_CCU4_DisableClock(). + */ +__STATIC_INLINE bool XMC_CCU4_IsPrescalerRunning(XMC_CCU4_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU4_IsPrescalerRunning:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + return((bool)((module->GSTAT & (uint32_t) CCU4_GSTAT_PRB_Msk) == (uint32_t)CCU4_GSTAT_PRB_Msk)); +} + +/** + * @param module Constant pointer to CCU4 module + * @param clock_mask Slices whose clocks are to be enabled simultaneously. + * Bit location 0/1/2/3 represents slice-0/1/2/3 respectively. + * Range: [0x1 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Enables clocks of multiple slices at a time, by configuring GIDLC.CS0I, GIDLC.CS1I, GIDLC.CS2I, + * GIDLC.CS3I bits.\n\n + * Takes an input clock_mask, which determines the slices that would receive the clock. Bring them out + * of the idle state simultaneously. + * + * \parRelated APIs:
+ * XMC_CCU4_EnableClock()
XMC_CCU4_DisableClock(). + */ +__STATIC_INLINE void XMC_CCU4_EnableMultipleClocks(XMC_CCU4_MODULE_t *const module, const uint8_t clock_mask) +{ + XMC_ASSERT("XMC_CCU4_EnableMultipleClocks:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + XMC_ASSERT("XMC_CCU4_EnableMultipleClocks:Wrong clock mask", (clock_mask < 16U)); + + module->GIDLC |= (uint32_t) clock_mask; +} + +/** + * @param module Constant pointer to CCU4 module + * @param slice_number Slice for which the clock should be Enabled. + * Range: [0x0 to 0x3] + * @return
+ * None
+ * + * \parDescription:
+ * Enables the slice timer clock, by configuring GIDLC.CS0I, GIDLC.CS1I, GIDLC.CS2I, + * GIDLC.CS3I bits according to the selected \a slice_number.\n\n + * It is possible to enable/disable clock at slice level. This uses the \b slice_number to indicate the + * slice whose clock needs to be enabled. + * + * \parRelated APIs:
+ * XMC_CCU4_DisableClock()
XMC_CCU4_EnableMultipleClocks()
XMC_CCU4_StartPrescaler()
XMC_CCU4_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU4_EnableClock(XMC_CCU4_MODULE_t *const module, const uint8_t slice_number) +{ + XMC_ASSERT("XMC_CCU4_EnableClock:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + XMC_ASSERT("XMC_CCU4_EnableClock:Invalid Slice Number", (slice_number < 4U)); + + module->GIDLC |= ((uint32_t) 1) << slice_number; +} + +/** + * @param module Constant pointer to CCU4 module + * @param slice_number Slice for which the clock should be disabled. + * Range: [0x0 to 0x3] + * @return
+ * None
+ * + * \parDescription:
+ * Disables the slice timer clock, by configuring GIDLS.SS0I, GIDLS.SSS1I, GIDLS.SSS2I, + * GIDLS.SSS3I bits according to the selected \a slice_number .\n\n + * It is possible to disable clock at slice level using the module pointer. + * \b slice_number is used to disable the clock to a given slice of the module. + * Directly accessed Register is GIDLS. + * + * \parRelated APIs:
+ * XMC_CCU4_EnableClock()
XMC_CCU4_EnableMultipleClocks()
XMC_CCU4_StartPrescaler()
XMC_CCU4_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU4_DisableClock(XMC_CCU4_MODULE_t *const module, const uint8_t slice_number) +{ + XMC_ASSERT("XMC_CCU4_DisableClock:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + XMC_ASSERT("XMC_CCU4_DisableClock:Invalid Slice Number", (slice_number < 4U)); + + module->GIDLS |= ((uint32_t) 1) << slice_number; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param compare_init Pointer to slice configuration structure + * @return
+ * None
+ * + * \parDescription:
+ * Initialization of a CC4 slice to compare mode, by configuring CC4yTC, CC4yCMC, CC4yPSC, CC4yDITH, CC4yPSL, + * CC4yFPCS, CC4yCHC registers.\n\n + * CC4 slice is configured with Timer configurations in this routine. + * After initialization user has to explicitly enable the shadow transfer for the required values by calling + * XMC_CCU4_EnableShadowTransfer() with appropriate mask. + * + * \parRelated APIs:
+ * None. + */ +void XMC_CCU4_SLICE_CompareInit(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_COMPARE_CONFIG_t *const compare_init); + +/** + * @param slice Constant pointer to CC4 Slice + * @param capture_init Pointer to slice configuration structure + * @return
+ * None
+ * + * \parDescription:
+ * Initialization of a CC4 slice to capture mode, by configuring CC4yTC, CC4yCMC, CC4yPSC,CC4yFPCS registers.\n\n + * CC4 slice is configured with Capture configurations in this routine.After initialization user has to explicitly + * enable the shadow transfer for the required values by calling XMC_CCU4_EnableShadowTransfer() + * with appropriate mask. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_Capture0Config()
XMC_CCU4_SLICE_Capture1Config(). + */ +void XMC_CCU4_SLICE_CaptureInit(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_CAPTURE_CONFIG_t *const capture_init); + + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the External Start Function + * @param start_mode Behavior of slice when the start function is activated + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Start Function of the slice, by configuring CC4yCMC.ENDS and CC4yTC.ENDM bits.\n\n + * Start function is mapped with one of the 3 events. An external signal can control when a CC4 timer should start. + * Additionally, the behaviour of the slice upon activation of the start function is configured as well. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StopConfig()
XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_StartConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_START_MODE_t start_mode); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the External Stop Function + * @param end_mode Behavior of slice when the stop function is activated + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Stop function for the slice, by configuring CC4yCMC.STRTS and CC4yTC.STRM bits.\n\n + * Stop function is mapped with one of the 3 events. An external signal can control when a CCU4 timer should stop. + * Additionally, the behaviour of the slice upon activation of the stop function is configured as well. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartConfig()
XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_StopConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_END_MODE_t end_mode); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the External load Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Load Function for the slice, by configuring CC4yCMC.LDS bit.\n\n + * Load function is mapped with one of the 3 events. Up on occurrence of the event,\n + * if CC4yTCST.CDIR set to 0,CC4yTIMER register is reloaded with the value from compare register\n + * if CC4yTCST.CDIR set to 1,CC4yTIMER register is reloaded with the value from period register\n + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_LoadConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event); + + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the External Modulation Function + * @param mod_mode Desired Modulation mode + * @param synch_with_pwm Option to synchronize modulation with PWM start + * Pass \b true if the modulation needs to be synchronized with PWM signal. + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Output Modulation Function of the slice, by configuring CCeyCMC.MOS, CC4yTC.EMT and + * CC4yTC.EMS bits.\n\n + * Modulation function is mapped with one of the 3 events. The output signal of the CCU can + * be modulated according to a external input. Additionally, the behaviour of the slice upon activation + * of the modulation function is configured as well. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_ModulationConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_MODULATION_MODE_t mod_mode, + const bool synch_with_pwm); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the External Count Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Count Function of the slice, by configuring CC4yCMC.CNTS bit.\n\n + * Count function is mapped with one of the 3 events. CCU4 slice can take an external + * signal to act as the counting event. The CCU4 slice would count the + * edges present on the \b event selected. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_CountConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the External Gating Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Gating Function of the slice, by configuring CC4yCMC.GATES bit.\n\n + * Gating function is mapped with one of the 3 events. A CCU4 slice can use an input signal that would + * operate as counter gating. If the configured Active level is detected the counter will gate all the pulses. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_GateConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the Capture-0 Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Capture-0 Function of the slice, by configuring CC4yCMC.CAP0S bit.\n\n + * Capture function is mapped with one of the 3 events. A CCU4 slice can be configured into capture-0 mode + * with the selected \b event. In this mode the CCU4 will capture the timer value into CC4yC0V and CC4yC1V. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_Capture0Config(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the Capture-1 Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Capture-1 Function of the slice, by configuring CC4yCMC.CAP1S bit.\n\n + * Capture function is mapped with one of the 3 events. A CCU4 slice can be configured into capture-1 + * mode with the selected \b event. In this mode the CCU4 will capture the timer value into CC4yC2V and CC4yC3V. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_Capture1Config(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * bool would return true if the extended capture read back mode is enabled
+ * + * \parDescription:
+ * Checks if Extended capture mode read is enabled for particular slice or not, by reading CC4yTC.ECM bit.\n\n + * In this mode the there is only one associated read address for all the capture registers. + * Individual capture registers can still be accessed in this mode. + * + * \parRelated APIs:
+ * XMC_CCU4_GetCapturedValueFromFifo(). + */ +__STATIC_INLINE bool XMC_CCU4_SLICE_IsExtendedCapReadEnabled(const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_IsExtendedCapReadEnabled:Invalid Module Pointer", XMC_CCU4_IsValidSlice(slice)); + return((bool)((slice->TC & (uint32_t) CCU4_CC4_TC_ECM_Msk) == (uint32_t)CCU4_CC4_TC_ECM_Msk)); +} + +#if defined(CCU4V1) /* Defined for XMC4500, XMC4400, XMC4200, XMC4100 devices only */ +/** + * @param module Constant pointer to CCU4 module + * @param slice_number to check whether read value belongs to required slice or not + * @return
+ * int32_t Returns -1 if the FIFO value being retrieved is not from the \b slice_number. + * Returns the value captured in the \b slice_number, if captured value is from the correct slice. + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Read captured value from FIFO(ECRD register).\n\n + * This is applicable only in the Capture mode of operation. The signal whose timing characteristics are to be measured + * must be mapped to an event which in turn must be mapped to the capture function. Based on the capture criteria, the + * instant timer values are captured into capture registers. Timing characteristics of the input signal may then be + * derived/inferred from the captured values. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_IsExtendedCapReadEnabled(). + * @note Only available for XMC4500, XMC4400, XMC4200 and XMC4100 series + */ +int32_t XMC_CCU4_GetCapturedValueFromFifo(const XMC_CCU4_MODULE_t *const module, const uint8_t slice_number); +#else +/** + * @param slice Constant pointer to CC4 Slice + * @param set The capture register set from which the captured value is to be retrieved + * @return
+ * uint32_t Returns the value captured in the \b slice_number + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Read captured value from FIFO(CC4yECRD0 and CC4yECRD1).\n\n + * This is applicable only in the Capture mode of operation. The signal whose timing characteristics are to be measured + * must be mapped to an event which in turn must be mapped to the capture function. Based on the capture criteria, the + * instant timer values are captured into capture registers. Timing characteristics of the input signal may then be + * derived/inferred from the captured values. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_IsExtendedCapReadEnabled(). + * @note Defined for XMC4800, XMC4700, XMC4500, XMC4400, XMC4200, XMC4100 devices only. For other devices use XMC_CCU4_GetCapturedValueFromFifo() API + */ +uint32_t XMC_CCU4_SLICE_GetCapturedValueFromFifo(const XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_CAP_REG_SET_t set); +#endif + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Map an External event to the External Count Direction Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Count Direction of the slice, by configuring CC4yCMC.UDS bit.\n\n + * Count direction function is mapped with one of the 3 events. A slice can be configured to change the + * CC4yTIMER count direction depending on an external signal. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_DirectionConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Configures the status bit override Function of the slice, by configuring CC4yCMC.OFS bit.\n\n + * Status bit override function is mapped with one of the 3 events. A slice can be configured to change the + * output of the timer's CC4yST signal depending on an external signal. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent(). + */ +void XMC_CCU4_SLICE_StatusBitOverrideConfig(XMC_CCU4_SLICE_t *const slice); + +/** + * @param slice Constant pointer to CC4 Slice + * @param exit_mode How should a previously logged trap state be exited? + * @param synch_with_pwm Should exit of trap state be synchronized with PWM cycle start? + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Trap Function of the slice, by configuring CC4yCMC.TS, CC4yTC.TRPSE, and CC4yTC.TRPSW bits.\n\n + * Trap function is mapped with Event-2. Criteria for exiting the trap state is configured. + * This trap function allows PWM outputs to react on the state of an input pin. + * Thus PWM output can be forced to inactive state upon detection of a trap. + * It is also possible to synchronize the trap function with the PWM signal using the \b synch_with_pwm. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput(). + */ +void XMC_CCU4_SLICE_TrapConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_TRAP_EXIT_MODE_t exit_mode, + bool synch_with_pwm); + + +/** + * @param slice Constant pointer to CC4 Slice + * @param ev1_config Pointer to event 1 configuration data + * @param ev2_config Pointer to event 2 configuration data + * @return
+ * None
+ * + * + * \parDescription:
+ * Map Status bit override function with an Event1 & Event 2 of the slice and configure CC4yINS register.\n\n + * Details such as the input mapped to the event, event detection criteria and Low Pass filter options are programmed + * by this routine for the events 1 & 2. Event-1 input would be the trigger to override the value. + * Event-2 input would be the override value. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StatusBitOverrideConfig(). + */ +void XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_CONFIG_t *const ev1_config, + const XMC_CCU4_SLICE_EVENT_CONFIG_t *const ev2_config); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event The External Event which needs to be configured. + * @param config Pointer to event configuration data. + * @return
+ * None
+ * + * \parDescription:
+ * Configures an External Event of the slice, by updating CC4yINS register .\n\n + * Details such as the input mapped to the event, event detection criteria and low pass filter + * options are programmed by this routine. The Event \b config will configure the input selection, + * the edge selection, the level selection and the Low pass filter for the event. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartConfig()
XMC_CCU4_SLICE_StopConfig()
XMC_CCU4_SLICE_LoadConfig()
+ * XMC_CCU4_SLICE_ModulationConfig()
XMC_CCU4_SLICE_CountConfig()
XMC_CCU4_SLICE_GateConfig()
+ * XMC_CCU4_SLICE_Capture0Config()
XMC_CCU4_SLICE_Capture1Config()
XMC_CCU4_SLICE_DirectionConfig()
+ * XMC_CCU4_SLICE_StatusBitOverrideConfig()
XMC_CCU4_SLICE_TrapConfig(). + */ +void XMC_CCU4_SLICE_ConfigureEvent(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_EVENT_CONFIG_t *const config); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event The External Event which needs to be configured. + * @param input One of the 16 inputs meant to be mapped to the desired event + * @return
+ * None
+ * + * + * \parDescription:
+ * Selects an input for an external event, by configuring CC4yINS register.\n\n + * It is possible to select one of the possible 16 input signals for a given Event. + * This configures the CC4yINS.EVxIS for the selected event. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartConfig()
XMC_CCU4_SLICE_StopConfig()
XMC_CCU4_SLICE_LoadConfig()
+ * XMC_CCU4_SLICE_ModulationConfig()
XMC_CCU4_SLICE_CountConfig()
XMC_CCU4_SLICE_GateConfig()
+ * XMC_CCU4_SLICE_Capture0Config()
XMC_CCU4_SLICE_Capture1Config()
XMC_CCU4_SLICE_DirectionConfig()
+ * XMC_CCU4_SLICE_StatusBitOverrideConfig()
XMC_CCU4_SLICE_TrapConfig(). + */ +void XMC_CCU4_SLICE_SetInput(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_INPUT_t input); + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Enables the trap feature, by setting CC4yTC.TRAPE0, CC4yTC.TRAPE1, CC4yTC.TRAPE2 and CC4yTC.TRAPE3 bit based on the + * \a out_mask.\n\n + * A particularly useful feature where the PWM output can be forced inactive upon detection of a trap. The trap signal + * can be the output of a sensing element which has just detected an abnormal electrical condition. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_TrapConfig()
XMC_CCU4_SLICE_DisableTrap()
XMC_CCU4_SLICE_ConfigureEvent()
+ * XMC_CCU4_SLICE_SetInput(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_EnableTrap(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_EnableTrap:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TC |= (uint32_t) CCU4_CC4_TC_TRAPE_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Disables the trap feature, by clearing CC4yTC.TRAPE0, CC4yTC.TRAPE1, CC4yTC.TRAPE2 and CC4yTC.TRAPE3 bit based on the + * \a out_mask.\n\n.\n\n + * This API will revert the changes done by XMC_CCU4_SLICE_EnableTrap(). + * This Ensures that the TRAP function has no effect on the output of the CCU4 slice. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableTrap(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableTrap(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableTrap:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TC &= ~((uint32_t) CCU4_CC4_TC_TRAPE_Msk); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * bool returns \b true if the Timer is running else it returns \b false. + * + * \parDescription:
+ * Returns the state of the timer (Either Running or stopped(idle)), by reading CC4yTCST.TRB bit. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartTimer()
XMC_CCU4_SLICE_StopTimer(). + */ +__STATIC_INLINE bool XMC_CCU4_SLICE_IsTimerRunning(const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetTimerStatus:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return (bool)(((slice->TCST) & CCU4_CC4_TCST_TRB_Msk) == CCU4_CC4_TCST_TRB_Msk); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * ::XMC_CCU4_SLICE_TIMER_COUNT_DIR_t returns the direction in which the timer is counting. + * + * \parDescription:
+ * Returns the timer counting direction, by reading CC4yTCST.CDIR bit.\n\n + * This API will return the direction in which the timer is currently + * incrementing(XMC_CCU4_SLICE_TIMER_COUNT_DIR_UP) or decrementing (XMC_CCU4_SLICE_TIMER_COUNT_DIR_DOWN). + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE XMC_CCU4_SLICE_TIMER_COUNT_DIR_t XMC_CCU4_SLICE_GetCountingDir(const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetCountingDir:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return((XMC_CCU4_SLICE_TIMER_COUNT_DIR_t)(((slice->TCST) & CCU4_CC4_TCST_CDIR_Msk) >> CCU4_CC4_TCST_CDIR_Pos)); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Starts the timer counting operation, by setting CC4yTCSET.TRBS bit.\n\n + * It is necessary to have configured the CC4 slice before starting its timer. + * Before the Timer is started ensure that the clock is provided to the slice. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StopTimer(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_StartTimer(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_StartTimer:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TCSET = CCU4_CC4_TCSET_TRBS_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Stops the Timer.
\n + * Timer counting operation can be stopped by invoking this API, by setting CC4yTCCLR.TRBC bit. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartTimer(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_StopTimer(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_StopTimer:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TCCLR = (uint32_t) CCU4_CC4_TCCLR_TRBC_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Resets the timer count to zero, by setting CC4yTCCLR.TCC bit.\n\n + * A timer which has been stopped can still retain the last counted value. + * After invoking this API the timer value will be cleared. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartTimer(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_ClearTimer(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_ClearTimer:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TCCLR = (uint32_t) CCU4_CC4_TCCLR_TCC_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Stops and resets the timer count to zero, by setting CC4yTCCLR.TCC and CC4yTCCLR.TRBC bit.\n\n + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartTimer(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_StopClearTimer(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_StopClearTimer:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TCCLR = CCU4_CC4_TCCLR_TRBC_Msk | CCU4_CC4_TCCLR_TCC_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * ::XMC_CCU4_SLICE_MODE_t returns XMC_CCU4_SLICE_MODE_COMPARE if the slice is operating in compare mode + * returns XMC_CCU4_SLICE_MODE_CAPTURE if the slice is operating in capture mode + * + * \parDescription:
+ * Retrieves the current mode of operation in the slice (either Capture mode or Compare mode), by reading + * CC4yTC.CMOD bit.\n\n + * Ensure that before invoking this API the CCU4 slice should be configured otherwise the output of this API is + * invalid. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE XMC_CCU4_SLICE_MODE_t XMC_CCU4_SLICE_GetSliceMode(const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetSliceMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return((XMC_CCU4_SLICE_MODE_t)(((slice->TC) & CCU4_CC4_TC_CMOD_Msk) >> CCU4_CC4_TC_CMOD_Pos)); +} +/** + * @param slice Constant pointer to CC4 Slice + * @param mode Desired repetition mode (Either single shot or Continuous) + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Timer to either Single shot mode or continuous mode, by configuring CC4yTC.TSSM bit.\n\n + * The timer will count up to the terminal count as specified in the period register and stops immediately if the repeat + * mode has been set to single shot. In the continuous mode of operation, the timer starts counting all over again after + * reaching the terminal count. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_GetTimerRepeatMode(). + */ +void XMC_CCU4_SLICE_SetTimerRepeatMode(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t mode); + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * ::XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t returns XMC_CCU4_SLICE_TIMER_REPEAT_MODE_REPEAT if continuous mode is selected + * returns XMC_CCU4_SLICE_TIMER_REPEAT_MODE_SINGLE if single shot mode is selected + * + * \parDescription:
+ * Retrieves the Timer repeat mode, either Single shot mode or continuous mode, by reading CC4yTC.TSSM bit.\n\n + * The timer will count up to the terminal count as specified in the period register and stops immediately if the repeat + * mode has been set to single shot mode. In the continuous mode of operation, the timer starts counting + * all over again after reaching the terminal count. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetTimerRepeatMode(). + */ +__STATIC_INLINE XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t XMC_CCU4_SLICE_GetTimerRepeatMode( + const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetTimerRepeatMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return((XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t)(((slice->TC) & CCU4_CC4_TC_TSSM_Msk) >> CCU4_CC4_TC_TSSM_Pos)); +} +/** + * @param slice Constant pointer to CC4 Slice + * @param mode Desired counting mode (Either Edge Aligned or Center Aligned) + * @return
+ * None
+ * + * \parDescription:
+ * Configures the timer counting mode either Edge Aligned or Center Aligned, by configuring CC4yTC.TCM bit.\n\n + * In the edge aligned mode, the timer counts from 0 to the terminal count. Once the timer count has reached a preset + * compare value, the timer status output asserts itself. It will now deassert only after the timer count reaches the + * terminal count.\n In the center aligned mode, the timer first counts from 0 to the terminal count and then back to 0. + * During this upward and downward counting, the timer status output stays asserted as long as the timer value is + * greater than the compare value. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_GetTimerCountingMode(). + */ +void XMC_CCU4_SLICE_SetTimerCountingMode(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_TIMER_COUNT_MODE_t mode); + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * ::XMC_CCU4_SLICE_TIMER_COUNT_MODE_t returns XMC_CCU4_SLICE_TIMER_COUNT_MODE_EA if edge aligned mode is selected + * returns XMC_CCU4_SLICE_TIMER_COUNT_MODE_CA if center aligned mode is selected + * + * \parDescription:
+ * Retrieves timer counting mode either Edge aligned or Center Aligned, by reading CC4yTC.TCM bit.\n\n + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetTimerCountingMode(). + */ +__STATIC_INLINE XMC_CCU4_SLICE_TIMER_COUNT_MODE_t XMC_CCU4_SLICE_GetTimerCountingMode( + const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetTimerCountingMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return((XMC_CCU4_SLICE_TIMER_COUNT_MODE_t)(((slice->TC) & CCU4_CC4_TC_TCM_Msk) >> CCU4_CC4_TC_TCM_Pos)); +} +/** + * @param slice Constant pointer to CC4 Slice + * @param period_val Timer period value + * Range: [0x0 to 0xFFFF] + * @return
+ * None
+ * + * \parDescription:
+ * Programs the timer period, by writing CC4yPRS register.\n\n + * The frequency of counting/ PWM frequency is determined by this value. The period value is written to a shadow + * register. Explicitly enable the shadow transfer for the the period value by calling + * XMC_CCU4_EnableShadowTransfer() with appropriate mask. If shadow transfer is enabled and the timer is running, + * a period match transfers the value from the shadow register to the actual period register. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_GetTimerPeriodMatch(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_SetTimerPeriodMatch(XMC_CCU4_SLICE_t *const slice, const uint16_t period_val) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerPeriodMatch:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->PRS = (uint32_t) period_val; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * uint16_t returns the current timer period value + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Retrieves the timer period value currently effective, by reading CC4yPR register.\n\n + * If the timer is active then the value being returned is currently being used for the PWM period. + * + * \parNote:
+ * The XMC_CCU4_SLICE_SetTimerPeriodMatch() would set the new period value to a shadow register. + * This would only transfer the new values into the actual period register if the shadow transfer request + * is enabled and if a period match occurs. Hence a consecutive call to XMC_CCU4_SLICE_GetTimerPeriodMatch() + * would not reflect the new values until the shadow transfer completes. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetTimerPeriodMatch(). + */ +__STATIC_INLINE uint16_t XMC_CCU4_SLICE_GetTimerPeriodMatch(const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerPeriodMatch:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return((uint16_t)slice->PR); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param compare_val Timer compare value + * @return
+ * None
+ * + * \parDescription:
+ * Programs the timer compare value, by writing CC4yCRS register.
\n + * The PWM duty cycle is determined by this value. + * The compare value is written to a shadow register. Explicitly enable the shadow transfer for + * the the period/compare value by calling XMC_CCU4_EnableShadowTransfer() with + * appropriate mask.If shadow transfer is enabled and the timer is running, + * a period match transfers the value from the shadow register to the actual compare register. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_GetTimerPeriodMatch(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_SetTimerCompareMatch(XMC_CCU4_SLICE_t *const slice, const uint16_t compare_val) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerCompareMatch:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->CRS = (uint32_t) compare_val; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * uint16_t returns the current timer compare value + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Retrieves the timer compare value currently effective, by reading CC4yCRS register.\n\n + * If the timer is active then the value being returned is currently being for the PWM duty cycle( timer compare value). + * + * \parNote:
+ * The XMC_CCU4_SLICE_SetTimerCompareMatch() would set the new compare value to a shadow register. + * This would only transfer the new values into the actual compare register if the shadow transfer request + * is enabled and if a period match occurs. Hence a consecutive call to XMC_CCU4_SLICE_GetTimerCompareMatch() + * would not reflect the new values until the shadow transfer completes. + * Directly accessed Register is CC4yCR. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetTimerCompareMatch(). + */ +__STATIC_INLINE uint16_t XMC_CCU4_SLICE_GetTimerCompareMatch(const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetTimerCompareMatch:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return((uint16_t)slice->CR); +} + +/** + * @param module Constant pointer to CCU4 module + * @param shadow_transfer_msk Shadow transfer request mask for various transfers. + * Use ::XMC_CCU4_SHADOW_TRANSFER_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Requests of shadow transfer for Period, Compare, Passive level, dither and prescaler, by configuring + * the GCSS register.\n\n + * The transfer from the shadow registers to the actual registers is done in the immediate next occurrence of the + * shadow transfer trigger after the API is called. + * + * Any call to XMC_CCU4_SLICE_SetTimerPeriodMatch()
XMC_CCU4_SLICE_SetTimerCompareMatch()
+ * XMC_CCU4_SLICE_SetPrescaler()
XMC_CCU4_SLICE_CompareInit()
XMC_CCU4_SLICE_CaptureInit(). + * must be succeeded by this API. + * Directly accessed Register is GCSS. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_CCU4_EnableShadowTransfer(XMC_CCU4_MODULE_t *const module, const uint32_t shadow_transfer_msk) +{ + XMC_ASSERT("XMC_CCU4_EnableShadowTransfer:Invalid Slice Pointer", XMC_CCU4_IsValidModule(module)); + module->GCSS = (uint32_t)shadow_transfer_msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * uint16_t returns the current timer value + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Retrieves the latest timer value, from CC4yTIMER register.\n\n + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetTimerValue(). + */ +__STATIC_INLINE uint16_t XMC_CCU4_SLICE_GetTimerValue(const XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetTimerValue:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + return((uint16_t)slice->TIMER); +} +/** + * @param slice Constant pointer to CC4 Slice + * @param timer_val The new timer value that has to be loaded into the TIMER register. + * Range: [0x0 to 0xFFFF] + * @return
+ * None
+ * + * \parDescription:
+ * Loads a new timer value, by setting CC4yTIMER register.\n\n + * + * \parNote:
+ * Request to load is ignored if the timer is running. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_GetTimerValue(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_SetTimerValue(XMC_CCU4_SLICE_t *const slice, const uint16_t timer_val) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerValue:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TIMER = (uint32_t) timer_val; +} +/** + * @param slice Constant pointer to CC4 Slice + * @param period_dither Boolean instruction on dithering of period match + * @param duty_dither Boolean instruction on dithering of compare match + * @param spread Dither compare value + * @return
+ * None
+ * + * \parDescription:
+ * Enables dithering of PWM frequency and duty cycle, by configuring CC4yTC.DITHE and CC4yDITS bits.\n\n + * Some control loops are slow in updating PWM frequency and duty cycle. In such a case, a Bresenham style dithering + * can help reduce long term errors. Dithering can be applied to period and duty individually, + * this can be selected using the parameter \b period_dither and \b duty_dither. + * The \b spread would provide the dither compare value. If the dither counter value is less than this \b spread then + * the period/compare values would be dithered according to the dither mode selected. This API would invoke + * XMC_CCU4_SLICE_SetDitherCompareValue(). + * + * \parNote:
+ * After this API call, XMC_CCU4_EnableShadowTransfer() has to be called with appropriate mask + * to transfer the dither value. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_DisableDithering(). + */ +void XMC_CCU4_SLICE_EnableDithering(XMC_CCU4_SLICE_t *const slice, + const bool period_dither, + const bool duty_dither, + const uint8_t spread); + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Disables dithering of PWM frequency and duty cycle, by clearing CC4yTC.DITHE bits.\n\n + * This disables the Dither mode that was set in XMC_CCU4_SLICE_EnableDithering(). + * This API will not clear the dither compare value. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableDithering(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableDithering(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableDithering:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TC &= ~((uint32_t) CCU4_CC4_TC_DITHE_Msk); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Enables the floating prescaler, by setting CC4yTC.FPE bit.\n\n + * The prescaler divider starts with an initial value and increments upon every period match. It keeps incrementing + * until a ceiling (prescaler compare value) is hit and thereafter rolls back to the original prescaler divider value.\n + * It is necessary to have programmed an initial divider value and a compare value before the feature is enabled. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetFloatingPrescalerCompareValue()
XMC_CCU4_SLICE_DisableFloatingPrescaler()
+ * XMC_CCU4_SLICE_SetPrescaler(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_EnableFloatingPrescaler(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_EnableFloatingPrescaler:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TC |= (uint32_t) CCU4_CC4_TC_FPE_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Disables the floating prescaler, by clearing CC4yTC.FPE bit.\n\n + * This would return the prescaler to the normal mode. + * The prescaler that would be applied is the value present in CC4yPSC. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableFloatingPrescaler(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableFloatingPrescaler(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableFloatingPrescaler:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TC &= ~((uint32_t) CCU4_CC4_TC_FPE_Msk); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param comp_val Dither compare value + * Range: [0x0 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Sets the dither spread/compare value, by setting CC4yDITS.DCVS bits.\n\n + * This value is the cornerstone of PWM dithering feature. Dithering is applied/done when the value in the + * dithering counter is less than this compare/spread value. For all dithering counter values greater than + * the spread value, there is no dithering. After setting the value XMC_CCU4_EnableShadowTransfer() has to be + * called with appropriate mask. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableDithering(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_SetDitherCompareValue(XMC_CCU4_SLICE_t *const slice, const uint8_t comp_val) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetDitherCompareValue:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->DITS = comp_val; +} +/** + * @param slice Constant pointer to CC4 Slice + * @param div_val Prescaler divider value + * Range: [0x0 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Programs the slice specific prescaler divider, by configuring the CC4yPSC and CC4yFPC registers.\n\n + * The prescaler divider may only be programmed after the prescaler run bit has been cleared + * by calling XMC_CCU4_StopPrescaler(). + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetFloatingPrescalerCompareValue(). + */ +void XMC_CCU4_SLICE_SetPrescaler(XMC_CCU4_SLICE_t *const slice, const uint8_t div_val); + +/** + * @param slice Constant pointer to CC4 Slice + * @param cmp_val Prescaler divider compare value + * Range: [0x0 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Programs the slice specific prescaler divider compare value, by configuring CC4yFPCS register.\n\n + * The compare value is applicable only in floating mode of operation. The prescaler divider starts with an initial + * value and increments to the compare value steadily upon every period match. Once prescaler divider + * equals the prescaler divider compare value, the value in the former resets back to the PVAL (from FPC). After setting + * the value, XMC_CCU4_EnableShadowTransfer() has to be called with appropriate mask. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetPrescaler(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_SetFloatingPrescalerCompareValue(XMC_CCU4_SLICE_t *const slice, + const uint8_t cmp_val) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetFloatingPrescalerCompareValue:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + /* write to the shadow register */ + slice->FPCS = (uint32_t) cmp_val; +} +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Enables the multichannel mode, by setting CC4yTC.MCME bit.
\n + * The output state of the Timer slices can be controlled in parallel by a single input signal. + * A particularly useful feature in motor control applications where the PWM output of multiple slices of a module can + * be gated and ungated by multi-channel gating inputs connected to the slices. A peripheral like POSIF connected to the + * motor knows exactly which of the power drive switches are to be turned on and off at any instant. It can thus through + * a gating bus (known as multi-channel inputs) control which of the slices output stays gated/ungated. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_DisableMultiChannelMode()
XMC_CCU4_SetMultiChannelShadowTransferMode(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_EnableMultiChannelMode(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_EnableMultiChannelMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TC |= (uint32_t) CCU4_CC4_TC_MCME_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Disables the multichannel mode, by clearing CC4yTC.MCME bit.
\n + * This would return the slices to the normal operation mode. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableMultiChannelMode(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableMultiChannelMode(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableMultiChannelMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->TC &= ~((uint32_t) CCU4_CC4_TC_MCME_Msk); +} + +/** + * @param module Constant pointer to CCU4 module + * @param slice_mode_msk Slices for which the configuration has to be applied. + * Use ::XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Enables the Multi-channel shadow transfer request trigger signal either by software or hardware by configuring + * GCTRL.MSE0, GCTRL.MSE1, GCTRL.MSE2, and GCTRL.MSE3 based on the mask.\n\n + * The shadow transfer would take place either if it was requested by software or by the CCU4x.MCSS input. + * + * \parRelated APIs:
+ * None. +*/ +void XMC_CCU4_SetMultiChannelShadowTransferMode(XMC_CCU4_MODULE_t *const module, const uint32_t slice_mode_msk); + +/** + * @param slice Constant pointer to CC4 Slice + * @param reg_num The capture register from which the captured value is to be retrieved + * Range: [0,3] + * @return
+ * uint32_t Returns the Capture register value. + * Range: [0 to 0x1FFFFF] + * + * \parDescription:
+ * Retrieves timer value which has been captured in the Capture registers, by reading CC4yCV[\b reg_num] register.\n\n + * The signal whose timing characteristics are to be measured must be mapped to an event which in turn must be mapped + * to the capture function. Based on the capture criteria, the timer values are captured into capture registers. Timing + * characteristics of the input signal may then be derived/inferred from the captured values. The full flag will help + * to find out if there is a new captured value present. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_GetLastCapturedTimerValue(). + */ +uint32_t XMC_CCU4_SLICE_GetCaptureRegisterValue(const XMC_CCU4_SLICE_t *const slice, const uint8_t reg_num); + +/** + * @param slice Constant pointer to CC4 Slice + * @param set The capture register set, which must be evaluated + * @param val_ptr Out Parameter of the API.Stores the captured timer value into this out parameter. + * @return
+ * ::XMC_CCU4_STATUS_t Returns XMC_CCU4_STATUS_OK if there was new value present in the capture registers. + * returns XMC_CCU4_STATUS_ERROR if there was no new value present in the capture registers. + * + * \parDescription:
+ * Retrieves the latest captured timer value, by reading CC4yCV registers.\n\n + * Retrieve the timer value last stored by the slice. When separate capture events are used, + * users must specify the capture set to evaluate. If single capture event mode is used, all 4 capture registers are + * evaluated.\n + * The lowest register is evaluated first followed by the next higher ordered register and this continues until all + * capture registers have been evaluated. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_GetCaptureRegisterValue(). + */ +XMC_CCU4_STATUS_t XMC_CCU4_SLICE_GetLastCapturedTimerValue(const XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_CAP_REG_SET_t set, + uint32_t *val_ptr); + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Event whose assertion can potentially lead to an interrupt + * @return
+ * None
+ * + * \parDescription:
+ * Enables the generation of an interrupt pulse for the event, by configuring CC4yINTE register.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API merely enables the event. Binding with SR is performed by another API. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetInterruptNode()
XMC_CCU4_SLICE_EnableMultipleEvents()
XMC_CCU4_SLICE_DisableEvent()
+ * XMC_CCU4_SLICE_DisableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_EnableEvent(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU4_SLICE_EnableEvent:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_EnableEvent:Invalid SR event", XMC_CCU4_SLICE_CHECK_INTERRUPT(event)); + slice->INTE |= ((uint32_t) 1) << ((uint32_t) event); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param intr_mask Event mask such that multiple events can be enabled. + * Use ::XMC_CCU4_SLICE_MULTI_IRQ_ID_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Enables the generation of an interrupt pulse for the required events, by configuring CC4yINTE register.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API merely enables the events. Binding with SR is performed by another API. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetInterruptNode()
XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_DisableEvent()
+ * XMC_CCU4_SLICE_DisableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_EnableMultipleEvents(XMC_CCU4_SLICE_t *const slice, const uint16_t intr_mask) +{ + XMC_ASSERT("XMC_CCU4_SLICE_EnableMultipleEvents:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->INTE |= (uint32_t)intr_mask; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Event whose assertion can potentially lead to an interrupt + * @return
+ * None
+ * + * \parDescription:
+ * Disables the generation of an interrupt pulse for the event, by clearing CC4yINTE register.\n\n + * Prevents the event from being asserted + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetInterruptNode()
XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_EnableMultipleEvents()
+ * XMC_CCU4_SLICE_DisableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableEvent(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableEvent:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_DisableEvent:Invalid SR event", XMC_CCU4_SLICE_CHECK_INTERRUPT(event)); + slice->INTE &= ~(((uint32_t) 1) << ((uint32_t) event)); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param mask Event mask such that multiple events can be enabled. + * Use ::XMC_CCU4_SLICE_MULTI_IRQ_ID_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Disables the generation of an interrupt pulse for the required events, by clearing CC4yINTE register.\n\n + * Prevents selected events of the slice from being asserted. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetInterruptNode()
XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_EnableMultipleEvents()
+ * XMC_CCU4_SLICE_DisableEvent(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableMultipleEvents(XMC_CCU4_SLICE_t *const slice, const uint16_t mask) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableMultipleEvents:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->INTE &= ~((uint32_t) mask); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Event whose assertion can potentially lead to an interrupt + * @return
+ * None
+ * + * \parDescription:
+ * Manually asserts the requested event, by setting CC4ySWS register.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API manually asserts the requested event. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_SetInterruptNode()
XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_EnableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_SetEvent(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetEvent:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_SetEvent:Invalid SR event", XMC_CCU4_SLICE_CHECK_INTERRUPT(event)); + slice->SWS |= ((uint32_t) 1) << ((uint32_t) event); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Asserted event which must be acknowledged. + * @return
+ * None
+ * + * \parDescription:
+ * Acknowledges an asserted event, by setting CC4ySWR with respective event flag.\n\n + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_SetEvent()
XMC_CCU4_SLICE_GetEvent(). + */ +__STATIC_INLINE void XMC_CCU4_SLICE_ClearEvent(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU4_SLICE_ClearEvent:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_ClearEvent:Invalid SR event", XMC_CCU4_SLICE_CHECK_INTERRUPT(event)); + slice->SWR |= ((uint32_t) 1) << ((uint32_t) event); +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param event Event to be evaluated for assertion + * @return
+ * bool Returns true if event is set else false is returned. + * + * \parDescription:
+ * Evaluates if a given event is asserted or not, by reading CC4yINTS register.\n\n + * Return true if the event is asserted. For a event to be asserted it has to be + * first enabled. Only if that event is enabled the call to this API is valid. + * If the Event is enabled and has not yet occurred then a false is returned. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_SetEvent(). + */ +__STATIC_INLINE bool XMC_CCU4_SLICE_GetEvent(const XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetEvent:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_GetEvent:Invalid SR event", XMC_CCU4_SLICE_CHECK_INTERRUPT(event)); + + return(((uint32_t)(slice->INTS & ((uint32_t)1 << (uint32_t)event))) != 0U); +} +/** + * @param slice Constant pointer to CC4 Slice + * @param event Event which must be bound to a service request line + * @param sr The Service request line which is bound to the \b event + * @return
+ * None
+ * + * \parDescription:
+ * Binds requested event to a service request line, by configuring CC4ySRS register with respective event.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API binds the requested event with the requested service request line(\b sr). + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_SetEvent(). + */ +void XMC_CCU4_SLICE_SetInterruptNode(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_IRQ_ID_t event, + const XMC_CCU4_SLICE_SR_ID_t sr); + +/** + * @param slice Constant pointer to CC4 Slice + * @param level Slice output passive level + * @return
+ * None
+ * + * \parDescription:
+ * Configures the passive level for the slice output, by setting CC4yPSL register.\n\n + * Defines the passive level for the timer slice output pin. Selects either level high is passive + * or level low is passive. This is the level of the output before the compare match is value changes it. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_SetEvent(). + */ +void XMC_CCU4_SLICE_SetPassiveLevel(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_t level); + +#if defined(CCU4V3) || defined(DOXYGEN) /* Defined for XMC1400 devices only */ +/** + * @param slice Constant pointer to CC4 Slice + * + * @return
+ * None
+ * + * \parDescription:
+ * Cascades the shadow transfer operation throughout the CCU4 timer slices, by setting CSE bit in STC register.\n\n + * + * The shadow transfer enable bits needs to be set in all timer slices, that are being used in the cascaded architecture, + * at the same time. The shadow transfer enable bits, also need to be set for all slices even if the shadow values of + * some slices were not updated. It is possible to to cascade with the adjacent slices only. CC40 slice is a + * master to start the operation. + * + * \parNote:
+ * XMC_CCU4_EnableShadowTransfer() must be called to enable the shadow transfer of the all the slices, which needs to be + * cascaded. + * + * \parRelated APIs:
+ * XMC_CCU4_EnableShadowTransfer(), XMC_CCU4_SLICE_DisableCascadedShadowTransfer()
. + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU4_SLICE_EnableCascadedShadowTransfer(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_EnableCascadedShadowTransfer:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->STC |= (uint32_t) CCU4_CC4_STC_CSE_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * + * @return
+ * None
+ * + * \parDescription:
+ * Disables the cascaded the shadow transfer operation, by clearing CSE bit in STC register.\n\n + * + * If in any slice the cascaded mode disabled, other slices from there onwards does not update the values in cascaded mode. + * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableCascadedShadowTransfer()
. + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableCascadedShadowTransfer(XMC_CCU4_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableCascadedShadowTransfer:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->STC &= ~(uint32_t) CCU4_CC4_STC_CSE_Msk; +} + +/** + * @param slice Constant pointer to CC4 Slice + * @param shadow_transfer_mode mode to be configured + * Use :: XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_t enum items for mode + * @return
+ * None
+ * + * \parDescription:
+ * Configures when the shadow transfer has to occur, by setting STM bit in STC register.\n\n + * + * After requesting for shadow transfer mode using XMC_CCU4_EnableShadowTransfer(), actual transfer occurs based on the + * selection done using this API (i.e. on period and One match, on Period match only, on One match only). + * + * \parNote:
+ * This is effective when the timer is configured in centre aligned mode. + * + * \parRelated APIs:
+ * XMC_CCU4_EnableShadowTransfer()
+ * @note Only available for XMC1400 series +*/ +__STATIC_INLINE void XMC_CCU4_SLICE_SetShadowTransferMode(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_t shadow_transfer_mode) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetShadowTransferMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->STC = ((slice->STC) & ~(uint32_t)((uint32_t)CCU4_CC4_STC_STM_Msk << (uint32_t)CCU4_CC4_STC_STM_Pos)) | + ((shadow_transfer_mode << CCU4_CC4_STC_STM_Pos) & (uint32_t)CCU4_CC4_STC_STM_Msk); +} + + /** + * @param slice Constant pointer to CC4 Slice + * @param coherent_write specifies for what fields this mode has to be applied + * Use :: XMC_CCU4_SLICE_WRITE_INTO_t enum items to create a mask of choice, using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configures the specified fields shadow value to be updated in synchronous with PWM after shadow transfer request, by + * clearing IRPC, IRCC1, IRCC2, IRLC, IRDC, IRFC bits in STC register.\n\n + * + * When coherent shadow is enabled, after calling XMC_CCU4_EnableShadowTransfer(), the value which are written in the + * respective shadow registers get updated according the configuration done using XMC_CCU4_SLICE_SetShadowTransferMode() + * API. \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU4_EnableShadowTransfer(), XMC_CCU4_SLICE_SetShadowTransferMode()
+ * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU4_SLICE_WriteCoherentlyWithPWMCycle(XMC_CCU4_SLICE_t *const slice, + const uint32_t coherent_write) +{ + XMC_ASSERT("XMC_CCU4_SLICE_WriteCoherentlyWithPWMCycle:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->STC &= ~(uint32_t)coherent_write; +} + + /** + * @param slice Constant pointer to CC4 Slice + * @param immediate_write specifies for what fields this mode has to be applied + * Use :: XMC_CCU4_SLICE_WRITE_INTO_t enum items to create a mask of choice, using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configures the specified fields shadow value to be updated immediately after shadow transfer request, by setting + * IRPC, IRCC1, IRCC2, IRLC, IRDC, IRFC bits in STC register.\n\n + * + * When immediate shadow is enabled, by calling XMC_CCU4_EnableShadowTransfer() the value which are written in the + * shadow registers get updated to the actual registers immediately. \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU4_EnableShadowTransfer()
+ * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU4_SLICE_WriteImmediateAfterShadowTransfer(XMC_CCU4_SLICE_t *const slice, + const uint32_t immediate_write) +{ + XMC_ASSERT("XMC_CCU4_SLICE_WriteImmediateAfterShadowTransfer:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->STC |= immediate_write; +} + + /** + * @param slice Constant pointer to CC4 Slice + * @param automatic_shadow_transfer specify upon which register update, automatic shadow transfer request is generated + * Use :: XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_t enum items to create a mask of choice, using a + * bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configure on which shadow register update, automatic shadow transfer request generation has to be enabled. By setting + * ASPC, ASCC1, ASCC2, ASLC, ASDC, ASFC bits in STC register.\n\n + * + * By updating the configured shadow register, the shadow transfer request is generated to update all the shadow registers. + * \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_DisableAutomaticShadowTransferRequest(). + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU4_SLICE_EnableAutomaticShadowTransferRequest(XMC_CCU4_SLICE_t *const slice, + const uint32_t automatic_shadow_transfer) +{ + XMC_ASSERT("XMC_CCU4_SLICE_EnableAutomaticShadowTransferRequest:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->STC |= automatic_shadow_transfer; +} + + /** + * @param slice Constant pointer to CC4 Slice + * @param automatic_shadow_transfer specify upon which register update, automatic shadow transfer request should not be + * generated + * Use :: XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_t enum items to create a mask of choice, using a + * bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configure on which shadow register update, automatic shadow transfer request generation has to be disabled. By + * clearing ASPC, ASCC1, ASCC2, ASLC, ASDC, ASFC bits in STC register.\n\n + * + * This disables the generation of automatic shadow transfer request for the specified register update. + * \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU4_SLICE_EnableAutomaticShadowTransferRequest(). + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU4_SLICE_DisableAutomaticShadowTransferRequest(XMC_CCU4_SLICE_t *const slice, + const uint32_t automatic_shadow_transfer) +{ + XMC_ASSERT("XMC_CCU4_SLICE_DisableAutomaticShadowTransferRequest:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + slice->STC &= ~(uint32_t)automatic_shadow_transfer; +} +#endif +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(CCU40) */ + +#endif /* CCU4_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_ccu8.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_ccu8.h new file mode 100644 index 00000000..8b732444 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_ccu8.h @@ -0,0 +1,2929 @@ +/** + * @file xmc_ccu8.h + * @date 2016-05-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * - Documentation updates
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * - Added XMC_CCU8_SLICE_LoadSelector() API, to select which compare register value has to be loaded + * during external load event. + * + * 2015-07-01: + * - In XMC_CCU8_SLICE_CHECK_INTERRUPT macro, fixed the missing item for compare match down for channel 2.
+ * + * 2015-07-24: + * - XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent() is updated to support XMC14 device.
+ * + * 2015-08-17: + * - XMC_CCU8_SLICE_PRESCALER_t enum is added to set the prescaler divider.
+ * - XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE_t is added for all the devices except XMC45 devices, to set when the + * shadow transfer has to happen.
+ * - XMC_CCU8_SOURCE_OUT0_t, XMC_CCU8_SOURCE_OUT1_t, XMC_CCU8_SOURCE_OUT2_t, XMC_CCU8_SOURCE_OUT3_t enums are added + * to maps one of the ST to OUT0, OUT1, OUT3, OUT4 signals. + * - In XMC_CCU8_SLICE_COMPARE_CONFIG_t structure, selector_out0, selector_out1, selector_out2, selector_out3 are + * added to support XMC14 devices. + * - XMC_CCU8_EnableShadowTransfer() API is made as inline, to improve the speed.
+ * - XMC_CCU8_SLICE_EnableCascadedShadowTransfer(), XMC_CCU8_SLICE_DisableCascadedShadowTransfer(), + * XMC_CCU8_SLICE_SetShadowTransferMode() API are supported for all the devices except XMC45. + * + * 2015-09-29: + * - In XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_t, two more enum items are added to support external count direction + * settings. + * + * 2015-10-07: + * - XMC_CCU8_SLICE_SetTimerCompareMatchChannel1(), XMC_CCU8_SLICE_SetTimerCompareMatchChannel2() inline APIs are + * added to update the respective compare registers directly. + * - XMC_CCU8_SLICE_GetEvent() is made as inline. + * - XMC_CCU8_SLICE_MULTI_IRQ_ID_t is added to support the XMC_CCU8_SLICE_EnableMultipleEvents() and + * XMC_CCU8_SLICE_DisableMultipleEvents() APIs. + * - DOC updates for the newly added APIs. + * + * 2016-03-09: + * - Optimization of write only registers + * + * 2016-05-20: + * - Added XMC_CCU8_SLICE_StopClearTimer() + * - Changed XMC_CCU8_SLICE_StopTimer() and XMC_CCU8_SLICE_ClearTimer() + * + * @endcond + */ + +#ifndef XMC_CCU8_H +#define XMC_CCU8_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include "xmc_common.h" + +#if defined(CCU80) + +#if UC_FAMILY == XMC1 + #include "xmc1_ccu8_map.h" +#endif + +#if UC_FAMILY == XMC4 + #include "xmc4_ccu8_map.h" +#endif + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup CCU8 + * + * @brief Capture Compare Unit 8 (CCU8) low level driver for XMC family of microcontrollers
+ * + * The CCU8 peripheral functions play a major role in applications that need complex Pulse Width Modulation (PWM) signal + * generation, with complementary high side and low side switches, multi phase control. These functions in conjunction + * with a very flexible and programmable signal conditioning scheme, make the CCU8 the must have peripheral for state + * of the art motor control, multi phase and multi level power electronics systems.\n + * Each CCU8 module is comprised of four identical 16 bit Capture/Compare Timer slices, CC8y (where y = [0..4]). Each + * timer slice can work in compare mode or in capture mode. + * + * APIs provided in this file cover the following functional blocks of CCU8: + * -- Timer configuration, Capture configuration, Function/Event configuration, Interrupt configuration + * \par Note: + * 1. SLICE (APIs prefixed with e.g. XMC_CCU8_SLICE_) + * 2. Module (APIs are not having any prefix e.g. XMC_CCU8_) + * + * \par Timer(Compare mode) configuration: + * This section of the LLD provides the configuration structure XMC_CCU8_SLICE_COMPARE_CONFIG_t, + * XMC_CCU8_SLICE_DEAD_TIME_CONFIG_t and the initialization functions XMC_CCU8_SLICE_CompareInit(), XMC_CCU8_SLICE_DeadTimeInit(). + * + * It can be used to: + * -# Start and Stop the timer. (XMC_CCU8_SLICE_StartTimer(), XMC_CCU8_SLICE_StopTimer()) + * -# Update the period, compare, Dither, Prescaler and Passive values. (XMC_CCU8_SLICE_SetTimerPeriodMatch(), + * XMC_CCU8_SLICE_SetTimerCompareMatch(), XMC_CCU8_SLICE_SetPrescaler(), XMC_CCU8_SLICE_SetDitherCompareValue(), + * XMC_CCU8_SLICE_SetPassiveLevel()) + * -# Configure the dead time.(XMC_CCU8_SLICE_SetDeadTimeValue(), XMC_CCU8_SLICE_SetDeadTimePrescaler()) + * -# Enable the slices to support multichannel mode. (XMC_CCU8_SLICE_EnableMultiChannelMode()) + * + * \par Capture configuration: + * This section of the LLD provides the configuration structure XMC_CCU8_SLICE_CAPTURE_CONFIG_t and the initialization + * function XMC_CCU8_SLICE_CaptureInit(). + * + * It can be used to: + * -# Configure the capture functionality. (XMC_CCU8_SLICE_Capture0Config(), XMC_CCU8_SLICE_Capture1Config()) + * -# Read the captured values along with the status, which indicate the value is latest or not. + * (XMC_CCU8_SLICE_GetCaptureRegisterValue()) + * + * \par Function/Event configuration: + * This section of the LLD provides the configuration structure XMC_CCU8_SLICE_EVENT_CONFIG_t. + * + * It can be used to: + * -# Enable and Disable the events. (XMC_CCU8_SLICE_EnableEvent(), XMC_CCU8_SLICE_DisableEvent()) + * -# Configure to start and stop the timer on external events.(XMC_CCU8_SLICE_StartConfig(), XMC_CCU8_SLICE_StopConfig()) + * -# Modulation, external load and Gating of the timer output.(XMC_CCU8_SLICE_ModulationConfig(), + * XMC_CCU8_SLICE_LoadConfig(), XMC_CCU8_SLICE_GateConfig()) + * -# Control the count direction of the timer based on the external event. (XMC_CCU8_SLICE_DirectionConfig()) + * -# Count the external events.(XMC_CCU8_SLICE_CountConfig()) + * -# External Trap. Which can be used as protective feature.(XMC_CCU8_SLICE_EnableTrap(), XMC_CCU8_SLICE_DisableTrap(), + * XMC_CCU8_SLICE_TrapConfig()) + * + * \par Interrupt configuration: + * This section of the LLD provides the function to configure the interrupt node to each event (XMC_CCU8_SLICE_SetInterruptNode()) + * + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_CCU8_SLICE_CHECK_INTERRUPT(interrupt) \ + ((interrupt == XMC_CCU8_SLICE_IRQ_ID_PERIOD_MATCH) || \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_ONE_MATCH) || \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_UP_CH_1) || \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_DOWN_CH_1)|| \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_UP_CH_2) || \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_DOWN_CH_2)|| \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_EVENT0) || \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_EVENT1) || \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_EVENT2) || \ + (interrupt == XMC_CCU8_SLICE_IRQ_ID_TRAP)) + +/* Macro to check if the slice ptr passed is valid */ +#define XMC_CCU8_SLICE_CHECK_COMP_CHANNEL(cmp_channel) \ + ((cmp_channel == XMC_CCU8_SLICE_COMPARE_CHANNEL_1) || \ + (cmp_channel == XMC_CCU8_SLICE_COMPARE_CHANNEL_2)) + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/** + * Typedef for CCU8 Global data structure + */ +typedef CCU8_GLOBAL_TypeDef XMC_CCU8_MODULE_t; + +/** + * Typedef for CCU8 Slice data structure + */ +typedef CCU8_CC8_TypeDef XMC_CCU8_SLICE_t; + +/** + * Return Value of an API + */ +typedef enum XMC_CCU8_STATUS +{ + XMC_CCU8_STATUS_OK = 0U, /**< API fulfils request */ + XMC_CCU8_STATUS_ERROR , /**< API cannot fulfil request */ + XMC_CCU8_STATUS_RUNNING , /**< The timer slice is currently running */ + XMC_CCU8_STATUS_IDLE /**< The timer slice is currently idle */ +} XMC_CCU8_STATUS_t; + +/** + * CCU8 module clock + */ +typedef enum XMC_CCU8_CLOCK +{ + XMC_CCU8_CLOCK_SCU = 0U, /**< Select the fCCU as the clock */ + XMC_CCU8_CLOCK_EXTERNAL_A , /**< External clock-A */ + XMC_CCU8_CLOCK_EXTERNAL_B , /**< External clock-B */ + XMC_CCU8_CLOCK_EXTERNAL_C /**< External clock-C */ +} XMC_CCU8_CLOCK_t; + +/** + * CCU8 set the shadow transfer type for multichannel mode + */ +typedef enum XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER +{ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE0 = (uint32_t)0x4000000, /**< Shadow transfer through software + only for slice 0*/ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE0 = (uint32_t)0x4000400, /**< Shadow transfer through software + and hardware for slice 0 */ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE1 = (uint32_t)0x8000000, /**< Shadow transfer through software + only for slice 1*/ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE1 = (uint32_t)0x8000800, /**< Shadow transfer through software + and hardware for slice 1 */ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE2 = (uint32_t)0x10000000, /**< Shadow transfer through software + only for slice 2 */ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE2 = (uint32_t)0x10001000, /**< Shadow transfer through software + and hardware for slice 2 */ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_SLICE3 = (uint32_t)0x20000000, /**< Shadow transfer through software + only for slice 3*/ + XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_SW_MCSS_SLICE3 = (uint32_t)0x20002000 /**< Shadow transfer through software + and hardware for slice 3 */ +} XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_t; + +/** + * Operational modes of CCU8 slice + */ +typedef enum XMC_CCU8_SLICE_MODE +{ + XMC_CCU8_SLICE_MODE_COMPARE = 0U, /**< slice(CC8y) operates in Compare Mode */ + XMC_CCU8_SLICE_MODE_CAPTURE /**< slice(CC8y) operates in Capture Mode */ +} XMC_CCU8_SLICE_MODE_t; + +/** + * Slice Output selection + */ +typedef enum XMC_CCU8_SLICE_OUTPUT +{ + XMC_CCU8_SLICE_OUTPUT_0 = 1U, /**< Slice Output-0 */ + XMC_CCU8_SLICE_OUTPUT_1 = 2U, /**< Slice Output-1 */ + XMC_CCU8_SLICE_OUTPUT_2 = 4U, /**< Slice Output-2 */ + XMC_CCU8_SLICE_OUTPUT_3 = 8U /**< Slice Output-3 */ +} XMC_CCU8_SLICE_OUTPUT_t; + +/** + * Timer counting modes for the slice + */ +typedef enum XMC_CCU8_SLICE_TIMER_COUNT_MODE +{ + XMC_CCU8_SLICE_TIMER_COUNT_MODE_EA = 0U, /**< Edge Aligned Mode */ + XMC_CCU8_SLICE_TIMER_COUNT_MODE_CA /**< Centre Aligned Mode */ +} XMC_CCU8_SLICE_TIMER_COUNT_MODE_t; + +/** + * Timer repetition mode for the slice + */ +typedef enum XMC_CCU8_SLICE_TIMER_REPEAT_MODE +{ + XMC_CCU8_SLICE_TIMER_REPEAT_MODE_REPEAT = 0U, /**< Repetitive mode: continuous mode of operation */ + XMC_CCU8_SLICE_TIMER_REPEAT_MODE_SINGLE /**< Single shot mode: Once a Period match/One match + occurs timer goes to idle state */ +} XMC_CCU8_SLICE_TIMER_REPEAT_MODE_t; + +/** + * Timer counting direction for the CCU8 slice + */ +typedef enum XMC_CCU8_SLICE_TIMER_COUNT_DIR +{ + XMC_CCU8_SLICE_TIMER_COUNT_DIR_UP = 0U, /**< Counting up */ + XMC_CCU8_SLICE_TIMER_COUNT_DIR_DOWN /**< Counting down */ +} XMC_CCU8_SLICE_TIMER_COUNT_DIR_t; + +/** + * Capture mode register sets + */ +typedef enum XMC_CCU8_SLICE_CAP_REG_SET +{ + XMC_CCU8_SLICE_CAP_REG_SET_LOW = 0U, /**< Capture register-0, Capture register-1 used */ + XMC_CCU8_SLICE_CAP_REG_SET_HIGH /**< Capture register-0, Capture register-1 used */ +} XMC_CCU8_SLICE_CAP_REG_SET_t; + +/** + * Prescaler mode + */ +typedef enum XMC_CCU8_SLICE_PRESCALER_MODE +{ + XMC_CCU8_SLICE_PRESCALER_MODE_NORMAL = 0U, /**< Fixed division of module clock */ + XMC_CCU8_SLICE_PRESCALER_MODE_FLOAT /**< Floating divider */ +} XMC_CCU8_SLICE_PRESCALER_MODE_t; + +/** + * Timer output passive level + */ +typedef enum XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL +{ + XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_LOW = 0U, /**< Passive level = Low */ + XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_HIGH /**< Passive level = High */ +} XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_t; + +/** + * Compare Channel selection + */ +typedef enum XMC_CCU8_SLICE_COMPARE_CHANNEL +{ + XMC_CCU8_SLICE_COMPARE_CHANNEL_1 = 0U, /**< Compare Channel-1 */ + XMC_CCU8_SLICE_COMPARE_CHANNEL_2 /**< Compare Channel-2 */ +} XMC_CCU8_SLICE_COMPARE_CHANNEL_t; + +/** + * Timer clock Divider + */ +typedef enum XMC_CCU8_SLICE_PRESCALER +{ + XMC_CCU8_SLICE_PRESCALER_1 = 0U, /**< Slice Clock = fccu8 */ + XMC_CCU8_SLICE_PRESCALER_2 , /**< Slice Clock = fccu8/2 */ + XMC_CCU8_SLICE_PRESCALER_4 , /**< Slice Clock = fccu8/4 */ + XMC_CCU8_SLICE_PRESCALER_8 , /**< Slice Clock = fccu8/8 */ + XMC_CCU8_SLICE_PRESCALER_16 , /**< Slice Clock = fccu8/16 */ + XMC_CCU8_SLICE_PRESCALER_32 , /**< Slice Clock = fccu8/32 */ + XMC_CCU8_SLICE_PRESCALER_64 , /**< Slice Clock = fccu8/64 */ + XMC_CCU8_SLICE_PRESCALER_128 , /**< Slice Clock = fccu8/128 */ + XMC_CCU8_SLICE_PRESCALER_256 , /**< Slice Clock = fccu8/256 */ + XMC_CCU8_SLICE_PRESCALER_512 , /**< Slice Clock = fccu8/512 */ + XMC_CCU8_SLICE_PRESCALER_1024 , /**< Slice Clock = fccu8/1024 */ + XMC_CCU8_SLICE_PRESCALER_2048 , /**< Slice Clock = fccu8/2048 */ + XMC_CCU8_SLICE_PRESCALER_4096 , /**< Slice Clock = fccu8/4096 */ + XMC_CCU8_SLICE_PRESCALER_8192 , /**< Slice Clock = fccu8/8192 */ + XMC_CCU8_SLICE_PRESCALER_16384 , /**< Slice Clock = fccu8/16384 */ + XMC_CCU8_SLICE_PRESCALER_32768 /**< Slice Clock = fccu8/32768 */ +} XMC_CCU8_SLICE_PRESCALER_t; + +/** + * Dead Time Generator Clock Divider + */ +typedef enum XMC_CCU8_SLICE_DTC_DIV +{ + XMC_CCU8_SLICE_DTC_DIV_1 = 0U, /**< DTC clock = Slice Clock */ + XMC_CCU8_SLICE_DTC_DIV_2 , /**< DTC clock = Slice Clock/2 */ + XMC_CCU8_SLICE_DTC_DIV_4 , /**< DTC clock = Slice Clock/4 */ + XMC_CCU8_SLICE_DTC_DIV_8 /**< DTC clock = Slice Clock/8 */ +} XMC_CCU8_SLICE_DTC_DIV_t; + + +/** + * The compare channel output which is routed to the slice output signal(STy). + */ +typedef enum XMC_CCU8_SLICE_STATUS +{ + XMC_CCU8_SLICE_STATUS_CHANNEL_1 = 0U, /**< Channel-1 status connected to Slice Status */ + XMC_CCU8_SLICE_STATUS_CHANNEL_2 , /**< Channel-2 status connected to Slice Status */ + XMC_CCU8_SLICE_STATUS_CHANNEL_1_AND_2 , /**< \b Wired \b AND of Channel-1 and Channel-2 status connected to + Slice status */ +#if ((UC_SERIES == XMC13) || (UC_SERIES == XMC14)) || defined(DOXYGEN) + XMC_CCU8_SLICE_STATUS_CHANNEL_1_OR_2 /**< \b Wired \b OR of Channel-1 and Channel-2 status connected to Slice + status. @note Only available for XMC1300 and XMC1400 series */ +#endif +} XMC_CCU8_SLICE_STATUS_t; + +/** + * Compare channel for which modulation has to be applied + */ +typedef enum XMC_CCU8_SLICE_MODULATION_CHANNEL +{ + XMC_CCU8_SLICE_MODULATION_CHANNEL_NONE = 0U, /**< No modulation */ + XMC_CCU8_SLICE_MODULATION_CHANNEL_1 , /**< Modulation for Compare Channel-1 */ + XMC_CCU8_SLICE_MODULATION_CHANNEL_2 , /**< Modulation for Compare Channel-2 */ + XMC_CCU8_SLICE_MODULATION_CHANNEL_1_AND_2 /**< Modulation for Compare Channel-1 and Compare Channel-2 */ +} XMC_CCU8_SLICE_MODULATION_CHANNEL_t; + +/** + * External Function list + */ +typedef enum XMC_CCU8_SLICE_FUNCTION +{ + XMC_CCU8_SLICE_FUNCTION_START = 0U, /**< Start function */ + XMC_CCU8_SLICE_FUNCTION_STOP , /**< Stop function */ + XMC_CCU8_SLICE_FUNCTION_CAPTURE_EVENT0 , /**< Capture Event-0 function, CCycapt0 signal is used for event + generation */ + XMC_CCU8_SLICE_FUNCTION_CAPTURE_EVENT1 , /**< Capture Event-1 function, CCycapt1 signal is used for event + generation */ + XMC_CCU8_SLICE_FUNCTION_GATING , /**< Gating function */ + XMC_CCU8_SLICE_FUNCTION_DIRECTION , /**< Direction function */ + XMC_CCU8_SLICE_FUNCTION_LOAD , /**< Load function */ + XMC_CCU8_SLICE_FUNCTION_COUNT , /**< Counting function */ + XMC_CCU8_SLICE_FUNCTION_OVERRIDE , /**< Override function */ + XMC_CCU8_SLICE_FUNCTION_MODULATION , /**< Modulation function */ + XMC_CCU8_SLICE_FUNCTION_TRAP /**< Trap function */ +} XMC_CCU8_SLICE_FUNCTION_t; + +/** + * External Event list + */ +typedef enum XMC_CCU8_SLICE_EVENT +{ + XMC_CCU8_SLICE_EVENT_NONE = 0U, /**< None */ + XMC_CCU8_SLICE_EVENT_0 , /**< Event-0 */ + XMC_CCU8_SLICE_EVENT_1 , /**< Event-1 */ + XMC_CCU8_SLICE_EVENT_2 /**< Event-2 */ +} XMC_CCU8_SLICE_EVENT_t; + +/** + * External Event trigger criteria - Edge sensitivity + */ +typedef enum XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY +{ + XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_NONE = 0U, /**< None */ + XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_RISING_EDGE , /**< Rising Edge of the input signal generates + event trigger */ + XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_FALLING_EDGE , /**< Falling Edge of the input signal generates event + trigger */ + XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_DUAL_EDGE /**< Both Rising and Falling edges cause an event trigger */ +} XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_t; + +/** + * External Event trigger criteria - Level sensitivity + */ +typedef enum XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY +{ + XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH = 0U, /**< Level sensitive functions react to a high signal level*/ + XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW = 1U, /**< Level sensitive functions react to a low signal level */ + /* Below enum items can be utilised specific to the functionality */ + XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_COUNT_UP_ON_LOW = 0U, /**< Timer counts up, during Low state of the control signal */ + XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_COUNT_UP_ON_HIGH = 1U /**< Timer counts up, during High state of the control signal */ +} XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_t; + +/** + * Low pass filter Configuration. The External Event input should be stable for a selected number of clock cycles. + */ +typedef enum XMC_CCU8_SLICE_EVENT_FILTER +{ + XMC_CCU8_SLICE_EVENT_FILTER_DISABLED = 0U, /**< No Low Pass Filtering is applied */ + XMC_CCU8_SLICE_EVENT_FILTER_3_CYCLES , /**< Input should be stable for 3 clock cycles */ + XMC_CCU8_SLICE_EVENT_FILTER_5_CYCLES , /**< Input should be stable for 5 clock cycles */ + XMC_CCU8_SLICE_EVENT_FILTER_7_CYCLES /**< Input should be stable for 7 clock cycles */ +} XMC_CCU8_SLICE_EVENT_FILTER_t; + +/** + * External Event Input list. This list depicts the possible input connections to the CCU8 slice. + * Interconnects are specific to each device. + */ +typedef uint8_t XMC_CCU8_SLICE_INPUT_t; + + +/** + * Actions that can be performed upon detection of an external Timer STOP event + */ +typedef enum XMC_CCU8_SLICE_END_MODE +{ + XMC_CCU8_SLICE_END_MODE_TIMER_STOP = 0U, /**< Stops the timer, without clearing TIMER register */ + XMC_CCU8_SLICE_END_MODE_TIMER_CLEAR , /**< Without stopping timer, clears the TIMER register */ + XMC_CCU8_SLICE_END_MODE_TIMER_STOP_CLEAR /**< Stops the timer and clears the TIMER register */ +} XMC_CCU8_SLICE_END_MODE_t; + +/** + * Actions that can be performed upon detection of an external Timer START event + */ +typedef enum XMC_CCU8_SLICE_START_MODE +{ + XMC_CCU8_SLICE_START_MODE_TIMER_START = 0U, /**< Start the timer from the current count of TIMER register */ + XMC_CCU8_SLICE_START_MODE_TIMER_START_CLEAR /**< Clears the TIMER register and start the timer */ +} XMC_CCU8_SLICE_START_MODE_t; + +/** + * Modulation of timer output signals + */ +typedef enum XMC_CCU8_SLICE_MODULATION_MODE +{ + XMC_CCU8_SLICE_MODULATION_MODE_CLEAR_ST_OUT = 0U, /**< Clear ST and OUT signals */ + XMC_CCU8_SLICE_MODULATION_MODE_CLEAR_OUT /**< Clear only the OUT signal */ +} XMC_CCU8_SLICE_MODULATION_MODE_t; + +/** + * Trap exit mode + */ +typedef enum XMC_CCU8_SLICE_TRAP_EXIT_MODE +{ + XMC_CCU8_SLICE_TRAP_EXIT_MODE_AUTOMATIC = 0U, /**< Clear trap state as soon as the trap signal is de-asserted */ + XMC_CCU8_SLICE_TRAP_EXIT_MODE_SW /**< Clear only when acknowledged by software */ +} XMC_CCU8_SLICE_TRAP_EXIT_MODE_t; + +/** + * Timer clear on capture + */ +typedef enum XMC_CCU8_SLICE_TIMER_CLEAR_MODE +{ + XMC_CCU8_SLICE_TIMER_CLEAR_MODE_NEVER = 0U, /**< Never clear the timer on any capture event */ + XMC_CCU8_SLICE_TIMER_CLEAR_MODE_CAP_HIGH , /**< Clear only when timer value has been captured in C3V and C2V */ + XMC_CCU8_SLICE_TIMER_CLEAR_MODE_CAP_LOW , /**< Clear only when timer value has been captured in C1V and C0V */ + XMC_CCU8_SLICE_TIMER_CLEAR_MODE_ALWAYS /**< Always clear the timer upon detection of any capture event */ +} XMC_CCU8_SLICE_TIMER_CLEAR_MODE_t; + +/** + * Multi Channel Shadow transfer request configuration options + */ +typedef enum XMC_CCU8_SLICE_MCMS_ACTION +{ + XMC_CCU8_SLICE_MCMS_ACTION_TRANSFER_PR_CR = 0U, /**< Transfer Compare and Period Shadow register values to + the actual registers upon MCS xfer request */ + XMC_CCU8_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP = 1U, /**< Transfer Compare, Period and Prescaler Compare Shadow + register values to the actual registers upon MCS xfer + request */ + XMC_CCU8_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP_DIT = 3U /**< Transfer Compare, Period ,Prescaler Compare and Dither + Compare register values to the actual registers upon + MCS xfer request */ +} XMC_CCU8_SLICE_MCMS_ACTION_t; + +/** + * Available Interrupt Event Ids + */ +typedef enum XMC_CCU8_SLICE_IRQ_ID +{ + XMC_CCU8_SLICE_IRQ_ID_PERIOD_MATCH = 0U , /**< Period match counting up */ + XMC_CCU8_SLICE_IRQ_ID_ONE_MATCH = 1U , /**< One match counting down */ + XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_UP_CH_1 = 2U , /**< Compare match counting up for channel 1 */ + XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_DOWN_CH_1 = 3U , /**< Compare match counting down for channel 1 */ + XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_UP_CH_2 = 4U , /**< Compare match counting up for channel 2 */ + XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_DOWN_CH_2 = 5U , /**< Compare match counting down for channel 2 */ + XMC_CCU8_SLICE_IRQ_ID_EVENT0 = 8U , /**< Event-0 occurrence */ + XMC_CCU8_SLICE_IRQ_ID_EVENT1 = 9U , /**< Event-1 occurrence */ + XMC_CCU8_SLICE_IRQ_ID_EVENT2 = 10U, /**< Event-2 occurrence */ + XMC_CCU8_SLICE_IRQ_ID_TRAP = 11U /**< Trap occurrence */ +} XMC_CCU8_SLICE_IRQ_ID_t; + +/** + * Available Interrupt Event Ids, which is added to support multi event APIs + */ +typedef enum XMC_CCU8_SLICE_MULTI_IRQ_ID +{ + XMC_CCU8_SLICE_MULTI_IRQ_ID_PERIOD_MATCH = 0x1U, /**< Period match counting up */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_ONE_MATCH = 0x2U, /**< One match counting down */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_COMPARE_MATCH_UP_CH_1 = 0x4U, /**< Compare match counting up for channel 1 */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_COMPARE_MATCH_DOWN_CH_1 = 0x8U, /**< Compare match counting down for channel 1 */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_COMPARE_MATCH_UP_CH_2 = 0x10U, /**< Compare match counting up for channel 2 */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_COMPARE_MATCH_DOWN_CH_2 = 0x20U, /**< Compare match counting down for channel 2 */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_EVENT0 = 0x100U, /**< Event-0 occurrence */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_EVENT1 = 0x200U, /**< Event-1 occurrence */ + XMC_CCU8_SLICE_MULTI_IRQ_ID_EVENT2 = 0x400U, /**< Event-2 occurrence */ +} XMC_CCU8_SLICE_MULTI_IRQ_ID_t; + +/** + * Service Request Lines for CCU8. Event are mapped to these SR lines and these are used to generate the interrupt. + */ +typedef enum XMC_CCU8_SLICE_SR_ID +{ + XMC_CCU8_SLICE_SR_ID_0 = 0U, /**< Service Request Line-0 selected */ + XMC_CCU8_SLICE_SR_ID_1 , /**< Service Request Line-1 selected */ + XMC_CCU8_SLICE_SR_ID_2 , /**< Service Request Line-2 selected */ + XMC_CCU8_SLICE_SR_ID_3 /**< Service Request Line-3 selected */ +} XMC_CCU8_SLICE_SR_ID_t; + + +/** + * Slice shadow transfer options. + */ +typedef enum XMC_CCU8_SHADOW_TRANSFER +{ + XMC_CCU8_SHADOW_TRANSFER_SLICE_0 = CCU8_GCSS_S0SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-0 */ + XMC_CCU8_SHADOW_TRANSFER_DITHER_SLICE_0 = CCU8_GCSS_S0DSE_Msk, /**< Transfer Dither compare shadow register value + to actual register for SLICE-0 */ + XMC_CCU8_SHADOW_TRANSFER_PRESCALER_SLICE_0 = CCU8_GCSS_S0PSE_Msk, /**< Transfer Prescaler shadow register value to + actual register for SLICE-0 */ + XMC_CCU8_SHADOW_TRANSFER_SLICE_1 = CCU8_GCSS_S1SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-1 */ + XMC_CCU8_SHADOW_TRANSFER_DITHER_SLICE_1 = CCU8_GCSS_S1DSE_Msk, /**< Transfer Dither compare shadow register value + to actual registers for SLICE-1 */ + XMC_CCU8_SHADOW_TRANSFER_PRESCALER_SLICE_1 = CCU8_GCSS_S1PSE_Msk, /**< Transfer Prescaler shadow register value to + actual register for SLICE-1 */ + XMC_CCU8_SHADOW_TRANSFER_SLICE_2 = CCU8_GCSS_S2SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-2 */ + XMC_CCU8_SHADOW_TRANSFER_DITHER_SLICE_2 = CCU8_GCSS_S2DSE_Msk, /**< Transfer Dither compare shadow register value + to actual register for SLICE-2 */ + XMC_CCU8_SHADOW_TRANSFER_PRESCALER_SLICE_2 = CCU8_GCSS_S2PSE_Msk, /**< Transfer Prescaler shadow register value to + actual register for SLICE-2 */ + XMC_CCU8_SHADOW_TRANSFER_SLICE_3 = CCU8_GCSS_S3SE_Msk, /**< Transfer Period, Compare and Passive Level + shadow register values to actual registers for + SLICE-3 */ + XMC_CCU8_SHADOW_TRANSFER_DITHER_SLICE_3 = CCU8_GCSS_S3DSE_Msk, /**< Transfer Dither compare shadow register value + to actual register for SLICE-3 */ + XMC_CCU8_SHADOW_TRANSFER_PRESCALER_SLICE_3 = CCU8_GCSS_S3PSE_Msk /**< Transfer Prescaler shadow register value to + actual register for SLICE-3 */ +} XMC_CCU8_SHADOW_TRANSFER_t; + +#if (UC_SERIES != XMC45) || defined(DOXYGEN) +/** + * Slice shadow transfer mode options. + * @note Not available for XMC4500 series + */ +typedef enum XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE +{ + XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE_IN_PERIOD_MATCH_AND_ONE_MATCH = 0U, /**< Shadow transfer is done in Period Match and + One match. */ + XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE_ONLY_IN_PERIOD_MATCH = 1U, /**< Shadow transfer is done only in Period Match. */ + XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE_ONLY_IN_ONE_MATCH = 2U /**< Shadow transfer is done only in One Match. */ +} XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE_t; +#endif + +#if defined(CCU8V3) || defined(DOXYGEN) /* Defined for XMC1400 devices only */ +/** + * Output sources for OUTy0 signal + * @note Only available for XMC1400 series + */ + typedef enum XMC_CCU8_SOURCE_OUT0 +{ + XMC_CCU8_SOURCE_OUT0_ST1 = (uint32_t)0x0, /**< CCU8yST1 signal path is connected the CCU8x.OUT0 */ + XMC_CCU8_SOURCE_OUT0_INV_ST1 = (uint32_t)0x1, /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT0 */ + XMC_CCU8_SOURCE_OUT0_ST2 = (uint32_t)0x2, /**< CCU8yST2 signal path is connected the CCU8x.OUT0 */ + XMC_CCU8_SOURCE_OUT0_INV_ST2 = (uint32_t)0x3 /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT0 */ +} XMC_CCU8_SOURCE_OUT0_t; + +/** + * Output sources for OUTy1 signal + * @note Only available for XMC1400 series + */ + typedef enum XMC_CCU8_SOURCE_OUT1 +{ + XMC_CCU8_SOURCE_OUT1_ST1 = (uint32_t)0x1, /**< CCU8yST1 signal path is connected the CCU8x.OUT1 */ + XMC_CCU8_SOURCE_OUT1_INV_ST1 = (uint32_t)0x0, /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT1 */ + XMC_CCU8_SOURCE_OUT1_ST2 = (uint32_t)0x3, /**< CCU8yST2 signal path is connected the CCU8x.OUT1 */ + XMC_CCU8_SOURCE_OUT1_INV_ST2 = (uint32_t)0x2 /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT1 */ +} XMC_CCU8_SOURCE_OUT1_t; + +/** + * Output sources for OUTy2 signal + * @note Only available for XMC1400 series + */ + typedef enum XMC_CCU8_SOURCE_OUT2 +{ + XMC_CCU8_SOURCE_OUT2_ST2 = (uint32_t)0x0, /**< CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_SOURCE_OUT2_INV_ST2 = (uint32_t)0x1, /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_SOURCE_OUT2_ST1 = (uint32_t)0x2, /**< CCU8yST1 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_SOURCE_OUT2_INV_ST1 = (uint32_t)0x3 /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT2 */ +} XMC_CCU8_SOURCE_OUT2_t; + +/** + * Output sources for OUTy3 signal + * @note Only available for XMC1400 series + */ + typedef enum XMC_CCU8_SOURCE_OUT3 +{ + XMC_CCU8_SOURCE_OUT3_ST2 = (uint32_t)0x1, /**< CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_SOURCE_OUT3_INV_ST2 = (uint32_t)0x0, /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_SOURCE_OUT3_ST1 = (uint32_t)0x3, /**< CCU8yST1 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_SOURCE_OUT3_INV_ST1 = (uint32_t)0x2 /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT2 */ +} XMC_CCU8_SOURCE_OUT3_t; +#endif + + +/** + * Output selector for CCU8x.OUT0-3 + */ +#if !defined(CCU8V3) /* Defined for all devices except XMC1400 */ +typedef enum XMC_CCU8_OUT_PATH +{ + XMC_CCU8_OUT_PATH_OUT0_ST1 = (uint32_t)0x20000, /**< CCU8yST1 signal path is connected the CCU8x.OUT0 */ + XMC_CCU8_OUT_PATH_OUT0_INV_ST1 = (uint32_t)0x20002, /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT0 */ + XMC_CCU8_OUT_PATH_OUT1_ST1 = (uint32_t)0x40000, /**< CCU8yST1 signal path is connected the CCU8x.OUT1 */ + XMC_CCU8_OUT_PATH_OUT1_INV_ST1 = (uint32_t)0x40004, /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT1 */ + XMC_CCU8_OUT_PATH_OUT2_ST2 = (uint32_t)0x80000, /**< CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_OUT_PATH_OUT2_INV_ST2 = (uint32_t)0x80008, /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_OUT_PATH_OUT3_ST2 = (uint32_t)0x100000,/**< CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_OUT_PATH_OUT3_INV_ST1 = (uint32_t)0x100010 /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT3 */ +} XMC_CCU8_OUT_PATH_t; +#else +typedef enum XMC_CCU8_OUT_PATH +{ + XMC_CCU8_OUT_PATH_OUT0_ST1 = (uint32_t)0x000C0, /**< CCU8yST1 signal path is connected the CCU8x.OUT0 */ + XMC_CCU8_OUT_PATH_OUT0_INV_ST1 = (uint32_t)0x000D0, /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT0 */ + XMC_CCU8_OUT_PATH_OUT0_ST2 = (uint32_t)0x000E0, /**< CCU8yST2 signal path is connected the CCU8x.OUT0. @note Only available for XMC1400 series*/ + XMC_CCU8_OUT_PATH_OUT0_INV_ST2 = (uint32_t)0x000F0, /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT0. @note Only available for XMC1400 series*/ + XMC_CCU8_OUT_PATH_OUT1_ST1 = (uint32_t)0x00D00, /**< CCU8yST1 signal path is connected the CCU8x.OUT1 */ + XMC_CCU8_OUT_PATH_OUT1_INV_ST1 = (uint32_t)0x00C00, /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT1 */ + XMC_CCU8_OUT_PATH_OUT1_ST2 = (uint32_t)0x00F00, /**< CCU8yST2 signal path is connected the CCU8x.OUT1. @note Only available for XMC1400 series*/ + XMC_CCU8_OUT_PATH_OUT1_INV_ST2 = (uint32_t)0x00E00, /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT1. @note Only available for XMC1400 series */ + XMC_CCU8_OUT_PATH_OUT2_ST2 = (uint32_t)0x0C000, /**< CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_OUT_PATH_OUT2_INV_ST2 = (uint32_t)0x0D000, /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT2 */ + XMC_CCU8_OUT_PATH_OUT2_ST1 = (uint32_t)0x0E000, /**< CCU8yST1 signal path is connected the CCU8x.OUT2. @note Only available for XMC1400 series*/ + XMC_CCU8_OUT_PATH_OUT2_INV_ST1 = (uint32_t)0x0F000, /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT2.@note Only available for XMC1400 series */ + XMC_CCU8_OUT_PATH_OUT3_ST2 = (uint32_t)0xD0000, /**< CCU8yST2 signal path is connected the CCU8x.OUT3 */ + XMC_CCU8_OUT_PATH_OUT3_INV_ST2 = (uint32_t)0xC0000, /**< Inverted CCU8yST2 signal path is connected the CCU8x.OUT3.@note Only available for XMC1400 series */ + XMC_CCU8_OUT_PATH_OUT3_ST1 = (uint32_t)0xF0000, /**< CCU8yST1 signal path is connected the CCU8x.OUT3.@note Only available for XMC1400 series */ + XMC_CCU8_OUT_PATH_OUT3_INV_ST1 = (uint32_t)0xE0000 /**< Inverted CCU8yST1 signal path is connected the CCU8x.OUT3 */ +} XMC_CCU8_OUT_PATH_t; + +/** + * Immediate write into configuration register + * @note Only available for XMC1400 series + */ +typedef enum XMC_CCU8_SLICE_WRITE_INTO +{ + XMC_CCU8_SLICE_WRITE_INTO_PERIOD_CONFIGURATION = CCU8_CC8_STC_IRPC_Msk, /**< Immediate or Coherent + Write into Period + Configuration */ + XMC_CCU8_SLICE_WRITE_INTO_COMPARE1_CONFIGURATION = CCU8_CC8_STC_IRCC1_Msk, /**< Immediate or Coherent + Write into Compare 1 + Configuration */ + XMC_CCU8_SLICE_WRITE_INTO_COMPARE2_CONFIGURATION = CCU8_CC8_STC_IRCC2_Msk, /**< Immediate or Coherent + Write into Compare 2 + Configuration */ + XMC_CCU8_SLICE_WRITE_INTO_PASSIVE_LEVEL_CONFIGURATION = CCU8_CC8_STC_IRLC_Msk, /**< Immediate or Coherent + Write into Passive Level + Configuration */ + XMC_CCU8_SLICE_WRITE_INTO_DITHER_VALUE_CONFIGURATION = CCU8_CC8_STC_IRDC_Msk, /**< Immediate or Coherent + Write into Dither Value + Configuration */ + XMC_CCU8_SLICE_WRITE_INTO_FLOATING_PRESCALER_VALUE_CONFIGURATION = CCU8_CC8_STC_IRFC_Msk /**< Immediate or Coherent + Write into Floating Prescaler + Value Configuration */ +} XMC_CCU8_SLICE_WRITE_INTO_t; + + +/** + * Automatic Shadow Transfer request when writing into shadow register + * @note Only available for XMC1400 series + */ +typedef enum XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO +{ + XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_PERIOD_SHADOW = CCU8_CC8_STC_ASPC_Msk, /**< Automatic Shadow + Transfer request when + writing into Period + Shadow Register */ + XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_COMPARE1_SHADOW = CCU8_CC8_STC_ASCC1_Msk, /**< Automatic Shadow + transfer request + when writing into + Compare 1 Shadow Register */ + XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_COMPARE2_SHADOW = CCU8_CC8_STC_ASCC2_Msk, /**< Automatic Shadow + transfer request + when writing into + Compare 2 Shadow Register */ + XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_PASSIVE_LEVEL = CCU8_CC8_STC_ASLC_Msk, /**< Automatic Shadow transfer + request when writing + into Passive Level Register*/ + XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_DITHER_SHADOW = CCU8_CC8_STC_ASDC_Msk, /**< Automatic Shadow transfer + request when writing + into Dither Shadow Register */ + XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_FLOATING_PRESCALER_SHADOW = CCU8_CC8_STC_ASFC_Msk /**< Automatic Shadow transfer + request when writing + into Floating Prescaler Shadow + register */ + +} XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_t; +#endif +/** + * CCU8 slice mask which can be used for the APIs as input where multi slice support is available + */ +typedef enum XMC_CCU8_SLICE_MASK +{ + XMC_CCU8_SLICE_MASK_SLICE_0 = 1U , /**< SLICE-0 */ + XMC_CCU8_SLICE_MASK_SLICE_1 = 2U , /**< SLICE-1 */ + XMC_CCU8_SLICE_MASK_SLICE_2 = 4U , /**< SLICE-2 */ + XMC_CCU8_SLICE_MASK_SLICE_3 = 8U /**< SLICE-3 */ +} XMC_CCU8_SLICE_MASK_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/** + * Configuration data structure of an External Event(Event-0/1/2). + * Needed to configure the various aspects of an External Event. + * This structure will not connect the external event with an external function. + */ +typedef struct XMC_CCU8_SLICE_EVENT_CONFIG +{ + XMC_CCU8_SLICE_INPUT_t mapped_input; /**< Required input signal for the Event. */ + XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_t edge; /**< Select the event edge of the input signal. + This is needed for an edge sensitive External function.*/ + XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_t level; /**< Select the event level of the input signal. + This is needed for an level sensitive External function.*/ + XMC_CCU8_SLICE_EVENT_FILTER_t duration; /**< Low Pass filter duration in terms of fCCU clock cycles. */ +} XMC_CCU8_SLICE_EVENT_CONFIG_t; + +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * Dead Time configuration + */ +typedef struct XMC_CCU8_SLICE_DEAD_TIME_CONFIG +{ + union + { + struct + { + uint32_t enable_dead_time_channel1 : 1; /**< Enable dead time for Compare Channel-1 */ + uint32_t enable_dead_time_channel2 : 1; /**< Enable dead time for Compare Channel-2 */ + uint32_t channel1_st_path : 1; /**< Should dead time be applied to ST output of Compare Channel-1? */ + uint32_t channel1_inv_st_path : 1; /**< Should dead time be applied to inverse ST output of + Compare Channel-1? */ + uint32_t channel2_st_path : 1; /**< Should dead time be applied to ST output of Compare Channel-2? */ + uint32_t channel2_inv_st_path : 1; /**< Should dead time be applied to inverse ST output of + Compare Channel-2? */ + uint32_t div : 2; /**< Dead time prescaler divider value. + Accepts enum ::XMC_CCU8_SLICE_DTC_DIV_t*/ + uint32_t : 24; + }; + uint32_t dtc; + }; + union + { + struct + { + uint32_t channel1_st_rising_edge_counter : 8; /**< Contains the delay value that is applied to the rising edge + for compare channel-1. Range: [0x0 to 0xFF] */ + uint32_t channel1_st_falling_edge_counter : 8; /**< Contains the delay value that is applied to the falling edge + for compare channel-1. Range: [0x0 to 0xFF] */ + uint32_t : 16; + }; + uint32_t dc1r; + }; + union + { + struct + { + uint32_t channel2_st_rising_edge_counter : 8; /**< Contains the delay value that is applied to the rising edge + for compare channel-2. Range: [0x0 to 0xFF]*/ + uint32_t channel2_st_falling_edge_counter : 8; /**< Contains the delay value that is applied to the falling edge + for compare channel-2. Range: [0x0 to 0xFF]*/ + uint32_t : 16; + }; + uint32_t dc2r; + }; +} XMC_CCU8_SLICE_DEAD_TIME_CONFIG_t; + +/** + * Configuration data structure for CCU8 slice. Specifically configures the CCU8 slice to compare mode operation. + * This excludes event and function configuration. + */ +typedef struct XMC_CCU8_SLICE_COMPARE_CONFIG +{ + union + { + struct + { + uint32_t timer_mode : 1; /**< Edge aligned or Centre Aligned. + Accepts enum :: XMC_CCU8_SLICE_TIMER_COUNT_MODE_t */ + uint32_t monoshot : 1; /**< Single shot or Continuous mode . + Accepts enum :: XMC_CCU8_SLICE_TIMER_REPEAT_MODE_t */ + uint32_t shadow_xfer_clear : 1; /**< Should PR and CR shadow xfer happen when timer is cleared? */ + uint32_t : 10; + uint32_t dither_timer_period: 1; /**< Can the period of the timer dither? */ + uint32_t dither_duty_cycle : 1; /**< Can the compare match of the timer dither? */ + uint32_t : 1; + uint32_t prescaler_mode: 1; /**< Normal or floating prescaler mode. + Accepts enum :: XMC_CCU8_SLICE_PRESCALER_MODE_t */ + uint32_t : 8; + uint32_t mcm_ch1_enable : 1; /**< Multi-Channel mode for compare channel 1 enable? */ + uint32_t mcm_ch2_enable : 1; /**< Multi-Channel mode for compare channel 2 enable? */ + uint32_t : 2; + uint32_t slice_status : 2; /**< Which of the two channels drives the slice status output. + Accepts enum :: XMC_CCU8_SLICE_STATUS_t*/ + uint32_t : 1; + }; + uint32_t tc; + }; + union + { + struct + { + uint32_t passive_level_out0 : 1; /**< ST and OUT passive levels Configuration for OUT0. + Accepts enum :: XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_t */ + uint32_t passive_level_out1 : 1; /**< ST and OUT passive levels Configuration for OUT1. + Accepts enum :: XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_t */ + uint32_t passive_level_out2 : 1; /**< ST and OUT passive levels Configuration for OUT2. + Accepts enum :: XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_t */ + uint32_t passive_level_out3 : 1; /**< ST and OUT passive levels Configuration for OUT3. + Accepts enum :: XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_t */ + uint32_t : 28; + }; + uint32_t psl; + }; + union + { + struct + { + uint32_t asymmetric_pwm : 1; /**< Should the PWM be a function of the 2 compare channels + rather than period value? */ + #if !defined(CCU8V3) /* Defined for all devices except XMC1400 */ + uint32_t invert_out0 : 1; /**< Should inverted ST of Channel-1 be connected to OUT0? */ + uint32_t invert_out1 : 1; /**< Should inverted ST of Channel-1 be connected to OUT1? */ + uint32_t invert_out2 : 1; /**< Should inverted ST of Channel-2 be connected to OUT2? */ + uint32_t invert_out3 : 1; /**< Should inverted ST of Channel-2 be connected to OUT3? */ + uint32_t : 27; + #else + uint32_t : 3; + uint32_t selector_out0 : 2; /**< Connect ST or inverted ST of Channel-1 or Channel-2 be to OUT0 + Accepts enum :: XMC_CCU8_SOURCE_OUT0_t + refer OCS1 bit-field of CHC register. + @note Only available for XMC1400 series */ + uint32_t : 2; + uint32_t selector_out1 : 2; /**< Connect ST or inverted ST of Channel-1 or Channel-2 be to OUT1 + Accepts enum :: XMC_CCU8_SOURCE_OUT1_t + refer OCS2 bit-field of CHC register. + @note Only available for XMC1400 series */ + uint32_t : 2; + uint32_t selector_out2 : 2; /**< Connect ST or inverted ST of Channel-1 or Channel-2 be to OUT2 + Accepts enum :: XMC_CCU8_SOURCE_OUT2_t + refer OCS3 bit-field of CHC register. + @note Only available for XMC1400 series */ + uint32_t : 2; + uint32_t selector_out3 : 2; /**< Connect ST or inverted ST of Channel-1 or Channel-2 be to OUT3 + Accepts enum :: XMC_CCU8_SOURCE_OUT3_t + refer OCS4 bit-field of CHC register. + @note Only available for XMC1400 series */ + uint32_t : 14; + #endif + }; + uint32_t chc; + }; + uint32_t prescaler_initval : 4; /**< Initial prescaler divider value + Accepts enum :: XMC_CCU8_SLICE_PRESCALER_t */ + uint32_t float_limit : 4; /**< The max value which the prescaler divider can increment to. + Range : [0 to 15] */ + uint32_t dither_limit : 4; /**< The value that determines the spreading of dithering + Range : [0 to 15] */ + uint32_t timer_concatenation : 1; /**< Enables the concatenation of the timer if true*/ +} XMC_CCU8_SLICE_COMPARE_CONFIG_t; + +/** + * Configuration data structure for CCU8 slice. Specifically configures the CCU8 slice to capture mode operation. + * This excludes event and function configuration. + */ +typedef struct XMC_CCU8_SLICE_CAPTURE_CONFIG +{ + union + { + struct + { + uint32_t : 4; + uint32_t fifo_enable : 1; /**< Should the capture registers be setup as a FIFO?(Extended capture mode) */ + uint32_t timer_clear_mode : 2; /**< How should the timer register be cleared upon detection of capture event? + Accepts enum ::XMC_CCU8_SLICE_TIMER_CLEAR_MODE_t */ + uint32_t : 4; + uint32_t same_event : 1; /**< Should the capture event for C1V/C0V and C3V/C2V be same capture edge? */ + uint32_t ignore_full_flag : 1; /**< Should updates to capture registers follow full flag rules? */ + uint32_t : 3; + uint32_t prescaler_mode: 1; /**< Normal or floating prescaler Accepts enum :: XMC_CCU8_SLICE_PRESCALER_MODE_t*/ + uint32_t : 15; + }; + uint32_t tc; + }; + uint32_t prescaler_initval : 4; /**< Prescaler divider value */ + uint32_t float_limit : 4; /**< The max value which the prescaler divider can increment to */ + uint32_t timer_concatenation : 1; /**< Enables the concatenation of the timer */ +} XMC_CCU8_SLICE_CAPTURE_CONFIG_t; +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +__STATIC_INLINE bool XMC_CCU8_IsValidModule(const XMC_CCU8_MODULE_t *const module) +{ + bool tmp = false; + + tmp = (module == CCU80); + +#if defined(CCU81) + tmp = tmp || (module == CCU81); +#endif + + return tmp; +} + +__STATIC_INLINE bool XMC_CCU8_IsValidSlice(const XMC_CCU8_SLICE_t *const slice) +{ + bool tmp = false; + + tmp = (slice == CCU80_CC80); +#if defined(CCU80_CC81) + tmp = tmp || (slice == CCU80_CC81); +#endif +#if defined(CCU80_CC82) + tmp = tmp || (slice == CCU80_CC82); +#endif +#if defined(CCU80_CC83) + tmp = tmp || (slice == CCU80_CC83); +#endif +#if defined(CCU81) + tmp = tmp || (slice == CCU81_CC80); +#if defined(CCU81_CC81) + tmp = tmp || (slice == CCU81_CC81); +#endif +#if defined(CCU81_CC82) + tmp = tmp || (slice == CCU81_CC82); +#endif +#if defined(CCU81_CC83) + tmp = tmp || (slice == CCU81_CC83); +#endif +#endif + + return tmp; +} + +/** + * @param module Constant pointer to CCU8 module + * @param mcs_action multi-channel shadow transfer request configuration + * @return
+ * None
+ * + * \parDescription:
+ * Initialization of global register GCTRL.\n\n + * As part of module initialization, behaviour of the module upon detection + * Multi-Channel Mode trigger is configured. Will also invoke the XMC_CCU8_EnableModule(). + * The API call would bring up the required CCU8 module and also initialize the module for + * the required multi-channel shadow transfer. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_CompareInit()
XMC_CCU8_SLICE_CaptureInit(). + */ +void XMC_CCU8_Init(XMC_CCU8_MODULE_t *const module, const XMC_CCU8_SLICE_MCMS_ACTION_t mcs_action); + +/** + * @param module Constant pointer to CCU8 module + * @return
+ * None
+ * + * \parDescription:
+ * Enables the CCU8 module and brings it to active state.\n\n + * Also disables the gating of the clock signal (if applicable depending on the device being selected). + * Invoke this API before any operations are done on the CCU8 module. Invoked from XMC_CCU8_Init(). + * + * \parRelated APIs:
+ * XMC_CCU8_SetModuleClock()
XMC_CCU8_DisableModule()
XMC_CCU8_StartPrescaler(). + */ +void XMC_CCU8_EnableModule(XMC_CCU8_MODULE_t *const module); + +/** + * @param module Constant pointer to CCU8 module + * @return
+ * None
+ * + * \parDescription:
+ * Brings the CCU8 module to reset state and enables gating of the clock signal(if applicable depending + * on the device being selected).\n\n + * Invoke this API when a CCU8 module needs to be disabled completely. + * Any operation on the CCU8 module will have no effect after this API is called. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableModule()
XMC_CCU8_DisableModule(). + */ +void XMC_CCU8_DisableModule(XMC_CCU8_MODULE_t *const module); + +/** + * @param module Constant pointer to CCU8 module + * @param clock Choice of input clock to the module + * @return
+ * None
+ * + * \parDescription:
+ * Selects the Module Clock by configuring GCTRL.PCIS bits.\n\n + * There are 3 potential clock sources. This API helps to select the required clock source. + * Call to this API is valid after the XMC_CCU8_Init(). + * + * \parRelated APIs:
+ * None.
+ */ +void XMC_CCU8_SetModuleClock(XMC_CCU8_MODULE_t *const module, const XMC_CCU8_CLOCK_t clock); + + +/** + * @param module Constant pointer to CCU8 module + * @return
+ * None
+ * + * \parDescription:
+ * Starts the prescaler and restores clocks to the timer slices, by setting GIDLC.SPRB bit.
\n + * Once the input to the prescaler has been chosen and the prescaler divider of all slices programmed, + * the prescaler itself may be started. Invoke this API after XMC_CCU8_Init() + * (Mandatory to fully initialize the module). + * + * \parRelated APIs:
+ * XMC_CCU8_Init()
XMC_CCU8_EnableClock()
XMC_CCU8_DisableClock()
XMC_CCU8_StartPrescaler()
+ * XMC_CCU8_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU8_StartPrescaler(XMC_CCU8_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU8_StartPrescaler:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + module->GIDLC |= (uint32_t) CCU8_GIDLC_SPRB_Msk; +} + +/** + * @param module Constant pointer to CCU8 module + * @return
+ * None
+ * + * \parDescription:
+ * Stops the prescaler and blocks clocks to the timer slices, by setting GIDLS.CPRB bit.\n\n + * Clears the run bit of the prescaler. Ensures that the module clock is not supplied to + * the slices of the module. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableClock()
XMC_CCU8_DisableClock()
XMC_CCU8_StartPrescaler()
XMC_CCU8_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU8_StopPrescaler(XMC_CCU8_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU8_StopPrescaler:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + module->GIDLS |= (uint32_t) CCU8_GIDLS_CPRB_Msk; +} + +/** + * @param module Constant pointer to CCU8 module + * @return
+ * None
+ * + * \parDescription:
+ * Returns the state of the prescaler, by reading GSTAT.PRB bit.\n\n + * If clock is being supplied to the slices of the module then returns as true. + * + * \parRelated APIs:
+ * XMC_CCU8_StartPrescaler()
XMC_CCU8_StopPrescaler()
XMC_CCU8_EnableClock()
XMC_CCU8_DisableClock(). + */ +__STATIC_INLINE bool XMC_CCU8_IsPrescalerRunning(XMC_CCU8_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU8_IsPrescalerRunning:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + return((bool)((module->GSTAT & (uint32_t) CCU8_GSTAT_PRB_Msk) == CCU8_GSTAT_PRB_Msk)); +} + +/** + * @param module Constant pointer to CCU8 module + * @param clock_mask Slices whose clocks are to be enabled simultaneously. + * Bit location 0/1/2/3 represents slice-0/1/2/3 respectively. + * Range: [0x1 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Enables clocks of multiple slices at a time, by configuring GIDLC.CS0I, GIDLC.CS1I, GIDLC.CS2I, + * GIDLC.CS3I bits.\n\n + * Takes an input clock_mask, which determines the slices that would receive the clock. Bring them out + * of the idle state simultaneously. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableClock()
XMC_CCU8_DisableClock(). + */ +__STATIC_INLINE void XMC_CCU8_EnableMultipleClocks(XMC_CCU8_MODULE_t *const module, const uint8_t clock_mask) +{ + XMC_ASSERT("XMC_CCU8_EnableMultipleClocks:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + XMC_ASSERT("XMC_CCU8_EnableMultipleClocks:Invalid clock mask", (clock_mask < 16U)); + + module->GIDLC |= (uint32_t) clock_mask; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param compare_init Pointer to slice configuration structure + * @return
+ * None
+ * + * \parDescription:
+ * Initialization of a CC8 slice to compare mode, by configuring CC8yTC, CC8yCMC, CC8yPSC, CC8yDITH, CC8yPSL, + * CC8yFPCS, CC8yCHC registers.\n\n + * CC8 slice is configured with Timer configurations in this routine. Timer is stopped before initialization + * by calling XMC_CCU8_SLICE_StopTimer(). After initialization user has to explicitly enable + * the shadow transfer for the required values by calling XMC_CCU8_EnableShadowTransfer() with appropriate mask. + * + * \parRelated APIs:
+ * None. + */ +void XMC_CCU8_SLICE_CompareInit(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CONFIG_t *const compare_init); + +/** + * @param slice Constant pointer to CC8 Slice + * @param capture_init Pointer to slice configuration structure + * @return
+ * None
+ * + * \parDescription:
+ * Initialization of a CC8 slice to capture mode, by configuring CC8yTC, CC8yCMC, CC8yPSC,CC8yFPCS registers.\n\n + * CC8 slice is configured with Capture configurations in this routine. Timer is stopped before initialization + * by calling XMC_CCU8_SLICE_StopTimer(). After initialization user has to explicitly enable the shadow transfer + * for the required values by calling XMC_CCU8_EnableShadowTransfer() with appropriate mask. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_Capture0Config()
XMC_CCU8_SLICE_Capture1Config(). + */ +void XMC_CCU8_SLICE_CaptureInit(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_CAPTURE_CONFIG_t *const capture_init); + +/** + * @param module Constant pointer to CCU8 module + * @param slice_number Slice for which the clock should be Enabled. + * Range: [0x0 to 0x3] + * @return
+ * None
+ * + * \parDescription:
+ * Enables the slice timer clock, by configuring GIDLC.CS0I, GIDLC.CS1I, GIDLC.CS2I, + * GIDLC.CS3I bits according to the selected \a slice_number.\n\n + * It is possible to enable/disable clock at slice level. This uses the \b slice_number to indicate the + * slice whose clock needs to be enabled. Directly accessed register is GIDLC. + * + * \parRelated APIs:
+ * XMC_CCU8_DisableClock()
XMC_CCU8_EnableMultipleClocks()
XMC_CCU8_StartPrescaler()
XMC_CCU8_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU8_EnableClock(XMC_CCU8_MODULE_t *const module, const uint8_t slice_number) +{ + XMC_ASSERT("XMC_CCU8_EnableClock:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + XMC_ASSERT("XMC_CCU8_EnableClock:Invalid Slice Number", (slice_number < 4U)); + + module->GIDLC |= ((uint32_t) 1 << slice_number); +} + +/** + * @param module Constant pointer to CCU8 module + * @param slice_number Slice for which the clock should be disabled. + * Range: [0x0 to 0x3] + * @return
+ * None
+ * + * \parDescription:
+ * Disables the slice timer clock, by configuring GIDLS.SS0I, GIDLS.SSS1I, GIDLS.SSS2I, + * GIDLS.SSS3I bits according to the selected \a slice_number .\n\n + * It is possible to disable clock at slice level using the module pointer. + * \b slice_number is used to disable the clock to a given slice of the module. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableClock()
XMC_CCU8_EnableMultipleClocks()
XMC_CCU8_StartPrescaler()
XMC_CCU8_StopPrescaler(). + */ +__STATIC_INLINE void XMC_CCU8_DisableClock(XMC_CCU8_MODULE_t *const module, const uint8_t slice_number) +{ + XMC_ASSERT("XMC_CCU8_DisableClock:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + XMC_ASSERT("XMC_CCU8_DisableClock:Invalid Slice Number", (slice_number < 4U)); + + module->GIDLS |= ((uint32_t) 1 << slice_number); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param out_path_msk configuration for output path selection. + * combination of XMC_CCU8_OUT_PATH_t enum items can be used to create a mask. + * + * @return
+ * None
+ * + * \parDescription:
+ * Configure the out the path of the two compare channels with specified ST signal, by configuring the + ^ CC8yCHC register.\n\n + * + * For the two compare channels it is possible to select either direct ST signal or inverted ST signal. + * \b out_path_msk is used to set the required out put path. + * + * \parRelated APIs:
+ * None +*/ +void XMC_CCU8_SLICE_SetOutPath(XMC_CCU8_SLICE_t *const slice, const uint32_t out_path_msk); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the External Start Function + * @param start_mode Behaviour of slice when the start function is activated + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Start Function of the slice, by configuring CC8yCMC.ENDS and CC8yTC.ENDM bits.\n\n + * Start function is mapped with one of the 3 events. An external signal can control when a CC8 timer should start. + * Additionally, the behaviour of the slice upon activation of the start function is configured as well. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StopConfig()
XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_StartConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_START_MODE_t start_mode); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the External Stop Function + * @param end_mode Behaviour of slice when the stop function is activated + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Stop function for the slice, by configuring CC8yCMC.STRTS and CC8yTC.STRM bits.\n\n + * Stop function is mapped with one of the 3 events. An external signal can control when a CCU8 timer should stop. + * Additionally, the behaviour of the slice upon activation of the stop function is configured as well. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StartConfig()
XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_StopConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_END_MODE_t end_mode); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the External load Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Load Function for the slice, by configuring CC8yCMC.LDS bit.\n\n + * Load function is mapped with one of the 3 events. Up on occurrence of the event,\n + * if CC8yTCST.CDIR set to 0,CC8yTIMER register is reloaded with the value from compare channel 1 or + * compare channel 2\n + * if CC8yTCST.CDIR set to 1,CC8yTIMER register is reloaded with the value from period register\n + * + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_LoadConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC8 Slice + * @param ch_num Select which compare channel value has to be loaded to the Timer register during external load event. + * @return
+ * None
+ * + * \parDescription:
+ * Up on occurrence of the external load event, if CC8yTCST.CDIR set to 0, CC8yTIMER register can be reloaded\n + * with the value from compare channel 1 or compare channel 2\n + * If CC8yTC.TLS is 0, compare channel 1 value is loaded to the CC8yTIMER register\n + * If CC8yTC.TLS is 1, compare channel 2 value is loaded to the CC8yTIMER register\n + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_LoadSelector(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_COMPARE_CHANNEL_t ch_num); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the External Modulation Function + * @param mod_mode Desired Modulation mode + * @param channel Specify the channel(s) on which the modulation should be applied. + * @param synch_with_pwm Option to synchronize modulation with PWM start + * Pass \b true if the modulation needs to be synchronized with PWM signal. + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Output Modulation Function of the slice, by configuring CC8yCMC.MOS, CC8yTC.EMT and + * CC8yTC.EMS bits.\n\n + * Modulation function is mapped with one of the 3 events. The output signal of the CCU can + * be modulated according to a external input. Additionally, the behaviour of the slice upon activation + * of the modulation function is configured as well. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_ModulationConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_MODULATION_MODE_t mod_mode, + const XMC_CCU8_SLICE_MODULATION_CHANNEL_t channel, + const bool synch_with_pwm + ); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the External Count Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Count Function of the slice, by configuring CC8yCMC.CNTS bit.\n\n + * Count function is mapped with one of the 3 events. CCU8 slice can take an external + * signal to act as the counting event. The CCU8 slice would count the + * edges present on the \b event selected. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_CountConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the External Gating Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Gating Function of the slice, by configuring CC8yCMC.GATES bit.\n\n + * Gating function is mapped with one of the 3 events. A CCU8 slice can use an input signal that would + * operate as counter gating. If the configured Active level is detected the counter will gate all the pulses. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_GateConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the Capture-0 Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Capture-0 Function of the slice, by configuring CC8yCMC.CAP0S bit.\n\n + * Capture function is mapped with one of the 3 events. A CCU8 slice can be configured into capture-0 mode + * with the selected \b event. In this mode the CCU8 will capture the timer value into CC8yC0V and CC8yC1V. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_Capture0Config(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the Capture-1 Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Capture-1 Function of the slice, by configuring CC8yCMC.CAP1S bit.\n\n + * Capture function is mapped with one of the 3 events. A CCU8 slice can be configured into capture-1 + * mode with the selected \b event. In this mode the CCU8 will capture the timer value into CC8yC2V and CC8yC3V. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_Capture1Config(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * bool would return true if the extended capture read back mode is enabled
+ * + * \parDescription:
+ * Checks if Extended capture mode read is enabled for particular slice or not, by reading CC8yTC.ECM bit.\n\n + * In this mode the there is only one associated read address for all the capture registers. + * Individual capture registers can still be accessed in this mode. + * + * \parRelated APIs:
+ * XMC_CCU8_GetCapturedValueFromFifo(). + */ +__STATIC_INLINE bool XMC_CCU8_SLICE_IsExtendedCapReadEnabled(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_IsPrescalerRunning:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return((bool)((slice->TC & (uint32_t) CCU8_CC8_TC_ECM_Msk) == (uint32_t)CCU8_CC8_TC_ECM_Msk)); +} + +#if defined(CCU8V1) /* Defined for XMC4800, XMC4700, XMC4500, XMC4400, XMC4200, XMC4100 devices only */ +/** + * @param module Constant pointer to CCU8 module + * @param slice_number to check whether read value belongs to required slice or not + * @return
+ * int32_t Returns -1 if the FIFO value being retrieved is not from the \b slice_number. + * Returns the value captured in the \b slice_number, if captured value is from the correct slice. + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Read captured value from FIFO(ECRD register).\n\n + * This is applicable only in the Capture mode of operation. The signal whose timing characteristics are to be measured + * must be mapped to an event which in turn must be mapped to the capture function. Based on the capture criteria, the + * instant timer values are captured into capture registers. Timing characteristics of the input signal may then be + * derived/inferred from the captured values. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_IsExtendedCapReadEnabled(). + */ +int32_t XMC_CCU8_GetCapturedValueFromFifo(const XMC_CCU8_MODULE_t *const module, const uint8_t slice_number); +#else +/** + * @param slice Constant pointer to CC8 Slice + * @param set The capture register set from which the captured value is to be retrieved + * @return
+ * uint32_t Returns the value captured in the \b slice_number + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Read captured value from FIFO(CC8yECRD0 and CC8yECRD1).\n\n + * This is applicable only in the Capture mode of operation. The signal whose timing characteristics are to be measured + * must be mapped to an event which in turn must be mapped to the capture function. Based on the capture criteria, the + * instant timer values are captured into capture registers. Timing characteristics of the input signal may then be + * derived/inferred from the captured values. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_IsExtendedCapReadEnabled(). + * @note Defined for XMC4800, XMC4700, XMC4500, XMC4400, XMC4200, XMC4100 devices only. For other devices use XMC_CCU8_GetCapturedValueFromFifo() API + */ +uint32_t XMC_CCU8_SLICE_GetCapturedValueFromFifo(const XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_CAP_REG_SET_t set); +#endif + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Map an External event to the External Count Direction Function + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Count Direction of the slice, by configuring CC8yCMC.UDS bit.\n\n + * Count direction function is mapped with one of the 3 events. A slice can be configured to change the + * CC8yTIMER count direction depending on an external signal. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_DirectionConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event); + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Configures the status bit override Function of the slice, by configuring CC8yCMC.OFS bit.\n\n + * Status bit override function is mapped with one of the 3 events. A slice can be configured to change the + * output of the timer's CC8yST1 signal depending on an external signal. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent(). + */ +void XMC_CCU8_SLICE_StatusBitOverrideConfig(XMC_CCU8_SLICE_t *const slice); + +/** + * @param slice Constant pointer to CC8 Slice + * @param exit_mode How should a previously logged trap state be exited? + * @param synch_with_pwm Should exit of trap state be synchronized with PWM cycle start? + * @return
+ * None
+ * + * + * \parDescription:
+ * Configures the Trap Function of the slice, by configuring CC8yCMC.TS, CC8yTC.TRPSE, and CC8yTC.TRPSW bits.\n\n + * Trap function is mapped with Event-2. Criteria for exiting the trap state is configured. + * This trap function allows PWM outputs to react on the state of an input pin. + * Thus PWM output can be forced to inactive state upon detection of a trap. + * It is also possible to synchronize the trap function with the PWM signal using the \b synch_with_pwm. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureEvent()
XMC_CCU8_SLICE_SetInput(). + */ +void XMC_CCU8_SLICE_TrapConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_TRAP_EXIT_MODE_t exit_mode, + bool synch_with_pwm); + +/** + * @param slice Constant pointer to CC8 Slice + * @param ev1_config Pointer to event 1 configuration data + * @param ev2_config Pointer to event 2 configuration data + * @return
+ * None
+ * + * + * \parDescription:
+ * Map Status bit override function with an Event1 & Event 2 of the slice and configure CC8yINS register.\n\n + * Details such as the input mapped to the event, event detection criteria and Low Pass filter options are programmed + * by this routine for the events 1 & 2. Event-1 input would be the trigger to override the value. + * Event-2 input would be the override value. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StatusBitOverrideConfig(). + */ +void XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_CONFIG_t *const ev1_config, + const XMC_CCU8_SLICE_EVENT_CONFIG_t *const ev2_config); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event The External Event which needs to be configured. + * @param config Pointer to event configuration data. + * @return
+ * None
+ * + * \parDescription:
+ * Configures an External Event of the slice, by updating CC8yINS register .\n\n + * Details such as the input mapped to the event, event detection criteria and low pass filter + * options are programmed by this routine. The Event \b config will configure the input selection, + * the edge selection, the level selection and the Low pass filter for the event. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StartConfig()
XMC_CCU8_SLICE_StopConfig()
XMC_CCU8_SLICE_LoadConfig()
+ * XMC_CCU8_SLICE_ModulationConfig()
XMC_CCU8_SLICE_CountConfig()
XMC_CCU8_SLICE_GateConfig()
+ * XMC_CCU8_SLICE_Capture0Config()
XMC_CCU8_SLICE_Capture1Config()
XMC_CCU8_SLICE_DirectionConfig()
+ * XMC_CCU8_SLICE_StatusBitOverrideConfig()
XMC_CCU8_SLICE_TrapConfig(). + */ +void XMC_CCU8_SLICE_ConfigureEvent(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_EVENT_CONFIG_t *config); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event The External Event which needs to be configured. + * @param input One of the 16 inputs meant to be mapped to the desired event + * @return
+ * None
+ * + * + * \parDescription:
+ * Selects an input for an external event, by configuring CC8yINS register.\n\n + * It is possible to select one of the possible 16 input signals for a given Event. + * This configures the CC8yINS.EVxIS for the selected event. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StartConfig()
XMC_CCU8_SLICE_StopConfig()
XMC_CCU8_SLICE_LoadConfig()
+ * XMC_CCU8_SLICE_ModulationConfig()
XMC_CCU8_SLICE_CountConfig()
XMC_CCU8_SLICE_GateConfig()
+ * XMC_CCU8_SLICE_Capture0Config()
XMC_CCU8_SLICE_Capture1Config()
XMC_CCU8_SLICE_DirectionConfig()
+ * XMC_CCU8_SLICE_StatusBitOverrideConfig()
XMC_CCU8_SLICE_TrapConfig(). + */ +void XMC_CCU8_SLICE_SetInput(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_INPUT_t input); + +/** + * @param slice Constant pointer to CC8 Slice + * @param out_mask Output signals for which the Trap function needs to be activated. + * Use ::XMC_CCU8_SLICE_OUTPUT_t enum items to create a mask of choice, + * using a bit wise OR operation + * Range: [0x1 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Enables the trap feature, by setting CC8yTC.TRAPE0, CC8yTC.TRAPE1, CC8yTC.TRAPE2 and CC8yTC.TRAPE3 bit based on the + * \a out_mask.\n\n + * A particularly useful feature where the PWM output can be forced inactive upon detection of a trap. The trap signal + * can be the output of a sensing element which has just detected an abnormal electrical condition. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_TrapConfig()
XMC_CCU8_SLICE_DisableTrap()
XMC_CCU8_SLICE_ConfigureEvent()
+ * XMC_CCU8_SLICE_SetInput(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableTrap(XMC_CCU8_SLICE_t *const slice, const uint32_t out_mask) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableTrap:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TC |= (uint32_t)out_mask << CCU8_CC8_TC_TRAPE0_Pos; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param out_mask Output signals for which the Trap function needs to be deactivated. + * Use ::XMC_CCU8_SLICE_OUTPUT_t enum items to create a mask of choice, + * using a bit wise OR operation. + * Range: [0x1 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Disables the trap feature, by clearing CC8yTC.TRAPE0, CC8yTC.TRAPE1, CC8yTC.TRAPE2 and CC8yTC.TRAPE3 bit based on the + * \a out_mask.\n\n.\n\n + * This API will revert the changes done by XMC_CCU8_SLICE_EnableTrap(). + * This Ensures that the TRAP function has no effect on the output of the CCU8 slice. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableTrap(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableTrap(XMC_CCU8_SLICE_t *const slice, const uint32_t out_mask) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableTrap:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + + slice->TC &= ~((uint32_t)out_mask << CCU8_CC8_TC_TRAPE0_Pos); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * bool returns \b true if the Timer is running else it returns \b false. + * + * \parDescription:
+ * Returns the state of the timer (Either Running or stopped(idle)), by reading CC8yTCST.TRB bit. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StartTimer()
XMC_CCU8_SLICE_StopTimer(). + */ +__STATIC_INLINE bool XMC_CCU8_SLICE_IsTimerRunning(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetTimerStatus:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return(bool)(((slice->TCST) & CCU8_CC8_TCST_TRB_Msk) == (uint32_t)CCU8_CC8_TCST_TRB_Msk); +} + +/** + * @param slice Pointer to an instance of CC8 slice + * @return
+ * bool returns \b true if the dead time counter of Compare channel-1 is running else it returns \b false. + * + * \parDescription:
+ * Returns the state of the Dead time counter 1 (Either Running or stopped(idle)), by reading CC8yTCST.DTR1 bit. + * This returns the state of the dead time counter which is linked to Compare channel-1. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_IsDeadTimeCntr2Running(). + */ +__STATIC_INLINE bool XMC_CCU8_SLICE_IsDeadTimeCntr1Running(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_IsDeadTimeCntr1Running:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return(bool)(((slice->TCST) & CCU8_CC8_TCST_DTR1_Msk) == (uint32_t)CCU8_CC8_TCST_DTR1_Msk); +} + +/** + * @param slice Pointer to an instance of CC8 slice + * @return
+ * bool returns \b true if the dead time counter of Compare channel-2 is running else it returns \b false. + * + * \parDescription:
+ * Returns the state of the Dead time counter 2 (Either Running or stopped(idle)), by reading CC8yTCST.DTR2 bit. + * This returns the state of the dead time counter which is linked to Compare channel-2. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_IsDeadTimeCntr1Running(). + */ +__STATIC_INLINE bool XMC_CCU8_SLICE_IsDeadTimeCntr2Running(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_IsDeadTimeCntr2Running:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return(bool)(((slice->TCST) & CCU8_CC8_TCST_DTR2_Msk) == (uint32_t)CCU8_CC8_TCST_DTR2_Msk); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * ::XMC_CCU8_SLICE_TIMER_COUNT_DIR_t returns the direction in which the timer is counting. + * + * \parDescription:
+ * Returns the timer counting direction, by reading CC8yTCST.CDIR bit.\n\n + * This API will return the direction in which the timer is currently + * incrementing(XMC_CCU8_SLICE_TIMER_COUNT_DIR_UP) or decrementing (XMC_CCU8_SLICE_TIMER_COUNT_DIR_DOWN). + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE XMC_CCU8_SLICE_TIMER_COUNT_DIR_t XMC_CCU8_SLICE_GetCountingDir(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetCountingDir:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return((XMC_CCU8_SLICE_TIMER_COUNT_DIR_t)(((slice->TCST) & CCU8_CC8_TCST_CDIR_Msk) >> CCU8_CC8_TCST_CDIR_Pos)); +} +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Starts the timer counting operation, by setting CC8yTCSET.TRBS bit.\n\n + * It is necessary to have configured the CC8 slice before starting its timer. + * Before the Timer is started ensure that the clock is provided to the slice. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StopTimer(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_StartTimer(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_StartTimer:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TCSET = CCU8_CC8_TCSET_TRBS_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Stops the Timer.\n\n + * Timer counting operation can be stopped by invoking this API, by setting CC8yTCCLR.TRBC bit. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StartTimer(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_StopTimer(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_StopTimer:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TCCLR = (uint32_t) CCU8_CC8_TCCLR_TRBC_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Resets the timer count to zero, by setting CC8yTCCLR.TCC bit.\n\n + * A timer which has been stopped can still retain the last counted value. + * After invoking this API the timer value will be cleared. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StartTimer(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_ClearTimer(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_ClearTimer:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TCCLR = (uint32_t) CCU8_CC8_TCCLR_TCC_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Stops and resets the timer count to zero, by setting CC8yTCCLR.TCC and CC8yTCCLR.TRBC bit.\n\n + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_StartTimer(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_StopClearTimer(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_StopClearTimer:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TCCLR = CCU8_CC8_TCCLR_TRBC_Msk | CCU8_CC8_TCCLR_TCC_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * ::XMC_CCU8_SLICE_MODE_t returns XMC_CCU8_SLICE_MODE_COMPARE if the slice is operating in compare mode + * returns XMC_CCU8_SLICE_MODE_CAPTURE if the slice is operating in capture mode + * + * \parDescription:
+ * Retrieves the current mode of operation in the slice (either Capture mode or Compare mode), by reading + * CC8yTC.CMOD bit.\n\n + * Ensure that before invoking this API the CCU8 slice should be configured otherwise the output of this API is + * invalid. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE XMC_CCU8_SLICE_MODE_t XMC_CCU8_SLICE_GetSliceMode(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetSliceMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return((XMC_CCU8_SLICE_MODE_t)(((slice->TC) & CCU8_CC8_TC_CMOD_Msk) >> CCU8_CC8_TC_CMOD_Pos)); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param mode Desired repetition mode (Either single shot or Continuous) + * @return
+ * None
+ * + * \parDescription:
+ * Configures the Timer to either Single shot mode or continuous mode, by configuring CC8yTC.TSSM bit.\n\n + * The timer will count up to the terminal count as specified in the period register and stops immediately if the repeat + * mode has been set to single shot. In the continuous mode of operation, the timer starts counting all over again after + * reaching the terminal count. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_GetTimerRepeatMode(). + */ +void XMC_CCU8_SLICE_SetTimerRepeatMode(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_TIMER_REPEAT_MODE_t mode); + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * ::XMC_CCU8_SLICE_TIMER_REPEAT_MODE_t returns XMC_CCU8_SLICE_TIMER_REPEAT_MODE_REPEAT if continuous mode is selected + * returns XMC_CCU8_SLICE_TIMER_REPEAT_MODE_SINGLE if single shot mode is selected + * + * \parDescription:
+ * Retrieves the Timer repeat mode, either Single shot mode or continuous mode, by reading CC8yTC.TSSM bit.\n\n + * The timer will count upto the terminal count as specified in the period register and stops immediately if the repeat + * mode has been set to single shot mode. In the continuous mode of operation, the timer starts counting + * all over again after reaching the terminal count. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetTimerRepeatMode(). + */ +__STATIC_INLINE XMC_CCU8_SLICE_TIMER_REPEAT_MODE_t XMC_CCU8_SLICE_GetTimerRepeatMode( + const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetTimerRepeatMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return((XMC_CCU8_SLICE_TIMER_REPEAT_MODE_t)(((slice->TC) & CCU8_CC8_TC_TSSM_Msk) >> CCU8_CC8_TC_TSSM_Pos)); +} +/** + * @param slice Constant pointer to CC8 Slice + * @param mode Desired counting mode (Either Edge Aligned or Center Aligned) + * @return
+ * None
+ * + * \parDescription:
+ * Configures the timer counting mode either Edge Aligned or Center Aligned, by configuring CC8yTC.TCM bit.\n\n + * In the edge aligned mode, the timer counts from 0 to the terminal count. Once the timer count has reached a preset + * compare value, the timer status output asserts itself. It will now deassert only after the timer count reaches the + * terminal count.\n In the center aligned mode, the timer first counts from 0 to the terminal count and then back to 0. + * During this upward and downward counting, the timer status output stays asserted as long as the timer value is + * greater than the compare value. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_GetTimerCountingMode(). + */ +void XMC_CCU8_SLICE_SetTimerCountingMode(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_TIMER_COUNT_MODE_t mode); + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * ::XMC_CCU8_SLICE_TIMER_COUNT_MODE_t returns XMC_CCU8_SLICE_TIMER_COUNT_MODE_EA if edge aligned mode is selected + * returns XMC_CCU8_SLICE_TIMER_COUNT_MODE_CA if center aligned mode is selected + * + * \parDescription:
+ * Retrieves timer counting mode either Edge aligned or Center Aligned, by reading CC8yTC.TCM bit.\n\n + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetTimerCountingMode(). + */ +__STATIC_INLINE XMC_CCU8_SLICE_TIMER_COUNT_MODE_t XMC_CCU8_SLICE_GetTimerCountingMode( + const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetTimerCountingMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return((XMC_CCU8_SLICE_TIMER_COUNT_MODE_t)(((slice->TC) & CCU8_CC8_TC_TCM_Msk) >> CCU8_CC8_TC_TCM_Pos)); +} +/** + * @param slice Constant pointer to CC8 Slice + * @param period_val Timer period value + * Range: [0x0 to 0xFFFF] + * @return
+ * None
+ * + * \parDescription:
+ * Programs the timer period, by writing CC8yPRS register.\n\n + * The frequency of counting/ PWM frequency is determined by this value. The period value is written to a shadow + * register. Explicitly enable the shadow transfer for the the period value by calling + * XMC_CCU8_EnableShadowTransfer() with appropriate mask. If shadow transfer is enabled and the timer is running, + * a period match transfers the value from the shadow register to the actual period register. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_GetTimerPeriodMatch(). + */ +void XMC_CCU8_SLICE_SetTimerPeriodMatch(XMC_CCU8_SLICE_t *const slice, const uint16_t period_val); + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * uint16_t returns the current timer period value + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Retrieves the timer period value currently effective, by reading CC8yPR register.\n\n + * If the timer is active then the value being returned is currently being used for the PWM period. + * + * \parNote:
+ * The XMC_CCU8_SLICE_SetTimerPeriodMatch() would set the new period value to a shadow register. + * This would only transfer the new values into the actual period register if the shadow transfer request + * is enabled and if a period match occurs. Hence a consecutive call to XMC_CCU8_SLICE_GetTimerPeriodMatch() + * would not reflect the new values until the shadow transfer completes. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetTimerPeriodMatch(). + */ +__STATIC_INLINE uint16_t XMC_CCU8_SLICE_GetTimerPeriodMatch(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetTimerPeriodMatch:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return((uint16_t) slice->PR); +} +/** + * @param slice Constant pointer to CC8 Slice + * @param channel Select the compare channel to which the \b compare_val has to programmed. + * @param compare_val Timer compare value + * @return
+ * None
+ * + * \parDescription:
+ * Programs the timer compare value, by writing CC8yCR1S and CC8yCR2S registers.\n\n + * The PWM duty cycle is determined by this value.\n\n + * The compare value is written to a shadow register. Explicitly enable the shadow transfer for + * the the period/compare value by calling XMC_CCU8_EnableShadowTransfer() with + * appropriate mask.If shadow transfer is enabled and the timer is running, + * a period match transfers the value from the shadow register to the actual compare register. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableShadowTransfer(). + */ +void XMC_CCU8_SLICE_SetTimerCompareMatch(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t channel, + const uint16_t compare_val); + +/** + * @param slice Constant pointer to CC8 Slice + * @param compare_val Timer compare value + * @return
+ * None
+ * + * \parDescription:
+ * Programs the timer compare1 value, by writing CC8yCR1S register.\n\n + * The PWM duty cycle is determined by this value.\n\n + * The compare value is written to a shadow register. Explicitly enable the shadow transfer for + * the the period/compare value by calling XMC_CCU8_EnableShadowTransfer() with appropriate mask. + * If shadow transfer is enabled and the timer is running, a period match transfers the value from + * the shadow register to the actual compare register. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableShadowTransfer(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_SetTimerCompareMatchChannel1(XMC_CCU8_SLICE_t *const slice, const uint16_t compare_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerCompareMatchChannel1:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->CR1S = (uint32_t) compare_val; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param compare_val Timer compare value + * @return
+ * None
+ * + * \parDescription:
+ * Programs the timer compare2 value, by writing CC8yCR2S register.\n\n + * The PWM duty cycle is determined by this value.\n\n + * The compare value is written to a shadow register. Explicitly enable the shadow transfer for + * the the period/compare value by calling XMC_CCU8_EnableShadowTransfer() with appropriate mask. + * If shadow transfer is enabled and the timer is running, a period match transfers the value from + * the shadow register to the actual compare register. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableShadowTransfer(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_SetTimerCompareMatchChannel2(XMC_CCU8_SLICE_t *const slice, const uint16_t compare_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerCompareMatchChannel2:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->CR2S = (uint32_t) compare_val; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param channel Select the compare channel to retrieve from. + * @return
+ * uint16_t returns the current timer compare value + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Retrieves the timer compare value currently effective, by reading CC8yCR1S and CC8yCR2S registers.\n\n + * If the timer is active then the value being returned is currently being for the PWM duty cycle( timer compare value). + * + * \parNote:
+ * The XMC_CCU8_SLICE_SetTimerCompareMatch() would set the new compare value to a shadow register. + * This would only transfer the new values into the actual compare register if the shadow transfer request + * is enabled and if a period match occurs. Hence a consecutive call to XMC_CCU8_SLICE_GetTimerCompareMatch() + * would not reflect the new values until the shadow transfer completes. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetTimerCompareMatch(). + */ +uint16_t XMC_CCU8_SLICE_GetTimerCompareMatch(const XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t channel); + +/** + * @param module Constant pointer to CCU8 module + * @param shadow_transfer_msk Shadow transfer request mask for various transfers. + * Use ::XMC_CCU8_SHADOW_TRANSFER_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Requests of shadow transfer for Period, Compare, Passive level, dither and prescaler, by configuring + * the GCSS register.\n\n + * The transfer from the shadow registers to the actual registers is done in the immediate next occurrence of the + * shadow transfer trigger after the API is called. + * + * Any call to XMC_CCU8_SLICE_SetTimerPeriodMatch()
XMC_CCU8_SLICE_SetTimerCompareMatch()
+ * XMC_XMC_CCU8_SLICE_SetPrescaler()
XMC_CCU8_SLICE_CompareInit()
XMC_CCU8_SLICE_CaptureInit(). + * must be succeeded by this API. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_CCU8_EnableShadowTransfer(XMC_CCU8_MODULE_t *const module, const uint32_t shadow_transfer_msk) +{ + XMC_ASSERT("XMC_CCU8_EnableShadowTransfer:Invalid module Pointer", XMC_CCU8_IsValidModule(module)); + module->GCSS = (uint32_t)shadow_transfer_msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * uint16_t returns the current timer value + * Range: [0x0 to 0xFFFF] + * + * \parDescription:
+ * Retrieves the latest timer value, from CC8yTIMER register.\n\n + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetTimerValue(). + */ +__STATIC_INLINE uint16_t XMC_CCU8_SLICE_GetTimerValue(const XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetTimerValue:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + return((uint16_t) slice->TIMER); +} +/** + * @param slice Constant pointer to CC8 Slice + * @param timer_val The new timer value that has to be loaded into the TIMER register. + * Range: [0x0 to 0xFFFF] + * @return
+ * None
+ * + * \parDescription:
+ * Loads a new timer value, by setting CC8yTIMER register.\n\n + * + * \parNote:
+ * Request to load is ignored if the timer is running. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_GetTimerValue(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_SetTimerValue(XMC_CCU8_SLICE_t *const slice, const uint16_t timer_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerValue:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TIMER = (uint32_t) timer_val; +} +/** + * @param slice Constant pointer to CC8 Slice + * @param period_dither Boolean instruction on dithering of period match + * @param duty_dither Boolean instruction on dithering of compare match + * @param spread Dither compare value + * @return
+ * None
+ * + * \parDescription:
+ * Enables dithering of PWM frequency and duty cycle, by configuring CC8yTC.DITHE and CC8yDITS bits.\n\n + * Some control loops are slow in updating PWM frequency and duty cycle. In such a case, a Bresenham style dithering + * can help reduce long term errors. Dithering can be applied to period and duty individually, + * this can be selected using the parameter \b period_dither and \b duty_dither. + * The \b spread would provide the dither compare value. If the dither counter value is less than this \b spread then + * the period/compare values would be dithered according to the dither mode selected. This API would invoke + * XMC_CCU8_SLICE_SetDitherCompareValue(). + * + * \parNote:
+ * After this API call, XMC_CCU8_EnableShadowTransfer() has to be called with appropriate mask + * to transfer the dither value. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_DisableDithering(). + */ +void XMC_CCU8_SLICE_EnableDithering(XMC_CCU8_SLICE_t *const slice, + const bool period_dither, + const bool duty_dither, + const uint8_t spread); + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Disables dithering of PWM frequency and duty cycle, by clearing CC8yTC.DITHE bits.\n\n + * This disables the Dither mode that was set in XMC_CCU8_SLICE_EnableDithering(). + * This API will not clear the dither compare value. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableDithering(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableDithering(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableDithering:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TC &= ~((uint32_t) CCU8_CC8_TC_DITHE_Msk); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Enables the floating prescaler, by setting CC8yTC.FPE bit.\n\n + * The prescaler divider starts with an initial value and increments upon every period match. It keeps incrementing + * until a ceiling (prescaler compare value) is hit and thereafter rolls back to the original prescaler divider value.\n + * It is necessary to have programmed an initial divider value and a compare value before the feature is enabled. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetFloatingPrescalerCompareValue()
XMC_CCU8_SLICE_DisableFloatingPrescaler()
+ * XMC_XMC_CCU8_SLICE_SetPrescaler(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableFloatingPrescaler(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableFloatingPrescaler:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TC |= (uint32_t) CCU8_CC8_TC_FPE_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Disables the floating prescaler, by clearing CC8yTC.FPE bit.\n\n + * This would return the prescaler to the normal mode. + * The prescaler that would be applied is the value present in CC8yPSC. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableFloatingPrescaler(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableFloatingPrescaler(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableFloatingPrescaler:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->TC &= ~((uint32_t) CCU8_CC8_TC_FPE_Msk); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param comp_val Dither compare value + * Range: [0x0 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Sets the dither spread/compare value, by setting CC8yDITS.DCVS bits.\n\n + * This value is the cornerstone of PWM dithering feature. Dithering is applied/done when the value in the + * dithering counter is less than this compare/spread value. For all dithering counter values greater than + * the spread value, there is no dithering. After setting the value XMC_CCU8_EnableShadowTransfer() has to be + * called with appropriate mask. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableDithering(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_SetDitherCompareValue(XMC_CCU8_SLICE_t *const slice, const uint8_t comp_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetDitherCompareValue:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetDitherCompareValue:Invalid Dither compare value", (comp_val <= 15U)); + + slice->DITS = comp_val; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param div_val Prescaler divider value + * Range: [0x0 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Programs the slice specific prescaler divider, by configuring the CC8yPSC and CC8yFPC registers.\n\n + * The prescaler divider may only be programmed after the prescaler run bit has been cleared + * by calling XMC_CCU8_StopPrescaler(). + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetFloatingPrescalerCompareValue(). + */ +void XMC_CCU8_SLICE_SetPrescaler(XMC_CCU8_SLICE_t *const slice, const uint8_t div_val); + +/** + * @param slice Constant pointer to CC8 Slice + * @param cmp_val Prescaler divider compare value + * Range: [0x0 to 0xF] + * @return
+ * None
+ * + * \parDescription:
+ * Programs the slice specific prescaler divider compare value, by configuring CC8yFPCS register.\n\n + * The compare value is applicable only in floating mode of operation. The prescaler divider starts with an initial + * value and increments to the compare value steadily upon every period match. Once prescaler divider + * equals the prescaler divider compare value, the value in the former resets back to the PVAL (from FPC). After setting + * the value, XMC_CCU8_EnableShadowTransfer() has to be called with appropriate mask. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetPrescaler(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_SetFloatingPrescalerCompareValue(XMC_CCU8_SLICE_t *const slice, + const uint8_t cmp_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetFloatingPrescalerCompareValue:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + /* First, write to the shadow register */ + slice->FPCS = (uint32_t) cmp_val; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param ch_num Compare channel for which the multi-channel mode is needed. + * @return
+ * None
+ * + * \parDescription:
+ * Enables the multichannel mode, by setting CC8yTC.MCME1 or CC8yTC.MCME1 bits based on the \a ch_num.\n\n + * The output state of the Timer slices can be controlled in parallel by a single input signal. + * A particularly useful feature in motor control applications where the PWM output of multiple slices of a module can + * be gated and ungated by multi-channel gating inputs connected to the slices. A peripheral like POSIF connected to the + * motor knows exactly which of the power drive switches are to be turned on and off at any instant. It can thus through + * a gating bus (known as multi-channel inputs) control which of the slices output stays gated/ungated. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_DisableMultiChannelMode()
XMC_CCU8_SetMultiChannelShadowTransferMode(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableMultiChannelMode(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t ch_num) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableMultiChannelMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_EnableMultiChannelMode:Invalid Channel", XMC_CCU8_SLICE_CHECK_COMP_CHANNEL(ch_num)); + + slice->TC |= (uint32_t)CCU8_CC8_TC_MCME1_Msk << ch_num; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param ch_num Compare channel for which the multi-channel mode needs to be disabled. + * @return
+ * None
+ * + * \parDescription:
+ * Disables the multichannel mode, by clearing CC8yTC.MCME1 or CC8yTC.MCME1 bits based on the \a ch_num.\n\n + * Returns the slices to the normal operation mode. This takes the slice number as input and + * configures the multi channel mode for it. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableMultiChannelMode(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableMultiChannelMode(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t ch_num) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableMultiChannelMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_DisableMultiChannelMode:Invalid Channel", XMC_CCU8_SLICE_CHECK_COMP_CHANNEL(ch_num)); + + slice->TC &= ~((uint32_t)CCU8_CC8_TC_MCME1_Msk << ch_num); +} + +/** + * @param module Constant pointer to CCU8 module + * @param slice_mode_msk Slices for which the configuration has to be applied. + * Use ::XMC_CCU8_MULTI_CHANNEL_SHADOW_TRANSFER_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Enables the Multi-channel shadow transfer request trigger signal either by software or hardware by configuring + * GCTRL.MSE0, GCTRL.MSE1, GCTRL.MSE2, and GCTRL.MSE3 based on the mask.\n\n + * The shadow transfer would take place either if it was requested by software or by the CCU8x.MCSS input. + * + * \parRelated APIs:
+ * None. +*/ +void XMC_CCU8_SetMultiChannelShadowTransferMode(XMC_CCU8_MODULE_t *const module, const uint32_t slice_mode_msk); + +/** + * @param slice Constant pointer to CC8 Slice + * @param reg_num The capture register from which the captured value is to be retrieved + * Range: [0,3] + * @return
+ * uint32_t Returns the Capture register value. + * Range: [0 to 0x1FFFFF] + * + * \parDescription:
+ * Retrieves timer value which has been captured in the Capture registers, by reading CC8yCV[\b reg_num] register.\n\n + * The signal whose timing characteristics are to be measured must be mapped to an event which in turn must be mapped + * to the capture function. Based on the capture criteria, the timer values are captured into capture registers. Timing + * characteristics of the input signal may then be derived/inferred from the captured values. The full flag will help + * to find out if there is a new captured value present. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_GetLastCapturedTimerValue(). + */ +uint32_t XMC_CCU8_SLICE_GetCaptureRegisterValue(const XMC_CCU8_SLICE_t *const slice, const uint8_t reg_num); + +/** + * @param slice Constant pointer to CC8 Slice + * @param set The capture register set, which must be evaluated + * @param val_ptr Out Parameter of the API.Stores the captured timer value into this out parameter. + * @return
+ * ::XMC_CCU8_STATUS_t Returns XMC_CCU8_STATUS_OK if there was new value present in the capture registers. + * returns XMC_CCU8_STATUS_ERROR if there was no new value present in the capture registers. + * + * \parDescription:
+ * Retrieves the latest captured timer value, by reading CC8yCV registers.\n\n + * Retrieve the timer value last stored by the slice. When separate capture events are used, + * users must specify the capture set to evaluate. If single capture event mode is used, all 8 capture registers are + * evaluated.\n + * The lowest register is evaluated first followed by the next higher ordered register and this continues until all + * capture registers have been evaluated. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_GetCaptureregisterValue(). + */ +XMC_CCU8_STATUS_t XMC_CCU8_SLICE_GetLastCapturedTimerValue(const XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_CAP_REG_SET_t set, + uint32_t *val_ptr); + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Event whose assertion can potentially lead to an interrupt + * @return
+ * None
+ * + * \parDescription:
+ * Enables the generation of an interrupt pulse for the event, by configuring CC8yINTE register.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API merely enables the event. Binding with SR is performed by another API. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetInterruptNode()
XMC_CCU8_SLICE_EnableMultipleEvents()
XMC_CCU8_SLICE_DisableEvent()
+ * XMC_CCU8_SLICE_DisableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableEvent(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableEvent:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_EnableEvent:Invalid SR event", XMC_CCU8_SLICE_CHECK_INTERRUPT(event)); + + slice->INTE |= ((uint32_t) 1) << ((uint32_t) event); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param mask Event mask such that multiple events can be enabled. + * Use ::XMC_CCU8_SLICE_MULTI_IRQ_ID_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Enables the generation of an interrupt pulse for the required events, by configuring CC8yINTE register.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API merely enables the events. Binding with SR is performed by another API. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetInterruptNode()
XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_DisableEvent()
+ * XMC_CCU8_SLICE_DisableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableMultipleEvents(XMC_CCU8_SLICE_t *const slice, const uint16_t mask) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableMultipleEvents:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->INTE = (uint32_t) mask; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Event whose assertion can potentially lead to an interrupt + * @return
+ * None
+ * + * \parDescription:
+ * Disables the generation of an interrupt pulse for the event, by clearing CC8yINTE register.\n\n + * Prevents the event from being asserted. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetInterruptNode()
XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_EnableMultipleEvents()
+ * XMC_CCU8_SLICE_DisableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableEvent(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableEvent:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_DisableEvent:Invalid SR event", XMC_CCU8_SLICE_CHECK_INTERRUPT(event)); + + slice->INTE &= ~(((uint32_t) 1) << ((uint32_t) event)); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param mask Event mask such that multiple events can be enabled. + * Use ::XMC_CCU8_SLICE_MULTI_IRQ_ID_t enum items to create a mask of choice, + * using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Disables the generation of an interrupt pulse for the required events, by clearing CC8yINTE register.\n\n + * Prevents selected events of the slice from being asserted. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetInterruptNode()
XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_EnableMultipleEvents()
+ * XMC_CCU8_SLICE_DisableEvent(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableMultipleEvents(XMC_CCU8_SLICE_t *const slice, const uint16_t mask) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableMultipleEvents:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->INTE &= ~((uint32_t) mask); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Event whose assertion can potentially lead to an interrupt + * @return
+ * None
+ * + * \parDescription:
+ * Manually asserts the requested event, by setting CC8ySWS register.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API manually asserts the requested event. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_SetInterruptNode()
XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_EnableMultipleEvents(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_SetEvent(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetEvent:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetEvent:Invalid SR event", XMC_CCU8_SLICE_CHECK_INTERRUPT(event)); + + slice->SWS |= ((uint32_t) 1) << ((uint32_t) event); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Asserted event which must be acknowledged. + * @return
+ * None
+ * + * \parDescription:
+ * Acknowledges an asserted event, by setting CC8ySWR with respective event flag.\n\n + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_SetEvent()
XMC_CCU8_SLICE_GetEvent(). + * + */ +__STATIC_INLINE void XMC_CCU8_SLICE_ClearEvent(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU8_SLICE_ClearEvent:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_ClearEvent:Invalid SR event", XMC_CCU8_SLICE_CHECK_INTERRUPT(event)); + slice->SWR |= ((uint32_t) 1) << ((uint32_t) event); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Event to be evaluated for assertion + * @return
+ * bool Returns true if event is set else false is returned. + * + * \parDescription:
+ * Evaluates if a given event is asserted or not, by reading CC8yINTS register.\n\n + * Return true if the event is asserted. For a event to be asserted it has to be + * first enabled. Only if that event is enabled the call to this API is valid. + * If the Event is enabled and has not yet occurred then a false is returned. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_SetEvent(). + */ +__STATIC_INLINE bool XMC_CCU8_SLICE_GetEvent(const XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_IRQ_ID_t event) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetEvent:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_GetEvent:Invalid SR event", XMC_CCU8_SLICE_CHECK_INTERRUPT(event)); + return(((uint32_t)(slice->INTS & ((uint32_t)1 << event))) != 0U); + } + +/** + * @param slice Constant pointer to CC8 Slice + * @param event Event which must be bound to a service request line + * @param sr The Service request line which is bound to the \b event + * @return
+ * None
+ * + * \parDescription:
+ * Binds requested event to a service request line, by configuring CC8ySRS register with respective event.\n\n + * For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding + * NVIC node must be enabled as well. This API binds the requested event with the requested service request line(\b sr). + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_SetEvent(). + * + */ +void XMC_CCU8_SLICE_SetInterruptNode(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_IRQ_ID_t event, + const XMC_CCU8_SLICE_SR_ID_t sr); + +/** + * @param slice Constant pointer to CC8 Slice + * @param out Output signal for which the passive level needs to be set. + * @param level Output passive level for the \b out signal + * @return
+ * None
+ * + * \parDescription:
+ * Configures the passive level for the slice output, by setting CC8yPSL register.\n\n + * Defines the passive level for the timer slice output pin. Selects either level high is passive + * or level low is passive. This is the level of the output before the compare match is value changes it. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableEvent()
XMC_CCU8_SLICE_SetEvent(). + */ +void XMC_CCU8_SLICE_SetPassiveLevel(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_OUTPUT_t out, + const XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_t level); + +/** + * @param slice Constant pointer to CC8 Slice + * @param config Pointer to dead time configuration data + * @return
+ * None
+ * + * \parDescription:
+ * Initializes Dead time configuration for the slice outputs, by configuring CC8yDC1R, CC8yDC2R, CC8yDTC registers.\n\n + * This routine programs dead time delays (rising & falling) and dead time clock prescaler. + * Details such as the choice of dead time for channel1, channel2, ST1, Inverted ST1, ST2, Inverted ST2, are also + * programmed by this routine. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_ConfigureDeadTime()
XMC_CCU8_SLICE_SetDeadTimeValue()
XMC_CCU8_SLICE_SetDeadTimePrescaler()
+ * XMC_CCU8_SLICE_IsDeadTimeCntr1Running()
XMC_CCU8_SLICE_IsDeadTimeCntr2Running(). + */ +void XMC_CCU8_SLICE_DeadTimeInit(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_DEAD_TIME_CONFIG_t *const config); + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Configures the slice to generate PWM in asymmetric compare mode, by setting CC8yCHC.ASE bit.\n\n + * In asymmetric compare mode, the compare channels 1 & 2 are grouped to generate the PWM.This would + * generate an inverted PWM at OUT0 & OUT1. + * In Edge Aligned mode (counting up), the Status bit is set when a compare match of + * Compare channel-1 occurs and cleared when a compare match event of Compare channel-2 occurs.\n + * In Center Aligned mode, the status bit is set when a compare match event of Compare channel-1 occurs while + * counting up and cleared when a compare match event of Compare channel-2 occurs while counting down. + * + * \parNote:
+ * External count direction function is enabled then the asymmetric mode of operation is not possible. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableSymmetricCompareMode()
+ */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableAsymmetricCompareMode(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableAsymmetricCompareMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->CHC |= (uint32_t) CCU8_CC8_CHC_ASE_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @return
+ * None
+ * + * \parDescription:
+ * Configures the slice to generate PWM in symmetric(standard) compare mode, by clearing CC8yCHC.ASE bit.\n\n + * In symmetric compare mode, the compare channels 1 & 2 are independent of each other & each channel generates the + * PWM & inverted PWM at OUT0, OUT1, OUT2 & OUT3. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableAsymmetricCompareMode(). + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableSymmetricCompareMode(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableSymmetricCompareMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->CHC &= ~((uint32_t) CCU8_CC8_CHC_ASE_Msk); +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param mask The Dead Time configuration mask. + * Do a bitwise OR operation on the following values depending on the need. + * Value 0x1: Dead Time Enable for Compare Channel 1 + * Value 0x2: Dead Time Enable for Compare Channel 2 + * Value 0x4: Dead Time Enable for CC8yST1 path is enabled. + * Value 0x8: Dead Time Enable for Inverted CC8yST1 path is enabled. + * Value 0x10: Dead Time Enable for CC8yST2 path is enabled. + * Value 0x20: Dead Time Enable for Inverted CC8yST2 path is enabled. + * Range: [0x0 to 0x3F] + * + * \parDescription:
+ * Activates or deactivates dead time for compare channel and ST path, by configuring CC8y.DC1R, CC8y.DC1R and + * CC8y.DTC registers.\n\n + * Use the provided masks to enable/disable the dead time for the compare channels and the ST signals. It is possible + * to deactivate the dead time for all the options by passing a 0x0 as the mask. + * Details such as the choice of dead time for channel1, channel2, ST1, Inverted ST1, ST2, Inverted ST2, are + * programmed by this routine. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_DeadTimeInit()
XMC_CCU8_SLICE_SetDeadTimeValue()
XMC_CCU8_SLICE_SetDeadTimePrescaler()
+ * XMC_CCU8_SLICE_IsDeadTimeCntr1Running()
XMC_CCU8_SLICE_IsDeadTimeCntr2Running(). + */ +void XMC_CCU8_SLICE_ConfigureDeadTime(XMC_CCU8_SLICE_t *const slice, const uint8_t mask); + +/** + * @param slice Constant pointer to CC8 Slice + * @param channel Compare channel number + * @param rise_value Programs rising edge delay + * Range: [0x0 to 0xFF] + * @param fall_value Programs falling edge delay + * Range: [0x0 to 0xFF] + * @return
+ * None
+ * + * \parDescription:
+ * Configures the dead time for rising and falling edges, by updating CC8y.DC1R, CC8y.DC1R registers.\n\n + * This API will Configure the delay that is need either when the value changes from 0 to 1 (rising edge) or + * value changes from 1 to 0(falling edge). Directly accessed registers are CC8yDC1R, CC8yDC2R. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_DeadTimeInit()
XMC_CCU8_SLICE_SetDeadTimeValue()
XMC_CCU8_SLICE_ConfigureDeadTime()
+ * XMC_CCU8_SLICE_IsDeadTimeCntr1Running()
XMC_CCU8_SLICE_IsDeadTimeCntr2Running(). + */ +void XMC_CCU8_SLICE_SetDeadTimeValue(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t channel, + const uint8_t rise_value, + const uint8_t fall_value); + +/** + * @param slice Pointer to an instance of CC8 slice + * @param div_val Prescaler divider value + * @return
+ * None
+ * + * \parDescription:
+ * Configures clock division factor for dead time generator, by configuring CC8yDTC.DTCC bit. + * The Clock divider works on the timer clock. It is possible to scale the timer clock for the dead time + * generator by a factor of 1/2/4/8. This selection is passed as an argument to the API. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_DeadTimeInit()
XMC_CCU8_SLICE_SetDeadTimeValue()
XMC_CCU8_SLICE_ConfigureDeadTime()
+ * XMC_CCU8_SLICE_IsDeadTimeCntr1Running()
XMC_CCU8_SLICE_IsDeadTimeCntr2Running(). + */ +void XMC_CCU8_SLICE_SetDeadTimePrescaler(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_DTC_DIV_t div_val); + +/** + * @param slice Constant pointer to CC8 Slice + * @param channel which channel status has to be give as out + * @return
+ * None
+ * + * \parDescription:
+ * Configures status ST1, ST2 mapping to STy, by configuring CC8yTC.STOS bits.\n\n + * This routine defines the output STy as a function of ST1 or ST2 or both ST1 & ST2. + * It is possible to make the CCU8x.STy signal to reflect the CC8y.ST1/CC8y.ST2 or a function of the 2 signals. + * + * \parRelated APIs:
+ * None. + */ +void XMC_CCU8_SLICE_ConfigureStatusBitOutput(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_STATUS_t channel); + +#if (UC_SERIES != XMC45) || defined(DOXYGEN) +/** + * @param slice Constant pointer to CC8 Slice + * + * @return
+ * None
+ * + * \parDescription:
+ * Cascades the shadow transfer operation throughout the CCU8 timer slices, by setting CSE bit in STC register.\n\n + * + * The shadow transfer enable bits needs to be set in all timer slices, that are being used in the cascaded architecture, + * at the same time. The shadow transfer enable bits, also need to be set for all slices even if the shadow values of + * some slices were not updated. It is possible to to cascade with the adjacent slices only. CC80 slice is a + * master to start the operation. + * + * \parNote:
+ * XMC_CCU8_EnableShadowTransfer() must be called to enable the shadow transfer of the all the slices, which needs to be + * cascaded. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableShadowTransfer(), XMC_CCU8_SLICE_DisableCascadedShadowTransfer()
. + * @note Not available for XMC4500 series + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableCascadedShadowTransfer(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableCascadedShadowTransfer:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->STC |= (uint32_t) CCU8_CC8_STC_CSE_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * + * @return
+ * None
+ * + * \parDescription:
+ * Disables the cascaded the shadow transfer operation, by clearing CSE bit in STC register.\n\n + * + * If in any slice the cascaded mode disabled, other slices from there onwards does not update the values in cascaded mode. + * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableCascadedShadowTransfer()
. + * @note Not available for XMC4500 series + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableCascadedShadowTransfer(XMC_CCU8_SLICE_t *const slice) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableCascadedShadowTransfer:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->STC &= ~(uint32_t) CCU8_CC8_STC_CSE_Msk; +} + +/** + * @param slice Constant pointer to CC8 Slice + * @param shadow_transfer_mode mode to be configured + * Use :: XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE_t enum items for mode + * @return
+ * None
+ * + * \parDescription:
+ * Configures when the shadow transfer has to occur, by setting STM bit in STC register.\n\n + * + * After requesting for shadow transfer mode using XMC_CCU8_EnableShadowTransfer(), actual transfer occurs based on the + * selection done using this API (i.e. on period and One match, on Period match only, on One match only). + * + * \parNote:
+ * This is effective when the timer is configured in centre aligned mode. + * + * \parRelated APIs:
+ * XMC_CCU8_EnableShadowTransfer()
+ * @note Not available for XMC4500 series + */ +__STATIC_INLINE void XMC_CCU8_SLICE_SetShadowTransferMode(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_SHADOW_TRANSFER_MODE_t shadow_transfer_mode) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetShadowTransferMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->STC = ((slice->STC) & ~(uint32_t)((uint32_t)CCU8_CC8_STC_STM_Msk << (uint32_t)CCU8_CC8_STC_STM_Pos)) | + ((shadow_transfer_mode << CCU8_CC8_STC_STM_Pos) & (uint32_t)CCU8_CC8_STC_STM_Msk); +} +#endif + +#if defined(CCU8V3) || defined(DOXYGEN)/* Defined for XMC1400 devices only */ + /** + * @param slice Constant pointer to CC8 Slice + * @param immediate_write specifies for what fields this mode has to be applied + * Use :: XMC_CCU8_SLICE_WRITE_INTO_t enum items to create a mask of choice, using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configures the specified fields shadow value to be updated immediately after shadow transfer request, by setting + * IRPC, IRCC1, IRCC2, IRLC, IRDC, IRFC bits in STC register.\n\n + * + * When immediate shadow is enabled, by calling XMC_CCU8_EnableShadowTransfer() the value which are written in the + * shadow registers get updated to the actual registers immediately. \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU8_EnableShadowTransfer()
+ * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU8_SLICE_WriteImmediateAfterShadowTransfer(XMC_CCU8_SLICE_t *const slice, + const uint32_t immediate_write) +{ + XMC_ASSERT("XMC_CCU8_SLICE_WriteImmediateAfterShadowTransfer:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->STC |= immediate_write; +} + + /** + * @param slice Constant pointer to CC8 Slice + * @param coherent_write specifies for what fields this mode has to be applied + * Use :: XMC_CCU8_SLICE_WRITE_INTO_t enum items to create a mask of choice, using a bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configures the specified fields shadow value to be updated in synchronous with PWM after shadow transfer request, by + * clearing IRPC, IRCC1, IRCC2, IRLC, IRDC, IRFC bits in STC register.\n\n + * + * When coherent shadow is enabled, after calling XMC_CCU8_EnableShadowTransfer(), the value which are written in the + * respective shadow registers get updated according the configuration done using XMC_CCU8_SLICE_SetShadowTransferMode() + * API. \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU8_EnableShadowTransfer(), XMC_CCU8_SLICE_SetShadowTransferMode()
+ * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU8_SLICE_WriteCoherentlyWithPWMCycle(XMC_CCU8_SLICE_t *const slice, + const uint32_t coherent_write) +{ + XMC_ASSERT("XMC_CCU8_SLICE_WriteCoherentlyWithPWMCycle:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->STC &= ~(uint32_t)coherent_write; +} + + /** + * @param slice Constant pointer to CC8 Slice + * @param automatic_shadow_transfer specify upon which register update, automatic shadow transfer request is generated + * Use :: XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_t enum items to create a mask of choice, using a + * bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configure on which shadow register update, automatic shadow transfer request generation has to be enabled. By setting + * ASPC, ASCC1, ASCC2, ASLC, ASDC, ASFC bits in STC register.\n\n + * + * By updating the configured shadow register, the shadow transfer request is generated to update all the shadow registers. + * \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_DisableAutomaticShadowTransferRequest(). + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU8_SLICE_EnableAutomaticShadowTransferRequest(XMC_CCU8_SLICE_t *const slice, + const uint32_t automatic_shadow_transfer) +{ + XMC_ASSERT("XMC_CCU8_SLICE_EnableAutomaticShadowTransferRequest:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->STC |= automatic_shadow_transfer; +} + + /** + * @param slice Constant pointer to CC8 Slice + * @param automatic_shadow_transfer specify upon which register update, automatic shadow transfer request should not be + * generated + * Use :: XMC_CCU8_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_t enum items to create a mask of choice, using a + * bit wise OR operation. + * @return
+ * None
+ * + * \parDescription:
+ * Configure on which shadow register update, automatic shadow transfer request generation has to be disabled. By + * clearing ASPC, ASCC1, ASCC2, ASLC, ASDC, ASFC bits in STC register.\n\n + * + * This disables the generation of automatic shadow transfer request for the specified register update. + * \parNote:
+ * + * \parRelated APIs:
+ * XMC_CCU8_SLICE_EnableAutomaticShadowTransferRequest(). + * @note Only available for XMC1400 series + */ +__STATIC_INLINE void XMC_CCU8_SLICE_DisableAutomaticShadowTransferRequest(XMC_CCU8_SLICE_t *const slice, + const uint32_t automatic_shadow_transfer) +{ + XMC_ASSERT("XMC_CCU8_SLICE_DisableAutomaticShadowTransferRequest:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->STC &= ~(uint32_t)automatic_shadow_transfer; +} +#endif +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(CCU80) */ + +#endif /* XMC_CCU8_H */ + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_common.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_common.h new file mode 100644 index 00000000..77ff7e07 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_common.h @@ -0,0 +1,285 @@ +/** + * @file xmc_common.h + * @date 2017-04-04 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-06-20: + * - Initial + * - Brief section updated + * - Added XMC_LIB_VERSION macro + * + * 2016-02-26: + * - Updated XMC_LIB_VERSION macro to v2.1.6 + * + * 2016-05-30: + * - Updated XMC_LIB_VERSION macro to v2.1.8 + * + * 2016-11-18: + * - Updated XMC_LIB_VERSION macro to v2.1.10 + * - Changed type of size in XMC_PRIOARRAY_t to fix compilation warnings + * + * 2017-04-04: + * - Updated XMC_LIB_VERSION macro to v2.1.12 + * + * @endcond + * + */ + +#ifndef XMC_COMMON_H +#define XMC_COMMON_H + +#include +#include +#include +#include + +#include "xmc_device.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup COMMON + * @brief Common APIs to all peripherals for XMC microcontroller family + * @{ + */ + +/********************************************************************************************************************** + * MACROS + *********************************************************************************************************************/ +#define XMC_LIB_MAJOR_VERSION (2U) +#define XMC_LIB_MINOR_VERSION (1U) +#define XMC_LIB_PATCH_VERSION (12U) + +#define XMC_LIB_VERSION ((XMC_LIB_MAJOR_VERSION << 16U) + (XMC_LIB_MINOR_VERSION << 8U) + XMC_LIB_PATCH_VERSION) + +/* Define WEAK attribute */ +#if !defined(__WEAK) +#if defined ( __CC_ARM ) +#define __WEAK __attribute__ ((weak)) +#elif defined ( __ICCARM__ ) +#define __WEAK __weak +#elif defined ( __GNUC__ ) +#define __WEAK __attribute__ ((weak)) +#elif defined ( __TASKING__ ) +#define __WEAK __attribute__ ((weak)) +#endif +#endif + +#ifdef XMC_ASSERT_ENABLE + #define XMC_ASSERT(msg, exp) { if(!(exp)) {XMC_AssertHandler(msg, __FILE__, __LINE__);} } +#else + #define XMC_ASSERT(msg, exp) { ; } +#endif + +#ifdef XMC_DEBUG_ENABLE + #include + #define XMC_DEBUG(...) { printf(__VA_ARGS__); } +#else + #define XMC_DEBUG(...) { ; } +#endif + +#define XMC_UNUSED_ARG(x) (void)x + +#define XMC_STRUCT_INIT(m) memset(&m, 0, sizeof(m)) + +#define XMC_PRIOARRAY_DEF(name, size) \ +XMC_PRIOARRAY_ITEM_t prioarray_m_##name[size + 2]; \ +XMC_PRIOARRAY_t prioarray_def_##name = {(size), (prioarray_m_##name)}; + +#define XMC_PRIOARRAY(name) \ +&prioarray_def_##name + +/********************************************************************************************************************** + * DATA STRUCTURES + *********************************************************************************************************************/ +/* + * + */ +typedef struct XMC_DRIVER_VERSION +{ + uint8_t major; + uint8_t minor; + uint8_t patch; +} XMC_DRIVER_VERSION_t; + +/* + * + */ +typedef void *XMC_LIST_t; + +/* + * + */ +typedef struct XMC_PRIOARRAY_ITEM +{ + int32_t priority; + int32_t previous; + int32_t next; +} XMC_PRIOARRAY_ITEM_t; + +/* + * + */ +typedef struct XMC_PRIOARRAY +{ + int32_t size; + XMC_PRIOARRAY_ITEM_t *items; +} XMC_PRIOARRAY_t; + +/********************************************************************************************************************** + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * + */ +void XMC_AssertHandler(const char *const msg, const char *const file, uint32_t line); + +/* + * + */ +void XMC_LIST_Init(XMC_LIST_t *list); + +/* + * + */ +void XMC_LIST_Add(XMC_LIST_t *list, void *const item); + +/* + * + */ +void XMC_LIST_Remove(XMC_LIST_t *list, void *const item); + +/* + * + */ +uint32_t XMC_LIST_GetLength(XMC_LIST_t *list); + +/* + * + */ +void *XMC_LIST_GetHead(XMC_LIST_t *list); + +/* + * + */ +void *XMC_LIST_GetTail(XMC_LIST_t *list); + +/* + * + */ +void XMC_LIST_Insert(XMC_LIST_t *list, void *prev_item, void *new_item); + +/* + * + */ +void XMC_PRIOARRAY_Init(XMC_PRIOARRAY_t *prioarray); + +/* + * + */ +void XMC_PRIOARRAY_Add(XMC_PRIOARRAY_t *prioarray, int32_t item, int32_t priority); + +/* + * + */ +void XMC_PRIOARRAY_Remove(XMC_PRIOARRAY_t *prioarray, int32_t item); + +/* + * + */ +__STATIC_INLINE int32_t XMC_PRIOARRAY_GetHead(XMC_PRIOARRAY_t *prioarray) +{ + XMC_ASSERT("XMC_PRIOARRAY_Init: NULL pointer", prioarray != NULL); + return prioarray->items[prioarray->size].next; +} + +/* + * + */ +__STATIC_INLINE int32_t XMC_PRIOARRAY_GetTail(XMC_PRIOARRAY_t *prioarray) +{ + XMC_ASSERT("XMC_PRIOARRAY_Init: NULL pointer", prioarray != NULL); + return prioarray->items[prioarray->size + 1].previous; +} + +/* + * + */ +__STATIC_INLINE int32_t XMC_PRIOARRAY_GetItemPriority(XMC_PRIOARRAY_t *prioarray, int32_t item) +{ + XMC_ASSERT("XMC_PRIOARRAY_GetItemPriority: item out of range", (item >= 0) && (item < prioarray->size)); + return prioarray->items[item].priority; +} + +/* + * + */ +__STATIC_INLINE int32_t XMC_PRIOARRAY_GetItemNext(XMC_PRIOARRAY_t *prioarray, int32_t item) +{ + XMC_ASSERT("XMC_PRIOARRAY_GetItemNext: item out of range", (item >= 0) && (item < prioarray->size)); + return prioarray->items[item].next; +} + +/* + * + */ +__STATIC_INLINE int32_t XMC_PRIOARRAY_GetItemPrevious(XMC_PRIOARRAY_t *prioarray, int32_t item) +{ + XMC_ASSERT("XMC_PRIOARRAY_GetItemPrevious: item out of range", (item >= 0) && (item < prioarray->size)); + return prioarray->items[item].previous; +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* XMC_COMMON_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_device.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_device.h new file mode 100644 index 00000000..fe346210 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_device.h @@ -0,0 +1,1514 @@ +/** + * @file xmc_device.h + * @date 2016-07-21 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-06-20: + * - Initial version + * + * 2015-09-23: + * - Added XMC14 and XMC48/47 + * + * 2015-11-19: + * - Added XMC43 + * + * 2016-02-26: + * - Fixed CCU8 version for XMC43/47/48 + * + * 2016-06-14: + * - Added XMC1201_T028x0016, XMC1202_T016x0064, XMC1301_T016x0032, XMC1302_Q040x0200, + * XMC1302_T028x0016, XMC1402_T038x0032, XMC1402_T038x0064, XMC1402_T038x0128, + * XMC1403_Q040x0064, XMC1403_Q040x0128, XMC1403_Q040x0200, XMC1402_T038x0200 + * XMC1402_Q040x0200, XMC1402_Q048x0200, XMC1201_T028x0032 + * @endcond + * + */ + +#ifndef XMC_DEVICE_H +#define XMC_DEVICE_H + +/* Family definitions */ +#define XMC4 (4) +#define XMC1 (1) + +/* Series definitions */ +#define XMC48 (48) +#define XMC47 (47) +#define XMC45 (45) +#define XMC44 (44) +#define XMC43 (43) +#define XMC42 (42) +#define XMC41 (41) +#define XMC14 (14) +#define XMC13 (13) +#define XMC12 (12) +#define XMC11 (11) + +/* Device definitions */ +#define XMC4800 (4800) +#define XMC4700 (4700) +#define XMC4500 (4500) +#define XMC4502 (4502) +#define XMC4504 (4504) +#define XMC4400 (4400) +#define XMC4402 (4402) +#define XMC4300 (4300) +#define XMC4200 (4200) +#define XMC4100 (4100) +#define XMC4104 (4104) +#define XMC4108 (4108) +#define XMC1401 (1401) +#define XMC1402 (1402) +#define XMC1403 (1403) +#define XMC1404 (1404) +#define XMC1300 (1300) +#define XMC1301 (1301) +#define XMC1302 (1302) +#define XMC1200 (1200) +#define XMC1201 (1201) +#define XMC1202 (1202) +#define XMC1203 (1203) +#define XMC1100 (1100) + +/* Package definitions */ +#define BGA144 (1) +#define LQFP144 (2) +#define LQFP100 (3) +#define BGA64 (4) +#define LQFP64 (5) +#define VQFN48 (6) +#define TSSOP38 (7) +#define TSSOP28 (8) +#define TSSOP16 (9) +#define VQFN24 (10) +#define VQFN40 (11) +#define VQFN64 (12) +#define BGA196 (13) + +#if defined(XMC4800_E196x2048) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE BGA196 +#define UC_FLASH (2048UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_F144x2048) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (2048UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_F100x2048) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (2048UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_E196x1536) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE BGA196 +#define UC_FLASH (1536UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_F144x1536) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (1536UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_F100x1536) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (1536UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_E196x1024) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE BGA196 +#define UC_FLASH (1024UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_F144x1024) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (1024UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4800_F100x1024) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC48 +#define UC_DEVICE XMC4800 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (1024UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4700_E196x2048) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC47 +#define UC_DEVICE XMC4700 +#define UC_PACKAGE BGA196 +#define UC_FLASH (2048UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4700_F144x2048) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC47 +#define UC_DEVICE XMC4700 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (2048UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4700_F100x2048) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC47 +#define UC_DEVICE XMC4700 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (2048UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4700_E196x1536) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC47 +#define UC_DEVICE XMC4700 +#define UC_PACKAGE BGA196 +#define UC_FLASH (1536UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4700_F144x1536) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC47 +#define UC_DEVICE XMC4700 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (1536UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4700_F100x1536) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC47 +#define UC_DEVICE XMC4700 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (1536UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4500_E144x1024) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4500 +#define UC_PACKAGE BGA144 +#define UC_FLASH (1024UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4500_F144x1024) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4500 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (1024UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4500_F100x1024) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4500 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (1024UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4500_F144x768) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4500 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (768UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4500_F100x768) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4500 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (768UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4502_F100x768) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4502 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (768UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4504_F100x512) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4504 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (512UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4504_F144x512) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC45 +#define UC_DEVICE XMC4504 +#define UC_PACKAGE LQFP144 +#define UC_FLASH (512UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4400_F100x512) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC44 +#define UC_DEVICE XMC4400 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (512UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4400_F64x512) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC44 +#define UC_DEVICE XMC4400 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (512UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4400_F100x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC44 +#define UC_DEVICE XMC4400 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (256UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4400_F64x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC44 +#define UC_DEVICE XMC4400 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (256UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4402_F100x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC44 +#define UC_DEVICE XMC4402 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (256UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4402_F64x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC44 +#define UC_DEVICE XMC4402 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (256UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4300_F100x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC43 +#define UC_DEVICE XMC4300 +#define UC_PACKAGE LQFP100 +#define UC_FLASH (256UL) +#define MULTICAN_PLUS +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC4200_E64x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC42 +#define UC_DEVICE XMC4200 +#define UC_PACKAGE BGA64 +#define UC_FLASH (256UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4200_F64x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC42 +#define UC_DEVICE XMC4200 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (256UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4200_Q48x256) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC42 +#define UC_DEVICE XMC4200 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (256UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4100_E64x128) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4100 +#define UC_PACKAGE BGA64 +#define UC_FLASH (128UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4100_F64x128) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4100 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (128UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4100_Q48x128) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4100 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (128UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4104_E64x64) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4104 +#define UC_PACKAGE BGA64 +#define UC_FLASH (64UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4104_F64x64) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4104 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (64UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4104_Q48x64) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4104 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (64UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4104_E64x128) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4104 +#define UC_PACKAGE BGA64 +#define UC_FLASH (128UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4104_F64x128) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4104 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (128UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4104_Q48x128) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4104 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (128UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4108_Q48x64) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4108 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (64UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC4108_F64x64) +#define UC_FAMILY XMC4 +#define UC_SERIES XMC41 +#define UC_DEVICE XMC4108 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (64UL) +#define CCU4V1 +#define CCU8V1 + +#elif defined(XMC1100_Q024x0008) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (8UL) +#define CCU4V2 + +#elif defined(XMC1100_Q024x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1100_Q024x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1100_Q024x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1100_Q040x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1100_Q040x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1100_Q040x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1100_T016x0008) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (8UL) +#define CCU4V2 + +#elif defined(XMC1100_T016x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1100_T016x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1100_T016x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1100_T038x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1100_T038x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1100_T038x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC11 +#define UC_DEVICE XMC1100 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1201_Q040x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1201_Q040x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1201_Q040x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1201_Q040x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (128UL) +#define CCU4V2 + +#elif defined(XMC1201_Q040x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (200UL) +#define CCU4V2 + +#elif defined(XMC1201_T038x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1201_T038x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1201_T038x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1201_T038x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (128UL) +#define CCU4V2 + +#elif defined(XMC1201_T038x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (200UL) +#define CCU4V2 + +#elif defined(XMC1201_T028x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE TSSOP28 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1201_T028x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1201 +#define UC_PACKAGE TSSOP28 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1202_Q024x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1202_Q024x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1202_Q040x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1202_Q040x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1202_T016x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1202_T016x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1202_T016x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1202_T028x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE TSSOP28 +#define UC_FLASH (16UL) +#define CCU4V2 + +#elif defined(XMC1202_T028x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE TSSOP28 +#define UC_FLASH (64UL) +#define CCU4V2 + +#elif defined(XMC1202_T028x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1202 +#define UC_PACKAGE TSSOP28 +#define UC_FLASH (32UL) +#define CCU4V2 + +#elif defined(XMC1200_T038x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC12 +#define UC_DEVICE XMC1200 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (200UL) +#define CCU4V2 + +#elif defined(XMC1301_Q024x0008) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (8UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_Q024x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_Q040x0008) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (8UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_Q040x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_Q040x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (32UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_T016x0008) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (8UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_T016x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_T016x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (32UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_T038x0008) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (8UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_T038x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_T038x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (32UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1301_T038x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1301 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (64UL) + +#elif defined(XMC1302_Q024x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_Q024x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (32UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_Q024x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN24 +#define UC_FLASH (64UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_Q040x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_Q040x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (32UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_Q040x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (64UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_Q040x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (128UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_Q040x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (200UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T038x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T038x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (32UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T038x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (64UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T038x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (128UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T038x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (200UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T028x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP28 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T016x0008) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (8UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T016x0016) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (16UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1302_T016x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC13 +#define UC_DEVICE XMC1302 +#define UC_PACKAGE TSSOP16 +#define UC_FLASH (32UL) +#define CCU4V2 +#define CCU8V2 + +#elif defined(XMC1401_Q048x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1401 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (64UL) +#define CCU4V3 + +#elif defined(XMC1401_Q048x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1401 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (128UL) +#define CCU4V3 + +#elif defined(XMC1401_F064x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1401 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (64UL) +#define CCU4V3 + +#elif defined(XMC1401_F064x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1401 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (128UL) +#define CCU4V3 + +#elif defined(XMC1402_T038x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (32UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_T038x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (64UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_T038x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (128UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_T038x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE TSSOP38 +#define UC_FLASH (200UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q040x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (32UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q040x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (64UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q040x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (128UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q040x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (200UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q048x0032) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (32UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q048x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (64UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q048x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (128UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q048x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (200UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q064x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (64UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q064x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (128UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_Q064x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (200UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_F064x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (64UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_F064x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (128UL) +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1402_F064x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1402 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (200UL) +#define CCU4V3 +#define CCU8V3 + + +#elif defined(XMC1403_Q048x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (64UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q048x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (128UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q048x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (200UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q040x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (64UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q040x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (128UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q040x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN40 +#define UC_FLASH (200UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q064x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (64UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q064x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (128UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1403_Q064x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1403 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (200UL) +#define MULTICAN_PLUS +#define CCU4V3 + +#elif defined(XMC1404_Q048x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (64UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_Q048x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (128UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_Q048x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE VQFN48 +#define UC_FLASH (200UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_Q064x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (64UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_Q064x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (128UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_Q064x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE VQFN64 +#define UC_FLASH (200UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_F064x0064) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (64UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_F064x0128) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (128UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#elif defined(XMC1404_F064x0200) +#define UC_FAMILY XMC1 +#define UC_SERIES XMC14 +#define UC_DEVICE XMC1404 +#define UC_PACKAGE LQFP64 +#define UC_FLASH (200UL) +#define MULTICAN_PLUS +#define CCU4V3 +#define CCU8V3 + +#else +#error "xmc_device.h: device not supported" +#endif + +#if UC_SERIES == XMC45 +#include "XMC4500.h" +#define PERIPHERAL_RESET_SUPPORTED +#define USB_OTG_SUPPORTED + +#elif UC_SERIES == XMC44 +#include "XMC4400.h" +#define CLOCK_GATING_SUPPORTED +#define PERIPHERAL_RESET_SUPPORTED +#define USB_OTG_SUPPORTED + +#elif UC_SERIES == XMC43 +#include "XMC4300.h" +#define CLOCK_GATING_SUPPORTED +#define PERIPHERAL_RESET_SUPPORTED +#define USB_OTG_SUPPORTED + +#elif UC_SERIES == XMC42 +#include "XMC4200.h" +#define CLOCK_GATING_SUPPORTED +#define PERIPHERAL_RESET_SUPPORTED + +#elif UC_SERIES == XMC41 +#include "XMC4100.h" +#define CLOCK_GATING_SUPPORTED +#define PERIPHERAL_RESET_SUPPORTED + +#elif UC_SERIES == XMC47 +#include "XMC4700.h" +#define CLOCK_GATING_SUPPORTED +#define PERIPHERAL_RESET_SUPPORTED +#define USB_OTG_SUPPORTED + +#elif UC_SERIES == XMC48 +#include "XMC4800.h" +#define CLOCK_GATING_SUPPORTED +#define PERIPHERAL_RESET_SUPPORTED +#define USB_OTG_SUPPORTED + +#elif UC_SERIES == XMC11 +#include "XMC1100.h" +#define CLOCK_GATING_SUPPORTED + +#elif UC_SERIES == XMC12 +#include "XMC1200.h" +#define CLOCK_GATING_SUPPORTED + +#elif UC_SERIES == XMC13 +#include "XMC1300.h" +#define CLOCK_GATING_SUPPORTED + +#elif UC_SERIES == XMC14 +#include "XMC1400.h" +#define CLOCK_GATING_SUPPORTED +#endif + +#endif /* XMC_DEVICE_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_eru.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_eru.h new file mode 100644 index 00000000..e5c04096 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_eru.h @@ -0,0 +1,884 @@ +/** + * @file xmc_eru.h + * @date 2016-03-10 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * - Documentation updates
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-10-07: + * - Doc update for XMC_ERU_ETL_CONFIG_t field
+ * + * 2016-03-10: + * - XMC_ERU_ETL_GetEdgeDetection() API is added to get the configured edge for event generation.
+ * + * @endcond + */ + +#ifndef XMC_ERU_H +#define XMC_ERU_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ + +#include "xmc_common.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup ERU + * @brief Event Request Unit (ERU) driver for the XMC microcontroller family. + * + * The Event Request Unit (ERU) is a versatile multiple input event detection and processing unit. + * The ERU module can be used to expand the P-to-P connections of the device: ports-to-peripherals, + * peripherals-to-peripherals and ports-to-ports. It also offers configurable logic, that allows the generation of + * triggers, pattern detection and real-time signal monitoring. + * + * @image html "eru_overview.png" + * + * The driver is divided into two sections: + * \par Event trigger logic (ERU_ETL): + * This section of the LLD provides the configuration structure XMC_ERU_ETL_CONFIG_t and the initialization function + * XMC_ERU_ETL_Init().\n + * It can be used to: + * -# Select one out of two inputs (A and B). For each of these two inputs, a vector of 4 possible signals is available. + * (XMC_ERU_ETL_SetSource()) + * -# Logically combine the two input signals to a common trigger. (XMC_ERU_ETL_SetSource()) + * -# Define the transition (edge selection, or by software) that leads to a trigger event and can also store this status. + * (XMC_ERU_ETL_SetEdgeDetection() and XMC_ERU_ETL_SetStatusFlag()) + * -# Distribute the events and status flags to the output channels. (XMC_ERU_ETL_EnableOutputTrigger()) + * + * \par Output gating unit (ERU_OGU): + * This section of the LLD provides the provides the configuration structure XMC_ERU_OGU_CONFIG_t and the initialization + * function XMC_ERU_ETL_OGU_Init(). + * It can be used to: + * -# Combine the trigger events and status information and gates the output depending on a gating signal. + * (XMC_ERU_OGU_EnablePatternDetection(), XMC_ERU_OGU_DisablePeripheralTrigger(), XMC_ERU_OGU_SetServiceRequestMode()) + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +#if defined(ERU0) +#define XMC_ERU0 ((XMC_ERU_t *) ERU0_BASE) /**< ERU module 0 */ +#endif + +#if defined(ERU1) +#define XMC_ERU1 ((XMC_ERU_t *) ERU1_BASE) /**< ERU module 1, only available in XMC4 family */ +#endif + +#if UC_FAMILY == XMC1 + #include "xmc1_eru_map.h" +#endif + +#if UC_FAMILY == XMC4 + #include "xmc4_eru_map.h" +#endif + +#if defined(XMC_ERU0) && defined(XMC_ERU1) +#define XMC_ERU_CHECK_MODULE_PTR(PTR) (((PTR)== XMC_ERU0) | ((PTR)== XMC_ERU1)) +#elif defined(XMC_ERU0) +#define XMC_ERU_CHECK_MODULE_PTR(PTR) (((PTR)== XMC_ERU0)) +#elif defined(XMC_ERU1) +#define XMC_ERU_CHECK_MODULE_PTR(PTR) (((PTR)== XMC_ERU0)) +#endif + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/** + * Defines input signal for path A of ERSx(Event request source, x = [0 to 3]) unit. + * @image html "eru_input_a.png" "ETLx Input A selection" +*/ +typedef enum XMC_ERU_ETL_INPUT_A +{ + XMC_ERU_ETL_INPUT_A0 = 0x0U, /**< input A0 is selected */ + XMC_ERU_ETL_INPUT_A1 = 0x1U, /**< input A1 is selected */ + XMC_ERU_ETL_INPUT_A2 = 0x2U, /**< input A2 is selected */ + XMC_ERU_ETL_INPUT_A3 = 0x3U /**< input A3 is selected */ +} XMC_ERU_ETL_INPUT_A_t; + +/** + * Defines input signal for path B of ERSx(Event request source, x = [0 to 3]) unit. + * @image html "eru_input_b.png" "ETLx Input B selection" + */ +typedef enum XMC_ERU_ETL_INPUT_B +{ + XMC_ERU_ETL_INPUT_B0 = 0x0U, /**< input B0 is selected */ + XMC_ERU_ETL_INPUT_B1 = 0x1U, /**< input B1 is selected */ + XMC_ERU_ETL_INPUT_B2 = 0x2U, /**< input B2 is selected */ + XMC_ERU_ETL_INPUT_B3 = 0x3U /**< input B3 is selected */ +} XMC_ERU_ETL_INPUT_B_t; + +/** + * Defines input path combination along with polarity for event generation by ERSx(Event request source) unit to + * ETLx(Event trigger logic),x = [0 to 3] unit. + * @image html "eru_input_trigger.png" "ETLx input trigger signal generation" + */ +typedef enum XMC_ERU_ETL_SOURCE +{ + XMC_ERU_ETL_SOURCE_A = 0x0U, /**< select (A) path as a event source */ + XMC_ERU_ETL_SOURCE_B = 0x1U, /**< select (B) path as a event source */ + XMC_ERU_ETL_SOURCE_A_OR_B = 0x2U, /**< select (A OR B) path as a event source */ + XMC_ERU_ETL_SOURCE_A_AND_B = 0x3U, /**< select (A AND B) path as a event source */ + XMC_ERU_ETL_SOURCE_NOT_A = 0x4U, /**< select (inverted A) path as a event source */ + XMC_ERU_ETL_SOURCE_NOT_A_OR_B = 0x6U, /**< select (inverted A OR B) path as a event source */ + XMC_ERU_ETL_SOURCE_NOT_A_AND_B = 0x7U, /**< select (inverted A AND B) path as a event source */ + XMC_ERU_ETL_SOURCE_NOT_B = 0x9U, /**< select (inverted B) path as a event source */ + XMC_ERU_ETL_SOURCE_A_OR_NOT_B = 0xaU, /**< select (A OR inverted B) path as a event source */ + XMC_ERU_ETL_SOURCE_A_AND_NOT_B = 0xbU, /**< select (A AND inverted B) path as a event source */ + XMC_ERU_ETL_SOURCE_NOT_A_OR_NOT_B = 0xeU, /**< select (inverted A OR inverted B) path as a event + source */ + XMC_ERU_ETL_SOURCE_NOT_A_AND_NOT_B = 0xfU /**< select (inverted A AND inverted B) path as a event + source */ +} XMC_ERU_ETL_SOURCE_t; + +/** + * Defines trigger edge for the event generation by ETLx (Event Trigger Logic, x = [0 to 3]) unit, by getting the signal + * from ERSx(Event request source, x = [0 to 3]) unit. + */ +typedef enum XMC_ERU_ETL_EDGE_DETECTION +{ + XMC_ERU_ETL_EDGE_DETECTION_DISABLED = 0U, /**< no event enabled */ + XMC_ERU_ETL_EDGE_DETECTION_RISING = 1U, /**< detection of rising edge generates the event */ + XMC_ERU_ETL_EDGE_DETECTION_FALLING = 2U, /**< detection of falling edge generates the event */ + XMC_ERU_ETL_EDGE_DETECTION_BOTH = 3U /**< detection of either edges generates the event */ +} XMC_ERU_ETL_EDGE_DETECTION_t; + +/** + * Defines Output Channel of OGUy(Output gating unit y = [0 to 3]) to be mapped by the trigger pulse generated by + * ETLx(Event Trigger Logic, x = [0 to 3]) unit. + * @note Generation of output trigger pulse need to be enabled @ref XMC_ERU_OGU_PERIPHERAL_TRIGGER_t + * @image html "eru_connection_matrix.png" "ERU_ETL ERU_OGU Connection matrix" + */ +typedef enum XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL +{ + XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL0 = 0U, /**< Event from input ETLx triggers output OGU0 */ + XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL1 = 1U, /**< Event from input ETLx triggers output OGU1 */ + XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL2 = 2U, /**< Event from input ETLx triggers output OGU2 */ + XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL3 = 3U, /**< Event from input ETLx triggers output OGU3 */ +} XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL_t; + +/** + * Defines generation of the trigger pulse by ETLx(Event Trigger Logic, x = [0 to 3]) unit. + * Use type XMC_ERU_ETL_OUTPUT_TRIGGER_t for this enum. + */ +typedef enum XMC_ERU_ETL_OUTPUT_TRIGGER +{ + XMC_ERU_ETL_OUTPUT_TRIGGER_DISABLED = 0U, /**< trigger pulse generation disabled */ + XMC_ERU_ETL_OUTPUT_TRIGGER_ENABLED = 1U /**< trigger pulse generation enabled */ +} XMC_ERU_ETL_OUTPUT_TRIGGER_t; + +/** + * Defines status flag reset mode generated by ETLx(Event Trigger Logic, x = [0 to 3]) unit. + * Use type XMC_ERU_ETL_STATUS_FLAG_MODE_t for this enum. + */ +typedef enum XMC_ERU_ETL_STATUS_FLAG_MODE +{ + XMC_ERU_ETL_STATUS_FLAG_MODE_SWCTRL = 0U, /**< Status flag is in sticky mode. Retain the same state until + cleared by software. In case of pattern match this mode + is used. */ + XMC_ERU_ETL_STATUS_FLAG_MODE_HWCTRL = 1U /**< Status flag is in non-sticky mode. Automatically cleared by + the opposite edge detection.\n + eg. if positive edge is selected as trigger event, for the + negative edge event the status flag is cleared. */ +} XMC_ERU_ETL_STATUS_FLAG_MODE_t; + +/** + * Defines pattern detection feature to be enabled or not in OGUy(Output gating unit, y = [0 to 3]). + * + */ +typedef enum XMC_ERU_OGU_PATTERN_DETECTION +{ + XMC_ERU_OGU_PATTERN_DETECTION_DISABLED = 0U, /**< Pattern match is disabled */ + XMC_ERU_OGU_PATTERN_DETECTION_ENABLED = 1U /**< Pattern match is enabled, the selected status flags of + ETLx(Event Trigger Logic, x = [0 to 3]) unit, are + used in pattern detection. */ +} XMC_ERU_OGU_PATTERN_DETECTION_t; + +/** + * Defines the inputs for Pattern detection. The configured status flag signal from the ETLx(Event Trigger Logic, + * x = [0 to 3]) unit indicates the pattern to be detected. + */ +typedef enum XMC_ERU_OGU_PATTERN_DETECTION_INPUT +{ + XMC_ERU_OGU_PATTERN_DETECTION_INPUT0 = 1U, /**< Status flag ETL0, participating in pattern match */ + XMC_ERU_OGU_PATTERN_DETECTION_INPUT1 = 2U, /**< Status flag ETL1, participating in pattern match */ + XMC_ERU_OGU_PATTERN_DETECTION_INPUT2 = 4U, /**< Status flag ETL0, participating in pattern match */ + XMC_ERU_OGU_PATTERN_DETECTION_INPUT3 = 8U /**< Status flag ETL0, participating in pattern match */ +} XMC_ERU_OGU_PATTERN_DETECTION_INPUT_t; + +/** + * Defines peripheral trigger signal for event generation. Based on the selected peripheral for event generation, + * the trigger signal is mapped. + */ +typedef enum XMC_ERU_OGU_PERIPHERAL_TRIGGER +{ + XMC_ERU_OGU_PERIPHERAL_TRIGGER1 = 1U, /**< OGUy1 signal is mapped for event generation */ + XMC_ERU_OGU_PERIPHERAL_TRIGGER2 = 2U, /**< OGUy2 signal is mapped for event generation */ + XMC_ERU_OGU_PERIPHERAL_TRIGGER3 = 3U /**< OGUy3 signal is mapped for event generation */ +} XMC_ERU_OGU_PERIPHERAL_TRIGGER_t; + +/** + * Defines the gating scheme for service request generation. In later stage of the OGUy(Output gating unit, + * y = [0 to 3]) based on the gating scheme selected ERU_GOUTy(gated output signal) output is defined. + * @image html "interrupt_gating_signal.png" "Interrupt gating signal" + */ +typedef enum XMC_ERU_OGU_SERVICE_REQUEST +{ + XMC_ERU_OGU_SERVICE_REQUEST_DISABLED = 0U, /**< Service request blocked, ERUx_GOUTy = 0 */ + XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER = 1U, /**< Service request generated enabled, ERUx_GOUTy = 1 */ + XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER_AND_PATTERN_MATCH = 2U, /**< Service request generated on trigger + event and input pattern match, + ERUx_GOUTy = ~pattern matching result*/ + XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER_AND_PATTERN_MISMATCH = 3U/**< Service request generated on trigger + event and input pattern mismatch, + ERUx_GOUTy = pattern matching result*/ +} XMC_ERU_OGU_SERVICE_REQUEST_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * ERU module + */ +typedef struct { + union { + __IO uint32_t EXISEL; + + struct { + __IO uint32_t EXS0A : 2; + __IO uint32_t EXS0B : 2; + __IO uint32_t EXS1A : 2; + __IO uint32_t EXS1B : 2; + __IO uint32_t EXS2A : 2; + __IO uint32_t EXS2B : 2; + __IO uint32_t EXS3A : 2; + __IO uint32_t EXS3B : 2; + } EXISEL_b; + }; + __I uint32_t RESERVED0[3]; + + union { + __IO uint32_t EXICON[4]; + + struct { + __IO uint32_t PE : 1; + __IO uint32_t LD : 1; + __IO uint32_t ED : 2; + __IO uint32_t OCS : 3; + __IO uint32_t FL : 1; + __IO uint32_t SS : 4; + __I uint32_t RESERVED1 : 20; + } EXICON_b[4]; + }; + + union { + __IO uint32_t EXOCON[4]; + + struct { + __IO uint32_t ISS : 2; + __IO uint32_t GEEN : 1; + __I uint32_t PDR : 1; + __IO uint32_t GP : 2; + uint32_t : 6; + __IO uint32_t IPEN : 4; + __I uint32_t RESERVED2 : 16; + } EXOCON_b[4]; + }; +} XMC_ERU_t; + +/** + * \if XMC4 + * Structure for initializing ERUx_ETLy (x = [0..1], y = [0..4]) module. + * \endif + * \if XMC1 + * Structure for initializing ERUx_ETLy (x = [0], y = [0..4]) module. + * \endif + */ +typedef struct XMC_ERU_ETL_CONFIG +{ + union + { + uint32_t input; /**< While configuring the bit fields, the values have to be shifted according to the position */ + struct + { + uint32_t input_a: 2; /**< Configures input A. Refer @ref XMC_ERU_ETL_INPUT_A_t for valid values */ + uint32_t input_b: 2; /**< Configures input B. Refer @ref XMC_ERU_ETL_INPUT_B_t for valid values */ + uint32_t : 28; + }; + }; + + union + { + uint32_t raw; + struct + { + uint32_t enable_output_trigger: 1; /**< Enables the generation of trigger pulse(PE), for the configured edge + detection. This accepts boolean values as input. */ + uint32_t status_flag_mode: 1; /**< Enables the status flag auto clear(LD), for the opposite edge of the + configured event edge. This accepts boolean values as input. */ + uint32_t edge_detection: 2; /**< Configure the event trigger edge(FE, RE). + Refer @ref XMC_ERU_ETL_EDGE_DETECTION_t for valid values. */ + uint32_t output_trigger_channel: 3; /**< Output channel select(OCS) for ETLx output trigger pulse. + Refer @ref XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL_t for valid values. */ + uint32_t : 1; + uint32_t source: 4; /**< Input path combination along with polarity for event generation. + Refer @ref XMC_ERU_ETL_SOURCE_t for valid values. */ + uint32_t : 20; + }; + }; +} XMC_ERU_ETL_CONFIG_t; + +/** + * \if XMC4 + * Structure for initializing ERUx_OGUy (x = [0..1], y = [0..4]) module. + * \endif + * \if XMC1 + * Structure for initializing ERUx_OGUy (x = [0], y = [0..4]) module. + * \endif + */ +typedef union XMC_ERU_OGU_CONFIG +{ + uint32_t raw; + + struct + { + uint32_t peripheral_trigger: 2; /**< peripheral trigger(ISS) input selection. + Refer @ref XMC_ERU_OGU_PERIPHERAL_TRIGGER_t for valid values. */ + uint32_t enable_pattern_detection: 1; /**< Enable generation of(GEEN) event for pattern detection result change. + This accepts boolean values as input. */ + uint32_t : 1; + uint32_t service_request: 2; /**< Gating(GP) on service request generation for pattern detection result. + Refer @ref XMC_ERU_OGU_SERVICE_REQUEST_t for valid values. */ + uint32_t : 6; + uint32_t pattern_detection_input: 4; /**< Enable input for the pattern detection(IPENx, x = [0 to 3]). + Refer @ref XMC_ERU_OGU_PATTERN_DETECTION_INPUT_t for valid values. + OR combination of the enum items given as input */ + uint32_t : 16; + }; +} XMC_ERU_OGU_CONFIG_t; + +/*Anonymous structure/union guard end */ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif +/********************************************************************************************************************* + * API PROTOTYPES + ********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * + * @return None + * + * \parDescription:
+ * \if XMC4 + * If ERU1 module is selected, it enables clock and releases reset.
+ * \endif + * \if XMC1 + * Abstract API, not mandatory to call.
+ * \endif + * \par + * This API is called by XMC_ERU_ETL_Init() or XMC_ERU_OGU_Init() and therefore no need to call it explicitly during + * initialization sequence. Call this API to enable ERU1 module once again if the module is disabled by calling + * XMC_ERU_Disable(). For ERU0 module clock gating and reset features are not available. + * + * \parNote:
+ * \if XMC4 + * 1. Required to configure ERU1 module again after calling XMC_ERU_Disable(). Since the all the registers are + * reset with default values. + * \endif + * \parRelated APIs:
+ * XMC_ERU_ETL_Init(), XMC_ERU_OGU_Init(), XMC_ERU_Disable(). + */ +void XMC_ERU_Enable(XMC_ERU_t *const eru); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * + * @return None + * + * \parDescription:
+ * \if XMC4 + * Disables clock and releases reset for ERU1 module.
+ * \endif + * \if XMC1 + * Abstract API, not mandatory to call.
+ * \endif + * + * \parNote:
+ * \if XMC4 + * 1. Required to configure ERU1 module again after calling XMC_ERU_ETL_Init() or XMC_ERU_OGU_Init(). Since the all the + * registers are reset with default values. + * \endif + * \parRelated APIs:
+ * XMC_ERU_Enable() + */ +void XMC_ERU_Disable(XMC_ERU_t *const eru); + +/* ERU_ETL APIs */ + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_ETLx(Event trigger logic unit) channel + * Range : [0 to 3] + * @param config pointer to a constant ERU_ETLx configuration data structure. + * Refer data structure XMC_ERU_ETL_CONFIG_t for detail. + * + * @return None + * + * Description:
+ * Initializes the selected ERU_ETLx \a channel with the \a config structure.
+ * + * Invokes XMC_ERU_Enable() to enable \a eru module clock. Then configures + *
    + *
  • Input signal for path A and Path B,
  • + *
  • Trigger pulse generation,
  • + *
  • status flag clear mode,
  • + *
  • Event Trigger edge,
  • + *
  • Output Channel of OGUy(Output gating unit y = [0 to 3]) to be mapped by the trigger pulse,
  • + *
  • input path combination along with polarity for event generation
  • + *
. + */ +void XMC_ERU_ETL_Init(XMC_ERU_t *const eru, const uint8_t channel, const XMC_ERU_ETL_CONFIG_t *const config); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3] + * @param input_a input signal for path A of ERSx(Event request source, x = [0 to 3]) unit.\n + * Refer XMC_ERU_ETL_INPUT_A_t for valid value or xmc1_eru_map.h/xmc4_eru_map.h file where the mapping of + * the input is done based on selected signal.\n + * e.g: ERU0_ETL3_INPUTA_P2_7. + * @param input_b input signal for path B of ERSx(Event request source, x = [0 to 3]) unit.\n + * Refer XMC_ERU_ETL_INPUT_B_t for valid value or xmc1_eru_map.h/xmc4_eru_map.h file where the mapping of + * the input is done based on selected signal.\n + * e.g: ERU0_ETL0_INPUTB_P2_0. + * + * @return None + * + * \parDescription:
+ * Configures the event source for path A and path B in with selected \a input_a and \a input_b respectively.
+ * \par + * These values are set during initialization in XMC_ERU_ETL_Init(). Call this to change the input, as needed later in + * the program. According to the ports/peripheral selected, the event source has to be changed. + */ +void XMC_ERU_ETL_SetInput(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_INPUT_A_t input_a, + const XMC_ERU_ETL_INPUT_B_t input_b); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3] + * @param source input path combination along with polarity for event generation by ERSx(Event request source) unit. + * Refer @ref XMC_ERU_ETL_SOURCE_t enum for valid input values. + * + * @return None + * + * \parDescription:
+ * Select input path combination along with polarity for event generation by setting (SS, NA, NB) bits in + * ERSx(Event request source) unit
+ * \par + * The signal ERSxO is generated from the selection and this is connected to ETLx(Event trigger logic, + * x = [0 to 3]) for further action. These values are set during initialization in XMC_ERU_ETL_Init(). Call this to + * change the source, as needed later in the program. + */ +void XMC_ERU_ETL_SetSource(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_SOURCE_t source); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3] + * @param edge_detection event trigger edge. + * Refer @ref XMC_ERU_ETL_EDGE_DETECTION_t enum for valid values. + * + * @return None + * + * \parDescription:
+ * Configure event trigger edge/s by setting (RE, FE) bits of EXICONx(x = [0 to 3]) register.
+ * \par + * Rising edge, falling edge or either edges can be selected to generate the event.These values are set during + * initialization in XMC_ERU_ETL_Init(). Call this to change the trigger edge, as needed later in the program. + */ +void XMC_ERU_ETL_SetEdgeDetection(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_EDGE_DETECTION_t edge_detection); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3] + * + * @return XMC_ERU_ETL_EDGE_DETECTION_t indicate which egde/s is configured for event generation + * + * \parDescription:
+ * Return event trigger edge/s by reading (RE, FE) bits of EXICONx(x = [0 to 3]) register.
+ * \par + * Rising edge, falling edge or either edges can be selected to generate the event. + * Call this to get the configured trigger edge. */ +XMC_ERU_ETL_EDGE_DETECTION_t XMC_ERU_ETL_GetEdgeDetection(XMC_ERU_t *const eru, + const uint8_t channel); +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3] + * + * @return None + * + * \parDescription:
+ * Set the status flag bit(FL) in EXICONx(x = [0 to 3]).
+ * \par + * The status flag indicates that the configured event has occurred. This status flag is used in Pattern match detection + * by OGUy(Output gating unit, y = [0 to 3]). + * \par + * \parRelated APIs:
+ * XMC_ERU_ETL_ClearStatusFlag(), XMC_ERU_ETL_GetStatusFlag() + */ +__STATIC_INLINE void XMC_ERU_ETL_SetStatusFlag(XMC_ERU_t *const eru, const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_ETL_SetStatusFlag:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_SetStatusFlag:Invalid Channel Number", (channel < 4U)); + + eru->EXICON_b[channel].FL = true; +} + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3] + * + * @return None + * + * \parDescription:
+ * Set the status flag bit(FL) in EXICONx(x = [0 to 3]).
+ * \par + * If auto clear of the status flag is not enabled by detection of the opposite edge of the event edge, this API clears + * the Flag. SO that next event is considered as new event. + * \parRelated APIs:
+ * XMC_ERU_ETL_SetStatusFlag(), XMC_ERU_ETL_GetStatusFlag() + */ +__STATIC_INLINE void XMC_ERU_ETL_ClearStatusFlag(XMC_ERU_t *const eru, const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_ETL_ClearStatusFlag:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_ClearStatusFlag:Invalid Channel Number", (channel < 4U)); + + eru->EXICON_b[channel].FL = false; +} + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3]. + * + * @return uint32_t Current state of the status flag bit(FL). Result is in 32-bit format. + * + * \parDescription:
+ * Returns status flag state of \a channel. + * \par + * The function can typically be used to clear the status flag using software, when auto clear is not enabled. + * + * \parRelated APIs:
+ * XMC_ERU_ETL_SetStatusFlag(), XMC_ERU_ETL_ClearStatusFlag() + */ +__STATIC_INLINE uint32_t XMC_ERU_ETL_GetStatusFlag(XMC_ERU_t *const eru, const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_ETL_GetStatusFlag:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_GetStatusFlag:Invalid Channel Number", (channel < 4U)); + + return (uint32_t)eru->EXICON_b[channel].FL; +} + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3]. + * @param mode Set whether status flag has to be cleared by software or hardware. + * Refer @ref XMC_ERU_ETL_STATUS_FLAG_MODE_t for valid value. + * + * @return None + * + * \parDescription:
+ * Set the mode for status flag mode by setting (LD) bit in EXICONx(x = \a channel) register.
+ * \par + * If SWCTRL is selected, status flag has to be cleared by software. This is typically used for pattern match detection. + * If HWCTRL is selected, status flag is cleared by hardware. If Positive edge is selected as event edge, for negative + * edge status flag is cleared and vice versa.This is typically used for continuous event detection.These values are set + * during initialization in XMC_ERU_ETL_Init(). Call this to change the trigger edge, as needed later in the program. + * + * \parRelated APIs:
+ * XMC_ERU_ETL_ClearStatusFlag(), XMC_ERU_ETL_GetStatusFlag() + */ +void XMC_ERU_ETL_SetStatusFlagMode(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_STATUS_FLAG_MODE_t mode); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3]. + * @param trigger Output Channel of OGUy(Output gating unit y = [0 to 3]) to be mapped by the trigger pulse + * Refer @ref XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL_t for valid value. + * + * @return None + * + * \parDescription:
+ * Configure which Channel of OGUy(Output gating unit y = [0 to 3]) to be mapped by the trigger pulse generated by + * ETLx(Event Trigger Logic, x = \a channel) by setting (OCS and PE) bit fields. + * \par + * The trigger pulse is generated for one clock pulse along with the flag status update. This is typically used to + * trigger the ISR for the external events. The configured OGUy(Output gating unit y = [0 to 3]), generates the event + * based on the trigger pulse.If output trigger pulse generation is disabled by XMC_ERU_ETL_DisableOutputTrigger(), + * XMC_ERU_ETL_EnableOutputTrigger() can called to reconfigure. These values are set during initialization in + * XMC_ERU_ETL_Init(). Call this to change the trigger edge, as needed later in the program. + * + * \parRelated APIs:
+ * XMC_ERU_ETL_DisableOutputTrigger() + */ +void XMC_ERU_ETL_EnableOutputTrigger(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL_t trigger); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address. + * @param channel ERU_ETLx(Event trigger logic unit) channel. + * Range : [0 to 3]. + * + * @return None + * + * \parDescription:
+ * Disables the trigger pulse generation by clearing the (PE) of the EXICONx(x = \a channel). + * \par + * Typically this can used when only pattern match is being used for event generation. + * + * \parRelated APIs:
+ * XMC_ERU_ETL_EnableOutputTrigger() + */ +void XMC_ERU_ETL_DisableOutputTrigger(XMC_ERU_t *const eru, const uint8_t channel); + +/* ERU_OGU APIs */ + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_OGUy(Output gating unit) channel + * Range : [0 to 3] + * @param config pointer to constant ERU_OGUy configuration data structure. + * Refer data structure XMC_ERU_OGU_CONFIG_t for detail. + * + * @return None + * + * Description:
+ * Initializes the selected ERU_OGUy \a channel with the \a config structure.
+ * + * Invokes XMC_ERU_Enable() to enable \a eru module clock. Then configures + *
    + *
  • Pattern detection,
  • + *
  • Peripheral trigger input,
  • + *
  • Gating for service request generation
  • + *
. + */ +void XMC_ERU_OGU_Init(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_CONFIG_t *const config); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_OGUy(Output gating unit) channel + * Range : [0 to 3] + * @param input ERU_ETLx(x = [0 to 3]), for pattern match detection. + * Refer @ref XMC_ERU_OGU_PATTERN_DETECTION_INPUT_t for valid values. Logical OR combination of the + * enum items can be passed as the input. + * + * @return None + * + * \parDescription:
+ * Configures ERU_ETLx(x = [0 to 3]) for pattern match detection by setting IPENx(x = [0 to 3]) and GEEN bits. + * \par + * These bits are dedicated to each channel of the ERU_ETLx(x = [0 to 3]). These values are set during initialization in + * XMC_ERU_OGU_Init(). Call this to change the pattern, as needed later in the program. + * + * \parRelated APIs:
+ * XMC_ERU_OGU_DisablePatternDetection(), XMC_ERU_OGU_GetPatternDetectionStatus() + */ +void XMC_ERU_OGU_EnablePatternDetection(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_PATTERN_DETECTION_INPUT_t input); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_OGUy(Output gating unit) channel + * Range : [0 to 3] + * + * @return None + * + * \parDescription:
+ * Disable the pattern detection by clearing (GEEN) bit. + * \par + * Typically XMC_ERU_OGU_DisablePatternDetection is used when events has to be generated peripheral triggers. + * + * \parRelated APIs:
+ * XMC_ERU_OGU_EnablePatternDetection(), XMC_ERU_OGU_GetPatternDetectionStatus() + */ +void XMC_ERU_OGU_DisablePatternDetection(XMC_ERU_t *const eru, const uint8_t channel); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_OGUy(Output gating unit) channel + * Range : [0 to 3] + * + * @return uint32_t returns the pattern match result. Result is in 32-bit format. + * + * \parDescription:
+ * This API returns the pattern match result by reading (PDR) bit. + * \par + * \parRelated APIs:
+ * XMC_ERU_OGU_EnablePatternDetection(), XMC_ERU_OGU_DisablePatternDetection() + */ +__STATIC_INLINE uint32_t XMC_ERU_OGU_GetPatternDetectionStatus(XMC_ERU_t *const eru, + const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_OGU_GetPatternDetectionStatus:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_OGU_GetPatternDetectionStatus:Invalid Channel Number", (channel < 4U)); + + return (uint32_t)eru->EXOCON_b[channel].PDR; +} + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_OGUy(Output gating unit) channel + * Range : [0 to 3] + * @param peripheral_trigger which peripheral trigger signal is used for event generation. + * Refer @ref XMC_ERU_OGU_PERIPHERAL_TRIGGER_t for the valid values, or + xmc1_eru_map.h/xmc4_eru_map.h file where the mapping of the peripheral input is done based + on input. e.g: ERU0_OGU0_PERIPHERAL_TRIGGER_CCU40_SR0. + * + * @return None + * + * \parDescription:
+ * Configures peripheral trigger input, by setting (ISS) bit. + * \par + * Based on the peripheral the input signal has to be selected. These values are set during initialization in + * XMC_ERU_OGU_Init(). Call this to change the input, as needed later in the program. + * + * \parRelated APIs:
+ * XMC_ERU_OGU_DisablePeripheralTrigger() + */ +void XMC_ERU_OGU_EnablePeripheralTrigger(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_PERIPHERAL_TRIGGER_t peripheral_trigger); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_OGUy(Output gating unit) channel + * Range : [0 to 3] + * + * @return None + * + * \parDescription:
+ * Disables event generation based on peripheral trigger by clearing (ISS) bit. + * \par + * This is typically used when peripheral trigger is no longer need. After calling + * XMC_ERU_OGU_DisablePeripheralTrigger(), XMC_ERU_OGU_EnablePeripheralTrigger() has to be called to reconfigure the + * signals again. + * + * \parRelated APIs:
+ * XMC_ERU_OGU_EnablePeripheralTrigger() + */ +void XMC_ERU_OGU_DisablePeripheralTrigger(XMC_ERU_t *const eru, + const uint8_t channel); + +/** + * @param eru A constant pointer to XMC_ERU_t, pointing to the ERU base address + * @param channel ERU_OGUy(Output gating unit) channel + * Range : [0 to 3] + * @param mode gating scheme for service request generation. + * Refer @ref XMC_ERU_OGU_SERVICE_REQUEST_t for valid values. + * + * @return None + * + * \parDescription:
+ * Configures the gating scheme for service request generation by setting (GP) bit.
+ * \par + * Typically this function is used to change the service request generation scheme. These values are set during + * initialization in XMC_ERU_OGU_Init(). Call this to change the gating mode, as needed later in the program. + * + */ +void XMC_ERU_OGU_SetServiceRequestMode(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_SERVICE_REQUEST_t mode); + +#ifdef __cplusplus +} +#endif + +/** + * @} (end addtogroup ERU) + */ + +/** + * @} (end addtogroup XMClib) + */ + +#endif /* XMC_ERU_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_flash.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_flash.h new file mode 100644 index 00000000..355dc3b5 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_flash.h @@ -0,0 +1,276 @@ +/** + * @file xmc_flash.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2014-12-10: + * - Initial
+ * 2015-02-20: + * - Updated for Documentation related changes
+ * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * @endcond + * + */ + + +#ifndef XMC_FLASH_H +#define XMC_FLASH_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ + +#include "xmc_common.h" + +#if UC_FAMILY == XMC1 + #include "xmc1_flash.h" +#endif + +#if UC_FAMILY == XMC4 + #include "xmc4_flash.h" +#endif + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup FLASH + * @brief Flash driver for XMC microcontroller family. + * + * Flash is a non volatile memory module used to store instruction code or constant data. + * The flash low level driver provides support to the following functionalities of flash memory.
+ *
    + * \if XMC4 + *
  1. Provides function to program a page. ( XMC_FLASH_ProgramPage() )

  2. + *
  3. Provides functions to support read and write protection. ( XMC_FLASH_InstallProtection(), + * XMC_FLASH_ConfirmProtection(), XMC_FLASH_VerifyReadProtection(), XMC_FLASH_VerifyWriteProtection() )

  4. + *
  5. Provides function to erase sector. ( XMC_FLASH_EraseSector() )

  6. + * \endif + * \if XMC1 + *
  7. Provides functions to program and verify pages. ( XMC_FLASH_ProgramPage(), XMC_FLASH_ProgramPages() + * XMC_FLASH_ProgramVerifyPage() )

  8. + *
  9. Provides functions to write and verify blocks. ( XMC_FLASH_WriteBlocks(), XMC_FLASH_VerifyBlocks() )

  10. + *
  11. Provides functions to read data in terms of word and blocks. ( XMC_FLASH_ReadBlocks(), XMC_FLASH_ReadWord() ) + *

  12. + *
  13. Provides function to erase page. ( XMC_FLASH_ErasePage() )

  14. + * \endif + *
+ * @{ + */ + +/******************************************************************************* + * API PROTOTYPE + *******************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * + * @param None + * + * @return None + * + * \parDescription:
+ * \if XMC1 + * Clears the previous error status by reseting the ECC and VERR error status bits of NVMSTATUS register.\n\n + * Call this API before starting any flash programming / erase related APIs to ensure all previous errors are cleared. + * \endif + * \if XMC4 + * Clears the previous error status by reseting the FSR status register.\n\n Call this API before starting any flash + * programming / erase related APIs to ensure all previous errors are cleared. + * \endif + * + * \parRelated APIs:
+ * None + * + */ +void XMC_FLASH_ClearStatus(void); + +/** + * + * @param None + * + * @return uint32_t Status of the previous flash operation. + * + * \parDescription:
+ * \if XMC1 + * Informs the status of flash by reading the NVMSTATUS register.\n\n It indicates the ECC, VERR(verification error), + * WRPERR (Write protocol error) errors as well as the current flash state. After calling the flash read/write/erase + * operation related APIs, call this API to get the verification status. The return value of this API shall be checked + * against the members of @ref XMC_FLASH_STATUS_t enumeration to get the relevant status. + * \endif + * \if XMC4 + * Informs the status of flash by reading the FSR register.\n\n It indicates the error status such as PFOPER, SQER, + * PROER, PFDBER, ORIER, VER errors as well as the current flash state. After calling the flash read/write/erase + * operation related APIs, call this API to verify flash status. The return value of this API shall be checked against + * the members of @ref XMC_FLASH_STATUS_t enumeration to get the relevant status. + * \endif + * + * \parRelated APIs:
+ * None + * + */ +uint32_t XMC_FLASH_GetStatus(void); + +/** + * + * @param event_msk ORed values of @ref XMC_FLASH_EVENT_t enumeration + * + * @return None + * + * \parDescription:
+ * Enables the particular flash events as specified in the input parameter.\n + * + * \parRelated APIs:
+ * XMC_FLASH_DisableEvent()\n\n\n + * + */ +void XMC_FLASH_EnableEvent(const uint32_t event_msk); + +/** + * + * @param event_msk ORed values of @ref XMC_FLASH_EVENT_t enumeration + * + * @return None + * + * \parDescription:
+ * Disables the particular flash events as specified in the input parameter.\n + * + * \parRelated APIs:
+ * XMC_FLASH_EnableEvent()\n\n\n + * + */ +void XMC_FLASH_DisableEvent(const uint32_t event_msk); + +/** + * + * @param address Pointer to the starting address of flash page from where the programming starts. + * @param data Pointer to the source address where targeted data is located. + * + * @return None + * + * \parDescription:
+ * \if XMC1 + * Programs a single flash page associated with the specified \a address.\n\n XMC1000 Flash can be programmed with one + * page (256 bytes) using this API. It calls the Flash Firmware routine \a XMC1000_NvmProgVerify(unsigned long pageAddr) + * to perform the programming. Refer XMC1000 reference manual of for more details on flash firmware routines + * (Section 25.3). Call XMC_FLASH_GetStatus() API after calling this API, to verify the programming operation. + * \endif + * \if XMC4 + * Programs a single flash page associated with the specified \a address.\n\n XMC4000 flash can be programmed with a + * granularity of 256 bytes page using this API. Before entering into page write process, it clears the error status + * bits inside status register. It starts the write process by issuing the page mode command followed by the load page + * command which loads the targeted \a data blocks into internal assembly buffer. Finally, it issues the write page + * command which programs the \a data into flash. Call XMC_FLASH_GetStatus() API after calling this API, to verify the + * programming operation.\n + * \endif + * + * \parNote:
+ * Flash will be busy state during write is ongoing, hence no operations allowed until it completes. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_FLASH_ProgramPage(uint32_t *address, const uint32_t *data); + +/** + * + * @param address Pointer to the starting address of the page to be erased. + * + * @return None + * + * \parDescription:
+ * \if XMC1 + * Erases a complete sector starting from the \a address specified.\n\n XMC1000 Flash can be erased with granularity + * of one page = 16 blocks of 16 Bytes = 256 Bytes using this API. It internally calls XMC_FLASH_ErasePages API 16 + * times starting from the first page of the sector.. Call XMC_FLASH_GetStatus() API after calling this API, + * to verify the erase operation.\n + * \endif + * + * \if XMC4 + * Erases a sector associated with the specified \a address.\n\n Before erase, it clears the error status bits inside + * FSR status register. Issues the erase sector command sequence with the specified starting \a address to start flash + * erase process. Call XMC_FLASH_GetStatus() API after calling this API, to verify the erase operation.\n + * \endif + * \if XMC1 + * \parRelated APIs:
+ * XMC_FLASH_ErasePages() \n\n\n + * \endif + * \if XMC4 + * \parRelated APIs:
+ * None + * \endif + */ +void XMC_FLASH_EraseSector(uint32_t *address); + +/** + * + * @param None + * + * @return true if flash is in busy state else returns \a false. + * + * \parDescription:
+ * Checks whether flash is in busy state or not.\n\n It is checked by calling the XMC_FLASH_GetStatus() API internally. + * Refer XMC_FLASH_GetStatus() for more details.\n + * + * \parRelated APIs:
+ * XMC_FLASH_GetStatus()\n\n\n + * + */ +__STATIC_INLINE bool XMC_FLASH_IsBusy(void) +{ + return (bool)(XMC_FLASH_GetStatus() & XMC_FLASH_STATUS_BUSY); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_gpio.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_gpio.h new file mode 100644 index 00000000..671cdc0b --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_gpio.h @@ -0,0 +1,478 @@ +/** + * @file xmc_gpio.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * - Documentation improved
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * @endcond + * + */ + +#ifndef XMC_GPIO_H +#define XMC_GPIO_H + +/********************************************************************************************************************** + * HEADER FILES + *********************************************************************************************************************/ + +#include "xmc_common.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup GPIO + * @brief General Purpose Input Output (GPIO) driver for the XMC microcontroller family. + * + * GPIO driver provide a generic and very flexible software interface for all standard digital I/O port pins. + * Each port slice has individual interfaces for the operation as General Purpose I/O and it further provides the + * connectivity to the on-chip periphery and the control for the pad characteristics. + * + * The driver is divided into Input and Output mode. + * + * Input mode features: + * -# Configuration structure XMC_GPIO_CONFIG_t and initialization function XMC_GPIO_Init() + * -# Allows the selection of weak pull-up or pull-down device. Configuration structure XMC_GPIO_MODE_t and function XMC_GPIO_SetMode() + * \if XMC1 + * -# Allows the selection of input hysteresis. XMC_GPIO_SetInputHysteresis() + * \endif + * + * + * Output mode features: + * -# Allows the selection of push pull/open drain and Alternate output. Configuration structure XMC_GPIO_MODE_t and function XMC_GPIO_SetMode() + * \if XMC4 + * -# Allows the selection of pad driver strength. Configuration structure XMC_GPIO_OUTPUT_STRENGTH_t and function XMC_GPIO_SetOutputStrength() + * \endif + * + * -# Allows the selection of initial output level. Configuration structure XMC_GPIO_OUTPUT_LEVEL_t and function XMC_GPIO_SetOutputLevel() + * + *@{ + */ + +/********************************************************************************************************************** + * MACROS + *********************************************************************************************************************/ + +#define PORT_IOCR_PC_Pos PORT0_IOCR0_PC0_Pos +#define PORT_IOCR_PC_Msk PORT0_IOCR0_PC0_Msk + +#define PORT_IOCR_PC_Size (8U) + + +#define XMC_GPIO_CHECK_OUTPUT_LEVEL(level) ((level == XMC_GPIO_OUTPUT_LEVEL_LOW) || \ + (level == XMC_GPIO_OUTPUT_LEVEL_HIGH)) + +#define XMC_GPIO_CHECK_HWCTRL(hwctrl) ((hwctrl == XMC_GPIO_HWCTRL_DISABLED) || \ + (hwctrl == XMC_GPIO_HWCTRL_PERIPHERAL1) || \ + (hwctrl == XMC_GPIO_HWCTRL_PERIPHERAL2)) + +/********************************************************************************************************************** + * ENUMS + *********************************************************************************************************************/ + + +/** + * Defines output level of a pin. Use type \a XMC_GPIO_OUTPUT_LEVEL_t for this enum. + */ +typedef enum XMC_GPIO_OUTPUT_LEVEL +{ + XMC_GPIO_OUTPUT_LEVEL_LOW = 0x10000U, /**< Reset bit */ + XMC_GPIO_OUTPUT_LEVEL_HIGH = 0x1U, /**< Set bit */ +} XMC_GPIO_OUTPUT_LEVEL_t; + +/** + * Defines direct hardware control characteristics of the pin . Use type \a XMC_GPIO_HWCTRL_t for this enum. + */ +typedef enum XMC_GPIO_HWCTRL +{ + XMC_GPIO_HWCTRL_DISABLED = 0x0U, /**< Software control only */ + XMC_GPIO_HWCTRL_PERIPHERAL1 = 0x1U, /**< HWI0/HWO0 control path can override the software configuration */ + XMC_GPIO_HWCTRL_PERIPHERAL2 = 0x2U /**< HWI1/HWO1 control path can override the software configuration */ +} XMC_GPIO_HWCTRL_t; + +/********************************************************************************************************************** + * DEVICE FAMILY EXTENSIONS + *********************************************************************************************************************/ + + #if UC_FAMILY == XMC1 +#include "xmc1_gpio.h" +#elif UC_FAMILY == XMC4 +#include "xmc4_gpio.h" +#else +#error "xmc_gpio.h: family device not supported" +#endif + +/********************************************************************************************************************** + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @param port Constant pointer pointing to GPIO port, to access port registers like Pn_OUT,Pn_OMR,Pn_IOCR etc. + * @param pin Port pin number. + * @param config GPIO configuration data structure. Refer data structure @ref XMC_GPIO_CONFIG_t for details. + * + * @return None + * + * \parDescription:
+ * \if XMC1 + * Initializes input / output mode settings like, pull up / pull down devices,hysteresis, push pull /open drain. + * Also configures alternate function outputs and clears hardware port control for a selected \a port \a and \a pin. + * \a config provides selected I/O settings. It configures hardware registers Pn_IOCR,Pn_OUT, Pn_OMR,Pn_PDISC and Pn_PHCR. + * \endif + * \if XMC4 + * Initializes input / output mode settings like, pull up / pull down devices,push pull /open drain, and pad driver mode. + * Also configures alternate function outputs and clears hardware port control for selected \a port and \a pin . + * It configures hardware registers Pn_IOCR,Pn_OUT,Pn_OMR,Pn_PDISC and Pn_PDR.\n + * \endif + * + * \parRelated APIs:
+ * None + * + * \parNote:
+ * This API is called in definition of DAVE_init by code generation and therefore should not be explicitly called + * for the normal operation. Use other APIs only after DAVE_init is called successfully (returns DAVE_STATUS_SUCCESS). + * + * + */ + + +void XMC_GPIO_Init(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_CONFIG_t *const config); + +/** + * + * @param port Constant pointer pointing to GPIO port, to access hardware register Pn_IOCR. + * @param pin Port pin number. + * @param mode input / output functionality selection. Refer @ref XMC_GPIO_MODE_t for valid values. + * + * @return None + * + * \parDescription:
+ * Sets digital input and output driver functionality and characteristics of a GPIO port pin. It configures hardware + * registers Pn_IOCR. \a mode is initially configured during initialization in XMC_GPIO_Init(). Call this API to alter + * the port direction functionality as needed later in the program. + * + * \parRelated APIs:
+ * None + * + */ + +void XMC_GPIO_SetMode(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_MODE_t mode); + + +/** + * + * @param port Constant pointer pointing to GPIO port, to access hardware register Pn_OMR. + * @param pin Port pin number. + * @param level output level selection. Refer @ref XMC_GPIO_OUTPUT_LEVEL_t for valid values. + * + * @return None + * + * \parDescription:
+ * Set port pin output level to high or low.It configures hardware registers Pn_OMR.\a level is initially + * configured during initialization in XMC_GPIO_Init(). Call this API to alter output level as needed later in the program. + * + * \parRelated APIs:
+ * XMC_GPIO_SetOutputHigh(), XMC_GPIO_SetOutputLow(). + * + * \parNote:
+ * Prior to this api, user has to configure port pin to output mode using XMC_GPIO_SetMode(). + * + */ + + +__STATIC_INLINE void XMC_GPIO_SetOutputLevel(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_OUTPUT_LEVEL_t level) +{ + XMC_ASSERT("XMC_GPIO_SetOutputLevel: Invalid port", XMC_GPIO_CHECK_OUTPUT_PORT(port)); + XMC_ASSERT("XMC_GPIO_SetOutputLevel: Invalid output level", XMC_GPIO_CHECK_OUTPUT_LEVEL(level)); + + port->OMR = (uint32_t)level << pin; +} + + +/** + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_OMR. + * @param pin Port pin number. + * + * @return None + * + * \parDescription:
+ * Sets port pin output to high. It configures hardware registers Pn_OMR. + * + * \parRelated APIs:
+ * XMC_GPIO_SetOutputLow() + * + * \parNote:
+ * Prior to this api, user has to configure port pin to output mode using XMC_GPIO_SetMode().\n + * Register Pn_OMR is virtual and does not contain any flip-flop. A read action delivers the value of 0. + * + */ + +__STATIC_INLINE void XMC_GPIO_SetOutputHigh(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_SetOutputHigh: Invalid port", XMC_GPIO_CHECK_OUTPUT_PORT(port)); + + port->OMR = (uint32_t)0x1U << pin; +} + +/** + * + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_OMR. + * @param pin port pin number. + * + * @return None + * + *\parDescription:
+ * Sets port pin output to low. It configures hardware registers Pn_OMR.\n + * + * \parRelated APIs:
> + * XMC_GPIO_SetOutputHigh() + * + *\parNote:
+ * Prior to this api, user has to configure port pin to output mode using XMC_GPIO_SetMode(). + * Register Pn_OMR is virtual and does not contain any flip-flop. A read action delivers the value of 0.\n + * + */ + +__STATIC_INLINE void XMC_GPIO_SetOutputLow(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_SetOutputLow: Invalid port", XMC_GPIO_CHECK_OUTPUT_PORT(port)); + + port->OMR = 0x10000U << pin; +} + +/** + * + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_OMR. + * @param pin port pin number. + * + * @return None + * + * \parDescription:
+ * Configures port pin output to Toggle. It configures hardware registers Pn_OMR. + * + * \parRelated APIs:
+ * XMC_GPIO_SetOutputHigh(), XMC_GPIO_SetOutputLow(). + * + * \parNote:
+ * Prior to this api, user has to configure port pin to output mode using XMC_GPIO_SetMode(). Register Pn_OMR is virtual + * and does not contain any flip-flop. A read action delivers the value of 0. + * + */ + +__STATIC_INLINE void XMC_GPIO_ToggleOutput(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_ToggleOutput: Invalid port", XMC_GPIO_CHECK_OUTPUT_PORT(port)); + + port->OMR = 0x10001U << pin; +} + +/** + * + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_IN. + * @param pin Port pin number. + * + * @return uint32_t pin logic level status. + * + *\parDescription:
+ * Reads the Pn_IN register and returns the current logical value at the GPIO pin. + * + * \parRelated APIs:
+ * None + * + * \parNote:
+ * Prior to this api, user has to configure port pin to input mode using XMC_GPIO_SetMode(). + * + */ + +__STATIC_INLINE uint32_t XMC_GPIO_GetInput(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_GetInput: Invalid port", XMC_GPIO_CHECK_PORT(port)); + + return (((port->IN) >> pin) & 0x1U); +} + +/** + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_PPS. + * @param pin port pin number. + * + * @return None + * + * \parDescription:
+ * Enables pin power save mode and configures Pn_PPS register.This configuration is useful when the controller enters + * Deep Sleep mode.Port pin enabled with power save mode option are set to a defined state and the input Schmitt-Trigger + * as well as the output driver stage are switched off. By default port pin does not react to power save mode request. + * + * \parRelated APIs:
+ * XMC_GPIO_DisablePowerSaveMode() + * + * Note:
+ * Do not enable the Pin Power Save function for pins configured for Hardware Control (Pn_HWSEL.HWx != 00B). Doing so + * may result in an undefined behavior of the pin when the device enters the Deep Sleep state. + * + */ + + +__STATIC_INLINE void XMC_GPIO_EnablePowerSaveMode(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_EnablePowerSaveMode: Invalid port", XMC_GPIO_CHECK_PORT(port)); + + port->PPS |= (uint32_t)0x1U << pin; +} + + +/** + * + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_PPS. + * @param pin port pin number. + * + * @return None + * + * \parDescription:
+ * Disables pin power save mode and configures Pn_PPS register.This configuration is useful when the controller enters + * Deep Sleep mode. This configuration enables input Schmitt-Trigger and output driver stage(if pin is enabled power + * save mode previously). By default port \a pin does not react to power save mode request. + * + * \parRelated APIs:
+ * XMC_GPIO_EnablePowerSaveMode() + * + *\parNote:
+ * Do not enable the Pin Power Save function for pins configured for Hardware Control (Pn_HWSEL.HWx != 00B). Doing so + * may result in an undefined behavior of the pin when the device enters the Deep Sleep state. + * + */ + +__STATIC_INLINE void XMC_GPIO_DisablePowerSaveMode(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_DisablePowerSaveMode: Invalid port", XMC_GPIO_CHECK_PORT(port)); + + port->PPS &= ~(uint32_t)((uint32_t)0x1U << pin); +} + + +/** + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_HWSEL. + * @param pin port pin number. + * @param hwctrl direct hardware control selection. Refer @ref XMC_GPIO_HWCTRL_t for valid values. + * + * @return None + * + * \parDescription:
+ * Selects direct hard ware control and configures Pn_HWSEL register.This configuration is useful for the port pins + * overlaid with peripheral functions for which the connected peripheral needs hardware control. + * + * \parRelated APIs:
+ * None + * + *\parNote:
+ * Do not enable the Pin Power Save function for pins configured for Hardware Control (Pn_HWSEL.HWx != 00B). + * Doing so may result in an undefined behavior of the pin when the device enters the Deep Sleep state. + * + */ + +void XMC_GPIO_SetHardwareControl(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_HWCTRL_t hwctrl); + + +/** + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_PDISC. + * @param pin port pin number. + * + * @return None + * + * \parRelated APIs:
+ * None + * + * \parDescription:
+ * Enable digital input path for analog pins and configures Pn_PDISC register.This configuration is applicable only for + * analog port pins. + * + */ +__STATIC_INLINE void XMC_GPIO_EnableDigitalInput(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_EnableDigitalInput: Invalid analog port", XMC_GPIO_CHECK_ANALOG_PORT(port)); + + port->PDISC &= ~(uint32_t)((uint32_t)0x1U << pin); +} + + +/** + * @param port constant pointer pointing to GPIO port, to access hardware register Pn_PDISC. + * @param pin port pin number. + * + * @return None + * + * \parRelated APIs:
+ * None + * + * \parDescription:
+ * Disable digital input path for analog pins and configures Pn_PDISC register.This configuration is applicable only + * for analog port pins. + * + */ + +__STATIC_INLINE void XMC_GPIO_DisableDigitalInput(XMC_GPIO_PORT_t *const port, const uint8_t pin) +{ + XMC_ASSERT("XMC_GPIO_EnableDigitalInput: Invalid analog port", XMC_GPIO_CHECK_ANALOG_PORT(port)); + + port->PDISC |= (uint32_t)0x1U << pin; +} + +#ifdef __cplusplus +} +#endif + +/** + * @} (end addtogroup GPIO) + */ + +/** + * @} (end addtogroup XMClib) + */ + +#endif /* XMC_GPIO_H */ + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_i2c.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_i2c.h new file mode 100644 index 00000000..78ffb946 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_i2c.h @@ -0,0 +1,782 @@ +/** + * @file xmc_i2c.h + * @date 2016-05-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-05-20: + * - Description updated
+ * - Added XMC_I2C_CH_TriggerServiceRequest() and XMC_I2C_CH_SelectInterruptNodePointer()
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-08-27: + * - Added APIs for external input for BRG configuration:XMC_I2C_CH_ConfigExternalInputSignalToBRG()
+ * + * 2015-09-01: + * - Added APIs for enabling or disabling the ACK response to a 0x00 slave address: XMC_I2C_CH_EnableSlaveAcknowledgeTo00() and + * XMC_I2C_CH_DisableSlaveAcknowledgeTo00().
+ * - Modified XMC_I2C_CH_SetInputSource() API for avoiding complete DXCR register overwriting.
+ * - Modified XMC_I2C_CH_EVENT_t enum for supporting XMC_I2C_CH_EnableEvent() and XMC_I2C_CH_DisableEvent() + * for supporting multiple events configuration
+ * + * 2015-10-02: + * - Fix 10bit addressing + * + * 2015-10-07: + * - Fix register access in XMC_I2C_CH_EnableSlaveAcknowledgeTo00() and XMC_I2C_CH_DisableSlaveAcknowledgeTo00() APIs. + * - Naming of APIs modified: from XMC_I2C_CH_EnableSlaveAcknowledgeTo00() to XMC_I2C_CH_EnableAcknowledgeAddress0() + * and from XMC_I2C_CH_DisableSlaveAcknowledgeTo00() to XMC_I2C_CH_DisableAcknowledgeAddress0(). + * + * 2016-05-20: + * - Added XMC_I2C_CH_EnableDataTransmission() and XMC_I2C_CH_DisableDataTransmission() + * + * 2016-08-17: + * - Improved documentation of slave address passing + * + * @endcond + * + */ + +#ifndef XMC_I2C_H +#define XMC_I2C_H + +/******************************************************************************* + * HEADER FILES + *******************************************************************************/ + +#include "xmc_usic.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup I2C + * @brief Inter Integrated Circuit(IIC) driver for the XMC microcontroller family. + * + * USIC IIC Features:
+ * * Two-wire interface, with one line for shift clock transfer and synchronization (shift clock SCL), the other one for the data transfer (shift data SDA)
+ * * Communication in standard mode (100 kBit/s) or in fast mode (up to 400 kBit/s)
+ * * Support of 7-bit addressing, as well as 10-bit addressing
+ * * Master mode operation, where the IIC controls the bus transactions and provides the clock signal.
+ * * Slave mode operation, where an external master controls the bus transactions and provides the clock signal.
+ * * Multi-master mode operation, where several masters can be connected to the bus and bus arbitration can take place, i.e. the IIC module can be master or slave.
+ The master/slave operation of an IIC bus participant can change from frame to frame.
+ * * Efficient frame handling (low software effort), also allowing DMA transfers
+ * * Powerful interrupt handling due to multitude of indication flags
+ * @{ + */ + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +#if defined(USIC0) +#define XMC_I2C0_CH0 XMC_USIC0_CH0 /**< USIC0 channel 0 base address */ +#define XMC_I2C0_CH1 XMC_USIC0_CH1 /**< USIC0 channel 1 base address */ +#endif + +#if defined(USIC1) +#define XMC_I2C1_CH0 XMC_USIC1_CH0 /**< USIC1 channel 0 base address */ +#define XMC_I2C1_CH1 XMC_USIC1_CH1 /**< USIC1 channel 1 base address */ +#endif + +#if defined(USIC2) +#define XMC_I2C2_CH0 XMC_USIC2_CH0 /**< USIC2 channel 0 base address */ +#define XMC_I2C2_CH1 XMC_USIC2_CH1 /**< USIC2 channel 1 base address */ +#endif + +#define XMC_I2C_10BIT_ADDR_GROUP (0x7800U) /**< Value to verify the address is 10-bit or not */ + +/******************************************************************************* + * ENUMS + *******************************************************************************/ + +/** + * @brief I2C Status + */ +typedef enum XMC_I2C_CH_STATUS +{ + XMC_I2C_CH_STATUS_OK, /**< Status OK */ + XMC_I2C_CH_STATUS_ERROR, /**< Status ERROR */ + XMC_I2C_CH_STATUS_BUSY /**< Status BUSY */ +} XMC_I2C_CH_STATUS_t; + +/** + * @brief I2C status + */ +typedef enum XMC_I2C_CH_STATUS_FLAG +{ + XMC_I2C_CH_STATUS_FLAG_SLAVE_SELECT = USIC_CH_PSR_IICMode_SLSEL_Msk, /**< Slave select status */ + XMC_I2C_CH_STATUS_FLAG_WRONG_TDF_CODE_FOUND = USIC_CH_PSR_IICMode_WTDF_Msk, /**< Wrong TDF status */ + XMC_I2C_CH_STATUS_FLAG_START_CONDITION_RECEIVED = USIC_CH_PSR_IICMode_SCR_Msk, /**< Start condition received status */ + XMC_I2C_CH_STATUS_FLAG_REPEATED_START_CONDITION_RECEIVED = USIC_CH_PSR_IICMode_RSCR_Msk, /**< Repeated start condition received status */ + XMC_I2C_CH_STATUS_FLAG_STOP_CONDITION_RECEIVED = USIC_CH_PSR_IICMode_PCR_Msk, /**< Stop condition received status */ + XMC_I2C_CH_STATUS_FLAG_NACK_RECEIVED = USIC_CH_PSR_IICMode_NACK_Msk, /**< NACK received status */ + XMC_I2C_CH_STATUS_FLAG_ARBITRATION_LOST = USIC_CH_PSR_IICMode_ARL_Msk, /**< Arbitration lost status */ + XMC_I2C_CH_STATUS_FLAG_SLAVE_READ_REQUESTED = USIC_CH_PSR_IICMode_SRR_Msk, /**< Slave read requested status */ + XMC_I2C_CH_STATUS_FLAG_ERROR = USIC_CH_PSR_IICMode_ERR_Msk, /**< Error status */ + XMC_I2C_CH_STATUS_FLAG_ACK_RECEIVED = USIC_CH_PSR_IICMode_ACK_Msk, /**< ACK received status */ + XMC_I2C_CH_STATUS_FLAG_RECEIVER_START_INDICATION = USIC_CH_PSR_IICMode_RSIF_Msk, /**< Receive start indication status */ + XMC_I2C_CH_STATUS_FLAG_DATA_LOST_INDICATION = USIC_CH_PSR_IICMode_DLIF_Msk, /**< Data lost indication status */ + XMC_I2C_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION = USIC_CH_PSR_IICMode_TSIF_Msk, /**< Transmit shift indication status */ + XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION = USIC_CH_PSR_IICMode_TBIF_Msk, /**< Transmit buffer indication status */ + XMC_I2C_CH_STATUS_FLAG_RECEIVE_INDICATION = USIC_CH_PSR_IICMode_RIF_Msk, /**< Receive indication status */ + XMC_I2C_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION = USIC_CH_PSR_IICMode_AIF_Msk, /**< Alternate receive indication status */ + XMC_I2C_CH_STATUS_FLAG_BAUD_RATE_GENERATOR_INDICATION = USIC_CH_PSR_IICMode_BRGIF_Msk /**< Baud rate generator indication status */ +} XMC_I2C_CH_STATUS_FLAG_t; + +/** + * @brief I2C receiver status. The received data byte is available at the bit + * positions RBUF[7:0], whereas the additional information is monitored at the bit positions +* RBUF[12:8]. + */ +typedef enum XMC_I2C_CH_RECEIVER_STATUS_FLAG +{ + XMC_I2C_CH_RECEIVER_STATUS_FLAG_ACK = 0x1U, /**< Bit 8: Value of Received Acknowledgement bit */ + XMC_I2C_CH_RECEIVER_STATUS_FLAG_FIN = 0x2U, /**< Bit 9: A 1 at this bit position indicates that after a (repeated) start condition + followed by the address reception the first data byte of a new frame has + been received. A 0 at this bit position indicates further data bytes */ + XMC_I2C_CH_RECEIVER_STATUS_FLAG_MODE = 0x4U, /**< Bit 10: A 0 at this bit position indicates that the data byte has been received + when the device has been in slave mode, whereas a 1 indicates a reception in master mode */ + XMC_I2C_CH_RECEIVER_STATUS_FLAG_ERR = 0x8U, /**< Bit 11: A 1 at this bit position indicates an incomplete/erroneous + data byte in the receive buffer */ + XMC_I2C_CH_RECEIVER_STATUS_FLAG_ADR = 0x10 /**< Bit 12: A 0 at this bit position indicates that the programmed address + has been received. A 1 indicates a general call address. */ +} XMC_I2C_CH_RECEIVER_STATUS_FLAG_t; + +/** + * @brief I2C commands + */ +typedef enum XMC_I2C_CH_CMD +{ + XMC_I2C_CH_CMD_WRITE, /**< I2C Command Write */ + XMC_I2C_CH_CMD_READ /**< I2C Command Read */ +} XMC_I2C_CH_CMD_t; + +/** + * @brief I2C events + */ +typedef enum XMC_I2C_CH_EVENT +{ + XMC_I2C_CH_EVENT_RECEIVE_START = USIC_CH_CCR_RSIEN_Msk, /**< Receive start event */ + XMC_I2C_CH_EVENT_DATA_LOST = USIC_CH_CCR_DLIEN_Msk, /**< Data lost event */ + XMC_I2C_CH_EVENT_TRANSMIT_SHIFT = USIC_CH_CCR_TSIEN_Msk, /**< Transmit shift event */ + XMC_I2C_CH_EVENT_TRANSMIT_BUFFER = USIC_CH_CCR_TBIEN_Msk, /**< Transmit buffer event */ + XMC_I2C_CH_EVENT_STANDARD_RECEIVE = USIC_CH_CCR_RIEN_Msk, /**< Receive event */ + XMC_I2C_CH_EVENT_ALTERNATIVE_RECEIVE = USIC_CH_CCR_AIEN_Msk, /**< Alternate receive event */ + XMC_I2C_CH_EVENT_BAUD_RATE_GENERATOR = USIC_CH_CCR_BRGIEN_Msk, /**< Baudrate generator event */ + + XMC_I2C_CH_EVENT_START_CONDITION_RECEIVED = USIC_CH_PCR_IICMode_SCRIEN_Msk, /**< Start condition received event */ + XMC_I2C_CH_EVENT_REPEATED_START_CONDITION_RECEIVED = USIC_CH_PCR_IICMode_RSCRIEN_Msk, /**< Repeated start condition received event */ + XMC_I2C_CH_EVENT_STOP_CONDITION_RECEIVED = USIC_CH_PCR_IICMode_PCRIEN_Msk, /**< Stop condition received event */ + XMC_I2C_CH_EVENT_NACK = USIC_CH_PCR_IICMode_NACKIEN_Msk, /**< NACK received event */ + XMC_I2C_CH_EVENT_ARBITRATION_LOST = USIC_CH_PCR_IICMode_ARLIEN_Msk, /**< Arbitration lost event */ + XMC_I2C_CH_EVENT_SLAVE_READ_REQUEST = USIC_CH_PCR_IICMode_SRRIEN_Msk, /**< Slave read request event */ + XMC_I2C_CH_EVENT_ERROR = USIC_CH_PCR_IICMode_ERRIEN_Msk, /**< Error condition event */ + XMC_I2C_CH_EVENT_ACK = USIC_CH_PCR_IICMode_ACKIEN_Msk /**< ACK received event */ +} XMC_I2C_CH_EVENT_t; + +/** + * @brief I2C input stage selection + */ +typedef enum XMC_I2C_CH_INPUT +{ + XMC_I2C_CH_INPUT_SDA = 0U, /**< selection of sda input stage */ +#if UC_FAMILY == XMC1 + XMC_I2C_CH_INPUT_SDA1 = 3U, + XMC_I2C_CH_INPUT_SDA2 = 5U, +#endif + XMC_I2C_CH_INPUT_SCL = 1U, /**< selection of scl input stage */ +#if UC_FAMILY == XMC1 + XMC_I2C_CH_INPUT_SCL1 = 4U +#endif +} XMC_I2C_CH_INPUT_t; + +/** + * I2C channel interrupt node pointers + */ +typedef enum XMC_I2C_CH_INTERRUPT_NODE_POINTER +{ + XMC_I2C_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, /**< Node pointer for transmit shift interrupt */ + XMC_I2C_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER, /**< Node pointer for transmit buffer interrupt */ + XMC_I2C_CH_INTERRUPT_NODE_POINTER_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_RECEIVE, /**< Node pointer for receive interrupt */ + XMC_I2C_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE, /**< Node pointer for alternate receive interrupt */ + XMC_I2C_CH_INTERRUPT_NODE_POINTER_PROTOCOL = XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL /**< Node pointer for protocol related interrupts */ +} XMC_I2C_CH_INTERRUPT_NODE_POINTER_t; + +/******************************************************************************* + * DATA STRUCTURES + *******************************************************************************/ +/** + * @brief I2C_CH configuration structure + */ +typedef struct XMC_I2C_CH_CONFIG +{ + uint32_t baudrate; /**< baud rate configuration upto max of 400KHz */ + uint16_t address; /**< slave address + A 7-bit address needs to be left shifted it by 1. + A 10-bit address needs to be ORed with XMC_I2C_10BIT_ADDR_GROUP. */ +} XMC_I2C_CH_CONFIG_t; + +/******************************************************************************* + * API PROTOTYPES + *******************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param config Constant pointer to I2C channel config structure of type @ref XMC_I2C_CH_CONFIG_t + * + * @return None
+ * + * \parDescription:
+ * Initializes the I2C \a channel.
+ * + * \par + * Configures the data format in SCTR register. Sets the slave address, baud rate. Enables transmit data valid, clears status flags + * and disables parity generation.
+ * + * \parRelated APIs:
+ * XMC_USIC_CH_Enable()\n\n + */ + +void XMC_I2C_CH_Init(XMC_USIC_CH_t *const channel, const XMC_I2C_CH_CONFIG_t *const config); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param rate baud rate of I2C channel + * + * @return None
+ * + * \parDescription:
+ * Sets the rate of I2C \a channel. + * + * \parNote:
+ * Standard over sampling is considered if rate <= 100KHz and fast over sampling is considered if rate > 100KHz.
+ * + * \parRelated APIs:
+ * XMC_USIC_CH_SetBaudrate()\n\n + */ +XMC_I2C_CH_STATUS_t XMC_I2C_CH_SetBaudrate(XMC_USIC_CH_t *const channel, const uint32_t rate); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * + * @return None
+ * + * \parDescription:
+ * Starts the I2C \a channel. + * + * \par + * Sets the USIC input operation mode to I2C mode using CCR register. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetMode()\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_Start(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetMode(channel, XMC_USIC_CH_OPERATING_MODE_I2C); +} + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * + * @return @ref XMC_I2C_CH_STATUS_t
+ * + * \parDescription:
+ * Stops the I2C \a channel.
+ * + * \par + * Sets the USIC input operation to IDLE mode using CCR register. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetMode()\n\n + */ +XMC_I2C_CH_STATUS_t XMC_I2C_CH_Stop(XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param service_request Service request number in the range of 0-5 + * @return None
+ * + * \parDescription:
+ * Sets the interrupt node for protocol interrupt.
+ * + * \par + * To generate interrupt for an event, node pointer should be configured with service request number(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so.
+ * + * \parNote:
+ * NVIC node should be separately enabled to generate the interrupt. After setting the node pointer, desired event must be enabled. + * + * \parRelated APIs:
+ * XMC_I2C_CH_EnableEvent(), NVIC_SetPriority(), NVIC_EnableIRQ(), XMC_I2C_CH_SetInputSource()
+ */ +__STATIC_INLINE void XMC_I2C_CH_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const uint8_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL, service_request); +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2C0_CH0, @ref XMC_I2C0_CH1,@ref XMC_I2C1_CH0,@ref XMC_I2C1_CH1,@ref XMC_I2C2_CH0,@ref XMC_I2C2_CH1 @note Availability of I2C1 and I2C2 depends on device selection + * @param interrupt_node Interrupt node pointer to be configured. \n + * \b Range: @ref XMC_I2C_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, + * @ref XMC_I2C_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER etc. + * @param service_request Service request number.\n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets the interrupt node for USIC channel events. \n\n + * For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so.
+ * Note: NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_I2C_CH_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_SelectInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_I2C_CH_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, (XMC_USIC_CH_INTERRUPT_NODE_POINTER_t)interrupt_node, + (uint32_t)service_request); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2C0_CH0, @ref XMC_I2C0_CH1,@ref XMC_I2C1_CH0,@ref XMC_I2C1_CH1,@ref XMC_I2C2_CH0,@ref XMC_I2C2_CH1 @note Availability of I2C1 and I2C2 depends on device selection + * @param service_request_line service request number of the event to be triggered. \n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Trigger a I2C interrupt service request.\n\n + * When the I2C service request is triggered, the NVIC interrupt associated with it will be + * generated if enabled. + * + * \parRelated APIs:
+ * XMC_I2C_CH_SelectInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_TriggerServiceRequest(XMC_USIC_CH_t *const channel, const uint32_t service_request_line) +{ + XMC_USIC_CH_TriggerServiceRequest(channel, (uint32_t)service_request_line); +} + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param input I2C channel input stage of type @ref XMC_I2C_CH_INPUT_t + * @param source Input source select for the input stage(0->DX0A, 1->DX1A, .. 7->DX7G) + * @return None
+ * + * \parDescription:
+ * Sets the input source for I2C \a channel.
+ * Defines the input stage for the corresponding input line. + * + * @note After configuring the input source for corresponding channel, interrupt node pointer is set. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetInptSource(), XMC_USIC_CH_SetInterruptNodePointer() + * + */ +__STATIC_INLINE void XMC_I2C_CH_SetInputSource(XMC_USIC_CH_t *const channel, const XMC_I2C_CH_INPUT_t input, const uint8_t source) +{ + channel->DXCR[input] = (uint32_t)(channel->DXCR[input] & (~USIC_CH_DX0CR_INSW_Msk)) | USIC_CH_DX0CR_DSEN_Msk; + XMC_USIC_CH_SetInputSource(channel, (XMC_USIC_CH_INPUT_t)input, source); +} + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param address I2C slave address + * @return None
+ * + * \parDescription:
+ * Sets the I2C \a channel slave address.
+ * + * \par + * Address is set in PCR_IICMode register by checking if it is in 10-bit address group or 7-bit address group. + * (If first five bits of address are assigned with 0xF0, then address mode is 10-bit mode otherwise it is 7-bit mode)\n + * @note A 7-bit address should include an additional bit at the LSB for read/write indication. For example, address 0x05 should + * be provided as 0x0a. A 10-bit address should be provided with the identifier 0b11110xx at the most significant bits. For example, + * address 0x305 should be provided as 0x7b05(bitwise OR with 0x7800). + * + * \parRelated APIs:
+ * XMC_I2C_CH_GetSlaveAddress()\n\n + */ +void XMC_I2C_CH_SetSlaveAddress(XMC_USIC_CH_t *const channel, const uint16_t address); + +/** + * @param channel Constant pointer to USIC channel handler of type @ref XMC_USIC_CH_t + * @return uint16_t Slave address
+ * + * \parDescription:
+ * Gets the I2C \a channel slave address.
+ * + * \par + * Returns the address using PCR_IICMode register by checking if it is in 10-bit address group or 7-bit address group.
+ * (If first five bits of address are assigned with 0xF0, then address mode is considered as 10-bit mode otherwise it is 7-bit mode)\n + * @note A 7-bit address will include an additional bit at the LSB. For example, address 0x05 will be returned as 0x0a. + * 10-bit address will not include the 10-bit address identifier 0b11110xx at the most signifcant bits. + * + * \parRelated APIs:
+ * XMC_I2C_CH_SetSlaveAddress()\n\n + */ +uint16_t XMC_I2C_CH_GetSlaveAddress(const XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param addr I2C master address + * @param command read/write command + * @return None
+ * + * \parDescription:
+ * Starts the I2C master \a channel.
+ * + * \par + * Sends the Start condition with read/write command by updating IN/TBUF register based on FIFO/non-FIFO modes.\n + * @note Address(addr) should reserve an additional bit at the LSB for read/write indication. For example, address 0x05 should + * be provided as 0x0a. If the address is 10-bit, only most significant bits with the 10-bit identifier should be sent using this function. + * For example, if the 10-bit address is 0x305, the address should be provided as 0xf6(prepend with 0b11110, upper two bits of address 0b11, + * followed by 1-bit field for read/write). + * + * \parRelated APIs:
+ * XMC_I2C_CH_MasterTransmit(), XMC_USIC_CH_GetTransmitBufferStatus()\n\n + */ +void XMC_I2C_CH_MasterStart(XMC_USIC_CH_t *const channel, const uint16_t addr, const XMC_I2C_CH_CMD_t command); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param addr I2C master address + * @param command read/write command + * @return None
+ * + * \parDescription:
+ * Sends the repeated start condition from I2C master \a channel.
+ * + * \par + * Sends the repeated start condition with read/write command by updating IN/TBUF register based on FIFO/non-FIFO modes.\n + * @note Address(addr) should reserve an additional bit at the LSB for read/write indication. For example, address 0x05 should + * be provided as 0x0a. If the address is 10-bit, only most significant bits with the 10-bit identifier should be sent using this function. + * For example, if the 10-bit address is 0x305, the address should be provided as 0xf6(prepend with 0b11110, upper two bits of address 0b11, + * followed by 1-bit field for read/write). + * + * \parRelated APIs:
+ * XMC_I2C_CH_MasterTransmit(), XMC_USIC_CH_GetTransmitBufferStatus()\n\n + */ +void XMC_I2C_CH_MasterRepeatedStart(XMC_USIC_CH_t *const channel, const uint16_t addr, const XMC_I2C_CH_CMD_t command); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return None
+ * + * \parDescription:
+ * Stops the I2C master \a channel.
+ * + * \par + * Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Stop command. + * + * \parRelated APIs:
+ * XMC_I2C_CH_MasterTransmit(), XMC_USIC_CH_GetTransmitBufferStatus()\n\n + */ +void XMC_I2C_CH_MasterStop(XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param data data to transmit from I2C \a channel + * @return None
+ * + * \parDescription:
+ * Transmit the data from the I2C master \a channel.
+ * + * \par + * Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Master Send command. + * + * \parRelated APIs:
+ * XMC_USIC_CH_GetTransmitBufferStatus()\n\n + */ +void XMC_I2C_CH_MasterTransmit(XMC_USIC_CH_t *const channel, const uint8_t data); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param data data to transmit from I2C \a channel + * @return None
+ * + * \parDescription:
+ * Transmit the data from the I2C slave \a channel.
+ * + * \par + * Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Slave Send command. + * + * \parRelated APIs:
+ * XMC_USIC_CH_GetTransmitBufferStatus(),XMC_I2C_CH_ClearStatusFlag()\n\n + */ +void XMC_I2C_CH_SlaveTransmit(XMC_USIC_CH_t *const channel, const uint8_t data); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return None
+ * + * \parDescription:
+ * Sends the Ack request from I2C master \a channel.
+ * + * \par +* Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Master Receive Ack command. + * + * \parRelated APIs:
+ * XMC_I2C_CH_MasterTransmit()\n\n + */ +void XMC_I2C_CH_MasterReceiveAck(XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return None
+ * + * \parDescription:
+ * Sends the Nack request from I2C master \a channel.
+ * + * \par + * Reads the transmit buffer status is busy or not and thereby updates IN/TBUF register based on FIFO/non-FIFO modes using Master Receive Nack command. + * + * \parRelated APIs:
+ * XMC_I2C_CH_MasterTransmit()\n\n + */ +void XMC_I2C_CH_MasterReceiveNack(XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return uint8_t OUTR/RBUF register data
+ * + * \parDescription:
+ * Reads the data from I2C \a channel.
+ * + * \par + * Data is read by using OUTR/RBUF register based on FIFO/non-FIFO modes. + * + * \parRelated APIs:
+ * XMC_I2C_CH_MasterTransmit()\n\n + */ +uint8_t XMC_I2C_CH_GetReceivedData(const XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return uint8_t Receiver status flag
+ * + * \parDescription:
+ * Gets the receiver status of I2C \a channel using RBUF register of bits 8-12 which gives information about receiver status. + * + * \parRelated APIs:
+ * XMC_I2C_CH_MasterTransmit()\n\n + */ +__STATIC_INLINE uint8_t XMC_I2C_CH_GetReceiverStatusFlag(XMC_USIC_CH_t *const channel) +{ + return((uint8_t)((channel->RBUF) >> 8U)); +} + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param event ORed values of @ref XMC_I2C_CH_EVENT_t enum + * @return None
+ * + * \parDescription:
+ * Enables the input parameter @ref XMC_I2C_CH_EVENT_t event using PCR_IICMode register. + * + * \parRelated APIs:
+ * XMC_I2C_CH_DisableEvent()\n\n + */ +void XMC_I2C_CH_EnableEvent(XMC_USIC_CH_t *const channel, uint32_t event); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param event ORed values of @ref XMC_I2C_CH_EVENT_t enum + * @return None
+ * + * \parDescription:
+ * Disables the input parameter @ref XMC_I2C_CH_EVENT_t event using PCR_IICMode register. + * + * \parRelated APIs:
+ * XMC_I2C_CH_EnableEvent()\n\n + */ +void XMC_I2C_CH_DisableEvent(XMC_USIC_CH_t *const channel, uint32_t event); + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return uint32_t Status byte
+ * + * \parDescription:
+ * Retrieves the status byte of I2C \a channel using PSR_IICMode register.\n + * + * \parRelated APIs:
+ * XMC_I2C_CH_ClearStatusFlag()\n\n + */ +__STATIC_INLINE uint32_t XMC_I2C_CH_GetStatusFlag(XMC_USIC_CH_t *const channel) +{ + return (channel->PSR_IICMode); +} + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @param flag Status flag + * @return None
+ * + * \parDescription:
+ * Clears the status flag of I2C \a channel by setting the input parameter \a flag in PSCR register. + * + * \parRelated APIs:
+ * XMC_I2C_CH_GetStatusFlag()\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_ClearStatusFlag(XMC_USIC_CH_t *const channel, uint32_t flag) +{ + channel->PSCR |= flag; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2C0_CH0, @ref XMC_I2C0_CH1,@ref XMC_I2C1_CH0,@ref XMC_I2C1_CH1,@ref XMC_I2C2_CH0,@ref XMC_I2C2_CH1 @note Availability of I2C1 and I2C2 depends on device selection + * @param pdiv Desired divider for the external frequency input. \b Range: minimum value = 1, maximum value = 1024 \n + * @param oversampling Required oversampling. The value indicates the number of time quanta for one symbol of data. \n + * This can be related to the number of samples for each logic state of the data signal. \n + * \b Range: 1 to 32. Value should be chosen based on the protocol used. + * @param combination_mode USIC channel input combination mode \n + * + * @return None + * + * \parDescription
+ * Enables the external frequency input for the Baudrate Generator and configures the divider, oversampling and + * the combination mode of the USIC channel. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetBRGInputClockSource(), XMC_USIC_CH_SetInputTriggerCombinationMode() \n\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_ConfigExternalInputSignalToBRG(XMC_USIC_CH_t *const channel, + const uint16_t pdiv, + const uint32_t oversampling, + const XMC_USIC_CH_INPUT_COMBINATION_MODE_t combination_mode) +{ + XMC_USIC_CH_ConfigExternalInputSignalToBRG(channel,pdiv,oversampling,combination_mode); +} + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return None + * + * \parDescription:
+ * Retrieves the status byte of I2C \a channel using PSR_IICMode register.\n + * + * \parRelated APIs:
+ * XMC_I2C_CH_DisableAcknowledgeAddress0()\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_EnableAcknowledgeAddress0(XMC_USIC_CH_t *const channel) +{ + channel->PCR_IICMode |= USIC_CH_PCR_IICMode_ACK00_Msk; +} + +/** + * @param channel Constant pointer to USIC channel structure of type @ref XMC_USIC_CH_t + * @return None + * + * \parDescription:
+ * This bit defines that slave device should not be sensitive to the slave address 00H.\n + * + * \parRelated APIs:
+ * XMC_I2C_CH_EnableAcknowledgeAddress0()\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_DisableAcknowledgeAddress0(XMC_USIC_CH_t *const channel) +{ + channel->PCR_IICMode &= ~USIC_CH_PCR_IICMode_ACK00_Msk; +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2C0_CH0, @ref XMC_I2C0_CH1,@ref XMC_I2C1_CH0,@ref XMC_I2C1_CH1,@ref XMC_I2C2_CH0,@ref XMC_I2C2_CH1 @note Availability of I2C1 and I2C2 depends on device selection + * @return None + * + * \parDescription
+ * Enable data transmission.\n\n + * Use this function in combination with XMC_I2C_CH_DisableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * @note If you need more control over the start of transmission use XMC_USIC_CH_SetStartTransmisionMode() + * + * \parRelated APIs:
+ * XMC_I2C_CH_DisableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_EnableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_ON_TDV); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2C0_CH0, @ref XMC_I2C0_CH1,@ref XMC_I2C1_CH0,@ref XMC_I2C1_CH1,@ref XMC_I2C2_CH0,@ref XMC_I2C2_CH1 @note Availability of I2C1 and I2C2 depends on device selection + * @return None + * + * \parDescription
+ * Disable data transmission.\n\n + * Use this function in combination with XMC_I2C_CH_EnableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * + * \parRelated APIs:
+ * XMC_I2C_CH_EnableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_I2C_CH_DisableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_DISABLED); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_i2s.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_i2s.h new file mode 100644 index 00000000..60808167 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_i2s.h @@ -0,0 +1,837 @@ +/** + * @file xmc_i2s.h + * @date 2016-06-30 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-08-21: + * - Initial
+ * + * 2015-08-24: + * - Added APIs for enabling/disabling delay compensation XMC_I2S_CH_DisableDelayCompensation() and + * XMC_I2S_CH_EnableDelayCompensation()
+ * + * 2015-09-01: + * - Modified XMC_I2S_CH_SetInputSource() for avoiding complete DXCR register overwriting.
+ * - Modified XMC_I2S_CH_EVENT_t enum for supporting XMC_I2S_CH_EnableEvent() and XMC_I2S_CH_DisableEvent()
+ * for supporting multiple events configuration
+ * + * 2015-09-14: + * - Modified XMC_I2S_CH_SetSystemWordLength for supporting up to 63 system word length
+ * + * 2016-05-20: + * - Added XMC_I2S_CH_EnableDataTransmission() and XMC_I2S_CH_DisableDataTransmission() + * + * 2016-06-30: + * - Documentation updates. + * + * @endcond + * + */ + +#ifndef XMC_I2S_H_ +#define XMC_I2S_H_ + +/********************************************************************************************************************** + * HEADER FILES + *********************************************************************************************************************/ +#include "xmc_usic.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup I2S + * @brief (IIS) driver for the XMC microcontroller family. + * + * USIC IIS Features:
+ * @{ + */ + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +#if defined(USIC0) +#define XMC_I2S0_CH0 XMC_USIC0_CH0 /**< USIC0 channel 0 base address */ +#define XMC_I2S0_CH1 XMC_USIC0_CH1 /**< USIC0 channel 1 base address */ +#endif + +#if defined(USIC1) +#define XMC_I2S1_CH0 XMC_USIC1_CH0 /**< USIC1 channel 0 base address */ +#define XMC_I2S1_CH1 XMC_USIC1_CH1 /**< USIC1 channel 1 base address */ +#endif + +#if defined(USIC2) +#define XMC_I2S2_CH0 XMC_USIC2_CH0 /**< USIC2 channel 0 base address */ +#define XMC_I2S2_CH1 XMC_USIC2_CH1 /**< USIC2 channel 1 base address */ +#endif +/******************************************************************************* + * ENUMS + *******************************************************************************/ + +/** + * @brief I2S Status + */ +typedef enum XMC_I2S_CH_STATUS +{ + XMC_I2S_CH_STATUS_OK, /**< Status OK */ + XMC_I2S_CH_STATUS_ERROR, /**< Status ERROR */ + XMC_I2S_CH_STATUS_BUSY /**< Status BUSY */ +} XMC_I2S_CH_STATUS_t; + +/** + * @brief I2S status flag + */ +typedef enum XMC_I2S_CH_STATUS_FLAG +{ + XMC_I2S_CH_STATUS_FLAG_WORD_ADDRESS = USIC_CH_PSR_IISMode_WA_Msk, /**< Word Address status */ + XMC_I2S_CH_STATUS_FLAG_DX2S = USIC_CH_PSR_IISMode_DX2S_Msk, /**< Status of WA input(DX2) signal*/ + XMC_I2S_CH_STATUS_FLAG_DX2T_EVENT_DETECTED = USIC_CH_PSR_IISMode_DX2TEV_Msk, /**< Status for WA input signal transition */ + XMC_I2S_CH_STATUS_FLAG_WA_FALLING_EDGE_EVENT = USIC_CH_PSR_IISMode_WAFE_Msk, /**< Falling edge of the WA output + signal has been generated */ + XMC_I2S_CH_STATUS_FLAG_WA_RISING_EDGE_EVENT = USIC_CH_PSR_IISMode_WARE_Msk, /**< Rising edge of the WA output + signal has been generated */ + XMC_I2S_CH_STATUS_FLAG_WA_GENERATION_END = USIC_CH_PSR_IISMode_END_Msk, /**< The WA generation has ended */ + XMC_I2S_CH_STATUS_FLAG_RECEIVER_START_INDICATION = USIC_CH_PSR_IISMode_RSIF_Msk, /**< Receive start indication status */ + XMC_I2S_CH_STATUS_FLAG_DATA_LOST_INDICATION = USIC_CH_PSR_IISMode_DLIF_Msk, /**< Data lost indication status */ + XMC_I2S_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION = USIC_CH_PSR_IISMode_TSIF_Msk, /**< Transmit shift indication status */ + XMC_I2S_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION = USIC_CH_PSR_IISMode_TBIF_Msk, /**< Transmit buffer indication status */ + XMC_I2S_CH_STATUS_FLAG_RECEIVE_INDICATION = USIC_CH_PSR_IISMode_RIF_Msk, /**< Receive indication status */ + XMC_I2S_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION = USIC_CH_PSR_IISMode_AIF_Msk, /**< Alternate receive indication status */ + XMC_I2S_CH_STATUS_FLAG_BAUD_RATE_GENERATOR_INDICATION = USIC_CH_PSR_IISMode_BRGIF_Msk /**< Baud rate generator indication status */ +} XMC_I2S_CH_STATUS_FLAG_t; + +/** + * @brief I2S Baudrate Generator shift clock output +*/ +typedef enum XMC_I2S_CH_BRG_SHIFT_CLOCK_OUTPUT +{ + XMC_I2S_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK = XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK, /**< Baudrate Generator shift clock output: SCLK*/ + XMC_I2S_CH_BRG_SHIFT_CLOCK_OUTPUT_DX1 = XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_DX1 /**< Clock obtained as input from master: DX1*/ +} XMC_I2S_CH_BRG_SHIFT_CLOCK_OUTPUT_t; + +/** + * @brief I2S channel interrupt node pointers + */ +typedef enum XMC_I2S_CH_INTERRUPT_NODE_POINTER +{ + XMC_I2S_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, /**< Node pointer for transmit shift interrupt */ + XMC_I2S_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER, /**< Node pointer for transmit buffer interrupt */ + XMC_I2S_CH_INTERRUPT_NODE_POINTER_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_RECEIVE, /**< Node pointer for receive interrupt */ + XMC_I2S_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE, /**< Node pointer for alternate receive interrupt */ + XMC_I2S_CH_INTERRUPT_NODE_POINTER_PROTOCOL = XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL /**< Node pointer for protocol related interrupts */ +} XMC_I2S_CH_INTERRUPT_NODE_POINTER_t; + +/** + * @brief I2S events + */ +typedef enum XMC_I2S_CH_EVENT +{ + XMC_I2S_CH_EVENT_RECEIVE_START = USIC_CH_CCR_RSIEN_Msk, /**< Receive start event */ + XMC_I2S_CH_EVENT_DATA_LOST = USIC_CH_CCR_DLIEN_Msk, /**< Data lost event */ + XMC_I2S_CH_EVENT_TRANSMIT_SHIFT = USIC_CH_CCR_TSIEN_Msk, /**< Transmit shift event */ + XMC_I2S_CH_EVENT_TRANSMIT_BUFFER = USIC_CH_CCR_TBIEN_Msk, /**< Transmit buffer event */ + XMC_I2S_CH_EVENT_STANDARD_RECEIVE = USIC_CH_CCR_RIEN_Msk, /**< Receive event */ + XMC_I2S_CH_EVENT_ALTERNATIVE_RECEIVE = USIC_CH_CCR_AIEN_Msk, /**< Alternate receive event */ + XMC_I2S_CH_EVENT_BAUD_RATE_GENERATOR = USIC_CH_CCR_BRGIEN_Msk, /**< Baudrate generator event */ + + XMC_I2S_CH_EVENT_WA_FALLING_EDGE = USIC_CH_PCR_IISMode_WAFEIEN_Msk << 2U, /**< WA falling edge event */ + XMC_I2S_CH_EVENT_WA_RISING_EDGE = USIC_CH_PCR_IISMode_WAREIEN_Msk << 2U, /**< WA rising edge event */ + XMC_I2S_CH_EVENT_WA_GENERATION_END = USIC_CH_PCR_IISMode_ENDIEN_Msk << 2U, /**< END event */ + XMC_I2S_CH_EVENT_DX2TIEN_ACTIVATED = USIC_CH_PCR_IISMode_DX2TIEN_Msk << 2U /**< WA input signal transition event*/ +} XMC_I2S_CH_EVENT_t; + +/** + * @brief Defines the Polarity of the WA in the SELO output lines in relation to the internal WA signal. + */ +typedef enum XMC_I2S_CH_WA_POLARITY +{ + XMC_I2S_CH_WA_POLARITY_DIRECT = 0x0UL, /**< The SELO outputs have the same polarity + as the WA signal (active high) */ + XMC_I2S_CH_WA_POLARITY_INVERTED = 0x1UL << USIC_CH_PCR_IISMode_SELINV_Pos /**< The SELO outputs have the inverted + polarity to the WA signal (active low)*/ +} XMC_I2S_CH_WA_POLARITY_t; + +/** + * @brief Defines the Polarity of the WA in the SELO output lines in relation to the internal WA signal. + */ +typedef enum XMC_I2S_CH_CHANNEL +{ + XMC_I2S_CH_CHANNEL_1_LEFT = 0U, /**< Channel 1 (left) */ + XMC_I2S_CH_CHANNEL_2_RIGHT = 1U /**< Channel 2 (right) */ +} XMC_I2S_CH_CHANNEL_t; + +/** + * @brief I2S input stage selection + */ +typedef enum XMC_I2S_CH_INPUT +{ + XMC_I2S_CH_INPUT_DIN0 = 0UL, /**< Data input stage 0 */ + XMC_I2S_CH_INPUT_SLAVE_SCLKIN = 1UL, /**< Clock input stage */ + XMC_I2S_CH_INPUT_SLAVE_WA = 2UL, /**< WA input stage */ +#if UC_FAMILY == XMC1 + XMC_I2S_CH_INPUT_DIN1 = 3UL, /**< Data input stage 1 */ + XMC_I2S_CH_INPUT_DIN2 = 4UL, /**< Data input stage 2 */ + XMC_I2S_CH_INPUT_DIN3 = 5UL /**< Data input stage 3 */ +#endif +} XMC_I2S_CH_INPUT_t; + +/** + * @brief Defines the I2S bus mode + */ +typedef enum XMC_I2S_CH_BUS_MODE +{ + XMC_I2S_CH_BUS_MODE_MASTER, /**< I2S Master */ + XMC_I2S_CH_BUS_MODE_SLAVE /**< I2S Slave */ +} XMC_I2S_CH_BUS_MODE_t; + +/******************************************************************************* + * DATA STRUCTURES + *******************************************************************************/ +/** + * @brief I2S_CH configuration structure + */ +typedef struct XMC_I2S_CH_CONFIG +{ + uint32_t baudrate; /**< Module baud rate for communication */ + uint8_t data_bits; /**< Data word length. A data frame can consists of several data words. \n + Value configured as USIC channel word length. \n + \b Range: minimum= 1, maximum= 16*/ + uint8_t frame_length; /**< Number of data bits transferred after a change of signal WA (data frame). \n + Configured as USIC channel frame length. \n + \b Range: minimum= 1, maximum= 63*/ + uint8_t data_delayed_sclk_periods; /**< Data delay defined in sclk periods */ + XMC_I2S_CH_WA_POLARITY_t wa_inversion; /**< Enable inversion of Slave select signal relative to the internal WA */ + XMC_I2S_CH_BUS_MODE_t bus_mode; /**< Bus mode MASTER/SLAVE */ +} XMC_I2S_CH_CONFIG_t; + +/******************************************************************************* + * API PROTOTYPES + *******************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2S0_CH0, XMC_I2S0_CH1,XMC_I2S1_CH0, XMC_I2S1_CH1,XMC_I2S2_CH0, XMC_I2S2_CH1 @note Availability of I2S1 and I2S2 depends on device selection + * @param config Constant pointer to I2S configuration structure of type @ref XMC_I2S_CH_CONFIG_t. + * @return XMC_I2S_CH_STATUS_t Status of initializing the USIC channel for I2S protocol.\n + * \b Range: @ref XMC_I2S_CH_STATUS_OK if initialization is successful.\n + * @ref XMC_I2S_CH_STATUS_ERROR if configuration of baudrate failed. + * + * \parDescription
+ * Initializes the USIC channel for I2S protocol.\n\n + * During the initialization, USIC channel is enabled and baudrate is configured. + * After each change of the WA signal, a complete data frame is intended to be transferred (frame length <= system word length). + * The number of data bits transferred after a change of signal WA is defined by config->frame_length. + * A data frame can consist of several data words with a data word length defined by config->data_bits. + * The changes of signal WA define the system word length as the number of SCLK cycles between two changes of WA. + * The system word length is set by default to the frame length defined by config->frame_length. + * + * XMC_I2S_CH_Start() should be invoked after the initialization to enable the channel. + * + * \parRelated APIs:
+ * XMC_I2S_CH_Start(), XMC_I2S_CH_Stop(), XMC_I2S_CH_Transmit(), XMC_I2S_CH_SetSystemWordLength()\n\n\n + */ +void XMC_I2S_CH_Init(XMC_USIC_CH_t *const channel, const XMC_I2S_CH_CONFIG_t *const config); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Set the selected USIC channel to operate in I2S mode, by setting CCR.MODE bits.\n\n + * It should be executed after XMC_I2S_CH_Init() during initialization. By invoking XMC_I2S_CH_Stop(), the MODE is set + * to IDLE state. Call XMC_I2S_CH_Start() to set the I2S mode again, as needed later in the program. + * + * \parRelated APIs:
+ * XMC_I2S_CH_Init(), XMC_I2S_CH_Stop() + */ +__STATIC_INLINE void XMC_I2S_CH_Start(XMC_USIC_CH_t *const channel) +{ + /* USIC channel in I2S mode */ + XMC_USIC_CH_SetMode(channel, XMC_USIC_CH_OPERATING_MODE_I2S); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return XMC_I2S_CH_STATUS_t Status of the I2S driver after the request for stopping is processed. \n + * XMC_I2S_CH_STATUS_OK- If the USIC channel is successfully put to IDLE mode. \n + * XMC_I2S_CH_STATUS_BUSY- If the USIC channel is busy transmitting data. + * + * \parDescription:
+ * Set the selected I2S channel to IDLE mode, by clearing CCR.MODE bits.\n\n + * After calling XMC_I2S_CH_Stop, channel is IDLE mode. So no communication is supported. XMC_I2S_CH_Start() has to be + * invoked to start the communication again. + * + * \parRelated APIs:
+ * XMC_I2S_CH_Start() + */ +XMC_I2S_CH_STATUS_t XMC_I2S_CH_Stop(XMC_USIC_CH_t *const channel); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param rate Bus speed in bits per second + * + * @return XMC_I2S_CH_STATUS_t Status of the I2S driver after the request for setting baudrate is processed. \n + * XMC_I2S_CH_STATUS_OK- If the baudrate is successfully changed. \n + * XMC_I2S_CH_STATUS_ERROR- If the new baudrate value is out of range. + * + * \parDescription:
+ * Sets the bus speed in bits per second + * + * \parRelated APIs:
+ * XMC_I2S_CH_Init(), XMC_I2S_CH_Stop() + */ +XMC_I2S_CH_STATUS_t XMC_I2S_CH_SetBaudrate(XMC_USIC_CH_t *const channel, const uint32_t rate); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param sclk_cycles_system_word_length system word length in terms of sclk clock cycles. + * + * @return None + * + * \parDescription:
+ * Configures the system word length by setting BRG.DCTQ bit field.\n\n + * This value has to be always higher than 1U and lower than the data with (SCTR.FLE) + * + */ +void XMC_I2S_CH_SetSystemWordLength(XMC_USIC_CH_t *const channel,uint32_t sclk_cycles_system_word_length); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param data Data to be transmitted + * @param channel_number Communication output channel of the I2S, based on this channel selection TCI(Transmit control information)is updated.\n + * Refer @ref XMC_I2S_CH_CHANNEL_t for valid values. + * + * @return None + * + * \parDescription:
+ * Puts the data into FIFO, if FIFO mode is enabled or else into standard buffer, by setting the proper mode.\n\n + * TCI(Transmit Control Information) allows dynamic control of output channel during data transfers. To support this auto + * update, TCSR.WAMD(Automatic WA mode) will be enabled during the initialization using XMC_I2S_CH_Init() for all modes. + * + * + * \parRelated APIs:
+ * XMC_I2S_CH_Receive() + */ +void XMC_I2S_CH_Transmit(XMC_USIC_CH_t *const channel, const uint16_t data, const XMC_I2S_CH_CHANNEL_t channel_number); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param channel_number Communication output channel of the I2S, based on this mode TCI(Transmit control information)is updated.\n + * Refer @ref XMC_I2S_CH_CHANNEL_t for valid values. + * + * @return None + * + * \parDescription:
+ * Transmits a dummy data(FFFFH) to provide clock for slave and receives the data from the slave.\n\n + * XMC_I2S_CH_Receive() receives the data and places it into buffer based on the FIFO selection. After reception of data + * XMC_I2S_CH_GetReceivedData() can be invoked to read the data from the buffers. + * + * \parRelated APIs:
+ * XMC_I2S_CH_GetReceivedData() + */ +__STATIC_INLINE void XMC_I2S_CH_Receive(XMC_USIC_CH_t *const channel, const XMC_I2S_CH_CHANNEL_t channel_number) +{ + /* Transmit dummy data */ + XMC_I2S_CH_Transmit(channel, (uint16_t)0xffffU , channel_number); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return uint16_t Data read from the receive buffer. + * + * \parDescription:
+ * Reads data from the receive buffer based on the FIFO selection.\n\n + * Invocation of XMC_I2S_CH_Receive() receives the data and place it into receive buffer. After receiving the data + * XMC_I2S_CH_GetReceivedData() can be used to read the data from the buffer. + * + * \parRelated APIs:
+ * XMC_I2S_CH_Receive() + */ +uint16_t XMC_I2S_CH_GetReceivedData(XMC_USIC_CH_t *const channel); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Set the order of data transfer from LSB to MSB, by clearing SCTR.SDIR bit.\n\n + * This is typically based on the slave settings. Invoke XMC_I2S_CH_SetBitOrderLsbFirst() to set direction as needed in + * the program. + * + * \parRelated APIs:
+ * XMC_I2S_CH_SetBitOrderMsbFirst() + */ +__STATIC_INLINE void XMC_I2S_CH_SetBitOrderLsbFirst(XMC_USIC_CH_t *const channel) +{ + channel->SCTR &= (uint32_t)~USIC_CH_SCTR_SDIR_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Set the order of data transfer from MSB to LSB, by setting SCTR.SDIR bit.\n\n + * This is typically based on the slave settings. This is not set during XMC_I2S_CH_Init(). + * Invoke XMC_I2S_CH_SetBitOrderMsbFirst() to set direction as needed in the program. + * + * \parRelated APIs:
+ * XMC_I2S_CH_SetBitOrderLsbFirst() + */ +__STATIC_INLINE void XMC_I2S_CH_SetBitOrderMsbFirst(XMC_USIC_CH_t *const channel) +{ + channel->SCTR |= (uint32_t)USIC_CH_SCTR_SDIR_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param event Protocol events which have to be enabled. + * Refer @ XMC_I2S_CH_EVENT_t for valid values. OR combinations of these enum items can be used + * as input. + * + * @return None + * + * \parDescription:
+ * Enables the I2S protocol specific events, by configuring PCR register.\n\n + * Events can be enabled as needed using XMC_I2S_CH_EnableEvent(). + * XMC_I2S_CH_DisableEvent() can be used to disable the events. + * + * \parRelated APIs:
+ * XMC_I2S_CH_DisableEvent() + */ +void XMC_I2S_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param event Protocol events which have to be disabled. + * Refer @ XMC_I2S_CH_EVENT_t for valid values. OR combinations of these enum item can be used + * as input. + * + * @return None + * + * \parDescription:
+ * Disables the I2S protocol specific events, by configuring PCR register.\n\n + * After disabling the events, XMC_I2S_CH_EnableEvent() has to be invoked to re-enable the events. + * + * \parRelated APIs:
+ * XMC_I2S_CH_EnableEvent() + */ +void XMC_I2S_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return uint32_t Status of I2S protocol events. + * + * \parDescription:
+ * Returns the status of the events, by reading PSR register.\n\n + * This indicates the status of the all the events, for I2S communication. + * + * \parRelated APIs:
+ * XMC_I2S_CH_ClearStatusFlag() + */ +__STATIC_INLINE uint32_t XMC_I2S_CH_GetStatusFlag(XMC_USIC_CH_t *const channel) +{ + return channel->PSR_IISMode; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param flag Protocol event status to be cleared for detection of next occurence. + * Refer @ XMC_I2S_CH_STATUS_FLAG_t for valid values. OR combinations of these enum item can be used + * as input. + * @return None + * + * \parDescription:
+ * Clears the events specified, by setting PSCR register.\n\n + * During communication the events occurred have to be cleared to detect their next occurence.\n + * e.g: During transmission Transmit buffer event occurs to indicating data word transfer has started. This + * event has to be cleared after transmission of each data word. Otherwise next event cannot be recognized. + * + * \parRelated APIs:
+ * XMC_I2S_CH_GetStatusFlag() + */ +__STATIC_INLINE void XMC_I2S_CH_ClearStatusFlag(XMC_USIC_CH_t *const channel, const uint32_t flag) +{ + channel->PSCR |= flag; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Enables the generation of Master clock by setting PCR.MCLK bit.\n\n + * This clock can be used as a clock reference for external devices. This is not enabled during initialization in + * XMC_I2S_CH_Init(). Invoke XMC_I2S_CH_EnableMasterClock() to enable as needed in the program, or if it is disabled by + * XMC_I2S_CH_DisableMasterClock(). + * + * \parRelated APIs:
+ * XMC_I2S_CH_DisableMasterClock() + */ +__STATIC_INLINE void XMC_I2S_CH_EnableMasterClock(XMC_USIC_CH_t *const channel) +{ + channel->PCR_IISMode |= (uint32_t)USIC_CH_PCR_IISMode_MCLK_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Disables the generation of Master clock by clearing PCR.MCLK bit.\n\n + * This clock can be enabled by invoking XMC_I2S_CH_EnableMasterClock() as needed in the program. + * + * \parRelated APIs:
+ * XMC_I2S_CH_EnableMasterClock() + */ +__STATIC_INLINE void XMC_I2S_CH_DisableMasterClock(XMC_USIC_CH_t *const channel) +{ + channel->PCR_IISMode &= (uint32_t)~USIC_CH_PCR_IISMode_MCLK_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param clock_output shift clock source.\n + * Refer @ref XMC_I2S_CH_BRG_SHIFT_CLOCK_OUTPUT_t for valid inputs. + * + * @return None + * + * \parDescription:
+ * Configures the shift clock source by setting BRG.SCLKOSEL.\n\n + * In Master mode operation, shift clock is generated by the internal baud rate generator. This SCLK is made available + * for external slave devices by SCLKOUT signal.\n + * In Slave mode, the signal is received from the external master. So the DX1(input) stage has to be connected to input.\n + */ +__STATIC_INLINE void XMC_I2S_CH_ConfigureShiftClockOutput(XMC_USIC_CH_t *const channel, + const XMC_I2S_CH_BRG_SHIFT_CLOCK_OUTPUT_t clock_output) +{ + XMC_USIC_CH_ConfigureShiftClockOutput(channel, (XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t)0U, + (XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_t)clock_output); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param word_length Number of bits to be configured for a data word. \n + * \b Range: 1 to 16. + * + * @return None + * + * \parDescription
+ * Defines the data word length.\n\n + * Sets the number of bits to represent a data word. Frame length should be a multiple of word length. + * + * \parRelated APIs:
+ * XMC_I2S_CH_SetFrameLength() + */ +__STATIC_INLINE void XMC_I2S_CH_SetWordLength(XMC_USIC_CH_t *const channel, const uint8_t word_length) +{ + XMC_USIC_CH_SetWordLength(channel, word_length); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param frame_length Number of bits in a frame. \n + * \b Range: 1 to 64. + * + * @return None + * + * \parDescription
+ * Define the data frame length.\n\n + * Set the number of bits to be serially transmitted in a frame. + * The frame length should be multiples of word length. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetWordLength() + */ +__STATIC_INLINE void XMC_I2S_CH_SetFrameLength(XMC_USIC_CH_t *const channel, const uint8_t frame_length) +{ + XMC_USIC_CH_SetFrameLength(channel, frame_length); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param input I2S channel input stage.\n + * Refer @ref XMC_I2S_CH_INPUT_t for valid values + * @param source Input source select for the input stage. + * Range : [0 to 7] + * + * @return None + * + * \parDescription
+ * Selects the data source for I2S input stage, by configuring DXCR.DSEL bits.\n\n + * Selects the input data signal source among DXnA, DXnB.. DXnG for the input stage. The API can be used for all the + * input stages like DX0CR, DX1CR etc. This is not done during initialization. This has to be configured before starting + * the I2S communication. + */ +__STATIC_INLINE void XMC_I2S_CH_SetInputSource(XMC_USIC_CH_t *const channel, + const XMC_I2S_CH_INPUT_t input, + const uint8_t source) +{ + channel->DXCR[input] = (uint32_t)(channel->DXCR[input] & (~USIC_CH_DX0CR_DSEN_Msk)) | USIC_CH_DX0CR_INSW_Msk; + XMC_USIC_CH_SetInputSource(channel, (XMC_USIC_CH_INPUT_t)input, source); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param wa_inversion Polarity of the word address signal.\n + * Refer @ref XMC_I2S_CH_WA_POLARITY_t for valid values + * + * @return None + * + * \parDescription
+ * Set the polarity of the word address signal, by configuring PCR.SELINV bit.\n\n + * Normally WA signal is active low level signal. This is configured + * in XMC_I2S_CH_Init() during initialization. Invoke XMC_I2S_CH_WordAddressSignalPolarity() with desired settings as + * needed later in the program. + */ +__STATIC_INLINE void XMC_I2S_CH_WordAddressSignalPolarity(XMC_USIC_CH_t *const channel, + const XMC_I2S_CH_WA_POLARITY_t wa_inversion) +{ + /* Configuration of Protocol Control Register */ + channel->PCR_IISMode = (uint32_t)((channel->PCR_IISMode & (~USIC_CH_PCR_IISMode_SELINV_Msk)) | (uint32_t)wa_inversion); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param input I2S channel input stage.\n + * Refer @ref XMC_I2S_CH_INPUT_t for valid inputs. + * + * @return None + * + * \parDescription
+ * Enables the polarity inversion of input data signal, by setting DXyCR.DPOL(where y = \a input).\n\n + * This is not set in XMC_I2S_CH_Init(). Invoke XMC_I2S_CH_EnableInputInversion() as needed later in the program. To + * disable the inversion XMC_I2S_CH_DisableInputInversion() can be invoked. + * + * \parRelated APIs:
+ * XMC_I2S_CH_DisableInputInversion() + */ +__STATIC_INLINE void XMC_I2S_CH_EnableInputInversion(XMC_USIC_CH_t *const channel, + const XMC_I2S_CH_INPUT_t input) +{ + XMC_USIC_CH_EnableInputInversion(channel, (XMC_USIC_CH_INPUT_t)input); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param input I2S channel input stage.\n + * Refer @ref XMC_I2S_CH_INPUT_t for valid inputs. + * + * @return None + * + * \parDescription
+ * Disables the polarity inversion of input data signal, by clearing DXyCR.DPOL(where y = \a input).\n\n + * Resets the input data polarity. Invoke XMC_I2S_CH_EnableInputInversion() to apply inversion. + * + * \parRelated APIs:
+ * XMC_I2S_CH_EnableInputInversion() + */ +__STATIC_INLINE void XMC_I2S_CH_DisableInputInversion(XMC_USIC_CH_t *const channel, + const XMC_I2S_CH_INPUT_t input) +{ + XMC_USIC_CH_DisableInputInversion(channel, (XMC_USIC_CH_INPUT_t)input); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param service_request Service request number. + Range: [0 to 5] + * + * @return None + * + * \parDescription
+ * Sets the interrupt node for I2S channel events.\n\n + * For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so. This is not configured in XMC_I2S_CH_Init() during + * initialization. + * + * \parNote::
+ * 1. NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableEvent() + */ +__STATIC_INLINE void XMC_I2S_CH_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const uint8_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL, (uint32_t)service_request); +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2S0_CH0, @ref XMC_I2S0_CH1,@ref XMC_I2S1_CH0,@ref XMC_I2S1_CH1,@ref XMC_I2S2_CH0,@ref XMC_I2S2_CH1 @note Availability of I2S1 and I2S2 depends on device selection + * @param interrupt_node Interrupt node pointer to be configured. \n + * \b Range: @ref XMC_I2S_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, + * @ref XMC_I2S_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER etc. + * @param service_request Service request number.\n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets the interrupt node for USIC channel events. \n\n + * For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so.
+ * Note: NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_I2S_CH_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_I2S_CH_SelectInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_I2S_CH_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, (XMC_USIC_CH_INTERRUPT_NODE_POINTER_t)interrupt_node, + (uint32_t)service_request); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2S0_CH0, @ref XMC_I2S0_CH1,@ref XMC_I2S1_CH0,@ref XMC_I2S1_CH1,@ref XMC_I2S2_CH0,@ref XMC_I2S2_CH1 @note Availability of I2S1 and I2S2 depends on device selection + * @param service_request_line service request number of the event to be triggered. \n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Trigger a I2S interrupt service request.\n\n + * When the I2S service request is triggered, the NVIC interrupt associated with it will be + * generated if enabled. + * + * \parRelated APIs:
+ * XMC_I2S_CH_SelectInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_I2S_CH_TriggerServiceRequest(XMC_USIC_CH_t *const channel, const uint32_t service_request_line) +{ + XMC_USIC_CH_TriggerServiceRequest(channel, (uint32_t)service_request_line); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2S0_CH0, @ref XMC_I2S0_CH1,@ref XMC_I2S1_CH0,@ref XMC_I2S1_CH1,@ref XMC_I2S2_CH0,@ref XMC_I2S2_CH1 @note Availability of I2S1 and I2S2 depends on device selection + * @return None + * + * \parDescription
+ * Enables delay compensation. \n\n + * + * Delay compensation can be applied to the receive path. + * \parRelated APIs:
+ * XMC_I2S_CH_DisableDelayCompensation()\n\n\n + */ +__STATIC_INLINE void XMC_I2S_CH_EnableDelayCompensation(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_EnableDelayCompensation(channel); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2S0_CH0, @ref XMC_I2S0_CH1,@ref XMC_I2S1_CH0,@ref XMC_I2S1_CH1,@ref XMC_I2S2_CH0,@ref XMC_I2S2_CH1 @note Availability of I2S1 and I2S2 depends on device selection + * @return None + * + * \parDescription
+ * Disables delay compensation.. \n\n + * + * \parRelated APIs:
+ * XMC_I2S_CH_EnableDelayCompensation()\n\n\n + */ +__STATIC_INLINE void XMC_I2S_CH_DisableDelayCompensation(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_DisableDelayCompensation(channel); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2S0_CH0, @ref XMC_I2S0_CH1,@ref XMC_I2S1_CH0,@ref XMC_I2S1_CH1,@ref XMC_I2S2_CH0,@ref XMC_I2S2_CH1 @note Availability of I2S1 and I2S2 depends on device selection + * @return None + * + * \parDescription
+ * Enable data transmission.\n\n + * Use this function in combination with XMC_I2S_CH_DisableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * @note If you need more control over the start of transmission use XMC_USIC_CH_SetStartTransmisionMode() + * + * \parRelated APIs:
+ * XMC_I2S_CH_DisableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_I2S_CH_EnableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_ON_TDV); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_I2S0_CH0, @ref XMC_I2S0_CH1,@ref XMC_I2S1_CH0,@ref XMC_I2S1_CH1,@ref XMC_I2S2_CH0,@ref XMC_I2S2_CH1 @note Availability of I2S1 and I2S2 depends on device selection + * @return None + * + * \parDescription
+ * Disable data transmission.\n\n + * Use this function in combination with XMC_I2S_CH_EnableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * + * \parRelated APIs:
+ * XMC_I2S_CH_EnableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_I2S_CH_DisableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_DISABLED); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ +#endif /* XMC_I2S_H_ */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_ledts.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_ledts.h new file mode 100644 index 00000000..0934eda6 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_ledts.h @@ -0,0 +1,1052 @@ +/** + * @file xmc_ledts.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * - Documentation improved
+ * - New API added: XMC_LEDTS_SetActivePADNo()
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * @endcond + * + */ + +#ifndef XMC_LEDTS_H +#define XMC_LEDTS_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +#if defined(LEDTS0) +#include "xmc_scu.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup LEDTS + * @brief LED and Touch-Sense control(LEDTS) driver for the XMC controller family. + * + * The LED and Touch-Sense (LEDTS) drives LEDs and controls touch pads used as human-machine interface (HMI) in an + * application. The LEDTS can measure the capacitance of up to 8 touch pads, can also drive up to 64 LEDs in an LED matrix. + * Touch pads and LEDs can share pins to minimize the number of pins needed for such applications, this is realized by + * the module controlling the touch pads and driving the LEDs in a time-division multiplexed manner. + * + * This device contains LEDTS kernel that has an LED driving function and a touch-sensing function. + * + * It is recommended to set up all configurations for the LEDTS in all Special Function Registers(SFR) before + * enabling and starting LED and/or touch-sense function(s). + * + * This Low Level Driver(LLD) provides APIs to configure and control LED functionality, Touch-Sense functionality and + * features common to both functionalities. + * + * LED features: + * -# Configuration structure to configure LED functionality (XMC_LEDTS_LED_CONFIG_t) and initialization funtion + * (XMC_LEDTS_InitLED()). + * -# Selection of number of LED columns, active column level and enabling LED funtionality (XMC_LEDTS_InitLED()). + * -# Setting line pattern to be displayed on LED column (XMC_LEDTS_SetLEDLinePattern()). + * -# Brightness control of LED column (XMC_LEDTS_SetColumnBrightness()). + * -# Setting number of columns to be activated (XMC_LEDTS_SetNumOfLEDColumns()). + * + * Touch-Sense features: + * -# Configuration structure to perform basic Touch-Sense functionality (XMC_LEDTS_TS_CONFIG_BASIC_t) settings and + * initialization funtion (XMC_LEDTS_InitTSBasic()). + * -# Configuration structure to perform advanced Touch-Sense functionality (XMC_LEDTS_TS_CONFIG_ADVANCED_t) settings + * and initialization function (XMC_LEDTS_InitTSAdvanced()). + * -# Setting number of touch inputs and acculumate count on touch input (XMC_LEDTS_InitTSBasic()). + * -# Enabling/disabling of common compare, Touch-Sense counter auto reset and Touch-Sense funtionality. + * (XMC_LEDTS_InitTSBasic()). + * -# Set number of mask bits for time frame validation and first touch input to be active. (XMC_LEDTS_InitTSAdvanced()). + * -# Enable/disable time frame interrupt, external pull-up on touch pin and hardware or software control of + * pad turn (XMC_LEDTS_InitTSAdvanced()). + * -# Setting size of common oscillation window for all touch-sense inputs (XMC_LEDTS_SetCommonOscillationWindow()). + * -# Setting size of oscillation window for a touch-sense input (XMC_LEDTS_SetOscillationWindow()). + * + * Common features: + * -# Global configuration structure XMC_LEDTS_GLOBAL_CONFIG_t and initialization function XMC_LEDTS_InitGlobal(). + * -# Selection of Clock source for LEDTS module (XMC_LEDTS_InitGlobal()). + * -# Kick-start and stop of LEDTS module (XMC_LEDTS_StartCounter() / XMC_LEDTS_StopCounter()). + * -# Read and clear of interrupt status flags (XMC_LEDTS_ReadInterruptFlag() / XMC_LEDTS_ClearInterruptFlag()). + * -# Reading of previous active column number (XMC_LEDTS_ReadFNCOL()). + * -# Enable/Disable Interrupts(XMC_LEDTS_EnableInterrupt() / XMC_LEDTS_DisableInterrupt()). + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +#if defined(LEDTS0) +#define XMC_LEDTS0 ((XMC_LEDTS_GLOBAL_t *) LEDTS0) /**< Typedef for LEDTS kernel0*/ +#define XMC_LEDTS_CHECK_LEDTS0(PTR) (PTR == XMC_LEDTS0) +#else +#define XMC_LEDTS_CHECK_LEDTS0(PTR) 0 +#endif + +#if defined(LEDTS1) +#define XMC_LEDTS1 ((XMC_LEDTS_GLOBAL_t *) LEDTS1) /**< Typedef for LEDTS kernel1*/ +#define XMC_LEDTS_CHECK_LEDTS1(PTR) (PTR == XMC_LEDTS1) +#else +#define XMC_LEDTS_CHECK_LEDTS1(PTR) 0 +#endif + +#if defined(LEDTS2) +#define XMC_LEDTS2 ((XMC_LEDTS_GLOBAL_t *) LEDTS2) /**< Typedef for LEDTS kernel2*/ +#define XMC_LEDTS_CHECK_LEDTS2(PTR) (PTR == XMC_LEDTS2) +#else +#define XMC_LEDTS_CHECK_LEDTS2(PTR) 0 +#endif + +#define XMC_LEDTS_CHECK_KERNEL_PTR(PTR) (XMC_LEDTS_CHECK_LEDTS0(PTR) || \ + XMC_LEDTS_CHECK_LEDTS1(PTR) || \ + XMC_LEDTS_CHECK_LEDTS2(PTR)) + +/** + * Defines LEDTS module structure. This holds data and configuration registers of LEDTS modules. Use type + * XMC_LEDTS_GLOBAL_t for this data structure.\n + */ +typedef struct XMC_LEDTS_GLOBAL{ /*!< (@ 0x50020000) LEDTS Structure */ + __I uint32_t ID; /*!< (@ 0x50020000) Module Identification Register */ + __IO uint32_t GLOBCTL; /*!< (@ 0x50020004) Global Control Register */ + __IO uint32_t FNCTL; /*!< (@ 0x50020008) Function Control Register */ + __O uint32_t EVFR; /*!< (@ 0x5002000C) Event Flag Register */ + __IO uint32_t TSVAL; /*!< (@ 0x50020010) Touch-sense TS-Counter Value */ + __IO uint32_t LINE[2]; /*!< (@ 0x50020014) Line Pattern Register 0 */ + __IO uint32_t LDCMP[2]; /*!< (@ 0x5002001C) LED Compare Register 0 */ + __IO uint32_t TSCMP[2]; /*!< (@ 0x50020024) Touch-sense Compare Register 0 */ + } XMC_LEDTS_GLOBAL_t; + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +/** + * Defines typedef for LEDTS Global data structure. Use type XMC_LEDTS_t for this data structure.\n + */ +typedef XMC_LEDTS_GLOBAL_t XMC_LEDTS_t; + +#if defined(LEDTS0) +#define XMC_LEDTS0 ((XMC_LEDTS_GLOBAL_t *) LEDTS0) /**< Typedef for LEDTS kernel0*/ +#endif + +#if defined(LEDTS1) +#define XMC_LEDTS1 ((XMC_LEDTS_GLOBAL_t *) LEDTS1) /**< Typedef for LEDTS kernel1*/ +#endif + + +/** + * Defines return value of an API. Use type XMC_LEDTS_STATUS_t for this enum. + */ +typedef enum XMC_LEDTS_STATUS +{ + XMC_LEDTS_STATUS_SUCCESS = 0, /**< API fulfills request */ + XMC_LEDTS_STATUS_RUNNING = 1, /**< The kernel-counter is currently running */ + XMC_LEDTS_STATUS_ERROR = 2, /**< API cannot fulfill request */ + XMC_LEDTS_STATUS_IDLE = 3 /**< The kernel-counter is currently idle */ +} XMC_LEDTS_STATUS_t; + +/** + * Defines return value for checking interrupt flag. Use type XMC_LEDTS_FLAG_STATUS_t for this enum. + */ +typedef enum XMC_LEDTS_FLAG_STATUS +{ + XMC_LEDTS_FLAG_STATUS_NO = 0, /**< Flag not raised */ + XMC_LEDTS_FLAG_STATUS_YES = 1 /**< Flag is raised */ +} XMC_LEDTS_FLAG_STATUS_t; + +/** + * Defines Touch-Sense function enable/disable. Use type XMC_LEDTS_TS_FUNC_t for this enum. + */ +typedef enum XMC_LEDTS_TS_FUNC +{ + XMC_LEDTS_TS_FUNC_DISABLE = 0, /**< Disable touch-sense function */ + XMC_LEDTS_TS_FUNC_ENABLE = 1 /**< Enable touch-sense function */ +} XMC_LEDTS_TS_FUNC_t; + +/** + * Defines LED function enable/disable. Use type XMC_LEDTS_LED_FUNC_t for this enum. + */ +typedef enum XMC_LEDTS_LED_FUNC +{ + XMC_LEDTS_LED_FUNC_DISABLE = 0, /**< Disable LED function */ + XMC_LEDTS_LED_FUNC_ENABLE = 1 /**< Enable LED function */ +} XMC_LEDTS_LED_FUNC_t; + +/** + * Defines Clock master enable/disable. Use type for XMC_LEDTS_CLOCK_TYPE_t for this enum. + */ +typedef enum XMC_LEDTS_CLOCK_TYPE +{ + XMC_LEDTS_CLOCK_TYPE_MASTER = 0, /**< Kernel generates its own clock */ + XMC_LEDTS_CLOCK_TYPE_SLAVE = 1 /**< Clock is taken from another master kernel */ +} XMC_LEDTS_CLOCK_TYPE_t; + +/** + * Defines enable/disable of autoscan time period synchronization. Use type XMC_LEDTS_TP_SYNC_t for this enum. + */ +typedef enum XMC_LEDTS_TP_SYNC +{ + XMC_LEDTS_TP_SYNC_DISABLE = 0, /**< Synchronization is disabled */ + XMC_LEDTS_TP_SYNC_ENABLE = 1 /**< Synchronization enabled on Kernel0 autoscan time period */ +} XMC_LEDTS_TP_SYNC_t; + +/** + * Defines Suspend request configuration. Use type XMC_LEDTS_SUSPEND_t for this enum. + */ +typedef enum XMC_LEDTS_SUSPEND +{ + XMC_LEDTS_SUSPEND_DISABLE = 0, /**< Ignore suspend request */ + XMC_LEDTS_SUSPEND_ENABLE = 1 /**< Enable suspend according to request */ +} XMC_LEDTS_SUSPEND_t; + +/** + * Defines number of bits to mask for time frame event validation. Use type XMC_LEDTS_TS_COUNTER_MASK_t for this enum. + */ +typedef enum XMC_LEDTS_TS_COUNTER_MASK +{ + XMC_LEDTS_TS_COUNTER_MASK_1_LSB = 0, /**< Mask LSB bit only */ + XMC_LEDTS_TS_COUNTER_MASK_2_LSB = 1, /**< Mask 2 LSB bits */ + XMC_LEDTS_TS_COUNTER_MASK_3_LSB = 2, /**< Mask 3 LSB bits */ + XMC_LEDTS_TS_COUNTER_MASK_4_LSB = 3, /**< Mask 4 LSB bits */ + XMC_LEDTS_TS_COUNTER_MASK_5_LSB = 4, /**< Mask 5 LSB bits */ + XMC_LEDTS_TS_COUNTER_MASK_6_LSB = 5, /**< Mask 6 LSB bits */ + XMC_LEDTS_TS_COUNTER_MASK_7_LSB = 6, /**< Mask 7 LSB bits */ + XMC_LEDTS_TS_COUNTER_MASK_8_LSB = 7 /**< Mask 8 LSB bits */ +} XMC_LEDTS_TS_COUNTER_MASK_t; + +/** + * Defines Enable/disable of (extended) time frame validation. Use type XMC_LEDTS_TF_VALIDATION_t for this enum. + */ +typedef enum XMC_LEDTS_TF_VALIDATION +{ + XMC_LEDTS_TF_VALIDATION_DISABLE = 0, /**< Disable time frame validation */ + XMC_LEDTS_TF_VALIDATION_ENABLE = 1 /**< Enable time frame validation */ +} XMC_LEDTS_TF_VALIDATION_t; + +/** + * Defines Enable or disable interrupts. Use type XMC_LEDTS_INTERRUPT_t for this enum. + */ +typedef enum XMC_LEDTS_INTERRUPT +{ + XMC_LEDTS_INTERRUPT_TIMESLICE = LEDTS_GLOBCTL_ITS_EN_Msk, /**< Enable or Disable time slice interrupt */ + XMC_LEDTS_INTERRUPT_TIMEFRAME = LEDTS_GLOBCTL_ITF_EN_Msk, /**< Enable or Disable time frame interrupt */ + XMC_LEDTS_INTERRUPT_TIMEPERIOD = LEDTS_GLOBCTL_ITP_EN_Msk /**< Enable or Disable autoscan time period interrupt */ +} XMC_LEDTS_INTERRUPT_t; + +/** + * Defines Touch-Sense TSIN pad turn. Use type XMC_LEDTS_PAD_TURN_t for this enum. + */ +typedef enum XMC_LEDTS_PAD_TURN +{ + XMC_LEDTS_PAD_TURN_0 = 0, /**< TSIN0 is next or currently active */ + XMC_LEDTS_PAD_TURN_1 = 1, /**< TSIN1 is next or currently active */ + XMC_LEDTS_PAD_TURN_2 = 2, /**< TSIN2 is next or currently active */ + XMC_LEDTS_PAD_TURN_3 = 3, /**< TSIN3 is next or currently active */ + XMC_LEDTS_PAD_TURN_4 = 4, /**< TSIN4 is next or currently active */ + XMC_LEDTS_PAD_TURN_5 = 5, /**< TSIN5 is next or currently active */ + XMC_LEDTS_PAD_TURN_6 = 6, /**< TSIN6 is next or currently active */ + XMC_LEDTS_PAD_TURN_7 = 7 /**< TSIN7 is next or currently active */ +} XMC_LEDTS_PAD_TURN_t; + +/** + * Defines software control for Touch-Sense pad turn. Use type XMC_LEDTS_PAD_TURN_SW_CONTROL_t for this enum. + */ +typedef enum XMC_LEDTS_PAD_TURN_SW_CONTROL +{ + XMC_LEDTS_SW_CONTROL_DISABLE = 0, /**< Disable software control. Auto hardware control */ + XMC_LEDTS_SW_CONTROL_ENABLE = 1 /**< Enable software control for pad turn */ +} XMC_LEDTS_PAD_TURN_SW_CONTROL_t; + +/** + * Defines External pull-up on touch-sense pin. Use type XMC_LEDTS_EXT_PULLUP_COLA_t for this enum. + */ +typedef enum XMC_LEDTS_EXT_PULLUP_COLA +{ + XMC_LEDTS_EXT_PULLUP_COLA_DISABLE = 0, /**< Disable external pull-up. Internal pull-up is active */ + XMC_LEDTS_EXT_PULLUP_COLA_ENABLE = 1 /**< Enable external pull-up */ +} XMC_LEDTS_EXT_PULLUP_COLA_t; + +/** + * Defines number of accumulation counts on Touch-Sense input. Use type XMC_LEDTS_ACCUMULATION_COUNT_t for this enum. + */ +typedef enum XMC_LEDTS_ACCUMULATION_COUNT +{ + XMC_LEDTS_ACCUMULATION_COUNT_1_TIME = 0, /**< Accumulate once */ + XMC_LEDTS_ACCUMULATION_COUNT_2_TIMES = 1, /**< Accumulate twice */ + XMC_LEDTS_ACCUMULATION_COUNT_3_TIMES = 2, /**< Accumulate thrice */ + XMC_LEDTS_ACCUMULATION_COUNT_4_TIMES = 3, /**< Accumulate 4 times */ + XMC_LEDTS_ACCUMULATION_COUNT_5_TIMES = 4, /**< Accumulate 5 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_6_TIMES = 5, /**< Accumulate 6 times */ + XMC_LEDTS_ACCUMULATION_COUNT_7_TIMES = 6, /**< Accumulate 7 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_8_TIMES = 7, /**< Accumulate 8 times */ + XMC_LEDTS_ACCUMULATION_COUNT_9_TIMES = 8, /**< Accumulate 9 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_10_TIMES = 9, /**< Accumulate 10 times */ + XMC_LEDTS_ACCUMULATION_COUNT_11_TIMES = 10, /**< Accumulate 11 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_12_TIMES = 11, /**< Accumulate 12 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_13_TIMES = 12, /**< Accumulate 13 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_14_TIMES = 13, /**< Accumulate 14 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_15_TIMES = 14, /**< Accumulate 15 times*/ + XMC_LEDTS_ACCUMULATION_COUNT_16_TIMES = 15 /**< Accumulate 16 times*/ +} XMC_LEDTS_ACCUMULATION_COUNT_t; + +/** + * Defines enable/disable of common compare configuration for Touch-Sense. Use type XMC_LEDTS_COMMON_COMPARE_t + * for this enum. + */ +typedef enum XMC_LEDTS_COMMON_COMPARE +{ + XMC_LEDTS_COMMON_COMPARE_DISABLE = 0, /**< Disable common compare for touch-sense */ + XMC_LEDTS_COMMON_COMPARE_ENABLE = 1 /**< Enable common compare for touch-sense */ +} XMC_LEDTS_COMMON_COMPARE_t; + +/** + * Defines extended Touch-Sense output for pin-low-level. Use type XMC_LEDTS_EXTEND_TS_OUTPUT_t for this enum. + */ +typedef enum XMC_LEDTS_EXTEND_TS_OUTPUT +{ + XMC_LEDTS_EXTEND_TS_OUTPUT_BY_1_CLK = 0, /**< Extend Touch-Sense output for pin-low-level by 1 ledts_clk */ + XMC_LEDTS_EXTEND_TS_OUTPUT_BY_4_CLK = 1, /**< Extend Touch-Sense output for pin-low-level by 4 ledts_clk */ + XMC_LEDTS_EXTEND_TS_OUTPUT_BY_8_CLK = 2, /**< Extend Touch-Sense output for pin-low-level by 8 ledts_clk */ + XMC_LEDTS_EXTEND_TS_OUTPUT_BY_16_CLK = 3 /**< Extend Touch-Sense output for pin-low-level by 16 ledts_clk */ +} XMC_LEDTS_EXTEND_TS_OUTPUT_t; + +/** + * Defines enable/disable of Touch-Sense counter auto reset configuration. Use type XMC_LEDTS_TS_COUNTER_AUTO_RESET_t + * for this enum. + */ +typedef enum XMC_LEDTS_TS_COUNTER_AUTO_RESET +{ + XMC_LEDTS_TS_COUNTER_AUTO_RESET_DISABLE = 0, /**< Disable Touch-Sense counter automatic reset */ + XMC_LEDTS_TS_COUNTER_AUTO_RESET_ENABLE = 1 /**< Enable Touch-Sense counter automatic reset to 0x00 */ +} XMC_LEDTS_TS_COUNTER_AUTO_RESET_t; + +/** + * Defines enable/disable of Touch-Sense counter saturation configuration. Use type XMC_LEDTS_TS_COUNTER_SATURATION_t + * for this enum. + */ +typedef enum XMC_LEDTS_TS_COUNTER_SATURATION +{ + XMC_LEDTS_TS_COUNTER_SATURATION_DISABLE = 0, /**< Disabled. Touch-Sense counter overflows when it reaches 0xFF */ + XMC_LEDTS_TS_COUNTER_SATURATION_ENABLE = 1 /**< Enabled. Touch-Sense counter stops counting when it reaches 0xFF */ +} XMC_LEDTS_TS_COUNTER_SATURATION_t; + +/** + * Defines number of Touch-Sense Input (for HW pad turn control). Use type XMC_LEDTS_NUMBER_TS_INPUT_t for this enum. + */ +typedef enum XMC_LEDTS_NUMBER_TS_INPUT +{ + XMC_LEDTS_NUMBER_TS_INPUT_1 = 0, /**< Only TSIN0 is used */ + XMC_LEDTS_NUMBER_TS_INPUT_2 = 1, /**< TSIN0 & TSIN1 are used */ + XMC_LEDTS_NUMBER_TS_INPUT_3 = 2, /**< TSIN0-TSIN2 are used */ + XMC_LEDTS_NUMBER_TS_INPUT_4 = 3, /**< TSIN0-TSIN3 are used */ + XMC_LEDTS_NUMBER_TS_INPUT_5 = 4, /**< TSIN0-TSIN4 are used */ + XMC_LEDTS_NUMBER_TS_INPUT_6 = 5, /**< TSIN0-TSIN5 are used */ + XMC_LEDTS_NUMBER_TS_INPUT_7 = 6, /**< TSIN0-TSIN6 are used */ + XMC_LEDTS_NUMBER_TS_INPUT_8 = 7 /**< TSIN0-TSIN7 are used */ +} XMC_LEDTS_NUMBER_TS_INPUT_t; + +/** + * Defines level of LED column when active. Use type XMC_LEDTS_ACTIVE_LEVEL_LED_COL_t for this enum. + */ +typedef enum XMC_LEDTS_ACTIVE_LEVEL_LED_COL +{ + XMC_LEDTS_ACTIVE_LEVEL_LED_COL_LOW = 0, /**< LED column pins output low when active */ + XMC_LEDTS_ACTIVE_LEVEL_LED_COL_HIGH = 1 /**< LED column pins output high when active */ +} XMC_LEDTS_ACTIVE_LEVEL_LED_COL_t; + +/** + * Defines Number of LED columns. Use type XMC_LEDTS_NUMBER_LED_COLUMNS_t for this enum. + */ +typedef enum XMC_LEDTS_NUMBER_LED_COLUMNS +{ + XMC_LEDTS_NUMBER_LED_COLUMNS_1 = 0, /**< COLA only if TS is enabled, else COL0 only */ + XMC_LEDTS_NUMBER_LED_COLUMNS_2 = 1, /**< COLA,COL0 if TS is enabled, else COL0-1 */ + XMC_LEDTS_NUMBER_LED_COLUMNS_3 = 2, /**< COLA,COL0-1 if TS is enabled, else COL0-2 */ + XMC_LEDTS_NUMBER_LED_COLUMNS_4 = 3, /**< COLA,COL0-2 if TS is enabled, else COL0-3 */ + XMC_LEDTS_NUMBER_LED_COLUMNS_5 = 4, /**< COLA,COL0-3 if TS is enabled, else COL0-4 */ + XMC_LEDTS_NUMBER_LED_COLUMNS_6 = 5, /**< COLA,COL0-4 if TS is enabled, else COL0-5 */ + XMC_LEDTS_NUMBER_LED_COLUMNS_7 = 6, /**< COLA,COL0-5 if TS is enabled, else COL0-6 */ + XMC_LEDTS_NUMBER_LED_COLUMNS_8 = 7 /**< Only possible if TS is disabled; COLA,COL0-6 used */ +} XMC_LEDTS_NUMBER_LED_COLUMNS_t; + +/** + * Defines Interrupt flag status. Use type XMC_LEDTS_TS_INTERRUPT_FLAG_t for this enum. + */ +typedef enum XMC_LEDTS_INTERRUPT_FLAG +{ + XMC_LEDTS_INTERRUPT_FLAG_TIMESLICE = LEDTS_EVFR_TSF_Msk, /**< Time slice interrupt flag status */ + XMC_LEDTS_INTERRUPT_FLAG_TIMEFRAME = LEDTS_EVFR_TFF_Msk, /**< Time frame interrupt flag status */ + XMC_LEDTS_INTERRUPT_FLAG_TIMEPERIOD = LEDTS_EVFR_TPF_Msk, /**< Time period interrupt flag status */ + XMC_LEDTS_INTERRUPT_FLAG_TSCOUNTER_OVERFLOW = LEDTS_EVFR_TSCTROVF_Msk, /**< TS counter overflow flag status */ +} XMC_LEDTS_TS_INTERRUPT_FLAG_t; + +/** + * Defines (Extended) Time frame interrupt flag status. Use type XMC_LEDTS_TF_INTERRUPT_FLAG_t for this enum. + */ +typedef enum XMC_LEDTS_TF_INTERRUPT_FLAG +{ + XMC_LEDTS_TF_INTERRUPT_FLAG_INACTIVE = 0, /**< (Extended) Time frame interrupt not active */ + XMC_LEDTS_TF_INTERRUPT_FLAG_ACTIVE = 1 /**< (Extended) Time frame interrupt active */ +} XMC_LEDTS_TF_INTERRUPT_FLAG_t; + +/** + * Defines Autoscan time period interrupt flag status. Use type XMC_LEDTS_AUTOSCAN_INTERRUPT_FLAG_t for this enum. + */ +typedef enum XMC_LEDTS_AUTOSCAN_INTERRUPT_FLAG +{ + XMC_LEDTS_AUTOSCAN_INTERRUPT_FLAG_INACTIVE = 0, /**< Autoscan time period interrupt not active */ + XMC_LEDTS_AUTOSCAN_INTERRUPT_FLAG_ACTIVE = 1 /**< Autoscan time period interrupt active */ +} XMC_LEDTS_AUTOSCAN_INTERRUPT_FLAG_t; + +/** + * Defines Touch-Sense counter overflow indication. Use type XMC_LEDTS_TS_COUNTER_OVERLOW_FLAG_t for this enum. + */ +typedef enum XMC_LEDTS_TS_COUNTER_OVERLOW_FLAG +{ + XMC_LEDTS_TS_COUNTER_OVERLOW_FLAG_NO = 0, /**< Touch-sense counter has not overflowed */ + XMC_LEDTS_TS_COUNTER_OVERLOW_FLAG_YES = 1 /**< Touch-sense counter has overflowed at least once */ +} XMC_LEDTS_TS_COUNTER_OVERLOW_FLAG_t; + +/** + * Defines available LED columns. Use type XMC_LEDTS_LED_COLUMN_t for this enum. + */ +typedef enum XMC_LEDTS_LED_COLUMN +{ + XMC_LEDTS_LED_COLUMN_0 = 0, /**< Denotes LED Column 0 */ + XMC_LEDTS_LED_COLUMN_1 = 1, /**< Denotes LED Column 1 */ + XMC_LEDTS_LED_COLUMN_2 = 2, /**< Denotes LED Column 2 */ + XMC_LEDTS_LED_COLUMN_3 = 3, /**< Denotes LED Column 3 */ + XMC_LEDTS_LED_COLUMN_4 = 4, /**< Denotes LED Column 4 */ + XMC_LEDTS_LED_COLUMN_5 = 5, /**< Denotes LED Column 5 */ + XMC_LEDTS_LED_COLUMN_6 = 6, /**< Denotes LED Column 6 */ + XMC_LEDTS_LED_COLUMN_A = 7 /**< Denotes LED Column A */ +} XMC_LEDTS_LED_COLUMN_t; + +/** + * Defines available Touch-Sense inputs. Use type XMC_LEDTS_TS_INPUT_t for this enum. + */ +typedef enum XMC_LEDTS_TS_INPUT +{ + XMC_LEDTS_TS_INPUT_0 = 0, /**< TSIN0 - Denotes touch-sense line 1 */ + XMC_LEDTS_TS_INPUT_1 = 1, /**< TSIN1 - Denotes touch-sense line 2 */ + XMC_LEDTS_TS_INPUT_2 = 2, /**< TSIN2 - Denotes touch-sense line 3*/ + XMC_LEDTS_TS_INPUT_3 = 3, /**< TSIN3 - Denotes touch-sense line 4*/ + XMC_LEDTS_TS_INPUT_4 = 4, /**< TSIN4 - Denotes touch-sense line 5*/ + XMC_LEDTS_TS_INPUT_5 = 5, /**< TSIN5 - Denotes touch-sense line 6*/ + XMC_LEDTS_TS_INPUT_6 = 6, /**< TSIN6 - Denotes touch-sense line 7*/ + XMC_LEDTS_TS_INPUT_7 = 7 /**< TSIN7 - Denotes touch-sense line 8*/ +} XMC_LEDTS_TS_INPUT_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + /*Anonymous structure/union guard start*/ + #if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * Data structure for initialization of global features common to LED and touch-sense function. Use + * type XMC_LEDTS_GLOBAL_CONFIG_t for this structure. + */ +typedef struct XMC_LEDTS_GLOBAL_CONFIG +{ + union + { + struct + { + uint32_t : 2; + uint32_t clock_generation:1; /**< When this bit is set LEDTS counter takes its clock from another master + kernel. Kernel generates its own clock when this bit is not set (CMTR). + Refer @ref XMC_LEDTS_CLOCK_TYPE_t enum for possible values. */ + + uint32_t autoscan_synchronization:1; /**< Set this bit to synchronize start of autoscan time period with master + kernel(ENSYNC). Refer @ref XMC_LEDTS_TP_SYNC_t enum for possible values. */ + uint32_t : 4; + uint32_t suspend_response:1; /**< Suspend request configuration(SUSCFG). + Refer @ref XMC_LEDTS_SUSPEND_t enum for possible values.*/ + }; + uint32_t globctl; + }; +}XMC_LEDTS_GLOBAL_CONFIG_t; + +/** + * Data structure for LED function initialization. Use type XMC_LEDTS_LED_CONFIG_t for this structure. + */ +typedef struct XMC_LEDTS_LED_CONFIG +{ + union + { + struct + { + uint32_t : 28; + uint32_t column_active_level:1; /**< When this bit is set LED column level is active high, otherwise column + level is active low(COLLEV). Refer @ref XMC_LEDTS_ACTIVE_LEVEL_LED_COL_t + enum for possible values.*/ + + uint32_t no_of_led_columns:3; /**< Defines number of LED columns(NR_LEDCOL). Range 0 - 7. + Refer @ref XMC_LEDTS_NUMBER_LED_COLUMNS_t enum for possible values. */ + }; + uint32_t fnctl; + }; +}XMC_LEDTS_LED_CONFIG_t; + +/** + * Data structure for basic Touch-Sense function initialization. Use type XMC_LEDTS_TS_CONFIG_BASIC_t for + * this structure. + */ +typedef struct XMC_LEDTS_TS_CONFIG_BASIC +{ + union + { + struct + { + uint32_t : 16; + uint32_t no_of_accumulation:4; /**< Defines number of times touch-sense input pin is enabled in touch-sense + time slice of consecutive frames(ACCCNT). Range 0 - 15. + Refer @ref XMC_LEDTS_ACCUMULATION_COUNT_t enum type for possible values. */ + + uint32_t common_compare:1; /**< When this bit is set it enables common compare for all touch sense inputs. + Disables common compare when not set(TSCCMP). + Refer @ref XMC_LEDTS_COMMON_COMPARE_t enum for possible values.*/ + uint32_t : 2; + uint32_t counter_auto_reset:1; /**< When this bit is set TS-counter is automatically reset to 00H on first pad + turn of a new touch-sense pin(TSCTRR). + Refer @ref XMC_LEDTS_TS_COUNTER_AUTO_RESET_t enum for possible values.*/ + + uint32_t counter_saturation:1; /**< When this bit is set TS-counter stops counting in the touch-sense time slice + of the same frame when it reaches FFH (TSCTRSAT). + Refer @ref XMC_LEDTS_TS_COUNTER_SATURATION_t enum for possible values. */ + + uint32_t no_of_touch_inputs:3; /**< Defines number of touch-sense inputs (NR_TSIN). Range 0 - 7. + Refer @ref XMC_LEDTS_NUMBER_TS_INPUT_t enum for possible values. */ + }; + uint32_t fnctl; + }; +}XMC_LEDTS_TS_CONFIG_BASIC_t; + +/** + * Data structure for advanced Touch-Sense function initialization. Use type XMC_LEDTS_TS_CONFIG_ADVANCED_t + * for this structure. + */ +typedef struct XMC_LEDTS_TS_CONFIG_ADVANCED +{ + union + { + struct + { + uint32_t : 9; + uint32_t validation_mask:3; /**< This bit-field defines number of LSB bits to mask for TS counter and shadow + TS counter comparison when Time Frame validation is enabled(MASKVAL). + Refer @ref XMC_LEDTS_TS_COUNTER_MASK_t enum for possible values.*/ + + uint32_t time_frame_validation:1; /**< Disable or enable (extended) time frame validation(FENVAL). + when validation fails time frame interrupt is not triggered. + Refer @ref XMC_LEDTS_TF_VALIDATION_t enum for possible values.*/ + uint32_t : 1; + uint32_t : 1; + }; + uint32_t globctl; + }; + union + { + struct + { + uint32_t first_pad_turn:3; /**< This bit-field denotes TSIN[x] pin on which oscillations are measured + currently/next(PADT). Refer @ref XMC_LEDTS_PAD_TURN_t enum for possible + values.*/ + + uint32_t pad_turn_control:1; /**< Control pad turn via HW or SW(PADTSW). + Refer @ref XMC_LEDTS_PAD_TURN_SW_CONTROL_t enum for possible values. */ + + uint32_t external_pullup:1; /**< Disable or enable external pull-up on touch pin(EPULL). + Refer @ref XMC_LEDTS_EXT_PULLUP_COLA_t enum for possible values. */ + uint32_t : 16; + uint32_t pin_low_extend:2; /**< This bit extends touch-sense output for pin-low-level configuration for + adjustment of oscillation per user system. + Refer @ref XMC_LEDTS_EXTEND_TS_OUTPUT_t enum for possible values. */ + }; + uint32_t fnctl; + }; +}XMC_LEDTS_TS_CONFIG_ADVANCED_t; + +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif + +#ifdef __cplusplus +extern "C" { +#endif +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param config Pointer to constant LEDTS Global configuration structure. Refer @ref XMC_LEDTS_GLOBAL_CONFIG_t + * data structure.
+ * + * @return + * XMC_LEDTS_STATUS_SUCCESS - on success.
+ * XMC_LEDTS_STATUS_RUNNING - LEDTS module currently active. Refer @ref XMC_LEDTS_STATUS_t enum type.
+ * + * \parDescription
+ * Initializes and configures GLOBCTL register of \a ledts with configuration data pointed by \a config. + * \par + * This API selects clock source (GLOBCTL.CMTR), enables/disables auto scan sync(GLOBCTL.ENSYNC) & + * suspend config(GLOBCTL.SUSCFG).
+ * Call this API to initialize global register fields common to both LED and touch-sense(TS).\n + * + * \parNote
+ * LEDTS should be stopped by using XMC_LEDTS_StopCounter()before calling this API.\n + * + * \parRelated API's
+ * XMC_LEDTS_StopCounter()\n + * + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitGlobal(XMC_LEDTS_t *const ledts, const XMC_LEDTS_GLOBAL_CONFIG_t *config); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param config Pointer to constant LEDTS LED configuration structure. Refer @ref XMC_LEDTS_LED_CONFIG_t + * data structure.
+ * + * @return + * XMC_LEDTS_STATUS_SUCCESS - on success.
+ * XMC_LEDTS_STATUS_RUNNING - LEDTS module currently active/running. Refer @ref XMC_LEDTS_STATUS_t enum type.
+ * + * \parDescription
+ * Configures FNCTL register of \a ledts with configuration data pointed by \a config and enables LED functionality. + * \par + * This API sets number of LED columns(FNCTL.NR_LEDCOL), column level(FNCTL.COLLEV) and enables LED + * functionality(GLOBCTL.LD_EN). + * \par + * Call this API to Configure \a FNCTL & \a GLOBCTL registers for LED-driving function. Global initialization of + * LEDTS module should be done by calling XMC_LEDTS_InitGlobal() prior to calling this API.\n + * + * \parNote
+ * LEDTS should be stopped by using XMC_LEDTS_StopCounter() before calling this API.\n + * + * \parRelated API's
+ * XMC_LEDTS_StopCounter() XMC_LEDTS_InitGlobal()\n + * + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitLED(XMC_LEDTS_t *const ledts, const XMC_LEDTS_LED_CONFIG_t *config); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param config Pointer to constant LEDTS TS basic configuration structure. Refer @ref XMC_LEDTS_TS_CONFIG_BASIC_t + * data structure.
+ * + * @return + * XMC_LEDTS_STATUS_SUCCESS - on success.
+ * XMC_LEDTS_STATUS_RUNNING - LEDTS module currently active/running. Refer @ref XMC_LEDTS_STATUS_t enum type.
+ * + * \parDescription
+ * Configures FNCTL register of \a ledts for basic touch sense functionality with configuration data pointed by \a config + * and enables TS functionality. + * \par + * This API sets number of touch inputs(FNCTL.NR_TSIN), accumulate count on touch input(FNCTL.ACCCNT). + * \par + * This API Enables/disables common compare(FNCTL.TSCCMP), TS counter auto reset(FNCTL.TSCTRR), counter + * saturation(FNCTL.TSCTRSAT) and enables TS functionality(GLOBCTL.TS_EN). + * \par + * Call this API to configure \a FNCTL & \a GLOBCTL registers for basic touch sense function. Global initialization + * of LEDTS module should be done by calling XMC_LEDTS_InitGlobal() prior to calling this API.\n + * + * \parNote
+ * LEDTS should be stopped by using XMC_LEDTS_StopCounter() before calling this API.\n + * + * \parRelated API's
+ * XMC_LEDTS_StopCounter() XMC_LEDTS_InitGlobal()\n + * + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitTSBasic(XMC_LEDTS_t *const ledts, const XMC_LEDTS_TS_CONFIG_BASIC_t *config); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param config Pointer to constant LEDTS TS advanced configuration structure. + * Refer @ref XMC_LEDTS_TS_CONFIG_ADVANCED_t data structure.
+ * + * @return + * XMC_LEDTS_STATUS_SUCCESS - on success.
+ * XMC_LEDTS_STATUS_RUNNING - LEDTS module currently active/running. Refer @ref XMC_LEDTS_STATUS_t enum type.
+ * + * \parDescription
+ * Configures FNCTL register of \a ledts for advanced touch sense functionality with configuration data pointed by + * \a config. + * \par + * This API sets number of mask-bits for time frame validation(GLOBCTL.MASKVAL) & first touch input to be active(if + * pad turn control is set to S/W)(FNCTL.PADT). + * \par + * Enables/disables time frame interrupt(GLOBCTL.ITF_EN), external pull up on touch pin(FNCTL.EPULL) & H/W or S/W + * control of pad turn(if set to H/W, touch input activation is done in round-robin sequence, starting from TSIN0) + * (FNCTL.PADTSW). + * \par + * Call this API to initialize registers for advanced touch sense function. Before calling this API Call + * XMC_LEDTS_InitGlobal() to do Global initialization and XMC_LEDTS_InitTSBasic() to do basic init of touch-sense.\n + * + * \parNote
+ * LEDTS should be stopped by using XMC_LEDTS_StopCounter() before calling this API.\n + * + * \parRelated API's
+ * XMC_LEDTS_StopCounter(), XMC_LEDTS_InitTSBasic().\n + * + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitTSAdvanced (XMC_LEDTS_t *const ledts, const XMC_LEDTS_TS_CONFIG_ADVANCED_t *config); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param prescaler Constant prescaler value. Range: 0H to FFFFH.
+ * + * @return + * None.
+ * + * \parDescription
+ * Kick-starts the LEDTS module by programming CLK_PS bit field of GLOBCTL register with \a prescaler value to start + * the LEDTS-counter. + * \par + * To set LEDTS counter at least one of the touch-sense or LED function should be enabled. + * Call this API to start LEDTS counter.\n + * + * \parNote
+ * This should be called after all used modules have been initialized.\n + * + * \parRelated API's
+ * XMC_LEDTS_StopCounter(), XMC_LEDTS_InitLED(), XMC_LEDTS_InitTSBasic(), XMC_LEDTS_InitTSAdvanced().\n + * + */ +void XMC_LEDTS_StartCounter(XMC_LEDTS_t *const ledts, const uint16_t prescaler); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * + * @return + * None.
+ * + * \parDescription
+ * Stops the LEDTS module by programming the CLK_PS bit field(with value = 0) of GLOBCTL register.
+ * This could be done when it is required to change some module configuration which requires the LEDTS-counter + * to be stopped before the register bit/bit field can be programmed.
Call this API to stop LEDTS counter.\n + * + * \parRelated API's
+ * XMC_LEDTS_StartCounter(), XMC_LEDTS_InitLED(), XMC_LEDTS_InitTSBasic(), XMC_LEDTS_InitTSAdvanced().\n + * + */ +void XMC_LEDTS_StopCounter(XMC_LEDTS_t *const ledts); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param interrupt_mask mask value of @ref XMC_LEDTS_INTERRUPT_t enum type.
+ * + * @return + * None.
+ * + * \parDescription
+ * Enables requested interrupt type by configuring GLOBCTL register with masked value \a interrupt_mask.
+ * \par + * This API can be used to enable time slice(GLOBCTL.ITS_EN) or time frame(GLOBCTL.ITF_EN )or time period + * (GLOBCTL.ITP_EN)interrupt or any combination of these interrupts by passing appropriate bitwise ORed mask value.\n + * + * \parRelated API's
+ * XMC_LEDTS_DisableInterrupt().\n + * + */ +__STATIC_INLINE void XMC_LEDTS_EnableInterrupt(XMC_LEDTS_t *const ledts, uint32_t interrupt_mask) +{ + XMC_ASSERT("XMC_LEDTS_EnableInterrupt:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + ledts->GLOBCTL |= interrupt_mask; +} + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param interrupt_mask mask value of @ref XMC_LEDTS_INTERRUPT_t enum type.
+ * + * @return + * None.
+ * + * \parDescription
+ * Disables requested interrupt type by configuring GLOBCTL register with masked value \a interrupt_mask.
+ * \par + * This API can be used to disable time slice(GLOBCTL.ITS_EN) or time frame(GLOBCTL.ITF_EN )or time period + * (GLOBCTL.ITP_EN)interrupt or any combination of these interrupts by passing appropriate bitwise ORed mask value.\n + * + * \parRelated API's
+ * XMC_LEDTS_EnableInterrupt().\n + * + */ +__STATIC_INLINE void XMC_LEDTS_DisableInterrupt(XMC_LEDTS_t *const ledts, uint32_t interrupt_mask) +{ + XMC_ASSERT("XMC_LEDTS_DisableInterrupt:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + ledts->GLOBCTL &= ~interrupt_mask; +} + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * + * @return + * Status flags for events. Possible event flags are 0x01(time slice), 0x02(time frame), + 0x04(time period), 0x08(TS counter overflow).
+ * + * \parDescription
+ * Returns interrupt status flag by reading TSF(time slice), TFF(time frame), TPF(time period), TSCTROVF + * (touch sense counter overflow) fields of EVFR register.
+ * Typically used in interrupt handler to find out which event has triggered the interrupt.\n + * + * \parNote
+ * These flags are set on event regardless of corresponding interrupt is enabled or not.\n + * + * \parRelated API's
+ * XMC_LEDTS_ClearInterruptFlag().\n + * + */ +uint32_t XMC_LEDTS_ReadInterruptFlag(XMC_LEDTS_t *const ledts); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param interrupt_mask mask value of @ref XMC_LEDTS_INTERRUPT_t enum type.
+ * + * @return + * None.
+ * + * \parDescription
+ * Clears interrupt status flags in EVFR register as indicated by mask value \a interrupt_mask.
+ * This API sets EVFR.CTSF, EVFR.CTFF, EVFR.CTPF bit fields to clear time slice, time frame or time period interrupts + * respectively. + * \par + * Typically used along with XMC_LEDTS_ReadInterruptFlag() to figure out which event triggered the interrupt.\n + * + * \parNote
+ * Calling this API moves interrupt from pending/active state to inactive state. If the interrupt is pulsed, + * failing to clear the event bit might cause CPU to immediately re-enter the interrupt service routine(ISR).\n + * + * \parRelated API's
+ * XMC_LEDTS_ReadInterruptFlag().\n + * + */ +void XMC_LEDTS_ClearInterruptFlag(XMC_LEDTS_t *const ledts, uint32_t interrupt_mask); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param pad_num Pad number. Range refer @ref XMC_LEDTS_NUMBER_TS_INPUT_t enum type.
+ * + * @return + * None.
+ * + * \parDescription
+ * Sets TSIN[x] (where x corresponds to \a active pad number to be set) field of TSIN[x](x = 0-7) .
+ * This is the TSIN[x] pin that is next or currently active in pad turn.
+ * Call this API to set the active pad turn. + * \par + * Touch sense functionality should be initialized and configured before calling this API.\n + * + */ +void XMC_LEDTS_SetActivePADNo(XMC_LEDTS_t *const ledts, XMC_LEDTS_NUMBER_TS_INPUT_t pad_num); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param column Column number. Range refer @ref XMC_LEDTS_LED_COLUMN_t enum type.
+ * @param pattern Pattern to be displayed. Range: 0H to FFH.
+ * + * @return + * None.
+ * + * \parDescription
+ * Sets LINE_x (where x corresponds to \a column number) field of LINEx(x = 0-1) register to \a pattern value.
+ * This value is output on LINE_x when LED \a column x is active.
Call this API to set desired LED pattern. + * \par + * LED functionality should be initialized and configured before calling this API.\n + * + */ +void XMC_LEDTS_SetLEDLinePattern(XMC_LEDTS_t *const ledts, XMC_LEDTS_LED_COLUMN_t column, const uint8_t pattern); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param column Column number. Range refer @ref XMC_LEDTS_LED_COLUMN_t enum type.
+ * @param brightness LED brightness level. Range: 0H(min brightness) to FFH(max brightness).
+ * + * @return + * None.
+ * + * \parDescription
+ * Programs CMP_LDx (where x denotes \a column number) field of LDCMPx(x = 0-1)register to the requested \a brightness + * level. + * \par + * The LDCMPx registers hold the COMPARE values for their respective LED columns. These values are used for LED + * brightness control. Call this API to control brightness level of the LED. + * \par + * LED functionality should be initialized and configured before calling this API.\n + * + */ +void XMC_LEDTS_SetColumnBrightness(XMC_LEDTS_t *const ledts, XMC_LEDTS_LED_COLUMN_t column, const uint8_t brightness); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param common_size Requested common oscillation window width. Range: FFH(min) to 00H.(max)
+ * + * @return + * None.
+ * + * \parDescription
+ * Programs the respective LDCMP1 register bit field CMP_LDA_TSCOM with \a common_size. + * \par + * Call this API to adjust the size of the common oscillation window to increase/decrease the number of recorded + * number of oscillation counts for all touch-sense inputs.\n + * + */ +void XMC_LEDTS_SetCommonOscillationWindow(XMC_LEDTS_t *const ledts, const uint8_t common_size); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * + * @return + * uint32_t Previous active LED column number. Range: 0 to 7.
+ * + * \parDescription
+ * Returns active LED column number in previous time-slice by reading FNCOL bit field of FNCTL register. + * Call this API to figure out active column during previous time slice.\n + * + */ +uint32_t XMC_LEDTS_ReadFNCOL(XMC_LEDTS_t *const ledts); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure
+ * @param count Number of LED columns to be enabled. Range: 0 to 7.
+ * + * @return + * None.
+ * + * \parDescription
+ * Sets \a count number of LED columns active by programming NR_LEDCOL bit field of FNCTL register.
+ * \par + * Call this API to set desired number of LED columns active.\n + * + * \parNote
+ * NR_LEDCOL bit field can only be modified when LEDTS counter is not running, use XMC_LEDTS_StopCounter() + * to stop LEDTS module before calling this API.\n + * + * \parRelated API's
+ * XMC_LEDTS_StopCounter().\n + */ +void XMC_LEDTS_SetNumOfLEDColumns(XMC_LEDTS_t *const ledts, uint8_t count); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * + * @return + * uint16_t Shadow touch sense counter value. Range: 0H to FFFFH.
+ * + * \parDescription
+ * Returns latched touch sense counter value by reading the TSCTRVALR field of TSVAL register.
+ * \par + * This API is typically called in time frame(TF) event handler to get oscillation count of the touch-sense input + * active in previous time frame.\n + * + * \parNote
+ * This is the latched value of the TS-counter(on every extended time frame event).\n + * + * \parRelated API's
+ * XMC_LEDTS_ReadInterruptFlag().\n + */ +uint16_t XMC_LEDTS_ReadTSVAL(XMC_LEDTS_t *const ledts); + +/** + * + * @param ledts Constant pointer to LEDTS module structure. Refer @ref XMC_LEDTS_GLOBAL_t data structure.
+ * @param touchpad Touch-sense input pad number. Range refer @ref XMC_LEDTS_NUMBER_TS_INPUT_t enum type.
+ * @param size Requested oscillation window width. Range: 0H(max) to FFH(min).
+ * + * @return + * None.
+ * + * \parDescription
+ * Sets the size of \a touchpad touch sense oscillation window to \a size. + * \par + * This API programs the respective CMP_TSx(where x is \a touchpad number) bit fields of TSCMPx(x = 0-1) register. + * \a size value determines the size of the pad oscillation window for each pad input lines during their pad turn. + * \par + * Call this API to increase/decrease recorded number of oscillation counts for the requested touch-sense input.\n + * + */ +void XMC_LEDTS_SetOscillationWindow(XMC_LEDTS_t *const ledts, XMC_LEDTS_NUMBER_TS_INPUT_t touchpad, const uint8_t size); + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* LEDTS0 */ + +#endif /* XMC_LEDTS_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_math.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_math.h new file mode 100644 index 00000000..7fcfd150 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_math.h @@ -0,0 +1,1088 @@ +/** + * @file xmc_math.h + * @date 2015-10-08 + * + * @cond + ********************************************************************************** + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification,are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share + * modifications, enhancements or bug fixes with Infineon Technologies AG + * dave@infineon.com). + ********************************************************************************** + * + * Change History + * -------------- + * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * - Updated copyright and change history section. + * + * 2015-08-25: + * - XMC_MATH_ClearEvent() API is updated to set the event clear flag bit.
+ * + * 2015-09-23: + * - Added SQRT functions + * + * 2015-10-08: + * - Return values for sin(), cos(), sinh(), cosh(), arctan() are corrected. + * + * @endcond + * + */ + +#ifndef XMC_MATH_H +#define XMC_MATH_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +#if defined(MATH) +#include + +/** + * @addtogroup XMClib + * @{ + */ + +/** + * @addtogroup MATH + * @{ + * @brief MATH Coprocessor (MATH) driver for the XMC1302 microcontroller family
+ * + * The MATH Coprocessor (MATH) module comprises of two independent sub-blocks to support the CPU in math-intensive + * computations: a Divider Unit (DIV) for signed and unsigned 32-bit division operations and a CORDIC + * (COrdinate Rotation DIgital Computer) Coprocessor for computation of trigonometric, linear or hyperbolic functions.
+ * + * MATH driver features: + * -# CORDIC Coprocessor is used for computation of trigonometric and hyperbolic functions + * -# Supports result chaining between the Divider Unit and CORDIC Coprocessor + * -# All MATH APIs are available in Blocking and non-blocking modes. Non-blocking APIs are suffixed with NB. + * -# 32bit signed and unsigned division implementations available for __aeabi_uidiv(), __aeabi_idiv(), __aeabi_uidivmod(), __aeabi_idivmod() + * -# Divider and CORDIC unit busy status can be checked by XMC_MATH_DIV_IsBusy() and XMC_MATH_CORDIC_IsBusy() + * -# Individual APIs available to return the result of each non-blocking MATH function + * + * Note:
+ * All non-blocking MATH APIs are not atomic and hence occurence of interrupts during the normal execution of + * these APIs may lead to erroneous results. User has to exercise caution while using these APIs. + * + * Example: + * Execution of divide instruction (/) in an ISR during the normal execution of non-blocking APIs may give erroneous results. + * + */ + + +/********************************************************************************************************************* + * TYPE DEFINITIONS + ********************************************************************************************************************/ +/** + * @brief This typedef is used for Input and Output Data representation in blocking & non-blocking functions. + * XMC_MATH_Q0_23_t => 1 Signed bit, 0 Integer bits, 23 fraction bits. + */ +typedef int32_t XMC_MATH_Q0_23_t; + +/** + * @brief This typedef is used for Input Data representation in blocking & non-blocking functions. + * XMC_MATH_Q8_15_t => 1 Signed bit, 8 Integer bits, 15 fraction bits. + */ +typedef int32_t XMC_MATH_Q8_15_t; + +/** + * @brief This typedef is used for Output Data representation in blocking & non-blocking functions. + * XMC_MATH_Q1_22_t => 1 Signed bit, 1 Integer bits, 22 fraction bits. + */ +typedef int32_t XMC_MATH_Q1_22_t; + +/** + * @brief This typedef is used for Output Data representation in blocking & non-blocking functions. + * XMC_MATH_Q0_11_t => 1 Signed bit, 0 Integer bits, 11 fraction bits. + */ +typedef int32_t XMC_MATH_Q0_11_t; + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +/* Utility macros */ +#define XMC_MATH_Q0_23(x) ((XMC_MATH_Q0_23_t)(((x) >= 0) ? ((x) * (1 << 23) + 0.5) : ((x) * (1 << 23) - 0.5))) /**< Converts the given number to XMC_MATH_Q0_23_t format */ +#define XMC_MATH_Q0_11(x) ((XMC_MATH_Q0_11_t)(((x) >= 0) ? ((x) * (1 << 11) + 0.5) : ((x) * (1 << 11) - 0.5))) /**< Converts the given number to XMC_MATH_Q0_11_t format */ + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/** + * @brief Service request events for the DIV and CORDIC modules + */ +typedef enum XMC_MATH_EVENT +{ + XMC_MATH_EVENT_DIV_END_OF_CALC = 1U, /**< Divider end of calculation event */ + XMC_MATH_EVENT_DIV_ERROR = 2U, /**< Divider error event */ + XMC_MATH_EVENT_CORDIC_END_OF_CALC = 4U, /**< CORDIC end of calculation event */ + XMC_MATH_EVENT_CORDIC_ERROR = 8U /**< CORDIC error event */ +} XMC_MATH_EVENT_t; + +/** + * @brief Dividend Register Result Chaining + */ +typedef enum XMC_MATH_DIV_DVDRC +{ + XMC_MATH_DIV_DVDRC_DISABLED = 0U << MATH_GLBCON_DVDRC_Pos, /**< No result chaining is selected */ + XMC_MATH_DIV_DVDRC_QUOT_IS_SOURCE = 1U << MATH_GLBCON_DVDRC_Pos, /**< QUOT register is the selected source */ + XMC_MATH_DIV_DVDRC_RMD_IS_SOURCE = 2U << MATH_GLBCON_DVDRC_Pos, /**< RMD register is the selected source */ + XMC_MATH_DIV_DVDRC_CORRX_IS_SOURCE = 3U << MATH_GLBCON_DVDRC_Pos, /**< CORRX is the selected source */ + XMC_MATH_DIV_DVDRC_CORRY_IS_SOURCE = 4U << MATH_GLBCON_DVDRC_Pos, /**< CORRY is the selected source */ + XMC_MATH_DIV_DVDRC_CORRZ_IS_SOURCE = 5U << MATH_GLBCON_DVDRC_Pos /**< CORRZ is the selected source */ +} XMC_MATH_DIV_DVDRC_t; + +/** + * @brief Divisor Register Result Chaining + */ +typedef enum XMC_MATH_DIV_DVSRC +{ + XMC_MATH_DIV_DVSRC_DISABLED = 0U << MATH_GLBCON_DVSRC_Pos, /**< No result chaining is selected */ + XMC_MATH_DIV_DVSRC_QUOT_IS_SOURCE = 1U << MATH_GLBCON_DVSRC_Pos, /**< QUOT register is the selected source */ + XMC_MATH_DIV_DVSRC_RMD_IS_SOURCE = 2U << MATH_GLBCON_DVSRC_Pos, /**< RMD register is the selected source */ + XMC_MATH_DIV_DVSRC_CORRX_IS_SOURCE = 3U << MATH_GLBCON_DVSRC_Pos, /**< CORRX is the selected source */ + XMC_MATH_DIV_DVSRC_CORRY_IS_SOURCE = 4U << MATH_GLBCON_DVSRC_Pos, /**< CORRY is the selected source */ + XMC_MATH_DIV_DVSRC_CORRZ_IS_SOURCE = 5U << MATH_GLBCON_DVSRC_Pos /**< CORRZ is the selected source */ +} XMC_MATH_DIV_DVSRC_t; + +/** + * @brief CORDX Register Result Chaining + */ +typedef enum XMC_MATH_CORDIC_CORDXRC +{ + XMC_MATH_CORDIC_CORDXRC_DISABLED = 0U << MATH_GLBCON_CORDXRC_Pos, /**< No result chaining is selected */ + XMC_MATH_CORDIC_CORDXRC_QUOT_IS_SOURCE = 1U << MATH_GLBCON_CORDXRC_Pos, /**< QUOT register is the selected source */ + XMC_MATH_CORDIC_CORDXRC_RMD_IS_SOURCE = 2U << MATH_GLBCON_CORDXRC_Pos /**< RMD register is the selected source */ +} XMC_MATH_CORDIC_CORDXRC_t; + +/** + * @brief CORDY Register Result Chaining + */ +typedef enum XMC_MATH_CORDIC_CORDYRC +{ + XMC_MATH_CORDIC_CORDYRC_DISABLED = 0U << MATH_GLBCON_CORDYRC_Pos, /**< No result chaining is selected */ + XMC_MATH_CORDIC_CORDYRC_QUOT_IS_SOURCE = 1U << MATH_GLBCON_CORDYRC_Pos, /**< QUOT register is the selected source */ + XMC_MATH_CORDIC_CORDYRC_RMD_IS_SOURCE = 2U << MATH_GLBCON_CORDYRC_Pos /**< RMD register is the selected source */ +} XMC_MATH_CORDIC_CORDYRC_t; + +/** + * @brief CORDZ Register Result Chaining + */ +typedef enum XMC_MATH_CORDIC_CORDZRC +{ + XMC_MATH_CORDIC_CORDZRC_DISABLED = 0U << MATH_GLBCON_CORDZRC_Pos, /**< No result chaining is selected */ + XMC_MATH_CORDIC_CORDZRC_QUOT_IS_SOURCE = 1U << MATH_GLBCON_CORDZRC_Pos, /**< QUOT register is the selected source */ + XMC_MATH_CORDIC_CORDZRC_RMD_IS_SOURCE = 2U << MATH_GLBCON_CORDZRC_Pos /**< RMD register is the selected source */ +} XMC_MATH_CORDIC_CORDZRC_t; +/** + * @brief CORDIC operating mode + */ +typedef enum XMC_MATH_CORDIC_OPERATING_MODE +{ + XMC_MATH_CORDIC_OPERATING_MODE_LINEAR = 0U << MATH_CON_MODE_Pos, /**< Linear mode */ + XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR = 1U << MATH_CON_MODE_Pos, /**< Circular mode */ + XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC = 3U << MATH_CON_MODE_Pos /**< Hyperbolic mode */ +} XMC_MATH_CORDIC_OPERATING_MODE_t; + +/** + * @brief Rotation vectoring selection + */ +typedef enum XMC_MATH_CORDIC_ROTVEC_MODE +{ + XMC_MATH_CORDIC_ROTVEC_MODE_VECTORING = 0U << MATH_CON_ROTVEC_Pos, /**< Vectoring mode */ + XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION = 1U << MATH_CON_ROTVEC_Pos /**< Rotation mode */ +} XMC_MATH_CORDIC_ROTVEC_MODE_t; + +/** + * @brief Calculated value of CORRX and CORRY are each divided by this factor to yield the result. + */ +typedef enum XMC_MATH_CORDIC_MAGNITUDE +{ + XMC_MATH_CORDIC_MAGNITUDE_DIVBY1 = 0U << MATH_CON_MPS_Pos, /**< Divide by 1 */ + XMC_MATH_CORDIC_MAGNITUDE_DIVBY2 = 1U << MATH_CON_MPS_Pos, /**< Divide by 2 */ + XMC_MATH_CORDIC_MAGNITUDE_DIVBY4 = 2U << MATH_CON_MPS_Pos, /**< Divide by 4 */ +} XMC_MATH_CORDIC_MAGNITUDE_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * API Prototypes - General + ********************************************************************************************************************/ + +/** + * + * @return None + * + * \parDescription:
+ * Enables the Math module by un-gating the clock. + * + * \par + * MATH coprocessor's clock is enabled by setting \a MATH bit of \a CGATCLR0 register. + * + * \parRelated APIs:
+ * XMC_MATH_Disable()\n\n\n + * + */ +__STATIC_INLINE void XMC_MATH_Enable(void) +{ + /* Un-gates clock to the MATH kernel */ + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_MATH); +} + +/** + * + * @return None + * + * \parDescription:
+ * Disables the Math module by gating the clock. + * + * \par + * MATH coprocessor's clock is disabled by setting \a MATH bit of \a CGATSET0 register. + * + * \parRelated APIs:
+ * XMC_MATH_Disable()\n\n\n + * + */ +__STATIC_INLINE void XMC_MATH_Disable(void) +{ + /* Gates clock to the MATH kernel */ + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_MATH); +} + +/** + * + * @return bool \n + * true - if DIV unit is busy + * false - if DIV unit is not busy + * + * \parDescription:
+ * Utility function to check if the DIV unit is busy. + * + * \par + * Divider unit status is determined by reading \a BSY bit of \a DIVST register. + * + */ +bool XMC_MATH_DIV_IsBusy(void); + +/** + * + * @return bool \n + * true - if CORDIC unit is busy\n + * false - if CORDIC unit is not busy + * + * \parDescription:
+ * Utility function to check if the DIV unit is busy. + * + * \par + * CORDIC coprocessor's status is determined by reading \a BSY bit of \a STATC register. + * + */ +bool XMC_MATH_CORDIC_IsBusy(void); + +/** + * @param event Event of type XMC_MATH_EVENT_t + * + * @return bool\n + * true - if status is set\n + * false - if status is not set + * + * \parDescription:
+ * Returns the status of the requested event. + * + * \par + * Status of DIV & CORDIC unit's event (end of calculation & error) status is determined by reading \a EVFR register. + * + * \parRelated APIs:
+ * XMC_MATH_EnableEvent(), XMC_MATH_DisableEvent(), XMC_MATH_SetEvent(), XMC_MATH_ClearEvent()\n\n\n + * + */ +bool XMC_MATH_GetEventStatus(const XMC_MATH_EVENT_t event); + +/** + * @param event Event of type XMC_MATH_EVENT_t + * + * @return None + * + * \parDescription:
+ * Enables the requested event. + * + * \par + * DIV & CORDIC unit's event (end of calculation & error) is enabled by setting bit-fields of \a EVIER register. + * + * \parRelated APIs:
+ * XMC_MATH_GetEventStatus(), XMC_MATH_DisableEvent()\n\n\n + * + */ +__STATIC_INLINE void XMC_MATH_EnableEvent(const XMC_MATH_EVENT_t event) +{ + MATH->EVIER |= (uint32_t) event; +} + +/** + * @param event Event of type XMC_MATH_EVENT_t + * + * @return None + * + * \parDescription:
+ * Disables the requested event. + * + * \par + * DIV & CORDIC unit's event (end of calculation & error) is disabled by clearing bit-fields of \a EVIER register. + * + * \parRelated APIs:
+ * XMC_MATH_GetEventStatus(), XMC_MATH_EnableEvent()\n\n\n + * + */ +__STATIC_INLINE void XMC_MATH_DisableEvent(const XMC_MATH_EVENT_t event) +{ + MATH->EVIER &= ~((uint32_t) event); +} + +/** + * @param event Event of type XMC_MATH_EVENT_t + * + * @return None + * + * \parDescription:
+ * Sets the requested event. This is a software setting for the event. + * + * \par + * DIV & CORDIC unit's event (end of calculation & error) is set by setting bit-fields of \a EVFSR register. + * + * \parRelated APIs:
+ * XMC_MATH_ClearEvent()\n\n\n + * + */ +__STATIC_INLINE void XMC_MATH_SetEvent(const XMC_MATH_EVENT_t event) +{ + MATH->EVFSR |= (uint32_t) event; +} + +/** + * @param event Event of type XMC_MATH_EVENT_t + * + * @return None + * + * \parDescription:
+ * Clears the requested event. + * + * \par + * DIV & CORDIC unit's event (end of calculation & error) is cleared by setting bit-fields of \a EVFCR register. + * + * \parRelated APIs:
+ * XMC_MATH_SetEvent()\n\n\n + * + */ +__STATIC_INLINE void XMC_MATH_ClearEvent(const XMC_MATH_EVENT_t event) +{ + MATH->EVFCR |= (uint32_t) event; +} + +/** + * @return XMC_MATH_Q0_23_t + * + * \parDescription:
+ * Returns result of a Cosine operation. + * + * \par + * Most significant 24 bits of \a CORRX register returns the result of Cosine operation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_CosNB()\n\n\n + * + */ +__STATIC_INLINE XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetCosResult(void) +{ + return ((XMC_MATH_Q0_23_t) (((int32_t)MATH->CORRX) >> MATH_CORRX_RESULT_Pos)); +} + +/** + * @return XMC_MATH_Q0_23_t + * + * \parDescription:
+ * Returns result of a Sine operation. + * + * \par + * Most significant 24 bits of \a CORRY register returns the result of Sine operation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_SinNB()\n\n\n + * + */ +__STATIC_INLINE XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetSinResult(void) +{ + return ((XMC_MATH_Q0_23_t) (((int32_t)MATH->CORRY) >> MATH_CORRY_RESULT_Pos)); +} + +/** + * @return XMC_MATH_Q0_11_t + * + * \parDescription:
+ * Returns result of a Tangent operation. + * + * \par + * \a QUOT register returns the result of Tangent operation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_TanNB()\n\n\n + * + */ +__STATIC_INLINE XMC_MATH_Q0_11_t XMC_MATH_CORDIC_GetTanResult(void) +{ + return ((XMC_MATH_Q0_11_t) MATH->QUOT); +} + +/** + * @return XMC_MATH_Q0_23_t + * + * \parDescription:
+ * Returns result of a Arc Tangent operation. + * + * \par + * Most significant 24 bits of \a CORRZ register returns the result of Arc Tangent operation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_ArcTanNB()\n\n\n + * + */ +__STATIC_INLINE XMC_MATH_Q0_23_t XMC_MATH_CORDIC_GetArcTanResult(void) +{ + return ((XMC_MATH_Q0_23_t) (((int32_t)MATH->CORRZ) >> MATH_CORRZ_RESULT_Pos)); +} + +/** + * @return XMC_MATH_Q1_22_t + * + * \parDescription:
+ * Returns result of a Hyperbolic Cosine operation. + * + * \par + * Most significant 24 bits of \a CORRX register returns the result of Hyperbolic Cosine operation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_CoshNB()\n\n\n + * + */ +__STATIC_INLINE XMC_MATH_Q1_22_t XMC_MATH_CORDIC_GetCoshResult(void) +{ + return ((XMC_MATH_Q1_22_t) (((int32_t)MATH->CORRX) >> MATH_CORRX_RESULT_Pos)); +} + +/** + * @return XMC_MATH_Q1_22_t + * + * \parDescription:
+ * Returns result of a Hyperbolic Sine operation. + * + * \par + * Most significant 24 bits of \a CORRY register returns the result of Hyperbolic Sine operation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_SinhNB()\n\n\n + * + */ +__STATIC_INLINE XMC_MATH_Q1_22_t XMC_MATH_CORDIC_GetSinhResult(void) +{ + return ((XMC_MATH_Q1_22_t) (((int32_t)MATH->CORRY) >> MATH_CORRY_RESULT_Pos)); +} + +/** + * @return XMC_MATH_Q0_11_t + * + * \parDescription:
+ * Returns result of a Hyperbolic Tangent operation. + * + * \par + * \a QUOT register returns the result of Hyperbolic Tangent operation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_TanhNB()\n\n\n + * + */ +__STATIC_INLINE XMC_MATH_Q0_11_t XMC_MATH_CORDIC_GetTanhResult(void) +{ + return ((XMC_MATH_Q0_11_t) MATH->QUOT); +} + +/** + * @return uint32_t + * + * \parDescription:
+ * Returns result of a Unsigned Division operation. + * + * \par + * \a QUOT register returns the result of Unsigned Division operation. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_UnsignedDivNB()\n\n\n + * + */ +__STATIC_INLINE uint32_t XMC_MATH_DIV_GetUnsignedDivResult(void) +{ + return ((uint32_t) MATH->QUOT); +} + +/** + * @return uint32_t + * + * \parDescription:
+ * Returns result of a Unsigned Modulo operation. + * + * \par + * \a RMD register returns the result of Unsigned Modulo operation. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_UnsignedModNB()\n\n\n + * + */ +__STATIC_INLINE uint32_t XMC_MATH_DIV_GetUnsignedModResult(void) +{ + return ((uint32_t) MATH->RMD); +} + +/** + * @return int32_t + * + * \parDescription:
+ * Returns result of a Signed Division operation. + * + * \par + * \a QUOT register returns the result of Signed Division operation. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_SignedDivNB()\n\n\n + * + */ +__STATIC_INLINE int32_t XMC_MATH_DIV_GetSignedDivResult(void) +{ + return ((int32_t) MATH->QUOT); +} + +/** + * @return int32_t + * + * \parDescription:
+ * Returns result of a Signed Modulo operation. + * + * \par + * \a RMD register returns the result of Signed Modulo operation. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_SignedModNB()\n\n\n + * + */ +__STATIC_INLINE int32_t XMC_MATH_DIV_GetSignedModResult(void) +{ + return ((int32_t) MATH->RMD); +} + +/*********************************************************************************************************************** + * API Prototypes - Blocking functions + **********************************************************************************************************************/ +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return XMC_MATH_Q0_23_t
+ * + * \parDescription:
+ * Computes the cosine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * + * \par + * This function programs CORDIC to rotation & circular mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. + * Most significant 24 bits of \a CORRX register returns the result of the operation. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_Sin(), XMC_MATH_CORDIC_Tan()\n\n\n + * + */ +XMC_MATH_Q0_23_t XMC_MATH_CORDIC_Cos(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return XMC_MATH_Q0_23_t
+ * + * \parDescription:
+ * Computes the sine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * + * \par + * This function programs CORDIC to rotation & circular mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. + * Most significant 24 bits of \a CORRY register returns the result of the operation. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_Cos(), XMC_MATH_CORDIC_Tan()\n\n\n + * + */ +XMC_MATH_Q0_23_t XMC_MATH_CORDIC_Sin(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return XMC_MATH_Q0_11_t
+ * + * \parDescription:
+ * Computes the tangent for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * + * \par + * This function programs CORDIC to rotation & circular mode. + * Chains the results of Cosine (\a CORRX) and Sine (\a CORRY) as a dividend and divisor by configuring \a GLBCON register. + * \a CORDZ register is programmed with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. + * Most significant 24 bits of \a CORRY register returns the result of the operation. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_Sin(), XMC_MATH_CORDIC_Cos()\n\n\n + * + */ +XMC_MATH_Q0_11_t XMC_MATH_CORDIC_Tan(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * + * @param x Value representing the proportion of the x-coordinate (XMC_MATH_Q8_15_t format) + * @param y Value representing the proportion of the y-coordinate (XMC_MATH_Q8_15_t format) + * + * @return XMC_MATH_Q0_23_t
+ * + * \parDescription:
+ * Computes the principal value arc tangent of an angle of y/x expressed in radians. + * The input radians must be in XMC_MATH_Q8_15_t format. + * + * \par + * This function programs CORDIC as circular mode. + * \a CORDY register is programmed with input \a y and \a CORDX register is programmed with input \a x. + * Most significant 24 bits of \a CORRZ register returns the result of the operation. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + */ +XMC_MATH_Q0_23_t XMC_MATH_CORDIC_ArcTan(XMC_MATH_Q8_15_t x, XMC_MATH_Q8_15_t y); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return XMC_MATH_Q1_22_t
+ * + * \parDescription:
+ * Computes the hyperbolic cosine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * + * \par + * This function programs CORDIC to rotation & hyperbolic mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. + * Most significant 24 bits of \a CORRX register returns the result of the operation. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_Sinh(), XMC_MATH_CORDIC_Tanh()\n\n\n + * + */ +XMC_MATH_Q1_22_t XMC_MATH_CORDIC_Cosh(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return XMC_MATH_Q1_22_t
+ * + * \parDescription:
+ * Computes the hyperbolic sine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * + * \par + * This function programs CORDIC to rotation & hyperbolic mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. + * Most significant 24 bits of \a CORRY register returns the result of the operation. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_Cosh(), XMC_MATH_CORDIC_Tanh()\n\n\n + * + */ +XMC_MATH_Q1_22_t XMC_MATH_CORDIC_Sinh(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return XMC_MATH_Q0_11_t
+ * + * \parDescription:
+ * Computes the hyperbolic tangent for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * + * \par + * This function programs CORDIC to rotation & hyperbolic mode. + * Chains the results of Cosine (\a CORRX) and Sine (\a CORRY) as a dividend and divisor by configuring \a GLBCON register. + * \a CORDZ register is programmed with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. + * \a QUOT register returns the result of the operation. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_Sinh(), XMC_MATH_CORDIC_Cosh()()\n\n\n + * + */ +XMC_MATH_Q0_11_t XMC_MATH_CORDIC_Tanh(XMC_MATH_Q0_23_t angle_in_radians); + +/*********************************************************************************************************************** + * API Prototypes - Non blocking functions + **********************************************************************************************************************/ +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return None
+ * + * \parDescription:
+ * Computes the cosine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * Call XMC_MATH_CORDIC_GetCosResult() API to get the result. + * + * \par + * This function programs CORDIC to rotation & circular mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_GetCosResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_CORDIC_CosNB(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return None
+ * + * \parDescription:
+ * Computes the sine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * Call XMC_MATH_CORDIC_GetSinResult() API to get the result. + * + * \par + * This function programs CORDIC to rotation & circular mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_GetSinResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_CORDIC_SinNB(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return None
+ * + * \parDescription:
+ * Computes the tangent for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * Call XMC_MATH_CORDIC_GetTanResult() API to get the result. + * + * \par + * This function programs CORDIC to rotation & circular mode. + * Chains the results of Cosine (\a CORRX) and Sine (\a CORRY) as a dividend and divisor by configuring \a GLBCON register. + * \a CORDZ register is programmed with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_GetTanResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_CORDIC_TanNB(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * + * @param x Value representing the proportion of the x-coordinate (XMC_MATH_Q8_15_t format) + * @param y Value representing the proportion of the y-coordinate (XMC_MATH_Q8_15_t format) + * + * @return None
+ * + * \parDescription:
+ * Computes the principal value arc tangent of an angle of y/x expressed in radians. + * The input radians must be in XMC_MATH_Q8_15_t format. + * Call XMC_MATH_CORDIC_GetArcTanResult() API to get the result. + * + * \par + * This function programs CORDIC as circular mode. + * \a CORDY register is programmed with input \a y and \a CORDX register is programmed with input \a x. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_GetArcTanResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_CORDIC_ArcTanNB(XMC_MATH_Q8_15_t x, XMC_MATH_Q8_15_t y); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return None
+ * + * \parDescription:
+ * Computes the hyperbolic cosine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * Call XMC_MATH_CORDIC_GetCoshResult() API to get the result. + * + * \par + * This function programs CORDIC to rotation & hyperbolic mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_GetCoshResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_CORDIC_CoshNB(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return None
+ * + * \parDescription:
+ * Computes the hyperbolic sine for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * Call XMC_MATH_CORDIC_GetSinhResult() API to get the result. + * + * \par + * This function programs CORDIC to rotation & hyperbolic mode. + * Configures \a CORDZ register with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_GetSinhResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_CORDIC_SinhNB(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param angle_in_radians - Normalised Angle in Radians (XMC_MATH_Q0_23_t format) + * + * @return None
+ * + * \parDescription:
+ * Computes the hyperbolic tangent for an angle in radians \e angle_in_radians. + * The input angle in radians must be in XMC_MATH_Q0_23_t format. + * Call XMC_MATH_CORDIC_GetTanhResult() API to get the result. + * + * \par + * This function programs CORDIC to rotation & hyperbolic mode. + * Chains the results of Cosine (\a CORRX) and Sine (\a CORRY) as a dividend and divisor by configuring \a GLBCON register. + * \a CORDZ register is programmed with input \a angle_in_radians and \a CORDX register with gain \a XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22. + * + * \parNote:
+ * Loading of \a CORDX register triggers the start of computation. + * + * \parRelated APIs:
+ * XMC_MATH_CORDIC_GetTanhResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_CORDIC_TanhNB(XMC_MATH_Q0_23_t angle_in_radians); + +/** + * @param dividend - Dividend + * @param divisor - Divisor + * + * @return None
+ * + * \parDescription:
+ * Performs unsigned integer division and computes quotient of the division. + * Call XMC_MATH_DIV_GetUnsignedDivResult() API to get the result. + * + * \par + * Divider unit is configured for unsigned division. + * \a DVD & \a DVS registers are programmed with \a dividend and \a divisor values. + * The division is started with the write to DVS register. + * + * \parNote:
+ * Ensure \e divisor is smaller than \e dividend. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_GetUnsignedDivResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_DIV_UnsignedDivNB(uint32_t dividend, uint32_t divisor); + +/** + * @param dividend - Dividend + * @param divisor - Divisor + * + * @return None
+ * + * \parDescription:
+ * Performs signed integer division and computes quotient of the division. + * Call XMC_MATH_DIV_GetSignedDivResult() API to get the result. + * + * \par + * Divider unit is configured for signed division. + * \a DVD & \a DVS registers are programmed with \a dividend and \a divisor values. + * The division is started with the write to DVS register. + * + * \parNote:
+ * Ensure \e divisor is smaller than \e dividend. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_GetSignedDivResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_DIV_SignedDivNB(int32_t dividend, int32_t divisor); + +/** + * @param dividend - Dividend + * @param divisor - Divisor + * + * @return None
+ * + * \parDescription:
+ * Performs unsigned modulo operation and computes remainder of the division. + * Call XMC_MATH_DIV_GetUnsignedModResult() API to get the result. + * + * \par + * Divider unit is configured for unsigned division. + * \a DVD & \a DVS registers are programmed with \a dividend and \a divisor values. + * The division is started with the write to DVS register. + * + * \parNote:
+ * Ensure \e divisor is smaller than \e dividend. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_GetUnsignedModResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_DIV_UnsignedModNB(uint32_t dividend, uint32_t divisor); + +/** + * @param dividend - Dividend + * @param divisor - Divisor + * + * @return None
+ * + * \parDescription:
+ * Performs signed modulo operation and computes remainder of the division. + * Call XMC_MATH_DIV_GetSignedModResult() API to get the result. + * + * \par + * Divider unit is configured for signed division. + * \a DVD & \a DVS registers are programmed with \a dividend and \a divisor values. + * The division is started with the write to DVS register. + * + * \parNote:
+ * Ensure \e divisor is smaller than \e dividend. + * + * \parRelated APIs:
+ * XMC_MATH_DIV_GetSignedModResult(), XMC_MATH_EnableEvent(), XMC_MATH_GetEventStatus(), XMC_MATH_ClearEvent()\n\n\n + * + */ +void XMC_MATH_DIV_SignedModNB(int32_t dividend, int32_t divisor); + +/** + * @param x - Value whose square root is computed + * + * @return Square root of x
+ * + * \parDescription:
+ * Computes square root of Q15 number + * + * \parNote:
+ * x > 0 + * + */ +int16_t XMC_MATH_CORDIC_Q15_Sqrt(int16_t x); + +/** + * @param x - Value whose square root is computed + * + * @return Square root of x
+ * + * \parDescription:
+ * Computes square root of Q31 number + * + * \parNote:
+ * x > 0 + * + */ +int32_t XMC_MATH_CORDIC_Q31_Sqrt(int32_t x); +/** + * @} + */ + +/** + * @} + */ + +#endif /* end of #if defined(MATH) */ + +#ifdef __cplusplus +} +#endif + +#endif /* XMC_MATH_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_pau.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_pau.h new file mode 100644 index 00000000..446a5b5a --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_pau.h @@ -0,0 +1,396 @@ +/** + * @file xmc_pau.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial version + * + * 2015-05-20: + * - Documentation updated + * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * @endcond + * + */ + +#ifndef XMC_PAU_H +#define XMC_PAU_H + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ + +#include "xmc_common.h" + +#if defined(PAU) + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup PAU + * @brief Peripheral Access Unit (PAU) driver for the XMC1000 microcontroller family + * + * The Peripheral Access Unit (PAU) supports access control of memories and peripherals. + * It allows user application to enable/disable the access to the registers of a peripheral. + * It generates a HardFault exception when there is an access to a disabled or unassigned + * address location. It also provides information on the availability of peripherals and + * sizes of memories. + * + * The PAU low level driver provides functions to check the availability of peripherals + * and to enable/disable peripheral access. + * @{ + */ + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ + +/** + * A convenient symbol for the PAU peripheral base address + */ +#define XMC_PAU ((XMC_PAU_t *) PAU_BASE) + +/* + * This macro is used in the LLD for assertion checks (XMC_ASSERT) + */ +#define XMC_PAU_CHECK_MODULE_PTR(p) ((p) == XMC_PAU) + +/********************************************************************************************************************* + * ENUMS + *********************************************************************************************************************/ + +/** + * Status return values for PAU low level driver + */ +typedef enum XMC_PAU_STATUS +{ + XMC_PAU_STATUS_OK = 0U, /**< Operation successful */ + XMC_PAU_STATUS_BUSY = 1U, /**< Busy with a previous request */ + XMC_PAU_STATUS_ERROR = 2U /**< Operation unsuccessful */ +} XMC_PAU_STATUS_t; + +/** + * PAU peripheral select + */ +typedef enum XMC_PAU_PERIPHERAL +{ + XMC_PAU_PERIPHERAL_FLASH = PAU_PRIVDIS0_PDIS2_Msk, /**< Flash SFRs Privilege Disable Flag */ + XMC_PAU_PERIPHERAL_RAM_BLOCK1 = PAU_PRIVDIS0_PDIS5_Msk, /**< RAM Block 1 Privilege Disable Flag */ + XMC_PAU_PERIPHERAL_RAM_BLOCK2 = PAU_PRIVDIS0_PDIS6_Msk, /**< RAM Block 2 Privilege Disable Flag */ + XMC_PAU_PERIPHERAL_RAM_BLOCK3 = PAU_PRIVDIS0_PDIS7_Msk, /**< RAM Block 3 Privilege Disable Flag */ + #if defined(WDT) + XMC_PAU_PERIPHERAL_WDT = PAU_PRIVDIS0_PDIS19_Msk, /**< WDT Privilege Disable Flag */ + #endif + #if defined(MATH) + XMC_PAU_PERIPHERAL_MATH_GLOBAL_AND_DIV = PAU_PRIVDIS0_PDIS20_Msk, /**< MATH Global SFRs and Divider Privilege Disable Flag */ + #endif + #if defined(MATH) + XMC_PAU_PERIPHERAL_MATH_CORDIC = PAU_PRIVDIS0_PDIS21_Msk, /**< MATH CORDIC Privilege Disable Flag */ + #endif + #if defined(PORT0) + XMC_PAU_PERIPHERAL_PORT0 = PAU_PRIVDIS0_PDIS22_Msk, /**< Port 0 Privilege Disable Flag */ + #endif + #if defined(PORT1) + XMC_PAU_PERIPHERAL_PORT1 = PAU_PRIVDIS0_PDIS23_Msk, /**< Port 1 Privilege Disable Flag */ + #endif + #if defined(PORT2) + XMC_PAU_PERIPHERAL_PORT2 = PAU_PRIVDIS0_PDIS24_Msk, /**< Port 2 Privilege Disable Flag */ +#endif +#if defined(PORT3) + XMC_PAU_PERIPHERAL_PORT3 = PAU_PRIVDIS0_PDIS25_Msk, /**< Port 3 Privilege Disable Flag */ +#endif +#if defined(PORT4) + XMC_PAU_PERIPHERAL_PORT4 = PAU_PRIVDIS0_PDIS26_Msk, /**< Port 4 Privilege Disable Flag */ +#endif +#if defined(USIC0) + XMC_PAU_PERIPHERAL_USIC0_CH0 = PAU_PRIVDIS1_PDIS0_Msk | 0x10000000U, /**< USIC0 Channel 0 Privilege Disable Flag */ + XMC_PAU_PERIPHERAL_USIC0_CH1 = PAU_PRIVDIS1_PDIS1_Msk | 0x10000000U, /**< USIC0 Channel 1 Privilege Disable Flag */ +#endif +#if defined(USIC1) + XMC_PAU_PERIPHERAL_USIC1_CH0 = PAU_PRIVDIS1_PDIS16_Msk | 0x10000000U, /**< USIC1 Channel 0 Privilege Disable Flag */ + XMC_PAU_PERIPHERAL_USIC1_CH1 = PAU_PRIVDIS1_PDIS17_Msk | 0x10000000U, /**< USIC1 Channel 1 Privilege Disable Flag */ +#endif +#if defined(PRNG) + XMC_PAU_PERIPHERAL_PRNG = PAU_AVAIL1_AVAIL4_Msk | 0x10000000U, /**< PRNG Availability Flag*/ +#endif +#if defined(VADC) + XMC_PAU_PERIPHERAL_VADC_GLOBAL = PAU_PRIVDIS1_PDIS5_Msk | 0x10000000U, /**< VADC0 Basic SFRs Privilege Disable Flag */ +#if defined(VADC_G0) + XMC_PAU_PERIPHERAL_VADC_GROUP0 = PAU_PRIVDIS1_PDIS6_Msk | 0x10000000U, /**< VADC0 Group 0 SFRs Privilege Disable Flag */ +#endif +#if defined(VADC_G1) + XMC_PAU_PERIPHERAL_VADC_GROUP1 = PAU_PRIVDIS1_PDIS7_Msk | 0x10000000U, /**< VADC0 Group 1 SFRs Privilege Disable Flag */ +#endif +#endif +#if defined(SHS0) + XMC_PAU_PERIPHERAL_VADC_SHS0 = PAU_PRIVDIS1_PDIS8_Msk | 0x10000000U, /**< SHS0 Privilege Disable Flag */ +#endif +#if defined(CCU40) + XMC_PAU_PERIPHERAL_CCU40_CC40_AND_GLOBAL = PAU_PRIVDIS1_PDIS9_Msk | 0x10000000U, /**< CCU40_CC40 and CCU40 Kernel SFRs Privilege Disable Flag */ +#if defined(CCU40_CC41) + XMC_PAU_PERIPHERAL_CCU40_CC41 = PAU_PRIVDIS1_PDIS10_Msk | 0x10000000U, /**< CCU40_CC41 Privilege Disable Flag */ +#endif +#if defined(CCU40_CC42) + XMC_PAU_PERIPHERAL_CCU40_CC42 = PAU_PRIVDIS1_PDIS11_Msk | 0x10000000U, /**< CCU40_CC42 Privilege Disable Flag */ +#endif +#if defined(CCU40_CC43) + XMC_PAU_PERIPHERAL_CCU40_CC43 = PAU_PRIVDIS1_PDIS12_Msk | 0x10000000U, /**< CCU40_CC43 Privilege Disable Flag */ +#endif +#endif +#if defined(CCU41) + XMC_PAU_PERIPHERAL_CCU41_CC40_AND_GLOBAL = PAU_PRIVDIS1_PDIS25_Msk | 0x10000000U, /**< CCU41_CC40 and CCU41 Kernel SFRs Privilege Disable Flag */ +#if defined(CCU41_CC41) + XMC_PAU_PERIPHERAL_CCU41_CC41 = PAU_PRIVDIS1_PDIS26_Msk | 0x10000000U, /**< CCU41_CC41 Privilege Disable Flag */ +#endif +#if defined(CCU41_CC42) + XMC_PAU_PERIPHERAL_CCU41_CC42 = PAU_PRIVDIS1_PDIS27_Msk | 0x10000000U, /**< CCU41_CC42 Privilege Disable Flag */ +#endif +#if defined(CCU41_CC43) + XMC_PAU_PERIPHERAL_CCU41_CC43 = PAU_PRIVDIS1_PDIS28_Msk | 0x10000000U, /**< CCU41_CC43 Privilege Disable Flag */ +#endif +#endif +#if defined(CCU80) + XMC_PAU_PERIPHERAL_CCU80_CC80_AND_GLOBAL = PAU_PRIVDIS2_PDIS0_Msk | 0x20000000U, /**< CCU80_CC80 and CCU80 Kernel SFRs Privilege Disable Flag */ +#if defined(CCU80_CC81) + XMC_PAU_PERIPHERAL_CCU80_CC81 = PAU_PRIVDIS2_PDIS1_Msk | 0x20000000U, /**< CCU80_CC81 Privilege Disable Flag */ +#endif +#if defined(CCU80_CC82) + XMC_PAU_PERIPHERAL_CCU80_CC82 = PAU_PRIVDIS2_PDIS2_Msk | 0x20000000U, /**< CCU80_CC82 Privilege Disable Flag */ +#endif +#if defined(CCU80_CC83) + XMC_PAU_PERIPHERAL_CCU80_CC83 = PAU_PRIVDIS2_PDIS3_Msk | 0x20000000U, /**< CCU80_CC83 Privilege Disable Flag */ +#endif +#endif +#if defined(CCU81) + XMC_PAU_PERIPHERAL_CCU81_CC80_AND_GLOBAL = PAU_PRIVDIS2_PDIS16_Msk | 0x20000000U, /**< CCU81_CC80 and CCU81 Kernel SFRs Privilege Disable Flag */ +#if defined(CCU81_CC81) + XMC_PAU_PERIPHERAL_CCU81_CC81 = PAU_PRIVDIS2_PDIS17_Msk | 0x20000000U, /**< CCU81_CC81 Privilege Disable Flag */ +#endif +#if defined(CCU81_CC82) + XMC_PAU_PERIPHERAL_CCU81_CC82 = PAU_PRIVDIS2_PDIS18_Msk | 0x20000000U, /**< CCU81_CC82 Privilege Disable Flag */ +#endif +#if defined(CCU81_CC83) + XMC_PAU_PERIPHERAL_CCU81_CC83 = PAU_PRIVDIS2_PDIS19_Msk | 0x20000000U, /**< CCU81_CC83 Privilege Disable Flag */ +#endif +#endif +#if defined(POSIF0) + XMC_PAU_PERIPHERAL_POSIF0 = PAU_PRIVDIS2_PDIS12_Msk | 0x20000000U, /**< POSIF0 Privilege Disable Flag */ +#endif +#if defined(POSIF1) + XMC_PAU_PERIPHERAL_POSIF1 = PAU_PRIVDIS2_PDIS28_Msk | 0x20000000U, /**< POSIF1 Privilege Disable Flag */ +#endif +#if defined(LEDTS0) + XMC_PAU_PERIPHERAL_LEDTS0 = PAU_PRIVDIS2_PDIS13_Msk | 0x20000000U, /**< LEDTS0 Privilege Disable Flag */ +#endif +#if defined(LEDTS1) + XMC_PAU_PERIPHERAL_LEDTS1 = PAU_PRIVDIS2_PDIS14_Msk | 0x20000000U, /**< LEDTS1 Privilege Disable Flag */ +#endif +#if defined(LEDTS2) + XMC_PAU_PERIPHERAL_LEDTS2 = PAU_PRIVDIS2_PDIS29_Msk | 0x20000000U, /**< LEDTS2 Privilege Disable Flag */ +#endif +#if defined(BCCU0) + XMC_PAU_PERIPHERAL_BCCU0 = PAU_PRIVDIS2_PDIS15_Msk | 0x20000000U, /**< BCCU0 Privilege Disable Flag */ +#endif +#if defined(CAN) +#if defined(CAN_NODE0) + XMC_PAU_PERIPHERAL_MCAN_NODE0_AND_GLOBAL = PAU_PRIVDIS2_PDIS21_Msk | 0x20000000U, /**< MCAN NODE0 and Global SFRs Privilege */ +#endif +#if defined(CAN_NODE1) + XMC_PAU_PERIPHERAL_MCAN_NODE1_AND_GLOBAL = PAU_PRIVDIS2_PDIS23_Msk | 0x20000000U, /**< MCAN NODE1 Privilege Disable Flag */ +#endif + XMC_PAU_PERIPHERAL_MCAN_OBJECTS = PAU_PRIVDIS2_PDIS28_Msk | 0x20000000U, /**< MCAN Message Objects Privilege Disable Flag */ +#endif +} XMC_PAU_PERIPHERAL_t; + + +/********************************************************************************************************************* + * DATA STRUCTURES + *********************************************************************************************************************/ + + +/** + * External Peripheral Access Unit (PAU) device structure
+ * + * The structure represents a collection of all hardware registers + * used to configure the PAU peripheral on the XMC microcontroller. + * The registers can be accessed with ::XMC_PAU. + */ +typedef struct +{ + __I uint32_t RESERVED0[16]; + __I uint32_t AVAIL[3]; + __I uint32_t RESERVED1[13]; + __IO uint32_t PRIVDIS[3]; + __I uint32_t RESERVED2[221]; + __I uint32_t ROMSIZE; + __I uint32_t FLSIZE; + __I uint32_t RESERVED3[2]; + __I uint32_t RAM0SIZE; +} XMC_PAU_t; + +/********************************************************************************************************************* + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param peripheral Peripheral of type ::XMC_PAU_PERIPHERAL_t for which access needs to be enabled + * @return None + * + * \parDescription:
+ * Enable the peripheral access
+ * + * \par + * The function resets the PRIVDISx.PDISy bit to enable the access to the registers of a peripheral + * during run time. + * + * \parRelated APIs:
+ * XMC_PAU_DisablePeripheralAccess() + */ +void XMC_PAU_EnablePeripheralAccess(XMC_PAU_PERIPHERAL_t peripheral); + +/** + * @param peripheral Peripheral of type ::XMC_PAU_PERIPHERAL_t for which access needs to be disabled + * @return None + * + * \parDescription:
+ * Disable the peripheral access
+ * + * \par + * The function sets the PRIVDISx.PDISy bit to disable the access to the registers of a peripheral + * during run time. An access to a disabled or unassigned address location generates a hardfault + * exception. + * + * \parRelated APIs:
+ * XMC_PAU_EnablePeripheralAccess() + */ +void XMC_PAU_DisablePeripheralAccess(XMC_PAU_PERIPHERAL_t peripheral); + +/** + * @param peripheral Peripheral of type ::XMC_PAU_PERIPHERAL_t for which access enabled status to be checked + * @return bool "false" if peripheral access is enabled, "true" otherwise + * + * \parDescription:
+ * Checks if the peripheral access is enabled or not
+ * + * \par + * The function checks the PRIVDISx.PDISy bit to know whether the access to the registers of a peripheral + * during run time is enabled or not. + * + * \parRelated APIs:
+ * XMC_PAU_DisablePeripheralAccess(), XMC_PAU_EnablePeripheralAccess() + */ +bool XMC_PAU_IsPeripheralAccessEnabled(XMC_PAU_PERIPHERAL_t peripheral); + +/** + * @param peripheral Peripheral of type ::XMC_PAU_PERIPHERAL_t for which access needs to be disabled + * @return bool Returns "true" if peripheral is available, "false" otherwise + * + * \parDescription:
+ * Checks if a peripheral is available or not
+ * + * \par + * The function checks the AVAILx.AVAILy bit to know whether the peripheral + * is available or not for the particular device variant. + */ +bool XMC_PAU_IsPeripheralAvailable(XMC_PAU_PERIPHERAL_t peripheral); + +/** + * @return uint32_t Returns ROM size + * + * \parDescription:
+ * Gets the ROM size
+ * + * \par + * The function checks the ROMSIZE.ADDR bitfield to indicate the available size of ROM in the device in bytes. + */ +__STATIC_INLINE uint32_t XMC_PAU_GetROMSize(void) +{ + return (uint32_t)(((XMC_PAU->ROMSIZE & PAU_ROMSIZE_ADDR_Msk) >> PAU_ROMSIZE_ADDR_Pos) * 256U); +} + +/** + * @return uint32_t Returns flash size + * + * \parDescription:
+ * Gets the flash size
+ * + * \par + * The function checks the FLSIZE.ADDR bitfield to indicate the available size of FLASH in the device in Kbytes. + */ +__STATIC_INLINE uint32_t XMC_PAU_GetFlashSize(void) +{ + return (uint32_t)((((XMC_PAU->FLSIZE & PAU_FLSIZE_ADDR_Msk) >> PAU_FLSIZE_ADDR_Pos) - 1U) * 4U); +} + +/** + * @return uint32_t Returns RAM size + * + * \parDescription:
+ * Gets RAM size
+ * + * \par + * The function checks the RAM0SIZE.ADDR bitfield to indicate the available size of RAM in the device in bytes. + */ +__STATIC_INLINE uint32_t XMC_PAU_GetRAMSize(void) +{ + return (uint32_t)(((XMC_PAU->RAM0SIZE & PAU_RAM0SIZE_ADDR_Msk) >> PAU_RAM0SIZE_ADDR_Pos) * 256U); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* defined(PAU) */ + +#endif /* XMC_PAU_H */ + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_posif.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_posif.h new file mode 100644 index 00000000..2cbab878 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_posif.h @@ -0,0 +1,1046 @@ +/** + * @file xmc_posif.h + * @date 2016-03-09 + * + * @cond + ********************************************************************************** + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification,are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share + * modifications, enhancements or bug fixes with Infineon Technologies AG + * dave@infineon.com). + ********************************************************************************** + * + * Change History + * -------------- + * + * 2015-02-18: + * - Initial version + * + * 2015-02-20: + * - Driver description added
+ * + * 2015-06-19: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-07-02: + * - Updated XMC_POSIF_QD_GetDirection API + * + * 2016-03-09: + * - Optimization of write only registers + * + * @endcond + * + */ + + +#ifndef XMC_POSIF_H +#define XMC_POSIF_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +#if defined(POSIF0) +#include + +/** + * @addtogroup XMClib + * @{ + */ + +/** + * @addtogroup POSIF + * @{ + * @brief Position Interface Unit (POSIF) driver for the XMC microcontroller family
+ * + * The POSIF unit is a flexible and powerful component for motor control systems that use + * rotary encoders or hall sensors as feedback loop. It provides interface for motor position and velocity measurement. + * POSIF unit works with CCU4 and CCU8 to enable position and velocity measurement and to control PWM outputs using multi channel pattern.
+ * + * Driver is divided in three POSIF functional blocks - Hall Sensor Control (POSIF_HSC), Quadrature Decoder (POSIF_QD) and + * MultiChannel Mode (POSIF_MCM).
+ * + * POSIF driver features: + * -# Configuration structure XMC_POSIF_CONFIG_t and initialization function XMC_POSIF_Init() to configure global settings + * -# Allows to change the operating mode using XMC_POSIF_SetMode() + * -# Allows the selection of one of the four inputs (A, B, C or D) using XMC_POSIF_SelectInputSource(). In hall sensor control, inputs are + * hall0, hall1 and hall2 signals. For quadrature decoder mode, inputs are phase A, phase B and index signals. + * -# Hall Sensor Control (APIs prefixed with XMC_POSIF_HSC_)
+ * - Configuration structure XMC_POSIF_HSC_CONFIG_t and initialization function XMC_POSIF_HSC_Init() + * - Update current and expected hall pattern in shadow register using XMC_POSIF_HSC_SetHallPatterns() + * - Allows immediate shadow transfer using XMC_POSIF_HSC_UpdateHallPattern() + * -# Quadrature Decoder (APIs prefixed with XMC_POSIF_QD_)
+ * - Configuration structure XMC_POSIF_QD_CONFIG_t and initialization function XMC_POSIF_QD_Init() + * - Get direction of rotation using XMC_POSIF_QD_GetDirection() + * -# MultiChannel Mode (APIs prefixed with XMC_POSIF_MCM_)
+ * - Configuration structure XMC_POSIF_MCM_CONFIG_t and initialization function XMC_POSIF_MCM_Init() + * - Update multichannel pattern in shadow register using XMC_POSIF_MCM_SetMultiChannelPattern() + * - Allows immediate shadow transfer using XMC_POSIF_MCM_UpdateMultiChannelPattern() + * -# User need to call respective init functions to configure POSIF operating mode. e.g to configure POSIF in hall sensor control with multichannel mode + * call both XMC_POSIF_HSC_Init() and XMC_POSIF_MCM_Init(). + * -# Allows to enable and disable interrupt sources and assign to service request node using XMC_POSIF_EnableEvent(), XMC_POSIF_DisableEvent() and XMC_POSIF_SetInterruptNode() + + */ +/* POSIF is not available on XMC11 and XMC12 devices */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_POSIF_PCONF_INSEL_Msk (0x3fUL << POSIF_PCONF_INSEL0_Pos) /*< Mask for input pins selection */ +#define XMC_POSIF_INSEL_MAX (4U) /*< Maximum possible input selector */ +#define XMC_POSIF_HALPS_HALLPAT_Msk (0x3FUL) + +#if ((UC_SERIES == XMC45) || (UC_SERIES == XMC44) || (UC_SERIES == XMC47) || (UC_SERIES == XMC48) || (UC_SERIES == XMC14)) +#define XMC_POSIF_CHECK_MODULE_PTR(PTR) ( ((PTR)== POSIF0) || ((PTR)== POSIF1) ) /*< Check for valid module pointer */ +#else +#define XMC_POSIF_CHECK_MODULE_PTR(PTR) ( ((PTR)== POSIF0)) /*< Check for valid module pointer */ +#endif + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +/** + * Defines the return status, to verify the POSIF related API calls. Use type @ref XMC_POSIF_STATUS_t for this enum. + */ +typedef enum XMC_POSIF_STATUS +{ + XMC_POSIF_STATUS_OK = 0U, /**< API fulfills request */ + XMC_POSIF_STATUS_ERROR /**< API cannot fulfill request */ +} XMC_POSIF_STATUS_t; + +/** + * Defines POSIF configurable modes.Use type @ref XMC_POSIF_MODE_t for this enum. + * The members defines the function selector(FSEL) bitfields of \a PCONF register. + */ +typedef enum XMC_POSIF_MODE +{ + XMC_POSIF_MODE_HALL_SENSOR = 0U, /**< Hall sensor mode */ + XMC_POSIF_MODE_QD , /**< Quadrature Decoder mode */ + XMC_POSIF_MODE_MCM , /**< Standalone Multichannel mode */ + XMC_POSIF_MODE_MCM_QD /**< Quadrature Decoder + Standalone Multichannel mode */ +} XMC_POSIF_MODE_t; + +/** + * Defines POSIF configurable input ports.Use type @ref XMC_POSIF_INPUT_PORT_t for this enum. + * The member defines the respective input selector(INSELX) bitfields of \a PCONF register. + * It selects, which input is used for the phase or Hall input function (depending on the module is set for + * Quadrature Decoder or Hall Sensor Mode). Same enum can be used to configure pattern update signal select by configuring + * \a PCONF register's \a MSETS bit field. + */ +typedef enum XMC_POSIF_INPUT_PORT +{ + XMC_POSIF_INPUT_PORT_A = 0U, /**< INPUT-A */ + XMC_POSIF_INPUT_PORT_B , /**< INPUT-B */ + XMC_POSIF_INPUT_PORT_C , /**< INPUT-C */ + XMC_POSIF_INPUT_PORT_D , /**< INPUT-D */ + XMC_POSIF_INPUT_PORT_E , /**< INPUT-E */ + XMC_POSIF_INPUT_PORT_F , /**< INPUT-F */ + XMC_POSIF_INPUT_PORT_G , /**< INPUT-G */ + XMC_POSIF_INPUT_PORT_H /**< INPUT-H */ +} XMC_POSIF_INPUT_PORT_t; + +/** + * Defines active level of an input signal.Use type @ref XMC_POSIF_INPUT_ACTIVE_LEVEL_t for this enum. + */ +typedef enum XMC_POSIF_INPUT_ACTIVE_LEVEL +{ + XMC_POSIF_INPUT_ACTIVE_LEVEL_HIGH = 0U, /**< Input - Active High */ + XMC_POSIF_INPUT_ACTIVE_LEVEL_LOW /**< Input - Active Low */ +} XMC_POSIF_INPUT_ACTIVE_LEVEL_t; + +/** + * Defines POSIF input debounce filter configuration.POSIF inputs are connected to low pass filter and + * this enum is used to configure low pass filters cut off frequency. + * Use type @ref XMC_POSIF_FILTER_t for this enum. + * The member defines the low pass filter configuration(LPC) bitfield of \a PCONF register. + */ +typedef enum XMC_POSIF_FILTER +{ + XMC_POSIF_FILTER_DISABLED = 0U, /**< No filtering */ + XMC_POSIF_FILTER_1_CLOCK_CYCLE , /**< Filter of 1 Clock Cycle */ + XMC_POSIF_FILTER_2_CLOCK_CYCLE , /**< Filter of 2 Clock Cycles */ + XMC_POSIF_FILTER_4_CLOCK_CYCLE , /**< Filter of 4 Clock Cycles */ + XMC_POSIF_FILTER_8_CLOCK_CYCLE , /**< Filter of 8 Clock Cycles */ + XMC_POSIF_FILTER_16_CLOCK_CYCLE , /**< Filter of 16 Clock Cycles */ + XMC_POSIF_FILTER_32_CLOCK_CYCLE , /**< Filter of 32 Clock Cycles */ + XMC_POSIF_FILTER_64_CLOCK_CYCLE /**< Filter of 64 Clock Cycles */ +} XMC_POSIF_FILTER_t; + +/** + * Defines POSIF events.Use type @ref XMC_POSIF_IRQ_EVENT_t for this enum. + * The member defines available event sources.It is used to configure which event to be used for + * interrupt generation using \a PFLGE register. [ PFLG,SPFLG,RPFLG] + */ +typedef enum XMC_POSIF_IRQ_EVENT +{ + XMC_POSIF_IRQ_EVENT_CHE = 0U, /**< Hall Mode : Correct Hall Event */ + XMC_POSIF_IRQ_EVENT_WHE = 1U, /**< Hall Mode : Wrong Hall Event */ + XMC_POSIF_IRQ_EVENT_HALL_INPUT = 2U, /**< Hall Mode : Hall Input update */ + XMC_POSIF_IRQ_EVENT_MCP_SHADOW_TRANSFER = 4U, /**< Hall Mode + MCM Mode : MC Pattern shadow transfer */ + XMC_POSIF_IRQ_EVENT_INDX = 8U, /**< Quadrature Mode : Index event detection */ + XMC_POSIF_IRQ_EVENT_ERR = 9U, /**< Quadrature Mode : Quadrature Phase Error */ + XMC_POSIF_IRQ_EVENT_CNT = 10U, /**< Quadrature Mode : Quadrature Clock event */ + XMC_POSIF_IRQ_EVENT_DIR = 11U, /**< Quadrature Mode : Quadrature Direction change event */ + XMC_POSIF_IRQ_EVENT_PCLK = 12U /**< Quadrature Mode : Quadrature period clock generation event */ +} XMC_POSIF_IRQ_EVENT_t; + +/** + * Defines POSIF service request lines.Use type @ref XMC_POSIF_SR_ID_t for this enum. + * It used to connect POSIF event to required service request line. + * in \a PFLGE register for interrupt generation. + */ +typedef enum XMC_POSIF_SR_ID +{ + XMC_POSIF_SR_ID_0 = 0U, /**< SR-0 */ + XMC_POSIF_SR_ID_1 /**< SR-1 */ +} XMC_POSIF_SR_ID_t; + +/** + * Defines position decoder mode selection.Use type @ref XMC_POSIF_QD_MODE_t for this enum. + * The member defines configuration for the operation of the quadrature decoder mode. + * It used to configure \a QDC register. + */ +typedef enum XMC_POSIF_QD_MODE +{ + XMC_POSIF_QD_MODE_QUADRATURE = 0U, /**< Standard Quadrature Mode */ + XMC_POSIF_QD_MODE_DIRECTION_COUNT /**< Direction Count Mode */ +} XMC_POSIF_QD_MODE_t; + +/** + * Defines motor rotation direction.Use type @ref XMC_POSIF_QD_DIR_t for this enum. + * The member defines the direction in quadrature mode. + */ +typedef enum XMC_POSIF_QD_DIR +{ + XMC_POSIF_QD_DIR_COUNTERCLOCKWISE = 0U, /**< Counter Clockwise */ + XMC_POSIF_QD_DIR_CLOCKWISE /**< Clockwise */ +} XMC_POSIF_QD_DIR_t; + +/** + * Defines frequency of index signal generation.Use type @ref XMC_POSIF_QD_INDEX_GENERATION_t for this enum. + * Member represents available configuration for index marker generation using \a ICM bit field in \a QDC register. + */ +typedef enum XMC_POSIF_QD_INDEX_GENERATION +{ + XMC_POSIF_QD_INDEX_GENERATION_NEVER = 0U, /**< Never generate the index marker signal */ + XMC_POSIF_QD_INDEX_GENERATION_ONCE , /**< Generate only once after the first revolution */ + XMC_POSIF_QD_INDEX_GENERATION_ALWAYS /**< Index marker generated upon every revolution */ +} XMC_POSIF_QD_INDEX_GENERATION_t; + +/** + * Defines trigger edge in hall sensor mode.Use type @ref XMC_POSIF_HSC_TRIGGER_EDGE_t for this enum. + * It can be used to configure \a PCONF register's \a SPES and \a MSES bit fields. + */ +typedef enum XMC_POSIF_HSC_TRIGGER_EDGE +{ + XMC_POSIF_HSC_TRIGGER_EDGE_RISING = 0U, /**< Rising edge */ + XMC_POSIF_HSC_TRIGGER_EDGE_FALLING /**< Falling edge */ +} XMC_POSIF_HSC_TRIGGER_EDGE_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * + * Defines POSIF peripheral register structure.Use type @ref XMC_POSIF_t for this data structure. + */ +typedef POSIF_GLOBAL_TypeDef XMC_POSIF_t; + +/** + * Defines POSIF quadrature decoder initialization data structure. + * Use type @ref XMC_POSIF_QD_CONFIG_t for this data structure. + * It used to configure Quadrature mode using \a QDC register. + */ +typedef struct XMC_POSIF_QD_CONFIG +{ + XMC_POSIF_QD_MODE_t mode; /**< Operational Mode of the quadrature encoder and decoder */ + union + { + struct + { + uint32_t phase_a: 1; /**< Phase-A active level configuration */ + uint32_t phase_b: 1; /**< Phase-B active level configuration */ + uint32_t phase_leader: 1; /**< Which of the two phase signals[Phase A or Phase B] leads the other? */ + uint32_t : 1; + uint32_t index: 2; /**< Index signal generation control. Use @ref XMC_POSIF_QD_INDEX_GENERATION_t to configure this field.*/ + uint32_t : 26; + }; + uint32_t qdc; + }; +} XMC_POSIF_QD_CONFIG_t; + +/** + * Defines POSIF hall sensor control initialization data structure. + * Use type @ref XMC_POSIF_HSC_CONFIG_t for this data structure. + * It used to initialize hall sensor mode configuration using \a PCONF register. + */ +typedef struct XMC_POSIF_HSC_CONFIG +{ + union + { + struct + { + uint32_t : 4; + uint32_t disable_idle_signal: 1; /**< Should idle signal be disabled upon wrong hall event? */ + uint32_t : 11; + uint32_t sampling_trigger: 1; /**< Of HSDA and HSDB, which one is to be used to trigger POSIF to sample hall pattern? */ + uint32_t sampling_trigger_edge: 1; /**< Which edge of the sampling trigger signal is to be considered? */ + uint32_t : 6; + uint32_t external_error_port: 2; /**< Of the 4 external error ports, which one is to be considered? */ + uint32_t external_error_enable: 1; /**< Should external errors lead to Wrong Hall event? */ + uint32_t external_error_level: 1; /**< What should be the active level of external error signal? */ + uint32_t: 4; + }; + uint32_t hall_config; + }; +} XMC_POSIF_HSC_CONFIG_t; + +/** + * Defines POSIF multi-channel mode initialization data structure. + * Use type @ref XMC_POSIF_MCM_CONFIG_t for this data structure. + * It used to initialize multi channel mode configuration using \a PCONF register. + */ +typedef struct XMC_POSIF_MCM_CONFIG +{ + union + { + struct + { + uint32_t : 5; + uint32_t pattern_sw_update: 1; /**< should multi channel pattern updated by SW ? */ + uint32_t : 12; + uint32_t pattern_update_trigger: 3; /**< Of the 8 update triggers, which one is to be considered? */ + uint32_t pattern_trigger_edge: 1; /**< Which edge of the pattern update trigger is to be considered? */ + uint32_t pwm_sync: 2; /**< Of the 4 pwm sync inputs, which one is to be considered? */ + uint32_t : 8; + }; + uint32_t mcm_config; + }; +}XMC_POSIF_MCM_CONFIG_t; + +/** + * Defines POSIF module initialization data structure. + * Use type @ref XMC_POSIF_CONFIG_t for this data structure. + * It is used to initialize POSIF module using \a PCONF register. + */ +typedef struct XMC_POSIF_CONFIG +{ + union + { + struct + { + uint32_t mode: 2; /**< POSIF Operational mode. Use @ref XMC_POSIF_MODE_t to configure */ + uint32_t :6; + uint32_t input0: 2; /**< Choice of input for Input-1 */ + uint32_t input1: 2; /**< Choice of input for Input-2 */ + uint32_t input2: 2; /**< Choice of input for Input-3 */ + uint32_t :14; + uint32_t filter: 3; /**< Input filter configuration */ + uint32_t: 1; + }; + uint32_t pconf; + }; +} XMC_POSIF_CONFIG_t; + +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif + +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param peripheral Pointer to an instance of POSIF module of type @ref XMC_POSIF_t + * @retval None + * + * \parDescription
+ * De-asserts the POSIF module from reset and enables the clock.\n + * Configures \a PRCLR0 register's \a POSIF0RS or \a POSIF1RS bit field depends upon \a peripheral. + * If running on other than XMC45 device then it will ungate the peripheral clock. + * + * \parNote
+ * This is the first API which application must invoke to configure POSIF. + * It is internally called by XMC_POSIF_Init(). + * + * \parRelated APIs:
+ * XMC_POSIF_Disable(),XMC_POSIF_Init() \n\n\n + */ +void XMC_POSIF_Enable(XMC_POSIF_t *const peripheral); + +/** + * @param peripheral Pointer to an instance of POSIF module of type @ref XMC_POSIF_t + * @retval None + * + * \parDescription
+ * Asserts the POSIF module into reset and disables the clock.\n + * If running on other than XMC45 device then in addition it will gate the peripheral clock. + * Configures \a PRCLR0 register's \a POSIF0RS or \a POSIF1RS bitfield depends upon \a peripheral. + * + * \parRelated APIs:
+ * XMC_POSIF_Enable()\n\n\n + */ +void XMC_POSIF_Disable(XMC_POSIF_t *const peripheral); + +/** + * @param peripheral Pointer to an instance of POSIF module of type @ref XMC_POSIF_t + * @param config Pointer to POSIF configuration data(operation mode,input selection and filter configuration) + * @retval None + * + * \parDescription
+ * Initialize POSIF module with \a config.\n + * Configures POSIF global registers.This is the first API which application must invoke to configure POSIF. + * It sets up parameters common to all the POSIF modes - hall sensor,quadrature decoder and multi-channel modes of operation. + * Configures \a PCONF register with mode of operation,input selection and filter configuration. + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_Init(),XMC_POSIF_QD_Init(),XMC_POSIF_MCM_Init() \n\n\n +*/ +void XMC_POSIF_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_CONFIG_t * const config); + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param config Pointer to hall sensor control initialization data of type @ref XMC_POSIF_HSC_CONFIG_t + * @retval XMC_POSIF_STATUS_t Returns @ref XMC_POSIF_STATUS_OK if configured in Hall Sensor Mode + * else return @ref XMC_POSIF_STATUS_ERROR. + * + * \parDescription
+ * Initializes hall sensor control mode.\n + * Configures \a PCONF register with which POSIF input trigger to be used for + * sampling hall pattern.Configures \a PCONF register for idle signal generation for wrong hall event. + * + * \parNote
+ * It is necessary to have called XMC_POSIF_Init first with Hall sensor mode before invocation of this API. + * + * \parRelated APIs:
+ * XMC_POSIF_Init() \n\n\n + */ +XMC_POSIF_STATUS_t XMC_POSIF_HSC_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_HSC_CONFIG_t * const config); + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param config Pointer to quadrature decoder initialization data + * @retval XMC_POSIF_STATUS_t Returns quadrature mode initialization status of type @ref XMC_POSIF_STATUS_t + * + * \parDescription
+ * Initializes quadrature decoder control mode.\n + * Configures \a PCONF register with quadrature mode using @ref XMC_POSIF_QD_MODE_t data structure. + * Initializes \a QDC register with quadrature mode configuration using @ref XMC_POSIF_QD_CONFIG_t structure. + * + * \parNote
+ * It is necessary to have called XMC_POSIF_Init first with Quadrature decoder mode before invocation of this API. + * + * \parRelated APIs:
+ * XMC_POSIF_Init() \n\n\n + */ +XMC_POSIF_STATUS_t XMC_POSIF_QD_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_QD_CONFIG_t * const config); + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param config Pointer to quadrature decoder initialization data + * @retval XMC_POSIF_STATUS_t Returns multi channel pattern initialization status of type @ref XMC_POSIF_STATUS_t + * + * \parDescription
+ * Initializes multi channel mode in Hall mode, standalone multi-channel mode and quadrature with multi-channel mode.\n + * Configures \a PCONF register with multi channel mode using @ref XMC_POSIF_MCM_CONFIG_t data structure. + * + * \parNote
+ * It is necessary to call XMC_POSIF_Init first before invocation of this API. + * For XMC_POSIF_MODE_HALL_SENSOR, it is necessary to have called XMC_POSIF_HSC_Init before invocation of this API. + * For XMC_POSIF_MODE_MCM_QD, it is necessary to have called XMC_POSIF_QD_Init before invocation of this API. + * + * \parRelated APIs:
+ * XMC_POSIF_Init(),XMC_POSIF_HSC_Init(),XMC_POSIF_QD_Init() \n\n\n + */ +XMC_POSIF_STATUS_t XMC_POSIF_MCM_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_MCM_CONFIG_t * const config); + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param mode POSIF operating mode of type @ref XMC_POSIF_MODE_t + * @retval None + * + * \parDescription
+ * Configures POSIF module for \a mode.\n + * Configures \a PCONF register's a\ FSEL bitfield with \a mode. + * Refer @ref XMC_POSIF_MODE_t for available options. + * + * \parNote
+ * POSIF module should be in stopped state while changing the operating mode. + * + * \parRelated APIs:
+ * XMC_POSIF_Stop() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_SetMode(XMC_POSIF_t *const peripheral, const XMC_POSIF_MODE_t mode) +{ + peripheral->PCONF = ((peripheral->PCONF & ~(uint32_t)(POSIF_PCONF_FSEL_Msk)) | + (((uint32_t)mode << POSIF_PCONF_FSEL_Pos) & (uint32_t)POSIF_PCONF_FSEL_Msk)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param input0 Choice of input for input 0 [0-3] + * @param input1 Choice of input for input 1 [0-3] + * @param input2 Choice of input for input 2 [0-3] + * @retval None + * + * \parDescription
+ * Configures which input to be connected to POSIF module. \n + * Configures \a PCONF register's INSEL0,INSEL1,INSEL2 bit fields with source for the input connection for \a input0 + * \a input1, \a input2 respectively. + * + * \parNote
+ * Configures which input is used for the Phase X or Hall input X function depending upon the module is + * set for Quadrature Decoder or Hall Sensor Mode. + * + * \parRelated APIs:
+ * XMC_POSIF_Init() \n\n\n + */ +void XMC_POSIF_SelectInputSource(XMC_POSIF_t *const peripheral, const XMC_POSIF_INPUT_PORT_t input0, + const XMC_POSIF_INPUT_PORT_t input1, const XMC_POSIF_INPUT_PORT_t input2); + + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval None + * + * \parDescription
+ * Starts POSIF \a peripheral functional state machine.\n + * Starts POSIF state machine for \a peripheral.Configures \a PRUNS register's \a SRB bit field with 1. + * + * \parNote
+ * Global properties of POSIF along with mode specific properties should have been initialized before starting of POSIF + * FSM. + * + * \parRelated APIs:
+ * XMC_POSIF_Stop(),XMC_POSIF_IsRunning() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_Start(XMC_POSIF_t *const peripheral) +{ + peripheral->PRUNS = (uint32_t)POSIF_PRUNS_SRB_Msk; +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval None + * + * \parDescription
+ * Stops POSIF \a peripheral functional state machine.\n + * Stop POSIF functional state machine and clears current internal status of the \a peripheral. + * Configures \a PRUNC register's \a CRB bit field with 1. + * + * \parRelated APIs:
+ * XMC_POSIF_Start(),XMC_POSIF_IsRunning() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_Stop(XMC_POSIF_t *const peripheral) +{ + peripheral->PRUNC = (uint32_t)(POSIF_PRUNC_CRB_Msk | POSIF_PRUNC_CSM_Msk); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval bool Returns false: IDLE, true:RUNNING + * + * \parDescription
+ * Returns the status of POSIF module - Running or IDLE.\n + * Retrieves the status from \a PRUN register's \a SRB bit. + * + * \parRelated APIs:
+ * XMC_POSIF_Start(),XMC_POSIF_Stop() \n\n\n + */ +__STATIC_INLINE bool XMC_POSIF_IsRunning(XMC_POSIF_t *const peripheral) +{ + return ((bool)peripheral->PRUN); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint8_t Returns last sampled hall sensor pattern. Range : [0-7] + * + * \parDescription
+ * Returns last sampled hall sensor pattern of \a peripheral.\n + * Retrieves the last sampled hall sensor pattern from \a PDBG register's \a HSP bit field of \a peripheral. + * Applications can at any point in time retrieve the last sampled hall sensor pattern by invoking this API. + * + * \parNote
+ * This is applicable only to the hall sensor mode of operation. + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_GetCurrentPattern(),XMC_POSIF_HSC_GetExpectedPattern() \n\n\n + */ +__STATIC_INLINE uint8_t XMC_POSIF_HSC_GetLastSampledPattern(XMC_POSIF_t *const peripheral) +{ + return ((uint8_t)((peripheral->PDBG) & POSIF_PDBG_HSP_Msk) >> POSIF_PDBG_HSP_Pos); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint8_t Returns current hall sensor pattern. Range : [0-7] + * + * \parDescription
+ * Returns current sampled hall sensor pattern of \a peripheral.\n + * Retrieves the current hall sensor pattern from \a HALP register's \a HCP bit field of \a peripheral. + * Applications can at any point in time retrieve the current hall sensor pattern by invoking this API. + * + * \parNote
+ * This is applicable only to the hall sensor mode of operation. + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_GetLastSampledPattern(),XMC_POSIF_HSC_GetExpectedPattern() \n\n\n + */ +__STATIC_INLINE uint8_t XMC_POSIF_HSC_GetCurrentPattern(XMC_POSIF_t *const peripheral) +{ + return ((uint8_t)((peripheral->HALP & POSIF_HALP_HCP_Msk) >> POSIF_HALP_HCP_Pos)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint8_t Returns expected hall sensor pattern. Range : [0-7] + * + * \parDescription
+ * Returns expected hall sensor pattern of \a peripheral.\n + * Retrieves the expected hall sensor pattern from \a HALP register's \a HEP bit field of \a peripheral. + * Applications can at any point in time retrieve the expected hall sensor pattern by invoking this API. + * + * \parNote
+ * This is applicable only to the hall sensor mode of operation. + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_GetLastSampledPattern(),XMC_POSIF_HSC_GetCurrentPattern() \n\n\n + */ +__STATIC_INLINE uint8_t XMC_POSIF_HSC_GetExpectedPattern(XMC_POSIF_t *const peripheral) +{ + return ((uint8_t)((peripheral->HALP & POSIF_HALP_HEP_Msk) >> POSIF_HALP_HEP_Pos)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param pattern The hall sensor pattern to be programmed into current pattern [0-7] + * @retval None + * + * \parDescription
+ * Configures current Hall sensor \a pattern of \a peripheral.\n + * Configures the Current hall sensor pattern on \a HALPS shadow register's \a HCPS bit field of \a peripheral. + * Applications can set at any point in time program the current hall sensor pattern by invoking this API. + * + * \parNote
+ * This is applicable only to the hall sensor mode of operation. It may be noted that the pattern is merely + * written to the shadow register. Transfer from the shadow register is based on a hardware transfer trigger + * or software trigger through API @ref XMC_POSIF_HSC_UpdateHallPattern(). + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_GetCurrentPattern(),XMC_POSIF_HSC_SetExpectedPattern() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_HSC_SetCurrentPattern(XMC_POSIF_t *const peripheral, const uint8_t pattern) +{ + peripheral->HALPS = ((peripheral->HALPS & ~(uint32_t)(POSIF_HALPS_HCPS_Msk)) | + (((uint32_t)pattern << POSIF_HALPS_HCPS_Pos) & (uint32_t)POSIF_HALPS_HCPS_Msk)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param pattern The hall sensor pattern to be programmed into expected pattern [0-7] + * @retval None + * + * \parDescription
+ * Configures the expected hall sensor \a pattern of \a peripheral.\n + * Applications can set at any point in time program the hall sensor expected patterns by invoking this API. + * Configures the expected hall sensor pattern on \a HALPS shadow register's \a HEPS bit field of \a peripheral. + * + * \parNote
+ * This is applicable only to the hall sensor mode of operation.It may be noted that the pattern is merely + * written to the shadow register. Transfer from the shadow register is based on a hardware transfer trigger + * or software trigger through API @ref XMC_POSIF_HSC_UpdateHallPattern(). + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_GetExpectedPattern() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_HSC_SetExpectedPattern(XMC_POSIF_t *const peripheral, const uint8_t pattern) +{ + peripheral->HALPS = ((peripheral->HALPS & ~(uint32_t)(POSIF_HALPS_HEPS_Msk)) | + (((uint32_t)pattern << POSIF_HALPS_HEPS_Pos) & (uint32_t)POSIF_HALPS_HEPS_Msk)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param pattern_mask The hall sensor pattern mask [0-63] Format of mask: (expected_pattern << 3) | (current_pattern) + * @retval None + * + * \parDescription
+ * Configures current and expected hall pattern of \a peripheral. \n + * Configures \a HALPS register with the Current and Expected hall sensor patterns in one operation. + * Applications can at any point in time program the current and expected hall sensor pattern by invoking this API. + * + * \parNote
+ * This is applicable only to the hall sensor mode of operation. It may be noted that the pattern is merely + * written to the shadow register. Transfer from the shadow register is based on a hardware transfer trigger + * or software trigger through API @ref XMC_POSIF_HSC_UpdateHallPattern(). + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_SetExpectedPattern(),XMC_POSIF_HSC_SetCurrentPattern() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_HSC_SetHallPatterns(XMC_POSIF_t *const peripheral, const uint8_t pattern_mask) +{ + peripheral->HALPS = (uint32_t)(pattern_mask & (POSIF_HALPS_HCPS_Msk | POSIF_HALPS_HEPS_Msk)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval None + * + * \parDescription
+ * Manually performs shadow transfer of hall sensor patterns.\n + * Configures \a MCMS register's \a STHR bit field with 1. + * Setting this bit to 1 leads to an immediate update of the fields \a HALP.HCP(Current pattern) and \a HALP.HEP(Expected pattern). + * + * \parNote
+ * The transfer of hall sensor pattern shadow registers content to the sensor pattern register happens under two + * conditions. A hardware trigger starts the shadow transfer. Alternatively, the shadow transfer can be initiated + * by application software by means of invocation of this API. + * + * \parRelated APIs:
+ * XMC_POSIF_HSC_SetHallPatterns() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_HSC_UpdateHallPattern(XMC_POSIF_t *const peripheral) +{ + peripheral->MCMS = (uint32_t)POSIF_MCMS_STHR_Msk; +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param pattern The 16b multi-channel pattern [0-65535] + * @retval None + * + * \parDescription
+ * Configures \a MCSM register with Multi-Channel Pattern.\n + * This 16b multi-channel pattern which controls the 16 outputs of all slices of a CCU8 module. + * Transfer from the shadow register is based on a hardware transfer trigger + * or software trigger through API @ref XMC_POSIF_MCM_UpdateMultiChannelPattern(). + * Every time that a Multi-Channel pattern transfer is triggered, this value is passed into the field \a MCM.MCMP of \a peripheral + * + * \parNote
+ * It may be noted that the pattern is merely written to the shadow register. + * + * \parRelated APIs:
+ * XMC_POSIF_MCM_GetMultiChannelPattern() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_MCM_SetMultiChannelPattern(XMC_POSIF_t *const peripheral, const uint16_t pattern) +{ + peripheral->MCSM = pattern; +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint16_t Returns configured multi channel pattern + * + * \parDescription
+ * Returns configured multi channel pattern of \a peripheral. \n + * Retrieves the Multi-Channel Pattern from \a MCM register's MCMP bit field of \a peripheral + * Applications can at any point in time retrieve the multi-channel pattern by invoking this API. + * + * \parRelated APIs:
+ * XMC_POSIF_MCM_SetMultiChannelPattern() \n\n\n + */ +__STATIC_INLINE uint16_t XMC_POSIF_MCM_GetMultiChannelPattern(XMC_POSIF_t *const peripheral) +{ + return ((uint16_t)(peripheral->MCM & (uint32_t)POSIF_MCM_MCMP_Msk)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint16_t Returns configured multi channel pattern present in shadow transfer register + * + * \parDescription
+ * Returns configured multi channel pattern in shadow register of \a peripheral. \n + * Retrieves the Multi-Channel Pattern from \a MCSM shadow register's \a MCMPS bit field. + * Applications can at any point in time retrieve the multi-channel pattern by invoking this API. + * + * It can be used when MCM is enabled. + * + * \parRelated APIs:
+ * XMC_POSIF_MCM_SetMultiChannelPattern() \n\n\n + */ +__STATIC_INLINE uint16_t XMC_POSIF_MCM_GetShadowMultiChannelPattern(XMC_POSIF_t *const peripheral) +{ + return ((uint16_t)(peripheral->MCSM & (uint32_t)POSIF_MCSM_MCMPS_Msk)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval None + * + * \parDescription
+ * Performs shadow transfer of the Multi-Channel Pattern register by configuring \a MCMS register's \a STMR bit field. + * + * \parNote
+ * Transfer multi-channel pattern shadow registers content to the actual pattern register of \a peripheral. \n + * The transfer of multi-channel pattern shadow registers content to the actual pattern register happens under two + * conditions. A hardware trigger starts the shadow transfer. Alternatively, the shadow transfer can be initiated + * by application software by means of invocation of this API. + * + * \parRelated APIs:
+ * XMC_POSIF_MCM_SetMultiChannelPattern() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_MCM_UpdateMultiChannelPattern(XMC_POSIF_t *const peripheral) +{ + peripheral->MCMS |= (uint32_t)POSIF_MCMS_STMR_Msk; +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval None + * + * \parDescription
+ * Enables update of the Multi-Channel Pattern by software in standalone multi-channel mode.\n + * Enabling update of multi-channel pattern happens under two conditions. A hardware trigger enables this update. + * Alternatively, this can be enabled by software by means of invocation of this API. + * + * \parNote
+ * The update is not done immediately due to the fact that the trigger that synchronizes the update with the PWM is + * still needed. + * + * \parRelated APIs:
+ * XMC_POSIF_MCM_UpdateMultiChannelPattern() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_MCM_EnableMultiChannelPatternUpdate(XMC_POSIF_t *const peripheral) +{ + peripheral->MCMS |= (uint32_t)POSIF_MCMS_MNPS_Msk; +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval XMC_POSIF_QD_DIR_t Return direction of revolution of the motor of type @ref XMC_POSIF_QD_DIR_t + * + * \parDescription
+ * Returns the direction of revolution of the motor.\n + * Retrieves direction from \a QDC register's \a DVAL bit field in quadrature mode. + * Applications can at any point in time retrieve the direction of rotation by invoking this API. + * + * \parNote
+ * This is applicable only to the quadrature decoder mode of operation. + * + */ +__STATIC_INLINE XMC_POSIF_QD_DIR_t XMC_POSIF_QD_GetDirection(XMC_POSIF_t *const peripheral) +{ + return ((XMC_POSIF_QD_DIR_t)((peripheral->QDC & POSIF_QDC_DVAL_Msk) >> POSIF_QDC_DVAL_Pos)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint8_t Returns current state of quadrature decoder[Phase B,Phase A] + * + * \parDescription
+ * Returns the current state of phase signals in quadrature decoder mode of \a peripheral. \n + * Retrieves current state of the quadrature decoder from \a PDBG register's \a QCSV bit fields. + * Applications can at any point in time retrieve the current state of Phase A and Phase B signals + * by invoking this API. + * + * \parNote
+ * This is applicable only to the quadrature decoder mode of operation. + * + * \parRelated APIs:
+ * XMC_POSIF_QD_GetPreviousState() \n\n\n + */ +__STATIC_INLINE uint8_t XMC_POSIF_QD_GetCurrentState(XMC_POSIF_t *const peripheral) +{ + return ((uint8_t)((peripheral->PDBG & POSIF_PDBG_QCSV_Msk) >> POSIF_PDBG_QCSV_Pos)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint8_t Returns previous state of quadrature decoder[Phase B,Phase A] + * + * \parDescription
+ * Returns the previous state of phase signals in quadrature decoder mode of \a peripheral. \n + * Retrieves previous state of the quadrature decoder from \a PDBG register's \a QPSV bit fields. + * Applications can at any point in time retrieve the previous state of Phase A and Phase B signals + * by invoking this API. + * + * \parNote
+ * This is applicable only to the quadrature decoder mode of operation. + * + * \parRelated APIs:
+ * XMC_POSIF_QD_GetCurrentState() \n\n\n + */ +__STATIC_INLINE uint8_t XMC_POSIF_QD_GetPreviousState(XMC_POSIF_t *const peripheral) +{ + return ((uint8_t)((peripheral->PDBG & POSIF_PDBG_QPSV_Msk) >> POSIF_PDBG_QPSV_Pos)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @retval uint8_t Returns the index value.[1 - New rotation started, 0 - In-between] + * + * \parDescription
+ * Returns the current index value in quadrature decoder mode of \a peripheral. \n + * Retrieves current index signal value of the quadrature decoder from \a PDBG register's \a IVAL bit field. + * Applications can at any point in time retrieve the current index signal value of the quadrature decoder by + * invoking this API. + * + * \parNote
+ * This is applicable only to the quadrature decoder mode of operation. + * + */ +__STATIC_INLINE uint8_t XMC_POSIF_QD_GetCurrentIndexValue(XMC_POSIF_t *const peripheral) +{ + return ((uint8_t)((peripheral->PDBG & POSIF_PDBG_IVAL_Msk) >> POSIF_PDBG_IVAL_Pos)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param event Event to be enabled + * @retval None + * + * \parDescription
+ * Enables \a event generation of \a peripheral. \n + * Enables an IRQ generation capable \a event by configuring 1 to \a PFLGE register's \a event bit field. + * + * \parRelated APIs:
+ * XMC_POSIF_DisableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_EnableEvent(XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) +{ + peripheral->PFLGE |= (uint32_t)1 << (uint8_t)event; +} + +/** + * @brief Disables an IRQ generation capable event + * @param peripheral Pointer to an instance of POSIF module + * @param event Event to be disabled + * @retval None + * + * \parDescription
+ * Disables \a event generation of \a peripheral.\n + * Disables an IRQ generation capable \a event by configuring 0 to \a PFLGE register's \a event bit field. + * + * \parRelated APIs:
+ * XMC_POSIF_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_DisableEvent(XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) +{ + peripheral->PFLGE &= ~((uint32_t)1 << (uint8_t)event); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param event Event to be manually asserted + * @retval None + * + * \parDescription
+ * Manually generates \a event of \a peripheral. \n + * Manually asserts an IRQ generation capable event by configuring 1 to \a SPFLG register's \a event bit field. + * + * \parRelated APIs:
+ * XMC_POSIF_ClearEvent() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_SetEvent(XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) +{ + peripheral->SPFLG = (uint32_t)1 << (uint8_t)event; +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param event Event to be acknowledged + * @retval None + * + * \parDescription
+ * Clears \a event by acknowledgment of \a peripheral. \n + * Acknowledges an IRQ event by configuring 1 to \a RPFLG register's \a event bit field. + * + * \parRelated APIs:
+ * XMC_POSIF_SetEvent() \n\n\n + */ +__STATIC_INLINE void XMC_POSIF_ClearEvent(XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) +{ + peripheral->RPFLG = (uint32_t)1 << (uint8_t)event; +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param event Event ID to be checked for status + * @retval uint8_t Returns event status + * + * \parDescription
+ * Returns \a event status of \a peripheral. \n + * Determines if IRQ event is asserted by retrieving data from \a PFLG register's \a event bit field. + * + * \parRelated APIs:
+ * XMC_POSIF_SetEvent(),XMC_POSIF_ClearEvent() \n\n\n + */ +__STATIC_INLINE uint8_t XMC_POSIF_GetEventStatus(XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) +{ + return ((uint8_t)((peripheral->PFLG >> (uint8_t)event) & 1U)); +} + +/** + * @param peripheral Pointer to an instance of POSIF module + * @param event Event to be acknowledged of type @ref XMC_POSIF_IRQ_EVENT_t + * @param sr Service request line of type @ref XMC_POSIF_SR_ID_t + * @retval None + * + * \parDescription
+ * Configures \a event to generate \a sr (service request) of \a peripheral. \n + * Binds an IRQ event to a service request line by configuring \a PFLGE register's \a event bit field. + */ +void XMC_POSIF_SetInterruptNode(XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event, const XMC_POSIF_SR_ID_t sr); + +#ifdef __cplusplus +} +#endif /* #if defined(POSIF0) */ + +/** + * @} + */ + +/** + * @} + */ + +#endif + +#endif /* XMC_POSIF_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_prng.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_prng.h new file mode 100644 index 00000000..4b8dce2a --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_prng.h @@ -0,0 +1,285 @@ + +/** + * @file xmc_prng.h + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * - Documentation updates
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * @endcond + */ + +#ifndef XMC_PRNG_H +#define XMC_PRNG_H + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ + +#include "xmc_common.h" + +#if defined (PRNG) + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup PRNG + * @brief Pseudo Random Number Generator (PRNG) driver for XMC1000 microcontroller family + * + * The pseudo random bit generator (PRNG) provides random data with fast generation times. + * PRNG has to be initialized by the user software before use. The initialization consists + * of two basic phases: key-loading and warm-up. + * + * The PRNG low level driver provides functions to configure and initialize the PRNG hardware + * peripheral. + * @{ + */ + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ + +/** + * Byte mask value for random data block size + */ +#define XMC_PRNG_RDBS_BYTE_READ_MASK (0x00FFU) + +/********************************************************************************************************************* + * ENUMS + *********************************************************************************************************************/ + +/** + * PRNG key load operation modes + */ +typedef enum XMC_PRNG_KEY_LOAD_OP_MODE { + XMC_PRNG_STRM_MODE = 0U, /**< Streaming mode (default) */ + XMC_PRNG_KLD_MODE = 1U /**< Loading mode */ +} XMC_PRNG_KEY_LOAD_OP_MODE_t; + +/** + * PRNG data block size + */ +typedef enum XMC_PRNG_DATA_BLOCK_SIZE { + XMC_PRNG_RDBS_RESET = 0U, /**< Reset state (no random data block size defined) */ + XMC_PRNG_RDBS_BYTE = 1U, /**< BYTE (8-bit) */ + XMC_PRNG_RDBS_WORD = 2U /**< WORD (16-bit) */ +} XMC_PRNG_DATA_BLOCK_SIZE_t; + +/** + * PRNG driver initialization status + */ +typedef enum XMC_PRNG_INIT_STATUS { + XMC_PRNG_NOT_INITIALIZED = 0U, /**< Reset state or Non-initialized state (Same as XMC_PRNG_RDBS_RESET) */ + XMC_PRNG_INITIALIZED = 1U /**< Initialized state */ +} XMC_PRNG_INIT_STATUS_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + *********************************************************************************************************************/ + +/** + * Key words and data block size configuration values of PRNG
+ * + * The structure presents a convenient way to set/obtain the key word and data block configuration + * values of PRNG. + * The XMC_PRNG_Init() can be used to populate the structure with the key word and data block + * configuration values of the PRNG module. + */ +typedef struct XMC_PRNG_INIT +{ + uint16_t key_words[5]; /**< Keywords */ + XMC_PRNG_DATA_BLOCK_SIZE_t block_size; /**< Block size */ +} XMC_PRNG_INIT_t; + +/********************************************************************************************************************* + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param prng Pointer to a constant instance of ::XMC_PRNG_INIT_t, pointing to + * the initialization configuration. + * @return XMC_PRNG_INIT_STATUS_t XMC_PRNG_INITIALIZED if initialized, + * XMC_PRNG_NOT_INITIALIZED otherwise. + * + * \parDescription:
+ * Initialize the PRNG peripheral with the configured key words and block size
+ * + * \par + * The function configures block size for key loading mode, enables key loading mode, + * loads key words (80 bits) and wait till RDV is set, enables the streaming mode and + * waits for warmup phase. This function programmes the CTRL and WORD registers. + */ +XMC_PRNG_INIT_STATUS_t XMC_PRNG_Init(const XMC_PRNG_INIT_t *prng); + + + +/** + * @param block_size Block size of type ::XMC_PRNG_DATA_BLOCK_SIZE_t for read access + * @return None + * + * \parDescription:
+ * Programming Random Block Size
+ * + * \par + * The function sets the random data block size as byte or word by programming CTRL.RDBS bitfield. + * block_size = 0 for Reset state, block_size = 1 for 'byte' and block_size = 2 for 'word'. + */ +__STATIC_INLINE void XMC_PRNG_SetRandomDataBlockSize(XMC_PRNG_DATA_BLOCK_SIZE_t block_size) +{ + PRNG->CTRL = (uint16_t)((PRNG->CTRL & (uint32_t)~PRNG_CTRL_RDBS_Msk) | + ((uint32_t)block_size << (uint32_t)PRNG_CTRL_RDBS_Pos)); +} + +/** + * @return None + * + * \parDescription:
+ * Checks the validity (CHK.RDV bit) of the generated random data
+ * + * \par + * The function checks the validity (CHK.RDV bit) of the generated random data. + * In key loading mode, this value indicates if the next partial key word can be written + * to PRNG_WORD or not. + */ +__STATIC_INLINE uint16_t XMC_PRNG_CheckValidStatus(void) +{ + return (PRNG->CHK & PRNG_CHK_RDV_Msk); +} + +/** + * @return None + * + * \parDescription:
+ * Enables the PRNG key loading mode
+ * + * \par + * The function initializes the key loading by setting the bit CTRL.KLD. In this mode, Register WORD + * acts as always as a 16 bit destination register. After the complete key has been loaded, the CTRL.KLD + * must be set to '0' to prepare the following warmup phase. + * + * \parRelated APIs:
+ * XMC_PRNG_EnableStreamingMode() + */ +__STATIC_INLINE void XMC_PRNG_EnableKeyLoadingMode(void) +{ + PRNG->CTRL |= (uint16_t)PRNG_CTRL_KLD_Msk; +} + +/** + * @return None + * + * \parDescription:
+ * Enables the Streaming mode
+ * + * \par + * The function enables the streaming mode and disables the PRNG key loading mode by resetting the + * CTRL.KLD bit. + * + * \parRelated APIs:
+ * XMC_PRNG_EnableKeyLoadingMode() + */ +__STATIC_INLINE void XMC_PRNG_EnableStreamingMode(void) +{ + PRNG->CTRL &= (uint16_t)~PRNG_CTRL_KLD_Msk; +} + +/** + * @param key Key word to load into PRNG WORD register + * @return None + * + * \parDescription:
+ * Loads a partial key word to the PRNG WORD register
+ * + * \par + * The function loads partial key word to WORD registr. These partial + * words are sequentially written and loading a key word will take 16 clock + * cycles. The CHK.RDV bit is set to '0' while loading is in progress. '1' indicates + * that the next partial key word can be written to WORD register. + */ +__STATIC_INLINE void XMC_PRNG_LoadKeyWords(uint16_t key) +{ + PRNG->WORD = key; +} + +/** + * @param None + * @return uint16_t Generated random number + * + * \parDescription:
+ * Gets the generated random number
+ * + * \par + * The function gives the generated random number by returning the content of WORD + * register. Before reading the WORD register to get the generated random number it is + * required to check the bit CHK.RDV is set which indicates that the next random data block + * can be read from WORD register. After a word has been read the bit CHK.RDV is reset + * by the hardware and generation of new random bits starts. + * + * \parRelated APIs:
+ * XMC_PRNG_CheckValidStatus() + */ +__STATIC_INLINE uint16_t XMC_PRNG_GetPseudoRandomNumber(void) +{ + return PRNG->WORD; +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* #if defined (PRNG) */ + +#endif /* XMC_PRNG_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_rtc.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_rtc.h new file mode 100644 index 00000000..f0b7d3a5 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_rtc.h @@ -0,0 +1,683 @@ +/** + * @file xmc_rtc.h + * @date 2016-05-19 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial + * + * 2015-05-20: + * - Documentation updates
+ * - In xmc1_rtc file XMC_RTC_Init function + * is modified by adding the RTC running condition check + * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * 2016-05-19: + * - Added XMC_RTC_SetTimeStdFormat() and XMC_RTC_SetAlarmStdFormat() + * + * @endcond + * + */ + +#ifndef XMC_RTC_H +#define XMC_RTC_H + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ + +#include +#include + +/** + * + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup RTC + * @brief RTC driver for XMC microcontroller family. + * + * Real-time clock (RTC) is a clock that keeps track of the current time. Precise + * real time keeping is with a 32.768 KHz external crystal clock or a 32.768 KHz + * high precision internal clock. It provides a periodic time based interrupt and + * a programmable alarm interrupt on time match. It also supports wakeup from + * hibernate. + * + * The RTC low level driver provides functions to configure and initialize the RTC + * hardware peripheral. + * + * @{ + */ + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************* + * ENUMS + *********************************************************************************************************************/ + +/** + * Status return values for RTC low level driver + */ +typedef enum XMC_RTC_STATUS +{ + XMC_RTC_STATUS_OK = 0U, /**< Operation successful */ + XMC_RTC_STATUS_ERROR = 1U, /**< Operation unsuccessful */ + XMC_RTC_STATUS_BUSY = 2U /**< Busy with a previous request */ +} XMC_RTC_STATUS_t; + +/** + * Events which enables interrupt request generation + */ +typedef enum XMC_RTC_EVENT +{ + XMC_RTC_EVENT_PERIODIC_SECONDS = RTC_MSKSR_MPSE_Msk, /**< Mask value to enable an event on periodic seconds */ + XMC_RTC_EVENT_PERIODIC_MINUTES = RTC_MSKSR_MPMI_Msk, /**< Mask value to enable an event on periodic seconds */ + XMC_RTC_EVENT_PERIODIC_HOURS = RTC_MSKSR_MPHO_Msk, /**< Mask value to enable an event on periodic seconds */ + XMC_RTC_EVENT_PERIODIC_DAYS = RTC_MSKSR_MPDA_Msk, /**< Mask value to enable an event on periodic seconds */ + XMC_RTC_EVENT_PERIODIC_MONTHS = RTC_MSKSR_MPMO_Msk, /**< Mask value to enable an event on periodic seconds */ + XMC_RTC_EVENT_PERIODIC_YEARS = RTC_MSKSR_MPYE_Msk, /**< Mask value to enable an event on periodic seconds */ + XMC_RTC_EVENT_ALARM = RTC_MSKSR_MAI_Msk /**< Mask value to enable an event on periodic seconds */ +} XMC_RTC_EVENT_t; + +/** + * Months used to program the date + */ +typedef enum XMC_RTC_MONTH +{ + XMC_RTC_MONTH_JANUARY = 0U, + XMC_RTC_MONTH_FEBRUARY = 1U, + XMC_RTC_MONTH_MARCH = 2U, + XMC_RTC_MONTH_APRIL = 3U, + XMC_RTC_MONTH_MAY = 4U, + XMC_RTC_MONTH_JUNE = 5U, + XMC_RTC_MONTH_JULY = 6U, + XMC_RTC_MONTH_AUGUST = 7U, + XMC_RTC_MONTH_SEPTEMBER = 8U, + XMC_RTC_MONTH_OCTOBER = 9U, + XMC_RTC_MONTH_NOVEMBER = 10U, + XMC_RTC_MONTH_DECEMBER = 11U +} XMC_RTC_MONTH_t; + +/** + * Week days used program the date + */ +typedef enum XMC_RTC_WEEKDAY +{ + XMC_RTC_WEEKDAY_SUNDAY = 0U, + XMC_RTC_WEEKDAY_MONDAY = 1U, + XMC_RTC_WEEKDAY_TUESDAY = 2U, + XMC_RTC_WEEKDAY_WEDNESDAY = 3U, + XMC_RTC_WEEKDAY_THURSDAY = 4U, + XMC_RTC_WEEKDAY_FRIDAY = 5U, + XMC_RTC_WEEKDAY_SATURDAY = 6U +} XMC_RTC_WEEKDAY_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + *********************************************************************************************************************/ +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + + +/** + * Alarm time values of RTC
+ * + * The structure presents a convenient way to set/obtain the + * alarm time values for seconds, minutes, hours, days, month and year of RTC. + * The XMC_RTC_SetAlarm() and XMC_RTC_GetAlarm() can be + * used to populate the structure with the alarm time value of + * RTC + */ +typedef struct XMC_RTC_ALARM +{ + union + { + uint32_t raw0; + struct + { + uint32_t seconds : 6; /**< Alarm seconds compare value (0-59: Above this causes this bitfield to be set with 0)*/ + uint32_t : 2; + uint32_t minutes : 6; /**< Alarm minutes compare value (0-59: Above this causes this bitfield to be set with 0)*/ + uint32_t : 2; + uint32_t hours : 5; /**< Alarm hours compare value (0-23: Above this causes this bitfield to be set with 0)*/ + uint32_t : 3; + uint32_t days : 5; /**< Alarm days compare value (0-Actual days of month: Above this causes this bitfield to be set with 0)*/ + uint32_t : 3; + }; + }; + + union + { + uint32_t raw1; + struct + { + uint32_t : 8; + uint32_t month : 4; /**< Alarm month compare value (0-11: Above this causes this bitfield to be set with 0) */ + uint32_t : 4; + uint32_t year : 16; /**< Alarm year compare value */ + }; + }; +} XMC_RTC_ALARM_t; + +/** + * Time values of RTC
+ * + * The structure presents a convenient way to set/obtain the + * time values for seconds, minutes, hours, days, month and year of RTC. + * The XMC_RTC_SetTime() and XMC_RTC_GetTime() can be + * used to populate the structure with the time value of + * RTC + */ +typedef struct XMC_RTC_TIME +{ + union + { + uint32_t raw0; + struct + { + uint32_t seconds : 6; /**< Seconds time value (0-59: Above this causes this bitfield to be set with 0) */ + uint32_t : 2; + uint32_t minutes : 6; /**< Minutes time value (0-59: Above this causes this bitfield to be set with 0) */ + uint32_t : 2; + uint32_t hours : 5; /**< Hours time value (0-23: Above this causes this bitfield to be set with 0) */ + uint32_t : 3; + uint32_t days : 5; /**< Days time value (0-Actual days of month: Above this causes this bitfield to be set with 0)*/ + uint32_t : 3; + }; + }; + + union + { + uint32_t raw1; + struct + { + uint32_t daysofweek : 3; /**< Days of week time value (0-6: Above this causes this bitfield to be set with 0) */ + uint32_t : 5; + uint32_t month : 4; /**< Month time value (0-11: Above this causes this bitfield to be set with 0) */ + uint32_t : 4; + uint32_t year : 16; /**< Year time value */ + }; + }; +} XMC_RTC_TIME_t; +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif + +/** + * RTC initialization with time, alarm and clock divider(prescaler) configurations
+ * + * The structure presents a convenient way to set/obtain the time and alarm configurations + * for RTC. The XMC_RTC_Init() can be used to populate the structure with the time and alarm + * values of RTC. + */ +typedef struct XMC_RTC_CONFIG +{ + XMC_RTC_TIME_t time; + XMC_RTC_ALARM_t alarm; + uint16_t prescaler; +} XMC_RTC_CONFIG_t; + +/******************************************************************************* + * EXTENSIONS + *******************************************************************************/ + +#if UC_FAMILY == XMC1 +#include "xmc1_rtc.h" +#endif + +#if UC_FAMILY == XMC4 +#include "xmc4_rtc.h" +#endif + +/******************************************************************************* + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param config Constant pointer to a constant ::XMC_RTC_CONFIG_t structure containing the + * time, alarm time and clock divider(prescaler) configuration. + * @return XMC_RTC_STATUS_t Always returns XMC_RTC_STATUS_OK (It contains only register assignment statements) + * + * \parDescription:
+ * Initialize the RTC peripheral
+ * + * \par \if XMC4 + * The function enables the hibernate domain for accessing RTC peripheral registers, configures + * internal clock divider, time and alarm values by writing to the CTR.DIV, TIM0, TIM1, ATIM0 and + * ATIM1 registers. + * \endif + * + * \if XMC1 + * The function ungates the peripheral clock for RTC, configures + * internal clock divider, time and alarm values by writing to the CTR.DIV, TIM0, TIM1, ATIM0 and + * ATIM1 registers. + * \endif + */ +XMC_RTC_STATUS_t XMC_RTC_Init(const XMC_RTC_CONFIG_t *const config); + +/** + * @return None + * + * \parDescription
+ * Enables RTC peripheral for programming its registers
+ * + * \par \if XMC4 + * Enables the hibernate domain for accessing RTC peripheral registers. + * \endif + * + * \if XMC1 + * Ungates the peripheral clock. + * \endif + * + * \parRelated APIs:
+ * XMC_RTC_Disable(), XMC_SCU_RESET_DeassertPeripheralReset() + */ +void XMC_RTC_Enable(void); + +/** + * @return None + * + * \parDescription
+ * Disables RTC peripheral for programming its registers
+ * + * \par \if XMC4 + * Empty function (Hibernate domain is not disabled). + * \endif + * + * \if XMC1 + * Gates the peripheral clock. + * \endif + * + * \parRelated APIs:
+ * XMC_RTC_Enable(), XMC_SCU_RESET_AssertPeripheralReset() + */ +void XMC_RTC_Disable(void); + +/** + * @return None + * + * \parDescription
+ * Checks RTC peripheral is enabled for programming its registers
+ * + * \par \if XMC4 + * Checks the hibernate domain is enabled or not. + * \endif + * + * \if XMC1 + * Checks peripheral clock is ungated or not. + * \endif + * + * \parRelated APIs:
+ * XMC_RTC_Enable(), XMC_RTC_Disable(), XMC_SCU_RESET_DeassertPeripheralReset(), + * XMC_SCU_RESET_AssertPeripheralReset() + */ +bool XMC_RTC_IsEnabled(void); + +/** + * @return None + * + * \parDescription
+ * Enables RTC peripheral to start counting time
+ * + * \par + * The function starts the RTC for counting time by setting + * CTR.ENB bit. Before starting the RTC, it should not be in + * running mode and also hibernate domain should be enabled. + * + * \parRelated APIs:
+ * XMC_RTC_Enable(), XMC_RTC_Stop(), XMC_SCU_RESET_DeassertPeripheralReset() + */ +void XMC_RTC_Start(void); + +/** + * @return None + * + * \parDescription
+ * Disables RTC peripheral to start counting time
+ * + * \par + * The function stops the RTC for counting time by resetting + * CTR.ENB. Before stopping the RTC, hibernate domain should be enabled. + * + * \parRelated APIs:
+ * XMC_RTC_Enable(), XMC_RTC_Start(), XMC_SCU_RESET_AssertPeripheralReset() + */ +void XMC_RTC_Stop(void); + +/** + * @param prescaler Prescaler value to be set + * @return None + * + * \parDescription:
+ * Sets the RTC module prescaler value
+ * + * \par + * The function sets the CTR.DIV bitfield to configure the prescalar value. + * The default value for the prescalar with the 32.768kHz crystal (or the internal clock) + * is 7FFFH for a time interval of 1 sec. Before setting the prescaler value RTC should be + * in stop mode and hibernate domain should be enabled. + * + * \parRelated APIs:
+ * XMC_RTC_Stop(), XMC_RTC_Enable(), XMC_RTC_GetPrescaler() + */ +void XMC_RTC_SetPrescaler(uint16_t prescaler); + +/** + * @return None + * + * \parDescription:
+ * Gets the RTC module prescaler value
+ * + * \par + * The function reads the CTR.DIV bitfield to get the prescalar value. The default value + * for the prescalar with the 32.768kHz crystal (or the internal clock) is 7FFFH for a + * time interval of 1 sec. + * + * \parRelated APIs:
+ * XMC_RTC_SetPrescaler() + */ +__STATIC_INLINE uint32_t XMC_RTC_GetPrescaler(void) +{ + return (uint32_t)(((uint32_t)RTC->CTR & (uint32_t)RTC_CTR_DIV_Msk) >> (uint32_t)RTC_CTR_DIV_Pos); +} + +/** + * @param timeval Contstant pointer to a constant ::XMC_RTC_TIME_t structure containing the + * time parameters seconds, minutes, hours, days, daysofweek, month and year. + * @return None + * + * \parDescription:
+ * Sets the RTC module time values
+ * + * \par + * The function sets the TIM0, TIM1 registers with time values. + * The values can only be written when RTC is disabled. + * See the structure ::XMC_RTC_TIME_t for the valid range of time value parameters.
+ * + * \parRelated APIs:
+ * XMC_RTC_GetTime(), XMC_RTC_Stop() + */ +void XMC_RTC_SetTime(const XMC_RTC_TIME_t *const timeval); + +/** + * @param time Pointer to a constant ::XMC_RTC_TIME_t structure containing the time parameters + * seconds, minutes, hours, days, daysofweek, month and year. + * @return None + * + * \parDescription:
+ * Gets the RTC module time value
+ * + * \par + * The function gets the time values from TIM0, TIM1 registers. + * See the structure ::XMC_RTC_TIME_t for the valid range of time value parameters.
+ * + * \parRelated APIs:
+ * XMC_RTC_SetTime() + */ +void XMC_RTC_GetTime(XMC_RTC_TIME_t *const time); + +/** + * @param stdtime Pointer to a ::tm structure containing the time parameters seconds, + * minutes, hours, days, daysofweek, month, year(since 1900) and days in a + * year in standard format. + * @return None + * + * \parDescription:
+ * Sets the RTC module time value in standard format
+ * + * \par + * The function sets the time values from TIM0, TIM1 registers. + * + * \parRelated APIs:
+ * XMC_RTC_SetTime(), XMC_RTC_GetTime() + */ +void XMC_RTC_SetTimeStdFormat(const struct tm *const stdtime); + +/** + * @param stdtime Pointer to a constant ::tm structure containing the time parameters seconds, + * minutes, hours, days, daysofweek, month, year(since 1900) and days in a + * year in standard format. + * @return None + * + * \parDescription:
+ * Gets the RTC module time value in standard format
+ * + * \par + * The function gets the time values from TIM0, TIM1 registers. + * See the structure ::XMC_RTC_TIME_t for the valid range of time value parameters.
+ * For days the valid range is (1 - Actual days of month), year (since 1900) and + * daysinyear (0 -365). + * + * \parRelated APIs:
+ * XMC_RTC_SetTime(), XMC_RTC_GetTime() + */ +void XMC_RTC_GetTimeStdFormat(struct tm *const stdtime); + +/** + * @param alarm Constant pointer to a constant ::XMC_RTC_ALARM_t structure containing the + * alarm time parameters alarm seconds, alarm minutes, alarm hours, alarm days, + * alarm daysofweek, alarm month and alarm year. + * @return None + * + * \parDescription:
+ * Sets the RTC module alarm time value
+ * + * \par + * The function sets the ATIM0, ATIM1 registers with alarm time values. + * See the structure ::XMC_RTC_ALARM_t for the valid range of alarm time value parameters.
+ * + * \parRelated APIs:
+ * XMC_RTC_GetAlarm() + */ +void XMC_RTC_SetAlarm(const XMC_RTC_ALARM_t *const alarm); + +/** + * @param alarm Pointer to a constant ::XMC_RTC_ALARM_t structure containing the + * time parameters alarm seconds, alarm minutes, alarm hours, alarm days, + * alarm daysofweek, alarm month and alarm year. + * @return None + * + * \parDescription:
+ * Gets the RTC module alarm time value
+ * + * \par + * The function gets the alarm time values from ATIM0, ATIM1 registers. + * See the structure ::XMC_RTC_ALARM_t for the valid range of alarm time value parameters.
+ * + * \parRelated APIs:
+ * XMC_RTC_SetAlarm() + */ +void XMC_RTC_GetAlarm(XMC_RTC_ALARM_t *const alarm); + +/** + * @param stdtime Pointer to a ::tm structure containing the time parameters alarm seconds, + * alarm minutes, alarm hours, alarm days, alarm daysofweek, alarm month, + * alarm year(since 1900) and alarm days in a year in standard format. + * @return None + * + * \parDescription:
+ * Sets the RTC module alarm time value in standard format
+ * + * \par + * The function sets the alarm time values from ATIM0, ATIM1 registers. + * + * \parRelated APIs:
+ * XMC_RTC_SetAlarm(), XMC_RTC_GetAlarm() + */ +void XMC_RTC_SetAlarmStdFormat(const struct tm *const stdtime); + +/** + * @param stdtime Pointer to a constant ::tm structure containing the time parameters alarm seconds, + * alarm minutes, alarm hours, alarm days, alarm daysofweek, alarm month, + * alarm year(since 1900) and alarm days in a year in standard format. + * @return None + * + * \parDescription:
+ * Gets the RTC module alarm time value in standard format
+ * + * \par + * The function gets the alarm time values from ATIM0, ATIM1 registers. + * See the structure ::XMC_RTC_ALARM_t for the valid range of alarm time value parameters.
+ * For days the valid range is (1 - Actual days of month), year (since 1900) and + * daysinyear (0 -365). + * + * \parRelated APIs:
+ * XMC_RTC_SetAlarm(), XMC_RTC_GetAlarm() + */ +void XMC_RTC_GetAlarmStdFormat(struct tm *const stdtime); + +/** + * @param event A valid RTC event (::XMC_RTC_EVENT_t) or a valid combination of + * logically OR'd events + * @return None + * + * \parDescription:
+ * Enable RTC periodic and alarm event(s)
+ * + * \par + * The function sets the bitfields of MSKSR register to enable interrupt generation + * for requested RTC event(s). + * Setting the masking value for the event(s) containing in the ::XMC_RTC_EVENT_t leads + * to a generation of the interrupt. + * + * \parRelated APIs:
+ * XMC_RTC_DisableEvent() + */ +void XMC_RTC_EnableEvent(const uint32_t event); + +/** + * @param event A valid RTC event (::XMC_RTC_EVENT_t) or a valid combination of + * logically OR'd events + * @return None + * + * \parDescription:
+ * Disable RTC periodic and alarm event(s)
+ * + * \par + * The function resets the bitfields of MSKSR register to disable interrupt generation + * for requested RTC event(s). + * Resetting the masking value for the the event(s) containing in the ::XMC_RTC_EVENT_t blocks + * the generation of the interrupt. + * + * \parRelated APIs:
+ * XMC_RTC_EnableEvent() + */ +void XMC_RTC_DisableEvent(const uint32_t event); + +/** + * @param event A valid RTC event (::XMC_RTC_EVENT_t) or a valid combination of + * logically OR'd events + * @return None + * + * \parDescription:
+ * Clears periodic and alarm event(s) status
+ * + * \par + * The function sets the bitfields of CLRSR register to clear status bits in RAWSTAT and STSSR registers. + * Setting the value for the the RTC event(s) containing in the ::XMC_RTC_EVENT_t clears the + * corresponding status bits in RAWSTAT and STSSR registers. + * + * \parRelated APIs:
+ * XMC_RTC_GetEventStatus() + */ +void XMC_RTC_ClearEvent(const uint32_t event); + +/** + * @return None + * + * \parDescription:
+ * Gets the RTC periodic and alarm event(s) status
+ * + * \par + * The function reads the bitfields of STSSR register + * to get the status of RTC events. + * Reading the value of the register STSSR gives the status of the event(s) containing in the ::XMC_RTC_EVENT_t. + * + * \parRelated APIs:
+ * XMC_RTC_ClearEvent() + */ +uint32_t XMC_RTC_GetEventStatus(void); + +/** + * @return bool true if RTC is running + * false if RTC is not running + * + * \parDescription:
+ * Checks the running status of the RTC
+ * + * \par + * The function reads the bitfield ENB of CTR register + * to get the running status of RTC. + * + * \parRelated APIs:
+ * XMC_RTC_Start(), XMC_RTC_Stop() + */ +__STATIC_INLINE bool XMC_RTC_IsRunning(void) +{ + return (bool)(RTC->CTR & RTC_CTR_ENB_Msk); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* XMC_RTC_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_scu.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_scu.h new file mode 100644 index 00000000..cacb0cf2 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_scu.h @@ -0,0 +1,598 @@ +/** + * @file xmc_scu.h + * @date 2016-03-09 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-05-20: + * - Documentation improved
+ * - XMC_ASSERT() hanging issues have fixed for XMC4 devices.
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * - Removed STATIC_INLINE property for the below APIs and declared as void + * XMC_SCU_INTERRUPT_EnableEvent, XMC_SCU_INTERRUPT_DisableEvent, + * XMC_SCU_INTERRUPT_TriggerEvent, XMC_SCU_INTERUPT_GetEventStatus, + * XMC_SCU_INTERUPT_ClearEventStatus + * + * 2015-11-30: + * - Documentation improved
+ * + * 2016-03-09: + * - Optimization of write only registers + * + * @endcond + * + */ +#ifndef XMC_SCU_H +#define XMC_SCU_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup SCU + * @brief System Control Unit(SCU) driver for XMC microcontroller family. + * + * System control unit is the SoC power, reset and a clock manager with additional responsibility of + * providing system stability protection and other auxiliary functions.
+ * SCU provides the following features, + * -# Power control + \if XMC4 + * -# Hibernate control + \endif + * -# Reset control + * -# Clock control + * -# Miscellaneous control(boot mode, system interrupts etc.)

+ * + * The SCU driver is divided in to clock control logic, reset control logic, system interrupt control logic + \if XMC4 + * , hibernate control logic, trap control logic, parity control logic + \endif + * and miscellaneous control logic.
+ * + * Clock driver features: + * -# Allows clock configuration using the structure XMC_SCU_CLOCK_CONFIG_t and API XMC_SCU_CLOCK_Init() + \if XMC4 + * -# Provides structure XMC_SCU_CLOCK_SYSPLL_CONFIG_t for configuring the system PLL + * -# Allows selection of clock source for system PLL, XMC_SCU_CLOCK_GetSystemPllClockSource() + * -# Provides APIs for configuring different module clock frequencies XMC_SCU_CLOCK_SetWdtClockDivider(), XMC_SCU_CLOCK_SetUsbClockDivider() + * -# Allows selection of clock source for external output, XMC_SCU_CLOCK_SetExternalOutputClockSource() + * -# Provides APIs for enabling external high power oscillator and ultra low power oscillator, XMC_SCU_CLOCK_EnableHighPerformanceOscillator(), XMC_SCU_CLOCK_EnableLowPowerOscillator() + * -# Provides APIs for getting various clock frequencies XMC_SCU_CLOCK_GetPeripheralClockFrequency(), + XMC_SCU_CLOCK_GetCpuClockFrequency(), XMC_SCU_CLOCK_GetSystemClockFrequency()
+ \endif + \if XMC1 + * -# Allows selection of peripheral clock frequency, XMC_SCU_CLOCK_SetFastPeripheralClockSource() + * -# Provides API to get the peripheral clock frequency, XMC_SCU_CLOCK_GetFastPeripheralClockFrequency() + \endif + * + * Reset driver features: + \if XMC4 + * -# Allows to handle peripheral reset XMC_SCU_RESET_AssertPeripheralReset(), XMC_SCU_RESET_DeassertPeripheralReset() + * -# Allows configuration of NMI generation for selected events, XMC_SCU_INTERRUPT_EnableNmiRequest() + \endif + \if XMC1 + * -# Allows to trigger device reset XMC_SCU_RESET_AssertMasterReset() + * -# Allows to configure multiple sources for reset, XMC_SCU_RESET_EnableResetRequest() + \endif
+ * + * Interrupt driver features: + * -# Provides APIs for enabling/ disabling interrupt event generation XMC_SCU_INTERRUPT_EnableEvent(), + XMC_SCU_INTERRUPT_DisableEvent() + * -# Provides API for registering callback function for events XMC_SCU_INTERRUPT_SetEventHandler()
+ * + \if XMC4 + * Hibernate driver features: + * -# Allows configuration of hibernate domain XMC_SCU_HIB_EnableHibernateDomain(), XMC_SCU_HIB_DisableHibernateDomain() + * -# Allows selection of standby clock source, XMC_SCU_HIB_SetStandbyClockSource() + * -# Allows selection of RTC clock source, XMC_SCU_HIB_SetRtcClockSource() + * -# Provides API for enabling slow internal clock used for backup clock, XMC_SCU_HIB_EnableInternalSlowClock()
+ * + * Trap driver features: + * -# Allows handling of trap XMC_SCU_TRAP_Enable(), XMC_SCU_TRAP_GetStatus(), XMC_SCU_TRAP_Trigger()
+ * + * Parity driver features: + * -# Parity error generated by on-chip RAM can be monitored, XMC_SCU_PARITY_Enable(), XMC_SCU_PARITY_GetStatus() + * -# Allows configuration of trap generation on detection of parity error, XMC_SCU_PARITY_EnableTrapGeneration() + * + * Power driver features: + * -# Allows to power the USB module XMC_SCU_POWER_EnableUsb(), XMC_SCU_POWER_DisableUsb() + \endif + * + * Miscellaneous features: + * -# Allows to trigger multiple capture compare unit(CCU) channels to be started together XMC_SCU_SetCcuTriggerHigh() + \if XMC4 + * -# Enables configuration of out of range comparator (ORC) XMC_SCU_EnableOutOfRangeComparator() + * -# Enables configuration of die temperature sensor XMC_SCU_EnableTemperatureSensor(), XMC_SCU_CalibrateTemperatureSensor() + * -# Enables configuration of device boot mode XMC_SCU_SetBootMode()
+ \endif + \if XMC1 + * -# Enables configuration of die temperature sensor XMC_SCU_StartTempMeasurement(), XMC_SCU_SetRawTempLimits() + * -# Allows configuring supply monitor unit using the structure XMC_SCU_SUPPLYMONITOR_t and API XMC_SCU_SupplyMonitorInit() + * -# Allows handling of protected bits XMC_SCU_LockProtectedBits(), XMC_SCU_UnlockProtectedBits()
+ \endif + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +/** + * Defines the status of SCU API execution, used to verify the SCU related API calls. + */ +typedef enum XMC_SCU_STATUS +{ + XMC_SCU_STATUS_OK = 0UL, /**< SCU related operation successfully completed.*/ + XMC_SCU_STATUS_ERROR, /**< SCU related operation failed. When API cannot fulfill request, this value is returned. */ + XMC_SCU_STATUS_BUSY, /**< Cannot execute the SCU related operation request because + another operation is in progress. \a XMC_SCU_STATUS_BUSY is returned when API is busy + processing another request. */ +} XMC_SCU_STATUS_t; + + +/********************************************************************************************************************* + * DATA TYPES + ********************************************************************************************************************/ + +/** + * Function pointer type used for registering callback functions on SCU event occurrence. + */ +typedef void (*XMC_SCU_INTERRUPT_EVENT_HANDLER_t)(void); + +/********************************************************************************************************************* + * DEVICE EXTENSIONS + ********************************************************************************************************************/ + +#if (UC_FAMILY == XMC1) +#include +#elif (UC_FAMILY == XMC4) +#include +#else +#error "Unspecified chipset" +#endif + +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * + * @param trigger CCU slices to be triggered synchronously via software. The value is a bitmask of CCU slice bits + * in the register CCUCON.
+ * \b Range: Use type @ref XMC_SCU_CCU_TRIGGER_t for bitmask of individual CCU slices. Multiple slices can be + * combined using \a OR operation. + * + * @return None + * + * \parDescription
+ * Generates active edge(low to high) trigger for multiple CCU units at the same time.\n\n + * Before executing this API, all the required CCU timers should configure external start. + * The edge of the start signal should be selected as active edge. + * The input signal for the CCU slice should be selected as SCU input. + * The above mentioned configurations can be made using the CCU LLD API XMC_CCU4_SLICE_StartConfig(). + * CCU timer slice should be started using XMC_CCU4_SLICE_StartTimer() before triggering + * the timer using this API.
+ * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartConfig(), XMC_CCU4_SLICE_SetInput(), XMC_SCU_SetCcuTriggerLow()\n\n\n + */ +__STATIC_INLINE void XMC_SCU_SetCcuTriggerHigh(const uint32_t trigger) +{ + SCU_GENERAL->CCUCON |= (uint32_t)trigger; +} + +/** + * + * @param trigger CCU slices to be triggered synchronously via software. The value is a bitmask of CCU slice bits + * in the register CCUCON.
+ * \b Range: Use type @ref XMC_SCU_CCU_TRIGGER_t for bitmask of individual CCU slices. Multiple slices can be + * combined using \a OR operation. + * + * @return None + * + * \parDescription
+ * Generates passive edge(high to low) trigger for multiple CCU units at the same time.\n\n + * Before executing this API, all the required CCU timers should configure external start. + * The edge of the start signal should be selected as passive edge. + * The input signal for the CCU slice should be selected as SCU input. + * The above mentioned configurations can be made using the CCU LLD API XMC_CCU4_SLICE_StartConfig(). + * CCU timer slice should be started using XMC_CCU4_SLICE_StartTimer() before triggering + * the timer using this API.
+ * \parRelated APIs:
+ * XMC_CCU4_SLICE_StartConfig(), XMC_CCU4_SLICE_SetInput(), XMC_SCU_SetCcuTriggerHigh()\n\n\n + */ +__STATIC_INLINE void XMC_SCU_SetCcuTriggerLow(const uint32_t trigger) +{ + SCU_GENERAL->CCUCON &= (uint32_t)~trigger; +} + +/** + * + * @param config Pointer to structure holding the clock prescaler values and divider values for + * configuring clock generators and clock tree.\n + * \b Range: Configure the members of structure @ref XMC_SCU_CLOCK_CONFIG_t for various + * parameters of clock setup. + * + * @return None + * + * \parDescription
+ * Initializes clock generators and clock tree.\n\n + * \if XMC1 + * Peripheral clock and system clock are configured based on the input configuration \a config. + * The system clock frequency is tuned by configuring the FDIV and IDIV values of CLKCR register. + * The values of FDIV and IDIV can be provided as part of input configuration. + * The PCLK divider determines the ratio of peripheral clock to the system clock. + * The source of RTC clock is set based on the input configuration. + * \a SystemCoreClock variable will be updated with the value of + * system clock frequency. Access to protected bit fields are handled internally. + * \endif + * \if XMC4 + * Enables the high precision oscillator(fOHP) input and configures the system and peripheral clock frequencies. + * Based on the system clock source selected in \a config, either fPLL or fOFI will be chosen as system clock. + * Based on PLL mode(normal or prescaler mode) used, PLL ramps up in steps to achieve target frequency. + * The clock dividers for CPU, CCU and peripheral clocks will be set based on the input configuration. + * The \a SystemCoreClock variable is set with the value of system clock frequency. + * \endif + * \parRelated APIs:
+ * XMC_SCU_CLOCK_GetPeripheralClockFrequency(), XMC_SCU_CLOCK_GetCpuClockFrequency() \n\n\n + */ +void XMC_SCU_CLOCK_Init(const XMC_SCU_CLOCK_CONFIG_t *const config); + +/** + * + * @param event Bit mask of the event to enable. \b Range: Use type @ref XMC_SCU_INTERRUPT_EVENT_t + * for providing the input value. Multiple events can be combined using the \a OR operation. + * + * @return None + * + * \parDescription
+ * Enables the generation of interrupt for the input events.\n\n + * The events are enabled by setting the respective bit fields in the SRMSK register. \n + * Note: User should separately enable the NVIC node responsible for handling the SCU interrupt. + * The interrupt will be generated when the respective event occurs. + * \parRelated APIs:
+ * NVIC_EnableIRQ(), XMC_SCU_INTERRUPT_DisableEvent()\n\n\n + */ +void XMC_SCU_INTERRUPT_EnableEvent(const XMC_SCU_INTERRUPT_EVENT_t event); + + +/** + * + * @param event Bit mask of the event to disable. \b Range: Use type @ref XMC_SCU_INTERRUPT_EVENT_t + * for providing the input value. Multiple events can be combined using the \a OR operation. + * + * @return None + * + * \parDescription
+ * Disables generation of interrupt on occurrence of the input event.\n\n + * The events are disabled by resetting the respective bit fields in the SRMSK register. \n + * \parRelated APIs:
+ * NVIC_DisableIRQ(), XMC_SCU_INTERRUPT_EnableEvent()\n\n\n + */ +void XMC_SCU_INTERRUPT_DisableEvent(const XMC_SCU_INTERRUPT_EVENT_t event); + +/** + * + * @param event Bit mask of the event to be triggered. \b Range: Use type @ref XMC_SCU_INTERRUPT_EVENT_t + * for providing the input value. Multiple events can be combined using the \a OR operation. + * + * @return None + * + * \parDescription
+ * Triggers the event as if the hardware raised it.\n\n + * Event will be triggered by setting the respective bitfield in the SRSET register.\n + * Note: User should enable the NVIC node that handles the respective event for interrupt generation. + * \parRelated APIs:
+ * NVIC_EnableIRQ(), XMC_SCU_INTERUPT_GetEventStatus(), XMC_SCU_INTERRUPT_ClearEventStatus() \n\n\n + */ +void XMC_SCU_INTERRUPT_TriggerEvent(const XMC_SCU_INTERRUPT_EVENT_t event); + +/** + * @return uint32_t Status of the SCU events. + * + * \parDescription
+ * Provides the status of all SCU events.\n\n + * The status is read from the SRRAW register. To check the status of a particular + * event, the returned value should be masked with the bit mask of the event. The bitmask + * of events can be obtained using the type @ref XMC_SCU_INTERRUPT_EVENT_t. Multiple events' + * status can be checked by combining the bit masks using \a OR operation. + * After detecting the event, the event status should be cleared using software to detect the event again. + * \parRelated APIs:
+ * XMC_SCU_INTERRUPT_ClearEventStatus(), XMC_SCU_INTERRUPT_TriggerEvent(), XMC_SCU_INTERRUPT_SetEventHandler() \n\n\n + */ +XMC_SCU_INTERRUPT_EVENT_t XMC_SCU_INTERUPT_GetEventStatus(void); + +/** + * + * @param event Bit mask of the events to clear. \b Range: Use type @ref XMC_SCU_INTERRUPT_EVENT_t + * for providing the input value. Multiple events can be combined using the \a OR operation. + * + * @return None + * + * \parDescription
+ * Clears the event status bit in SRRAW register.\n\n + * The events are cleared by writing value 1 to their bit positions in the SRCLR register. + * The API can be used when polling method is used. After detecting the event, the event status + * should be cleared using software to detect the event again. + * + * \parRelated APIs:
+ * XMC_SCU_INTERUPT_GetEventStatus(), XMC_SCU_INTERRUPT_TriggerEvent() \n\n\n + */ +void XMC_SCU_INTERRUPT_ClearEventStatus(const XMC_SCU_INTERRUPT_EVENT_t event); + +/** + * + * @return uint32_t Status representing the reason for device reset. + * + * \parDescription
+ * Provides the value representing the reason for device reset.\n\n + * The return value is an encoded word, which can indicate multiple reasons for the last reset. Each bit position of the + * returned word is representative of a last reset cause. The returned value should be appropriately masked to check + * the cause of reset. + * The cause of the last reset gets automatically stored in + * the \a SCU_RSTSTAT register. The reset status shall be reset after each + * startup in order to ensure consistent source indication after the next reset. + * \b Range: The type @ref XMC_SCU_RESET_REASON_t can be used to get the bit masks of the reset cause. + * + * \parRelated APIs:
+ * XMC_SCU_RESET_ClearDeviceResetReason() \n\n\n + */ +__STATIC_INLINE uint32_t XMC_SCU_RESET_GetDeviceResetReason(void) +{ + return ((SCU_RESET->RSTSTAT) & SCU_RESET_RSTSTAT_RSTSTAT_Msk); +} +/** + * @return None + * + * \parDescription
+ * Clears the reset reason bits in the reset status register. \n\n + * Clearing of the reset status information in the \a SCU_RSTSTAT register via register bit \a RSTCLR.RSCLR is strongly + * recommended to ensure a clear indication of the cause of next reset. + * + * \parRelated APIs:
+ * XMC_SCU_RESET_GetDeviceResetReason() \n\n\n + */ +__STATIC_INLINE void XMC_SCU_RESET_ClearDeviceResetReason(void) +{ + /* Clear RSTSTAT.RSTSTAT bitfield */ + SCU_RESET->RSTCLR = (uint32_t)SCU_RESET_RSTCLR_RSCLR_Msk; +} + +/** + * @return uint32_t Value of CPU clock frequency. + * + * \parDescription
+ * Provides the vlaue of CPU clock frequency.\n\n + * The value is stored in a global variable \a \b SystemCoreClock. + * It is updated when the clock configuration is done using the SCU LLD APIs. + * The value represents the frequency of clock used for CPU operation. + * \b Range: Value is of type uint32_t, and gives the value of frequency in Hertz. + * + * \parRelated APIs:
+ * XMC_SCU_CLOCK_GetPeripheralClockFrequency(), XMC_SCU_CLOCK_GatePeripheralClock() \n\n\n + */ +__STATIC_INLINE uint32_t XMC_SCU_CLOCK_GetCpuClockFrequency(void) +{ + return SystemCoreClock; +} + +/** + * @return uint32_t Value of peripheral clock frequency in Hertz. + * + * \parDescription
+ * Provides the vlaue of clock frequency at which the peripherals are working.\n\n + * The value is derived from the CPU frequency. \b Range: Value is of type uint32_t. It is represented in Hertz. + * \parRelated APIs:
+ * XMC_SCU_CLOCK_GetCpuClockFrequency(),XMC_SCU_CLOCK_GatePeripheralClock() \n\n\n + */ +uint32_t XMC_SCU_CLOCK_GetPeripheralClockFrequency(void); + +#if(UC_SERIES != XMC45) + +/** + * + * @param peripheral The peripheral for which the clock has to be gated. \b Range: Use type @ref XMC_SCU_PERIPHERAL_CLOCK_t + * to identify the peripheral clock to be gated. + * + * @return None + * + * \parDescription
+ * Blocks the supply of clock to the selected peripheral.\n\n + * Clock gating helps in reducing the power consumption. User can selectively gate the clocks of unused peripherals. + * \if XMC1 + * fPCLK is the source of clock to various peripherals. Some peripherals support clock gate. Such a gate blocks + * the clock supply for the selected peripheral. + * Software can request for individual gating of such peripheral clocks by enabling the \a SCU_CGATSET0 + * register bit field. Every bit in \a SCU_CGATSET0 register is protected by the bit protection scheme. Access to protected + * bit fields are handled internally. + * \endif + * \if XMC4 + * fPERI is the source of clock to various peripherals. Some peripherals support clock gate. Such a gate blocks + * the clock supply for the selected peripheral. + * Software can request for individual gating of such peripheral clocks by enabling one of the \a + * SCU_CGATSET0, \a SCU_CGATSET1 or \a SCU_CGATSET2 register bitfields. + * + * \endif + * Note: Clock gating shall not be activated unless the module is in reset state. So use \a + * XMC_SCU_CLOCK_IsPeripheralClockGated() API before enabling the gating of any peripheral. + * \parRelated APIs:
+ * XMC_SCU_CLOCK_IsPeripheralClockGated(), XMC_SCU_CLOCK_UngatePeripheralClock() \n\n\n + */ +void XMC_SCU_CLOCK_GatePeripheralClock(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral); + +/** + * + * @param peripheral The peripheral for which the clock has to be ungated. \b Range: Use type @ref XMC_SCU_PERIPHERAL_CLOCK_t + * to identify the peripheral. + * + * @return None + * + * \parDescription
+ * Enables the supply of clock to the selected peripheral.\n\n + * By default when the device powers on, the peripheral clock will be gated for the + * peripherals that support clock gating. + * The peripheral clock should be enabled before using it for any functionality. + * \if XMC1 + * fPCLK is the source of clock to various peripherals. Some peripherals support clock gate. + * Software can request for individual ungating of such peripheral clocks by setting respective bits + * in the \a SCU_CGATCLR0 register. + * \endif + * \if XMC4 + * fPERI is the source of clock to various peripherals. Some peripherals support clock gate. + * Software can request for individual ungating of such peripheral clocks by setting the respective bits in one of \a + * SCU_CGATCLR0, \a SCU_CGATCLR1 or \a SCU_CGATCLR2 registers. + * \endif + * + * \parRelated APIs:
+ * XMC_SCU_CLOCK_IsPeripheralClockGated(), XMC_SCU_CLOCK_GatePeripheralClock() \n\n\n + */ +void XMC_SCU_CLOCK_UngatePeripheralClock(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral); + +/** + * + * @param peripheral The peripheral for which the check for clock gating has to be done. + * \b Range: Use type @ref XMC_SCU_PERIPHERAL_CLOCK_t to identify the peripheral. + * + * @return bool Status of the peripheral clock gating. \b Range: true if the peripheral clock is gated. + * false if the peripheral clock ungated(gate de-asserted). + * + * \parDescription
+ * Gives the status of peripheral clock gating.\n\n + * \if XMC1 + * Checks the status of peripheral clock gating using the register CGATSTAT0. + * \endif + * \if XMC4 + * Checks the status of peripheral clock gating using one of CGATSTAT0, CGATSTAT1 or CGATSTAT2 registers. + * \endif + * It is recommended to use this API before + * enabling the gating of any peripherals through \a XMC_SCU_CLOCK_GatePeripheralClock() API. + * + * \parRelated APIs:
+ * XMC_SCU_CLOCK_UngatePeripheralClock(), XMC_SCU_CLOCK_GatePeripheralClock() \n\n\n + */ +bool XMC_SCU_CLOCK_IsPeripheralClockGated(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral); +#endif + + +/** + * @return uint32_t Status of the register mirror update.\n + * \b Range: Use the bit mask of the SCU_GENERAL_MIRRSTS register for the mirror update event of + * interest. e.g.: SCU_GENERAL_MIRRSTS_RTC_CTR_Msk. Multiple update events can be combined + * using \a OR operation. + * + * \parDescription
+ * Provides the status of hibernate domain register update, when the respective mirror registers are changed. \n\n + * The hibernate domain is connected to the core domain via SPI serial communication. MIRRSTS is a status register + * representing the communication of changed value of a mirror register to its corresponding register in the + * hibernate domain. The bit fields of the register indicate + * that a corresponding register of the hibernate domain is ready to accept a write or that the communication interface + * is busy with executing the previous operation.\n + * Note: There is no hibernate domain in XMC1x devices. This register is retained for legacy purpose. + */ +__STATIC_INLINE uint32_t XMC_SCU_GetMirrorStatus(void) +{ + return(SCU_GENERAL->MIRRSTS); +} + +/** + * @param event The event for which the interrupt handler is to be configured. \n + * \b Range: Use type @ref XMC_SCU_INTERRUPT_EVENT_t for identifying the event. + * @param handler Name of the function to be executed when the event if detected. \n + * \b Range: The function accepts no arguments and returns no value. + * @return XMC_SCU_STATUS_t Status of configuring the event handler function for the selected event.\n + * \b Range: \a XMC_SCU_STATUS_OK if the event handler is successfully configured.\n + * \a XMC_SCU_STATUS_ERROR if the input event is invalid.\n + * \parDescription
+ * Assigns the event handler function to be executed on occurrence of the selected event.\n\n + * If the input event is valid, the handler function will be assigned to a table to be executed + * when the interrupt is generated and the event status is set in the event status register. By using this API, + * polling for a particular event can be avoided. This way the CPU utilization will be optimized. Multiple SCU events + * can generate a common interrupt. When the interrupt is generated, a common interrupt service routine is executed. + * It checks for status flags of events which can generate the interrupt. The handler function will be executed if the + * event flag is set. + * + * \parRelated APIs:
+ * XMC_SCU_INTERRUPT_TriggerEvent(), XMC_SCU_INTERUPT_GetEventStatus() \n\n\n + */ +XMC_SCU_STATUS_t XMC_SCU_INTERRUPT_SetEventHandler(const XMC_SCU_INTERRUPT_EVENT_t event, const XMC_SCU_INTERRUPT_EVENT_HANDLER_t handler); + +/** + * @param sr_num Service request number identifying the SCU interrupt generated.\n + * \b Range: 0 to 2. XMC4x devices have one common SCU interrupt, so the value should be 0.\n + * But XMC1x devices support 3 interrupt nodes. + * @return None + * \parDescription
+ * A common function to execute callback functions for multiple events.\n\n + * It checks for the status of events which can generate the interrupt with the selected service request. + * If the event is set, the corresponding callback function will be executed. It also clears the event status bit.\n + * \b Note: This is an internal function. It should not be called by the user application. + * + * \parRelated APIs:
+ * XMC_SCU_INTERRUPT_SetEventHandler() \n\n\n + */ +void XMC_SCU_IRQHandler(uint32_t sr_num); + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* SCU_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_spi.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_spi.h new file mode 100644 index 00000000..ec1de7e8 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_spi.h @@ -0,0 +1,1279 @@ +/** + * @file xmc_spi.h + * @date 2016-05-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial + * + * 2015-05-20: + * - Documentation improved
+ * - Added XMC_SPI_CH_SetSlaveSelectDelay(), XMC_SPI_CH_TriggerServiceRequest() and + * XMC_SPI_CH_SelectInterruptNodePointer()
+ * - Added XMC_SPI_CH_SetInterwordDelaySCLK()
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-08-24: + * - Added APIs for enabling/disabling delay compensation XMC_SPI_CH_DisableDelayCompensation() and + * XMC_SPI_CH_EnableDelayCompensation()
+ * + * 2015-08-27: + * - Added APIs for external input for BRG configuration:XMC_SPI_CH_ConfigExternalInputSignalToBRG()
+ * + * 2015-09-01: + * - Modified XMC_SPI_CH_SetInputSource() for avoiding complete DXCR register overwriting.
+ * - Modified XMC_SPI_CH_EVENT_t enum for supporting XMC_SPI_CH_EnableEvent() and XMC_SPI_CH_DisableEvent() + * for supporting multiple events configuration
+ * + * 2015-09-08: + * - Adding API for configuring the receiving clock phase in the slave:XMC_SPI_CH_DataLatchedInTrailingEdge() and XMC_SPI_CH_DataLatchedInLeadingEdge()
+ * + * 2016-04-10: + * - Added an API for configuring the transmit mode:XMC_SPI_CH_SetTransmitMode()
+ * + * 2016-05-20: + * - Added XMC_SPI_CH_EnableDataTransmission() and XMC_SPI_CH_DisableDataTransmission() + * + * @endcond + * + */ + +#ifndef XMC_SPI_H +#define XMC_SPI_H + +/********************************************************************************************************************** + * HEADER FILES + *********************************************************************************************************************/ +#include "xmc_usic.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup SPI + * @brief Synchronous serial channel driver for SPI-like communication. + * + * The SPI driver uses Universal Serial Interface Channel(USIC) module. + * The USIC module supports multiple data lines for SPI communication. \n + * -# Full duplex communication with 2 separate lines for transmission and reception. + * -# Half duplex communication with 1 common line shared for transmission and reception. + * -# Dual mode communication with 2 common lines shared for transmission and reception. + * -# Quad mode communication with 4 common lines shared for transmission and reception.

+ * + * SPI driver provides structures, enumerations and APIs for configuring the USIC channel for SPI communication + * and also for data transaction.
+ * SPI driver features: + * -# Configuration structure XMC_SPI_CH_CONFIG_t and SPI initialization function XMC_SPI_CH_Init() + * -# Allows configuration of protocol word and frame length using XMC_SPI_CH_SetWordLength(), XMC_SPI_CH_SetFrameLength() + * -# Allows manipulation of data frame at runtime using XMC_SPI_CH_EnableSOF(), XMC_SPI_CH_EnableEOF(), + XMC_SPI_CH_EnableSlaveSelect(), XMC_SPI_CH_DisableSlaveSelect() + * -# Provides APIs for transmitting data and receiving data using XMC_SPI_CH_Transmit(), XMC_SPI_CH_Receive(), XMC_SPI_CH_GetReceivedData() + * -# Allows configuration of shift clock using XMC_SPI_CH_ConfigureShiftClockOutput() + * -# Provides enumeration of SPI protocol events using @ref XMC_SPI_CH_STATUS_FLAG_t + * @{ + */ + +/*********************************************************************************************************************** + * MACROS + **********************************************************************************************************************/ + +#if defined(USIC0) +#define XMC_SPI0_CH0 XMC_USIC0_CH0 /**< SPI0 channel 0 base address */ +#define XMC_SPI0_CH1 XMC_USIC0_CH1 /**< SPI0 channel 1 base address */ +#endif + +#if defined(USIC1) +#define XMC_SPI1_CH0 XMC_USIC1_CH0 /**< SPI1 channel 0 base address */ +#define XMC_SPI1_CH1 XMC_USIC1_CH1 /**< SPI1 channel 1 base address */ +#endif + +#if defined(USIC2) +#define XMC_SPI2_CH0 XMC_USIC2_CH0 /**< SPI2 channel 0 base address */ +#define XMC_SPI2_CH1 XMC_USIC2_CH1 /**< SPI2 channel 1 base address */ +#endif + +/*********************************************************************************************************************** + * ENUMS + ***********************************************************************************************************************/ + +/** + * Defines return status of SPI driver APIs + */ +typedef enum XMC_SPI_CH_STATUS +{ + XMC_SPI_CH_STATUS_OK, /**< Status of the Module: OK */ + XMC_SPI_CH_STATUS_ERROR, /**< Status of the Module: ERROR */ + XMC_SPI_CH_STATUS_BUSY /**< The Module is busy */ +} XMC_SPI_CH_STATUS_t; +/** + * Defines the SPI bus mode + */ +typedef enum XMC_SPI_CH_BUS_MODE +{ + XMC_SPI_CH_BUS_MODE_MASTER, /**< SPI Master */ + XMC_SPI_CH_BUS_MODE_SLAVE /**< SPI Slave */ +} XMC_SPI_CH_BUS_MODE_t; + +/** + * Defines the Polarity of the slave select signals SELO[7:0] in relation to the master slave select signal MSLS. + */ +typedef enum XMC_SPI_CH_SLAVE_SEL_MSLS_INV +{ + XMC_SPI_CH_SLAVE_SEL_SAME_AS_MSLS = 0x0UL, /**< The SELO outputs have the same polarity as the MSLS signal + (active high) */ + XMC_SPI_CH_SLAVE_SEL_INV_TO_MSLS = 0x1UL << USIC_CH_PCR_SSCMode_SELINV_Pos /**< The SELO outputs have the inverted + polarity to the MSLS signal + (active low)*/ +} XMC_SPI_CH_SLAVE_SEL_MSLS_INV_t; + +/** + * Defines the Polarity of the data inputs. + */ +typedef enum XMC_SPI_CH_DATA_POLARITY +{ + XMC_SPI_CH_DATA_POLARITY_DIRECT = 0x0UL, /**< The polarity of the data line is not inverted */ + XMC_SPI_CH_DATA_POLARITY_INVERT = 0x1UL << USIC_CH_DX2CR_DPOL_Pos /**< The polarity of the data line is inverted */ +} XMC_SPI_CH_DATA_POLARITY_t; + +/** + * Defines Slave Select lines + */ +typedef enum XMC_SPI_CH_SLAVE_SELECT +{ + XMC_SPI_CH_SLAVE_SELECT_0 = 1UL << USIC_CH_PCR_SSCMode_SELO_Pos, /**< Slave Select line 0 */ + XMC_SPI_CH_SLAVE_SELECT_1 = 2UL << USIC_CH_PCR_SSCMode_SELO_Pos, /**< Slave Select line 1 */ + XMC_SPI_CH_SLAVE_SELECT_2 = 4UL << USIC_CH_PCR_SSCMode_SELO_Pos, /**< Slave Select line 2 */ + XMC_SPI_CH_SLAVE_SELECT_3 = 8UL << USIC_CH_PCR_SSCMode_SELO_Pos, /**< Slave Select line 3 */ + XMC_SPI_CH_SLAVE_SELECT_4 = 16UL << USIC_CH_PCR_SSCMode_SELO_Pos, /**< Slave Select line 4 */ + XMC_SPI_CH_SLAVE_SELECT_5 = 32UL << USIC_CH_PCR_SSCMode_SELO_Pos, /**< Slave Select line 5 */ + XMC_SPI_CH_SLAVE_SELECT_6 = 64UL << USIC_CH_PCR_SSCMode_SELO_Pos, /**< Slave Select line 6 */ + XMC_SPI_CH_SLAVE_SELECT_7 = 128UL << USIC_CH_PCR_SSCMode_SELO_Pos /**< Slave Select line 7 */ +} XMC_SPI_CH_SLAVE_SELECT_t; + +/** + * Defines SPI specific events + */ +typedef enum XMC_SPI_CH_EVENT +{ + XMC_SPI_CH_EVENT_RECEIVE_START = USIC_CH_CCR_RSIEN_Msk, /**< Receive start event */ + XMC_SPI_CH_EVENT_DATA_LOST = USIC_CH_CCR_DLIEN_Msk, /**< Data lost event */ + XMC_SPI_CH_EVENT_TRANSMIT_SHIFT = USIC_CH_CCR_TSIEN_Msk, /**< Transmit shift event */ + XMC_SPI_CH_EVENT_TRANSMIT_BUFFER = USIC_CH_CCR_TBIEN_Msk, /**< Transmit buffer event */ + XMC_SPI_CH_EVENT_STANDARD_RECEIVE = USIC_CH_CCR_RIEN_Msk, /**< Receive event */ + XMC_SPI_CH_EVENT_ALTERNATIVE_RECEIVE = USIC_CH_CCR_AIEN_Msk, /**< Alternate receive event */ + XMC_SPI_CH_EVENT_BAUD_RATE_GENERATOR = USIC_CH_CCR_BRGIEN_Msk, /**< Baudrate generator event */ + + XMC_SPI_CH_EVENT_PARITY_ERROR = USIC_CH_PCR_SSCMode_PARIEN_Msk >> 13U, /**< Parity error event */ + XMC_SPI_CH_EVENT_MSLS_CHANGE = USIC_CH_PCR_SSCMode_MSLSIEN_Msk >> 13U, /**< Master slave select(MSLS) output transition event*/ + XMC_SPI_CH_EVENT_DX2TIEN_ACTIVATED = USIC_CH_PCR_SSCMode_DX2TIEN_Msk >> 13U /**< Slave select input signal transition event*/ +} XMC_SPI_CH_EVENT_t; + +/** + * Defines SPI event status + */ +typedef enum XMC_SPI_CH_STATUS_FLAG +{ + XMC_SPI_CH_STATUS_FLAG_MSLS = USIC_CH_PSR_SSCMode_MSLS_Msk, /**< Status of Master slave + select(MSLS) signal */ + XMC_SPI_CH_STATUS_FLAG_DX2S = USIC_CH_PSR_SSCMode_DX2S_Msk, /**< Status of slave select + input(DX2) signal*/ + XMC_SPI_CH_STATUS_FLAG_MSLS_EVENT_DETECTED = USIC_CH_PSR_SSCMode_MSLSEV_Msk, /**< Status for master slave select + output signal transition*/ + XMC_SPI_CH_STATUS_FLAG_DX2T_EVENT_DETECTED = USIC_CH_PSR_SSCMode_DX2TEV_Msk, /**< Status for slave select + input signal transition */ + XMC_SPI_CH_STATUS_FLAG_PARITY_ERROR_EVENT_DETECTED = USIC_CH_PSR_SSCMode_PARERR_Msk, /**< Indicates status of the + parity error */ + XMC_SPI_CH_STATUS_FLAG_RECEIVER_START_INDICATION = USIC_CH_PSR_SSCMode_RSIF_Msk, /**< Status for receive start + event */ + XMC_SPI_CH_STATUS_FLAG_DATA_LOST_INDICATION = USIC_CH_PSR_SSCMode_DLIF_Msk, /**< Status for data lost event*/ + XMC_SPI_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION = USIC_CH_PSR_SSCMode_TSIF_Msk, /**< Status for transmit shift + event */ + XMC_SPI_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION = USIC_CH_PSR_SSCMode_TBIF_Msk, /**< Status for transmit buffer + event */ + XMC_SPI_CH_STATUS_FLAG_RECEIVE_INDICATION = USIC_CH_PSR_SSCMode_RIF_Msk, /**< Status for receive event */ + XMC_SPI_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION = USIC_CH_PSR_SSCMode_AIF_Msk, /**< Status for alternative + receive event */ + XMC_SPI_CH_STATUS_FLAG_BAUD_RATE_GENERATOR_INDICATION = USIC_CH_PSR_SSCMode_BRGIF_Msk/**< Status for baud rate + generation error event */ +} XMC_SPI_CH_STATUS_FLAG_t; + +/** + * Defines input frequency sources for slave select signal delay configuration. + */ +typedef enum XMC_SPI_CH_INPUT_FREQ_SLAVE_SELECT_DELAY +{ + XMC_SPI_CH_INPUT_FREQ_SLAVE_SELECT_DELAY_FPDIV = 0x0UL, /**< Output of PDIV divider: FPDIV */ + XMC_SPI_CH_INPUT_FREQ_SLAVE_SELECT_DELAY_FPPP = 0x1UL << USIC_CH_PCR_SSCMode_CTQSEL1_Pos, /**< Peripheral clock: FPPP */ + XMC_SPI_CH_INPUT_FREQ_SLAVE_SELECT_DELAY_FSCLK = 0x2UL << USIC_CH_PCR_SSCMode_CTQSEL1_Pos, /**< Shift clock: FSCLK */ + XMC_SPI_CH_INPUT_FREQ_SLAVE_SELECT_DELAY_FMCLK = 0x3UL << USIC_CH_PCR_SSCMode_CTQSEL1_Pos /**< Master clock: FMCLK */ +} XMC_SPI_CH_INPUT_FREQ_SLAVE_SELECT_DELAY_t; + +/** + * Define data and clock input stages + */ +typedef enum XMC_SPI_CH_INPUT +{ + XMC_SPI_CH_INPUT_DIN0 = 0UL, /**< Data input stage 0 */ + XMC_SPI_CH_INPUT_SLAVE_SCLKIN = 1UL, /**< Clock input stage */ + XMC_SPI_CH_INPUT_SLAVE_SELIN = 2UL, /**< Slave select input stage */ + XMC_SPI_CH_INPUT_DIN1 = 3UL, /**< Data input stage 1 */ + XMC_SPI_CH_INPUT_DIN2 = 4UL, /**< Data input stage 2 */ + XMC_SPI_CH_INPUT_DIN3 = 5UL /**< Data input stage 3 */ +} XMC_SPI_CH_INPUT_t; + +/** + * Define SPI data transfer mode + */ +typedef enum XMC_SPI_CH_MODE +{ + XMC_SPI_CH_MODE_STANDARD = 0UL, /**< SPI standard full duplex mode */ + XMC_SPI_CH_MODE_STANDARD_HALFDUPLEX = 4UL, /**< SPI standard half duplex mode */ + XMC_SPI_CH_MODE_DUAL= 6UL, /**< SPI half duplex mode with dual data lines */ + XMC_SPI_CH_MODE_QUAD= 7UL /**< SPI half duplex mode with quad data lines */ +} XMC_SPI_CH_MODE_t; + + +/** + * SPI Baudrate Generator shift clock passive level + */ +typedef enum XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL +{ + /**< Passive clock level 0, delay disabled */ + XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_DISABLED = XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_DISABLED, + /**< Passive clock level 1, delay disabled */ + XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_DISABLED = XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_DISABLED, + /**< Passive clock level 0, delay enabled */ + XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_ENABLED = XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_ENABLED, + /**< Passive clock level 1, delay enabled */ + XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_ENABLED = XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_ENABLED +} XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t; + +/** + * SPI Baudrate Generator shift clock output +*/ +typedef enum XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT +{ + XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK = XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK, /**< Baudrate Generator shift clock output: SCLK*/ + XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT_DX1 = XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_DX1 /**< Clock obtained as input from master: DX1*/ +} XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT_t; + +/** + * SPI channel interrupt node pointers + */ +typedef enum XMC_SPI_CH_INTERRUPT_NODE_POINTER +{ + XMC_SPI_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, /**< Node pointer for transmit shift interrupt */ + XMC_SPI_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER, /**< Node pointer for transmit buffer interrupt */ + XMC_SPI_CH_INTERRUPT_NODE_POINTER_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_RECEIVE, /**< Node pointer for receive interrupt */ + XMC_SPI_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE, /**< Node pointer for alternate receive interrupt */ + XMC_SPI_CH_INTERRUPT_NODE_POINTER_PROTOCOL = XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL /**< Node pointer for protocol related interrupts */ +} XMC_SPI_CH_INTERRUPT_NODE_POINTER_t; + +/********************************************************************************************************************** + * DATA STRUCTURES +**********************************************************************************************************************/ + +/** + * Structure for initializing SPI channel. + */ +typedef struct XMC_SPI_CH_CONFIG +{ + uint32_t baudrate; /**< Module baud rate for communication */ + XMC_SPI_CH_BUS_MODE_t bus_mode; /**< Bus mode: Master/Slave */ + XMC_SPI_CH_SLAVE_SEL_MSLS_INV_t selo_inversion; /**< Enable inversion of Slave select signal relative to the internal + MSLS signal */ + XMC_USIC_CH_PARITY_MODE_t parity_mode; /**< Enable parity check for transmit and received data */ +} XMC_SPI_CH_CONFIG_t; + +/********************************************************************************************************************** + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param config pointer to constant SPI channel configuration data structure.\n + * Refer data structure @ref XMC_SPI_CH_CONFIG_t for detail. + * + * @return None + * + * \parDescription:
+ * Initializes the selected SPI \a channel with the \a config structure.\n\n + * Enable SPI channel by calling XMC_USIC_CH_Enable() and then configures + *
    + *
  • Baudrate,
  • + *
  • Passive data level as active high,
  • + *
  • Shift control signal as active high,
  • + *
  • Frame length as 64U,
  • + *
  • Word length as 8U,
  • + *
  • Enable Hardware port control mode,
  • + *
  • Enable transmission of data TDV(Transmit data valid) bit is set to 1,
  • + *
  • Enable invalidation of data in TBUF once loaded into shift register,
  • + *
  • Parity mode settings
  • + *
+ * And if master mode is selected, + *
    + *
  • Enables MSLS signal generation,
  • + *
  • configures slave selection as normal mode,
  • + *
  • Set polarity for the Slave signal,
  • + *
  • Enable Frame end mode(MSLS signal is kept active after transmission of a frame)
  • + *
+ */ +void XMC_SPI_CH_Init(XMC_USIC_CH_t *const channel, const XMC_SPI_CH_CONFIG_t *const config); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Set the selected USIC channel to operate in SPI mode, by setting CCR.MODE bits.\n\n + * It should be executed after XMC_SPI_CH_Init() during initialization. By invoking XMC_SPI_CH_Stop(), the MODE is set + * to IDLE state. Call XMC_SPI_CH_Start() to set the SPI mode again, as needed later in the program. + * + * \parRelated APIs:
+ * XMC_SPI_CH_Init(), XMC_SPI_CH_Stop() + */ +__STATIC_INLINE void XMC_SPI_CH_Start(XMC_USIC_CH_t *const channel) +{ + /* USIC channel in SPI mode */ + XMC_USIC_CH_SetMode(channel, XMC_USIC_CH_OPERATING_MODE_SPI); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return XMC_SPI_CH_STATUS_t Status of the SPI driver after the request for stopping is processed. \n + * XMC_SPI_CH_STATUS_OK- If the USIC channel is successfully put to IDLE mode. \n + * XMC_SPI_CH_STATUS_BUSY- If the USIC channel is busy transmitting data. + * + * \parDescription:
+ * Set the selected SPI channel to IDLE mode, by clearing CCR.MODE bits.\n\n + * After calling XMC_SPI_CH_Stop, channel is IDLE mode. So no communication is supported. XMC_SPI_CH_Start() has to be + * invoked to start the communication again. + * + * \parRelated APIs:
+ * XMC_SPI_CH_Start() + */ +XMC_SPI_CH_STATUS_t XMC_SPI_CH_Stop(XMC_USIC_CH_t *const channel); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param rate Bus speed in bits per second + * + * @return XMC_SPI_CH_STATUS_t Status of the SPI driver after the request for setting baudrate is processed. \n + * XMC_SPI_CH_STATUS_OK- If the baudrate is successfully changed. \n + * XMC_SPI_CH_STATUS_ERROR- If the new baudrate value is out of range. + * + * \parDescription:
+ * Sets the bus speed in bits per second + * + * \parRelated APIs:
+ * XMC_SPI_CH_Init(), XMC_SPI_CH_Stop() + */ +XMC_SPI_CH_STATUS_t XMC_SPI_CH_SetBaudrate(XMC_USIC_CH_t *const channel, const uint32_t rate); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param slave Slave select signal.\n + * Refer @ref XMC_SPI_CH_SLAVE_SELECT_t for valid values. + * + * @return None + * + * \parDescription:
+ * Enable the selected slave signal by setting PCR.SELO bits.\n\n + * Each slave is connected with one slave select signal. This is not configured in XMC_SPI_CH_Init(). Invoke + * XMC_SPI_CH_EnableSlaveSelect() with required \a slave to to start the communication. After finishing the + * communication XMC_SPI_CH_DisableSlaveSelect() can be invoked to disable the slaves. + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableSlaveSelect() + */ +void XMC_SPI_CH_EnableSlaveSelect(XMC_USIC_CH_t *const channel, const XMC_SPI_CH_SLAVE_SELECT_t slave); + +/** + * @param channel A constant ponter to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Disable all the slave signals by clearing PCR.SELO bits.\n\n + * XMC_SPI_CH_EnableSlaveSelect() has to be invoked to start the communication with the desired slave again. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableSlaveSelect() + */ +void XMC_SPI_CH_DisableSlaveSelect(XMC_USIC_CH_t *const channel); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param mode Communication mode of the SPI, based on this mode TCI(Transmit control information)is updated.\n + * Refer @ref XMC_SPI_CH_MODE_t for valid values. + * + * @return None + * + * \parDescription:
+ * In Dual and Quad modes, hardware port control(CCR.HPCEN) mode is enabled. \n\n + * By enabling this the direction of the data pin is updated by hardware itself. Before transmitting the data set the + * mode to ensure the proper communication. + * + * \parRelated APIs:
+ * XMC_SPI_CH_Transmit() + */ +__STATIC_INLINE void XMC_SPI_CH_SetTransmitMode(XMC_USIC_CH_t *const channel, const XMC_SPI_CH_MODE_t mode) +{ + channel->CCR = (channel->CCR & (uint32_t)(~USIC_CH_CCR_HPCEN_Msk)) | + (((uint32_t) mode << USIC_CH_CCR_HPCEN_Pos) & (uint32_t)USIC_CH_CCR_HPCEN_Msk); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param data Data to be transmitted + * @param mode Communication mode of the SPI, based on this mode TCI(Transmit control information)is updated.\n + * Refer @ref XMC_SPI_CH_MODE_t for valid values. + * + * @return None + * + * \parDescription:
+ * Puts the data into FIFO, if FIFO mode is enabled or else into standard buffer, by setting the proper mode.\n\n + * In Dual and Quad modes, hardware port control(CCR.HPCEN) mode is enabled. By enabling this the direction of the data + * pin is updated by hardware itself. TCI(Transmit Control Information) allows dynamic control of both the data shift mode + * and pin direction during data transfers by writing to SCTR.DSM and SCTR.HPCDIR bit fields. To support this auto + * update, TCSR.HPCMD(Hardware Port control) will be enabled during the initialization using XMC_SPI_CH_Init() for all modes. + * + * + * \parRelated APIs:
+ * XMC_SPI_CH_Receive() + */ +void XMC_SPI_CH_Transmit(XMC_USIC_CH_t *const channel, const uint16_t data, const XMC_SPI_CH_MODE_t mode); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param mode Communication mode of the SPI, based on this mode TCI(Transmit control information)is updated.\n + * Refer @ref XMC_SPI_CH_MODE_t for valid values. + * + * @return None + * + * \parDescription:
+ * Transmits a dummy data(FFFFH) to provide clock for slave and receives the data from the slave.\n\n + * XMC_SPI_CH_Receive() receives the data and places it into buffer based on the FIFO selection. After reception of data + * XMC_SPI_CH_GetReceivedData() can be invoked to read the data from the buffers. + * + * \parRelated APIs:
+ * XMC_SPI_CH_GetReceivedDaa() + */ +__STATIC_INLINE void XMC_SPI_CH_Receive(XMC_USIC_CH_t *const channel, const XMC_SPI_CH_MODE_t mode) +{ + /* Transmit dummy data */ + XMC_SPI_CH_Transmit(channel, (uint16_t)0xffffU, (XMC_SPI_CH_MODE_t)((uint16_t)mode & 0xfffbU)); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return uint16_t Data read from the receive buffer. + * + * \parDescription:
+ * Reads data from the receive buffer based on the FIFO selection.\n\n + * Invocation of XMC_SPI_CH_Receive() receives the data and place it into receive buffer. After receiving the data + * XMC_SPI_CH_GetReceivedData() can be used to read the data from the buffer. + * + * \parRelated APIs:
+ * XMC_SPI_CH_Receive() + */ +uint16_t XMC_SPI_CH_GetReceivedData(XMC_USIC_CH_t *const channel); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Set the order of data transfer from LSB to MSB, by clearing SCTR.SDIR bit.\n\n + * This is typically based on the slave settings. Invoke XMC_SPI_CH_SetBitOrderLsbFirst() to set direction as needed in + * the program. + * + * \parRelated APIs:
+ * XMC_SPI_CH_SetBitOrderMsbFirst() + */ +__STATIC_INLINE void XMC_SPI_CH_SetBitOrderLsbFirst(XMC_USIC_CH_t *const channel) +{ + channel->SCTR &= (uint32_t)~USIC_CH_SCTR_SDIR_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Set the order of data transfer from MSB to LSB, by setting SCTR.SDIR bit.\n\n + * This is typically based on the slave settings. This is not set during XMC_SPI_CH_Init(). + * Invoke XMC_SPI_CH_SetBitOrderMsbFirst() to set direction as needed in the program. + * + * \parRelated APIs:
+ * XMC_SPI_CH_SetBitOrderLsbFirst() + */ +__STATIC_INLINE void XMC_SPI_CH_SetBitOrderMsbFirst(XMC_USIC_CH_t *const channel) +{ + channel->SCTR |= (uint32_t)USIC_CH_SCTR_SDIR_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param event Protocol events which have to be enabled. + * Refer @ XMC_SPI_CH_EVENT_t for valid values. OR combinations of these enum items can be used + * as input. + * + * @return None + * + * \parDescription:
+ * Enables the SPI protocol specific events, by configuring PCR register.\n\n + * Events can be enabled as needed using XMC_SPI_CH_EnableEvent(). + * XMC_SPI_CH_DisableEvent() can be used to disable the events. + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableEvent() + */ +void XMC_SPI_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param event Protocol events which have to be disabled. + * Refer @ XMC_SPI_CH_EVENT_t for valid values. OR combinations of these enum item can be used + * as input. + * + * @return None + * + * \parDescription:
+ * Disables the SPI protocol specific events, by configuring PCR register.\n\n + * After disabling the events, XMC_SPI_CH_EnableEvent() has to be invoked to re-enable the events. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableEvent() + */ +void XMC_SPI_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return uint32_t Status of SPI protocol events. + * + * \parDescription:
+ * Returns the status of the events, by reading PSR register.\n\n + * This indicates the status of the all the events, for SPI communication. + * + * \parRelated APIs:
+ * XMC_SPI_CH_ClearStatusFlag() + */ +__STATIC_INLINE uint32_t XMC_SPI_CH_GetStatusFlag(XMC_USIC_CH_t *const channel) +{ + return channel->PSR_SSCMode; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param flag Protocol event status to be cleared for detection of next occurence. + * Refer @ XMC_SPI_CH_STATUS_FLAG_t for valid values. OR combinations of these enum item can be used + * as input. + * @return None + * + * \parDescription:
+ * Clears the events specified, by setting PSCR register.\n\n + * During communication the events occurred have to be cleared to detect their next occurence.\n + * e.g: During transmission Transmit buffer event occurs to indicating data word transfer has started. This + * event has to be cleared after transmission of each data word. Otherwise next event cannot be recognized. + * + * \parRelated APIs:
+ * XMC_SPI_CH_GetStatusFlag() + */ +__STATIC_INLINE void XMC_SPI_CH_ClearStatusFlag(XMC_USIC_CH_t *const channel, const uint32_t flag) +{ + channel->PSCR |= flag; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Enables the generation of Master clock by setting PCR.MCLK bit.\n\n + * This clock can be used as a clock reference for external devices. This is not enabled during initialization in + * XMC_SPI_CH_Init(). Invoke XMC_SPI_CH_EnableMasterClock() to enable as needed in the program, or if it is disabled by + * XMC_SPI_CH_DisableMasterClock(). + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableMasterClock() + */ +__STATIC_INLINE void XMC_SPI_CH_EnableMasterClock(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode |= (uint32_t)USIC_CH_PCR_SSCMode_MCLK_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Disables the generation of Master clock by clearing PCR.MCLK bit.\n\n + * This clock can be enabled by invoking XMC_SPI_CH_EnableMasterClock() as needed in the program. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableMasterClock() + */ +__STATIC_INLINE void XMC_SPI_CH_DisableMasterClock(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode &= (uint32_t)~USIC_CH_PCR_SSCMode_MCLK_Msk; +} +#ifdef USIC_CH_PCR_SSCMode_SLPHSEL_Msk +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Data bits are shifted out with the leading edge of the shift clock signal and latched in with the trailing edge. + * + * \parRelated APIs:
+ * XMC_SPI_CH_DataLatchedInLeadingEdge() + */ +__STATIC_INLINE void XMC_SPI_CH_DataLatchedInTrailingEdge(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode &= (uint32_t)~USIC_CH_PCR_SSCMode_SLPHSEL_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * The first data bit is shifted out when the data shift unit receives a low to high transition from the DX2 + * stage. Subsequent bits are shifted out with the trailing edge of the shift clock signal. Data bits are + * always latched in with the leading edge. + * + * \parRelated APIs:
+ * XMC_SPI_CH_DataLatchedInTrailingEdge() + */ +__STATIC_INLINE void XMC_SPI_CH_DataLatchedInLeadingEdge(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode |= USIC_CH_PCR_SSCMode_SLPHSEL_Msk; +} +#endif +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Enables the delay after each word, by setting PCR.TIWEN bit.\n\n + * The inter word delay starts at the end of last SCLK cycle of data word. During this time no clock pulses are + * generated and MSLS signal stays active. If inter word delay is not enabled, last data bit of a data word is directly + * followed by the first data bit of the next data word. This is not enabled in XMC_SPI_CH_Init(). To enable + * XMC_SPI_CH_EnableInterwordDelay() has to be invoked as needed in the program. And can be disabled by invoking + * XMC_SPI_CH_DisableInterwordDelay(). + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableInterwordDelay() + */ +__STATIC_INLINE void XMC_SPI_CH_EnableInterwordDelay(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode |= (uint32_t)USIC_CH_PCR_SSCMode_TIWEN_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Disables the delay after after each word, by clearing PCR.TIWEN bit.\n\n + * So the last data bit of a data word is directly followed by the first data bit of the next data word. If needed can + * be enabled by invoking XMC_SPI_CH_EnableInterwordDelay(). + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableInterwordDelay() + */ +__STATIC_INLINE void XMC_SPI_CH_DisableInterwordDelay(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode &= (uint32_t)~USIC_CH_PCR_SSCMode_TIWEN_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param tinterword_delay_ns delay in terms of nano seconds. + * + * @return None + * + * \parDescription:
+ * Configures the inter word delay by setting PCR.PCTQ1, PCR.DCTQ1 bit fields.\n\n + * The inter word delay is dependent on the peripheral clock. The maximum possible value is calculated by using the + * below formula\n + * Maximum inter word delay = ((1 + PCTQ1_max)(1 + DCTQ1_max)) / peripheral clock\n + * where PCTQ1_max = 3 and DCTQ1_max = 31\n + * After configuring the inter word delay, this has to be enabled by invoking XMC_SPI_CH_EnableInterwordDelay(). + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableInterwordDelay(),XMC_SPI_CH_SetInterwordDelaySCLK() + */ +void XMC_SPI_CH_SetInterwordDelay(XMC_USIC_CH_t *const channel,uint32_t tinterword_delay_ns); + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param sclk_period in terms of clk cycles. + * + * @return None + * + * \parDescription:
+ * Configures the inter word delay by setting PCR.DCTQ1 bit fields.\n\n + * This delay is dependent on the peripheral clock. The maximum possible value supported by this API + * is 32 clock cycles. + * After configuring the inter word delay, this has to be enabled by invoking XMC_SPI_CH_EnableInterwordDelay(). + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableInterwordDelay(),XMC_SPI_CH_EnableInterwordDelay() + */ +__STATIC_INLINE void XMC_SPI_CH_SetInterwordDelaySCLK(XMC_USIC_CH_t *const channel,uint32_t sclk_period) +{ + channel->PCR_SSCMode = (uint32_t)((channel->PCR_SSCMode) & (~(USIC_CH_PCR_SSCMode_DCTQ1_Msk | + USIC_CH_PCR_SSCMode_PCTQ1_Msk | + USIC_CH_PCR_SSCMode_CTQSEL1_Msk))) | + (((sclk_period - 1U) << USIC_CH_PCR_SSCMode_DCTQ1_Pos) | + (0x02U << USIC_CH_PCR_SSCMode_CTQSEL1_Pos)); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param sclk_period delay in terms of sclk clock cycles. + * + * @return None + * + * \parDescription:
+ * Configures the leading/trailing delay by setting BRG.DCTQ bit field.\n\n + * This delay is dependent on the peripheral clock. The maximum possible value supported by this API + * is 30 clock cycles. + * + */ +__STATIC_INLINE void XMC_SPI_CH_SetSlaveSelectDelay(XMC_USIC_CH_t *const channel,uint32_t sclk_period) +{ + + channel->BRG = (channel->BRG & ~(USIC_CH_BRG_DCTQ_Msk | + USIC_CH_BRG_PCTQ_Msk)) | + (((sclk_period - 1U) << USIC_CH_BRG_DCTQ_Pos) | (0x01U << USIC_CH_BRG_PCTQ_Pos)); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * + * Configure to keep MSLS(Slave select signal) active even after finishing the current data frame, + * by setting PCR.FEM bit.\n\n + * This is typically used during the transmission of multi-data word frames, where there is possibility of delay in + * delivering the data. Frame end mode is enabled in XMC_SPI_CH_Init() during initialization. To disable + * XMC_SPI_CH_DisableFEM() can be invoked as needed in the program. + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableFEM() + */ +__STATIC_INLINE void XMC_SPI_CH_EnableFEM(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode |= (uint32_t)USIC_CH_PCR_SSCMode_FEM_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription:
+ * Configure to disable the MSLS(Slave select signal) if the current data frame is considered as finished, + * by setting PCR.FEM bit.\n\n + * + * When the last bit of a data word has been sent out and the transmit buffer TBUF does not contain new data, is + * considered as frame is ended and MSLS(Slave select signal) is disabled. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableFEM() + */ +__STATIC_INLINE void XMC_SPI_CH_DisableFEM(XMC_USIC_CH_t *const channel) +{ + channel->PCR_SSCMode &= (uint32_t)~USIC_CH_PCR_SSCMode_FEM_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param passive_level polarity and delay of the selected shift clock.\n + * Refer @ref XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t for valid inputs. + * @param clock_output shift clock source.\n + * Refer @ref XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT_t for valid inputs. + * + * @return None + * + * \parDescription:
+ * Configures the shift clock source with the selected polarity and delay by setting BRG.SCLKOSEL and BRG.SCLKCFG.\n\n + * In Master mode operation, shift clock is generated by the internal baud rate generator. This SCLK is made available + * for external slave devices by SCLKOUT signal.\n + * In Slave mode, the signal is received from the external master. So the DX1(input) stage has to be connected to input.\n + * The shift clock output(SCLKOUT) signal polarity can be set relative to SCLK, with the delay of half the shift clock + * period. These settings are applicable only in master mode. + */ +__STATIC_INLINE void XMC_SPI_CH_ConfigureShiftClockOutput(XMC_USIC_CH_t *const channel, + const XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t passive_level, + const XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT_t clock_output) +{ + XMC_USIC_CH_ConfigureShiftClockOutput(channel, (XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t)passive_level, + (XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_t)clock_output); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param word_length Number of bits to be configured for a data word. \n + * \b Range: 1 to 16. + * + * @return None + * + * \parDescription
+ * Defines the data word length.\n\n + * Sets the number of bits to represent a data word. Frame length should be a multiple of word length. + * + * \parRelated APIs:
+ * XMC_SPI_CH_SetFrameLength() + */ +__STATIC_INLINE void XMC_SPI_CH_SetWordLength(XMC_USIC_CH_t *const channel, const uint8_t word_length) +{ + XMC_USIC_CH_SetWordLength(channel, word_length); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param frame_length Number of bits in a frame. \n + * \b Range: 1 to 64. If the value 64 is configured, then the frame does not + * automatically end. User should explicitly end the frame. + * + * @return None + * + * \parDescription
+ * Define the data frame length.\n\n + * Set the number of bits to be serially transmitted in a frame. + * The frame length should be multiples of word length. If the value is set to 64, the frame does not + * automatically end. Use XMC_SPI_CH_DisableSlaveSelect() to end the frame after all the data + * is transmitted. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetWordLength(), XMC_USIC_CH_EnableFrameLengthControl(), XMC_SPI_CH_DisableSlaveSelect() + */ +__STATIC_INLINE void XMC_SPI_CH_SetFrameLength(XMC_USIC_CH_t *const channel, const uint8_t frame_length) +{ + XMC_USIC_CH_SetFrameLength(channel, frame_length); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription
+ * Configure the handling of start of frame through software, by setting TCSR.SOF bit.\n\n + * This can be used if the software handles the TBUF data without FIFO. If SOF is set, a valid content of the TBUF is + * considered as first word of a new frame by finishing the currently running frame. For software handling of SOF bit, + * it is recommended to configure TCSR.WLEMD as 0. This is not configured during initialization. XMC_SPI_CH_EnableSOF() + * can be called as needed in the program and can be disabled by XMC_SPI_CH_DisableSOF(). + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableSOF() + */ +__STATIC_INLINE void XMC_SPI_CH_EnableSOF(XMC_USIC_CH_t *const channel) +{ + channel->TCSR |= (uint32_t)USIC_CH_TCSR_SOF_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription
+ * Set the control of the handling start of frame through hardware, by clearing TCSR.SOF bit.\n\n + * Typically this can be disabled, where the transmission control is done by the hardware. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableSOF() + */ +__STATIC_INLINE void XMC_SPI_CH_DisableSOF(XMC_USIC_CH_t *const channel) +{ + channel->TCSR &= (uint32_t)~USIC_CH_TCSR_SOF_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription
+ * Configure the handling of end of frame through software, by setting TCSR.EOF bit.\n\n + * This can be used if the software handles the TBUF data without FIFO. If EOF is set, a valid content of the TBUF is + * considered as last word of a frame. After transfer of the last word, MSLS signal becomes inactive. For software + * handling of EOF bit, it is recommended to configure TCSR.WLEMD as 0. \n + * \b Note: The API should be called before putting the last data word of the frame to TBUF. + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableEOF() + */ +__STATIC_INLINE void XMC_SPI_CH_EnableEOF(XMC_USIC_CH_t *const channel) +{ + channel->TCSR |= (uint32_t)USIC_CH_TCSR_EOF_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription
+ * Configure the handling of end of frame through hardware, by clearing TCSR.EOF bit.\n\n + * Typically this can be disabled, where the transmission control is done by the hardware. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableEOF() + */ +__STATIC_INLINE void XMC_SPI_CH_DisableEOF(XMC_USIC_CH_t *const channel) +{ + channel->TCSR &= (uint32_t)~USIC_CH_TCSR_EOF_Msk; +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param input SPI channel input stage.\n + * Refer @ref XMC_SPI_CH_INPUT_t for valid values + * @param source Input source select for the input stage. + * Range : [0 to 7] + * + * @return None + * + * \parDescription
+ * Selects the data source for SPI input stage, by configuring DXCR.DSEL bits.\n\n + * Selects the input data signal source among DXnA, DXnB.. DXnG for the input stage. The API can be used for all the + * input stages like DX0CR, DX1CR etc. This is not done during initialization. This has to be configured before starting + * the SPI communication. + */ +__STATIC_INLINE void XMC_SPI_CH_SetInputSource(XMC_USIC_CH_t *const channel, + const XMC_SPI_CH_INPUT_t input, + const uint8_t source) +{ + channel->DXCR[input] = (uint32_t)(channel->DXCR[input] & (~USIC_CH_DX0CR_DSEN_Msk)) | USIC_CH_DX0CR_INSW_Msk; + XMC_USIC_CH_SetInputSource(channel, (XMC_USIC_CH_INPUT_t)input, source); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param selo_inversion Polarity of the slave select signal relative to the MSLS signal.\n + * Refer @ref XMC_SPI_CH_SLAVE_SEL_MSLS_INV_t for valid values + * + * @return None + * + * \parDescription
+ * Set the polarity of the slave select signal, by configuring PCR.SELINV bit.\n\n + * Normally MSLS signal is active low level signal. SO based on the slave inversion has to be applied. This is configured + * in XMC_SPI_CH_Init() during initialization. Invoke XMC_SPI_CH_SetSlaveSelectPolarity() with desired settings as + * needed later in the program. + */ +__STATIC_INLINE void XMC_SPI_CH_SetSlaveSelectPolarity(XMC_USIC_CH_t *const channel, + const XMC_SPI_CH_SLAVE_SEL_MSLS_INV_t selo_inversion) +{ + /* Configuration of Protocol Control Register */ + channel->PCR_SSCMode = (uint32_t)((channel->PCR_SSCMode & (~USIC_CH_PCR_SSCMode_SELINV_Msk)) | (uint32_t)selo_inversion); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param input SPI channel input stage.\n + * Refer @ref XMC_SPI_CH_INPUT_t for valid inputs. + * + * @return None + * + * \parDescription
+ * Enables the polarity inversion of input data signal, by setting DXyCR.DPOL(where y = \a input).\n\n + * This is not set in XMC_SPI_CH_Init(). Invoke XMC_SPI_CH_EnableInputInversion() as needed later in the program. To + * disable the inversion XMC_SPI_CH_DisableInputInversion() can be invoked. + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableInputInversion() + */ +__STATIC_INLINE void XMC_SPI_CH_EnableInputInversion(XMC_USIC_CH_t *const channel, + const XMC_SPI_CH_INPUT_t input) +{ + XMC_USIC_CH_EnableInputInversion(channel, (XMC_USIC_CH_INPUT_t)input); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param input SPI channel input stage.\n + * Refer @ref XMC_SPI_CH_INPUT_t for valid inputs. + * + * @return None + * + * \parDescription
+ * Disables the polarity inversion of input data signal, by clearing DXyCR.DPOL(where y = \a input).\n\n + * Resets the input data polarity. Invoke XMC_SPI_CH_EnableInputInversion() to apply inversion. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableInputInversion() + */ +__STATIC_INLINE void XMC_SPI_CH_DisableInputInversion(XMC_USIC_CH_t *const channel, + const XMC_SPI_CH_INPUT_t input) +{ + XMC_USIC_CH_DisableInputInversion(channel, (XMC_USIC_CH_INPUT_t)input); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * @param service_request Service request number. + Range: [0 to 5] + * + * @return None + * + * \parDescription
+ * Sets the interrupt node for SPI channel events.\n\n + * For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so. This is not configured in XMC_SPI_CH_Init() during + * initialization. + * + * \parNote::
+ * 1. NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableEvent() + */ +__STATIC_INLINE void XMC_SPI_CH_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const uint8_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL, (uint32_t)service_request); +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_SPI0_CH0, @ref XMC_SPI0_CH1,@ref XMC_SPI1_CH0,@ref XMC_SPI1_CH1,@ref XMC_SPI2_CH0,@ref XMC_SPI2_CH1 @note Availability of SPI1 and SPI2 depends on device selection + * @param interrupt_node Interrupt node pointer to be configured. \n + * \b Range: @ref XMC_SPI_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, + * @ref XMC_SPI_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER etc. + * @param service_request Service request number.\n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets the interrupt node for USIC channel events. \n\n + * For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so.
+ * Note: NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_SPI_CH_SelectInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_SPI_CH_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, (XMC_USIC_CH_INTERRUPT_NODE_POINTER_t)interrupt_node, + (uint32_t)service_request); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_SPI0_CH0, @ref XMC_SPI0_CH1,@ref XMC_SPI1_CH0,@ref XMC_SPI1_CH1,@ref XMC_SPI2_CH0,@ref XMC_SPI2_CH1 @note Availability of SPI1 and SPI2 depends on device selection + * @param service_request_line service request number of the event to be triggered. \n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Trigger a SPI interrupt service request.\n\n + * When the SPI service request is triggered, the NVIC interrupt associated with it will be + * generated if enabled. + * + * \parRelated APIs:
+ * XMC_SPI_CH_SelectInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_SPI_CH_TriggerServiceRequest(XMC_USIC_CH_t *const channel, const uint32_t service_request_line) +{ + XMC_USIC_CH_TriggerServiceRequest(channel, (uint32_t)service_request_line); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_SPI0_CH0, @ref XMC_SPI0_CH1,@ref XMC_SPI1_CH0,@ref XMC_SPI1_CH1,@ref XMC_SPI2_CH0,@ref XMC_SPI2_CH1 @note Availability of SPI1 and SPI2 depends on device selection + * @return None + * + * \parDescription
+ * Enables delay compensation. \n\n + * + * Delay compensation can be applied to the receive path. + * \parRelated APIs:
+ * XMC_SPI_CH_DisableDelayCompensation()\n\n\n + */ +__STATIC_INLINE void XMC_SPI_CH_EnableDelayCompensation(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_EnableDelayCompensation(channel); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_SPI0_CH0, @ref XMC_SPI0_CH1,@ref XMC_SPI1_CH0,@ref XMC_SPI1_CH1,@ref XMC_SPI2_CH0,@ref XMC_SPI2_CH1 @note Availability of SPI1 and SPI2 depends on device selection + * @return None + * + * \parDescription
+ * Disables delay compensation.. \n\n + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableDelayCompensation()\n\n\n + */ +__STATIC_INLINE void XMC_SPI_CH_DisableDelayCompensation(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_DisableDelayCompensation(channel); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_SPI0_CH0, @ref XMC_SPI0_CH1,@ref XMC_SPI1_CH0,@ref XMC_SPI1_CH1,@ref XMC_SPI2_CH0,@ref XMC_SPI2_CH1 @note Availability of SPI1 and SPI2 depends on device selection + * @param pdiv Desired divider for the external frequency input. \b Range: minimum value = 1, maximum value = 1024 \n + * @param combination_mode USIC channel input combination mode \n + * + * @return None + * + * \parDescription
+ * Enables the external frequency input for the Baudrate Generator and configures the divider, oversampling and + * the combination mode of the USIC channel. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetBRGInputClockSource(), XMC_USIC_CH_SetInputTriggerCombinationMode() \n\n\n + */ +__STATIC_INLINE void XMC_SPI_CH_ConfigExternalInputSignalToBRG(XMC_USIC_CH_t *const channel, + const uint16_t pdiv, + const XMC_USIC_CH_INPUT_COMBINATION_MODE_t combination_mode) +{ + XMC_USIC_CH_ConfigExternalInputSignalToBRG(channel,pdiv,2U,combination_mode); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription
+ * The SELOx lines (with x = 1-7) can be used as addresses for an external address + * decoder to increase the number of external slave devices. + */ +__STATIC_INLINE void XMC_SPI_CH_EnableSlaveSelectCodedMode(XMC_USIC_CH_t *const channel) +{ + /* Configuration of Protocol Control Register */ + channel->PCR_SSCMode = (uint32_t)(channel->PCR_SSCMode & (~USIC_CH_PCR_SSCMode_SELCTR_Msk)); +} + +/** + * @param channel A constant pointer to XMC_USIC_CH_t, pointing to the USIC channel base address. + * + * @return None + * + * \parDescription
+ * Each SELOx line (with x = 0-7) can be directly connected to an external slave device. + */ +__STATIC_INLINE void XMC_SPI_CH_DisableSlaveSelectCodedMode(XMC_USIC_CH_t *const channel) +{ + /* Configuration of Protocol Control Register */ + channel->PCR_SSCMode |= (uint32_t)USIC_CH_PCR_SSCMode_SELCTR_Msk; +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_SPI0_CH0, @ref XMC_SPI0_CH1,@ref XMC_SPI1_CH0,@ref XMC_SPI1_CH1,@ref XMC_SPI2_CH0,@ref XMC_SPI2_CH1 @note Availability of SPI1 and SPI2 depends on device selection + * @return None + * + * \parDescription
+ * Enable data transmission.\n\n + * Use this function in combination with XMC_SPI_CH_DisableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * @note If you need more control over the start of transmission use XMC_USIC_CH_SetStartTransmisionMode() + * + * \parRelated APIs:
+ * XMC_SPI_CH_DisableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_SPI_CH_EnableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_ON_TDV); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_SPI0_CH0, @ref XMC_SPI0_CH1,@ref XMC_SPI1_CH0,@ref XMC_SPI1_CH1,@ref XMC_SPI2_CH0,@ref XMC_SPI2_CH1 @note Availability of SPI1 and SPI2 depends on device selection + * @return None + * + * \parDescription
+ * Disable data transmission.\n\n + * Use this function in combination with XMC_SPI_CH_EnableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * + * \parRelated APIs:
+ * XMC_SPI_CH_EnableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_SPI_CH_DisableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_DISABLED); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_uart.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_uart.h new file mode 100644 index 00000000..387be642 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_uart.h @@ -0,0 +1,810 @@ + /** + * @file xmc_uart.h + * @date 2016-05-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial + * + * 2015-05-20: + * - Description updated
+ * - Added XMC_UART_CH_TriggerServiceRequest() and XMC_UART_CH_SelectInterruptNodePointer
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-09-01: + * - Modified XMC_UART_CH_SetInputSource() for avoiding complete DXCR register overwriting.
+ * - Modified XMC_UART_CH_EVENT_t enum for supporting XMC_UART_CH_EnableEvent() and XMC_UART_CH_DisableEvent() + * for supporting multiple events configuration
+ * + * 2016-05-20: + * - Added XMC_UART_CH_EnableDataTransmission() and XMC_UART_CH_DisableDataTransmission() + * + * @endcond + * + */ + +#ifndef XMC_UART_H +#define XMC_UART_H + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ + +#include "xmc_usic.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup UART + * @brief Universal Asynchronous Receiver/Transmitter (UART) driver for XMC microcontroller family. + * + * The UART driver uses Universal Serial Interface Channel(USIC) module to implement UART protocol. + * It provides APIs to configure USIC channel for UART communication. The driver enables the user + * in getting the status of UART protocol events, configuring interrupt service requests, protocol + * related parameter configuration etc. + * + * UART driver features: + * -# Configuration structure XMC_UART_CH_CONFIG_t and initialization function XMC_UART_CH_Init() + * -# Enumeration of events with their bit masks @ref XMC_UART_CH_EVENT_t, @ref XMC_UART_CH_STATUS_FLAG_t + * -# Allows the selection of input source for the DX0 input stage using the API XMC_UART_CH_SetInputSource() + * -# Allows configuration of baudrate using XMC_UART_CH_SetBaudrate() and configuration of data length using + XMC_UART_CH_SetWordLength() and XMC_UART_CH_SetFrameLength() + * -# Provides the status of UART protocol events, XMC_UART_CH_GetStatusFlag() + * -# Allows transmission of data using XMC_UART_CH_Transmit() and gets received data using XMC_UART_CH_GetReceivedData() + * + * @{ + */ + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ + +#if defined(USIC0) +#define XMC_UART0_CH0 XMC_USIC0_CH0 /**< USIC0 channel 0 base address */ +#define XMC_UART0_CH1 XMC_USIC0_CH1 /**< USIC0 channel 1 base address */ +#endif + +#if defined(USIC1) +#define XMC_UART1_CH0 XMC_USIC1_CH0 /**< USIC1 channel 0 base address */ +#define XMC_UART1_CH1 XMC_USIC1_CH1 /**< USIC1 channel 1 base address */ +#endif + +#if defined(USIC2) +#define XMC_UART2_CH0 XMC_USIC2_CH0 /**< USIC2 channel 0 base address */ +#define XMC_UART2_CH1 XMC_USIC2_CH1 /**< USIC2 channel 1 base address */ +#endif + +/********************************************************************************************************************* + * ENUMS + *********************************************************************************************************************/ + +/** + * UART driver status + */ +typedef enum XMC_UART_CH_STATUS +{ + XMC_UART_CH_STATUS_OK, /**< UART driver status : OK*/ + XMC_UART_CH_STATUS_ERROR, /**< UART driver status : ERROR */ + XMC_UART_CH_STATUS_BUSY /**< UART driver status : BUSY */ +} XMC_UART_CH_STATUS_t; + +/** +* UART portocol status. The enum values can be used for getting the status of UART channel. +* +*/ +typedef enum XMC_UART_CH_STATUS_FLAG +{ + XMC_UART_CH_STATUS_FLAG_TRANSMISSION_IDLE = USIC_CH_PSR_ASCMode_TXIDLE_Msk, /**< UART Protocol Status transmit IDLE*/ + XMC_UART_CH_STATUS_FLAG_RECEPTION_IDLE = USIC_CH_PSR_ASCMode_RXIDLE_Msk, /**< UART Protocol Status receive IDLE*/ + XMC_UART_CH_STATUS_FLAG_SYNCHRONIZATION_BREAK_DETECTED = USIC_CH_PSR_ASCMode_SBD_Msk, /**< UART Protocol Status synchronization break detected*/ + XMC_UART_CH_STATUS_FLAG_COLLISION_DETECTED = USIC_CH_PSR_ASCMode_COL_Msk, /**< UART Protocol Status collision detected*/ + XMC_UART_CH_STATUS_FLAG_RECEIVER_NOISE_DETECTED = USIC_CH_PSR_ASCMode_RNS_Msk, /**< UART Protocol Status receiver noise detected */ + XMC_UART_CH_STATUS_FLAG_FORMAT_ERROR_IN_STOP_BIT_0 = USIC_CH_PSR_ASCMode_FER0_Msk, /**< UART Protocol Status format error in stop bit 0 */ + XMC_UART_CH_STATUS_FLAG_FORMAT_ERROR_IN_STOP_BIT_1 = USIC_CH_PSR_ASCMode_FER1_Msk, /**< UART Protocol Status format error in stop bit 1 */ + XMC_UART_CH_STATUS_FLAG_RECEIVE_FRAME_FINISHED = USIC_CH_PSR_ASCMode_RFF_Msk, /**< UART Protocol Status receive frame finished */ + XMC_UART_CH_STATUS_FLAG_TRANSMITTER_FRAME_FINISHED = USIC_CH_PSR_ASCMode_TFF_Msk, /**< UART Protocol Status transmit frame finished */ + XMC_UART_CH_STATUS_FLAG_TRANSFER_STATUS_BUSY = USIC_CH_PSR_ASCMode_BUSY_Msk, /**< UART Protocol Status transfer status busy */ + XMC_UART_CH_STATUS_FLAG_RECEIVER_START_INDICATION = USIC_CH_PSR_ASCMode_RSIF_Msk, /**< UART Protocol Status receive start indication flag*/ + XMC_UART_CH_STATUS_FLAG_DATA_LOST_INDICATION = USIC_CH_PSR_ASCMode_DLIF_Msk, /**< UART Protocol Status data lost indication flag*/ + XMC_UART_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION = USIC_CH_PSR_ASCMode_TSIF_Msk, /**< UART Protocol Status transmit shift indication flag*/ + XMC_UART_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION = USIC_CH_PSR_ASCMode_TBIF_Msk, /**< UART Protocol Status transmit buffer indication flag*/ + XMC_UART_CH_STATUS_FLAG_RECEIVE_INDICATION = USIC_CH_PSR_ASCMode_RIF_Msk, /**< UART Protocol Status receive indication flag*/ + XMC_UART_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION = USIC_CH_PSR_ASCMode_AIF_Msk, /**< UART Protocol Status alternative receive indication flag*/ + XMC_UART_CH_STATUS_FLAG_BAUD_RATE_GENERATOR_INDICATION = USIC_CH_PSR_ASCMode_BRGIF_Msk /**< UART Protocol Status baudrate generator indication flag*/ +} XMC_UART_CH_STATUS_FLAG_t; + +/** +* UART configuration events. The enums can be used for configuring events using the CCR register. +*/ +typedef enum XMC_CH_UART_EVENT +{ + XMC_UART_CH_EVENT_RECEIVE_START = USIC_CH_CCR_RSIEN_Msk, /**< Receive start event */ + XMC_UART_CH_EVENT_DATA_LOST = USIC_CH_CCR_DLIEN_Msk, /**< Data lost event */ + XMC_UART_CH_EVENT_TRANSMIT_SHIFT = USIC_CH_CCR_TSIEN_Msk, /**< Transmit shift event */ + XMC_UART_CH_EVENT_TRANSMIT_BUFFER = USIC_CH_CCR_TBIEN_Msk, /**< Transmit buffer event */ + XMC_UART_CH_EVENT_STANDARD_RECEIVE = USIC_CH_CCR_RIEN_Msk, /**< Receive event */ + XMC_UART_CH_EVENT_ALTERNATIVE_RECEIVE = USIC_CH_CCR_AIEN_Msk, /**< Alternate receive event */ + XMC_UART_CH_EVENT_BAUD_RATE_GENERATOR = USIC_CH_CCR_BRGIEN_Msk, /**< Baudrate generator event */ + + XMC_UART_CH_EVENT_SYNCHRONIZATION_BREAK = USIC_CH_PCR_ASCMode_SBIEN_Msk, /**< Event synchronization break */ + XMC_UART_CH_EVENT_COLLISION = USIC_CH_PCR_ASCMode_CDEN_Msk, /**< Event collision */ + XMC_UART_CH_EVENT_RECEIVER_NOISE = USIC_CH_PCR_ASCMode_RNIEN_Msk, /**< Event receiver noise */ + XMC_UART_CH_EVENT_FORMAT_ERROR = USIC_CH_PCR_ASCMode_FEIEN_Msk, /**< Event format error */ + XMC_UART_CH_EVENT_FRAME_FINISHED = USIC_CH_PCR_ASCMode_FFIEN_Msk /**< Event frame finished */ +} XMC_UART_CH_EVENT_t; + +/** + * UART Input sampling frequency options + */ +typedef enum XMC_UART_CH_INPUT_SAMPLING_FREQ +{ + XMC_UART_CH_INPUT_SAMPLING_FREQ_FPERIPH = XMC_USIC_CH_INPUT_SAMPLING_FREQ_FPERIPH, /**< Sampling frequency input fperiph*/ + XMC_UART_CH_INPUT_SAMPLING_FREQ_FRACTIONAL_DIVIDER = XMC_USIC_CH_INPUT_SAMPLING_FREQ_FRACTIONAL_DIVIDER /**< Sampling frequency input fractional divider*/ +} XMC_UART_CH_INPUT_SAMPLING_FREQ_t; + +/** + * UART input stages + */ +typedef enum XMC_UART_CH_INPUT +{ + XMC_UART_CH_INPUT_RXD = 0UL /**< UART input stage DX0*/ +#if UC_FAMILY == XMC1 + , + XMC_UART_CH_INPUT_RXD1 = 3UL, /**< UART input stage DX3*/ + XMC_UART_CH_INPUT_RXD2 = 5UL /**< UART input stage DX5*/ +#endif +} XMC_UART_CH_INPUT_t; + + +/** + * UART channel interrupt node pointers + */ +typedef enum XMC_UART_CH_INTERRUPT_NODE_POINTER +{ + XMC_UART_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, /**< Node pointer for transmit shift interrupt */ + XMC_UART_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER = XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER, /**< Node pointer for transmit buffer interrupt */ + XMC_UART_CH_INTERRUPT_NODE_POINTER_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_RECEIVE, /**< Node pointer for receive interrupt */ + XMC_UART_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE = XMC_USIC_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE, /**< Node pointer for alternate receive interrupt */ + XMC_UART_CH_INTERRUPT_NODE_POINTER_PROTOCOL = XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL /**< Node pointer for protocol related interrupts */ +} XMC_UART_CH_INTERRUPT_NODE_POINTER_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + *********************************************************************************************************************/ + +/** + * UART initialization structure +*/ +typedef struct XMC_UART_CH_CONFIG +{ + uint32_t baudrate; /**< Desired baudrate. \b Range: minimum= 100, maximum= (fPERIPH * 1023)/(1024 * oversampling) */ + uint8_t data_bits; /**< Number of bits for the data field. Value configured as USIC channel word length. \n + \b Range: minimum= 1, maximum= 16*/ + uint8_t frame_length; /**< Indicates nmber of bits in a frame. Configured as USIC channel frame length. \n + \b Range: minimum= 1, maximum= 63*/ + uint8_t stop_bits; /**< Number of stop bits. \b Range: minimum= 1, maximum= 2 */ + uint8_t oversampling; /**< Number of samples for a symbol(DCTQ).\b Range: minimum= 1, maximum= 32*/ + XMC_USIC_CH_PARITY_MODE_t parity_mode; /**< Parity mode. \b Range: @ref XMC_USIC_CH_PARITY_MODE_NONE, @ref XMC_USIC_CH_PARITY_MODE_EVEN, \n + @ref XMC_USIC_CH_PARITY_MODE_ODD*/ +} XMC_UART_CH_CONFIG_t; + +/********************************************************************************************************************* + * API PROTOTYPES + *********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0, XMC_UART1_CH1,XMC_UART2_CH0, XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param config Constant pointer to UART configuration structure of type @ref XMC_UART_CH_CONFIG_t. + * @return XMC_UART_CH_STATUS_t Status of initializing the USIC channel for UART protocol.\n + * \b Range: @ref XMC_UART_CH_STATUS_OK if initialization is successful.\n + * @ref XMC_UART_CH_STATUS_ERROR if configuration of baudrate failed. + * + * \parDescription
+ * Initializes the USIC channel for UART protocol.\n\n + * During the initialization, USIC channel is enabled, baudrate is configured with the defined oversampling value + * in the intialization structure. If the oversampling value is set to 0 in the structure, the default oversampling of 16 + * is considered. Sampling point for each symbol is configured at the half of sampling period. Symbol value is decided by the + * majority decision among 3 samples. + * Word length is configured with the number of data bits. If the value of \a frame_length is 0, then USIC channel frame length + * is set to the same value as word length. If \a frame_length is greater than 0, it is set as the USIC channel frame length. + * Parity mode is set to the value configured for \a parity_mode. + * The USIC channel should be set to UART mode by calling the XMC_UART_CH_Start() API after the initialization. + * + * \parRelated APIs:
+ * XMC_UART_CH_Start(), XMC_UART_CH_Stop(), XMC_UART_CH_Transmit()\n\n\n + */ +void XMC_UART_CH_Init(XMC_USIC_CH_t *const channel, const XMC_UART_CH_CONFIG_t *const config); + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @return None + * + * \parDescription
+ * Sets the USIC channel operation mode to UART mode.\n\n + * CCR register bitfield \a Mode is set to 2(UART mode). This API should be called after configuring + * the USIC channel. Transmission and reception can happen only when the UART mode is set. + * This is an inline function. + * + * \parRelated APIs:
+ * XMC_UART_CH_Stop(), XMC_UART_CH_Transmit()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_Start(XMC_USIC_CH_t *const channel) +{ + channel->CCR = (uint32_t)(((channel->CCR) & (~USIC_CH_CCR_MODE_Msk)) | (uint32_t)XMC_USIC_CH_OPERATING_MODE_UART); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @return XMC_UART_CH_STATUS_t Status to indicate if the communication channel is stopped successfully.\n + * @ref XMC_UART_CH_STATUS_OK if the communication channel is stopped. + * @ref XMC_UART_CH_STATUS_BUSY if the communication channel is busy. + * + * \parDescription
+ * Stops the UART communication.\n\n + * CCR register bitfield \a Mode is reset. This disables the communication. + * Before starting the communication again, the channel has to be reconfigured. + * + * \parRelated APIs:
+ * XMC_UART_CH_Init() \n\n\n + */ +XMC_UART_CH_STATUS_t XMC_UART_CH_Stop(XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, XMC_UART0_CH1 ,XMC_UART1_CH0, XMC_UART1_CH1, XMC_UART2_CH0, XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param rate Desired baudrate. \n + * \b Range: minimum value = 100, maximum value depends on the peripheral clock frequency\n + * and \a oversampling. Maximum baudrate can be derived using the formula: (fperiph * 1023)/(1024 * oversampling) + * @param oversampling Required oversampling. The value indicates the number of time quanta for one symbol of data.\n + * This can be related to the number of samples for each logic state of the data signal.\n + * \b Range: 4 to 32. Value should be chosen based on the protocol used. + * @return XMC_UART_CH_STATUS_t Status indicating the baudrate configuration.\n + * \b Range: @ref XMC_USIC_CH_STATUS_OK if baudrate is successfully configured, + * @ref XMC_USIC_CH_STATUS_ERROR if desired baudrate or oversampling is invalid. + * + * \parDescription:
+ * Sets the bus speed in bits per second.\n\n + * Derives the values of \a STEP and PDIV to arrive at the optimum realistic speed possible. + * \a oversampling is the number of samples to be taken for each symbol of UART protocol. + * Default \a oversampling of 16 is considered if the input \a oversampling is less than 4. It is recommended to keep + * a minimum oversampling of 4 for UART. + * + * \parRelated APIs:
+ * XMC_UART_CH_Init(), XMC_UART_CH_Stop() + */ +XMC_UART_CH_STATUS_t XMC_UART_CH_SetBaudrate(XMC_USIC_CH_t *const channel, uint32_t rate, uint32_t oversampling); + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param data Data to be transmitted. \n + * \b Range: 16 bit unsigned data within the range 0 to 65535. Actual size of + * data transmitted depends on the configured number of bits for the UART protocol in the register SCTR. + * @return None + * + * \parDescription
+ * Transmits data over serial communication channel using UART protocol.\n\n + * Based on the channel configuration, data is either put to the transmit FIFO or to TBUF register. + * Before putting data to TBUF, the API waits for TBUF to finish shifting its contents to shift register. + * So user can continuously execute the API without checking for TBUF busy status. Based on the number of + * data bits configured, the lower significant bits will be extracted for transmission. + * + * Note: When FIFO is not configured, the API waits for the TBUF to be available. + * This makes the execution a blocking call. + * + * \parRelated APIs:
+ * XMC_UART_CH_GetReceivedData() \n\n\n + */ +void XMC_UART_CH_Transmit(XMC_USIC_CH_t *const channel, const uint16_t data); + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @return uint16_t Received data over UART communication channel. + * \parDescription
+ * Provides one word of data received over UART communication channel.\n\n + * Based on the channel configuration, data is either read from the receive FIFO or RBUF register. + * Before returning the value, there is no check for data validity. User should check the appropriate + * data receive flags(standard receive/alternative receive/FIFO standard receive/FIFO alternative receive) + * before executing the API. Reading from an empty receive FIFO can generate a receive error event. + * + * \parRelated APIs:
+ * XMC_UART_CH_GetStatusFlag(), XMC_UART_CH_Transmit() \n\n\n + */ +uint16_t XMC_UART_CH_GetReceivedData(XMC_USIC_CH_t *const channel); + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param word_length Data word length. \n + * \b Range: minimum= 1, maximum= 16. + * @return None + * + * \parDescription
+ * Sets the data word length in number of bits.\n\n + * Word length can range from 1 to 16. It indicates the number of data bits in a data word. + * The value of \a word_length will be decremented by 1 before setting the value to \a SCTR register. + * If the UART data bits is more than 16, then the frame length should be set to the actual number of bits and + * word length should be configured with the number of bits expected in each transaction. For example, if number of data bits + * for UART communication is 20 bits, then the frame length should be set as 20. Word length can be set based on the + * transmit and receive handling. If data is stored as 8bit array, then the word length can be set to 8. In this case, + * a full message of UART data should be transmitted/ received as 3 data words. + * + * \parRelated APIs:
+ * XMC_UART_CH_SetFrameLength() \n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_SetWordLength(XMC_USIC_CH_t *const channel, const uint8_t word_length) +{ + XMC_USIC_CH_SetWordLength(channel, word_length); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param frame_length Number of data bits in each UART frame. \n + * \b Range: minimum= 1, maximum= 64. + * @return None + * + * \parDescription
+ * Sets the number of data bits for UART communication.\n\n + * The frame length is configured by setting the input value to \a SCTR register. + * The value of \a frame_length will be decremented by 1, before setting it to the register. + * Frame length should not be set to 64 for UART communication. + * + * \parRelated APIs:
+ * XMC_UART_CH_SetWordLength() \n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_SetFrameLength(XMC_USIC_CH_t *const channel, const uint8_t frame_length) +{ + XMC_USIC_CH_SetFrameLength(channel, frame_length); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param event Event bitmasks to enable. Use the type @ref XMC_UART_CH_EVENT_t for naming events. \n + * \b Range: @ref XMC_UART_CH_EVENT_RECEIVE_START, @ref XMC_UART_CH_EVENT_DATA_LOST, + * @ref XMC_UART_CH_EVENT_TRANSMIT_SHIFT, @ref XMC_UART_CH_EVENT_TRANSMIT_BUFFER, + * etc. + * @return None + * + * \parDescription
+ * Enables interrupt events for UART communication.\n\n + * Multiple events can be combined using the bitwise OR operation and configured in one function call. + * @ref XMC_UART_CH_EVENT_t enumerates multiple event bitmasks. These enumerations can be used as input to the API. + * Events are configured by setting bits in the CCR register. + * \parRelated APIs:
+ * XMC_UART_CH_DisableEvent(), XMC_UART_CH_SetInterruptNodePointer(), XMC_UART_CH_GetStatusFlag() \n\n\n + */ +void XMC_UART_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event); + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param event Bitmask of events to disable. Use the type @ref XMC_UART_CH_EVENT_t for naming events.\n + * \b Range: @ref XMC_UART_CH_EVENT_RECEIVE_START, @ref XMC_UART_CH_EVENT_DATA_LOST, + * @ref XMC_UART_CH_EVENT_TRANSMIT_SHIFT, @ref XMC_UART_CH_EVENT_TRANSMIT_BUFFER, + * etc. + * @return None + * + * \parDescription
+ * Disables the interrupt events by clearing the bits in CCR register.\n\n + * Multiple events can be combined using the bitwise OR operation and configured in one function call. + * XMC_UART_CH_EVENT_FLAG_t enumerates multiple event bitmasks. These enumerations can be used as input to the API. + * + * \parRelated APIs:
+ * XMC_UART_CH_ClearStatusFlag(), XMC_UART_CH_EnableEvent() \n\n\n + */ +void XMC_UART_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event); + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param service_request Service request number for generating protocol interrupts.\n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets the interrupt node for UART channel protocol events.\n\n + * For all the protocol events enlisted in the enumeration XMC_UART_CH_EVENT_t, one common + * interrupt gets generated. The service request connects the interrupt node to the UART + * protocol events. + * Note: NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const uint8_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL, + (uint32_t)service_request); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param interrupt_node Interrupt node pointer to be configured. \n + * \b Range: @ref XMC_UART_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, + * @ref XMC_UART_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER etc. + * @param service_request Service request number.\n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets the interrupt node for USIC channel events. \n\n + * For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so.
+ * Note: NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_SelectInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_UART_CH_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request) +{ + XMC_USIC_CH_SetInterruptNodePointer(channel, (XMC_USIC_CH_INTERRUPT_NODE_POINTER_t)interrupt_node, + (uint32_t)service_request); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param service_request_line service request number of the event to be triggered. \n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Trigger a UART interrupt service request.\n\n + * When the UART service request is triggered, the NVIC interrupt associated with it will be + * generated if enabled. + * + * \parRelated APIs:
+ * XMC_UART_CH_SelectInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_TriggerServiceRequest(XMC_USIC_CH_t *const channel, const uint32_t service_request_line) +{ + XMC_USIC_CH_TriggerServiceRequest(channel, (uint32_t)service_request_line); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @return Status of UART channel events. \n + * \b Range: Use @ref XMC_UART_CH_STATUS_FLAG_t enumerations for + * event bitmasks. @ref XMC_UART_CH_STATUS_FLAG_TRANSMISSION_IDLE, @ref XMC_UART_CH_STATUS_FLAG_RECEPTION_IDLE, + * @ref XMC_UART_CH_STATUS_FLAG_SYNCHRONIZATION_BREAK_DETECTED etc. + * + * \parDescription
+ * Provides the status of UART channel events.\n\n + * Status provided by the API represents the status of multiple events at their bit positions. The bitmasks can be + * obtained using the enumeration XMC_UART_CH_STATUS_FLAG_t. Event status is obtained by reading + * the register PSR_ASCMode. + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableEvent(), XMC_UART_CH_ClearStatusFlag()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_UART_CH_GetStatusFlag(XMC_USIC_CH_t *const channel) +{ + return channel->PSR_ASCMode; +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param flag UART events to be cleared. \n + * \b Range: Use @ref XMC_UART_CH_STATUS_FLAG_t enumerations for + * event bitmasks. @ref XMC_UART_CH_STATUS_FLAG_TRANSMISSION_IDLE, @ref XMC_UART_CH_STATUS_FLAG_RECEPTION_IDLE, + * @ref XMC_UART_CH_STATUS_FLAG_SYNCHRONIZATION_BREAK_DETECTED etc. + * @return None + * + * \parDescription
+ * Clears the status of UART channel events.\n\n + * Multiple events can be combined using the bitwise OR operation and configured in one function call. + * XMC_UART_CH_STATUS_FLAG_t enumerates multiple event bitmasks. These enumerations can be used as input to the API. + * Events are cleared by setting the bitmask to the PSCR register. + * + * \parRelated APIs:
+ * XMC_UART_CH_DisableEvent(), XMC_UART_CH_GetStatusFlag()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_ClearStatusFlag(XMC_USIC_CH_t *const channel, const uint32_t flag) +{ + channel->PSCR = flag; +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @param source Input source select for the input stage. The table provided below maps the decimal value with the input source. + * + * + *
0DXnA
1DXnB
2DXnC
3DXnD
4DXnE
5DXnF
6DXnG
7Always 1
+ * @return None + * + * \parDescription
+ * Sets input soource for the UART communication.\n\n + * It is used for configuring the input stage for data reception. + * Selects the input data signal source among DXnA, DXnB.. DXnG for the input stage. + * The API can be used for the input stages DX0, DX3 and DX5. + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableInputInversion() \n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_SetInputSource(XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input, const uint8_t source) +{ + channel->DXCR[input] = (uint32_t)(channel->DXCR[input] & (~(USIC_CH_DX0CR_INSW_Msk|USIC_CH_DX0CR_DSEN_Msk))); + XMC_USIC_CH_SetInputSource(channel, (XMC_USIC_CH_INPUT_t)input, source); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param pulse_length Length of the zero pulse in number of time quanta. \n + * \b Range: 0 to 7. + * @return None + * + * \parDescription
+ * Sets the length of zero pulse in number of time quanta. Value 0 indicates one time quanta.\n\n + * Maximum possible is 8 time quanta with the value configured as 7.\n + * The value is set to PCR_ASCMode register. + * \parRelated APIs:
+ * XMC_UART_CH_EnableInputInversion(), XMC_UART_CH_SetSamplePoint() \n\n\n + * +*/ +__STATIC_INLINE void XMC_UART_CH_SetPulseLength(XMC_USIC_CH_t *const channel, const uint8_t pulse_length) +{ + channel->PCR_ASCMode = (uint32_t)(channel->PCR_ASCMode & (~USIC_CH_PCR_ASCMode_PL_Msk)) | + ((uint32_t)pulse_length << USIC_CH_PCR_ASCMode_PL_Pos); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param sample_point Sample point among the number of samples. \n + * \b Range: minimum= 0, maximum= \a oversampling (DCTQ). + * @return None + * + * \parDescription
+ * Sets the sample point among the multiple samples for each UART symbol.\n\n + * The sample point is the one sample among number of samples set as oversampling. The value should be less than + * the oversampling value. XMC_UART_CH_Init() sets the sample point to the sample at the centre. For + * example if the oversampling is 16, then the sample point is set to 9. + * \parRelated APIs:
+ * XMC_UART_CH_EnableInputInversion(), XMC_UART_CH_SetSamplePoint() \n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_SetSamplePoint(XMC_USIC_CH_t *const channel, const uint32_t sample_point) +{ + channel->PCR_ASCMode = (uint32_t)((channel->PCR_ASCMode & (uint32_t)(~USIC_CH_PCR_ASCMode_SP_Msk)) | + (sample_point << USIC_CH_PCR_ASCMode_SP_Pos)); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @return None + * + * \parDescription
+ * Enables input inversion for UART input data signal.\n\n + * Polarity of the input source can be changed to provide inverted data input. + * \parRelated APIs:
+ * XMC_UART_CH_DisableInputInversion()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_EnableInputInversion(XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input) +{ + XMC_USIC_CH_EnableInputInversion(channel, (XMC_USIC_CH_INPUT_t)input); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @return None + * + * \parDescription
+ * Disables input inversion for UART input data signal.\n\n + * Resets the input data polarity for the UART input data signal. + * \parRelated APIs:
+ * XMC_UART_CH_EnableInputInversion()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_DisableInputInversion(XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input) +{ + XMC_USIC_CH_DisableInputInversion(channel, (XMC_USIC_CH_INPUT_t)input); +} +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @return None + * + * \parDescription
+ * Enables the digital filter for UART input stage.\n\n + * + * \parRelated APIs:
+ * XMC_UART_CH_DisableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_EnableInputDigitalFilter(XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input) +{ + XMC_USIC_CH_EnableInputDigitalFilter(channel, (XMC_USIC_CH_INPUT_t)input); +} +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @return None + * + * \parDescription
+ * Disables the digital filter for UART input stage.\n\n + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_DisableInputDigitalFilter(XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input) +{ + XMC_USIC_CH_DisableInputDigitalFilter(channel, (XMC_USIC_CH_INPUT_t)input); +} +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @return None + * \parDescription
+ * Enables synchronous input for the UART input stage.\n\n + * + * \parRelated APIs:
+ * XMC_UART_CH_DisableInputSync(), XMC_UART_CH_EnableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_EnableInputSync(XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input) +{ + XMC_USIC_CH_EnableInputSync(channel, (XMC_USIC_CH_INPUT_t)input); +} +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @return None + * + * \parDescription
+ * Disables synchronous input for the UART input stage.\n\n + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableInputSync(), XMC_UART_CH_EnableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_DisableInputSync(XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input) +{ + XMC_USIC_CH_DisableInputSync(channel, (XMC_USIC_CH_INPUT_t)input); +} +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @param input UART channel input stage of type @ref XMC_UART_CH_INPUT_t. \n + * \b Range: @ref XMC_UART_CH_INPUT_RXD (for DX0), + * @ref XMC_UART_CH_INPUT_RXD1 (for DX3), @ref XMC_UART_CH_INPUT_RXD2 (for DX5). + * @param sampling_freq Input sampling frequency. \n + * \b Range: @ref XMC_UART_CH_INPUT_SAMPLING_FREQ_FPERIPH, @ref XMC_UART_CH_INPUT_SAMPLING_FREQ_FRACTIONAL_DIVIDER. + * @return None + * + * \parDescription
+ * Sets the sampling frequency for the UART input stage.\n\n + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableInputSync(), XMC_UART_CH_EnableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_SetInputSamplingFreq(XMC_USIC_CH_t *const channel, + const XMC_UART_CH_INPUT_t input, + const XMC_UART_CH_INPUT_SAMPLING_FREQ_t sampling_freq) +{ + XMC_USIC_CH_SetInputSamplingFreq(channel, (XMC_USIC_CH_INPUT_t)input, (XMC_USIC_CH_INPUT_SAMPLING_FREQ_t)sampling_freq); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @return None + * + * \parDescription
+ * Enable data transmission.\n\n + * Use this function in combination with XMC_UART_CH_DisableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * @note If you need more control over the start of transmission use XMC_USIC_CH_SetStartTransmisionMode() + * + * \parRelated APIs:
+ * XMC_UART_CH_DisableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_EnableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_ON_TDV); +} + +/** + * @param channel Constant pointer to USIC channel handle of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_UART0_CH0, @ref XMC_UART0_CH1,@ref XMC_UART1_CH0,@ref XMC_UART1_CH1,@ref XMC_UART2_CH0,@ref XMC_UART2_CH1 @note Availability of UART1 and UART2 depends on device selection + * @return None + * + * \parDescription
+ * Disable data transmission.\n\n + * Use this function in combination with XMC_UART_CH_EnableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. + * FIFO is filled using XMC_USIC_CH_TXFIFO_PutData(). + * + * \parRelated APIs:
+ * XMC_UART_CH_EnableDataTransmission()\n\n\n + */ +__STATIC_INLINE void XMC_UART_CH_DisableDataTransmission(XMC_USIC_CH_t *const channel) +{ + XMC_USIC_CH_SetStartTransmisionMode(channel, XMC_USIC_CH_START_TRANSMISION_DISABLED); +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_usic.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_usic.h new file mode 100644 index 00000000..6eeb2daa --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_usic.h @@ -0,0 +1,2089 @@ +/** + * @file xmc_usic.h + * @date 2017-02-10 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * - Documentation improved
+ * + * 2015-05-08: + * - Added XMC_USIC_CH_SetInputTriggerCombinationMode() and XMC_USIC_CH_SetTransmitBufferStatus()
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * 2015-08-17: + * - Bug fixed in XMC_USIC_CH_SetTransmitBufferStatus API. OR operator removed. + * + * 2015-08-24: + * - Added APIs for enabling/disabling delay compensation XMC_USIC_CH_DisableDelayCompensation() and + * XMC_USIC_CH_DisableDelayCompensation() + * + * 2015-08-25: + * - Added APIs for defining if the data shift unit input is derived + * from the input data path DXn or from the selected protocol pre-processors: XMC_USIC_CH_ConnectInputDataShiftToPPP() + * and XMC_USIC_CH_ConnectInputDataShiftToDataInput() + * + * 2015-08-27: + * - Fixed bug in XMC_USIC_CH_BRG_CLOCK_SOURCE_DX1T value. + * - Added APIs for direct TBUF access: XMC_USIC_CH_WriteToTBUF() and XMC_USIC_CH_WriteToTBUFTCI() + * - Added APIs for external input for BRG configuration:XMC_USIC_CH_ConfigExternalInputSignalToBRG() and XMC_USIC_CH_SetBRGInputClockSource() + * + * 2015-08-28: + * - Added API for enabling the transfer trigger unit to set bit TCSR.TE if the trigger signal DX2T becomes active. Feature used for RS-232 + * Clear to Send (CTS) signal: XMC_USIC_CH_EnableTBUFDataValidTrigger() and XMC_USIC_CH_DisableTBUFDataValidTrigger(). + * + * 2016-03-09: + * - Optimization of write only registers + * + * 2016-04-10: + * - Added an API to put the data into FIFO when hardware port control is enabled: XMC_USIC_CH_TXFIFO_PutDataHPCMode()
+ * + * 2017-02-10: + * - Added XMC_USIC_CH_SetShiftDirection() to allow selection of shift direction of the data words for transmision and reception + * - Added XMC_USIC_CH_GetCaptureTimerValue() and XMC_USIC_CH_SetFractionalDivider() + * + * @endcond + * + */ + +#ifndef XMC_USIC_H +#define XMC_USIC_H +/******************************************************************************* + * HEADER FILES + *******************************************************************************/ + +#include "xmc_common.h" + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup USIC + * @brief Universal Serial Interface Channel(USIC) driver for serial communication. + * + * The Universal Serial Interface Channel(USIC) module is a flexible interface module + * covering several serial communication protocols. A USIC module contains two + * independent communication channels named USICx_CH0 and USICx_CH1, with x + * being the number of the USIC module. The user can program, during run-time, which protocol will be handled + * by each communication channel and which pins are used. + * The driver provides APIs, configuration structures and enumerations to configure common features of multiple serial + * communication protocols. + * + * USIC driver features: + * -# Allows configuration of FIFO for transmit and receive functions. + * -# Provides a structure type XMC_USIC_CH_t to represent the USIC channel registers in a programmer + friendly format. + * -# Allows configuration of automatic update for frame length, word length, slave select or slave address. + * -# Allows transmission of data to FIFO using XMC_USIC_CH_TXFIFO_PutData() and XMC_USIC_CH_TXFIFO_PutDataFLEMode() + * -# Allows reading of received data in FIFO using XMC_USIC_CH_RXFIFO_GetData() + * -# Allows configuration of baudrate using XMC_USIC_CH_SetBaudrate() + * -# Provides API to trigger interrupts using XMC_USIC_CH_TriggerServiceRequest() + * @{ + */ + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +#define XMC_USIC0 ((XMC_USIC_t *)USIC0_BASE) /**< USIC0 module base address */ +#define XMC_USIC0_CH0 ((XMC_USIC_CH_t *)USIC0_CH0_BASE) /**< USIC0 channel 0 base address */ +#define XMC_USIC0_CH1 ((XMC_USIC_CH_t *)USIC0_CH1_BASE) /**< USIC0 channel 1 base address */ + +#if defined(USIC1) +#define XMC_USIC1 ((XMC_USIC_t *)USIC1_BASE) /**< USIC1 module base address */ +#define XMC_USIC1_CH0 ((XMC_USIC_CH_t *)USIC1_CH0_BASE) /**< USIC1 channel 0 base address */ +#define XMC_USIC1_CH1 ((XMC_USIC_CH_t *)USIC1_CH1_BASE) /**< USIC1 channel 1 base address */ +#endif + +#if defined(USIC2) +#define XMC_USIC2 ((XMC_USIC_t *)USIC2_BASE) /**< USIC2 module base address */ +#define XMC_USIC2_CH0 ((XMC_USIC_CH_t *)USIC2_CH0_BASE) /**< USIC2 channel 0 base address */ +#define XMC_USIC2_CH1 ((XMC_USIC_CH_t *)USIC2_CH1_BASE) /**< USIC2 channel 1 base address */ +#endif + +#define USIC_CH_DXCR_DSEL_Msk USIC_CH_DX0CR_DSEL_Msk /**< Common mask for DSEL bitfield mask in DXnCR register */ +#define USIC_CH_DXCR_DSEL_Pos USIC_CH_DX0CR_DSEL_Pos /**< Common mask for DSEL bitfield position in DXnCR register */ +#define USIC_CH_DXCR_SFSEL_Pos USIC_CH_DX0CR_SFSEL_Pos /**< Common mask for SFSEL bitfield position in DXnCR register */ +#define USIC_CH_DXCR_SFSEL_Msk USIC_CH_DX0CR_SFSEL_Msk /**< Common mask for SFSEL bitfield mask in DXnCR register */ +#define USIC_CH_DXCR_DPOL_Msk USIC_CH_DX0CR_DPOL_Msk /**< Common mask for DPOL bitfield mask in DXnCR register */ +#define USIC_CH_DXCR_DFEN_Msk USIC_CH_DX0CR_DFEN_Msk /**< Common mask for DFEN bitfield mask in DXnCR register */ +#define USIC_CH_DXCR_DSEN_Msk USIC_CH_DX0CR_DSEN_Msk /**< Common mask for DSEN bitfield mask in DXnCR register */ +#define USIC_CH_DXCR_CM_Pos USIC_CH_DX0CR_CM_Pos /**< Common mask for CM bitfield position in DXnCR register */ +#define USIC_CH_DXCR_CM_Msk USIC_CH_DX0CR_CM_Msk /**< Common mask for CM bitfield mask in DXnCR register */ +#define USIC_CH_DXCR_INSW_Msk USIC_CH_DX0CR_INSW_Msk /**< Common mask for INSW bitfield mask in DXnCR register */ +#define USIC_CH_DXCR_INSW_pos USIC_CH_DX0CR_INSW_Pos /**< Common mask for INSW bitfield position in DXnCR register */ + +#if UC_FAMILY == XMC1 + #include "xmc1_usic_map.h" +#endif + +#if UC_FAMILY == XMC4 + #include "xmc4_usic_map.h" +#endif + +/******************************************************************************* + * ENUMS + *******************************************************************************/ + +/** + * USIC channel driver status + */ +typedef enum XMC_USIC_CH_STATUS +{ + XMC_USIC_CH_STATUS_OK, /**< USIC driver status : OK */ + XMC_USIC_CH_STATUS_ERROR, /**< USIC driver status : ERROR */ + XMC_USIC_CH_STATUS_BUSY /**< USIC driver status : BUSY */ +} XMC_USIC_CH_STATUS_t; + +/** +* USIC channel kernel mode +*/ +typedef enum XMC_USIC_CH_KERNEL_MODE +{ + XMC_USIC_CH_KERNEL_MODE_RUN_0 = 0x0UL, /**< Run mode 0 (transmission and reception possible)*/ + XMC_USIC_CH_KERNEL_MODE_RUN_1 = 0x1UL << USIC_CH_KSCFG_NOMCFG_Pos, /**< Run mode 1 (transmission and reception possible)*/ + XMC_USIC_CH_KERNEL_MODE_STOP_0 = 0x2UL << USIC_CH_KSCFG_NOMCFG_Pos, /**< Stop mode 0 (no transmission, but reception possible)*/ + XMC_USIC_CH_KERNEL_MODE_STOP_1 = 0x3UL << USIC_CH_KSCFG_NOMCFG_Pos /**< Stop mode 1 (both transmission and reception not possible)*/ +} XMC_USIC_CH_KERNEL_MODE_t; + +/** + * USIC channel operating mode + */ +typedef enum XMC_USIC_CH_OPERATING_MODE +{ + XMC_USIC_CH_OPERATING_MODE_IDLE = 0x0UL, /**< USIC channel idle */ + XMC_USIC_CH_OPERATING_MODE_SPI = 0x1UL << USIC_CH_CCR_MODE_Pos, /**< SPI mode */ + XMC_USIC_CH_OPERATING_MODE_UART = 0x2UL << USIC_CH_CCR_MODE_Pos, /**< UART mode */ + XMC_USIC_CH_OPERATING_MODE_I2S = 0x3UL << USIC_CH_CCR_MODE_Pos, /**< I2S mode */ + XMC_USIC_CH_OPERATING_MODE_I2C = 0x4UL << USIC_CH_CCR_MODE_Pos /**< I2C mode */ +} XMC_USIC_CH_OPERATING_MODE_t; + +/** + * USIC channel inputs + */ +typedef enum XMC_USIC_CH_INPUT +{ + XMC_USIC_CH_INPUT_DX0, /**< DX0 input */ + XMC_USIC_CH_INPUT_DX1, /**< DX1 input */ + XMC_USIC_CH_INPUT_DX2, /**< DX2 input */ + XMC_USIC_CH_INPUT_DX3, /**< DX3 input */ + XMC_USIC_CH_INPUT_DX4, /**< DX4 input */ + XMC_USIC_CH_INPUT_DX5 /**< DX5 input */ +} XMC_USIC_CH_INPUT_t; + +/** + * USIC channel input source sampling frequency + */ +typedef enum XMC_USIC_CH_INPUT_SAMPLING_FREQ +{ + XMC_USIC_CH_INPUT_SAMPLING_FREQ_FPERIPH = 0x0UL, /**< Use fperiph frequency for input source sampling*/ + XMC_USIC_CH_INPUT_SAMPLING_FREQ_FRACTIONAL_DIVIDER = 0x1UL << USIC_CH_DXCR_SFSEL_Pos /**< Use fFD(fractional divider) frequency for input source sampling*/ +} XMC_USIC_CH_INPUT_SAMPLING_FREQ_t; + +/** + * USIC channel input combination mode + */ +typedef enum XMC_USIC_CH_INPUT_COMBINATION_MODE +{ + XMC_USIC_CH_INPUT_COMBINATION_MODE_TRIGGER_DISABLED = 0x0UL, /**< The trigger activation is disabled.*/ + XMC_USIC_CH_INPUT_COMBINATION_MODE_RISING_EDGE = 0x1UL, /**< A rising edge activates DXnT*/ + XMC_USIC_CH_INPUT_COMBINATION_MODE_FALLING_EDGE = 0x2UL, /**< A falling edge activates DXnT*/ + XMC_USIC_CH_INPUT_COMBINATION_MODE_BOTH_EDGES = 0x3UL, /**< Both edges activate DXnT*/ +} XMC_USIC_CH_INPUT_COMBINATION_MODE_t; + +/** + * USIC channel data transmission start modes. + * Data shifted out of the transmit pin depends on the value configured for the + * TDEN bitfield of the TCSR register. Following enum values are used for configuring + * the TCSR->TDEN bitfield. + */ +typedef enum XMC_USIC_CH_START_TRANSMISION_MODE +{ + XMC_USIC_CH_START_TRANSMISION_DISABLED = 0x0U, /**< Passive data level is sent out on transmission. */ + XMC_USIC_CH_START_TRANSMISION_ON_TDV = 0x1UL << USIC_CH_TCSR_TDEN_Pos, /**< Transmission of the data word in TBUF can be started if TDV = 1 */ + XMC_USIC_CH_START_TRANSMISION_ON_TDV_DX2S_0 = 0x2UL << USIC_CH_TCSR_TDEN_Pos, /**< Transmission of the data word in TBUF can be started if TDV = 1 while DX2S_0 */ + XMC_USIC_CH_START_TRANSMISION_ON_TDV_DX2S_1 = 0x3UL << USIC_CH_TCSR_TDEN_Pos /**< Transmission of the data word in TBUF can be started if TDV = 1 while DX2S_1 */ +} XMC_USIC_CH_START_TRANSMISION_MODE_t; + +/** + * USIC channel interrupt node pointers + */ +typedef enum XMC_USIC_CH_INTERRUPT_NODE_POINTER +{ + XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT = USIC_CH_INPR_TSINP_Pos, /**< Node pointer for transmit shift interrupt */ + XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER = USIC_CH_INPR_TBINP_Pos, /**< Node pointer for transmit buffer interrupt */ + XMC_USIC_CH_INTERRUPT_NODE_POINTER_RECEIVE = USIC_CH_INPR_RINP_Pos, /**< Node pointer for receive interrupt */ + XMC_USIC_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE = USIC_CH_INPR_AINP_Pos, /**< Node pointer for alternate receive interrupt */ + XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL = USIC_CH_INPR_PINP_Pos /**< Node pointer for protocol related interrupts */ +} XMC_USIC_CH_INTERRUPT_NODE_POINTER_t; + +/** + * USIC channel events + */ +typedef enum XMC_USIC_CH_EVENT +{ + XMC_USIC_CH_EVENT_RECEIVE_START = USIC_CH_CCR_RSIEN_Msk, /**< Receive start event */ + XMC_USIC_CH_EVENT_DATA_LOST = USIC_CH_CCR_DLIEN_Msk, /**< Data lost event */ + XMC_USIC_CH_EVENT_TRANSMIT_SHIFT = USIC_CH_CCR_TSIEN_Msk, /**< Transmit shift event */ + XMC_USIC_CH_EVENT_TRANSMIT_BUFFER = USIC_CH_CCR_TBIEN_Msk, /**< Transmit buffer event */ + XMC_USIC_CH_EVENT_STANDARD_RECEIVE = USIC_CH_CCR_RIEN_Msk, /**< Receive event */ + XMC_USIC_CH_EVENT_ALTERNATIVE_RECEIVE = USIC_CH_CCR_AIEN_Msk, /**< Alternate receive event */ + XMC_USIC_CH_EVENT_BAUD_RATE_GENERATOR = USIC_CH_CCR_BRGIEN_Msk /**< Baudrate generator event */ +} XMC_USIC_CH_EVENT_t; + +/** +* USIC channel parity mode +*/ +typedef enum XMC_USIC_CH_PARITY_MODE +{ + XMC_USIC_CH_PARITY_MODE_NONE = 0x0UL, /**< Disable parity mode */ + XMC_USIC_CH_PARITY_MODE_EVEN = 0x2UL << USIC_CH_CCR_PM_Pos, /**< Enable even parity mode */ + XMC_USIC_CH_PARITY_MODE_ODD = 0x3UL << USIC_CH_CCR_PM_Pos /**< Enable odd parity mode */ +} XMC_USIC_CH_PARITY_MODE_t; + +/** +* USIC channel data output mode +*/ +typedef enum XMC_USIC_CH_DATA_OUTPUT_MODE +{ + XMC_USIC_CH_DATA_OUTPUT_MODE_NORMAL = 0x0UL, /**< Data output normal mode */ + XMC_USIC_CH_DATA_OUTPUT_MODE_INVERTED = 0x1UL << USIC_CH_SCTR_DOCFG_Pos /**< Data output inverted mode */ +} XMC_USIC_CH_DATA_OUTPUT_MODE_t; + +/** +* USIC channel data transmit buffer status +*/ +typedef enum XMC_USIC_CH_TBUF_STATUS +{ + XMC_USIC_CH_TBUF_STATUS_IDLE = 0x0UL, /**< Transfer buffer is currently idle*/ + XMC_USIC_CH_TBUF_STATUS_BUSY = USIC_CH_TCSR_TDV_Msk /**< Transfer buffer is currently busy*/ +} XMC_USIC_CH_TBUF_STATUS_t; + + + +/** +* USIC channel data transmit buffer status modification +*/ +typedef enum XMC_USIC_CH_TBUF_STATUS_SET +{ + XMC_USIC_CH_TBUF_STATUS_SET_BUSY = 0x1UL, /**< Set Transfer buffer status to busy*/ + XMC_USIC_CH_TBUF_STATUS_SET_IDLE = 0x2UL /**< Set Transfer buffer status to idle*/ +} XMC_USIC_CH_TBUF_STATUS_SET_t; + +/** +* USIC channel receive buffer status +*/ +typedef enum XMC_USIC_CH_RBUF_STATUS +{ + XMC_USIC_CH_RBUF_STATUS_DATA_VALID0 = USIC_CH_RBUFSR_RDV0_Msk, /**< RBUF0 data has not yet been read out*/ + XMC_USIC_CH_RBUF_STATUS_DATA_VALID1 = USIC_CH_RBUFSR_RDV1_Msk /**< RBUF1 data has not yet been read out*/ +} XMC_USIC_CH_RBUF_STATUS_t; + +/** + * USIC channel output signal passive data level +*/ +typedef enum XMC_USCI_CH_PASSIVE_DATA_LEVEL +{ + XMC_USIC_CH_PASSIVE_DATA_LEVEL0 = 0x0UL, /**< Passive level(idle mode signal level) 0 */ + XMC_USIC_CH_PASSIVE_DATA_LEVEL1 = 0x1UL << USIC_CH_SCTR_PDL_Pos /**< Passive level(idle mode signal level) 1 */ +} XMC_USIC_CH_PASSIVE_DATA_LEVEL_t; + +/** +* USIC channel receive FIFO size +*/ +typedef enum XMC_USIC_CH_FIFO_SIZE +{ + XMC_USIC_CH_FIFO_DISABLED = 0x0U, /**< FIFO Disabled */ + XMC_USIC_CH_FIFO_SIZE_2WORDS = 0x1U, /**< FIFO size: 2 words */ + XMC_USIC_CH_FIFO_SIZE_4WORDS = 0x2U, /**< FIFO size: 4 words */ + XMC_USIC_CH_FIFO_SIZE_8WORDS = 0x3U, /**< FIFO size: 8 words */ + XMC_USIC_CH_FIFO_SIZE_16WORDS = 0x4U, /**< FIFO size: 16 words */ + XMC_USIC_CH_FIFO_SIZE_32WORDS = 0x5U, /**< FIFO size: 32 words */ + XMC_USIC_CH_FIFO_SIZE_64WORDS = 0x6U /**< FIFO size: 64 words */ +} XMC_USIC_CH_FIFO_SIZE_t; + +/** +* USIC channel transmit FIFO interrupt node pointers +*/ +typedef enum XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER +{ + XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER_STANDARD = USIC_CH_TBCTR_STBINP_Pos, /**< Node pointer for FIFO standard transmit interrupt */ + XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER_ALTERNATE = USIC_CH_TBCTR_ATBINP_Pos /**< Node pointer for transmit FIFO error interrupt */ +} XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER_t; + +/** +* USIC channel transmit FIFO event configuration +*/ +typedef enum XMC_USIC_CH_TXFIFO_EVENT_CONF +{ + XMC_USIC_CH_TXFIFO_EVENT_CONF_STANDARD = USIC_CH_TBCTR_STBIEN_Msk, /**< Enable FIFO standard transmit interrupt */ + XMC_USIC_CH_TXFIFO_EVENT_CONF_ERROR = (int32_t)USIC_CH_TBCTR_TBERIEN_Msk /**< Enable transmit FIFO error interrupt */ +} XMC_USIC_CH_TXFIFO_EVENT_CONF_t; + +/** +* USIC channel transmit FIFO status +*/ +typedef enum XMC_USIC_CH_TXFIFO_EVENT +{ + XMC_USIC_CH_TXFIFO_EVENT_STANDARD = USIC_CH_TRBSR_STBI_Msk, /**< Transmit FIFO status: Standard event */ + XMC_USIC_CH_TXFIFO_EVENT_ERROR = USIC_CH_TRBSR_TBERI_Msk /**< Transmit FIFO status: Error event */ +} XMC_USIC_CH_TXFIFO_EVENT_t; + +/** +* USIC channel receive FIFO interrupt node pointers +*/ +typedef enum XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER +{ + XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_STANDARD = USIC_CH_RBCTR_SRBINP_Pos, /**< Node pointer for FIFO standard receive interrupt */ + XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_ALTERNATE = USIC_CH_RBCTR_ARBINP_Pos /**< Node pointer for FIFO alternative receive interrupt */ +} XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_t; + +/** +* USIC channel receive FIFO event configuration +*/ +typedef enum XMC_USIC_CH_RXFIFO_EVENT_CONF +{ + XMC_USIC_CH_RXFIFO_EVENT_CONF_STANDARD = USIC_CH_RBCTR_SRBIEN_Msk, /**< Enable FIFO standard receive interrupt */ + XMC_USIC_CH_RXFIFO_EVENT_CONF_ERROR = (int32_t)USIC_CH_RBCTR_RBERIEN_Msk, /**< Enable receive FIFO error interrupt */ + XMC_USIC_CH_RXFIFO_EVENT_CONF_ALTERNATE = USIC_CH_RBCTR_ARBIEN_Msk /**< Enable FIFO alternative receive interrupt */ +} XMC_USIC_CH_RXFIFO_EVENT_CONF_t; + +/** +* USIC channel receive FIFO status +*/ +typedef enum XMC_USIC_CH_RXFIFO_EVENT +{ + XMC_USIC_CH_RXFIFO_EVENT_STANDARD = USIC_CH_TRBSR_SRBI_Msk, /**< Receive FIFO status: Standard event */ + XMC_USIC_CH_RXFIFO_EVENT_ERROR = USIC_CH_TRBSR_RBERI_Msk, /**< Receive FIFO status: Error event */ + XMC_USIC_CH_RXFIFO_EVENT_ALTERNATE = USIC_CH_TRBSR_ARBI_Msk /**< Receive FIFO status: Alternative event */ +} XMC_USIC_CH_RXFIFO_EVENT_t; + +/** +* USIC channel baudrate generator clock source +*/ +typedef enum XMC_USIC_CH_BRG_CLOCK_SOURCE +{ + XMC_USIC_CH_BRG_CLOCK_SOURCE_DIVIDER = 0x0UL, /**< Baudrate generator clock source : Source divider. (Internal clock source)*/ + XMC_USIC_CH_BRG_CLOCK_SOURCE_DX1T = 0x2UL << USIC_CH_BRG_CLKSEL_Pos /**< Baudrate generator clock source : DX1T. (External clock source) */ +} XMC_USIC_CH_BRG_CLOCK_SOURCE_t; + +/** +* USIC channel baudrate generator divider mode +*/ +typedef enum XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE +{ + XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_DISABLED = 0x0UL, /**< Baudrate generator clock divider: Disabled */ + XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_NORMAL = 0x1UL << USIC_CH_FDR_DM_Pos, /**< Baudrate generator clock divider: Normal mode */ + XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_FRACTIONAL = 0x2UL << USIC_CH_FDR_DM_Pos /**< Baudrate generator clock divider: Fractional mode */ +} XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_t; + +/** +* USIC channel baudrate generator master clock passive level +*/ +typedef enum XMC_USIC_CH_BRG_MASTER_CLOCK_PASSIVE_LEVEL +{ + XMC_USIC_CH_BRG_MASTER_CLOCK_PASSIVE_LEVEL_0 = 0x0UL, /**< Baudrate generator master clock passive level(idle mode signal level) 0*/ + XMC_USIC_CH_BRG_MASTER_CLOCK_PASSIVE_LEVEL_1 = 0x1UL << USIC_CH_BRG_MCLKCFG_Pos /**< Baudrate generator master clock passive level((idle mode signal level)) 1*/ +} XMC_USIC_CH_BRG_MASTER_CLOCK_PASSIVE_LEVEL_t; + +/** +* USIC channel baudrate generator shift clock passive level +*/ +typedef enum XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL +{ + XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_DISABLED = 0x0UL, /**< Shift clock passive level 0, delay disabled */ + XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_DISABLED = 0x1UL << USIC_CH_BRG_SCLKCFG_Pos, /**< Shift clock passive level 1, delay disabled */ + XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_ENABLED = (int32_t)(0x2UL << USIC_CH_BRG_SCLKCFG_Pos), /**< Shift clock passive level 0, delay enabled */ + XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_ENABLED = (int32_t)(0x3UL << USIC_CH_BRG_SCLKCFG_Pos) /**< Shift clock passive level 1, delay enabled */ +} XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t; + +/** +* USIC channel baudrate generator shift clock output +*/ +typedef enum XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT +{ + XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK = 0x0UL, /**< Baudrate generator shift clock output: SCL.(Internally generated shift clock)*/ + XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_DX1 = 0x1UL << USIC_CH_BRG_SCLKOSEL_Pos /**< Baudrate generator shift clock output: DX1. (External input shift clock)*/ +} XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_t; + +/** +* USIC channel shift direction. +* Defines the shift direction of the data words for transmission and reception +*/ +typedef enum XMC_USIC_CH_SHIFT_DIRECTION +{ + XMC_USIC_CH_SHIFT_DIRECTION_LSB_FIRST = 0x0UL, /**< Shift LSB first. The first data bit of a data word is located at bit position 0. */ + XMC_USIC_CH_SHIFT_DIRECTION_MSB_FIRST = 0x1UL << USIC_CH_SCTR_SDIR_Msk /**< Shift MSB first. The first data bit of a data word is located at the bit position given by the configured word length. */ +} XMC_USIC_CH_SHIFT_DIRECTION_t; + + +/******************************************************************************* + * DATA STRUCTURES + *******************************************************************************/ + +/*Anonymous structure/union guard start*/ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * USIC module structure + */ +typedef USIC_GLOBAL_TypeDef XMC_USIC_t; + +/** + * USIC channel structure.
The members of the structure are same as in the device header file, + * except for some registers. + * DX0CR, DX1CR, DX2CR, DX3CR, DX4CR and DX5CR are replaced with the array DXCR[6]. + * TBUF0 to TBUF31 are replaced with TBUF[32]. + * IN0 to IN31 are replaced with IN[32]. + */ +typedef struct XMC_USIC_CH +{ + __I uint32_t RESERVED0; + __I uint32_t CCFG; /**< Channel configuration register*/ + __I uint32_t RESERVED1; + __IO uint32_t KSCFG; /**< Kernel state configuration register*/ + __IO uint32_t FDR; /**< Fractional divider configuration register*/ + __IO uint32_t BRG; /**< Baud rate generator register*/ + __IO uint32_t INPR; /**< Interrupt node pointer register*/ + __IO uint32_t DXCR[6]; /**< Input control registers DX0 to DX5.*/ + __IO uint32_t SCTR; /**< Shift control register*/ + __IO uint32_t TCSR; + + union { + __IO uint32_t PCR_IICMode; /**< I2C protocol configuration register*/ + __IO uint32_t PCR_IISMode; /**< I2S protocol configuration register*/ + __IO uint32_t PCR_SSCMode; /**< SPI protocol configuration register*/ + __IO uint32_t PCR; /**< Protocol configuration register*/ + __IO uint32_t PCR_ASCMode; /**< UART protocol configuration register*/ + }; + __IO uint32_t CCR; /**< Channel control register*/ + __IO uint32_t CMTR; /**< Capture mode timer register*/ + + union { + __IO uint32_t PSR_IICMode; /**< I2C protocol status register*/ + __IO uint32_t PSR_IISMode; /**< I2S protocol status register*/ + __IO uint32_t PSR_SSCMode; /**< SPI protocol status register*/ + __IO uint32_t PSR; /**< Protocol status register*/ + __IO uint32_t PSR_ASCMode; /**< UART protocol status register*/ + }; + __O uint32_t PSCR; /**< Protocol status clear register*/ + __I uint32_t RBUFSR; /**< Receive buffer status register*/ + __I uint32_t RBUF; /**< Receive buffer register*/ + __I uint32_t RBUFD; /**< Debug mode receive buffer register*/ + __I uint32_t RBUF0; /**< Receive buffer 0*/ + __I uint32_t RBUF1; /**< Receive buffer 1*/ + __I uint32_t RBUF01SR; /**< Receive buffer status register*/ + __O uint32_t FMR; /**< Flag modification register*/ + __I uint32_t RESERVED2[5]; + __IO uint32_t TBUF[32]; /**< Tranmsit buffer registers*/ + __IO uint32_t BYP; /**< FIFO bypass register*/ + __IO uint32_t BYPCR; /**< FIFO bypass control register*/ + __IO uint32_t TBCTR; /**< Transmit FIFO control register*/ + __IO uint32_t RBCTR; /**< Receive FIFO control register*/ + __I uint32_t TRBPTR; /**< Transmit/recive buffer pointer register*/ + __IO uint32_t TRBSR; /**< Transmit/receive buffer status register*/ + __O uint32_t TRBSCR; /**< Transmit/receive buffer status clear register*/ + __I uint32_t OUTR; /**< Receive FIFO output register*/ + __I uint32_t OUTDR; /**< Receive FIFO debug output register*/ + __I uint32_t RESERVED3[23]; + __O uint32_t IN[32]; /**< Transmit FIFO input register*/ +} XMC_USIC_CH_t; + + +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif + +/******************************************************************************* + * API PROTOTYPES + ******************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +__STATIC_INLINE bool XMC_USIC_IsModuleValid(const XMC_USIC_t *const module) +{ + bool tmp; + + tmp = (module == XMC_USIC0); +#if defined(XMC_USIC1) + tmp = tmp || (module == XMC_USIC1); +#endif +#if defined(XMC_USIC2) + tmp = tmp || (module == XMC_USIC2); +#endif + + return tmp; +} + +__STATIC_INLINE bool XMC_USIC_IsChannelValid(const XMC_USIC_CH_t *const channel) +{ + bool tmp; + + tmp = ((channel == XMC_USIC0_CH0) || (channel == XMC_USIC0_CH1)); +#if defined(XMC_USIC1) + tmp = tmp || ((channel == XMC_USIC1_CH0) || (channel == XMC_USIC1_CH1)); +#endif +#if defined(XMC_USIC2) + tmp = tmp || ((channel == XMC_USIC2_CH0) || (channel == XMC_USIC2_CH1)); +#endif + + return tmp; +} + +/* Common APIs */ + +/** + * @param usic Pointer to USIC module handler of type @ref XMC_USIC_t.\n + * \b Range: @ref XMC_USIC0 to @ref XMC_USIC2 based on device support. + * @return None + * + * \parDescription
+ * Enables the USIC module.\n\n + * Enables the clock for the USIC module by following the + * clock enabling sequence for the selected device. + * + * \parRelated APIs:
+ * XMC_USIC_CH_Enable(), XMC_USIC_Disable() \n\n\n + */ +void XMC_USIC_Enable(XMC_USIC_t *const usic); +/** + * @param usic Pointer to USIC module handler of type @ref XMC_USIC_t.\n + * \b Range: @ref XMC_USIC0 to @ref XMC_USIC2 based on device support. + * @return None + * + * \parDescription
+ * Disables the USIC module.\n\n + * Disables the clock for the USIC module by following the clock + * disabling sequence for the selected device. + * + * \parRelated APIs:
+ * XMC_USIC_CH_Disable(), XMC_USIC_Enable() \n\n\n + */ +void XMC_USIC_Disable(XMC_USIC_t *const usic); +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Enables the USIC channel. \n\n + * USIC channel is enabled by setting the module enable bit in KSCFG register bitfield MODEN. + * On enabling, the channel is set to idle mode. + * + * \parRelated APIs:
+ * XMC_USIC_CH_Disable(), XMC_USIC_Enable() \n\n\n + */ +void XMC_USIC_CH_Enable(XMC_USIC_CH_t *const channel); +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Disables the USIC channel.\n\n + * USIC channel is disabled by setting the module enable bit(MDEN) to 0 in the register KSCFG. + * + * \parRelated APIs:
+ * XMC_USIC_CH_Enable(), XMC_USIC_Disable() \n\n\n + */ +void XMC_USIC_CH_Disable(XMC_USIC_CH_t *const channel); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param rate Desired baudrate. \b Range: minimum value = 100, maximum value depends on the peripheral clock frequency \n + * and \a oversampling. Maximum baudrate can be derived using the formula: (fperiph * 1023)/(1024 * oversampling) + * @param oversampling Required oversampling. The value indicates the number of time quanta for one symbol of data. \n + * This can be related to the number of samples for each logic state of the data signal. \n + * \b Range: 1 to 32. Value should be chosen based on the protocol used. + * @return Status indicating the baudrate configuration.\n + * \b Range: @ref XMC_USIC_CH_STATUS_OK if baudrate is successfully configured, + * @ref XMC_USIC_CH_STATUS_ERROR if desired baudrate or oversampling is invalid. + * + * \parDescription
+ * Configures the baudrate of the USIC channel. \n\n + * Baudrate is configured by considering the peripheral frequency and the desired baudrate. + * Optimum values of FDR->STEP and BRG->PDIV are calulated and used for generating the desired + * baudrate. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetStartTransmisionMode(), XMC_USIC_CH_SetInputSource() \n\n\n + */ +XMC_USIC_CH_STATUS_t XMC_USIC_CH_SetBaudrate(XMC_USIC_CH_t *const channel, uint32_t rate, uint32_t oversampling); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param pdiv Desired divider for the external frequency input. \b Range: minimum value = 1, maximum value = 1024 \n + * @param oversampling Required oversampling. The value indicates the number of time quanta for one symbol of data. \n + * This can be related to the number of samples for each logic state of the data signal. \n + * \b Range: 1 to 32. Value should be chosen based on the protocol used. + * @param combination_mode Selects which edge of the synchronized(and optionally filtered) signal DXnS actives the trigger + * output DXnT of the input stage. + * + * @return None + * + * \parDescription
+ * Enables the external frequency input for the Baudrate Generator and configures the divider, oversampling and + * the combination mode of the USIC channel. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetBRGInputClockSource(), XMC_USIC_CH_SetInputTriggerCombinationMode() \n\n\n + */ +void XMC_USIC_CH_ConfigExternalInputSignalToBRG(XMC_USIC_CH_t *const channel, + const uint16_t pdiv, + const uint32_t oversampling, + const XMC_USIC_CH_INPUT_COMBINATION_MODE_t combination_mode); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @param source Input source select for the input stage. The table below maps the enum value with the input channel. + * + * + *
0DXnA
1DXnB
2DXnC
3DXnD
4DXnE
5DXnF
6DXnG
7Always 1
+ * @return None + * + * \parDescription
+ * Selects the data source for USIC input stage.\n\n + * Selects the input data signal source among DXnA, DXnB.. DXnG for the input stage. The API can be used for all the input stages + * like DX0CR, DX1CR etc. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableInputInversion(), XMC_USIC_CH_EnableInputDigitalFilter(), XMC_USIC_CH_EnableInputSync(), + * XMC_USIC_CH_SetInputSamplingFreq()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetInputSource(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input, const uint8_t source) +{ + channel->DXCR[input] = (uint32_t)((channel->DXCR[input] & (uint32_t)(~USIC_CH_DXCR_DSEL_Msk)) | + ((uint32_t)source << USIC_CH_DXCR_DSEL_Pos)); +} +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * The input of the data shift unit is controlled by the + * protocol pre-processor. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_ConnectInputDataShiftToDataInput()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_ConnectInputDataShiftToPPP(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] &=(uint32_t)~USIC_CH_DXCR_INSW_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * The input of the data shift unit is connected to + * the selected data input line. \n\n + * + * This setting is used + * if the signals are directly derived from an input + * pin without treatment by the protocol preprocessor. + * \parRelated APIs:
+ * XMC_USIC_CH_ConnectInputDataShiftToPPP()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_ConnectInputDataShiftToDataInput(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] |= USIC_CH_DXCR_INSW_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * Enables input inversion for USIC channel input data signal. \n\n + * + * Polarity of the input source can be changed to provide inverted data input. + * \parRelated APIs:
+ * XMC_USIC_CH_DisableInputInversion()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableInputInversion(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] |= USIC_CH_DXCR_DPOL_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * Disables input inversion for USIC channel. \n\n + * + * Resets the input data polarity for the USIC channel input data signal. + * \parRelated APIs:
+ * XMC_USIC_CH_EnableInputInversion()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_DisableInputInversion(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] &=(uint32_t)~USIC_CH_DXCR_DPOL_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Enables delay compensation. \n\n + * + * Delay compensation can be applied to the receive path. + * \parRelated APIs:
+ * XMC_USIC_CH_DisableDelayCompensation()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableDelayCompensation(XMC_USIC_CH_t *const channel) +{ + channel->DXCR[1U] |= USIC_CH_DX1CR_DCEN_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Disables delay compensation.. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableDelayCompensation()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_DisableDelayCompensation(XMC_USIC_CH_t *const channel) +{ + channel->DXCR[1U] &=(uint32_t)~USIC_CH_DX1CR_DCEN_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * Enables the input digital filter for USIC channel input data signal. \n\n + * Input data signal from the selected multiplexer will be digitally filtered. + * + * \parRelated APIs:
+ * XMC_USIC_CH_DisableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableInputDigitalFilter(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] |= (uint32_t)USIC_CH_DXCR_DFEN_Msk; +} +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * Disables the input digital filter for USIC channel input data signal. \n\n + * Input data signal from the selected multiplexer will not be digitally filtered. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_DisableInputDigitalFilter(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] &=(uint32_t)~USIC_CH_DXCR_DFEN_Msk; +} +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * Enables input synchronization for the USIC channel input data signal. \n\n + * Input data signal from the selected multiplexer will be synchronized with fPERIPH. + * A noisy signal can be synchronized and filtered by enabling the digital filter. + * + * \parRelated APIs:
+ * XMC_USIC_CH_DisableInputSync(), XMC_USIC_CH_EnableInputDigitalFilter()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableInputSync(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] |=(uint32_t)USIC_CH_DXCR_DSEN_Msk; +} +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @return None + * + * \parDescription
+ * Disables input synchronization for the USIC channel input data signal. \n\n + * Input data signal from the selected multiplexer will not be synchronized. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableInputSync(), XMC_USIC_CH_DisableInputDigitalFilter() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_DisableInputSync(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_INPUT_t input) +{ + channel->DXCR[input] &=(uint32_t)~USIC_CH_DXCR_DSEN_Msk; +} +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support.. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @param sampling_freq Sampling frequency value of type \a XMC_USIC_CH_INPUT_SAMPLING_FREQ_t. + * @return None + * + * \parDescription
+ * Sets sampling frequency for USIC channel input data signal. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetInputSource(), XMC_USIC_CH_EnableInputSync(), XMC_USIC_CH_EnableInputDigitalFilter() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetInputSamplingFreq(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_INPUT_t input, + const XMC_USIC_CH_INPUT_SAMPLING_FREQ_t sampling_freq) +{ + channel->DXCR[input] = (uint32_t)(channel->DXCR[input] & (~USIC_CH_DXCR_SFSEL_Msk)) | + ((uint32_t)sampling_freq); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support.. + * @param input USIC channel input stage of type @ref XMC_USIC_CH_INPUT_t. \n + * \b Range: @ref XMC_USIC_CH_INPUT_DX0 to @ref XMC_USIC_CH_INPUT_DX5 + * @param combination_mode Combination mode value of type \a XMC_USIC_CH_INPUT_COMBINATION_MODE_t. + * @return None + * + * \parDescription
+ * Selects which edge of the synchronized signal DXnS activates the trigger output DXnT of the input stage. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetInputSource(), XMC_USIC_CH_EnableInputSync(), XMC_USIC_CH_EnableInputDigitalFilter() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetInputTriggerCombinationMode(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_INPUT_t input, + const XMC_USIC_CH_INPUT_COMBINATION_MODE_t combination_mode) +{ + channel->DXCR[input] = (uint32_t)(channel->DXCR[input] & (~USIC_CH_DXCR_CM_Msk)) | + ((uint32_t)combination_mode << USIC_CH_DXCR_CM_Pos); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param clock_source clock source for the BRG. + * @return None + * + * \parDescription
+ * Sets the clock source for the BRG. \n\n + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetInputTriggerCombinationMode(), XMC_USIC_CH_SetExternalClockBRGDivider()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetBRGInputClockSource(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_BRG_CLOCK_SOURCE_t clock_source) +{ + channel->BRG = (uint32_t)(channel->BRG & (~USIC_CH_BRG_CLKSEL_Msk)) | (uint32_t)(clock_source); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data Data to be transmitted. \n + * \b Range: 16bit unsigned data. minimum= 0, maximum= 65535 + * @return None + * + * \parDescription
+ * Writes data into the transmit buffer. \n\n + * The data provided is placed in TBUF[0U]. + * + * + * \parRelated APIs:
+ * XMC_USIC_CH_WriteToTBUFTCI() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_WriteToTBUF(XMC_USIC_CH_t *const channel, const uint16_t data) +{ + channel->TBUF[0U] = data; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data Data to be transmitted. + * @param transmit_control_information transmit control information to be configured while transmitting the data. \n + * \b Range: minimum= 0, maximum= 31. + * @return None + * + * \parDescription
+ * Writes data to the transmit buffer in a control mode. \n\n + * When the respective control mode is enabled , this API can be used. + * + * + * \parRelated APIs:
+ * XMC_USIC_CH_WriteToTBUF() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_WriteToTBUFTCI(XMC_USIC_CH_t *const channel, + const uint16_t data, + const uint32_t transmit_control_information) +{ + channel->TBUF[transmit_control_information] = data; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param word_length Number of bits to be configured for a data word. \n + * \b Range: minimum= 1, maximum= 16. \n + * e.g: For word length of 8, \a word_length should be provided as 8. + * @return None + * + * \parDescription
+ * Sets the data word length in number of bits. \n\n + * Sets the number of bits to represent a data word. Frame length should be a multiple of word length. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetFrameLength()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetWordLength(XMC_USIC_CH_t *const channel, const uint8_t word_length) +{ + channel->SCTR = (uint32_t)(channel->SCTR & (~USIC_CH_SCTR_WLE_Msk)) | + (uint32_t)(((uint32_t)word_length - 1UL) << USIC_CH_SCTR_WLE_Pos); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param word_length Number of bits to be configured for a data word. \n + * \b Range: minimum= 1, maximum= 16. \n + * e.g: For word length of 8, \a word_length should be provided as 8. + * @return None + * + * \parDescription
+ * Sets the data word length in number of bits. \n\n + * Sets the number of bits to represent a data word. Frame length should be a multiple of word length. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetFrameLength()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetShiftDirection(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_SHIFT_DIRECTION_t shift_direction) +{ + channel->SCTR = (uint32_t)(channel->SCTR & (~USIC_CH_SCTR_SDIR_Msk)) | (uint32_t)shift_direction; +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Captured counter value + * + * + * \parDescription
+ * The value of the counter is captured if one of the trigger signals DX0T or DX1T are activated by the corresponding input stage. + */ +__STATIC_INLINE uint32_t XMC_USIC_CH_GetCaptureTimerValue(const XMC_USIC_CH_t *const channel) +{ + return channel->CMTR; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param mode divider mode ::XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_t \n + * @param step divider \n + * \b XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_NORMAL resulting divider = 1023 - step \n + * \b XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_FRACTIONAL resulting divider = 1023 / step \n + * + * @return None + * + * \parDescription
+ * The fractional divider generates its output frequency fFD by either dividing the input frequency fPERIPH by an integer factor n or by multiplication of n/1024. + * + */ +__STATIC_INLINE void XMC_USIC_CH_SetFractionalDivider(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_t mode, const uint16_t step) +{ + channel->FDR = mode | step; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param frame_length Number of bits in a frame. \n + * \b Range: minimum= 1, maximum= 0x3f. The maximum value for fixed frame size is 0x3f. \n + * e.g: For a frame length of 16, \a frame_length should be provided as 16. + * @return None + * + * \parDescription
+ * Define the data frame length.\n\n + * Set the number of bits to be serially transmitted in a frame. + * The frame length should be multiples of word length. If the value is set to 0x40, the frame length + * has to be controlled explicitly. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetWordLength(), XMC_USIC_CH_EnableFrameLengthControl() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetFrameLength(XMC_USIC_CH_t *const channel, const uint8_t frame_length) +{ + channel->SCTR = (uint32_t)(channel->SCTR & (~USIC_CH_SCTR_FLE_Msk)) | + (((uint32_t)frame_length - 0x1U) << USIC_CH_SCTR_FLE_Pos); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Bit mask of the channel events to be enabled. Use @ref XMC_USIC_CH_EVENT_t for the bit masks. \n + * \b Range: @ref XMC_USIC_CH_EVENT_RECEIVE_START, @ref XMC_USIC_CH_EVENT_DATA_LOST etc. Multiple events + * can be combined using \a OR operation. + * @return None + * + * \parDescription
+ * Enable the channel interrupt events.\n\n + * Common channel events related to serial communication can be configured using this API. + * Multiple events can be combined using the bitwise OR operation and configured in one function call. + * XMC_USIC_CH_EVENT_t enumerates multiple protocol event bitmasks. These enumerations can be used as input to the API. + * + * \parRelated APIs:
+ * XMC_USIC_CH_DisableEvent(), XMC_USIC_CH_SetInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR |= event; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Bit mask of the channel events to be disabled. Use @ref XMC_USIC_CH_EVENT_t for the bit masks. \n + * \b Range: @ref XMC_USIC_CH_EVENT_RECEIVE_START, @ref XMC_USIC_CH_EVENT_DATA_LOST etc. Multiple events + * can be combined using \a OR operation. + * @return None + * + * \parDescription
+ * Disable the channel interrupt events. \n\n + * Multiple events can be combined using the bitwise OR operation and configured in one function call. + * XMC_USIC_CH_EVENT_t enumerates multiple protocol event bitmasks. These enumerations can be used as input to the API. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableEvent(), XMC_USIC_CH_SetInterruptNodePointer() \n\n\n +*/ +__STATIC_INLINE void XMC_USIC_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR &= (uint32_t)~event; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param interrupt_node Interrupt node pointer to be configured. \n + * \b Range: @ref XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, + * @ref XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER etc. + * @param service_request Service request number.\n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets the interrupt node for USIC channel events. \n\n + * For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). + * The NVIC node gets linked to the interrupt event by doing so.
+ * Note: NVIC node should be separately enabled to generate the interrupt. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableEvent() \n\n\n + */ +void XMC_USIC_CH_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Stataus @ref XMC_USIC_CH_TBUF_STATUS_IDLE if transmit buffer is free, + * @ref XMC_USIC_CH_TBUF_STATUS_BUSY if transmit buffer is busy. + * + * \parDescription
+ * Gets transmit buffer status. \n\n + * Status indicates whether the transmit buffer is free, or busy transmitting data. + * The status depends on the value of TDV flag in TCSR register. + * This status can be used while transmitting data. Transmit data when the transmit buffer + * status is @ref XMC_USIC_CH_TBUF_STATUS_IDLE. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetDataOutputMode() \n\n\n + */ +__STATIC_INLINE XMC_USIC_CH_TBUF_STATUS_t XMC_USIC_CH_GetTransmitBufferStatus(XMC_USIC_CH_t *const channel) +{ + return (XMC_USIC_CH_TBUF_STATUS_t)(channel->TCSR & USIC_CH_TCSR_TDV_Msk); +} + +/** + * @brief API to get receive buffer status + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Status of data validity check for RBUF0 and RBUF1. \n + * Returned value should be masked with RDV0 and RDV1 bits to know the status. \n + * \b Range: @ref XMC_USIC_CH_RBUF_STATUS_DATA_VALID0, @ref XMC_USIC_CH_RBUF_STATUS_DATA_VALID1. + * + * \parDescription
+ * Checks if RBUF0 and RBUF1 have valid unread data. \n\n + * It checks the bits RDV0 and RDV1 of the RBUFSR register. + * Returns the value of RBUFSR masked with bitmasks of RDV0 and RDV1. + * It can be used to decide whether 2bytes has to be read from RBUF or 1 byte. + * If both bitmasks XMC_USIC_CH_RBUF_STATUS_DATA_VALID0 and XMC_USIC_CH_RBUF_STATUS_DATA_VALID1 + * are set, then 2 bytes can be read from RBUF. If only either of them is set, then only one byte + * can be read from RBUF. + * \parRelated APIs:
+ * XMC_USIC_CH_GetTransmitBufferStatus() \n\n\n + */ +__STATIC_INLINE uint32_t XMC_USIC_CH_GetReceiveBufferStatus(XMC_USIC_CH_t *const channel) +{ + return ((uint32_t) (channel->RBUFSR & (USIC_CH_RBUFSR_RDV0_Msk | USIC_CH_RBUFSR_RDV1_Msk))); +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param start_transmision_mode Transmission mode to be enabled. \n + * \b Range: @ref XMC_USIC_CH_START_TRANSMISION_DISABLED, + * @ref XMC_USIC_CH_START_TRANSMISION_ON_TDV, @ref XMC_USIC_CH_START_TRANSMISION_ON_TDV_DX2S_0, + * @ref XMC_USIC_CH_START_TRANSMISION_ON_TDV_DX2S_1 + * + * @return None + * + * \parDescription
+ * Configures data transmission. \n\n + * The configuration affects the data shifted on the DOUT0 pin. + * + * \parRelated APIs:
+ * XMC_USIC_CH_GetTransmitBufferStatus(), XMC_USIC_CH_SetDataOutputMode() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetStartTransmisionMode(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_START_TRANSMISION_MODE_t start_transmision_mode) +{ + channel->TCSR = (uint32_t)(channel->TCSR & (~USIC_CH_TCSR_TDEN_Msk)) | (uint32_t)start_transmision_mode; +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data_output_mode Data output mode. \n + * \b Range: @ref XMC_USIC_CH_DATA_OUTPUT_MODE_NORMAL, @ref XMC_USIC_CH_DATA_OUTPUT_MODE_INVERTED + * @return None + * + * \parDescription
+ * Configures the mode for data output. \n\n + * USIC channel can be configured to shift inverted data or direct data based on the input to the API. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetStartTransmisionMode() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetDataOutputMode(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_DATA_OUTPUT_MODE_t data_output_mode) +{ + channel->SCTR = (uint32_t)(channel->SCTR & (~USIC_CH_SCTR_DOCFG_Msk)) | (uint32_t)data_output_mode; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Enables automatic update of frame length. \n\n + * When the automatic update of frame length is enabled, frame length is configured based on the + * index of the TBUF[]/IN[] register array. When the data is written to TBUF[x], frame length is configured + * with the mask value of \a x at the last 5 bit positions. Same logic is applicable if data is written to + * IN[x] register. + * + * \parRelated APIs:
+ * XMC_USIC_CH_DisableFrameLengthControl(), XMC_USIC_CH_TXFIFO_PutDataFLEMode() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableFrameLengthControl(XMC_USIC_CH_t *const channel) +{ + channel->TCSR = (uint32_t)(channel->TCSR & (~(USIC_CH_TCSR_WLEMD_Msk | + USIC_CH_TCSR_SELMD_Msk | + USIC_CH_TCSR_WAMD_Msk | + USIC_CH_TCSR_HPCMD_Msk))) | + (uint32_t)USIC_CH_TCSR_FLEMD_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Disables automatic update of frame length. \n\n + * When automatic update of frame length is disabled, frame length has to configured explicitly. + * Frame length remains fixed until it is changed again. + * + * \parRelated APIs:
+ * XMC_USIC_CH_DisableFrameLengthControl(), XMC_USIC_CH_SetFrameLength() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_DisableFrameLengthControl(XMC_USIC_CH_t *const channel) +{ + channel->TCSR &= (uint32_t)~USIC_CH_TCSR_FLEMD_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Bit TCSR.TE is set if DX2T becomes active while TDV = 1. \n\n + * Enables the transfer trigger unit to set bit TCSR.TE if the trigger signal DX2T becomes active + * for event driven transfer starts. + * + * \parRelated APIs:
+ * XMC_USIC_CH_DisableTBUFDataValidTrigger()\n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableTBUFDataValidTrigger(XMC_USIC_CH_t *const channel) +{ + channel->TCSR |= (uint32_t)USIC_CH_TCSR_TDVTR_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Disables the trigger of TDV depending on DX2T signal. \n\n + * Bit TCSR.TE is permanently set. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableTBUFDataValidTrigger() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_DisableTBUFDataValidTrigger(XMC_USIC_CH_t *const channel) +{ + channel->TCSR &= (uint32_t)~USIC_CH_TCSR_TDVTR_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param service_request_line service request number of the event to be triggered. \n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Trigger a USIC interrupt service request.\n\n + * When the USIC service request is triggered, the NVIC interrupt associated with it will be + * generated if enabled. + * + * \parRelated APIs:
+ * XMC_USIC_CH_SetInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TriggerServiceRequest(XMC_USIC_CH_t *const channel, const uint32_t service_request_line) +{ + channel->FMR = (uint32_t)(USIC_CH_FMR_SIO0_Msk << service_request_line); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param transmit_buffer_status clearing or setting the TDV flag. \n + * + * @return None + * + * \parDescription
+ * Modify TCSR.TDV and TCSR.TE to control the start of a data word transmission by software. + * + * \parRelated APIs:
+ * XMC_USIC_CH_GetTransmitBufferStatus() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetTransmitBufferStatus(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_TBUF_STATUS_SET_t transmit_buffer_status) +{ + channel->FMR = (uint32_t)transmit_buffer_status; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param passive_level Value of passive level for the channel. \n + * \b Range: @ref XMC_USIC_CH_PASSIVE_DATA_LEVEL0, @ref XMC_USIC_CH_PASSIVE_DATA_LEVEL1 + * @return None + * + * \parDescription
+ * Set the passive data level of the output signal. \n\n + * When the USIC channel transmit stage is idle, the output signal level stays at the + * configured passive level. + * + * \parRelated APIs:
+ * XMC_USIC_CH_GetTransmitBufferStatus(), XMC_USIC_CH_SetStartTransmisionMode() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetPassiveDataLevel(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_PASSIVE_DATA_LEVEL_t passive_level) +{ + channel->SCTR &= (~USIC_CH_SCTR_PDL_Msk); + channel->SCTR |= (uint32_t)passive_level; +} + +/* TX FIFO APIs */ +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data_pointer Start position inside the FIFO buffer. \n + * \b Range: 0 to 63. + * @param size Required size of the transmit FIFO. \n + * \b Range: @ref XMC_USIC_CH_FIFO_DISABLED, @ref XMC_USIC_CH_FIFO_SIZE_2WORDS.. @ref XMC_USIC_CH_FIFO_SIZE_64WORDS + * @param limit Threshold of transmit FIFO filling level to be considered for generating events. \n + * \b Range: 0 to \a size -1. + * @return None + * + * \parDescription
+ * Initializes the transmit FIFO. \n\n + * Transmit FIFO is a subset of a common FIFO sized 64 words. This FIFO is shared between 2 channels of the USIC module. + * Each channel can share the FIFO for transmission and reception. \a data_pointer represents the start index in the common FIFO, + * from where transmit data can be put, for the selected USIC channel. \a size represents the size of transmit FIFO as a multiple of + * 2. Since the FIFO is shared between 2 USIC channels, FIFO size should be carefully selected. A FIFO standard transmit buffer + * event is generated when the FIFO filling level falls below the \a limit value. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_EnableEvent(), XMC_USIC_CH_TXFIFO_SetInterruptNodePointer() \n\n\n + */ +void XMC_USIC_CH_TXFIFO_Configure(XMC_USIC_CH_t *const channel, + const uint32_t data_pointer, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param size Required size of the transmit FIFO. \n + * \b Range: @ref XMC_USIC_CH_FIFO_DISABLED, @ref XMC_USIC_CH_FIFO_SIZE_2WORDS.. @ref XMC_USIC_CH_FIFO_SIZE_64WORDS + * @param limit Threshold for transmit FIFO filling level to be considered for generating events. \n + * \b Range: 0 to \a size -1. + * @return None + * + * \parDescription
+ * Sets the size and trigger limit for the transmit FIFO. \n\n + * The API is not to be called for initializing the transmit FIFO. The API shall be used for the + * runtime change of transmit FIFO trigger limit. FIFO start position will not be affected on execution. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_SetSizeTriggerLimit() \n\n\n + */ +void XMC_USIC_CH_TXFIFO_SetSizeTriggerLimit(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit); + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Events to be enabled. Multiple events can be bitwise OR combined. @ref XMC_USIC_CH_TXFIFO_EVENT_CONF_t \n + * @return None + * + * \parDescription
+ * Enables the interrupt events related to transmit FIFO. \n\n + * Event bitmasks can be constructed using the enumeration @ref XMC_USIC_CH_TXFIFO_EVENT_CONF_t. + * Multiple events can be enabled by providing multiple events in a single call. For providing + * multiple events, combine the events using bitwise OR operation. Events are configured in the TBCTR register.
+ * + * Note: API only enables the events. For interrupt generation, interrupt node must be configured and NVIC node + * must be enabled. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_SetInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TXFIFO_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->TBCTR |= event; +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Events to be disabled. @ref XMC_USIC_CH_TXFIFO_EVENT_CONF_t \n + * @return None + * + * \parDescription
+ * Disables the interrupt events related to transmit FIFO. \n\n + * By disabling the interrupt events, generation of interrupt is stopped. User can poll the event + * flags from the status register using the API XMC_USIC_CH_TXFIFO_GetEvent(). + * Event bitmasks can be constructed using the enumeration @ref XMC_USIC_CH_TXFIFO_EVENT_CONF_t. For providing + * multiple events, combine the events using bitwise OR operation. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_GetEvent(), XMC_USIC_CH_TXFIFO_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TXFIFO_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->TBCTR &= (uint32_t)~event; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param interrupt_node Node pointer representing the transmit FIFO events. \n + * \b Range: @ref XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER_STANDARD, + * @ref XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER_ALTERNATE + * @param service_request The service request to be used for interrupt generation. \n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets an interrupt node for the transmit FIFO events.\n\n + * A node pointer represents one or more interrupt events. Service request represents the interrupt node to be used + * among the 6 interrupt nodes available for USIC module. + * API configures the service request to be used for interrupt generation for the events selected. + * A transmit FIFO event can generate an interrupt only if the interrupt node is configured for the event and + * the interrupt generation is enabled for the event. For example, transmit FIFO standard transmit buffer + * interrupt is generated if the interrupt node for the same is set and interrupt is enabled.
+ * + * Note: NVIC node should be explicitly enabled for the interrupt generation. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_EnableEvent() \n\n\n + */ +void XMC_USIC_CH_TXFIFO_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data Data to be transmitted. \n + * \b Range: 16bit unsigned data. minimum= 0, maximum= 65535 + * @return None + * + * \parDescription
+ * Writes data into the transmit FIFO. \n\n + * The data provided is placed in the transmit FIFO. + * The transmit FIFO should be configured before calling this API. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TXFIFO_PutData(XMC_USIC_CH_t *const channel, const uint16_t data) +{ + channel->IN[0] = data; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data Data to be transmitted. + * @param frame_length Frame length to be configured while transmitting the data. \n + * \b Range: minimum= 0, maximum= 31. e.g: For a frame length of 16, set \a frame_length as 15. + * @return None + * + * \parDescription
+ * Writes data to the transmit FIFO in frame length control mode. \n\n + * When frame length control is enabled for dynamic update of frame length, this API can be used. + * \a frame_length represents the frame length to be updated by the peripheral. + * \a frame_length is used as index for the IN[] register array. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableFrameLengthControl() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TXFIFO_PutDataFLEMode(XMC_USIC_CH_t *const channel, + const uint16_t data, + const uint32_t frame_length) +{ + channel->IN[frame_length] = data; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data Data to be transmitted. + * @param frame_length Frame length to be configured while transmitting the data. \n + * \b Range: minimum= 0, maximum= 31. e.g: For a frame length of 16, set \a frame_length as 15. + * @return None + * + * \parDescription
+ * Writes data to the transmit FIFO in hardware port control mode. \n\n + * When hardware port control is enabled for dynamic update of frame length, this API can be used. + * \a frame_length represents the frame length to be updated by the peripheral. + * \a frame_length is used as index for the IN[] register array. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableFrameLengthControl() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TXFIFO_PutDataHPCMode(XMC_USIC_CH_t *const channel, + const uint16_t data, + const uint32_t frame_length) +{ + channel->IN[frame_length] = data; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Clears the contents of transmit FIFO. \n\n + * Transmit FIFO contents will be cleared and the filling level will be reset to 0. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_GetLevel() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TXFIFO_Flush(XMC_USIC_CH_t *const channel) +{ + channel->TRBSCR = (uint32_t)USIC_CH_TRBSCR_FLUSHTB_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Status \a true if transmit FIFO is full + * \a false if transmit FIFO is not full. + * + * \parDescription
+ * Checks if transmit FIFO is full. \n\n + * When the transmit FIFO filling level reaches the configured size, FIFO full flag is set. + * User should not write to the FIFO when the transmit FIFO is full. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_IsEmpty(), XMC_USIC_CH_TXFIFO_Flush() \n\n\n + */ +__STATIC_INLINE bool XMC_USIC_CH_TXFIFO_IsFull(XMC_USIC_CH_t *const channel) +{ + return (bool)(channel->TRBSR & USIC_CH_TRBSR_TFULL_Msk); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Status \a true if transmit FIFO is empty + * \a false if transmit FIFO has some data. + * + * \parDescription
+ * Checks if transmit FIFO is empty. \n\n + * When the transmit FIFO is empty, data can be written to FIFO. + * When the last written word to the transmit FIFO is transmitted out of the FIFO, + * FIFO empty flag is set. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_Flush(), XMC_USIC_CH_TXFIFO_PutData() \n\n\n + */ +__STATIC_INLINE bool XMC_USIC_CH_TXFIFO_IsEmpty(XMC_USIC_CH_t *const channel) +{ + return (bool)(channel->TRBSR & USIC_CH_TRBSR_TEMPTY_Msk); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Transmit FIFO filling level. \n + * \b Range: minimum= 0(FIFO empty), maximum= transmit FIFO size. + * + * \parDescription
+ * Gets the transmit FIFO filling level. \n\n + * For every word written to the FIFO, filling level is updated. The API gives the value + * of this filling level. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_Flush(), XMC_USIC_CH_TXFIFO_PutData() \n\n\n + */ +__STATIC_INLINE uint32_t XMC_USIC_CH_TXFIFO_GetLevel(XMC_USIC_CH_t *const channel) +{ + return ((uint32_t)(channel->TRBSR & USIC_CH_TRBSR_TBFLVL_Msk) >> USIC_CH_TRBSR_TBFLVL_Pos); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Status of standard transmit and transmit buffer error events. @ref XMC_USIC_CH_TXFIFO_EVENT_t \n + * + * \parDescription
+ * Gets the transmit FIFO event status. \n\n + * Gives the status of transmit FIFO standard transmit buffer event and transmit buffer error event. + * The status bits are located at their bit positions in the TRBSR register in the returned value. + * User can make use of the @ref XMC_USIC_CH_TXFIFO_EVENT_t enumeration for checking the status of return value. + * The status can be found by using the bitwise AND operation on the returned value with the enumerated value.
+ * + * Note: Event status flags should be cleared by the user explicitly. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_ClearEvent() \n\n\n + */ +__STATIC_INLINE uint32_t XMC_USIC_CH_TXFIFO_GetEvent(XMC_USIC_CH_t *const channel) +{ + return (uint32_t)((channel->TRBSR) & (USIC_CH_TRBSR_STBI_Msk | + USIC_CH_TRBSR_TBERI_Msk)); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Transmit FIFO events to be cleared. \n + * \b Range: @ref XMC_USIC_CH_TXFIFO_EVENT_STANDARD, @ref XMC_USIC_CH_TXFIFO_EVENT_ERROR. + * @return None + * + * \parDescription
+ * Clears the transmit FIFO event flags in the status register. \n\n + * USIC channel peripheral does not clear the event flags after they are read. + * This API clears the events provided in the \a mask value. + * XMC_USIC_CH_TXFIFO_EVENT enumeration can be used as input. Multiple events + * can be cleared by providing a mask value obtained by bitwise OR operation of + * multiple event enumerations. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_GetEvent() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_TXFIFO_ClearEvent(XMC_USIC_CH_t *const channel, + const uint32_t event) +{ + channel->TRBSCR = event; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param data_pointer Start position inside the FIFO buffer. \n + * \b Range: 0 to 63. + * @param size Required size of the receive FIFO. \n + * \b Range: @ref XMC_USIC_CH_FIFO_DISABLED, @ref XMC_USIC_CH_FIFO_SIZE_2WORDS.. @ref XMC_USIC_CH_FIFO_SIZE_64WORDS + * @param limit Threshold of receive FIFO filling level to be considered for generating events. \n + * \b Range: 0 to \a size -1. + * @return None + * + * \parDescription
+ * Configures the receive FIFO. \n\n + * Receive FIFO is the subset of a common FIFO sized 64 words. This FIFO is shared between 2 channels of the USIC module. + * Each channel can share the FIFO for transmission and reception. \a data_pointer represents the start index in the common FIFO, + * from where received data can be put. \a size represents the size of receive FIFO as a multiple of 2. + * Since the FIFO is shared between 2 USIC channels, FIFO size should be carefully selected. A FIFO standard receive buffer + * event or alternative receive buffer event is generated when the FIFO filling level exceeds the \a limit value. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_EnableEvent(), XMC_USIC_CH_RXFIFO_SetInterruptNodePointer() \n\n\n +*/ +void XMC_USIC_CH_RXFIFO_Configure(XMC_USIC_CH_t *const channel, + const uint32_t data_pointer, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param size Required size of the receive FIFO. \n + * \b Range: @ref XMC_USIC_CH_FIFO_DISABLED, @ref XMC_USIC_CH_FIFO_SIZE_2WORDS.. @ref XMC_USIC_CH_FIFO_SIZE_64WORDS + * @param limit Threshold for receive FIFO filling level to be considered for generating events. \n + * \b Range: 0 to \a size -1. + * @return None + * + * \parDescription
+ * Sets the size and trigger limit for the receive FIFO. \n\n + * The API is not to be called for initializing the receive FIFO. The API shall be used for the + * runtime change of receive FIFO trigger limit. FIFO start position will not be affected on execution. + * + * \parRelated APIs:
+ * XMC_USIC_CH_TXFIFO_SetSizeTriggerLimit()\ n\n\n + */ +void XMC_USIC_CH_RXFIFO_SetSizeTriggerLimit(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Events to be enabled. Multiple events can be bitwise OR combined. @ref XMC_USIC_CH_RXFIFO_EVENT_CONF_t\n + * @return None + * + * \parDescription
+ * Enables the interrupt events related to transmit FIFO. \n\n + * Event bitmasks can be constructed using the enumeration @ref XMC_USIC_CH_RXFIFO_EVENT_CONF_t. + * Multiple events can be enabled by providing multiple events in a single call. For providing + * multiple events, combine the events using bitwise OR operation.
+ * + * Note: API only enables the events. For interrupt generation, interrupt node must be configured and NVIC node + * must be enabled. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_SetInterruptNodePointer() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_RXFIFO_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->RBCTR |= event; +} + + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Events to be disabled. \n + * \b Range: @ref XMC_USIC_CH_RXFIFO_EVENT_CONF_STANDARD, @ref XMC_USIC_CH_RXFIFO_EVENT_CONF_ERROR, + * @ref XMC_USIC_CH_RXFIFO_EVENT_CONF_ALTERNATE. + * @return None + * + * \parDescription
+ * Disables the selected interrupt events related to receive FIFO. \n\n + * By disabling the interrupt events, generation of interrupt is stopped. User can poll the event + * flags from the status register using the API XMC_USIC_CH_RXFIFO_GetEvent(). + * Event bitmasks can be constructed using the enumeration \a XMC_USIC_CH_RXFIFO_EVENT_CONF. For providing + * multiple events, combine the events using bitwise OR operation. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_GetEvent(), XMC_USIC_CH_RXFIFO_EnableEvent() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_RXFIFO_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->RBCTR &= (uint32_t)~event; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param interrupt_node Node pointer representing the receive FIFO events. \n + * \b Range: @ref XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_STANDARD, + * @ref XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_ALTERNATE + * @param service_request The service request to be used for interrupt generation.\n + * \b Range: 0 to 5. + * @return None + * + * \parDescription
+ * Sets an interrupt node for the receive FIFO events. \n\n + * A node pointer represents one or more interrupt events. Service request represents the interrupt node to be used + * among the 6 interrupt nodes available for USIC module. + * API configures the service request to be used for interrupt generation for the events selected. + * A receive FIFO event can generate an interrupt only if the interrupt node is configured for the event and + * the interrupt generation is enabled for the event. For example, transmit FIFO standard transmit buffer + * interrupt is generated if the interrupt node for the same is set and interrupt is enabled.
+ * + * Note: NVIC node should be explicitly enabled for the interrupt generation. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_EnableEvent() \n\n\n + */ +void XMC_USIC_CH_RXFIFO_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request); + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Value read from the receive FIFO. \n + * \b Range: 16bit data. Length of data depends on the word length configuration. + * + * \parDescription
+ * Gets data from the receive FIFO. \n\n + * Receive FIFO should be read only if data is availble in the FIFO. This can be checked using + * the API XMC_USIC_CH_RXFIFO_IsEmpty(). Receive FIFO error flag will be set if an attempt is made + * to read from an empty receive FIFO. To read all the received data, user should keep reading data + * until receive FIFO is empty. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_ClearEvent() \n\n\n + */ +__STATIC_INLINE uint16_t XMC_USIC_CH_RXFIFO_GetData(XMC_USIC_CH_t *const channel) +{ + return (uint16_t)(channel->OUTR); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Clears the contents of receive FIFO. \n\n + * Receive FIFO contents will be cleared and the filling level will be reset to 0. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_GetLevel() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_RXFIFO_Flush(XMC_USIC_CH_t *const channel) +{ + channel->TRBSCR = (uint32_t)USIC_CH_TRBSCR_FLUSHRB_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Status \a true if receive FIFO is full + * \a false if receive FIFO is not full. + * + * \parDescription
+ * Checks if receive FIFO is full. \n\n + * When the receive FIFO filling level reaches the configured size, FIFO full flag is set. + * Any data received when the receive FIFO is full, is lost. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_IsEmpty(), XMC_USIC_CH_RXFIFO_Flush() \n\n\n + */ +__STATIC_INLINE bool XMC_USIC_CH_RXFIFO_IsFull(XMC_USIC_CH_t *const channel) +{ + return (bool)(channel->TRBSR & USIC_CH_TRBSR_RFULL_Msk); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Status \a true if receive FIFO is empty, + * \a false if receive FIFO has some data. + * + * \parDescription
+ * Checks if receive FIFO is empty. \n\n + * When the receive FIFO is empty, received data will be put in receive FIFO. + * When the last received word in the FIFO is read, FIFO empty flag is set. Any attempt + * to read from an empty receive FIFO will set the receive FIFO error flag. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_Flush(), XMC_USIC_CH_RXFIFO_PutData() \n\n\n + */ +__STATIC_INLINE bool XMC_USIC_CH_RXFIFO_IsEmpty(XMC_USIC_CH_t *const channel) +{ + return (bool)(channel->TRBSR & USIC_CH_TRBSR_REMPTY_Msk); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return uint32_t Receive FIFO filling level. \n + * \b Range: minimum= 0(FIFO empty), maximum= receive FIFO size. + * + * \parDescription
+ * Gets the receive FIFO filling level. \n\n + * For every word received, the filling level is incremented. The API gives the value + * of this filling level. The filling level is decremented when the data is read out of the + * receive FIFO. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_Flush(), XMC_USIC_CH_RXFIFO_PutData() \n\n\n + */ +__STATIC_INLINE uint32_t XMC_USIC_CH_RXFIFO_GetLevel(XMC_USIC_CH_t *const channel) +{ + return ((uint32_t)(channel->TRBSR & USIC_CH_TRBSR_RBFLVL_Msk) >> USIC_CH_TRBSR_RBFLVL_Pos); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return Status of standard receive buffer, alternative receive buffer and receive buffer error events. \n + * \b Range: @ref XMC_USIC_CH_RXFIFO_EVENT_STANDARD, @ref XMC_USIC_CH_RXFIFO_EVENT_ERROR, + * @ref XMC_USIC_CH_RXFIFO_EVENT_ALTERNATE. + * + * \parDescription
+ * Gets the receive FIFO events' status. \n\n + * Gives the status of receive FIFO standard receive buffer event, alternative receive buffer event and receive buffer error event. + * The status bits are located at their bitpositions in the TRBSR register in the returned value. + * User can make use of the XMC_USIC_CH_RXFIFO_EVENT enumeration for checking the status of return value. + * The status can be found by using the bitwise AND operation on the returned value with the enumerated value.
+ * + * Note: Event status flags should be cleared by the user explicitly. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_ClearEvent()\n\n\n + */ +__STATIC_INLINE uint32_t XMC_USIC_CH_RXFIFO_GetEvent(XMC_USIC_CH_t *const channel) +{ + return (uint32_t)((channel->TRBSR) & (USIC_CH_TRBSR_SRBI_Msk | + USIC_CH_TRBSR_RBERI_Msk | + USIC_CH_TRBSR_ARBI_Msk)); +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param event Receive FIFO events to be cleared. \n + * \b Range: @ref XMC_USIC_CH_RXFIFO_EVENT_STANDARD, @ref XMC_USIC_CH_RXFIFO_EVENT_ERROR, + * @ref XMC_USIC_CH_RXFIFO_EVENT_ALTERNATE. + * @return None + * + * \parDescription
+ * Clears the receive FIFO event flags in the status register. \n\n + * USIC channel peripheral does not clear the event flags after they are read. + * This API clears the events provided in the \a mask value. + * XMC_USIC_CH_RXFIFO_EVENT enumeration can be used as input. Multiple events + * can be cleared by providing a mask value obtained by bitwise OR operation of + * multiple event enumerations. + * + * \parRelated APIs:
+ * XMC_USIC_CH_RXFIFO_GetEvent() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_RXFIFO_ClearEvent(XMC_USIC_CH_t *const channel, + const uint32_t event) +{ + channel->TRBSCR = event; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Enables time measurement using the capture mode timer. \n\n + * Time measurement is enabled by setting the timer enable flag in BRG register. + * + * \parRelated APIs:
+ * XMC_USIC_CH_DisableTimeMeasurement() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_EnableTimeMeasurement(XMC_USIC_CH_t *const channel) +{ + channel->BRG |= (uint32_t)USIC_CH_BRG_TMEN_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @return None + * + * \parDescription
+ * Disables time measurement using the capture mode timer. \n\n + * Time measurement is disabled by clearing the timer enable flag in BRG register. + * + * \parRelated APIs:
+ * XMC_USIC_CH_EnableTimeMeasurement() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_DisableTimeMeasurement(XMC_USIC_CH_t *const channel) +{ + channel->BRG &= (uint32_t)~USIC_CH_BRG_TMEN_Msk; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param passive_level Passive level for the master clock output. \n + * \b Range: @ref XMC_USIC_CH_BRG_MASTER_CLOCK_PASSIVE_LEVEL_0, @ref XMC_USIC_CH_BRG_MASTER_CLOCK_PASSIVE_LEVEL_1. + * @return None + * + * \parDescription
+ * Sets the idle mode pin level for the master clock output. \n + */ +__STATIC_INLINE void XMC_USIC_CH_SetMclkOutputPassiveLevel(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_BRG_MASTER_CLOCK_PASSIVE_LEVEL_t passive_level) +{ + channel->BRG = (uint32_t)(channel->BRG & (~USIC_CH_BRG_MCLKCFG_Msk)) | (uint32_t)passive_level; +} +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param passive_level Passive level for the clock output. \n + * \b Range: @ref XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_DISABLED, + * @ref XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_ENABLED, + * @ref XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_DISABLED, + * @ref XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_ENABLED, + * @param clock_output Shift clock source selection. \n + * \b Range: Use @ref XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK, + * @ref XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_DX1 + * @return None + * + * \parDescription
+ * Sets the idle mode shift clock output level and selects the shift clock source. \n\n + * Shift clock idle mode output level can be set to logic high or low. Shift clock output can be configured to have a + * delay of half shift clock period. Both the configurations are available as enumeration values defined with type + * @ref XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t. + * This value should be configured based on the slave device requirement. + * Shift clock source can be selected between internal clock(master) and external input(slave). + * + */ +__STATIC_INLINE void XMC_USIC_CH_ConfigureShiftClockOutput(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_t passive_level, + const XMC_USIC_CH_BRG_SHIFT_CLOCK_OUTPUT_t clock_output) +{ + channel->BRG = (uint32_t)(channel->BRG & (~(USIC_CH_BRG_SCLKCFG_Msk | + USIC_CH_BRG_SCLKOSEL_Msk))) | + (uint32_t)passive_level | + (uint32_t)clock_output; +} + +/** + * @param channel Pointer to USIC channel handler of type @ref XMC_USIC_CH_t \n + * \b Range: @ref XMC_USIC0_CH0, @ref XMC_USIC0_CH1 to @ref XMC_USIC2_CH1 based on device support. + * @param mode USIC channel operation mode. \n + * \b Range: @ref XMC_USIC_CH_OPERATING_MODE_IDLE, @ref XMC_USIC_CH_OPERATING_MODE_SPI, + * @ref XMC_USIC_CH_OPERATING_MODE_UART, @ref XMC_USIC_CH_OPERATING_MODE_I2S, + * @ref XMC_USIC_CH_OPERATING_MODE_I2C. + * @return None + * + * \parDescription
+ * Sets the USIC channel operation mode.\n\n + * A USIC channel can support multiple serial communication protocols like UART, SPI, I2C and I2S. + * The API sets the input operation mode to the USIC channel. + * + * \parRelated APIs:
+ * XMC_USIC_Enable(), XMC_USIC_CH_Enable() \n\n\n + */ +__STATIC_INLINE void XMC_USIC_CH_SetMode(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_OPERATING_MODE_t mode) +{ + channel->CCR = (uint32_t)(channel->CCR & (~(USIC_CH_CCR_MODE_Msk))) | (uint32_t)mode; +} +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_vadc.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_vadc.h new file mode 100644 index 00000000..dc963068 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_vadc.h @@ -0,0 +1,4962 @@ +/** + * @file xmc_vadc.h + * @date 2017-02-06 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-15: + * - Initial
+ * + * 2015-02-20: + * - Revised for XMC1201 device.
+ * + * 2015-04-27: + * - Added new APIs for SHS.
+ * - Added New APIs for trigger edge selection.
+ * - Added new APIs for Queue flush entries, boundary selection, Boundary node pointer.
+ * - Revised GatingMode APIs and EMUX Control Init API.
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * 2015-06-25: + * - BFL configuration in channel initialization fixed. + * + * 2015-07-28: + * - CLOCK_GATING_SUPPORTED and PERIPHERAL_RESET_SUPPORTED macros used + * - Clubbed the macro definitions for XMC13 XMC12 and XMC14 + * - Clubbed the macro definitions for XMC44 XMC47 and XMC48 + * - New APIs Created. + * - XMC_VADC_GLOBAL_SetIndividualBoundary + * - XMC_VADC_GROUP_SetIndividualBoundary + * - XMC_VADC_GROUP_GetAlias + * - XMC_VADC_GROUP_GetInputClass + * - XMC_VADC_GROUP_ChannelSetIclass + * - XMC_VADC_GROUP_ChannelGetResultAlignment + * - XMC_VADC_GROUP_ChannelGetInputClass + * - XMC_VADC_GROUP_SetResultSubtractionValue + * + * 2015-12-01: + * - Added: + * - XMC4300 device supported + * + * - Fixed: + * - XMC_VADC_GLOBAL_TriggerEvent API updated. OR operation removed. + * - XMC_VADC_GLOBAL_ClearEvent API updated. Multiple events triggering on clearing the event is fixed. + * - Wrong MACRO name defined in xmc_vadc_map.h file corrected for XMC4200/4100 devices. + * XMC_VADC_G3_SAMPLE renamed to XMC_VADC_G1_SAMPLE + * + * 2015-12-01: + * - New APIs Created. + * - XMC_VADC_GROUP_ScanIsArbitrationSlotEnabled + * - XMC_VADC_GROUP_QueueIsArbitrationSlotEnabled + * - Fixed the analog calibration voltage for XMC1100 to external reference upper supply range. + * - Fixed the XMC_VADC_GLOBAL_StartupCalibration() for XMC1100. + * + * 2016-03-09: + * - Optimization of write only registers + * + * 2016-03-18: + * - Fixed XMC_VADC_GLOBAL_SHS_IsConverterReady(): API checks the STEPCFG register for the ready bit instead of + * SHSCFG SFR. + * + * 2016-06-17: + * - New macros added XMC_VADC_SHS_FULL_SET_REG, XMC_VADC_RESULT_PRIORITY_AVAILABLE + * - New Enum added XMC_VADC_SHS_GAIN_LEVEL_t and XMC_VADC_SYNCTR_EVAL_t + * - New APIs added are: + * - XMC_VADC_GROUP_SetSyncSlaveReadySignal + * - XMC_VADC_GROUP_ChannelGetAssertedEvents + * - XMC_VADC_GROUP_GetAssertedResultEvents + * - XMC_VADC_GROUP_SetResultRegPriority + * - XMC_VADC_GROUP_SetSyncReadySignal + * - XMC_VADC_GROUP_GetSyncReadySignal + * - XMC_VADC_GROUP_GetResultRegPriority + * + * 2017-02-06: + * - Added new functions to remove channels from background request source, XMC_VADC_GLOBAL_BackgroundRemoveChannelFromSequence() and XMC_VADC_GLOBAL_BackgndRemoveMultipleChannels() + * + * @endcond + * + */ + +#ifndef XMC_VADC_H +#define XMC_VADC_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include +#include +#include + +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup VADC + * @brief Versatile Analog to Digital Converter (VADC) driver for XMC microcontroller family. + * + * The XMC microcontroller provides a series of analog input channels connected to a cluster of Analog/Digital + * Converters using the Successive Approximation Register (SAR) principle to convert analog input values (voltages) + * to discrete digital values. + * \if XMC1 + * The XMC1x is based on Sample & Hold converters, where a cluster contains 2 Sample&Hold units which share a common + * converter. + * \endif + * + * Each converter of the ADC cluster can operate independent of the others, controlled by a dedicated set of + * registers and triggered by a dedicated group request source. The results of each channel can be stored in a + * dedicated channel-specific result register or in a group-specific result register.
+ * + * The Versatile Analog to Digital Converter module (VADC) of the XMC comprises a set of converter blocks that + * can be operated either independently or via a common request source that emulates a background converter. + * Each converter block is equipped with a dedicated input multiplexer and dedicated request sources, + * which together build separate groups. + * + * \if XMC4 + * @image html "vadc_overview_xmc4x.png" + * \else + * @image html "vadc_overview_xmc1x.png" + * \endif + * + * The VADC LLD is split into GLOBAL and GROUP related APIs.
+ * GLOBAL:
+ *
    + *
  • Global APIs act on the entire ADC module. Configures global configuration registers
  • + *
  • Allows configuration of the background request source of the VADC.
  • + *
  • The clock related configurations for the VADC module are configured in the Global APIs/
  • + *
  • The Global API names are prefixed by the \b XMC_VADC_GLOBAL_ and they accept ::XMC_VADC_GLOBAL_t as + * one of its arguments.
  • + *
  • Configures the background request source of the VADC. The APIs which act on the background related registers + * are prefixed by \b XMC_VADC_GLOBAL_Background
  • + *
  • Configures the sample and hold unit of the VADC. The APIs which act on the SHS related registers + * are prefixed by \b XMC_VADC_GLOBAL_SHS_
  • + *

+ * + * GROUP:
+ *
    + *
  • Group APIs act on a VADC group. Configures the group configuration registers
  • + *
  • Configures the queue request source of the VADC. The APIs which act on the queue related registers + * are prefixed by \b XMC_VADC_GROUP_Queue
  • + *
  • Configures the scan request source of the VADC. The APIs which act on the scan related registers + * are prefixed by \b XMC_VADC_GROUP_Scan
  • + *
  • Configuration of the channels of each group are done by the API which have a prefix as + * \b XMC_VADC_GROUP_Channel.
  • + *
  • The Group API names are prefixed by the \b XMC_VADC_GROUP_ and they accept ::XMC_VADC_GROUP_t as + * one of its arguments.
  • + *

+ * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +#if ((UC_SERIES == XMC42)||(UC_SERIES == XMC41) || (UC_SERIES == XMC43)) +#define XMC_VADC_GROUP_AVAILABLE (1U) /* Defines the availability of group resource in a device*/ +#define XMC_VADC_GSCAN_AVAILABLE (1U) /* Defines the availability of scan request resource in a device*/ +#define XMC_VADC_QUEUE_AVAILABLE (1U) /* Defines the availability of queue request resource in a device*/ +#define XMC_VADC_EMUX_AVAILABLE (1U) /* Defines the availability of external multiplexer support in a + device*/ +#define XMC_VADC_BOUNDARY_AVAILABLE (1U) /* Defines the availability of boundary check support in a device*/ +#define XMC_VADC_MULTIPLE_SLAVEGROUPS (1U) /* Defines the availability of synchronous request source in device*/ +#define XMC_VADC_MAXIMUM_NUM_GROUPS (2U) /* Defines the maximum number of groups available in a device*/ +#define XMC_VADC_BOUNDARY_FLAG_SELECT (1U) /* Defines the availability of boundary flags in a device*/ +#define XMC_VADC_EMUX_CH_SEL_STYLE (1U) /* Defines the external multiplexer channel selection mode of + operation for a particular device*/ +#define XMC_VADC_SHS_AVAILABLE (0U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_SHS_FULL_SET_REG (0U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_GROUP_SRCREG_AVAILABLE (1U) /* Define the availability of a source specific result register */ +#define XMC_VADC_RESULT_PRIORITY_AVAILABLE (0U) /* Define the availability of a priority for result register */ +#endif + +#if (UC_SERIES == XMC44 || UC_SERIES == XMC47 || UC_SERIES == XMC48) +#define XMC_VADC_GROUP_AVAILABLE (1U) /* Defines the availability of group resource in a device*/ +#define XMC_VADC_GSCAN_AVAILABLE (1U) /* Defines the availability of scan request resource in a device*/ +#define XMC_VADC_QUEUE_AVAILABLE (1U) /* Defines the availability of queue request resource in a device*/ +#define XMC_VADC_EMUX_AVAILABLE (1U) /* Defines the availability of external multiplexer support in a + device*/ +#define XMC_VADC_BOUNDARY_AVAILABLE (1U) /* Defines the availability of boundary check support in a device*/ +#define XMC_VADC_MULTIPLE_SLAVEGROUPS (1U) /* Defines the availability of synchronous request source in device*/ +#define XMC_VADC_MAXIMUM_NUM_GROUPS (4U) /* Defines the maximum number of groups available in a device*/ +#define XMC_VADC_BOUNDARY_FLAG_SELECT (1U) /* Defines the availability of boundary flags in a device*/ +#define XMC_VADC_EMUX_CH_SEL_STYLE (1U) /* Defines the external multiplexer channel selection mode of + operation for a particular device*/ +#define XMC_VADC_SHS_AVAILABLE (0U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_SHS_FULL_SET_REG (0U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_GROUP_SRCREG_AVAILABLE (1U) /* Define the availability of a source specific result register */ +#define XMC_VADC_RESULT_PRIORITY_AVAILABLE (0U) /* Define the availability of a priority for result register */ +#endif + +#if (UC_SERIES == XMC45) +#define XMC_VADC_GROUP_AVAILABLE (1U) /* Defines the availability of group resource in a device*/ +#define XMC_VADC_GSCAN_AVAILABLE (1U) /* Defines the availability of scan request resource in a device*/ +#define XMC_VADC_QUEUE_AVAILABLE (1U) /* Defines the availability of queue request resource in a device*/ +#define XMC_VADC_EMUX_AVAILABLE (1U) /* Defines the availability of external multiplexer support in a + device*/ +#define XMC_VADC_BOUNDARY_AVAILABLE (1U) /* Defines the availability of boundary check support in a device*/ +#define XMC_VADC_MULTIPLE_SLAVEGROUPS (1U) /* Defines the availability of synchronous request source in device*/ +#define XMC_VADC_MAXIMUM_NUM_GROUPS (4U) /* Defines the maximum number of groups available in a device*/ +#define XMC_VADC_BOUNDARY_FLAG_SELECT (0U) /* Defines the availability of boundary flags in a device*/ +#define XMC_VADC_EMUX_CH_SEL_STYLE (0U) /* Defines the external multiplexer channel selection mode of + operation for a particular device*/ +#define XMC_VADC_SHS_AVAILABLE (0U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_SHS_FULL_SET_REG (0U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_GROUP_SRCREG_AVAILABLE (0U) /* Define the availability of a source specific result register */ +#define XMC_VADC_RESULT_PRIORITY_AVAILABLE (0U) /* Define the availability of a priority for result register */ +#endif + +#if (UC_SERIES == XMC14 || UC_SERIES == XMC13 || UC_SERIES == XMC12) +#define XMC_VADC_GROUP_AVAILABLE (1U) /* Defines the availability of group resource in a device*/ +#define XMC_VADC_GSCAN_AVAILABLE (1U) /* Defines the availability of scan request resource in a device*/ +#define XMC_VADC_QUEUE_AVAILABLE (1U) /* Defines the availability of queue request resource in a device*/ +#define XMC_VADC_EMUX_AVAILABLE (1U) /* Defines the availability of external multiplexer support in a + device*/ +#define XMC_VADC_BOUNDARY_AVAILABLE (1U) /* Defines the availability of boundary check support in a device*/ +#define XMC_VADC_MULTIPLE_SLAVEGROUPS (1U) /* Defines the availability of synchronous request source in device*/ +#define XMC_VADC_MAXIMUM_NUM_GROUPS (2U) /* Defines the maximum number of groups available in a device*/ +#define XMC_VADC_BOUNDARY_FLAG_SELECT (1U) /* Defines the availability of boundary flags in a device*/ +#define XMC_VADC_EMUX_CH_SEL_STYLE (1U) /* Defines the external multiplexer channel selection mode of + operation for a particular device*/ +#define XMC_VADC_SHS_AVAILABLE (1U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_SHS_FULL_SET_REG (1U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_GROUP_SRCREG_AVAILABLE (1U) /* Define the availability of a source specific result register */ +#define XMC_VADC_RESULT_PRIORITY_AVAILABLE (1U) /* Define the availability of a priority for result register */ +#endif + +#if (UC_SERIES == XMC11) +#define XMC_VADC_GROUP_AVAILABLE (0U) /* Defines the availability of group resource in a device*/ +#define XMC_VADC_GSCAN_AVAILABLE (0U) /* Defines the availability of scan request resource in a device*/ +#define XMC_VADC_QUEUE_AVAILABLE (0U) /* Defines the availability of queue request resource in a device*/ +#define XMC_VADC_EMUX_AVAILABLE (0U) /* Defines the availability of external multiplexer support in a + device*/ +#define XMC_VADC_BOUNDARY_AVAILABLE (0U) /* Defines the availability of boundary check support in a device*/ +#define XMC_VADC_MULTIPLE_SLAVEGROUPS (0U) /* Defines the availability of synchronous request source in device*/ +#define XMC_VADC_MAXIMUM_NUM_GROUPS (2U) /* Defines the maximum number of groups available in a device*/ +#define XMC_VADC_BOUNDARY_FLAG_SELECT (0U) /* Defines the availability of boundary flags in a device*/ +#define XMC_VADC_SHS_START_UP_CAL_ACTIVE (3U) /* Defines the need for SHS startup calibration activation for + XMC1100 devices */ +#define XMC_VADC_CONV_ENABLE_FOR_XMC11 (*(uint32_t*) 0x40010500UL) /* Defines the additional errata setting for + XMC1100 device for effective working*/ +#define XMC_VADC_EMUX_CH_SEL_STYLE (0U) /* Defines the external multiplexer channel selection mode of + operation for a particular device*/ +#define XMC_VADC_SHS_AVAILABLE (1U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_SHS_FULL_SET_REG (0U) /* Defines the availability of sample and hold module*/ +#define XMC_VADC_GROUP_SRCREG_AVAILABLE (0U) /* Define the availability of a source specific result register */ +#define XMC_VADC_RESULT_PRIORITY_AVAILABLE (0U) /* Define the availability of a priority for result register */ +#endif + +#define XMC_VADC_NUM_PORTS (16U) /* Defines the number of hardware ports that can be configured + as triggers and gating signals */ + +#define XMC_VADC_NUM_RESULT_REGISTERS (16U) /* Defines the number of result holding registers per ADC group */ + +#define XMC_VADC_NUM_CHANNELS_PER_GROUP (8U) /**< Defines the number of ADC channels per group */ + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +typedef uint16_t XMC_VADC_RESULT_SIZE_t; /**< Type defined the converted result size to unsigned 16 bit integer */ +typedef VADC_GLOBAL_TypeDef XMC_VADC_GLOBAL_t; /**< Type defined the device header file vadc global register structure + type to VADC type*/ + +#if(XMC_VADC_GROUP_AVAILABLE == 1U) +typedef VADC_G_TypeDef XMC_VADC_GROUP_t; /**< Type defined the device header file vadc group register structure + type to VADC Group type*/ +#endif + +#if(XMC_VADC_SHS_AVAILABLE == 1U) +typedef SHS_Type XMC_VADC_GLOBAL_SHS_t; /**< Type defined the sample and hold register structure*/ +#endif +/** + * Defines the return status after execution of VADC specific API's. Use @ref XMC_VADC_STATUS_t for this enumeration. + */ +typedef enum XMC_VADC_STATUS +{ + XMC_VADC_STATUS_SUCCESS = 0, /**< Returned when the API has been able to fulfill the callers request */ + XMC_VADC_STATUS_ERROR /**< Returned when the API cannot fulfill the request */ +} XMC_VADC_STATUS_t; + +/** + * Defines the various service requests lines. Each group can raise up to 4 service requests independently. While + * all groups together have the possibility of raising 4 module wide service requests. Use @ref XMC_VADC_SR_t for this + * enumeration. + */ +typedef enum XMC_VADC_SR +{ + XMC_VADC_SR_GROUP_SR0 = 0, /**< Group specific Service Request-0 */ + XMC_VADC_SR_GROUP_SR1, /**< Group specific Service Request-1 */ + XMC_VADC_SR_GROUP_SR2, /**< Group specific Service Request-2 */ + XMC_VADC_SR_GROUP_SR3, /**< Group specific Service Request-3 */ + XMC_VADC_SR_SHARED_SR0, /**< Module Wide Common Service Request-0 */ + XMC_VADC_SR_SHARED_SR1, /**< Module Wide Common Service Request-1 */ + XMC_VADC_SR_SHARED_SR2, /**< Module Wide Common Service Request-2 */ + XMC_VADC_SR_SHARED_SR3 /**< Module Wide Common Service Request-3 */ +} XMC_VADC_SR_t; + +/** + * Defines the mode of operation of a channel, when an ongoing conversion gets interrupted in between. + * Use @ref XMC_VADC_STARTMODE_t for this enumeration. + */ +typedef enum XMC_VADC_STARTMODE +{ + XMC_VADC_STARTMODE_WFS = 0, /**< An ongoing conversion completes without interruption */ + XMC_VADC_STARTMODE_CIR, /**< An ongoing conversion can be interrupted and resumed later*/ + XMC_VADC_STARTMODE_CNR /**< An ongoing conversion can be interrupted and never resumed */ +} XMC_VADC_STARTMODE_t; + +/** + * Defines the edge sensitivity of the trigger signal which can assert a conversion. + * Use @ref XMC_VADC_TRIGGER_EDGE_t for this enumeration. + */ +typedef enum XMC_VADC_TRIGGER_EDGE +{ + XMC_VADC_TRIGGER_EDGE_NONE = 0, /**< No external trigger. Conversion request can be asserted by software */ + XMC_VADC_TRIGGER_EDGE_FALLING, /**< The falling edge of the external trigger can assert conversion request */ + XMC_VADC_TRIGGER_EDGE_RISING, /**< The rising edge of the external trigger can assert conversion request */ + XMC_VADC_TRIGGER_EDGE_ANY /**< Both the edges can assert conversion request */ +} XMC_VADC_TRIGGER_EDGE_t; + +/** + * Defines the external trigger input selection possibilities, to assert a conversion. Refer the VADC interconnects + * section of the reference manual for details of peripherals which can be used. Also refer xmc_vadc_map.h file for + * detailed definitions of the peripherals which can take the control of these enumeration items. + * Use @ref XMC_VADC_TRIGGER_INPUT_SELECT_t for this enumeration. + */ +typedef enum XMC_VADC_TRIGGER_INPUT_SELECT +{ + XMC_VADC_REQ_TR_A = 0, /**< Trigger select signal A */ + XMC_VADC_REQ_TR_B, /**< Trigger select signal B */ + XMC_VADC_REQ_TR_C, /**< Trigger select signal C */ + XMC_VADC_REQ_TR_D, /**< Trigger select signal D */ + XMC_VADC_REQ_TR_E, /**< Trigger select signal E */ + XMC_VADC_REQ_TR_F, /**< Trigger select signal F */ + XMC_VADC_REQ_TR_G, /**< Trigger select signal G */ + XMC_VADC_REQ_TR_H, /**< Trigger select signal H */ + XMC_VADC_REQ_TR_I, /**< Trigger select signal I */ + XMC_VADC_REQ_TR_J, /**< Trigger select signal J */ + XMC_VADC_REQ_TR_K, /**< Trigger select signal K */ + XMC_VADC_REQ_TR_L, /**< Trigger select signal L */ + XMC_VADC_REQ_TR_M, /**< Trigger select signal M */ + XMC_VADC_REQ_TR_N, /**< Trigger select signal N */ + XMC_VADC_REQ_TR_O, /**< Trigger select signal O */ + XMC_VADC_REQ_TR_P /**< Trigger select signal P */ + +} XMC_VADC_TRIGGER_INPUT_SELECT_t; + +/** + * Defines the external gating input selection possibilities, to gate the conversion requests. Refer the VADC + * interconnects section of the reference manual for details of peripherals which can be used. Also refer + * xmc_vadc_map.h file for detailed definitions of the peripherals which can take the control of these enumeration + * items. Use @ref XMC_VADC_GATE_INPUT_SELECT_t for this enumeration. + */ +typedef enum XMC_VADC_GATE_INPUT_SELECT +{ + XMC_VADC_REQ_GT_A = 0, /**< Gating select signal A */ + XMC_VADC_REQ_GT_B, /**< Gating select signal B */ + XMC_VADC_REQ_GT_C, /**< Gating select signal C */ + XMC_VADC_REQ_GT_D, /**< Gating select signal D */ + XMC_VADC_REQ_GT_E, /**< Gating select signal E */ + XMC_VADC_REQ_GT_F, /**< Gating select signal F */ + XMC_VADC_REQ_GT_G, /**< Gating select signal G */ + XMC_VADC_REQ_GT_H, /**< Gating select signal H */ + XMC_VADC_REQ_GT_I, /**< Gating select signal I */ + XMC_VADC_REQ_GT_J, /**< Gating select signal J */ + XMC_VADC_REQ_GT_K, /**< Gating select signal K */ + XMC_VADC_REQ_GT_L, /**< Gating select signal L */ + XMC_VADC_REQ_GT_M, /**< Gating select signal M */ + XMC_VADC_REQ_GT_N, /**< Gating select signal N */ + XMC_VADC_REQ_GT_O, /**< Gating select signal O */ + XMC_VADC_REQ_GT_P /**< Gating select signal P */ + +} XMC_VADC_GATE_INPUT_SELECT_t; + +/** + * Defines the condition for gating the conversion requests. It can be used to set the ENGT field + * of ASMR/BSMR/QMR register respectively for auto_scan/background_scan/queue request sources. + * Use @ref XMC_VADC_GATEMODE_t for this enumeration. + */ +typedef enum XMC_VADC_GATEMODE +{ + XMC_VADC_GATEMODE_BLOCK = 0, /**< External triggers are permanently blocked */ + XMC_VADC_GATEMODE_IGNORE, /**< External triggers are unconditionally passed */ + XMC_VADC_GATEMODE_ACTIVEHIGH, /**< External trigger is passed only if the gate signal is high */ + XMC_VADC_GATEMODE_ACTIVELOW /**< External trigger is passed only if the gate signal is low */ +} XMC_VADC_GATEMODE_t; + +/** + * Defines the conversion result handling mode. Use @ref XMC_VADC_DMM_t for this enumeration. + */ +typedef enum XMC_VADC_DMM +{ + XMC_VADC_DMM_REDUCTION_MODE = 0, /**< Standard Data reduction mode*/ + XMC_VADC_DMM_FILTERING_MODE, /**< Provide option to select Finite Impulse Response Filter (FIR) or + Infinite Impulse Response Filter (IIR)*/ + XMC_VADC_DMM_DIFFERENCE_MODE, /**< Difference mode is selected*/ +} XMC_VADC_DMM_t; + +/** + * Defines the conversion mode. It defines the resolution of conversion. Use XMC_VADC_CONVMODE_t for this enumeration. + */ +typedef enum XMC_VADC_CONVMODE +{ + XMC_VADC_CONVMODE_12BIT = 0, /**< Results of conversion are 12bits wide */ + XMC_VADC_CONVMODE_10BIT = 1, /**< Results of conversion are 10bits wide */ + XMC_VADC_CONVMODE_8BIT = 2, /**< Results of conversion are 8bits wide */ + XMC_VADC_CONVMODE_FASTCOMPARE = 5 /**< Input signal compared with a preset range */ +} XMC_VADC_CONVMODE_t; + +/** + * Defines the output of a fast compare mode. Use @ref XMC_VADC_FAST_COMPARE_t for + * this enumeration. + */ +typedef enum XMC_VADC_FAST_COMPARE +{ + XMC_VADC_FAST_COMPARE_LOW = 0, /**< Input lower than than programmed reference */ + XMC_VADC_FAST_COMPARE_HIGH , /**< Input higher than than programmed reference */ + XMC_VADC_FAST_COMPARE_UNKNOWN /**< Unknown, Conversion probably still ongoing */ +} XMC_VADC_FAST_COMPARE_t; + +/** + * Defines the type of scan request source to be used. It can choose between auto scan and background scan request + * source methods. Use @ref XMC_VADC_SCAN_TYPE_t for this enumeration. + */ +typedef enum XMC_VADC_SCAN_TYPE +{ + XMC_VADC_SCAN_TYPE_GROUPSCAN = 0, /**< Auto scan mode of operation selected. Also called as Group scan*/ + XMC_VADC_SCAN_TYPE_BACKGROUND /**< Background scan mode of operation selected. Also called as Global scan*/ +} XMC_VADC_SCAN_TYPE_t; + +/** + * Defines the behavior of load event for the scan request source. Use @ref XMC_VADC_SCAN_LOAD_t for this enumeration. + */ +typedef enum XMC_VADC_SCAN_LOAD +{ + XMC_VADC_SCAN_LOAD_OVERWRITE = 0, /**< The old set of channels is discarded in favor of the new set + awaiting conversion */ + XMC_VADC_SCAN_LOAD_COMBINE /**< The new set of channels are combined with the pending channels from + previous set */ +} XMC_VADC_SCAN_LOAD_t; + +/** + * Defines the conversion classes that can be selected for each channel. The enumeration members holds the group or + * global classes. The conversion classes decides the properties of conversion, like resolution, sampling time etc + * Use @ref XMC_VADC_CHANNEL_CONV_t for this enumeration. + */ + +typedef enum XMC_VADC_CHANNEL_CONV +{ + XMC_VADC_CHANNEL_CONV_GROUP_CLASS0 = 0, /**< Conversion property set-0 specific to the group */ + XMC_VADC_CHANNEL_CONV_GROUP_CLASS1, /**< Conversion property set-1 specific to the group */ + XMC_VADC_CHANNEL_CONV_GLOBAL_CLASS0, /**< Conversion property set-0, Module wide */ + XMC_VADC_CHANNEL_CONV_GLOBAL_CLASS1 /**< Conversion property set-1, Module wide */ +} XMC_VADC_CHANNEL_CONV_t; + +/** + * Defines the references to boundary values used for limit checking feature. Each of these can be assigned as + * either an upper bound or a lower bound. Use @ref XMC_VADC_CHANNEL_BOUNDARY_t for this enumeration. + */ + +typedef enum XMC_VADC_CHANNEL_BOUNDARY +{ + XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND0 = 0, /**< Group specific Boundary-0 value */ + XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND1, /**< Group specific Boundary-1 value */ + XMC_VADC_CHANNEL_BOUNDARY_GLOBAL_BOUND0, /**< Module wide Boundary-0 value */ + XMC_VADC_CHANNEL_BOUNDARY_GLOBAL_BOUND1 /**< Module wide Boundary-1 value */ +} XMC_VADC_CHANNEL_BOUNDARY_t; + +/** + * Defines the voltage which the capacitor is charged to. Used in Broken wire detection feature. Use + * @ref XMC_VADC_CHANNEL_BWDCH_t for this enumeration. + */ +typedef enum XMC_VADC_CHANNEL_BWDCH +{ + XMC_VADC_CHANNEL_BWDCH_VAGND = 0, /**< Capacitor pre-charged to ground*/ + XMC_VADC_CHANNEL_BWDCH_VAREF /**< Capacitor pre-charged to reference voltage*/ +} XMC_VADC_CHANNEL_BWDCH_t; + +/** + * Defines the criteria for event generation by the channel. Use @ref XMC_VADC_CHANNEL_EVGEN_t for this enumeration. + */ +typedef enum XMC_VADC_CHANNEL_EVGEN +{ + XMC_VADC_CHANNEL_EVGEN_NEVER = 0, /**< No event generated */ + XMC_VADC_CHANNEL_EVGEN_INBOUND = 1U, /**< Event generated when the result is within the normal range */ + XMC_VADC_CHANNEL_EVGEN_COMPHIGH = 1U, /**< Event generated when the result of fast compare operation is high */ + XMC_VADC_CHANNEL_EVGEN_OUTBOUND = 2U, /**< Event generated when the result is outside the normal range */ + XMC_VADC_CHANNEL_EVGEN_COMPLOW = 2U, /**< Event generated when the result result of fast compare operation is low */ + XMC_VADC_CHANNEL_EVGEN_ALWAYS = 3U /**< Event generated always after conversion - unconditionally */ +} XMC_VADC_CHANNEL_EVGEN_t; + +/** + * Defines the reference voltage selection for conversion. Use @ref XMC_VADC_CHANNEL_REF_t for this enumeration. + */ +typedef enum XMC_VADC_CHANNEL_REF +{ + XMC_VADC_CHANNEL_REF_INTREF = 0, /**< Internal VARef */ + XMC_VADC_CHANNEL_REF_ALT_CH0 /**< External voltage available on Channel-0 of the perticular group */ +} XMC_VADC_CHANNEL_REF_t; + +/** + * Defines the criteria for boundary flag assertion. Use @ref XMC_VADC_CHANNEL_BOUNDARY_CONDITION_t for this + * enumeration. + */ +typedef enum XMC_VADC_CHANNEL_BOUNDARY_CONDITION +{ + XMC_VADC_CHANNEL_BOUNDARY_CONDITION_ABOVE_BAND = 0, /**< Set Boundary condition criteria to assert above the band */ + XMC_VADC_CHANNEL_BOUNDARY_CONDITION_BELOW_BAND /**< Set Boundary condition criteria to assert below the band */ +} XMC_VADC_CHANNEL_BOUNDARY_CONDITION_t; + +/** + * Defines the event which can lead to a global service request assertion. Use @ref XMC_VADC_GLOBAL_EVENT_t for this + * enumeration. + */ +typedef enum XMC_VADC_GLOBAL_EVENT +{ + XMC_VADC_GLOBAL_EVENT_BKGNDSOURCE = VADC_GLOBEFLAG_SEVGLB_Msk, /**< Background scan request source event */ + XMC_VADC_GLOBAL_EVENT_RESULT = VADC_GLOBEFLAG_REVGLB_Msk /**< Global result event */ +} XMC_VADC_GLOBAL_EVENT_t; + +/** + * Defines the power modes of a VADC Group. Use @ref XMC_VADC_GROUP_POWERMODE_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_POWERMODE +{ + XMC_VADC_GROUP_POWERMODE_OFF = 0, /**< Group is powered down */ + XMC_VADC_GROUP_POWERMODE_RESERVED1, /**< Reserved */ + XMC_VADC_GROUP_POWERMODE_RESERVED2, /**< Reserved */ + XMC_VADC_GROUP_POWERMODE_NORMAL /**< Group is powered up */ +} XMC_VADC_GROUP_POWERMODE_t; + +/** + * Defines the status of a VADC group (also known as kernel). Use @ref XMC_VADC_GROUP_STATE_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_STATE +{ + XMC_VADC_GROUP_STATE_IDLE = 0, /**< Idle and can convert if requested */ + XMC_VADC_GROUP_STATE_BUSY /**< Busy with an ongoing conversion */ +} XMC_VADC_GROUP_STATE_t; + +/** + * Defines the reference to sample time and conversion mode settings. Use @ref XMC_VADC_GROUP_CONV_t for this + * enumeration. + */ +typedef enum XMC_VADC_GROUP_CONV +{ + XMC_VADC_GROUP_CONV_STD = 0, /**< Settings pertaining to channels directly attached to VADC module */ + XMC_VADC_GROUP_CONV_EMUX /**< Settings pertaining to channels connected to VADC via EMUX */ +} XMC_VADC_GROUP_CONV_t; + +/** + * Defines the request source arbiter behavior. Use @ref XMC_VADC_GROUP_ARBMODE_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_ARBMODE +{ + XMC_VADC_GROUP_ARBMODE_ALWAYS = 0, /**< Arbiter runs all the time */ + XMC_VADC_GROUP_ARBMODE_ONDEMAND /**< Arbiter runs only if a conversion request is asserted by any of the + request sources */ +} XMC_VADC_GROUP_ARBMODE_t; + +/** + * Defines the EMUX mode of operation. Use @ref XMC_VADC_GROUP_EMUXMODE_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_EMUXMODE +{ + XMC_VADC_GROUP_EMUXMODE_SWCTRL = 0, /**< Perform EMUX in Software control mode*/ + XMC_VADC_GROUP_EMUXMODE_STEADYMODE, /**< Perform EMUX in Steady mode (Use EMUX set value)*/ + XMC_VADC_GROUP_EMUXMODE_SINGLEMODE, /**< Perform EMUX in Single step mode*/ + XMC_VADC_GROUP_EMUXMODE_SEQUENCEMODE, /**< Perform EMUX in Sequence mode*/ +} XMC_VADC_GROUP_EMUXMODE_t; + +/** + * Defines the EMUX channel selection encoding scheme. Use @ref XMC_VADC_GROUP_EMUXCODE_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_EMUXCODE +{ + XMC_VADC_GROUP_EMUXCODE_BINARY = 0, /**< A linearly incrementing code serves are MUX-SEL */ + XMC_VADC_GROUP_EMUXCODE_GRAY /**< The MUX-SEL is gray encoded */ +} XMC_VADC_GROUP_EMUXCODE_t; + +/** + * Defines the service request set used. Use @ref XMC_VADC_GROUP_IRQ_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_IRQ +{ + XMC_VADC_GROUP_IRQ_KERNEL = 0, /**< Refers to Group specific service request */ + XMC_VADC_GROUP_IRQ_SHARED /**< Refers to Module wide service request */ +} XMC_VADC_GROUP_IRQ_t; + +/** + * Defines the alignment of the converted result. Use @ref XMC_VADC_RESULT_ALIGN_t for this enumeration. + */ +typedef enum XMC_VADC_RESULT_ALIGN +{ + XMC_VADC_RESULT_ALIGN_LEFT = 0, /**< Always align result to left */ + XMC_VADC_RESULT_ALIGN_RIGHT /**< Always align result to right */ +} XMC_VADC_RESULT_ALIGN_t; + +typedef enum XMC_VADC_RESULT_SUBTRATION +{ + XMC_VADC_RESULT_SUBTRATION_12BIT_LEFT_ALIGN = 0U, /**< Always align result to left */ + XMC_VADC_RESULT_SUBTRATION_12BIT_RIGHT_ALIGN = 0U, /**< Always align result to right */ + XMC_VADC_RESULT_SUBTRATION_10BIT_LEFT_ALIGN = 2U, /**< Always align result to left */ + XMC_VADC_RESULT_SUBTRATION_10BIT_RIGHT_ALIGN = 0U, /**< Always align result to right */ + XMC_VADC_RESULT_SUBTRATION_8BIT_LEFT_ALIGN = 4U, /**< Always align result to left */ + XMC_VADC_RESULT_SUBTRATION_8BIT_RIGHT_ALIGN = 0U, /**< Always align result to right */ +} XMC_VADC_RESULT_SUBTRATION_t; + +/** + * Defines the request source arbitration priority. Use @ref XMC_VADC_GROUP_RS_PRIORITY_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_RS_PRIORITY +{ + XMC_VADC_GROUP_RS_PRIORITY_0 = 0, /**< Lowest priority for the request source*/ + XMC_VADC_GROUP_RS_PRIORITY_1, /**< Second lowest priority for the request source*/ + XMC_VADC_GROUP_RS_PRIORITY_2, /**< Second highest priority for the request source*/ + XMC_VADC_GROUP_RS_PRIORITY_3, /**< Highest priority for the request source*/ +}XMC_VADC_GROUP_RS_PRIORITY_t; + +/** + * Defines the various modes for the boundary flag. Use @ref XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_BOUNDARY_FLAG_MODE +{ + XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_DISABLED = 0, /**< Disable boundary flag*/ + XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_ENABLED, /**< Always enable boundary*/ + XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_ENABLED_ACTIVE_LOW, /**< Enable boundary flag when gate level is 0*/ + XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_ENABLED_ACTIVE_HIGH /**< Enable boundary flag when gate level is 1*/ +}XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_t; + + +/** + * Defines the boundary select for Channel. Use @ref XMC_VADC_GROUP_BOUNDARY_FLAG_MODE_t for this enumeration. + */ +typedef enum XMC_VADC_BOUNDARY_SELECT +{ + XMC_VADC_BOUNDARY_SELECT_LOWER_BOUND = 0U, /**< Select the lower boundary*/ + XMC_VADC_BOUNDARY_SELECT_UPPER_BOUND = 2U /**< Selects the upper boundary*/ +}XMC_VADC_BOUNDARY_SELECT_t; + + +/** + * Defines the group indices. Use @ref XMC_VADC_GROUP_INDEX_t for this enumeration. + */ +typedef enum XMC_VADC_GROUP_INDEX +{ + XMC_VADC_GROUP_INDEX_0 = 0, + XMC_VADC_GROUP_INDEX_1, +#if (XMC_VADC_MAXIMUM_NUM_GROUPS > 2U) + XMC_VADC_GROUP_INDEX_2, + XMC_VADC_GROUP_INDEX_3 +#endif +}XMC_VADC_GROUP_INDEX_t; + +/** +* Defines channel alias. +* All enum items are available for channels 0 and 1. Other Channels can accept only XMC_VADC_CHANNEL_ALIAS_DISABLED. +*/ +typedef enum XMC_VADC_CHANNEL_ALIAS +{ + XMC_VADC_CHANNEL_ALIAS_DISABLED = -1, + XMC_VADC_CHANNEL_ALIAS_CH0 = 0, + XMC_VADC_CHANNEL_ALIAS_CH1 = 1, + XMC_VADC_CHANNEL_ALIAS_CH2 = 2, + XMC_VADC_CHANNEL_ALIAS_CH3 = 3, + XMC_VADC_CHANNEL_ALIAS_CH4 = 4, + XMC_VADC_CHANNEL_ALIAS_CH5 = 5, + XMC_VADC_CHANNEL_ALIAS_CH6 = 6, + XMC_VADC_CHANNEL_ALIAS_CH7 = 7 +} XMC_VADC_CHANNEL_ALIAS_t; + +#if(XMC_VADC_SHS_AVAILABLE == 1U) + +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) +/** + * Defines the gain calibration selection. + */ +typedef enum XMC_VADC_SHS_GAIN_LEVEL +{ + XMC_VADC_SHS_GAIN_LEVEL_0 = SHS_CALOC0_CALOFFVAL0_Pos, /**< Select the calibration value for gain level 0 */ + XMC_VADC_SHS_GAIN_LEVEL_1 = SHS_CALOC0_CALOFFVAL1_Pos, /**< Select the calibration value for gain level 1 */ + XMC_VADC_SHS_GAIN_LEVEL_2 = SHS_CALOC0_CALOFFVAL2_Pos, /**< Select the calibration value for gain level 2 */ + XMC_VADC_SHS_GAIN_LEVEL_3 = SHS_CALOC0_CALOFFVAL3_Pos /**< Select the calibration value for gain level 3 */ +}XMC_VADC_SHS_GAIN_LEVEL_t; +#endif + +/** + * Defines the Delta sigma loop. + */ +typedef enum XMC_VADC_SHS_LOOP_CH +{ + XMC_VADC_SHS_LOOP_CH_0 = SHS_LOOP_LPCH0_Pos, /**< Select Delta-sigma loop 0*/ + XMC_VADC_SHS_LOOP_CH_1 = SHS_LOOP_LPCH1_Pos /**< Select Delta-sigma loop 1*/ +}XMC_VADC_SHS_LOOP_CH_t; + +/** + * Provides the order in which the SHS should do the calibration + */ +typedef enum XMC_VADC_GLOBAL_SHS_CALIBRATION_ORDER +{ + XMC_VADC_GLOBAL_SHS_CALIBRATION_ORDER_POST_CONV = 0, /**< Calibration occur after conversion takes place */ + XMC_VADC_GLOBAL_SHS_CALIBRATION_ORDER_PRE_CONV /**< Calibration occur before conversion takes place */ +}XMC_VADC_GLOBAL_SHS_CALIBRATION_ORDER_t; +#endif + +#if (XMC_VADC_BOUNDARY_FLAG_SELECT == 1U) +/** + * Provides possible routing values for the boundary flag. + */ +typedef enum XMC_VADC_BOUNDARY_NODE +{ + XMC_VADC_BOUNDARY_NODE_COMMON_BOUNDARY_FLAG_0 = 0U, /** 2U) + XMC_VADC_SYNCTR_EVAL_2 = VADC_G_SYNCTR_EVALR2_Msk, /**Range:[0x0 to 0x7] */ + uint32_t refill_needed : 1; /**< Conversion completed channel gets inserted back into the queue */ + uint32_t generate_interrupt : 1; /**< Generates a queue request source event */ + uint32_t external_trigger : 1; /**< Conversion requests are raised on an external trigger. */ + uint32_t : 24; + + }; + uint32_t qinr0; + }; +} XMC_VADC_QUEUE_ENTRY_t; + +/** + * Structure initializing a VADC queue request source. Use type @ref XMC_VADC_QUEUE_CONFIG_t. + */ +typedef struct XMC_VADC_QUEUE_CONFIG +{ + uint32_t conv_start_mode : 2; /**< One converter is shared between the queue and scan request sources of the same + group. This field determines how queue request source would request for + conversion. Uses @ref XMC_VADC_STARTMODE_t */ + uint32_t req_src_priority : 2; /**< Request source priority for the arbiter.Uses @ref XMC_VADC_GROUP_RS_PRIORITY_t */ + union + { + struct + { +#if(XMC_VADC_GROUP_SRCREG_AVAILABLE == (1U)) + uint32_t src_specific_result_reg : 4; /**< Uses any one Group related result register as the destination + for all conversions results. To use the individual result register + from each channel configuration, configure this field with 0x0 */ +#else + uint32_t : 4; +#endif + uint32_t : 4; + uint32_t trigger_signal : 4; /**< Select one of the 16 possibilities for trigger. + Uses @ref XMC_VADC_TRIGGER_INPUT_SELECT_t */ + uint32_t : 1; + uint32_t trigger_edge : 2; /**< Edge selection for trigger signal. + Uses @ref XMC_VADC_TRIGGER_EDGE_t */ + uint32_t : 1; + uint32_t gate_signal : 4; /**< Select one of the 16 possibilities for gating. + Uses @ref XMC_VADC_GATE_INPUT_SELECT_t */ + uint32_t : 8; + uint32_t timer_mode : 1; /**< Timer mode for equi-distant sampling shall be activated or not? */ + uint32_t : 3; + }; + uint32_t qctrl0; + }; + union + { + struct + { + uint32_t : 2; + uint32_t external_trigger : 1; /**< Are external triggers supported? */ + uint32_t : 29; + }; + uint32_t qmr0; + }; +} XMC_VADC_QUEUE_CONFIG_t; + + +/** + * Structure to initialize the global input class configuration. Configured parameters are sample time and + * conversion Mode. + */ +typedef struct XMC_VADC_GLOBAL_CLASS +{ + union + { + struct + { + uint32_t sample_time_std_conv : 5; /**< Sample time for channels directly connected to VADC +
Range: [0x0 to 0x1F] */ + uint32_t : 3; + uint32_t conversion_mode_standard : 3; /**< Conversion mode for channels directly connected to VADC. + Uses @ref XMC_VADC_CONVMODE_t */ + uint32_t : 5; +#if(XMC_VADC_EMUX_AVAILABLE == 1U) + uint32_t sampling_phase_emux_channel : 5; /**< Sample time for channels connected via EMUX +
Range: [0x0 to 0x1F] */ + uint32_t : 3; + uint32_t conversion_mode_emux : 3; /**< Conversion mode for channels connected via EMUX to VADC. + Uses @ref XMC_VADC_CONVMODE_t */ + uint32_t : 5; +#else + uint32_t : 16; +#endif + }; + uint32_t globiclass; + }; +} XMC_VADC_GLOBAL_CLASS_t; + +#if (XMC_VADC_GROUP_AVAILABLE != 0U) +/** + * Structure to initialize converter and arbiter clock configuration + */ +typedef struct XMC_VADC_GLOBAL_CLOCK +{ + union + { + struct + { + + uint32_t analog_clock_divider : 5; /**< Clock for the converter.
Range: [0x0 to 0x1F] */ + uint32_t : 2; + uint32_t msb_conversion_clock : 1; /**< Additional clock cycle for analog converter */ + uint32_t arbiter_clock_divider : 2; /**< Request source arbiter clock divider.
Range: [0x0 to 0x3] */ + uint32_t : 5; + uint32_t : 17; + }; + uint32_t globcfg; + }; +} XMC_VADC_GLOBAL_CLOCK_t; +#endif + + +/** + * Structure to initialize the VADC Global functions + */ +typedef struct XMC_VADC_GLOBAL_CONFIG +{ + union + { + struct + { + uint32_t boundary0 : 12; /**< Boundary value for results comparison*/ + uint32_t : 4; + uint32_t boundary1 : 12; /**< Boundary value for results comparison*/ + uint32_t : 4; + }; + uint32_t globbound; + }; +#if (XMC_VADC_GROUP_AVAILABLE != 0U) + XMC_VADC_GLOBAL_CLOCK_t clock_config; /**< ADC clock configurations*/ +#endif + XMC_VADC_GLOBAL_CLASS_t class0; /**< ADC input conversion configurations for GLOBICLASS[0]*/ + XMC_VADC_GLOBAL_CLASS_t class1; /**< ADC input conversion configurations for GLOBICLASS[1]*/ + union + { + struct + { + uint32_t : 16; + uint32_t data_reduction_control : 4; /**< Data reduction stages */ + uint32_t : 4; + uint32_t wait_for_read_mode : 1; /**< Results of the next conversion will not be overwritten in the + result register until the previous value is read*/ + uint32_t : 6; + uint32_t event_gen_enable : 1; /**< Generates an event on availability of new result. */ + }; + uint32_t globrcr; + }; + union + { + struct + { + uint32_t module_disable : 1; /**< Disables the module clock.*/ + uint32_t : 2; + uint32_t disable_sleep_mode_control : 1; /**< Set it to true in order to disable the Sleep mode */ + uint32_t : 28; + }; + uint32_t clc; + }; +} XMC_VADC_GLOBAL_CONFIG_t; + + +/** + * Structure to initialize the group input class configuration. Configured parameters are sample time and + * conversion Mode. + */ +typedef struct XMC_VADC_GROUP_CLASS +{ + union + { + struct + { + uint32_t sample_time_std_conv : 5; /**< Sample time for channels directly connected to VADC +
Range: [0x0 to 0x1F] */ + uint32_t : 3; + uint32_t conversion_mode_standard : 3; /**< Conversion mode for channels directly connected to VADC. + Uses @ref XMC_VADC_CONVMODE_t */ + uint32_t : 5; + uint32_t sampling_phase_emux_channel : 5; /**< Sample time for channels connected via EMUX +
Range: [0x0 to 0x1F] */ + uint32_t : 3; + uint32_t conversion_mode_emux : 3; /**< Conversion mode for channels connected via EMUX to VADC. + Uses @ref XMC_VADC_CONVMODE_t */ + uint32_t : 5; + }; + uint32_t g_iclass0; + }; +} XMC_VADC_GROUP_CLASS_t; + + +/** + * EMUX related configuration structure. + */ +typedef struct XMC_VADC_GROUP_EMUXCFG +{ + union + { + struct + { + uint32_t starting_external_channel : 3; /**< External channel number to which the VADC will + generate a control signal (needed to select the analog input in + the analog multiplexer)*/ + uint32_t : 13; +#if (XMC_VADC_EMUX_CH_SEL_STYLE == 1U) + uint32_t connected_channel : 10; /**< The Channel to which the EMUX is connected. */ +#else + uint32_t connected_channel : 5; /**< The Channel to which the EMUX is connected. */ + uint32_t : 5; +#endif + uint32_t emux_mode : 2; /**< Selects the external multiplexer modes: Steady, Single Mode, step etc + Uses @ref XMC_VADC_GROUP_EMUXMODE_t*/ + uint32_t emux_coding : 1; /**< Select Binary or Gray coding. Uses @ref XMC_VADC_GROUP_EMUXCODE_t*/ + uint32_t stce_usage : 1; /**< Use STCE for each conversion of an external channel */ +#if (XMC_VADC_EMUX_CH_SEL_STYLE == 1U) + uint32_t emux_channel_select_style : 1; /**< Selects the style of configuring the \b connected_channel + (Each bit represents the channel or entire field represents the channel number ) */ + uint32_t : 1; +#else + uint32_t : 2; +#endif + }; + uint32_t g_emuxctr; + }; +} XMC_VADC_GROUP_EMUXCFG_t; + + +/** + * Group Configuration Data Structures + */ + +typedef struct XMC_VADC_GROUP_CONFIG +{ + XMC_VADC_GROUP_EMUXCFG_t emux_config; /**< External multiplexer related configurations */ + XMC_VADC_GROUP_CLASS_t class0; /**< ADC input conversion configurations for GxICLASS[0]*/ + XMC_VADC_GROUP_CLASS_t class1; /**< ADC input conversion configurations for GxICLASS[1]*/ + union + { + struct + { + uint32_t boundary0 : 12; /**< Boundary value for results comparison*/ + uint32_t : 4; + uint32_t boundary1 : 12; /**< Boundary value for results comparison*/ + uint32_t : 4; + }; + uint32_t g_bound; + }; + union + { + struct + { + uint32_t : 4; + uint32_t arbitration_round_length : 2; /**< Number of arbiter slots to be considered */ + uint32_t : 1; + uint32_t arbiter_mode : 1; /**< Arbiter mode - Select either Continuous mode or Demand based. + Uses @ref XMC_VADC_GROUP_ARBMODE_t */ + uint32_t : 24; + }; + uint32_t g_arbcfg; + }; +} XMC_VADC_GROUP_CONFIG_t; + +/** + * Structure to initialize VADC Group result register. + */ + +typedef struct XMC_VADC_RESULT_CONFIG +{ + union + { + struct + { + uint32_t : 16; + uint32_t data_reduction_control : 4; /**< Configures the data reduction stages */ + uint32_t post_processing_mode : 2; /**< Result data processing mode. Uses @ref XMC_VADC_DMM_t + For normal operation select + XMC_VADC_DMM_t::XMC_VADC_DMM_REDUCTION_MODE + and data_reduction_control as 0*/ + uint32_t : 2; + uint32_t wait_for_read_mode : 1; /**< Allow the conversion only after previous results are read*/ + uint32_t part_of_fifo : 2; /**< Make the result register a part of Result FIFO? */ + uint32_t : 4; + uint32_t event_gen_enable : 1; /**< Generates an event on availability of new result. */ + }; + uint32_t g_rcr; + }; +} XMC_VADC_RESULT_CONFIG_t; + +#if(XMC_VADC_SHS_AVAILABLE == 1U) +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) +/** + * Structure to initialize the Stepper configurations + */ +typedef struct XMC_VADC_GLOBAL_SHS_STEP_CONFIG +{ + union + { + struct + { + uint32_t sh_unit_step0 :3; /**< Select a Sample and hold unit for the stepper's step number 0. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step0 :1; /**< Should the step be added to the sequence */ + uint32_t sh_unit_step1 :3; /**< Select a Sample and hold unit for the stepper's step number 1. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step1 :1; /**< Should the step be added to the sequence */ + uint32_t sh_unit_step2 :3; /**< Select a Sample and hold unit for the stepper's step number 2. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step2 :1; /**< Should the step be added to the sequence */ + uint32_t sh_unit_step3 :3; /**< Select a Sample and hold unit for the stepper's step number 3. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step3 :1; /**< Should the step be added to the sequence */ + uint32_t sh_unit_step4 :3; /**< Select a Sample and hold unit for the stepper's step number 4. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step4 :1; /**< Should the step be added to the sequence */ + uint32_t sh_unit_step5 :3; /**< Select a Sample and hold unit for the stepper's step number 5. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step5 :1; /**< Should the step be added to the sequence */ + uint32_t sh_unit_step6 :3; /**< Select a Sample and hold unit for the stepper's step number 6. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step6 :1; /**< Should the step be added to the sequence */ + uint32_t sh_unit_step7 :3; /**< Select a Sample and hold unit for the stepper's step number 7. + Uses @ref XMC_VADC_GROUP_INDEX_t*/ + uint32_t enable_step7 :1; /**< Should the step be added to the sequence */ + + }; + uint32_t stepcfg; + }; +}XMC_VADC_GLOBAL_SHS_STEP_CONFIG_t; +#endif +/** + * Sample and hold Initialization structure + */ +typedef struct XMC_VADC_GLOBAL_SHS_CONFIG +{ + union + { + struct + { + uint32_t shs_clock_divider :4; /**< The divider value for the SHS clock. Range: [0x0 to 0xF]*/ + uint32_t :6; + uint32_t analog_reference_select :2; /**< It is possible to different reference voltage for the SHS module + */ + uint32_t :20; + }; + uint32_t shscfg; + }; +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) + XMC_VADC_GLOBAL_SHS_CALIBRATION_ORDER_t calibration_order; /**< order in which the calibration should be taken up*/ +#endif +}XMC_VADC_GLOBAL_SHS_CONFIG_t; + +#endif +/** + * Detailed result structure + */ + typedef struct XMC_VADC_DETAILED_RESULT +{ + union + { + struct + { + uint32_t result :16; /**< Result of the Analog to digital conversion*/ + uint32_t data_reduction_counter :4; /**< Results reduction counter value*/ + uint32_t channel_number :5; /**< Converted channel number*/ + uint32_t emux_channel_number :3; /**< Converted external multiplexer channel number. + Only applicable for GxRES[0] result register*/ + uint32_t converted_request_source :2; /**< Converted request source*/ + uint32_t fast_compare_result :1; /**< Fast compare result if conversion mode is fast compare mode.*/ + uint32_t vaild_result :1; /**< Valid flag is set when a new result is available*/ + }; + uint32_t res; + }; +}XMC_VADC_DETAILED_RESULT_t; + + +/*Anonymous structure/union guard end*/ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif +/********************************************************************************************************************* + * static inline functions + ********************************************************************************************************************/ + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) +__STATIC_INLINE bool XMC_VADC_CHECK_GROUP_PTR(XMC_VADC_GROUP_t *const group_ptr) +{ +#if (XMC_VADC_MAXIMUM_NUM_GROUPS == 4U) + return((group_ptr == VADC_G0) || (group_ptr == VADC_G1) || (group_ptr == VADC_G2) || (group_ptr == VADC_G3)); +#else + return((group_ptr == VADC_G0) || (group_ptr == VADC_G1)); +#endif +} +#endif +/********************************************************************************************************************* + * API Prototypes + ********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * Enables the VADC module.
\n + * This API would ungate the clock to the VADC module (if applicable). Also this API would bring + * the VADC module out of reset state(if applicable), by asserting the appropriate registers. + * This API would invoke XMC_SCU_CLOCK_UngatePeripheralClock() and XMC_SCU_RESET_DeassertPeripheralReset() + * if needed. Directly accessed register is COMPARATOR.ORCCTRL (Refer to the errata for XMC1100). + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_DisableModule(). + */ +void XMC_VADC_GLOBAL_EnableModule(void); + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * Disables the VADC module.
\n + * This API would gate the clock to the VADC module (if applicable). Also this API would put + * the VADC module into the reset state(if applicable) by asserting the appropriate registers. + * This API would invoke XMC_SCU_CLOCK_GatePeripheralClock() and XMC_SCU_RESET_AssertPeripheralReset() if needed. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_EnableModule(). + */ +void XMC_VADC_GLOBAL_DisableModule(void); + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * @param config Pointer to initialization data structure + * + * @return None + * + * \parDescription:
+ * Initializes the VADC global module with the associated configuration structure pointed by \a config.\n\n It + * enables the global access to registers by configuring reset and clock un-gating for selected devices. It + * initializes global class, boundary , result resources by setting GLOBICLASS,GLOBBOUND,GLOBRCR registers. It also + * configures the global analog and digital clock dividers by setting GLOBCFG register. Refer related API's to change + * the configurations later in the program. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_ClockInit()
+ */ +void XMC_VADC_GLOBAL_Init(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_GLOBAL_CONFIG_t *config); + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return None + * + * \parDescription:
+ * Enables the VADC module clock.\n\n Call this API before any further configuration of VADC. It sets the DISR bit of CLC + * register to enable. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_Init() + * + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_EnableModuleClock(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_Enable:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->CLC &= ~((uint32_t)VADC_CLC_DISR_Msk); +} + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return None + * + * \parDescription:
+ * Disables the VADC module clock.\n\n After this API call, no conversion will occur. Call + * XMC_VADC_GLOBAL_EnableModuleClock() to enable the VADC module later in the program. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_Init() + * + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_DisableModuleClock(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_Disable:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->CLC |= (uint32_t) ((uint32_t)1 << VADC_CLC_DISR_Pos); +} + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return None + * + * \parDescription:
+ * Enables VADC module to sleep if a sleep request comes.\n\n + * It resets the EDIS bit of CLC register for enabling the sleep mode. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_DisableSleepMode(). + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_EnableSleepMode(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_EnableSleepMode:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->CLC &= ~((uint32_t)VADC_CLC_EDIS_Msk); +} + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return None + * + * \parDescription:
+ * Ignores the sleep mode request for the VADC.\n\n + * With the sleep feature enabled, the module will respond to sleep + * requests by going into a low power mode. It resets the EDIS bit of CLC register for enabling the sleep mode. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_EnableSleepMode(). + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_DisableSleepMode(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_DisableSleepMode:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->CLC |= (uint32_t) ((uint32_t)1 << VADC_CLC_EDIS_Pos); +} + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) +/** + * + * @param global_ptr Constant pointer to the VADC module. + * @param config Pointer to the data structure containing clock configuration data + * + * @return None + * + * \parDescription:
+ * Configures the VADC clock.
\n + * Sets up the clock configuration of the VADC module using the config structure pointed by \a config. + * The clock to the analog converter and to the request source arbiter is configured by setting the GLOBCFG register. + * + * \parRelated APIs:
+ * None + * + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_ClockInit(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_GLOBAL_CLOCK_t *config) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_ClockInit:Wrong Module Pointer", (global_ptr == VADC)) + + /* Write the Clock configuration into the GLOBCFG register */ + global_ptr->GLOBCFG = (uint32_t)(config->globcfg | (VADC_GLOBCFG_DIVWC_Msk)); +} +#endif + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * @param config Conversion class parameter structure + * @param conv_type configure the input call for either standard conversion or EMUX related conversion. + * @param set_num Conversion class set
+ * Range: [0x0, 0x1] + * + * \parDescription:
+ * Configures the ADC conversion settings like sample time and resolution.
\n + * Sets up the conversion settings for vadc global resource associated with \a config structure. It configures the + * conversion class properties like sampling time and resolution for selected \a conv_type channels. It initializes + * the GLOBALICLASS register specified by \a set_num with the required settings. + * + * + * \parRelated APIs:
+ * None + * + */ + +void XMC_VADC_GLOBAL_InputClassInit(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_GLOBAL_CLASS_t config, + const XMC_VADC_GROUP_CONV_t conv_type, const uint32_t set_num); + +/** + * + * @param global_ptr Constant pointer to the VADC global module + * @param config Pointer to result configuration data structure + * + * @return None + * + * \parDescription:
+ * Initializes global result register.
\n + * Initializes Global Result Register with specified settings configured in the \a config structure.\n\n This API + * results in configuration of GLOBRCR register. This helps in configuring the Data reduction mode, global result event + * , wait for read mode on the GLOBRES register. + * + * + * \parRelated APIs:
+ * None + * + */ + + __STATIC_INLINE void XMC_VADC_GLOBAL_ResultInit(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_RESULT_CONFIG_t *config) + { + XMC_ASSERT("XMC_VADC_GLOBAL_ResultInit:Wrong Module Pointer", (global_ptr == VADC)) + + /* Configure GLOBRCR*/ + global_ptr->GLOBRCR = config->g_rcr; + } + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return None + * + * \parDescription:
+ * Enables the startup calibration feature of the VADC module.\n\n It configures the SUCAL bit of GLOBCFG register to + * enable the startup calibration feature. After turning it on, it loops until all active groups finish calibration. + * Call XMC_VADC_GLOBAL_Enable() and XMC_VADC_GLOBAL_ClockInit() before calling this API in sequence. Calling the API + * XMC_VADC_GLOBAL_DisableStartupCalibration() can disable the calibration feature at runtime. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_Enable()
+ * XMC_VADC_GLOBAL_ClockInit()
+ * None + */ +void XMC_VADC_GLOBAL_StartupCalibration(XMC_VADC_GLOBAL_t *const global_ptr); + + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return None + * + * \parDescription:
+ * Disables the startup calibration feature of the VADC module.\n\n It configures the SUCAL bit of GLOBCFG register to + * disable the startup calibration feature. Calling the API XMC_VADC_GLOBAL_EnsableStartupCalibration() can enable the + * calibration feature at runtime. + * + * \parRelated APIs:
+ * None + */ + +__STATIC_INLINE void XMC_VADC_GLOBAL_DisableStartupCalibration(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_DisableStartupCalibration:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->GLOBCFG &= ~((uint32_t)VADC_GLOBCFG_SUCAL_Msk); +} + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param group_number group number whose post calibration feature is to be disabled.
+ * Range[0x0 to 0x3] Accepts the enum ::XMC_VADC_GROUP_INDEX_t + * + * @return None + * + * \parDescription:
+ * Disables the post calibration for a particular group specified as \a group_number.\n\n It configures the DPCAL0 bit + * of GLOBCFG register to disable the post calibration feature. Call XMC_VADC_GLOBAL_Enable() and + * XMC_VADC_GLOBAL_ClockInit() before calling this API in sequence. Calling the API + * XMC_VADC_GLOBAL_EnablePostCalibration() can enable back the calibration feature at runtime. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_Enable()
+ * XMC_VADC_GLOBAL_ClockInit()
+ * XMC_VADC_GLOBAL_DisablePostCalibration()
+ * None + */ + +__STATIC_INLINE void XMC_VADC_GLOBAL_DisablePostCalibration(XMC_VADC_GLOBAL_t *const global_ptr, uint32_t group_number) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_DisablePostCalibration:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->GLOBCFG |= (uint32_t)((uint32_t)1 << ((uint32_t)VADC_GLOBCFG_DPCAL0_Pos + group_number)); +} + +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param group_number group number whose post calibration feature is to be enabled.
+ * Range[0x0 to 0x3] Accepts the enum ::XMC_VADC_GROUP_INDEX_t + * + * @return None + * + * \parDescription:
+ * Enables the post calibration for a particular group specified as \a group_number.\n\n It configures the DPCAL0 bit + * of GLOBCFG register to enable the post calibration feature. Calling the API XMC_VADC_GLOBAL_DisablePostCalibration() + * can disable the calibration feature at runtime. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_DisablePostCalibration()
+ * None + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_EnablePostCalibration(XMC_VADC_GLOBAL_t *const global_ptr, uint32_t group_number) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_EnablePostCalibration:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->GLOBCFG &= (~ (uint32_t)((uint32_t)1 << ((uint32_t)VADC_GLOBCFG_DPCAL0_Pos + group_number))); +} +#endif + +#if (XMC_VADC_BOUNDARY_AVAILABLE == 1U) +/** + * + * @param global_ptr Constant pointer to the VADC module. + * @param boundary0 Boundary-0 Value
Range[0 - 4095] + * @param boundary1 Boundary-1 Value
Range[0 - 4095] + * + * @return None + * + * \parDescription:
+ * Programs the boundaries with \a boundary0 and boundary1 for result comparison.\n\n These two boundaries can serve as + * absolute boundaries. They define a range against which the result of a conversion can be compared. In the + * fast compare mode, the two boundaries provide hysteresis capability to a compare value. In any case, these boundary + * values entered here form a boundary pallete. There are dedicated upper and lower boundary registers GLOBBOUND0 and + * GLOBBOUND1 who will derive their values from this palette. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_VADC_GLOBAL_SetBoundaries(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t boundary0, const uint32_t boundary1); + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * @param selection The boundary value selected for \b boundary_value. + * @param boundary_value Boundary Value
Range[0 - 4095] + * + * @return None + * + * \parDescription:
+ * Programs either the boundary 0 or boundary 1 for result comparison.\n\n This defines a range against which + * the result of a conversion can be compared. In the fast compare mode, the two boundaries provide hysteresis + * capability to a compare value. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_VADC_GLOBAL_SetIndividualBoundary(XMC_VADC_GLOBAL_t *const global_ptr, + const XMC_VADC_CHANNEL_BOUNDARY_t selection, + const uint16_t boundary_value); +#endif + +#if (XMC_VADC_EMUX_AVAILABLE== 1U) +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param emuxif The EMUX interface
Range[0x0 - 0x1] + * @param group The VADC group which must be bound to the desired emux + * + * @return None + * + * \parDescription:
+ * Binds a VADC \a group to an EMUX interface specified in \a emuxif.
\n + * Selects which group's scan request source will control the EMUX interface (set of control select lines for the EMUX). + * By passing \b group it would configure that group's scan request source to control the EMUX select lines of the set + * \b emuxif. + * + * \parRelated APIs:
+ * None + */ +void XMC_VADC_GLOBAL_BindGroupToEMux(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t emuxif, const uint32_t group); +#endif + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return uint32_t Complete global result register value GLOBRES + * + * \parDescription:
+ * Retrieves the complete result from the global result register associated with the \a global_ptr.\n\n This API audits + * the result register GLOBRES for the validity of the data. If the validity is assured, data is first read + * the global result register, cached locally next and subsequently returned to the caller. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_GetResult() + */ +__STATIC_INLINE uint32_t XMC_VADC_GLOBAL_GetDetailedResult(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_GetDetailedResult:Wrong Module Pointer", (global_ptr == VADC)) + + return(global_ptr->GLOBRES); +} + +/** + * + * @param global_ptr Constant pointer to the VADC module. + * + * @return XMC_VADC_RESULT_SIZE_t 16 bit result register value.
+ * Range[0x0 - 0X0FFF] + * + * \parDescription:
+ * Retrieves the conversion result from the global result register associated with the \a global_ptr.\n\n This is a + * lightweight version of XMC_VADC_GLOBAL_GetDetailedResult(). The behavior is exactly the same, just that it is + * only the 16 bit numeric result returned back to the application instead of the complete GLOBRES register value. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_GetDetailedResult() + */ +__STATIC_INLINE XMC_VADC_RESULT_SIZE_t XMC_VADC_GLOBAL_GetResult(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_GetResult:Wrong Module Pointer", (global_ptr == VADC)) + + return ((XMC_VADC_RESULT_SIZE_t)global_ptr->GLOBRES); +} + +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param compare_val Compare value which the result of a conversion will be compared against. + *
Range[0x0 - 0X0FFF] + * + * @return None + * + * \parDescription:
+ * Set compare value in the global result register for fast compare mode.\n\n The result of a conversion will directly + * be compared to the compare value entered as part of \a compare_val. The prerequisite is that the channel associated + * with this global register must select an ICLASS which has the conversion mode configured as fast compare mode. Call + * @ref XMC_VADC_GLOBAL_GetCompareResult() after this API to + * + * \parRelated APIs:
+ * None + */ +void XMC_VADC_GLOBAL_SetCompareValue(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_RESULT_SIZE_t compare_val); + +/** + * + * @param global_ptr Constant pointer to the VADC module + * @return compare high or low. Refer @ref XMC_VADC_FAST_COMPARE_t enum + * + * @return None + * + * \parDescription:
+ * Determines the result of fast compare operation.\n\n This API returns the result of fast compare operation provided + * the valid flag in the global result register GLOBRES is set. + * + * \parRelated APIs:
+ * None + */ +XMC_VADC_FAST_COMPARE_t XMC_VADC_GLOBAL_GetCompareResult(XMC_VADC_GLOBAL_t *const global_ptr); + +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param event_type Desired event that must be manually asserted + * Use the enum ::XMC_VADC_GLOBAL_EVENT_t to create a mask to be used with this argument + * @return None + * + * \parDescription:
+ * Manually asserts an event that can lead to an interrupt.\n\n This API manually asserts the requested event + * (Background request source event or a global result event) by setting the GLOBEVFLAG register with the specified + * \a event_type. + * + * \parRelated APIs:
+ * None + */ + +__STATIC_INLINE void XMC_VADC_GLOBAL_TriggerEvent(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t event_type) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_TriggerEvent:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_TriggerEvent:Wrong Global Event", + ((XMC_VADC_GLOBAL_EVENT_BKGNDSOURCE == event_type) || (XMC_VADC_GLOBAL_EVENT_RESULT == event_type))) + + global_ptr->GLOBEFLAG = event_type; +} + +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param event_type Event that must be acknowledged + * Use the enum ::XMC_VADC_GLOBAL_EVENT_t to create a mask to be used with this argument + * + * @return None + * + * \parDescription:
+ * Acknowledges an event that has been asserted manually or automatically.\n\n This API acknowledges the requested event + * by clearing GLOBEFLAG sticky flag. + * + * \parRelated APIs:
+ * None + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_ClearEvent(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t event_type) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_ClearEvent:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_ClearEvent:Wrong Global Event", + ((XMC_VADC_GLOBAL_EVENT_BKGNDSOURCE == event_type) || (XMC_VADC_GLOBAL_EVENT_RESULT == event_type))) + + global_ptr->GLOBEFLAG = ((uint32_t)(event_type << (uint32_t)16)); +} + +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param sr The service request to which the global result event is connected. Refer @ref XMC_VADC_SR_t enum + * + * @return None + * + * \parDescription:
+ * Binds the global result event to one of the 4 shared service requests.\n\n This API binds the global result event + * to one of the 4 module wide shared service requests .Sets GLOBEVNP register with the corresponding \a sr line. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode() + */ +void XMC_VADC_GLOBAL_SetResultEventInterruptNode(XMC_VADC_GLOBAL_t *const global_ptr, XMC_VADC_SR_t sr); + +/** + * + * @param global_ptr Constant pointer to the VADC module + * @param sr The service request to which the global request source event is connected. Refer @ref XMC_VADC_SR_t enum + * + * @return None + * + * \parDescription:
+ * Binds the background request source event to one of the 4 shared service requests.\n\n This API binds the background + * request source event to one of the 4 module wide shared service requests. Sets GLOBEVNP register with the + * corresponding \a sr line. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SetResultEventInterruptNode() + */ +void XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode(XMC_VADC_GLOBAL_t *const global_ptr, XMC_VADC_SR_t sr); + +#if(XMC_VADC_SHS_AVAILABLE == 1U) +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param config Struct consisting of various SHS related configurations. + * + * @return None + * + * \parDescription:
+ * Configure the basic SHS parameters.
\n + * API would initialize the clock divider configuration, the analog reference selection and + * the calibration order for the Sample and Hold unit. + * + * \parRelated APIs:
+ * None. + */ + void XMC_VADC_GLOBAL_SHS_Init(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, const XMC_VADC_GLOBAL_SHS_CONFIG_t *config); + +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) + /** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param config Struct consisting of various step configurations. + * + * @return None + * + * \parDescription:
+ * Configures the stepper sequence for the converter.
\n + * Stepper of the SHS can be configured to take up a specific sequence of groups for conversion. + * The stepper sequence is configured using this API. + * + * \parRelated APIs:
+ * None. + */ + __STATIC_INLINE void XMC_VADC_GLOBAL_SHS_SetStepperSequence(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + const XMC_VADC_GLOBAL_SHS_STEP_CONFIG_t *config) + { + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_StepperInit:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_StepperInit:Wrong config pointer", + (config == (XMC_VADC_GLOBAL_SHS_STEP_CONFIG_t*)NULL)) + + shs_ptr->STEPCFG = (uint32_t) config->stepcfg; + } +#endif + + /** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * + * @return bool returns true if the analog converter is operable + * returns false if the analog converter is powered down + * + * \parDescription:
+ * Returns the converter status.
\n + * Returns the ANRDY bit field of the SHSCFG register. + * + * \parRelated APIs:
+ * None. + */ + __STATIC_INLINE bool XMC_VADC_GLOBAL_SHS_IsConverterReady(XMC_VADC_GLOBAL_SHS_t *const shs_ptr) + { + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_IsConverterReady:Wrong SHS Pointer",(shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + + return((bool)((shs_ptr->SHSCFG >> (uint32_t)SHS_SHSCFG_ANRDY_Pos) & (uint32_t)0x1)); + } + +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num group number for which the accelerated mode needs to be enabled.
Range: [0x0 to 0x1] + * + * @return None + * + * \parDescription:
+ * Enables the Accelerated timing mode.
\n + * This API is needed when a switch from compatible mode to accelerated mode of conversion is needed. In + * this mode the ADC module will convert the input depending on the value stored in the SST bit of the SHS0_TIMCFGx. + * This API would configure the accelerated mode in the SHS0_TIMCFG0 and SHS0_TIMCFG1 registers. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GLOBAL_SHS_EnableAcceleratedMode(XMC_VADC_GLOBAL_SHS_t *const shs_ptr,XMC_VADC_GROUP_INDEX_t group_num); + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num group number for which the accelerated mode needs to be disabled.
Range: [0x0 to 0x1] + * + * @return None + * + * \parDescription:
+ * Enables the Accelerated timing mode.
\n + * This API is needed when a switch from accelerated mode to compatible mode of conversion is needed. + * This API would clear the accelerated mode in the SHS0_TIMCFG0 and SHS0_TIMCFG1 registers. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GLOBAL_SHS_DisableAcceleratedMode(XMC_VADC_GLOBAL_SHS_t *const shs_ptr,XMC_VADC_GROUP_INDEX_t group_num); + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num group number for which the accelerated mode needs to be enabled.
Range: [0x0 to 0x1] + * @param sst_value Value of short sample time that needs to be configured.
+ * Range: [0x0 to 0x3F] + * + * @return None + * + * \parDescription:
+ * Configures the Accelerated timing mode sample time.
\n + * This API is needed when a switch from compatible mode to accelerated mode of conversion is needed. In + * Accelerated mode the ADC module will convert the input depending on the value stored in the SST bit of the + * SHS0_TIMCFGx. This API would configure the shot sample time either in SHS0_TIMCFG0.SST or SHS0_TIMCFG1.SST . + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GLOBAL_SHS_SetShortSampleTime(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + uint8_t sst_value); + +#endif +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param divs_value The clock divider value that is possible + *
Range:[0x0 to 0xF] + * @return None + * + * \parDescription:
+ * Configure Sample and hold clock divider value.
\n + * API would initialize the clock divider configuration. This determines the frequency of conversion + * of the Sample and hold converter. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_SHS_SetClockDivider(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, uint8_t divs_value) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetClockDivider:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetClockDivider:Wrong divide factor selected", + (divs_value < (uint32_t)0x10)) + + shs_ptr->SHSCFG = (shs_ptr->SHSCFG & (~(uint32_t)SHS_SHSCFG_DIVS_Msk)) | (uint32_t)SHS_SHSCFG_SCWC_Msk; + shs_ptr->SHSCFG |= ((uint32_t)divs_value << SHS_SHSCFG_DIVS_Pos) | (uint32_t)SHS_SHSCFG_SCWC_Msk; +} + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param gain_value gain value possible + * Range:[0x0 to 0x3] + * @param group_num The Group number for which the configurations applies + * @param ch_num The channel number for which the gain has to be configured + * @return None + * + * \parDescription:
+ * Configure the gain value for SHS.
\n + * API would set the gain factor for a selected channel. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GLOBAL_SHS_SetGainFactor(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + uint8_t gain_value, + XMC_VADC_GROUP_INDEX_t group_num, + uint8_t ch_num); + +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param max_calibration_time calibration time + * Range:[0x0 to 0x3F] + * @return None + * + * \parDescription:
+ * Configure the Maximum calibration timing.
\n + * API would initialize the Maximum time after which the calibration should occur. If no adc conversion + * occur during this duration then the calibration would run irrespective of conversions. The max time the + * converter can go without a calibration is set in this API. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_SHS_SetMaxCalTime(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + uint32_t max_calibration_time) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetMaxCalTime:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + + shs_ptr->CALCTR &= ~((uint32_t)SHS_CALCTR_CALMAX_Msk); + shs_ptr->CALCTR |= ((uint32_t)max_calibration_time << SHS_CALCTR_CALMAX_Pos); +} + + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num The Group number for which the configurations applies + * @return None + * + * \parDescription:
+ * Enable the Gain and offset calibration.
\n + * Enable the gain and offset calibration for all the Sample and hold units. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SHS_DisableGainAndOffsetCalibrations()
. + */ +void XMC_VADC_GLOBAL_SHS_EnableGainAndOffsetCalibrations(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num); + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num The Group number for which the configurations applies + * @return None + * + * \parDescription:
+ * Disable the Gain and offset calibration.
\n + * Disable the gain and offset calibration for all the Sample and hold units. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SHS_EnableGainAndOffsetCalibrations()
. + */ +void XMC_VADC_GLOBAL_SHS_DisableGainAndOffsetCalibrations(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num); + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num The Group number for which the configurations applies + * @param gain_level The gain level whose calibration value has to read. + * @return None + * + * \parDescription:
+ * Read the calibration value for the selected gain level.
\n + * Each gain value has a offset calibration value, this API would return the offset calibration value of the + * selected gain level. This is applicable for all the channels in the group that use the particular gain level. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SHS_SetOffsetCalibrationValue()
. + */ +uint8_t XMC_VADC_GLOBAL_SHS_GetOffsetCalibrationValue(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + XMC_VADC_SHS_GAIN_LEVEL_t gain_level); + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num The Group number for which the configurations applies + * @param gain_level The gain level whose calibration value has to read. + * @param offset_calibration_value The offset calibration value to be set. + * @return None + * + * \parDescription:
+ * Set the calibration value for the selected gain level.
\n + * Each gain value has a offset calibration value, this API would set the offset value of the selected gain level. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SHS_GetOffsetCalibrationValue()
. + */ +void XMC_VADC_GLOBAL_SHS_SetOffsetCalibrationValue(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + XMC_VADC_SHS_GAIN_LEVEL_t gain_level, + uint8_t offset_calibration_value); +#endif + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param group_num The Group number for which the configurations applies + * @param loop_select The delta sigma loop number for which the configurations applies + * @param ch_num Channel number for which the configurations applies + * @return None + * + * \parDescription:
+ * Configures the delta sigma loop of the SHS.
\n + * There are 2 Delta-Sigma loops that can be configured. This API would configure the loop (loop_select) + * with the appropriate group_num and channel_num. + * Configures the SHS_LOOP bit fields. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SHS_EnableSigmaDeltaLoop()
. + */ +void XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + XMC_VADC_SHS_LOOP_CH_t loop_select, + uint8_t ch_num); + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param loop_select The delta sigma loop number for which the configurations applies + * @return None + * + * \parDescription:
+ * Enable the selected Delta-Sigma loop.
\n + * Configures the SHS_LOOP.LPENx bit field. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop()
. + * XMC_VADC_GLOBAL_SHS_EnableGainAndOffsetCalibrations()
. + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_SHS_EnableSigmaDeltaLoop(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_SHS_LOOP_CH_t loop_select) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_EnableSigmaDeltaLoop:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_EnableSigmaDeltaLoop:Wrong Delta sigma loop selected", + (loop_select == XMC_VADC_SHS_LOOP_CH_0)||(loop_select == XMC_VADC_SHS_LOOP_CH_1)) + + shs_ptr->LOOP |= (uint32_t)SHS_LOOP_LPEN0_Msk << (uint32_t)loop_select; +} + +/** + * @param shs_ptr Constant pointer to the VADC Sample and hold module + * @param loop_select The delta sigma loop number for which the configurations applies + * @return None + * + * \parDescription:
+ * Disable the selected delta sigma loop.
\n + * Configures the SHS_LOOP.LPENx bit field. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop()
. + * XMC_VADC_GLOBAL_SHS_EnableGainAndOffsetCalibrations()
. + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_SHS_DisableSigmaDeltaLoop(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_SHS_LOOP_CH_t loop_select) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_DisableSigmaDeltaLoop:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_DisableSigmaDeltaLoop:Wrong Delta sigma loop selected", + (loop_select == XMC_VADC_SHS_LOOP_CH_0)||(loop_select == XMC_VADC_SHS_LOOP_CH_1)) + + shs_ptr->LOOP &= ~((uint32_t)SHS_LOOP_LPEN0_Msk << (uint32_t)loop_select); + +} + +#endif +#if (XMC_VADC_GROUP_AVAILABLE == 1U) +/** + * + * @param group_ptr Constant pointer to the VADC group. + * @param config Pointer to the initialization data structure + * + * @return None + * + * \parDescription:
+ * Initializes the VADC group module with the associated configuration structure pointed by \a config.\n\n It + * initializes the group specified as part of the \a group_ptr. It initializes group conversion class, arbiter + * configuration , boundary configuration by setting GxICLASS,GxARBCFG,GxBOUND, registers. It also + * configures the EMUX control register if applicable. Refer related API's to change the configurations later in the + * program. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_InputClassInit()
+ * XMC_VADC_GROUP_SetPowerMode()
+ * XMC_VADC_GROUP_SetBoundaries()
+ * XMC_VADC_GROUP_ExternalMuxControlInit()
+ */ +void XMC_VADC_GROUP_Init(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GROUP_CONFIG_t *config); + +/** + * + * @param group_ptr Constant pointer to the VADC group. + * @param config group related conversion class parameter structure + * @param conv_type Use direct channels or EMUX channels. Refer @ref XMC_VADC_GROUP_CONV_t enum + * @param set_num Conversion class set
+ * Range[0x0, 0x1] + * + * @return None + * + * \parDescription:
+ * Sets up the conversion settings for vadc group resource associated with \a config structure. It configures the + * conversion class properties like sampling time and resolution for selected \a conv_type channels. It initializes + * the G_ICLASS register specified by \a set_num with the required settings. + * + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_Init() + * + */ +void XMC_VADC_GROUP_InputClassInit(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GROUP_CLASS_t config, + const XMC_VADC_GROUP_CONV_t conv_type, const uint32_t set_num); + +/** + * + * @param group_ptr Constant pointer to the VADC Group which must be set as a slave + * @param master_grp The master group number
+ * Range: [0x0 - 0x3] + * @param slave_group The slave group number
+ * Range: [0x0 - 0x3] + * + * @return None + * + * \parDescription:
+ * Configures a VADC Group as a slave group.\n\n Conversion of identically numbered channels across groups can be + * synchronized. For example, when the trigger to convert CH-1 of Group-2 is received, it is possible to + * simultaneously request conversion of CH-1 of Group-0 and Group-3. Group-2 in this example is therefore the + * master group while Groups-0 and 3 are the slave groups. It uses the SYNCCTR register for the configuration settings. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_SetSyncMaster()
+ * XMC_VADC_GROUP_CheckSlaveReadiness()
+ * XMC_VADC_GROUP_EnableChannelSyncRequest()
+ * + */ +void XMC_VADC_GROUP_SetSyncSlave(XMC_VADC_GROUP_t *const group_ptr, uint32_t master_grp, uint32_t slave_group); + +/** + * + * @param group_ptr Constant pointer to the VADC Group. + * @param power_mode Desired power mode + * + * @return None + * + * \parDescription:
+ * Configures the power mode of a VADC group.\n\n For a VADC group to actually convert an analog signal, its analog + * converter must be turned on. + * + * \parRelated APIs:
+ * None + */ +void XMC_VADC_GROUP_SetPowerMode(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GROUP_POWERMODE_t power_mode); + +/** + * + * @param group_ptr Constant pointer to the VADC group. + * + * @return None + * + * \parDescription:
+ * Configures a VADC Group as a master group.
\n + * Conversion of identically numbered channels across groups can be + * synchronized. For example, when the trigger to convert CH-1 of Group-2 is received, it is possible to simultaneously + * request conversion of CH-1 of Group-0 and Group-3. Group-2 in this example is therefore the master group while + * Groups-0 and 3 are the slave groups. + * + * \parRelated APIs:
+ * None + */ +void XMC_VADC_GROUP_SetSyncMaster(XMC_VADC_GROUP_t *const group_ptr); + +/** + + * @param group_ptr Pointer to the master VADC Group + * @param slave_group The slave VADC Group number + *
Range: [0x0 to 0x3] + * @return None + * + * \parDescription:
+ * Configures the ready signal for master group.
\n + * This API would read the \b slave_group number and determine which EVAL configuration to apply for the given master + * slave set. Checks the readiness of slaves in synchronized conversions. Conversion of identically numbered channels + * across groups can be synchronized. For example, when the trigger to convert CH-1 of Group-2 is received, it is + * possible to simultaneously request conversion of CH-1 of Group-0 and Group-3. Group-2 in this example is + * therefore the master group while Groups-0 and 3 are the slave groups. Before the master can request its slaves + * for synchronized conversion, it has the option of checking the readiness of the slaves. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_IgnoreSlaveReadiness()
XMC_VADC_GROUP_SetSyncMaster() + */ +void XMC_VADC_GROUP_CheckSlaveReadiness(XMC_VADC_GROUP_t *const group_ptr, uint32_t slave_group); + +/** + * + * @param group_ptr Constant Pointer to the master VADC Group + * @param slave_group The slave VADC Group number + * @return None + * + * \parDescription:
+ * Clears the ready signal for master group.
\n + * Ignores the readiness of slaves in synchronized conversions.This API would read the \b slave_group number and + * determine which EVAL configuration to apply for the given master slave set. Then clears the configuration if present. + * This API is called when the master should issue the conversion request without waiting for the slave to + * assert a ready signal. The ready signal is asserted by the slave group(s) when the conversion is completed + * in these channels. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_CheckSlaveReadiness()
XMC_VADC_GROUP_SetSyncMaster()
+ */ +void XMC_VADC_GROUP_IgnoreSlaveReadiness(XMC_VADC_GROUP_t *const group_ptr, uint32_t slave_group); + +/** + * + * @param group_ptr Constant Pointer to the VADC Group waiting for ready signal + * @param eval_waiting_group The VADC Group which expects a ready signal to start it's conversion. + * @param eval_origin_group The VADC Group from which the eval_waiting_group will expect a ready signal + * @return None + * + * \parDescription:
+ * Sets the ready signal in the eval_waiting_group .
\n + * For Synchronized conversion all the slaves participating need to configure the ready signal. + * A slave group will also need to configure the ready signals coming from the other slave groups. + * A call to this API would configure the Sync.slave's EVAL Bits (GxSYNCTR.EVALy). + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_CheckSlaveReadiness()
XMC_VADC_GROUP_IgnoreSlaveReadiness()
+ */ +void XMC_VADC_GROUP_SetSyncSlaveReadySignal(XMC_VADC_GROUP_t *const group_ptr, + uint32_t eval_waiting_group, + uint32_t eval_origin_group); + +/** + * + * @param group_ptr Constant Pointer to the VADC Group + * @return + * uint32_t EVAL bits for the group + * + * \parDescription:
+ * Get the Eval bits of the group.
\n + * For Synchronized conversion the master's ready signal configuration must be copied onto the slaves. + * A call to this API would return the Sync EVAL Bits (GxSYNCTR.EVALy) which can be used to set in the slaves. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_CheckSlaveReadiness()
XMC_VADC_GROUP_IgnoreSlaveReadiness()
+ */ +__STATIC_INLINE uint32_t XMC_VADC_GROUP_GetSyncReadySignal(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t eval_mask; + XMC_ASSERT("XMC_VADC_GROUP_GetSyncReadySignal:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + +#if (XMC_VADC_MAXIMUM_NUM_GROUPS > 2U) + eval_mask = VADC_G_SYNCTR_EVALR1_Msk | VADC_G_SYNCTR_EVALR2_Msk | VADC_G_SYNCTR_EVALR3_Msk; +#else + eval_mask = VADC_G_SYNCTR_EVALR1_Msk; +#endif + return( group_ptr->SYNCTR & eval_mask); +} + +/** + * @param group_ptr Constant Pointer to the VADC Group + * @param eval_mask mask to configure the eval bits + * Use XMC_VADC_SYNCTR_EVAL_t to create the mask. + * @return None + * + * \parDescription:
+ * Set the Eval bits of the group.
\n + * For Synchronized conversion the master's ready signal configuration must be copied onto the slaves. + * A call to this API would configure the Sync EVAL Bits (GxSYNCTR.EVALy). + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_CheckSlaveReadiness()
XMC_VADC_GROUP_IgnoreSlaveReadiness()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_SetSyncReadySignal(XMC_VADC_GROUP_t *const group_ptr, uint32_t mask) +{ + uint32_t eval_mask; + XMC_ASSERT("XMC_VADC_GROUP_SetSyncReadySignal:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + +#if (XMC_VADC_MAXIMUM_NUM_GROUPS > 2U) + eval_mask = VADC_G_SYNCTR_EVALR1_Msk | VADC_G_SYNCTR_EVALR2_Msk | VADC_G_SYNCTR_EVALR3_Msk; +#else + eval_mask = VADC_G_SYNCTR_EVALR1_Msk; +#endif + group_ptr->SYNCTR &= ~(eval_mask); + group_ptr->SYNCTR |= mask; +} + +/** + * + * @param group_ptr Constant pointer to the master VADC Group + * @param ch_num Channel whose conversion triggers conversion in slave groups + * @return None + * + * \parDescription:
+ * Sets up a channel for synchronized conversion.\n\n Conversion of identically numbered channels across groups + * can be synchronized. For example, when the trigger to + * convert CH-1 of Group-2 is received, it is possible to simultaneously request conversion of CH-1 of Group-0 and + * Group-3. Group-2 in this example is therefore the master group while Groups-0 and 3 are the slave groups.
+ * Before the master can request its slaves for synchronized conversion, it has the option of checking the readiness + * of the slaves. + * + * \parRelated APIs:
+ * None + */ +void XMC_VADC_GROUP_EnableChannelSyncRequest(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num); + +/** + * + * @param group_ptr Pointer to the master VADC Group + * @param ch_num Channel whose conversion triggers conversion in slave groups + * @return None + * + * \parDescription:
+ * Disable the synchronization request for the particular channel specified as ch_num. To enable the synchronization + * call the API @ref XMC_VADC_GROUP_EnableChannelSyncRequest(). + * + * \parRelated APIs:
+ * None + */ +void XMC_VADC_GROUP_DisableChannelSyncRequest(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num); + +/** + * + * @param group_ptr Constant pointer to the VADC group. + * + * @return retuns IDLE if converter is free else returns busy. Refer @ref XMC_VADC_GROUP_STATE_t enum + * + * \parDescription:
+ * Checks the live status of the analog to digital converter. The converter can either idle doing nothing or busy + * sampling + converting. + * + * \parRelated APIs:
+ * None + */ +XMC_VADC_GROUP_STATE_t XMC_VADC_GROUP_IsConverterBusy(XMC_VADC_GROUP_t *const group_ptr); + +/** + * + * @param group_ptr Constant pointer to the VADC group whose global boundary registers are to be programmed + * @param boundary0 Boundary-0 Value
+ * Range: [0x0 - 0x0FFF] + * @param boundary1 Boundary-1 Value
+ * Range: [0x0 - 0x0FFF] + * + * @return None + * + * \parDescription:
+ * Programs the boundaries with \a boundary0 and boundary1 for result comparison.\n\n These two boundaries can serve as + * absolute boundaries. They defines a range against which the result of a conversion can be compared. In the + * fast compare mode, the two boundaries provide hysteresis capability to a compare value. In any case, these boundary + * values entered here form a boundary pallete. There are dedicated upper and lower boundary registers G_BOUND0 and + * G_BOUND1 who will derive their values from this palette. + * + * \parRelated APIs:
+ * None + * + */ +void XMC_VADC_GROUP_SetBoundaries(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t boundary0, + const uint32_t boundary1); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param selection The boundary value selected for \b boundary_value. + * @param boundary_value Select the boundary value. + * @return + * None + * + * \parDescription:
+ * Programs the boundary with \a boundary_value for result comparison.\n\n This defines a range against which + * the result of a conversion can be compared. In the fast compare mode, the two boundaries provide hysteresis + * capability to a compare value. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_SetIndividualBoundary(XMC_VADC_GROUP_t *const group_ptr, + const XMC_VADC_CHANNEL_BOUNDARY_t selection, + const uint16_t boundary_value); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param sr_num The service request number (0 through 3) + * @param type IRQ type (Kernel specific interrupt vs Module wide shared interrupt ) + * @return None + * + * \parDescription:
+ * Activates a Service Request line(manually trigger).
\n + * VADC provides few SR lines for each group and a few more which is shared across all the groups. + * These SR lines can be connected to an NVIC node which in-turn would generate an interrupt. + * This API would manually trigger the given SR line. Could be used for evaluation and testing purposes. + * + * \parRelated APIs:
+ * None + */ +void XMC_VADC_GROUP_TriggerServiceRequest(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t sr_num, + const XMC_VADC_GROUP_IRQ_t type); + +/** + * + * @param group_ptr Constant pointer to the VADC group + * @param emux_cfg EMUX configuration structure + * @return None + * + * \parDescription:
+ * Configures group EMUX parameters associated with the \a emux_cfg configuration structure.\n\n An external emux + * interface allows additional channels to be connected to a VADC group. The conversion properties + * of such channels can be different from the standard channels which are directly connected to the VADC group. + * This API configures conversion properties of channels connected via EMUX interface. + * + * \parRelated APIs:
+ * None + */ +__STATIC_INLINE void XMC_VADC_GROUP_ExternalMuxControlInit(XMC_VADC_GROUP_t *const group_ptr, + const XMC_VADC_GROUP_EMUXCFG_t emux_cfg) +{ + uint32_t emux_config; + + XMC_ASSERT("XMC_VADC_GROUP_ExternalMuxControlInit:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + emux_config = ((uint32_t)emux_cfg.starting_external_channel << (uint32_t)VADC_G_EMUXCTR_EMUXSET_Pos) | + ((uint32_t)emux_cfg.connected_channel << (uint32_t)VADC_G_EMUXCTR_EMUXCH_Pos); + + group_ptr->EMUXCTR = emux_config; + emux_config = ((uint32_t)emux_cfg.emux_coding << (uint32_t)VADC_G_EMUXCTR_EMXCOD_Pos) | + ((uint32_t)emux_cfg.emux_mode << (uint32_t)VADC_G_EMUXCTR_EMUXMODE_Pos)| + ((uint32_t)emux_cfg.stce_usage << (uint32_t)VADC_G_EMUXCTR_EMXST_Pos); + +#if (XMC_VADC_EMUX_CH_SEL_STYLE == 1U) + emux_config |= ((uint32_t)emux_cfg.emux_channel_select_style << (uint32_t)VADC_G_EMUXCTR_EMXCSS_Pos); +#endif + group_ptr->EMUXCTR |= (emux_config | ((uint32_t)VADC_G_EMUXCTR_EMXWC_Msk)) ; +} + +#if XMC_VADC_BOUNDARY_FLAG_SELECT == 1U + +/** + * @param group_ptr Constant pointer to the VADC group + * @param boundary_flag_num The Boundary flag for which the interrupt node needs to be configured. + * Range: [0x0 to 0x3] + * @param node Service Request node Id + * @return + * None + * + * \parDescription:
+ * Connects the boundary event to the SR line of VADC or to a common boundary flag.
\n + * This API will connect a Service Request line(SR) to a boundary event. Hence to get a interrupt on this + * Service request line one has to enable the required NVIC node. A call to this API would configure the register bit + * field GxBFLNP.BFLxNP. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_SetBoundaryEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, + const uint8_t boundary_flag_num, + const XMC_VADC_BOUNDARY_NODE_t node); +#endif + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * uint32_t The complete GxALIAS register + * + * \parDescription:
+ * Returns the ALIAS values.\n The ALIAS value that is configured for Channel-0 and channel-1 are returned. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE uint32_t XMC_VADC_GROUP_GetAlias(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_GetAliasWrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + return (group_ptr->ALIAS); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param conv_class conversion property to be extracted + * @return + * XMC_VADC_GROUP_CLASS_t The complete GxICLASSy register + * + * \parDescription:
+ * Returns the input class configuration values.\n + * This returns the sampling time configuration and resolution configured in the appropriate group input class + * \b conv_class. A call to this API would return the register GxICLASSy. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE XMC_VADC_GROUP_CLASS_t XMC_VADC_GROUP_GetInputClass(XMC_VADC_GROUP_t *const group_ptr, + const XMC_VADC_CHANNEL_CONV_t conv_class) +{ + XMC_VADC_GROUP_CLASS_t input_value; + XMC_ASSERT("XMC_VADC_GROUP_GetInputClass:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_GetInputClass:Wrong conv_class selected", + (XMC_VADC_CHANNEL_CONV_GROUP_CLASS0 == conv_class) || (XMC_VADC_CHANNEL_CONV_GROUP_CLASS1 == conv_class)) + + input_value.g_iclass0 = (uint32_t) 0xFFFFFFFF; + if ((XMC_VADC_CHANNEL_CONV_GROUP_CLASS0 == conv_class) || (XMC_VADC_CHANNEL_CONV_GROUP_CLASS1 == conv_class)) + { + input_value.g_iclass0 = group_ptr->ICLASS[(uint32_t)conv_class]; + } + + return (input_value); +} +#endif + +#if (XMC_VADC_GSCAN_AVAILABLE == 1U) +/** + * @param group_ptr Pointer to the VADC group + * @param config Pointer to Scan configuration + * @return None + * + * \parDescription:
+ * Initializes the VADC SCAN functional block.
\n + * The GROUP SCAN request source functional block converts channels sequentially starting with the highest numbered + * channel to the lowest. Channels must register themselves as being part of the the scan sequence. + * A call to this API will first disable the arbitration slot for queue (XMC_VADC_GROUP_ScanEnableArbitrationSlot()) + * and then it would configure all the related registers with the required configuration values. + * The arbitration slot is re-enabled at the end of init by invoking XMC_VADC_GROUP_ScanDisableArbitrationSlot(). + * A call to this API would configure the registers GxARBPR, GxASCTRL, GxASMR needed scan request source. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanEnableArbitrationSlot()
XMC_VADC_GROUP_ScanDisableArbitrationSlot()
+ * XMC_VADC_GROUP_ScanSelectTrigger()
XMC_VADC_GROUP_ScanSelectGating()
+ */ +void XMC_VADC_GROUP_ScanInit(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_SCAN_CONFIG_t *config); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Enables arbitration slot of the scan request source.
\n + * If the scan request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the scan channel can only be converted when the arbiter comes + * to the scan slot. Thus this must be enabled if any conversion need to take place. + * A call to this API would configure the register bit field GxARBPR.ASEN1. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanDisableArbitrationSlot()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanEnableArbitrationSlot(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanEnableArbitrationSlot:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ARBPR |= (uint32_t)VADC_G_ARBPR_ASEN1_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Disables arbitration slot of the scan request source.
\n + * If the scan request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the scan channel can only be converted when the arbiter comes + * to the scan slot.A call to this API will lead to all conversions request by scan to be blocked. + * A call to this API would configure the register bit field GxARBPR.ASEN1. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanEnableArbitrationSlot()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanDisableArbitrationSlot(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanDisableArbitrationSlot:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ARBPR &= ~((uint32_t)VADC_G_ARBPR_ASEN1_Msk); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * bool returns true if the arbitration is enabled else returns false. + * + * \parDescription:
+ * Returns the arbitration status of the scan request source.
\n + * If the scan request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the scan channel can only be converted when the arbiter comes + * to the scan slot. A call to this API would return the status of the arbitration slot of scan. + * A call to this API would read the register bit field GxARBPR.ASEN1. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanEnableArbitrationSlot(),
XMC_VADC_GROUP_ScanDisableArbitrationSlot()
+ */ +__STATIC_INLINE bool XMC_VADC_GROUP_ScanIsArbitrationSlotEnabled(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanIsArbitrationSlotEnabled:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + return ((group_ptr->ARBPR & (uint32_t)VADC_G_ARBPR_ASEN1_Msk) >> VADC_G_ARBPR_ASEN1_Pos); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param trigger_input Choice of the input earmarked as a trigger line + * @return + * None + * + * \parDescription:
+ * Select Trigger signal for scan request source.
\n + * A scan request source will raise conversion request only if there were either a request from application or + * occurrence of a hardware trigger. This API selects one of the 16 input lines as a trigger line. This is + * needed when a hardware trigger is needed for the conversion of the scan request source. + * Refer to the reference manual to determine the signal that needs to be connected. + * A call to this API would configure the register bit field GxASCTRL.XTSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanSelectGating()
XMC_VADC_GROUP_ScanEnableExternalTrigger()
+ */ +void XMC_VADC_GROUP_ScanSelectTrigger(XMC_VADC_GROUP_t *const group_ptr, XMC_VADC_TRIGGER_INPUT_SELECT_t trigger_input); + + +/** + * @param group_ptr Constant pointer to the VADC group + * @param trigger_edge Trigger edge selection + * @return + * None + * + * \parDescription:
+ * Selects the trigger edge for scan request source.
\n + * A scan request source will raise conversion request only if there were either a request from application or + * occurrence of a hardware trigger. This API selects one of the 4 possible trigger edges. This is + * needed when a hardware trigger is needed for the conversion of the scan request source. + * A call to this API would configure the register bit field GxASCTRL.XTMODE. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanSelectTrigger()
+ */ +void XMC_VADC_GROUP_ScanSelectTriggerEdge(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_TRIGGER_EDGE_t trigger_edge); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param gating_input Module input signal meant to be selected as gating input + * @return + * None + * + * \parDescription:
+ * Select Gating signal for scan request source.
\n + * Passage of the trigger input to the request source can be controlled via a gating signal. Any one of the 16 input + * lines can be chosen as a gating signal. Trigger signal can be given to the scan request source only + * when the gating signal's active level is detected. Additionally the GxASMR.ENGT has to be configured for + * the gating signal's active level. A call to this API would configure the register bit field GxASCTRL.GTSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanSelectTrigger()
+ */ +void XMC_VADC_GROUP_ScanSelectGating(XMC_VADC_GROUP_t *const group_ptr, XMC_VADC_GATE_INPUT_SELECT_t gating_input); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param mode_sel Select how the gating is applied to the scan request source + * @return + * None + * + * \parDescription:
+ * Selects the gating mode of scan request source.
\n + * Passage of the trigger input to the request source can be controlled via a gating signal. + * This API determines how the gating signal behaves, either active low or active high. + * If gating signal needs to ignored XMC_VADC_GATEMODE_IGNORE should be used as the \a mode_sel. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanSelectGating(); + */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanSetGatingMode(XMC_VADC_GROUP_t *const group_ptr, XMC_VADC_GATEMODE_t mode_sel) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanSetGatingMode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanSetGatingMode:Wrong mode selected", (mode_sel <= XMC_VADC_GATEMODE_ACTIVELOW)) + + /* Clear the existing gate configuration */ + group_ptr->ASMR &= (uint32_t) (~((uint32_t)VADC_G_ASMR_ENGT_Msk)); + /* Set the new gating mode */ + group_ptr->ASMR |= (uint32_t)((uint32_t)mode_sel << VADC_G_ASMR_ENGT_Pos); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Enables continuous conversion mode.
\n + * Typically for a scan request source to generate conversion request, either a hardware trigger or a software + * request is a pre-requisite. Using autoscan feature it is possible to start the conversion once and allow the + * sequence to repeat without any further triggers. Once all channels belonging to a scan request source have + * been converted, a request source completion event is generated. Generation of this event can restart the scan + * sequence. Every request source event will cause a load event to occur. A call to this API would configure + * the register bit field GxASMR.SCAN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanDisableContinuousMode()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanEnableContinuousMode(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanEnableContinuousMode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ASMR |= (uint32_t)VADC_G_ASMR_SCAN_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Disables continuous conversion mode.
\n + * Typically for a scan request source to generate conversion request, either a hardware trigger or a software + * request is a pre-requisite. Using autoscan feature it is possible to start the conversion once and allow the + * sequence to repeat without any further triggers. Once all channels belonging to a scan request source have + * been converted, a request source completion event is generated. Generation of this event can restart the scan + * sequence. By invoking this feature the Autoscan mode of operations is disabled. A call to this API would configure + * the register bit field GxASMR.SCAN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanEnableContinuousMode()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanDisableContinuousMode(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanDisableContinuousMode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ASMR &= ~((uint32_t)VADC_G_ASMR_SCAN_Msk); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Generates conversion request (Software initiated conversion).
\n + * A conversion request can be raised either upon detection of a hardware trigger, or by software. This API forces + * the scan unit to generate a conversion request to the analog converter. It is assumed that the scan has already + * been filled up with entries. A call to this API would configure the register bit field GxASMR.LDEV. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanTriggerConversion(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanTriggerConversion:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ASMR |= (uint32_t)VADC_G_ASMR_LDEV_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Aborts an ongoing scan sequence conversion.
\n + * An ongoing sequence can be aborted at any time. The scan unit picks the pending channels one by one from a + * pending register and requests for their conversion. This API essentially clears the channel pending register thus + * creating an illusion that there are no more channels left in the sequence. + * A call to this API would configure the registers GxASMR, GxASCTRL, GxARBPR to achieve the sequence abort. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_ScanSequenceAbort(XMC_VADC_GROUP_t *const group_ptr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num The channel meant to be added to scan sequence + *
Range: [0x0 to 0x7] + * @return + * None + * + * \parDescription:
+ * Adds a channel to the scan sequence.
\n + * Call this API to insert a new single channel into the scan request source. This will be added to the scan + * sequence. The added channel will be part of the conversion sequence when the next load event occurs. + * A call to this API would configure the register bit fields of GxASSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanAddMultipleChannels()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanAddChannelToSequence(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + XMC_ASSERT("VADC_GSCAN_AddSingleChannel:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanAddChannelToSequence:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + group_ptr->ASSEL |= (uint32_t)((uint32_t)1 << ch_num); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_mask Mask word indicating channels which form part of scan conversion sequence + * Bit location 0/1/2/3/4/5/6/7 represents channels-0/1/2/3/4/5/6/7 respectively. + * To Add the channel to the scan sequence enable the respective bit. + * Passing a 0x0 will clear all the selected channels + *
Range: [0x0 to 0xFF] + * @return + * None + * + * \parDescription:
+ * Adds multiple channels to the scan sequence.
\n + * Call this API to insert a multiple channels into the scan request source. This will be added to a scan + * sequence. The added channels will be a part of the conversion sequence when the next load event occurs. + * A call to this API would configure the register bit fields of GxASSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanAddChannelToSequence()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanAddMultipleChannels(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_mask) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanAddMultipleChannels:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ASSEL = ch_mask; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num The channel being audited for completion of conversion + *
Range: [0x0 to 0x7] + * @return + * bool returns true if the channel is pending conversion else returns false + * + * \parDescription:
+ * Determine if the channel is pending for conversion.
\n + * This API will check if the Channel in question is awaiting conversion in the current arbitration round. + * When a load event occurs the scan sequence is pushed to a pending conversion register. + * From the pending register the channels are taken up by the converter. This API would return true + * if the channel is found in the pending register (GxASPND). + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanGetNumChannelsPending()
+ */ +__STATIC_INLINE bool XMC_VADC_GROUP_ScanIsChannelPending(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + + XMC_ASSERT("XMC_VADC_GROUP_ScanIsChannelPending:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanIsChannelPending:Wrong Channel Number", ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + return( (bool)((uint32_t)(group_ptr->ASPND >> ch_num) & 1U)); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return
+ * uint32_t Returns the total channels pending for conversion. + *
Range: [0x0 to 0x8] + * + * \parDescription:
+ * Returns the total number of pending channels.
\n + * This API will read the pending channels register and will return the number of channels that are awaiting conversion. + * When a load event occurs the scan sequence is pushed to a pending conversion register. + * From the pending register the channels are taken up by the converter. When the API is called it would + * return the total number of channels pending (GxASPND). + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanIsChannelPending()
+ */ +uint32_t XMC_VADC_GROUP_ScanGetNumChannelsPending(XMC_VADC_GROUP_t *const group_ptr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Manually asserts the conversion complete request source event.
\n + * This API will set the request source event for scan. This will trigger a interrupt if the + * service node pointer for the scan has been configured. + * A call to this API would configure the register bit field GxSEFLAG.SEV1. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanTriggerReqSrcEvent(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanTriggerReqSrcEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->SEFLAG |= (uint32_t)VADC_G_SEFLAG_SEV1_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Acknowledges the scan conversion complete request source event.
\n + * This API will clear the request source event that occurred. This will clear a interrupt if it was raised. + * A call to this API would configure the register bit field GxSEFLAG.SEV1. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanTriggerReqSrcEvent()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanClearReqSrcEvent(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanClearReqSrcEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->SEFCLR |= (uint32_t)VADC_G_SEFCLR_SEV1_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * bool returns true if the service request event is raised. + * returns false if the service request event was not raised. + * + * \parDescription:
+ * Determines if the request source event is asserted.
+ * This API will get the status of the scan request source event. Will return a true + * if the event has occurred for scan. A call to this API would access the register bit field GxSEFLAG.SEV1. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE bool XMC_VADC_GROUP_ScanGetReqSrcEventStatus(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GSCAN_GetRSEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + return( (bool)(group_ptr->SEFLAG & (uint32_t)VADC_G_SEFLAG_SEV1_Msk)); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param sr Service Request Id + * @return + * None + * + * \parDescription:
+ * Connects the scan request source event to the SR line of VADC.
\n + * This API will connect a Service Request line(SR) to a scan request source event. Hence to get a interrupt on this + * Service request line one has to enable the required NVIC node. A call to this API would configure the register bit + * field GxSEVNP.SEV1NP . + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_ScanSetReqSrcEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_SR_t sr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Enables the trigger for scan request source.
\n + * By using this API, the trigger signal will be activated for the scan request source. The trigger signal and trigger + * edge will be selected from the ASCTRL register. The Selection of a input will be done by + * XMC_VADC_GROUP_ScanSelectTrigger(). A call to this API would configure the register bit field GxASMR.ENTR. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanSelectTrigger()
XMC_VADC_GROUP_ScanDisableExternalTrigger()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanEnableExternalTrigger(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanEnableExternalTrigger:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + group_ptr->ASMR |= (uint32_t)VADC_G_ASMR_ENTR_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Disables the trigger for scan request source.
+ * By using this API the trigger will be deactivated for the scan request source. + * This will just deactivate the H/W trigger for the scan request source. If any configuration were done + * to select the trigger input in GxASCTRL, it will be not be effected by this API. + * A call to this API would configure the register bit field GxASMR.ENTR. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanEnableExternalTrigger()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanDisableExternalTrigger(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanDisableExternalTrigger:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + group_ptr->ASMR &= ~((uint32_t)VADC_G_ASMR_ENTR_Msk); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param channel_num channel number to be removed from the scan sequence. + * @return + * None + * + * \parDescription:
+ * Removes a channel from the scan sequence.
+ * By using this API the it is possible to remove a single channel from the conversion sequence. + * The remaining channels will continue however they are. + * A call to this API would configure the register GxASSEL. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_ScanRemoveChannel(XMC_VADC_GROUP_t *const group_ptr, const uint32_t channel_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Enables the scan request source event .
+ * By using this API the request source event will be activated for the scan request source. + * Other configurations w.r.t service node pointer are not done in this API. + * A call to this API would configure the register bit field GxASMR.ENSI. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanDisableEvent(),
XMC_VADC_GROUP_ScanSetReqSrcEventInterruptNode()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanEnableEvent(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanEnableEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + group_ptr->ASMR |= ((uint32_t)VADC_G_ASMR_ENSI_Msk); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Disables the scan request source event .
+ * By using this API the request source event will be deactivated for the scan request source. + * Other configurations w.r.t service node pointer are not done in this API. + * A call to this API would configure the register bit field GxASMR.ENSI. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ScanEnableEvent(),
XMC_VADC_GROUP_ScanSetReqSrcEventInterruptNode()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ScanDisableEvent(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ScanDisableEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + group_ptr->ASMR &= ~((uint32_t)VADC_G_ASMR_ENSI_Msk); +} +#endif + +/** + * @param global_ptr Pointer to the VADC module + * @param config Pointer to initialization data structure + * + * \parDescription:
+ * Initializes the Background scan functional block.
\n + * The BACKGROUND SCAN request source functional block converts channels of all VADC groups that have not + * been assigned as a priority channel (priority channels can be converted only by queue and scan). Background Scan + * request source converts the unprioritized channels. Unprioritized channels however can also be used with queue + * and scan. But a channel which is prioritized can not be used with background request source. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_BackgroundEnableArbitrationSlot()
XMC_VADC_GROUP_BackgroundDisableArbitrationSlot()
+ * XMC_VADC_GLOBAL_BackgroundSelectTrigger()
XMC_VADC_GLOBAL_BackgroundSelectGating()
+ */ +void XMC_VADC_GLOBAL_BackgroundInit(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_BACKGROUND_CONFIG_t *config); + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) +/** + * @param group_ptr Constant pointer to the VADC group which may receive a + * conversion request from background request source + * + * @return + * None + * + * \parDescription:
+ * Enables arbitration slot of the Background request source.
\n + * If the Background request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the Background channel can only be converted when the arbiter + * comes to the Background slot. Thus this must be enabled if any conversion need to take place. + * A call to this API would configure the register bit field GxARBPR.ASEN2. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_BackgroundDisableArbitrationSlot()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_BackgroundEnableArbitrationSlot(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_BackgroundEnableArbitrationSlot:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ARBPR |= (uint32_t)VADC_G_ARBPR_ASEN2_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group which may receive a conversion request + * from background request source + * @return + * None + * + * \parDescription:
+ * Disables arbitration slot of the Background request source.
\n + * If the Background request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the Background channel can only be converted when the arbiter + * comes to the Background slot.A call to this API will lead to all conversions request by Background to be blocked. + * A call to this API would configure the register bit field GxARBPR.ASEN2 + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_BackgroundEnableArbitrationSlot()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_BackgroundDisableArbitrationSlot(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_BackgroundDisableArbitrationSlot:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->ARBPR &= ~((uint32_t)VADC_G_ARBPR_ASEN2_Msk); +} +#endif + +/** + * @param global_ptr Pointer to the VADC module + * @param input_num Choice of the input earmarked as a trigger line + * Accepts enum ::XMC_VADC_TRIGGER_INPUT_SELECT_t + * @return + * None + * + * \parDescription:
+ * Select Trigger signal for Background request source.
\n + * A Background request source will raise conversion request only if there were either a request from application or + * occurrence of a hardware trigger. This API selects one of the 16 input lines as a trigger line. This is + * needed when a hardware trigger is needed for the conversion of the Background request source. + * Refer to the reference manual to determine the signal that needs to be connected. + * A call to this API would configure the register bit field BRSCTRL.XTSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundSelectGating()
XMC_VADC_GLOBAL_BackgroundEnableExternalTrigger()
+ */ +void XMC_VADC_GLOBAL_BackgroundSelectTrigger(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t input_num); + + +/** + * @param global_ptr Pointer to the VADC module + * @param trigger_edge Select the trigger edge + * @return + * None + * + * \parDescription:
+ * Select Trigger edge for Background request source.
\n + * A Background request source will raise conversion request only if there were either a request from application or + * occurrence of a hardware trigger. This API selects one of the 4 possible values for the trigger edge. This is + * needed when a hardware trigger is needed for the conversion of the Background request source. + * A call to this API would configure the register bit field BRSCTRL.XTMODE. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundSelectGating()
XMC_VADC_GLOBAL_BackgroundEnableExternalTrigger()
+ */ +void XMC_VADC_GLOBAL_BackgroundSelectTriggerEdge(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_TRIGGER_EDGE_t trigger_edge); + +/** + * @param global_ptr Pointer to the VADC module + * @param input_num Module input signal meant to be selected as gating input + * Accepts enum ::XMC_VADC_GATE_INPUT_SELECT_t + * @return + * None + * + * \parDescription:
+ * Select Gating signal for Background request source.
\n + * Passage of the trigger input to the request source can be controlled via a gating signal. Any one of the 16 input + * lines can be chosen as a gating signal. Trigger signal can be given to the Background request source only + * when the gating signal's active level is detected. Additionally the GxBRSMR.ENGT has to be configured for + * the gating signal's active level. A call to this API would configure the register bit field BRSCTRL.GTSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundSelectTrigger()
+ */ +void XMC_VADC_GLOBAL_BackgroundSelectGating(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t input_num); + +/** + * @param global_ptr Pointer to the VADC module + * @param mode_sel Select how the gating is applied to the background scan request source + * @return + * None + * + * Details of function
+ * Selects the gating mode of background request source.
\n + * Passage of the trigger input to the request source can be controlled via a gating signal. + * This API determines how the gating signal behaves, either active low or active high. + * If gating signal needs to ignored XMC_VADC_GATEMODE_IGNORE should be used as the \a mode_sel. + * A call to this API would configure the register bit field BRSMR.ENGT. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundSelectGating(); + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundSetGatingMode(XMC_VADC_GLOBAL_t *const global_ptr, + XMC_VADC_GATEMODE_t mode_sel) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSetGatingMode:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSetGatingMode:Wrong mode selected", (mode_sel <= XMC_VADC_GATEMODE_ACTIVELOW)) + + /* Clear the existing gate configuration */ + global_ptr->BRSMR &= (uint32_t)(~((uint32_t)VADC_BRSMR_ENGT_Msk)); + /* Configure the new gating mode*/ + global_ptr->BRSMR |= (uint32_t)((uint32_t)mode_sel << VADC_BRSMR_ENGT_Pos); +} + + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Enables continuous conversion mode.
\n + * Typically for a Background request source to generate conversion request, either a hardware trigger or a software + * request is needed. Using autoscan (continuous conversion)feature it is possible to start the conversion + * once and allow the sequence to repeat without any further triggers. Once all channels belonging to a Background + * request source have been converted, a request source completion event is generated. Generation of this event + * can restart the Background configure sequence. Every request source event will cause a load event to occur. + * A call to this API would access the register bit field BRSMR.SCAN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_BackgroundDisableContinuousMode()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundEnableContinuousMode(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundEnableContinuousMode:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->BRSMR |= (uint32_t)VADC_BRSMR_SCAN_Msk; +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Disables continuous conversion mode.
\n + * Typically for a Background request source to generate conversion request, either a hardware trigger or a software + * request is a pre-requisite. Using autoscan feature it is possible to start the conversion once and allow the + * sequence to repeat without any further triggers. Once all channels belonging to a Background request source have + * been converted, a request source completion event is generated. Generation of this event can restart the Background + * sequence. By invoking this API the Autoscan mode of operations is disabled. A call to this API would configure the + * register bit field BRSMR.SCAN. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundEnableContinuousMode()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundDisableContinuousMode(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundDisableContinuousMode:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->BRSMR &= ~((uint32_t)VADC_BRSMR_SCAN_Msk); +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Generates conversion request (Software initiated conversion).
\n + * A conversion request can be raised either upon detection of a hardware trigger, or by software. This API forces + * the scan unit to generate a conversion request to the analog converter. It is assumed that the background scan + * has already been filled up with entries. A call to this API would set the register bit field BRSMR.LDEV. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundTriggerConversion(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundTriggerConversion:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->BRSMR |= (uint32_t)VADC_BRSMR_LDEV_Msk; +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Aborts an ongoing background scan conversion(sequence).
\n + * An ongoing sequence can be aborted at any time. The scan unit picks the pending channels one by one from a + * pending register and requests for their conversion. This API essentially clears the channel pending register thus + * creating an illusion that there are no more channels left in the sequence. + * A call to this API would configure the registers BRSMR, BRSCTRL, GxARBPR(if group is available) to abort the + * current scan sequence. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GLOBAL_BackgroundAbortSequence(XMC_VADC_GLOBAL_t *const global_ptr); + +/** + * @param global_ptr Pointer to the VADC module + * @param grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan + * Request source + * @param ch_num The unprioritized channel meant to be added to the scan sequence + *
Range: [0x0 to 0x7] + * @return + * None + * + * \parDescription:
+ * Adds a channel to the background scan sequence.
\n + * Call this API to insert a new single channel into the background scan request source. This will be added to the scan + * sequence. The added channel will be part of the conversion sequence when the next load event occurs. + * A call to this API would configure the register bit fields of BRSSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundAddMultipleChannels()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundAddChannelToSequence(XMC_VADC_GLOBAL_t *const global_ptr, + const uint32_t grp_num, + const uint32_t ch_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundAddChannelToSequence:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundAddChannelToSequence:Wrong Group Number",((grp_num) < XMC_VADC_MAXIMUM_NUM_GROUPS)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundAddChannelToSequence:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + global_ptr->BRSSEL[grp_num] |= (uint32_t)((uint32_t)1 << ch_num); +} + +/** + * @param global_ptr Pointer to the VADC module + * @param grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan + * @param ch_mask Mask word indicating channels which form part of scan conversion sequence + * Bit location 0/1/2/3/4/5/6/7 represents channels-0/1/2/3/4/5/6/7 respectively. + * To Add the channel to the scan sequence enable the respective bit. + * Passing a 0x0 will clear all the previously selected channels + *
Range: [0x0 to 0xFF] + * @return + * None + * + * \parDescription:
+ * Adds multiple channels to the scan sequence.
\n + * Call this API to insert a multiple channels into the scan request source. This will be added to a scan + * sequence. The added channels will be a part of the conversion sequence when the next load event occurs. + * A call to this API would configure the register bit fields of BRSSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundAddChannelToSequence()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgndAddMultipleChannels(XMC_VADC_GLOBAL_t *const global_ptr, + const uint32_t grp_num, + const uint32_t ch_mask) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgndAddMultipleChannels:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgndAddMultipleChannels:Wrong Group Number", ((grp_num) < XMC_VADC_MAXIMUM_NUM_GROUPS)) + global_ptr->BRSSEL[grp_num] |= ch_mask; +} + +/** + * @param global_ptr Pointer to the VADC module + * @param grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan + * Request source + * @param ch_num The unprioritized channel meant to be added to the scan sequence + *
Range: [0x0 to 0x7] + * @return + * None + * + * \parDescription:
+ * Removes a channel to the background scan sequence.
\n + * Call this API to insert a new single channel into the background scan request source. This will be added to the scan + * sequence. The added channel will be part of the conversion sequence when the next load event occurs. + * A call to this API would configure the register bit fields of BRSSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundAddChannelToSequence()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundRemoveChannelFromSequence(XMC_VADC_GLOBAL_t *const global_ptr, + const uint32_t grp_num, + const uint32_t ch_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundAddChannelToSequence:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundAddChannelToSequence:Wrong Group Number",((grp_num) < XMC_VADC_MAXIMUM_NUM_GROUPS)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundAddChannelToSequence:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + global_ptr->BRSSEL[grp_num] &= (uint32_t)~((uint32_t)1 << ch_num); +} + +/** + * @param global_ptr Pointer to the VADC module + * @param grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan + * @param ch_mask Mask word indicating channels which form part of scan conversion sequence + * Bit location 0/1/2/3/4/5/6/7 represents channels-0/1/2/3/4/5/6/7 respectively. + * To Add the channel to the scan sequence enable the respective bit. + * Passing a 0x0 will clear all the previously selected channels + *
Range: [0x0 to 0xFF] + * @return + * None + * + * \parDescription:
+ * Removes multiple channels to the scan sequence.
\n + * Call this API to insert a multiple channels into the scan request source. This will be added to a scan + * sequence. The added channels will be a part of the conversion sequence when the next load event occurs. + * A call to this API would configure the register bit fields of BRSSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundAddChannelToSequence()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgndRemoveMultipleChannels(XMC_VADC_GLOBAL_t *const global_ptr, + const uint32_t grp_num, + const uint32_t ch_mask) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgndAddMultipleChannels:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgndAddMultipleChannels:Wrong Group Number", ((grp_num) < XMC_VADC_MAXIMUM_NUM_GROUPS)) + global_ptr->BRSSEL[grp_num] &= (uint32_t)~ch_mask; +} + +/** + * @param global_ptr Pointer to the VADC module + * @param grp_num ID of the VADC group whose unprioritized channels have been assigned to background scan RS + * @param ch_num The channel being audited for completion of conversion + *
Range: [0x0 to 0x7] + * @return + * bool returns true if the channel is pending conversion else returns false + * + * \parDescription:
+ * Determine if the channel is pending.
\n + * This API will check if the Channel in question is awaiting conversion in the current arbitration round. + * When a load event occurs the scan sequence is pushed to a pending conversion register. + * From the pending register the channels are taken up by the converter. This API would return true + * if the channel is found in the pending register (BRSPND[\b grp_num]). + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundGetNumChannelsPending()
+ */ +__STATIC_INLINE bool XMC_VADC_GLOBAL_BackgroundIsChannelPending(XMC_VADC_GLOBAL_t *const global_ptr, + const uint32_t grp_num, + const uint32_t ch_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundIsChannelPending:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundIsChannelPending:Wrong Group Number", ((grp_num) < XMC_VADC_MAXIMUM_NUM_GROUPS)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundIsChannelPending:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + return( (bool)(global_ptr->BRSPND[grp_num] & (uint32_t)((uint32_t)1 << ch_num))); +} + +/** + * @param global_ptr Pointer to the VADC module + * @return
+ * uint32_t Returns the total channels pending for conversion. + *
Range: [0x0 to (0x8*number of groups)] + * + * \parDescription:
+ * Returns the number of pending channels.
\n + * This API will read the pending channels register and will return the number of channels that are awaiting conversion. + * When a load event occurs the scan sequence is pushed to a pending conversion register. + * From the pending register the channels are taken up by the converter. When the API is called it would + * return the total number of channels pending (BRSPND[\b grp_num]). + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundIsChannelPending()
+ */ +uint32_t XMC_VADC_GLOBAL_BackgroundGetNumChannelsPending(XMC_VADC_GLOBAL_t *const global_ptr); + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Manually asserts the conversion complete request source event.
\n + * This API will set the request source event for background scan. This will trigger a interrupt if the + * service node pointer for the scan has been configured. + * A call to this API would configure the register bit field GLOBEFLAG.SEVGLB. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundTriggerReqSrcEvent(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundTriggerReqSrcEvent:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->GLOBEFLAG |= (uint32_t)VADC_GLOBEFLAG_SEVGLB_Msk; +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Acknowledges the background scan conversion complete request source event.
\n + * This API will clear the request source event that occurred. This will clear a interrupt if it was raised. + * A call to this API would configure the register bit field GLOBEFLAG.SEVGLB + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundTriggerReqSrcEvent()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundClearReqSrcEvent(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundClearReqSrcEvent:Wrong Module Pointer", (global_ptr == VADC)) + global_ptr->GLOBEFLAG |= (uint32_t)VADC_GLOBEFLAG_SEVGLBCLR_Msk; +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * bool returns true if the service request event is raised. + * returns false if the service request event was not raised. + * + * \parDescription:
+ * Determines if the request source event is asserted.
+ * This API will get the status of the background scan request source event. Will return a true + * if the event has occurred for background scan. A call to this API would configure the register + * bit field GLOBEFLAG.SEVGLB. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE bool XMC_VADC_GLOBAL_BackgroundGetReqSrcEventStatus(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundGetReqSrcEventStatus:Wrong Module Pointer", (global_ptr == VADC)) + return((bool)(global_ptr->GLOBEFLAG & (uint32_t)VADC_GLOBEFLAG_SEVGLB_Msk)); +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Enables the trigger for background scan request source.
\n + * By using this API the trigger will be activated for the scan request source. The trigger signal and trigger + * edge will be selected from the BRSCTRL register. The Selection of a input will be done by + * XMC_VADC_GLOBAL_BackgroundSelectTrigger(). A call to this API would configure the register bit field BRSMR.ENTR. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundSelectTrigger()
XMC_VADC_GLOBAL_BackgroundDisableExternalTrigger()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundEnableExternalTrigger(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundEnableExternalTrigger:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->BRSMR |= (uint32_t)VADC_BRSMR_ENTR_Msk; +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Disables the trigger for background scan request source.
+ * By using this API the trigger will be deactivated for the background scan request source. + * This will just deactivate the H/W trigger for the background scan request source. If any configuration was done + * to select the trigger input in BRSCTRL will be not be effected. A call to this API would configure the register + * bit field BRSMR.ENTR. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundEnableExternalTrigger()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundDisableExternalTrigger(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundDisableExternalTrigger:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->BRSMR &= ~((uint32_t)VADC_BRSMR_ENTR_Msk); +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Enables the background scan request source event .
+ * By using this API the request source event will be activated for the background scan request source. + * Other configurations w.r.t service node pointer are not done in this API. + * A call to this API would configure the register bit field BRSMR.ENSI. + * + * \parRelated APIs:
+ * XMC_VADC_GLOBAL_BackgroundEnableEvent(),
XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundEnableEvent(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundEnableEvent:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->BRSMR |= ((uint32_t)VADC_BRSMR_ENSI_Msk); +} + +/** + * @param global_ptr Pointer to the VADC module + * @return + * None + * + * \parDescription:
+ * Disables the background scan request source event .
+ * By using this API the request source event will be deactivated for the background scan request source. + * Other configurations w.r.t service node pointer are not done in this API. + * A call to this API would configure the register bit field BRSMR.ENSI. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_BackgroundEnableEvent(),
XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode()
+ */ +__STATIC_INLINE void XMC_VADC_GLOBAL_BackgroundDisableEvent(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundDisableEvent:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->BRSMR &= ~((uint32_t)VADC_BRSMR_ENSI_Msk); +} + +#if (XMC_VADC_QUEUE_AVAILABLE == 1U) +/** + * @param group_ptr Pointer to the VADC group + * @param config Pointer to initialization data structure + * @return + * None + * + * \parDescription:
+ * Initializes VADC QUEUE functional block.
\n + * The QUEUE request source functional block converts channels stored in a queue. The first channel entered into the + * queue is converted first. A channel once converted, can be placed back into the queue if desired(refill). + * A call to this API will first disable the arbitration slot for queue (XMC_VADC_GROUP_QueueEnableArbitrationSlot()) + * and then it would configure all the related registers with the required configuration values. + * The arbitration slot is re-enabled at the end of init by invoking XMC_VADC_GROUP_QueueDisableArbitrationSlot(). + * A call to this API would configure the registers GxARBPR, GxQCTRL0, GxQMR0 to configure the queue request + * source. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueEnableArbitrationSlot()
XMC_VADC_GROUP_QueueDisableArbitrationSlot()
+ * XMC_VADC_GROUP_QueueSelectTrigger()
XMC_VADC_GROUP_QueueSelectGating()
+ */ +void XMC_VADC_GROUP_QueueInit(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_QUEUE_CONFIG_t *config); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Enables arbitration slot of the queue request source.
\n + * If the QUEUE request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the queue channel can only be converted when the arbiter comes + * to the queue slot. Thus this must be enabled if any conversion need to take place. + * A call to this API would configure the register bit field GxARBPR.ASEN0. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueDisableArbitrationSlot()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueEnableArbitrationSlot(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueEnableArbitrationSlot:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)); + group_ptr->ARBPR |= (uint32_t)((uint32_t)1 << VADC_G_ARBPR_ASEN0_Pos); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Disables arbitration slot of the queue request source.
\n + * If the QUEUE request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the queue channel can only be converted when the arbiter comes + * to the queue slot.A call to this API will lead to all conversions request by queue to be blocked. + * A call to this API would configure the register bit field GxARBPR.ASEN0. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueEnableArbitrationSlot()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueDisableArbitrationSlot(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueDisableArbitrationSlot:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)); + group_ptr->ARBPR &= ~((uint32_t)VADC_G_ARBPR_ASEN0_Msk); +} + + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * bool returns true if the arbitration is enabled else returns false. + * + * \parDescription:
+ * Returns the arbitration status of the queue request source.
\n + * If the queue request source must have its conversion request considered by the arbiter, it must participate in + * the arbitration rounds. Even if a load event occurs the queue channel can only be converted when the arbiter comes + * to the queue slot. A call to this API would return the status of the arbitration slot of queue. + * A call to this API would read the register bit field GxARBPR.ASEN1. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueEnableArbitrationSlot(),
XMC_VADC_GROUP_QueueDisableArbitrationSlot()
+ */ +__STATIC_INLINE bool XMC_VADC_GROUP_QueueIsArbitrationSlotEnabled(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueIsArbitrationSlotEnabled:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + return ((group_ptr->ARBPR & (uint32_t)VADC_G_ARBPR_ASEN0_Msk) >> VADC_G_ARBPR_ASEN0_Pos); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param input_num Choice of the input earmarked as a trigger line + * @return + * None + * + * \parDescription:
+ * Select Trigger signal for queue request source.
\n + * A queue request source will raise conversion request only if there were either a request from application or + * occurrence of a hardware trigger. This API selects one of the 16 input lines as a trigger line. This is + * needed when a hardware trigger is needed for the conversion of the queue request source. + * Refer to the reference manual to determine the signal that needs to be connected. + * A call to this API would configure the register bit field GxQCTRL0.XTSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueSelectGating()
XMC_VADC_GROUP_QueueEnableExternalTrigger()
+ */ +void XMC_VADC_GROUP_QueueSelectTrigger(XMC_VADC_GROUP_t *const group_ptr, + const XMC_VADC_TRIGGER_INPUT_SELECT_t input_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param trigger_edge Choice of the trigger edge + * @return + * None + * + * \parDescription:
+ * Select Trigger signal edge for queue request source.
\n + * A queue request source will raise conversion request only if there were either a request from application or + * occurrence of a hardware trigger. This API selects one of the 4 trigger edges. This is + * needed when a hardware trigger is needed for the conversion of the queue request source. + * Refer to the reference manual to determine the signal that needs to be connected. + * A call to this API would configure the register bit field GxQCTRL0.XTMODE. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueSelectGating()
XMC_VADC_GROUP_QueueEnableExternalTrigger()
+ */ +void XMC_VADC_GROUP_QueueSelectTriggerEdge(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_TRIGGER_EDGE_t trigger_edge); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param input_num Choice of the input earmarked as the gating line + * @return + * None + * + * \parDescription:
+ * Select Gating signal for queue request source.
\n + * Passage of the trigger input to the request source can be controlled via a gating signal. Any one of the 16 input + * lines can be chosen as a gating signal. Trigger signal can be given to the queue request source only + * when the gating signal's active level is detected. Additionally the GxQMR0.ENGT has to be configured for + * the gating signal's active level. A call to this API would configure the register bit field GxQCTRL0.GTSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueSelectTrigger()
+ */ +void XMC_VADC_GROUP_QueueSelectGating(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GATE_INPUT_SELECT_t input_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param mode_sel Select how the gating is applied to the queue request source + * @return + * None + * + * Details of function
+ * Selects the gating mode of queue request source.
\n + * Passage of the trigger input to the request source can be controlled via a gating signal. + * This API determines how the gating signal behaves, either active low or active high. + * If gating signal needs to ignored XMC_VADC_GATEMODE_IGNORE should be used as the \a mode_sel. + * A call to this API would configure the register bit field GxQMR0.ENGT. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueSelectGating(); + */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueSetGatingMode(XMC_VADC_GROUP_t *const group_ptr, XMC_VADC_GATEMODE_t mode_sel) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueSetGatingMode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_QueueSetGatingMode:Wrong mode selected", (mode_sel <= XMC_VADC_GATEMODE_ACTIVELOW)) + + /* Clear the existing gate configuration */ + group_ptr->QMR0 &= (uint32_t)(~((uint32_t) VADC_G_QMR0_ENGT_Msk)); + /* Set the new gating mode */ + group_ptr->QMR0 |= (uint32_t)((uint32_t)mode_sel << VADC_G_QMR0_ENGT_Pos); +} + + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Generates conversion request (Software initiated conversion).
+ * A conversion request can be raised either upon detection of a hardware trigger, or by software. This API forces + * the queue unit to generate a conversion request to the analog converter. It is assumed that the queue has already + * been filled up with entries. A call to this API would configure the register bit field GxQMR0.TREV. + * + * \parNote:
+ * The conversion of queue entry will start immediately after the entry has been loaded into GxQINR0. + * This happens only if the queue entry has been loaded into the register without the need for the H/W trigger.\n + * If a H/W Trigger is selected while loading the entry, the conversion will occur in one of the 2 ways: + *
    + *
  • The H/W generates a trigger needed for the queue request source. + *
  • The Conversion is triggered manually by calling this API. + *
+ * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueInsertChannel()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueTriggerConversion(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueTriggerConversion:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->QMR0 |= (uint32_t)((uint32_t)1 << VADC_G_QMR0_TREV_Pos); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * uint32_t returns the total number of channels. + *
Range: [0x0 to 0x8] + * + * \parDescription:
+ * Returns the number of channels present in the queue.
\n + * This API will return the queue buffer size. This buffer will be consisting of valid queue entries which + * will be converted when a trigger event occurs. All the entries that are loaded onto the GxQINR0 will + * be added to the queue buffer. Hence if an application needs to get the number of valid queue entries + * this API would provide the interface. A call to this API would access the registers GxQBUR0, GxQSR0 in order + * to determine the queue length. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueInsertChannel()
+ */ +uint32_t XMC_VADC_GROUP_QueueGetLength(XMC_VADC_GROUP_t *const group_ptr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Aborts an ongoing conversion by flushing the queue.
\n + * This API will flush the queue buffer. Ongoing conversion of the Queue request source will + * not be effected by this API. This would clear all the contents that are present in the queue buffer. + * A call to this API would configure the registers GxQCTRL0, GxQMR0, GxARBPR in order to abort + * the queue sequence. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueRemoveChannel()
XMC_VADC_GROUP_QueueFlushEntries()
+ */ +void XMC_VADC_GROUP_QueueAbortSequence(XMC_VADC_GROUP_t *const group_ptr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Flushing the queue Entry.
\n + * This API will flush one entry in the queue buffer. Ongoing conversion of the Queue request source will + * not be effected by this API. This would clear all the contents that are present in the queue buffer. + * A call to this API would configure the registers GxQMR0. This is a Blocking API, i.e will only exit when + * all the entries are removed from the queue. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueRemoveChannel()
XMC_VADC_GROUP_QueueAbortSequence(0
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueFlushEntries(XMC_VADC_GROUP_t *const group_ptr) +{ + /* Initiate flushing of the queue */ + group_ptr->QMR0 |= (uint32_t)VADC_G_QMR0_FLUSH_Msk; + + while( !((group_ptr->QSR0)& (uint32_t)VADC_G_QSR0_EMPTY_Msk)) + { + /* Wait until the queue is indeed flushed */ + } +} + + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Clears the next valid channel in the queue buffer.
\n + * A queue entry lined up for conversion can be removed and replaced by its successor. The call to this API will + * first check if a valid queue entry is present in the queue backup register if present would clear its valid flag. + * If no valid queue entries are present in the backup then the first channel + * present in the queue buffer would be cleared. + * A call to this API would configure the registers GxQCTRL0, GxQMR0, GxARBPR in order to clear a + * channel from the queue. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueInsertChannel()
+ */ +void XMC_VADC_GROUP_QueueRemoveChannel(XMC_VADC_GROUP_t *const group_ptr); + +/** + * + * @param group_ptr Constant pointer to the VADC group + * @param entry Details of the node being added + * @return + * None + * + * \parDescription:
+ * Inserts a queue entry to the tail of the queue buffer.
\n + * This API will insert a new channel into the queue buffer. The Queue will start conversion of + * the channels from the head of the buffer. This Insert will place the entry after the last valid entry. + * If no valid entries are present then this API will place the Queue entry at the head of the buffer. + * Then the successive call to the insert will place the new entry after the last entry. + * A call to this API would configure the register GxQINR0 for a single queue entry. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueRemoveChannel()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueInsertChannel(XMC_VADC_GROUP_t *const group_ptr, + const XMC_VADC_QUEUE_ENTRY_t entry) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueInsertChannel:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + /* Insert the channel physically and get the length of the queue*/ + group_ptr->QINR0 = entry.qinr0; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * int32_t Returns -1 if there are no channels for conversion + * Else would return the next valid channel for conversion. + *
Range: [0x0 to 0x8] + * + * \parDescription:
+ * Returns the next entry in the queue request source for conversion.
\n + * Identifies the channel in the queue lined up for conversion next. + * API will return a valid queue entry from the queue buffer. First checks for the valid channel entry + * in the backup register and returns if present. If the valid entry has not been found in the backup register + * then the queue buffer is searched for a valid entry. A call to this API would access the registers GxQ0R0, + * GxQBUR0 to determine the next channel. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueRemoveChannel()
XMC_VADC_GROUP_QueueInsertChannel()
+ */ +int32_t XMC_VADC_GROUP_QueueGetNextChannel(XMC_VADC_GROUP_t *const group_ptr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * int32_t Returns -1 if there is no channel that have been interrupted. + * Else would return the channel that is interrupted. + *
Range: [0x0 to 0x8] + * + * \parDescription:
+ * Identifies the channel whose conversion was suspended.
\n + * When using cancel inject repeat mode the canceled conversion will be placed in the backup register. + * This API will return the valid queue channel number from the backup register. This happens when ever + * there is a high priority conversion interrupts the conversion of queue request source. This forces the channel + * to goto the backup register. A call to this API would access the register GxQBUR0 to determine the + * interrupted channel. + * + * \parRelated APIs:
+ * None. + */ +int32_t XMC_VADC_GROUP_QueueGetInterruptedChannel(XMC_VADC_GROUP_t *const group_ptr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Manually asserts the conversion complete request source event.
\n + * This API will set the request source event for queue. This will trigger a interrupt if the + * service node pointer for the scan has been configured. + * A call to this API would configure the register bit field GxSEFLAG.SEV0. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueClearReqSrcEvent()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueTriggerReqSrcEvent(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueTriggerReqSrcEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->SEFLAG |= 1U; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Acknowledges the conversion complete request source event.
\n + * This API will clear the request source event that occurred. This will clear a interrupt if it was raised. + * A call to this API would configure the register bit field GxSEFCLR.SEV0. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueTriggerReqSrcEvent()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueClearReqSrcEvent(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueClearReqSrcEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->SEFCLR = (uint32_t)VADC_G_SEFCLR_SEV0_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * bool returns true if the service request event is raised. + * returns false if the service request event was not raised. + * + * \parDescription:
+ * Determines if the request source event is asserted.
+ * This API will get the status of the queue request source event. Will return a true + * if the event has occurred for queue. A call to this API would acces the register bit field GxSEFLAG.SEV0. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE bool XMC_VADC_GROUP_QueueGetReqSrcEventStatus(XMC_VADC_GROUP_t *const group_ptr) +{ + + XMC_ASSERT("XMC_VADC_GROUP_QueueGetReqSrcEventStatus:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + return(group_ptr->SEFLAG & (uint32_t)VADC_G_SEFLAG_SEV0_Msk); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param sr The service request line (Common SR lines, Group specific SR lines) + * @return + * None + * + * \parDescription:
+ * Connects the event to the SR line of VADC.
\n + * This API will connect a Service Request line(SR) to a queue request source event. Hence to get a interrupt on this + * Service request line one has to enable the required NVIC node. A call to this API would configure the register + * bit field GxSEVNP.SEVNP0. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_QueueSetReqSrcEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_SR_t sr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Enables the trigger for queue request source.
\n + * By using this API the trigger will be activated for the queue request source. The trigger signal and trigger + * edge will be selected from the QCTRL register. The Selection of a input will be done by + * XMC_VADC_GROUP_QueueSelectTrigger(). A call to this API would configure the register bit field GxQMR0.ENTR + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueSelectTrigger()
XMC_VADC_GROUP_QueueDisableExternalTrigger()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueEnableExternalTrigger(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueEnableExternalTrigger:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + group_ptr->QMR0 |= (uint32_t)VADC_G_QMR0_ENTR_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Disables the trigger for queue request source.
+ * By using this API the trigger will be deactivated for the queue request source. + * This will just deactivate the H/W trigger for the queue request source. If any configuration was done + * to select the trigger input in GxQCTRL0 will be not be effected. A call to this API would configure the + * register bit field GxQMR0.ENTR + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_QueueEnableExternalTrigger()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_QueueDisableExternalTrigger(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_QueueDisableExternalTrigger:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + group_ptr->QMR0 &= ~((uint32_t)VADC_G_QMR0_ENTR_Msk); +} +#endif + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num The channel being initialized + *
Range: [0x0 to 0x7] + * @param config Pointer to initialization data + * @return + * None + * + * \parDescription:
+ * Initializes the ADC channel for conversion.
\n + * This API will do the channel related initializations. This includes configuration of the CHCTR settings + * and boundary flag settings. This must be called in the application in order to enable the conversion of + * a channel. After a request source has been initialized this API has to be called for each channel that + * has to be converted. A call to this API would configure the registers GxCHCTR GxBFL GxALIAS GxCHASS + * GxBFLC(depending on device) in order to configure the channel. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_ChannelInit(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num, + const XMC_VADC_CHANNEL_CONFIG_t *config); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param src_ch_num Channel which will be converted by \b alias_ch_num, when called by the request source. + *
Range:[0x0 to 0x7] + * @param alias_ch_num This is the alias channel (Ch-0 or Ch-1) + *
Range:[0x0, 0x1] + * @return + * None + * + * \parDescription:
+ * Sets the Alias channel(\b alias_ch_num) to convert from the source channel(\b src_ch_num).
\n + * When a alias configuration takes place the request source(queue/scan/background) will not call channel \b src_ch_num. + * The Request sources will call the channel \b alias_ch_num , this would invoke the conversion of + * the pin associated with \b src_ch_num. The configuration of the alias channel (\b alias_ch_num) will be used + * for the conversion.\n + * When an alias channel (Ch-0 or Ch-1) receives a trigger, it converts the aliased channel (\b src_ch_num). + * The properties of Ch-0 or Ch-1 (as indicated in \b alias_ch_num ) apply when \b src_ch_num is converted. + * A call to this API would configure the register GxALIAS. + * + * \parNote:
+ * Alias Channel (\b alias_ch_num) and the source channel (\b src_ch_num) cannot be the same. + * If they are, that alias feature is not used for the conversion. In order to Reset the alias + * feature that was previously selected this method can be used. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_SetChannelAlias(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t src_ch_num, + const uint32_t alias_ch_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose input was converted + *
Range: [0x0 to 0x7] + * @return + * bool Returns true if there was violation w.r.t the specified boundaries. + * + * \parDescription:
+ * Determines if the result of the channel confines with the specified boundaries.
\n + * An application may not necessarily always need to know the exact value of the converted result, but merely + * an indication if the generated result is within stipulated boundaries. Generation of Channel event can be subject + * to channel event generation criteria (Generate always, Never generate, Generate if result is out of bounds, + * Generate if result is within bounds). When interrupts are not enabled, this API can be used to determine the + * nature of the result. A call to this API would access the registers GxCHCTR and GxCEFLAG in order to determine + * if a violation has occured. + * + * \parRelated APIs:
+ * None + */ +bool XMC_VADC_GROUP_ChannelIsResultOutOfBounds(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose input is to be converted + *
Range: [0x0 to 0x7] + * @param ref Reference voltage + * @return + * None + * + * \parDescription:
+ * Selects the reference voltage for conversion.
\n + * An internal voltage reference (VARef) or an external voltage reference fed to Ch-0 can serve as a voltage reference + * for conversions. A call to this API would configure the register bit field GxCHCTR.REFSEL. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_ChannelSetInputReference(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num, + const XMC_VADC_CHANNEL_REF_t ref); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose i/p is to be converted + *
Range: [0x0 to 0x7] + * @param result_reg_num Result Register associated with this channel + * @return + * None + * + * \parDescription:
+ * Selects the target result register.
\n + * There are upto 16 result registers which a channel can choose from to store the results of conversion. + * This selects only the group related result registers. A call to this API would configure the register + * bit field GxCHCTR.RESREG. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_ChannelSetResultRegister(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const uint32_t result_reg_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose conversion class is to be configured + *
Range: [0x0 to 0x7] + * @param conversion_class conversion property to be associated with this channel + * @return + * None + * + * \parDescription:
+ * Selects the conversion class registers.
\n + * It configures the channel to have a particular conversion class properties like sampling + * time and resolution. A call to this API would configure the register + * bit field GxCHCTR.ICLSEL. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelGetInputClass(). + */ +void XMC_VADC_GROUP_ChannelSetIclass(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const XMC_VADC_CHANNEL_CONV_t conversion_class); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose result alignment is to be returned + *
Range: [0x0 to 0x7] + * @return + * XMC_VADC_RESULT_ALIGN_LEFT if the result are aligned to the left + * XMC_VADC_RESULT_ALIGN_RIGHT if the result are aligned to the right + * + * \parDescription:
+ * Returns the channel result alignment.
\n + * The results are aligned either to the left or to the right. A left aligned 10bit resolution has its LSB + * at bit2 where as a left aligned 8bit resolution starts at bit4. A call to this API would return the currently + * configured alignment value. + * A call to this API would read the register bit field GxCHCTR.RESPOS. + * + * \parRelated APIs:
+ * None. + */ +__STATIC_INLINE XMC_VADC_RESULT_ALIGN_t XMC_VADC_GROUP_ChannelGetResultAlignment(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num) +{ + XMC_ASSERT("XMC_VADC_GROUP_ChannelGetResultAlignment:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelGetResultAlignment:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + return ((XMC_VADC_RESULT_ALIGN_t)((group_ptr->CHCTR[ch_num] & (uint32_t)VADC_G_CHCTR_RESPOS_Msk) >> + (uint32_t)VADC_G_CHCTR_RESPOS_Pos) ); +} + + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose result alignment is to be returned + *
Range: [0x0 to 0x7] + * @return + * XMC_VADC_CHANNEL_CONV_t Returns the configured input class for the \b ch_num + * + * \parDescription:
+ * Returns the channel's input class for conversion for the required channel.
\n + * The sampling time and resolution can be taken from any of the 4 possible Input class registers. + * This API would return the input class register that is taken up by \b ch_num for conversion. + * A call to this API would read the register bit field GxCHCTR.RESPOS. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelSetIclass(). + */ +__STATIC_INLINE XMC_VADC_CHANNEL_CONV_t XMC_VADC_GROUP_ChannelGetInputClass(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num) +{ + XMC_ASSERT("XMC_VADC_GROUP_ChannelGetInputClass:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelGetInputClass:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + return ((XMC_VADC_CHANNEL_CONV_t)((group_ptr->CHCTR[ch_num] & (uint32_t)VADC_G_CHCTR_ICLSEL_Msk) >> + (uint32_t)VADC_G_CHCTR_ICLSEL_Pos) ); +} + +/** + * + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose associated result register is to be found + *
Range: [0x0 to 0x7] + * @return + * uint8_t returns the Group result register to which it is linked to. + *
Range: [0x0 to 0xF] + * + * \parDescription:
+ * Returns the result register associated with this channel.
\n + * There are upto 16 result registers which a channel can choose from to store the results of conversion. + * This returns only the group related result registers. A call to this API would access the register + * bit field GxCHCTR.RESREG. + * + * \parRelated APIs:
+ * None. + */ +uint8_t XMC_VADC_GROUP_ChannelGetResultRegister(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose channel event is to be asserted + *
Range: [0x0 to 0x7] + * @return + * None + * + * \parDescription:
+ * Manually asserts a Channel event.
\n + * It is merely the channel event which is asserted. For this asserted event to lead to an interrupt, it must + * have been bound to an SR and that SR must have been enabled. It can potentially lead to an interrupt if the + * SR line is connected to an NVIC node. A call to this API would configure the register bit fields of GxCEFLAG. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelClearEvent(). + */ +void XMC_VADC_GROUP_ChannelTriggerEvent(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num); + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * uint32_t returns the asserted channel events + * + * \parDescription:
+ * Returns the Channel event flag register.
\n + * The return is merely the channel events which are asserted. + * A call to this API would read the register bit fields of GxCEFLAG. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelClearEvent(). + */ +__STATIC_INLINE uint32_t XMC_VADC_GROUP_ChannelGetAssertedEvents(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_ChannelGetAssertedEvents:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + return(group_ptr->CEFLAG); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose channel event is to be acknowledged + *
Range: [0x0 to 0x7] + * @return + * None + * + * \parDescription:
+ * Acknowledges a Channel event.
\n + * When a channel event is raised after the conversion of that channel, it has to be cleared. This API would clear + * the Channel event of a particular channel if it has occurred. A call to this API would configure the register + * bit fields of GxCEFCLR. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelTriggerEvent(). + */ +__STATIC_INLINE void XMC_VADC_GROUP_ChannelClearEvent(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + + XMC_ASSERT("XMC_VADC_GROUP_ChannelClearEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelClearEvent:Wrong Channel Number", ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + group_ptr->CEFCLR = (uint32_t)((uint32_t)1 << ch_num); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose channel event is to be connected to a service request line + *
Range: [0x0 to 0x7] + * @param sr The service request line to which the channel event is to be connected + * @return + * None + * + * \parDescription:
+ * Binds a channel event to a requested Service Request line.
\n + * The channel event is connected to a service request line. For an event to result in an interrupt, this service + * request line must be enabled in VADC and the NVIC node which this service request line is connected to must have + * interrupt generation enabled. A call to this API would configure the register bit fields of GxCEVNP0. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelTriggerEvent()
XMC_VADC_GROUP_ChannelClearEvent() + */ +void XMC_VADC_GROUP_ChannelSetEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const XMC_VADC_SR_t sr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose channel event is being configured + *
Range: [0x0 to 0x7] + * @param criteria The condition under which the channel may assert its channel event + * @return + * None + * + * \parDescription:
+ * Defines the conditions under which a channel may assert its channel event.
\n + * The channel event can be generated under the following conditions - Always, Never, Result Out of bounds and Result + * inside the boundaries. A call to this API would configure the register bit field GxCHCTR.CHEVMODE. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelTriggerEvent()
XMC_VADC_GROUP_ChannelClearEvent()
+ * XMC_VADC_GROUP_ChannelSetEventInterruptNode()
+ */ +void XMC_VADC_GROUP_ChannelTriggerEventGenCriteria(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const XMC_VADC_CHANNEL_EVGEN_t criteria); + + +/** + * @param group_ptr Constant pointer to the VADC group + * @param ch_num Channel whose channel event is being configured + *
Range: [0x0 to 0x7] + * @param boundary_sel Select the upper/lower boundary configuration . + * @param selection The boundary value selected for \b boundary_sel. + * @return + * None + * + * \parDescription:
+ * Configure the boundary selection for the given channel
\n + * The channel event can be generated under the following conditions - Always, Never, Result Out of bounds and Result + * inside the boundaries. The boundary values to which results are compared can be selected from several sources. + * A call to this API would configure the register bit field GxCHCTR.BNDSELL or GxCHCTR.BNDSELU . + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_ChannelSetBoundarySelection(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + XMC_VADC_BOUNDARY_SELECT_t boundary_sel, + XMC_VADC_CHANNEL_BOUNDARY_t selection); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg_num Result register which is intended to be initialized + *
Range: [0x0 to 0xF] + * @param config Pointer to initialization data + * @return + * None + * + * \parDescription:
+ * Initializes a Group Result Register.
+ * Various options needed for the working of the result result will be configured with this API. + * This would determine the result handling of the group registers. This API must be called after + * the channel Init (XMC_VADC_GROUP_ChannelInit())to initialize the result register that is selected for the channel. + * This API would also determine if the result register that is being configured has to a part of a FIFO buffer. + * In this API one can also configure the various result handling options line FIR/IIR filters and it order. + * Also configures the Data reduction to accumulate 2/3/4 results need to be done. This API will also configure + * the result event generation. A call to this API would configure the register GxRCR with the \b config . + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_AddResultToFifo()
XMC_VADC_GROUP_EnableResultEvent()
XMC_VADC_GROUP_DisableResultEvent()
+ */ +__STATIC_INLINE void XMC_VADC_GROUP_ResultInit(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t res_reg_num, + const XMC_VADC_RESULT_CONFIG_t *config) +{ + XMC_ASSERT("XMC_VADC_GROUP_ResultInit:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->RCR[res_reg_num] = config->g_rcr; + +} + + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Register which is required to be a part of results FIFO + *
Range: [0x0 to 0xF] + * @return + * None + * + * \parDescription:
+ * Adds result register to Result FIFO.
\n + * Sometimes, the rate of consumption of results by application software may not match the rate at which the + * results are produced. A Result FIFO thus helps a slow consumer to read out results without loss of data. + * When a result register is added to fifo, it is in fact chained to its higher numbered neighbor. For example, if + * Result Register-5 is to be added to FIFO, it gets chained to Result Register-6. Results are written to Register-6 + * while the same can be read out of Register-5 leisurely by software. + * A call to this API would configure the register bit field GxRCR.FEN. + * + * \parNote:
+ * The FIFO is always read by the software with the lowest numbered result register. + * The hardware will write the results from the highest numbered result register. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_AddResultToFifo(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register for which event generation is to be enabled + *
Range: [0x0 to 0xF] + * @return + * None + * + * \parDescription:
+ * Enables result event generation.
\n + * Once the results of conversion are available, the result event (which is being enabled in this function) + * if connected to a service request line(Group or Shared service request) can lead to an interrupt. It is therefore + * not only necessary to enable the event, but also to connect it to a service request line. The + * service request generation capability must also be enabled and so should the corresponding NVIC node. + * A call to this API would configure the register bit field GxRCR.SRGEN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_SetResultInterruptNode(). + */ +__STATIC_INLINE void XMC_VADC_GROUP_EnableResultEvent(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + + XMC_ASSERT("XMC_VADC_GROUP_EnableResultEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_EnableResultEvent:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + group_ptr->RCR[res_reg] |= (uint32_t)VADC_G_RCR_SRGEN_Msk; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register for which event generation is to be disabled + *
Range: [0x0 to 0xF] + * @return + * None + * + * \parDescription:
+ * Disable result event generation.
\n + * This would just disable the event. It would not alter anything w.r.t the SR line if it was configured. + * A call to this API would configure the register bit field GxRCR.SRGEN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_EnableResultEvent(). + */ +__STATIC_INLINE void XMC_VADC_GROUP_DisableResultEvent(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + XMC_ASSERT("XMC_VADC_GROUP_DisableResultEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_DisableResultEvent:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + group_ptr->RCR[res_reg] &= ~((uint32_t)VADC_G_RCR_SRGEN_Msk); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register from which the result of conversion is to be read out + *
Range: [0x0 to 0xF] + * @return + * uint32_t returns the complete result register GxRESy. + * + * \parDescription:
+ * Returns the result register completely (result of conversion as well as other info).
\n + * The Result register will have information regarding the channel that is requesting the conversion, + * if the result is valid, if the fast compare bit, Data Reduction Counter, and the request source information. + * All these information will be returned back. And if the user is polling for the result he can use the + * result if the valid bit is set. A call to this API would return the complete register GxRES. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_GetResult(). + */ +__STATIC_INLINE uint32_t XMC_VADC_GROUP_GetDetailedResult(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + XMC_ASSERT("XMC_VADC_GROUP_GetDetailedResult:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_GetDetailedResult:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + return(group_ptr->RES[res_reg]); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register from which the result of conversion is to be read out + *
Range: [0x0 to 0xF] + * @return + * XMC_VADC_RESULT_SIZE_t Result register values. + *
Range:[ 0x0 to 0xFFF] (Result of single conversion. Accumulated results not considered for range) + * + * \parDescription:
+ * Returns the result of the conversion.
\n + * This API will only return the result of the conversion and will strip out the other information that is present + * in the result register. A call to this API would access the register bit field GxRES.RESULT. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_GetDetailedResult(). + */ +__STATIC_INLINE XMC_VADC_RESULT_SIZE_t XMC_VADC_GROUP_GetResult(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t res_reg) +{ + XMC_ASSERT("XMC_VADC_GROUP_GetResult:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_GetResult:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + + return ((XMC_VADC_RESULT_SIZE_t)group_ptr->RES[res_reg]); +} + +/** + * + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register for which the compare value is being set + *
Range: [0x0 to 0xF] + * @param compare_val The compare value itself + *
Range: [0x0 to 0xFFF] + * @return + * None + * + * \parDescription:
+ * Configures the compare value (relevant to the Fast Compare Mode).
\n + * A channel input can be converted and its value stored in its result register. Alternatively, the channel input can + * be converted and compared against a compare value. This is the fast compare mode typically utilized by applications + * that are not interested in absolute converted value of an analog input, but rather a binary decision on how the + * input fares against a preset compare value. The channel should have had already chosen the correct ICLASS with + * the fast compare mode enabled. \b compare_val would be the compare value on which FCM bit in the result + * register will be set. The FCM bit will be set if the analog voltage is greater than the compare value. + * A call to this API would configure the register bit field GxRES.RESULT. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_GetFastCompareResult(). + */ +void XMC_VADC_GROUP_SetResultFastCompareValue(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t res_reg, + const XMC_VADC_RESULT_SIZE_t compare_val); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register for which the compare value is being set + *
Range: [0x0 to 0xF] + * @return + * ::XMC_VADC_FAST_COMPARE_t If the input is greater or lower than the compare value returns the appropriate enum. + * if the valid flag was not set then it would return XMC_VADC_FAST_COMPARE_UNKNOWN. + * + * \parDescription:
+ * Determines the input is greater/lower than the compare value.
\n + * This API determines if the input is greater/lower than the preset compare value. + * A call to this API would access the register bit field GxRES.FCM. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_SetResultFastCompareValue(). + */ +XMC_VADC_FAST_COMPARE_t XMC_VADC_GROUP_GetFastCompareResult(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg); + +/** + * + * @param group_ptr Constant pointer to the VADC group + * @param subtraction_val 12 bit subtraction value + *
Range: [0x0 to 0xFFF] + * @return + * None + * + * \parDescription:
+ * Configures the subtraction value (relevant to the Difference Mode).
\n + * A channel input can be converted and its value stored in its result register. Alternatively, the channel input can + * be converted and subtracted with the value stored in GxRES[0]. This Difference Mode typically utilized by + * applications that are not interested in absolute converted value of an analog input, but rather a difference of + * converted values. Subtraction value will always be present in the GxRES[0] and thus this API would configure + * that register. + * + * \parRelated APIs:
+ * None. + */ +void XMC_VADC_GROUP_SetResultSubtractionValue(XMC_VADC_GROUP_t *const group_ptr, + const uint16_t subtraction_val); +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register for which the result event is being asserted + *
Range: [0x0 to 0xF] + * @return + * None + * + * \parDescription:
+ * Manually asserts the result event.
\n + * The result event must necessarily be connected to a SR line. The SR in turn must have been enabled along with the + * corresponding NVIC node. Only then will the assertion of RES event lead to an interrupt. + * A call to this API would access the register bit fieldS OF GxREFLAG. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ClearResultEvent(). + */ +__STATIC_INLINE void XMC_VADC_GROUP_TriggerResultEvent(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + XMC_ASSERT("XMC_VADC_GROUP_TriggerResultEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_TriggerResultEvent:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + group_ptr->REFLAG = (uint32_t)((uint32_t)1 << res_reg); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * uint32_t returns the asserted result events + * + * \parDescription:
+ * Returns the Result event flag register.
\n + * The return is merely the result events which are asserted. + * A call to this API would read the register bit fields of GxREFLAG. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_TriggerResultEvent(). + */ +__STATIC_INLINE uint32_t XMC_VADC_GROUP_GetAssertedResultEvents(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_GetAssertedResultEvents:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + return(group_ptr->REFLAG); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register for which the result event is being acknowledged + *
Range: [0x0 to 0xF] + * @return + * None + * + * \parDescription:
+ * Acknowledges a Result event.
\n + * When a Result event is raised after the conversion of that associated channel has produced a result and + * it has to be cleared. This API would clear the Channel event of a particular channel if it has occurred. + * A call to this API would access the register bit fields of GxREFCLR. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_ChannelTriggerEvent(). + */ +__STATIC_INLINE void XMC_VADC_GROUP_ClearResultEvent(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + XMC_ASSERT("XMC_VADC_GROUP_ClearResultEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ClearResultEvent:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + group_ptr->REFCLR = (uint32_t)((uint32_t)1 << res_reg); +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register for which the result event is being asserted + *
Range: [0x0 to 0xF] + * @param sr The SR line to which the result event must be connected + * @return + * None + * + * \parDescription:
+ * Binds a result event to a requested Service Request line.
\n + * The result event is connected to a service request line. For an event to result in an interrupt, this service + * request line must be enabled in VADC and the NVIC node which this service request line is connected to must have + * interrupt generation enabled. A call to this API would access the registers GxREVNP0 GxREVNP1. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_TriggerResultEvent()
XMC_VADC_GROUP_ClearResultEvent() + */ +void XMC_VADC_GROUP_SetResultInterruptNode(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t res_reg, + const XMC_VADC_SR_t sr); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register which forms a part of FIFO + *
Range: [0x0 to 0xF] + * @return + * uint32_t returns the Result register number which is the tail of the FIFO,\b res_reg is apart of this FIFO. + * + * \parDescription:
+ * Returns the the FIFO tail (register from where to read the results).
\n + * The analog converter writes to the head of the FIFO. It is the head of the FIFO which is bound to the channel. + * Applications read the result from the tail of the FIFO. This API would return the result + * register from where a user can call the API XMC_VADC_GROUP_GetResult() to read the result stored in the FIFO. + * A call to this API would access the register bit field GxRCR.FEN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_GetResultFifoHead()
+ */ +uint32_t XMC_VADC_GROUP_GetResultFifoTail(XMC_VADC_GROUP_t *const group_ptr, uint32_t res_reg); + +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register which forms a part of fifo + *
Range: [0x0 to 0xF] + * @return + * uint32_t returns the Result register number which is the head of the FIFO,\b res_reg is apart of this FIFO. + * + * \parDescription:
+ * Returns the the FIFO head (register to which the results are written by H/W).
\n + * The analog converter writes to the head of the FIFO. It is the head of the FIFO which is bound to the channel. + * Applications read the result from the tail of the FIFO. This API would just return the head of the FIFO + * from where the results are being added to the FIFO. + * A call to this API would access the register bit field GxRCR.FEN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_GetResultFifoHead()
+ */ +uint32_t XMC_VADC_GROUP_GetResultFifoHead(XMC_VADC_GROUP_t *const group_ptr,const uint32_t res_reg); + +/** + * + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register in question + *
Range: [0x0 to 0xF] + * @return + * bool returns true if the \b res_reg is the FIFO head. + * + * \parDescription:
+ * Determines if the requested register is the head of a FIFO.
\n + * The analog converter writes to the head of the FIFO. It is the head of the FIFO which is bound to the channel. + * Applications read the result from the tail of the FIFO. + * A call to this API would access the register bit field GxRCR.FEN. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_GetResultFifoHead()
+ */ +bool XMC_VADC_GROUP_IsResultRegisterFifoHead(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg); + +/** + * + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Register number
+ *
Range: [0x0 to 0xF] + * @return + * bool returns true if the \b res_reg is the FIFO member, else false. + * + * \parDescription:
+ * Determines whether the specified register is a FIFO member or not.
\n + * The analog converter writes to the head of the FIFO. It is the head of the FIFO which is bound to the channel. + * Applications read the result from the tail of the FIFO. + * A call to this API would access the register bit field GxRCR.FEN. + * + */ +__STATIC_INLINE bool XMC_VADC_GROUP_IsResultRegisterInFifo(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t res_reg) +{ + + XMC_ASSERT("XMC_VADC_GROUP_IsResultRegisterInFifo:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_IsResultRegisterInFifo:Wrong Result Register", + ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + return( (bool)(group_ptr->RCR[res_reg] & (uint32_t)VADC_G_RCR_FEN_Msk)); +} + +#if XMC_VADC_RESULT_PRIORITY_AVAILABLE == 1U +/** + * @param group_ptr Constant pointer to the VADC group + * @param res_reg Result Registers which need to be set for priority conversions + * Bit location 0..15 represents Result Register-0..15 respectively. + * To add the result register as priority. + * Passing a 0x0 will clear all the selected channels + *
Range: [0x0 to 0xFFFF] + * @return + * None + * + * \parDescription:
+ * Prioritize a Result register for group conversions.
\n + * Applications that need to reserve certain result registers only for Queue and scan request sources should + * use this API. A call to this API would access the register bit fields of GxRRASS. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_GetResultRegPriority(). + */ +__STATIC_INLINE void XMC_VADC_GROUP_SetResultRegPriority(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_mask) +{ + XMC_ASSERT("XMC_VADC_GROUP_SetResultRegPriority:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + group_ptr->RRASS = (uint32_t)res_mask; +} + +/** + * @param group_ptr Constant pointer to the VADC group + * @return + * None + * + * \parDescription:
+ * Get the priority of all Result register.
\n + * A call to this API would access the register bit fields of GxRRASS. + * + * \parRelated APIs:
+ * XMC_VADC_GROUP_SetResultRegPriority(). + */ +__STATIC_INLINE uint32_t XMC_VADC_GROUP_GetResultRegPriority(XMC_VADC_GROUP_t *const group_ptr) +{ + XMC_ASSERT("XMC_VADC_GROUP_GetResultRegPriority:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + return(group_ptr->RRASS); +} +#endif +#endif + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_vadc_map.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_vadc_map.h new file mode 100644 index 00000000..865f6688 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_vadc_map.h @@ -0,0 +1,293 @@ +/** + * @file xmc_vadc_map.h + * @date 2016-11-17 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-15: + * - Initial version + * + * 2015-12-01: + * - Added: + * - XMC4300 device supported + * + * - Fixed: + * - Wrong MACRO name corrected for XMC4200/4100 devices. + * XMC_VADC_G3_SAMPLE renamed to XMC_VADC_G1_SAMPLE + * + * 2016-11-17: + * - Fixed: Add missing support for XMC47000 + * - Fixed: Renamed XMC_CCU_41_ST2 to XMC_CCU_41_ST3 + * - Added: New macros equivalent to th existing ones but with better naming. + * Old macros are kept for backward compatibility but they deprecated. + * - Added: ECAT support for XMC48/43 + * + * @endcond + * + */ + +#ifndef XMC_ADC_MAP_H +#define XMC_ADC_MAP_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************************************************************************************************************** + * MACROS + *********************************************************************************************************************/ +#if ( UC_FAMILY == XMC1 ) + +/* Group request source Gating input connection mappings */ +#define XMC_CCU_40_ST3 XMC_VADC_REQ_GT_A /**< @deprecated use instead XMC_VADC_REQ_GT_CCU40_ST3 */ +#define XMC_CCU_40_ST2 XMC_VADC_REQ_GT_B /**< @deprecated use instead XMC_VADC_REQ_GT_CCU40_ST2 */ +#define XMC_CCU_40_ST1 XMC_VADC_REQ_GT_C /**< @deprecated use instead XMC_VADC_REQ_GT_CCU40_ST1 */ +#define XMC_CCU_40_ST0 XMC_VADC_REQ_GT_D /**< @deprecated use instead XMC_VADC_REQ_GT_CCU40_ST0 */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_CCU_80_ST3_A XMC_VADC_REQ_GT_E /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_ST3A */ +#define XMC_CCU_81_ST3 XMC_VADC_REQ_GT_F /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_ST3 */ +#endif +#if (UC_SERIES != XMC13 && UC_SERIES != XMC11) +#define XMC_LEDTS0_FN XMC_VADC_REQ_GT_I /**< @deprecated use instead XMC_VADC_REQ_GT_LEDTS0_FN */ +#define XMC_LEDTS1_FN XMC_VADC_REQ_GT_J /**< @deprecated use instead XMC_VADC_REQ_GT_LEDTS1_FN */ +#endif +#define XMC_ERU_0_PDOUT2 XMC_VADC_REQ_GT_K /**< @deprecated use instead XMC_VADC_REQ_GT_ERU0_PDOUT2 */ +#define XMC_ERU_0_PDOUT3 XMC_VADC_REQ_GT_L /**< @deprecated use instead XMC_VADC_REQ_GT_ERU0_PDOUT3 */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_CCU_80_ST0 XMC_VADC_REQ_GT_M /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_ST0 */ +#define XMC_CCU_80_ST1 XMC_VADC_REQ_GT_N /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_ST1 */ +#endif +#define XMC_ERU_0_PDOUT0 XMC_VADC_REQ_GT_O /**< @deprecated use instead XMC_VADC_REQ_GT_ERU0_PDOUT0 */ +#define XMC_ERU_0_PDOUT1 XMC_VADC_REQ_GT_P /**< @deprecated use instead XMC_VADC_REQ_GT_ERU0_PDOUT1 */ + +/* Group request source Trigger input connection mappings */ +#define XMC_CCU_40_SR2 XMC_VADC_REQ_TR_A /**< @deprecated use instead XMC_VADC_REQ_TR_CCU40_SR2 */ +#define XMC_CCU_40_SR3 XMC_VADC_REQ_TR_B /**< @deprecated use instead XMC_VADC_REQ_TR_CCU40_SR3 */ +#if (UC_SERIES != XMC11) +#define XMC_BCCU0_TRIGOUT XMC_VADC_REQ_TR_F /**< @deprecated use instead XMC_VADC_REQ_TR_BCCU0_TRIGOUT0, XMC_VADC_REQ_TR_G0_BCCU0_TRIGOUT0 or XMC_VADC_REQ_TR_G1_BCCU0_TRIGOUT1 */ +#endif +#define XMC_ERU_0_IOUT2 XMC_VADC_REQ_TR_G /**< @deprecated use instead XMC_VADC_REQ_TR_ERU0_IOUT2 */ +#define XMC_ERU_0_IOUT3 XMC_VADC_REQ_TR_H /**< @deprecated use instead XMC_VADC_REQ_TR_ERU0_IOUT3 */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_CCU_80_SR2 XMC_VADC_REQ_TR_I /**< @deprecated use instead XMC_VADC_REQ_TR_CCU80_SR2 */ +#define XMC_CCU_80_SR3 XMC_VADC_REQ_TR_J /**< @deprecated use instead XMC_VADC_REQ_TR_CCU80_SR3 */ +#endif +#define XMC_ERU_0_IOUT0 XMC_VADC_REQ_TR_M /**< @deprecated use instead XMC_VADC_REQ_TR_ERU0_IOUT0 */ +#define XMC_ERU_0_IOUT1 XMC_VADC_REQ_TR_N /**< @deprecated use instead XMC_VADC_REQ_TR_ERU0_IOUT1 */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_POSIF_0_SR1 XMC_VADC_REQ_TR_O /**< @deprecated use instead XMC_VADC_REQ_TR_POSIF0_SR1 */ +#endif +#define XMC_REQ_GT_SEL XMC_VADC_REQ_TR_P /**< @deprecated use instead XMC_VADC_REQ_TR_REQ_GT_SEL */ + +/* Group request source Gating input connection mappings */ +#define XMC_VADC_REQ_GT_CCU40_ST3 XMC_VADC_REQ_GT_A /**< VADC Gating input A */ +#define XMC_VADC_REQ_GT_CCU40_ST2 XMC_VADC_REQ_GT_B /**< VADC Gating input B */ +#define XMC_VADC_REQ_GT_CCU40_ST1 XMC_VADC_REQ_GT_C /**< VADC Gating input C */ +#define XMC_VADC_REQ_GT_CCU40_ST0 XMC_VADC_REQ_GT_D /**< VADC Gating input D */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_VADC_REQ_GT_CCU80_ST3A XMC_VADC_REQ_GT_E /**< VADC Gating input E */ +#define XMC_VADC_REQ_GT_CCU80_ST3 XMC_VADC_REQ_GT_F /**< VADC Gating input F */ +#endif +#if (UC_SERIES != XMC13 && UC_SERIES != XMC11) +#define XMC_VADC_REQ_GT_LEDTS0_FN XMC_VADC_REQ_GT_I /**< VADC Gating input I */ +#define XMC_VADC_REQ_GT_LEDTS1_FN XMC_VADC_REQ_GT_J /**< VADC Gating input J */ +#endif +#define XMC_VADC_REQ_GT_ERU0_PDOUT2 XMC_VADC_REQ_GT_K /**< VADC Gating input K */ +#define XMC_VADC_REQ_GT_ERU0_PDOUT3 XMC_VADC_REQ_GT_L /**< VADC Gating input L */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_VADC_REQ_GT_CCU80_ST0 XMC_VADC_REQ_GT_M /**< VADC Gating input M */ +#define XMC_VADC_REQ_GT_CCU80_ST1 XMC_VADC_REQ_GT_N /**< VADC Gating input N */ +#endif +#define XMC_VADC_REQ_GT_ERU0_PDOUT0 XMC_VADC_REQ_GT_O /**< VADC Gating input O */ +#define XMC_VADC_REQ_GT_ERU0_PDOUT1 XMC_VADC_REQ_GT_P /**< VADC Gating input P */ + +/* Group request source Trigger input connection mappings */ +#define XMC_VADC_REQ_TR_CCU40_SR2 XMC_VADC_REQ_TR_A /**< VADC Trigger input A */ +#define XMC_VADC_REQ_TR_CCU40_SR3 XMC_VADC_REQ_TR_B /**< VADC Trigger input B */ +#if (UC_SERIES != XMC11) +#define XMC_VADC_REQ_TR_BCCU0_TRIGOUT0 XMC_VADC_REQ_TR_F /**< VADC Global Background Source Trigger input F */ +#define XMC_VADC_REQ_TR_G0_BCCU0_TRIGOUT0 XMC_VADC_REQ_TR_F /**< VADC Group 0 Trigger input F */ +#define XMC_VADC_REQ_TR_G1_BCCU0_TRIGOUT1 XMC_VADC_REQ_TR_F /**< VADC Group1 Trigger input F */ +#endif +#define XMC_VADC_REQ_TR_ERU0_IOUT2 XMC_VADC_REQ_TR_G /**< VADC Trigger input G */ +#define XMC_VADC_REQ_TR_ERU0_IOUT3 XMC_VADC_REQ_TR_H /**< VADC Trigger input H */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_VADC_REQ_TR_CCU80_SR2 XMC_VADC_REQ_TR_I /**< VADC Trigger input I */ +#define XMC_VADC_REQ_TR_CCU80_SR3 XMC_VADC_REQ_TR_J /**< VADC Trigger input J */ +#endif +#define XMC_VADC_REQ_TR_ERU0_IOUT0 XMC_VADC_REQ_TR_M /**< VADC Trigger input M */ +#define XMC_VADC_REQ_TR_ERU0_IOUT1 XMC_VADC_REQ_TR_N /**< VADC Trigger input N */ +#if (UC_SERIES != XMC12 && UC_SERIES != XMC11) +#define XMC_VADC_REQ_TR_POSIF0_SR1 XMC_VADC_REQ_TR_O /**< VADC Trigger input O */ +#endif +#define XMC_VADC_REQ_TR_REQ_GT_SEL XMC_VADC_REQ_TR_P /**< VADC Trigger input P */ + +#endif + +#if ( UC_FAMILY == XMC4 ) + +/* Group request source Gating input connection mappings */ +#define XMC_CCU_40_ST3 XMC_VADC_REQ_GT_A /**< @deprecated use instead XMC_VADC_REQ_GT_CCU40_ST3 */ +#define XMC_CCU_41_ST3 XMC_VADC_REQ_GT_B /**< @deprecated use instead XMC_VADC_REQ_GT_CCU41_ST3 */ +#define XMC_CCU_40_SR0 XMC_VADC_REQ_GT_C /**< @deprecated use instead XMC_VADC_REQ_GT_CCU40_SR0 */ +#define XMC_CCU_41_SR1 XMC_VADC_REQ_GT_D /**< @deprecated use instead XMC_VADC_REQ_GT_CCU41_SR1 */ +#define XMC_CCU_80_ST3_A XMC_VADC_REQ_GT_E /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_ST3A */ +#define XMC_CCU_80_ST3_B XMC_VADC_REQ_GT_F /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_ST3B */ + +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_CCU_81_ST3_A XMC_VADC_REQ_GT_G /**< @deprecated use instead XMC_VADC_REQ_GT_CCU81_ST3A */ +#define XMC_CCU_81_ST3_B XMC_VADC_REQ_GT_H /**< @deprecated use instead XMC_VADC_REQ_GT_CCU81_ST3B */ +#endif + +#define XMC_DAC_0_SGN XMC_VADC_REQ_GT_I /**< @deprecated use instead XMC_VADC_REQ_GT_DAC0_SGN, XMC_VADC_REQ_GT_G0_DAC0_SGN or XMC_VADC_REQ_GT_G2_DAC0_SGN */ +#define XMC_DAC_1_SGN XMC_VADC_REQ_GT_I /**< @deprecated use instead XMC_VADC_REQ_GT_DAC0_SGN, XMC_VADC_REQ_GT_G1_DAC1_SGN or XMC_VADC_REQ_GT_G3_DAC1_SGN */ +#define XMC_LEDTS_FN XMC_VADC_REQ_GT_J /**< @deprecated use instead XMC_VADC_REQ_GT_LEDTS_FN */ +#define XMC_VADC_G0_BLOUT0 XMC_VADC_REQ_GT_K /**< @deprecated use instead XMC_VADC_REQ_GT_VADC_G1BFLOUT0 or XMC_VADC_REQ_GT_G0_VADC_G1BFLOUT0 */ +#define XMC_VADC_G1_BLOUT0 XMC_VADC_REQ_GT_K /**< @deprecated use instead XMC_VADC_REQ_GT_VADC_G1BFLOUT0 or XMC_VADC_REQ_GT_G1_VADC_G0BFLOUT0 */ +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_VADC_G2_BLOUT0 XMC_VADC_REQ_GT_K /**< @deprecated use instead XMC_VADC_REQ_GT_VADC_G1BFLOUT0 or XMC_VADC_REQ_GT_G2_VADC_G3BFLOUT0 */ +#define XMC_VADC_G3_BLOUT0 XMC_VADC_REQ_GT_K /**< @deprecated use instead XMC_VADC_REQ_GT_VADC_G1BFLOUT0 or XMC_VADC_REQ_GT_G3_VADC_G2BFLOUT0 */ +#endif +#define XMC_VADC_G0_SAMPLE XMC_VADC_REQ_GT_L /**< @deprecated use instead XMC_VADC_REQ_GT_G0_VADC_G3SAMPLE */ +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_VADC_G1_SAMPLE XMC_VADC_REQ_GT_L /**< @deprecated use instead XMC_VADC_REQ_GT_G1_VADC_G0SAMPLE */ +#define XMC_VADC_G2_SAMPLE XMC_VADC_REQ_GT_L /**< @deprecated use instead XMC_VADC_REQ_GT_G2_VADC_G1SAMPLE */ +#define XMC_VADC_G3_SAMPLE XMC_VADC_REQ_GT_L /**< @deprecated use instead XMC_VADC_REQ_GT_G3_VADC_G2SAMPLE */ +#endif +#define XMC_CCU_80_SR0 XMC_VADC_REQ_GT_M /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_SR0 */ +#define XMC_CCU_80_SR1 XMC_VADC_REQ_GT_N /**< @deprecated use instead XMC_VADC_REQ_GT_CCU80_SR1 */ +#define XMC_ERU_1_PDOUT0 XMC_VADC_REQ_GT_O /**< @deprecated use instead XMC_VADC_REQ_GT_ERU1_PDOUT0 */ +#define XMC_ERU_1_PDOUT1 XMC_VADC_REQ_GT_P /**< @deprecated use instead XMC_VADC_REQ_GT_ERU1_PDOUT1 */ + +/* Group request source Trigger input connection mappings */ +#define XMC_CCU_40_SR2 XMC_VADC_REQ_TR_A /**< @deprecated use instead XMC_VADC_REQ_TR_CCU40_SR2 */ +#define XMC_CCU_40_SR3 XMC_VADC_REQ_TR_B /**< @deprecated use instead XMC_VADC_REQ_TR_CCU40_SR3 */ +#define XMC_CCU_41_SR2 XMC_VADC_REQ_TR_C /**< @deprecated use instead XMC_VADC_REQ_TR_CCU41_SR2 */ +#define XMC_CCU_41_SR3 XMC_VADC_REQ_TR_D /**< @deprecated use instead XMC_VADC_REQ_TR_CCU41_SR3 */ +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_CCU_42_SR3 XMC_VADC_REQ_TR_E /**< @deprecated use instead XMC_VADC_REQ_TR_CCU42_SR3 */ +#define XMC_CCU_43_SR3 XMC_VADC_REQ_TR_F /**< @deprecated use instead XMC_VADC_REQ_TR_CCU43_SR3 */ +#endif +#define XMC_CCU_80_SR2 XMC_VADC_REQ_TR_I /**< @deprecated use instead XMC_VADC_REQ_TR_CCU80_SR2 */ +#define XMC_CCU_80_SR3 XMC_VADC_REQ_TR_J /**< @deprecated use instead XMC_VADC_REQ_TR_CCU80_SR3 */ +#define XMC_CCU_81_SR2 XMC_VADC_REQ_TR_K /**< @deprecated use instead XMC_VADC_REQ_TR_CCU81_SR2 */ +#define XMC_CCU_81_SR3 XMC_VADC_REQ_TR_L /**< @deprecated use instead XMC_VADC_REQ_TR_CCU81_SR3 */ +#define XMC_ERU_1_IOUT0 XMC_VADC_REQ_TR_M /**< @deprecated use instead XMC_VADC_REQ_TR_ERU1_IOUT0 */ +#define XMC_ERU_1_IOUT1 XMC_VADC_REQ_TR_N /**< @deprecated use instead XMC_VADC_REQ_TR_ERU1_IOUT1, XMC_VADC_REQ_TR_G0_ERU1_IOUT1 or XMC_VADC_REQ_TR_G1_ERU1_IOUT1 */ +#define XMC_ERU_1_IOUT2 XMC_VADC_REQ_TR_N /**< @deprecated use instead XMC_VADC_REQ_TR_ERU1_IOUT1, XMC_VADC_REQ_TR_G2_ERU1_IOUT2 or XMC_VADC_REQ_TR_G3_ERU1_IOUT1 */ +#if ( (UC_SERIES != XMC43) ) +#define XMC_POSIF_0_SR1 XMC_VADC_REQ_TR_O /**< @deprecated use instead XMC_VADC_REQ_TR_POSIF0_SR1, XMC_VADC_REQ_TR_G0_POSIF0_SR1 or XMC_VADC_REQ_TR_G2_POSIF0_SR1 */ +#endif +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_POSIF_1_SR1 XMC_VADC_REQ_TR_O /**< @deprecated use instead XMC_VADC_REQ_TR_POSIF0_SR1, XMC_VADC_REQ_TR_G1_POSIF0_SR1 or XMC_VADC_REQ_TR_G3_POSIF0_SR1 */ +#endif +#define XMC_REQ_GT_SEL XMC_VADC_REQ_TR_P /**< @deprecated use instead XMC_VADC_REQ_GT_CCU40_ST3 */ + +/* Group request source Gating input connection mappings */ +#define XMC_VADC_REQ_GT_CCU40_ST3 XMC_VADC_REQ_GT_A /**< VADC Gating input A */ +#define XMC_VADC_REQ_GT_CCU41_ST3 XMC_VADC_REQ_GT_B /**< VADC Gating input B */ +#define XMC_VADC_REQ_GT_CCU40_SR0 XMC_VADC_REQ_GT_C /**< VADC Gating input C */ +#define XMC_VADC_REQ_GT_CCU41_SR1 XMC_VADC_REQ_GT_D /**< VADC Gating input D */ +#define XMC_VADC_REQ_GT_CCU80_ST3A XMC_VADC_REQ_GT_E /**< VADC Gating input E */ +#define XMC_VADC_REQ_GT_CCU80_ST3B XMC_VADC_REQ_GT_F /**< VADC Gating input F */ +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_VADC_REQ_GT_CCU81_ST3A XMC_VADC_REQ_GT_G /**< VADC Gating input G */ +#define XMC_VADC_REQ_GT_CCU81_ST3B XMC_VADC_REQ_GT_H /**< VADC Gating input H */ +#endif +#define XMC_VADC_REQ_GT_DAC0_SGN XMC_VADC_REQ_GT_I /**< VADC Global Background Source Gating input I */ +#define XMC_VADC_REQ_GT_G0_DAC0_SGN XMC_VADC_REQ_GT_I /**< VADC Group 0 Gating input I */ +#define XMC_VADC_REQ_GT_G1_DAC1_SGN XMC_VADC_REQ_GT_I /**< VADC Group 1 Gating input I */ +#define XMC_VADC_REQ_GT_G2_DAC0_SGN XMC_VADC_REQ_GT_I /**< VADC Group 2 Gating input I */ +#define XMC_VADC_REQ_GT_G3_DAC1_SGN XMC_VADC_REQ_GT_I /**< VADC Group 3 Gating input I */ +#define XMC_VADC_REQ_GT_LEDTS_FN XMC_VADC_REQ_GT_J /**< VADC Gating input J */ +#define XMC_VADC_REQ_GT_VADC_G1BFLOUT0 XMC_VADC_REQ_GT_K /**< VADC Global Background Source Gating input K */ +#define XMC_VADC_REQ_GT_G0_VADC_G1BFLOUT0 XMC_VADC_REQ_GT_K /**< VADC Group 0 Gating input K */ +#define XMC_VADC_REQ_GT_G1_VADC_G0BFLOUT0 XMC_VADC_REQ_GT_K /**< VADC Group 1 Gating input K */ +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_VADC_REQ_GT_G2_VADC_G3BFLOUT0 XMC_VADC_REQ_GT_K /**< VADC Group 2 Gating input K */ +#define XMC_VADC_REQ_GT_G3_VADC_G2BFLOUT0 XMC_VADC_REQ_GT_K /**< VADC Group 3 Gating input K */ +#endif +#define XMC_VADC_REQ_GT_G0_VADC_G3SAMPLE XMC_VADC_REQ_GT_L /**< VADC Group 0 Gating input L */ +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_VADC_REQ_GT_G1_VADC_G0SAMPLE XMC_VADC_REQ_GT_L /**< VADC Group 1 Gating input L */ +#define XMC_VADC_REQ_GT_G2_VADC_G1SAMPLE XMC_VADC_REQ_GT_L /**< VADC Group 2 Gating input L */ +#define XMC_VADC_REQ_GT_G3_VADC_G2SAMPLE XMC_VADC_REQ_GT_L /**< VADC Group 3 Gating input L */ +#endif +#define XMC_VADC_REQ_GT_CCU80_SR0 XMC_VADC_REQ_GT_M /**< VADC Gating input M */ +#define XMC_VADC_REQ_GT_CCU80_SR1 XMC_VADC_REQ_GT_N /**< VADC Gating input N */ +#define XMC_VADC_REQ_GT_ERU1_PDOUT0 XMC_VADC_REQ_GT_O /**< VADC Gating input O */ +#define XMC_VADC_REQ_GT_ERU1_PDOUT1 XMC_VADC_REQ_GT_P /**< VADC Gating input P */ + +/* Group request source Trigger input connection mappings */ +#define XMC_VADC_REQ_TR_CCU40_SR2 XMC_VADC_REQ_TR_A /**< VADC Trigger input A */ +#define XMC_VADC_REQ_TR_CCU40_SR3 XMC_VADC_REQ_TR_B /**< VADC Trigger input B */ +#define XMC_VADC_REQ_TR_CCU41_SR2 XMC_VADC_REQ_TR_C /**< VADC Trigger input C */ +#define XMC_VADC_REQ_TR_CCU41_SR3 XMC_VADC_REQ_TR_D /**< VADC Trigger input D */ +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_VADC_REQ_TR_CCU42_SR3 XMC_VADC_REQ_TR_E /**< VADC Trigger input E */ +#define XMC_VADC_REQ_TR_CCU43_SR3 XMC_VADC_REQ_TR_F /**< VADC Trigger input F */ +#endif +#if ((UC_SERIES == XMC48) || (UC_SERIES == XMC43)) +#define XMC_VADC_REQ_TR_ECAT_SYNC0 XMC_VADC_REQ_TR_G /**< VADC Trigger input G */ +#define XMC_VADC_REQ_TR_ECAT_SYNC1 XMC_VADC_REQ_TR_H /**< VADC Trigger input H */ +#endif +#define XMC_VADC_REQ_TR_CCU80_SR2 XMC_VADC_REQ_TR_I /**< VADC Trigger input I */ +#define XMC_VADC_REQ_TR_CCU80_SR3 XMC_VADC_REQ_TR_J /**< VADC Trigger input J */ +#define XMC_VADC_REQ_TR_CCU81_SR2 XMC_VADC_REQ_TR_K /**< VADC Trigger input K */ +#define XMC_VADC_REQ_TR_CCU81_SR3 XMC_VADC_REQ_TR_L /**< VADC Trigger input L */ +#define XMC_VADC_REQ_TR_ERU1_IOUT0 XMC_VADC_REQ_TR_M /**< VADC Trigger input M */ +#define XMC_VADC_REQ_TR_ERU1_IOUT1 XMC_VADC_REQ_TR_M /**< VADC Global Background Source Trigger input N */ +#define XMC_VADC_REQ_TR_G0_ERU1_IOUT1 XMC_VADC_REQ_TR_N /**< VADC Group 0 Trigger input N */ +#define XMC_VADC_REQ_TR_G1_ERU1_IOUT1 XMC_VADC_REQ_TR_N /**< VADC Group 1 Trigger input N */ +#define XMC_VADC_REQ_TR_G2_ERU1_IOUT2 XMC_VADC_REQ_TR_N /**< VADC Group 2 Trigger input N */ +#define XMC_VADC_REQ_TR_G3_ERU1_IOUT2 XMC_VADC_REQ_TR_N /**< VADC Group 3 Trigger input N */ +#if ( (UC_SERIES != XMC43) ) +#define XMC_VADC_REQ_TR_POSIF0_SR1 XMC_VADC_REQ_TR_O /**< VADC Global Background Source Trigger input O */ +#define XMC_VADC_REQ_TR_G0_POSIF0_SR1 XMC_VADC_REQ_TR_O /**< VADC Group 0 Trigger input O */ +#define XMC_VADC_REQ_TR_G1_POSIF1_SR1 XMC_VADC_REQ_TR_O /**< VADC Group 1 Trigger input O */ +#endif +#if ( (UC_SERIES != XMC43) && (UC_SERIES != XMC42) && (UC_SERIES != XMC41)) +#define XMC_VADC_REQ_TR_G2_POSIF0_SR1 XMC_VADC_REQ_TR_O /**< VADC Group 2 Trigger input O */ +#define XMC_VADC_REQ_TR_G3_POSIF1_SR1 XMC_VADC_REQ_TR_O /**< VADC Group 3 Trigger input O */ +#endif +#define XMC_VADC_REQ_TR_REQ_GT_SEL XMC_VADC_REQ_TR_P /**< VADC Trigger input P */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_wdt.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_wdt.h new file mode 100644 index 00000000..223af6e6 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/inc/xmc_wdt.h @@ -0,0 +1,439 @@ +/** + * @file xmc_wdt.h + * @date 2015-08-06 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * - Documentation updates
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-08-06: + * - Bug fix in XMC_WDT_SetDebugMode() API, Wrong register is being configured.
+ * @endcond + */ + +#ifndef XMC_WDT_H +#define XMC_WDT_H + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ + +#include "xmc_common.h" +#include "xmc_scu.h" +/** + * @addtogroup XMClib XMC Peripheral Library + * @{ + */ + +/** + * @addtogroup WDT + * @brief Watchdog driver for the XMC microcontroller family. + * + * The watchdog unit (WDT) improves the system integrity, by triggering the system reset request to bring the system + * back from the unresponsive state to normal operation. + * + * This LLD provides the Configuration structure XMC_WDT_CONFIG_t and initialization function XMC_WDT_Init().\n + * It can be used to: + * -# Start or Stop the watchdog timer. (XMC_WDT_Start() and XMC_WDT_Stop()) + * -# Service the watchdog timer. (XMC_WDT_Service()) + * -# Configure the service window upper bound and lower bound timing values. (XMC_WDT_SetWindowBounds()) + * -# Enable the generation of the pre-warning event for the first overflow of the timer. (XMC_WDT_SetMode()) + * -# Clear the pre-warning alarm event. It is mandatory to clear the flag during pre-warning alarm ISR, to stop + generating reset request for the second overflow of the timer. (XMC_WDT_ClearAlarm()) + * -# Suspend the watchdog timer during Debug HALT mode. (XMC_WDT_SetDebugMode()) + * -# Configure service indication pulse width.(XMC_WDT_SetServicePulseWidth()) + * + * @{ + */ + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +#define XMC_WDT_MAGIC_WORD (0xABADCAFEU) /* Magic word to be written in Service Register (SRV), + to service or feed the watchdog. */ + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/** + * Defines working modes for watchdog. Use type XMC_WDT_MODE_t for this enum. + */ +typedef enum XMC_WDT_MODE +{ + XMC_WDT_MODE_TIMEOUT = (uint32_t)0x0 << WDT_CTR_PRE_Pos, /**< Generates reset request as soon as the timer overflow + occurs. */ + XMC_WDT_MODE_PREWARNING = (uint32_t)0x1 << WDT_CTR_PRE_Pos /**< Generates an alarm event for the first overflow. And + reset request after subsequent overflow, if not + serviced after first overflow. */ +} XMC_WDT_MODE_t; + +/** + * Defines debug behaviour of watchdog when the CPU enters HALT mode. Use type XMC_WDT_DEBUG_MODE_t for this enum. + */ +typedef enum XMC_WDT_DEBUG_MODE +{ + XMC_WDT_DEBUG_MODE_STOP = (uint32_t)0x0 << WDT_CTR_DSP_Pos, /**< Watchdog counter is paused during debug halt. */ + XMC_WDT_DEBUG_MODE_RUN = (uint32_t)0x1 << WDT_CTR_DSP_Pos /**< Watchdog counter is not paused during debug halt. */ +} XMC_WDT_DEBUG_MODE_t; + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + /* Anonymous structure/union guard start */ +#if defined(__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined(__TASKING__) + #pragma warning 586 +#endif + +/** + * Structure for initializing watchdog timer. Use type XMC_WDT_CONFIG_t for this structure. + */ +typedef struct XMC_WDT_CONFIG +{ + uint32_t window_upper_bound; /**< Upper bound for service window (WUB). Reset request is generated up on overflow of + timer. ALways upper bound value has to be more than lower bound value. If it is set + lower than WLB, triggers a system reset after timer crossed upper bound value.\n + Range: [0H to FFFFFFFFH] */ + uint32_t window_lower_bound; /**< Lower bound for servicing window (WLB). Setting the lower bound to 0H disables the + window mechanism.\n + Range: [0H to FFFFFFFFH] */ + union + { + struct + { + uint32_t : 1; + uint32_t prewarn_mode : 1; /**< Pre-warning mode (PRE). This accepts boolean values as input. */ + uint32_t : 2; + uint32_t run_in_debug_mode : 1; /**< Watchdog timer behaviour during debug (DSP). This accepts boolean values as input. */ + uint32_t : 3; + uint32_t service_pulse_width : 8; /**< Service Indication Pulse Width (SPW). Generated Pulse width is of (SPW+1), + in fwdt cycles.\n + Range: [0H to FFH] */ + uint32_t : 16; + }; + uint32_t wdt_ctr; /* Value of operation mode control register (CTR). It’s bit fields are represented by above + union members. */ + }; +} XMC_WDT_CONFIG_t; +/* Anonymous structure/union guard end */ +#if defined(__CC_ARM) + #pragma pop +#elif defined(__TASKING__) + #pragma warning restore +#endif +/********************************************************************************************************************* + * API PROTOTYPES + ********************************************************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * \if XMC4 + * Enables watchdog clock and releases watchdog reset.\n + * \endif + * \if XMC1 + * Enables watchdog clock.\n + * \endif + * \par + * This API is invoked by XMC_WDT_Init() and therefore no need to call it explicitly during watchdog initialization + * sequence. Invoke this API to enable watchdog once again if the watchdog is disabled by invoking XMC_WDT_Disable(). + * + * \parNote:
+ * \if XMC4 + * 1. It is required to configure the watchdog, again after invoking XMC_WDT_Disable(). Since all the registers are + * reset with default values. + * \endif + * \if XMC1 + * 1. Not required to configure the watchdog again after invoking XMC_WDT_Disable(). Since the registers retains with + * the configured values. + * \endif + * \parRelated APIs:
+ * XMC_WDT_Init(), XMC_WDT_Disable() + */ +void XMC_WDT_Enable(void); + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * \if XMC4 + * Disables the clock and resets watchdog timer.\n + * \endif + * \if XMC1 + * Disables the clock to the watchdog timer.\n + * \endif + * + * \parNote:
+ * \if XMC4 + * 1. Resets the registers with default values. So XMC_WDT_Init() has to be invoked again to configure the watchdog. + * \endif + * \if XMC1 + * 1. After invoking XMC_WDT_Disable(), all register values are displayed with 0F in debugger. Once enabled by + calling XMC_WDT_Enable(), previous configured register values are displayed. No need to invoke XMC_WDT_Init() + again. + * \endif + * \parRelated APIs:
+ * XMC_WDT_Enable() + */ +void XMC_WDT_Disable(void); + +/** + * @param config pointer to a constant watchdog configuration data structure. Refer data structure XMC_WDT_CONFIG_t + * for detail. + * + * @return None + * + * \parDescription:
+ * Initializes and configures watchdog with configuration data pointed by \a config.\n + * \par + * It invokes XMC_WDT_Enable() to enable clock and release reset. Then configures the lower and upper window bounds, + * working mode (timeout/pre-warning), debug behaviour and service request indication pulse width. + * + * \parNote:
+ * 1. With out invoking this XMC_WDT_Init() or XMC_WDT_Enable(), invocation of other APIs like XMC_WDT_SetWindowBounds(), + * XMC_WDT_SetMode(), XMC_WDT_SetServicePulseWidth(), XMC_WDT_SetDebugMode(), XMC_WDT_Start(), XMC_WDT_GetCounter(), + * XMC_WDT_Service(), XMC_WDT_ClearAlarm() has no affect. + */ +void XMC_WDT_Init(const XMC_WDT_CONFIG_t *const config); + +/** + * @param lower_bound specifies watchdog window lower bound in terms of watchdog clock (fWDT) cycles. + * Range: [0H to FFFFFFFFH]. + * @param upper_bound specifies watchdog window upper bound in terms of watchdog clock (fWDT) cycles. + * Range: [0H to FFFFFFFFH]. + * + * @return None + * + * \parDescription:
+ * Sets watchdog window lower and upper bounds by updating WLB and WUB registers.\n + * \par + * Window lower and upper bounds are set during initialization in XMC_WDT_Init(). Invoke this API to alter the values as + * needed later in the program. This upper bound and lower bound can be calculated by using the below formula\n + * upper_bound or lower_bound = desired_boundary_time(sec) * fwdt(hz) + * + * \parNote: + * 1. Always ensure that upper_bound is greater than the lower_bound value. If not, whenever timer crosses the + * upper_bound value it triggers the reset(wdt_rst_req) of the controller. + */ +__STATIC_INLINE void XMC_WDT_SetWindowBounds(uint32_t lower_bound, uint32_t upper_bound) +{ + WDT->WLB = lower_bound; + WDT->WUB = upper_bound; +} + +/** + * @param mode is one of the working modes of the watchdog timer, i.e timeout or pre-warning. Refer @ref XMC_WDT_MODE_t + * for valid values. + * + * @return None + * + * \parDescription:
+ * Sets watchdog working mode (timeout or pre-warning) by updating PRE bit of CTR register.\n + * \par + * The working mode is set during initialization in XMC_WDT_Init(). Invoke this API to alter the mode as needed later in + * the program. + */ +__STATIC_INLINE void XMC_WDT_SetMode(XMC_WDT_MODE_t mode) +{ + WDT->CTR = (WDT->CTR & (uint32_t)~WDT_CTR_PRE_Msk) | (uint32_t)mode; +} + +/** + * @param service_pulse_width specifies Service indication pulse width in terms of fwdt. + * Range: [0H – FFH]. + * @return None + * + * \parDescription:
+ * Sets service indication pulse width by updating SPW bit field of CTR register.\n + * \par + * The service indication pulse (with width service_pulse_width + 1 in fwdt cycles) is generated on successful servicing + * or feeding of watchdog. The pulse width is initially set during initialization in XMC_WDT_Init(). Invoke this API to + * alter the width as needed later in the program. + */ +__STATIC_INLINE void XMC_WDT_SetServicePulseWidth(uint8_t service_pulse_width) +{ + WDT->CTR = (WDT->CTR & (uint32_t)~WDT_CTR_SPW_Msk) | ((uint32_t)service_pulse_width << WDT_CTR_SPW_Pos); +} + +/** + * @param debug_mode running state of watchdog during debug halt mode. Refer @ref XMC_WDT_DEBUG_MODE_t for + * valid values. + * + * @return None + * + * \parDescription:
+ * Sets debug behaviour of watchdog by modifying DSP bit of CTR register.\n + * \par + * Depending upon DSP bit, the watchdog timer stops when CPU is in HALT mode. The debug behaviour is initially set as + * XMC_WDT_DEBUG_MODE_STOP during initialization in XMC_WDT_Init(). Invoke this API to change the debug behaviour as + * needed later in the program. + */ +__STATIC_INLINE void XMC_WDT_SetDebugMode(const XMC_WDT_DEBUG_MODE_t debug_mode) +{ + WDT->CTR = (WDT->CTR & (uint32_t)~WDT_CTR_DSP_Msk) | (uint32_t)debug_mode; +} + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * Start the watchdog timer by setting ENB bit of CTR register.\n + * \par + * Invoke this API to start the watchdog after initialization, or to resume the watchdog when + * paused by invoking XMC_WDT_Stop(). + * + * \parRelated APIs:
+ * XMC_WDT_Init(), XMC_WDT_Stop() + */ +__STATIC_INLINE void XMC_WDT_Start(void) +{ + WDT->CTR |= (uint32_t)WDT_CTR_ENB_Msk; +} + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * Pauses watchdog timer by resetting ENB bit of CTR register.\n + * \par + * Invoke this API to pause the watchdog as needed in the program e.g. debugging through software control. + * + * \parRelated APIs:
+ * XMC_WDT_Init(), XMC_WDT_Stop() + */ +__STATIC_INLINE void XMC_WDT_Stop(void) +{ + WDT->CTR &= (uint32_t)~WDT_CTR_ENB_Msk; +} + +/** + * @param None + * + * @return uint32_t Current count value of watchdog timer register (TIM). + * Range: [0H to FFFFFFFFH] + * + * \parDescription:
+ * Reads current count of timer register (TIM).\n + * \par + * Invoke this API before servicing or feeding the watchdog to check whether count is between lower and upper + * window bounds. + * + * \parRelated APIs:
+ * XMC_WDT_Service() + */ +__STATIC_INLINE uint32_t XMC_WDT_GetCounter(void) +{ + return WDT->TIM; +} + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * Services or feeds the watchdog by writing the Magic word in SRV register.\n + * \par + * Service watchdog when count value of watchdog timer is between lower and upper window bounds. Successful servicing + * will reset watchdog timer (TIM register) to 0H and generate service indication pulse. + * + * \parNote:
+ * 1. invoking this API when count value of watchdog timer is less than window lower bound results + * wrong servicing and immediately triggers reset request. + * + * \parRelated APIs:
+ * XMC_WDT_GetCounter(), XMC_WDT_SetWindowBounds(), XMC_WDT_SetServicePulseWidth() + */ +__STATIC_INLINE void XMC_WDT_Service(void) +{ + WDT->SRV = XMC_WDT_MAGIC_WORD; +} + +/** + * @param None + * + * @return None + * + * \parDescription:
+ * Clears pre-warning alarm by setting ALMC bit in WDTCLR register.\n + * \par + * In pre-warning mode, first overflow of the timer upper window bound fires the pre-warning alarm. XMC_WDT_ClearAlarm() + * must be invoked to clear the alarm alarm. After clearing of the alarm, watchdog timer must be serviced within valid + * time window. Otherwise watchdog timer triggers the reset request up on crossing the upper bound value in a subsequent + * cycle. + * + * \parRelated APIs:
+ * XMC_WDT_Service(), XMC_WDT_SetMode() + */ +__STATIC_INLINE void XMC_WDT_ClearAlarm(void) +{ + WDT->WDTCLR = WDT_WDTCLR_ALMC_Msk; +} + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +/** + * @} + */ + +#endif /* XMC_WDT_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_eru.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_eru.c new file mode 100644 index 00000000..531cf55f --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_eru.c @@ -0,0 +1,63 @@ +/** + * @file xmc1_eru.c + * @date 2015-02-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * @endcond + */ + +#include "xmc_eru.h" + +#if UC_FAMILY == XMC1 + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +void XMC_ERU_Enable(XMC_ERU_t *const eru) +{ + XMC_UNUSED_ARG(eru); +} + +void XMC_ERU_Disable(XMC_ERU_t *const eru) +{ + XMC_UNUSED_ARG(eru); +} + +#endif /* if( UC_FAMILY == XMC1 ) */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_flash.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_flash.c new file mode 100644 index 00000000..c72f9855 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_flash.c @@ -0,0 +1,254 @@ +/** + * @file xmc1_flash.c + * @date 2015-10-14 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-10: + * - Initial
+ * + * 2015-06-20: + * - Removed definition of GetDriverVersion API + * + * 2015-10-14: + * - Fixed defect in API XMC_FLASH_ErasePages, related to the errata NVM_CM.001 + * - NVM ROM user routine XMC1000_NvmErasePage(address) used for erase page. + * + * @endcond + * + */ + +#include "xmc_flash.h" + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#if UC_FAMILY == XMC1 + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ +/* FLASH programming / erase options */ +typedef enum FLASH_ACTION +{ + FLASH_ACTION_IDLE = (uint32_t)0x00, + FLASH_ACTION_ONESHOT_WRITE_VERIFY = ((uint32_t)0x51 << NVM_NVMPROG_ACTION_Pos), + FLASH_ACTION_ONESHOT_WRITE = ((uint32_t)0x91 << NVM_NVMPROG_ACTION_Pos), + FLASH_ACTION_CONTINUOUS_WRITE_VERIFY = ((uint32_t)0x61 << NVM_NVMPROG_ACTION_Pos), + FLASH_ACTION_CONTINUOUS_WRITE = ((uint32_t)0xa1 << NVM_NVMPROG_ACTION_Pos), + FLASH_ACTION_ONESHOT_PAGE_ERASE = ((uint32_t)0x92 << NVM_NVMPROG_ACTION_Pos), + FLASH_ACTION_CONTINUOUS_PAGE_ERASE = ((uint32_t)0xa2 << NVM_NVMPROG_ACTION_Pos), + FLASH_ACTION_ONESHOT_VERIFY_ONLY = ((uint32_t)0xd0 << NVM_NVMPROG_ACTION_Pos), + FLASH_ACTION_CONTINUOUS_VERIFY_ONLY = ((uint32_t)0xe0 << NVM_NVMPROG_ACTION_Pos) +} FLASH_ACTION_t; + + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* + * This API shall clear the ECC and VERIFICATION error status. + */ +void XMC_FLASH_ClearStatus(void) +{ + NVM->NVMPROG |= (uint16_t)((uint16_t)NVM_NVMPROG_RSTVERR_Msk | (uint16_t)NVM_NVMPROG_RSTECC_Msk); +} + +/* + * This API shall return the status of NVM. + */ +uint32_t XMC_FLASH_GetStatus(void) +{ + return NVM->NVMSTATUS; +} + +/* + * This API shall enable the the flash interrupt event. + */ +void XMC_FLASH_EnableEvent(const uint32_t event_msk) +{ + NVM->NVMCONF |= (uint16_t)event_msk; +} + +/* + * This API shall disable the the flash interrupt event. + */ +void XMC_FLASH_DisableEvent(const uint32_t event_msk) +{ + NVM->NVMCONF &= (uint16_t)(~(uint16_t)event_msk); +} + +void XMC_FLASH_ErasePage(uint32_t *address) +{ + (void)XMC1000_NvmErasePage(address); +} + +void XMC_FLASH_ProgramVerifyPage(uint32_t *address, const uint32_t *data) +{ + (void)XMC1000_NvmProgVerify(data, address); +} + +/* Write blocks of data into flash*/ +void XMC_FLASH_WriteBlocks(uint32_t *address, const uint32_t *data, uint32_t num_blocks, bool verify) +{ + uint32_t word; + uint32_t block; + + XMC_ASSERT("XMC_FLASH_WriteBlocks: Starting address not aligned to Block", + ((uint32_t)address & FLASH_BLOCK_ADDR_MASK) == 0U) + + /* Configure the continuous Write option command and reset the NVM error / verification status*/ + NVM->NVMPROG &= (uint16_t)(~(uint16_t)NVM_NVMPROG_ACTION_Msk); + NVM->NVMPROG |= (uint16_t)(NVM_NVMPROG_RSTVERR_Msk | NVM_NVMPROG_RSTECC_Msk); + + if (verify == true) + { + NVM->NVMPROG |= (uint16_t)FLASH_ACTION_CONTINUOUS_WRITE_VERIFY; + } + else + { + NVM->NVMPROG |= (uint16_t)FLASH_ACTION_CONTINUOUS_WRITE; + } + + for (block = 0U; block < num_blocks; ++block) + { + for (word = 0U; word < XMC_FLASH_WORDS_PER_BLOCK; ++word) + { + *address = *data; + data++; + address++; + } + + while (XMC_FLASH_IsBusy() == true) + { + } + } + + /* Stop continuous write operation */ + NVM->NVMPROG &= (uint16_t)(~(uint16_t)NVM_NVMPROG_ACTION_Msk); +} + +/* Erase flash pages */ +void XMC_FLASH_ErasePages(uint32_t *address, uint32_t num_pages) +{ + uint32_t page; + + XMC_ASSERT("XMC_FLASH_ErasePages: Starting address not aligned to Page", + ((uint32_t)address & FLASH_PAGE_ADDR_MASK) == 0U) + + for (page = 0U; page < num_pages; ++page) + { + (void)XMC1000_NvmErasePage(address); + + while (XMC_FLASH_IsBusy() == true) + { + } + + /* Increment the page address for the next erase */ + address += XMC_FLASH_WORDS_PER_PAGE; + + } + +} + +/* Write multiple data blocks and verify the written data */ +void XMC_FLASH_VerifyBlocks(uint32_t *address, const uint32_t *data, uint32_t num_blocks) +{ + uint32_t word; + uint32_t block; + + XMC_ASSERT("XMC_FLASH_VerifyBlocks: Starting address not aligned to Block", + ((uint32_t)address & FLASH_BLOCK_ADDR_MASK) == 0U) + + /* Configure the Continuous write with verify option command and reset the NVM error / verification status*/ + NVM->NVMPROG &= (uint16_t)~NVM_NVMPROG_ACTION_Msk; + NVM->NVMPROG |= (uint16_t)((uint16_t)NVM_NVMPROG_RSTVERR_Msk | + (uint16_t)NVM_NVMPROG_RSTECC_Msk | + (uint16_t)FLASH_ACTION_CONTINUOUS_VERIFY_ONLY); + + for (block = 0U; block < num_blocks; ++block) + { + for (word = 0U; word < XMC_FLASH_WORDS_PER_BLOCK; ++word) + { + *address = *data; + data++; + address++; + } + + while (XMC_FLASH_IsBusy() == true) + { + } + } + + /* Stop continuous verify operation */ + NVM->NVMPROG &= (uint16_t)(~(uint16_t)NVM_NVMPROG_ACTION_Msk); +} + +/* Read data blocks from flash */ +void XMC_FLASH_ReadBlocks(uint32_t *address, uint32_t *data, uint32_t num_blocks) +{ + uint32_t word; + uint32_t block; + + XMC_ASSERT("XMC_FLASH_ReadBlocks: Starting address not aligned to Block", + ((uint32_t)address & FLASH_BLOCK_ADDR_MASK) == 0U) + + for (block = 0U; block < num_blocks; ++block) + { + for (word = 0U; word < XMC_FLASH_WORDS_PER_BLOCK; ++word) + { + *data = *address; + data++; + address++; + } + } +} + +/* Erase single sector */ +void XMC_FLASH_EraseSector(uint32_t *address) +{ + XMC_ASSERT("XMC_FLASH_EraseSector: Starting address not aligned to Sector", + ((uint32_t)address & FLASH_SECTOR_ADDR_MASK) == 0U) + XMC_FLASH_ErasePages(address, XMC_FLASH_PAGES_PER_SECTOR); +} + +/* Program single page */ +void XMC_FLASH_ProgramPage(uint32_t *address, const uint32_t *data) +{ + XMC_FLASH_ProgramVerifyPage(address, data); +} + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_gpio.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_gpio.c new file mode 100644 index 00000000..86eaee3f --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_gpio.c @@ -0,0 +1,104 @@ +/** + * @file xmc1_gpio.c + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * @endcond + * + */ + +#include "xmc_gpio.h" + +#if UC_FAMILY == XMC1 + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +#define PORT_PHCR_Msk PORT0_PHCR0_PH0_Msk +#define PORT_PHCR_Size PORT0_PHCR0_PH0_Msk +#define PORT_HWSEL_Msk PORT0_HWSEL_HW0_Msk + +/******************************************************************************* + * API IMPLEMENTATION + *******************************************************************************/ + +void XMC_GPIO_Init(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_CONFIG_t *const config) +{ + XMC_ASSERT("XMC_GPIO_Init: Invalid port", XMC_GPIO_CHECK_PORT(port)); + XMC_ASSERT("XMC_GPIO_Init: Invalid mode", XMC_GPIO_IsModeValid(config->mode)); + XMC_ASSERT("XMC_GPIO_Init: Invalid input hysteresis", XMC_GPIO_CHECK_INPUT_HYSTERESIS(config->input_hysteresis)); + + /* Switch to input */ + port->IOCR[pin >> 2U] &= ~(uint32_t)((uint32_t)PORT_IOCR_PC_Msk << (PORT_IOCR_PC_Size * (pin & 0x3U))); + + /* HW port control is disabled */ + port->HWSEL &= ~(uint32_t)((uint32_t)PORT_HWSEL_Msk << ((uint32_t)pin << 1U)); + + /* Set input hysteresis */ + port->PHCR[(uint32_t)pin >> 3U] &= ~(uint32_t)((uint32_t)PORT_PHCR_Msk << ((uint32_t)PORT_PHCR_Size * ((uint32_t)pin & 0x7U))); + port->PHCR[(uint32_t)pin >> 3U] |= (uint32_t)config->input_hysteresis << ((uint32_t)PORT_PHCR_Size * ((uint32_t)pin & 0x7U)); + + /* Enable digital input */ + if (XMC_GPIO_CHECK_ANALOG_PORT(port)) + { + port->PDISC &= ~(uint32_t)((uint32_t)0x1U << pin); + } + /* Set output level */ + port->OMR = (uint32_t)config->output_level << pin; + + /* Set mode */ + port->IOCR[pin >> 2U] |= (uint32_t)config->mode << (PORT_IOCR_PC_Size * (pin & 0x3U)); +} + +void XMC_GPIO_SetInputHysteresis(XMC_GPIO_PORT_t *const port, + const uint8_t pin, + const XMC_GPIO_INPUT_HYSTERESIS_t hysteresis) +{ + XMC_ASSERT("XMC_GPIO_SetInputHysteresis: Invalid port", XMC_GPIO_CHECK_PORT(port)); + XMC_ASSERT("XMC_GPIO_SetInputHysteresis: Invalid input hysteresis", XMC_GPIO_CHECK_INPUT_HYSTERESIS(hysteresis)); + + port->PHCR[(uint32_t)pin >> 3U] &= ~(uint32_t)((uint32_t)PORT_PHCR_Msk << ((uint32_t)PORT_PHCR_Size * ((uint32_t)pin & 0x7U))); + port->PHCR[(uint32_t)pin >> 3U] |= (uint32_t)hysteresis << ((uint32_t)PORT_PHCR_Size * ((uint32_t)pin & 0x7U)); +} + +#endif /* UC_FAMILY == XMC1 */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_rtc.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_rtc.c new file mode 100644 index 00000000..5ee01e6d --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_rtc.c @@ -0,0 +1,160 @@ +/** + * @file xmc1_rtc.c + * @date 2016-03-09 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-05-20: + * - XMC_RTC_Init() function is modified + * by adding RTC running condition check + * + * 2016-03-09: + * - Optimize write only registers + * + * @endcond + * + */ + + +/** + * + * @brief RTC driver for XMC microcontroller family. + * + */ + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ +#include + +#if UC_FAMILY == XMC1 +#include + +/********************************************************************************************************************* + * API IMPLEMENTATION + *********************************************************************************************************************/ +/* + * Initialize the RTC peripheral + */ +XMC_RTC_STATUS_t XMC_RTC_Init(const XMC_RTC_CONFIG_t *const config) +{ + if (XMC_RTC_IsRunning() == false) + { + if (XMC_RTC_IsEnabled() == false) + { + XMC_RTC_Enable(); + } + + XMC_RTC_SetPrescaler(config->prescaler); + + while ((XMC_SCU_GetMirrorStatus() & (SCU_GENERAL_MIRRSTS_RTC_TIM0_Msk | SCU_GENERAL_MIRRSTS_RTC_TIM1_Msk)) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->TIM0 = config->time.raw0; + RTC->TIM1 = config->time.raw1; + + while ((XMC_SCU_GetMirrorStatus() & (SCU_GENERAL_MIRRSTS_RTC_ATIM0_Msk | SCU_GENERAL_MIRRSTS_RTC_ATIM1_Msk)) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->ATIM0 = config->alarm.raw0; + RTC->ATIM1 = config->alarm.raw1; + } + return XMC_RTC_STATUS_OK; +} + +/* + * Ungates a clock node for RTC + */ +void XMC_RTC_Enable(void) +{ + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_RTC); +} + +/* + * Gates a clock node for RTC + */ +void XMC_RTC_Disable(void) +{ + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_RTC); +} + +/* + * Suspends RTC function during CPU HALT mode + */ +void XMC_RTC_SetDebugMode(const XMC_RTC_DEBUG_MODE_t debug_mode) +{ + uint32_t regval; + regval = (RTC->CTR & (uint32_t)~RTC_CTR_SUS_Msk); + RTC->CTR = (regval | (uint32_t)debug_mode); +} + +/* + * Enable RTC periodic and alarm event(s) + */ +void XMC_RTC_EnableEvent(const uint32_t event) +{ + RTC->MSKSR |= event; +} + +/* + * Disable RTC periodic and alarm event(s) + */ +void XMC_RTC_DisableEvent(const uint32_t event) +{ + RTC->MSKSR &= ~event; +} + +/* + * Clear RTC periodic and alarm event(s) + */ +void XMC_RTC_ClearEvent(const uint32_t event) +{ + RTC->CLRSR = event; +} + +/* + * Checks RTC peripheral is enabled for programming to its registers + */ +bool XMC_RTC_IsEnabled(void) +{ + return !XMC_SCU_CLOCK_IsPeripheralClockGated(XMC_SCU_PERIPHERAL_CLOCK_RTC); +} + +#endif /* UC_FAMILY == XMC1 */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_scu.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_scu.c new file mode 100644 index 00000000..891cf6bf --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc1_scu.c @@ -0,0 +1,946 @@ +/** + * @file xmc1_scu.c + * @date 2017-04-11 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-05-20: + * - XMC_SCU_StartTempMeasurement API is modified + * - XMC_ASSERT statements are added in XMC_SCU_INTERRUPT_SetEventHandler + * + * 2015-06-20: + * - XMC_SCU_INTERRUPT_EnableEvent,XMC_SCU_INTERRUPT_DisableEvent, + * - XMC_SCU_INTERRUPT_TriggerEvent,XMC_SCU_INTERUPT_GetEventStatus, + * - XMC_SCU_INTERRUPT_ClearEventStatus APIs are added + * + * 2015-09-23: + * - XMC1400 support added + * + * 2015-11-30: + * - Documentation improved + * + * 2016-02-29: + * - Fixed XMC_SCU_CLOCK_ScaleMCLKFrequency + * It solves issues with down clock frequency scaling + * + * 2016-04-15: + * - Fixed XMC_SCU_CLOCK_Init for XMC1400 + * It solves issues when trying to disable the OSCHP and use the XTAL pins as GPIO + * + * 2017-02-09 + * - At XMC_SCU_CLOCK_Init() fixed issue while reading oscillator watchdog status + * + * 2017-04-11: + * - Added XMC_SCU_SetBMI() + * + * @endcond + * + */ + +/** + * + * @brief SCU low level driver API prototype definition for XMC1 family of microcontrollers
+ * + * Detailed description of file
+ * APIs provided in this file cover the following functional blocks of SCU:
+ * -- GCU (APIs prefixed with XMC_SCU_GEN_)
+ * ----Temperature Monitoring, Voltage Monitoring, CCU Start etc + * + * -- CCU (APIs prefixed with XMC_SCU_CLOCK_)
+ * ---- Clock initialization, Clock Gating, Sleep Management etc + * + * -- RCU (APIs prefixed with XMC_SCU_RESET_)
+ * ---- Reset Init, Cause, Manual Reset Assert/Deassert etc + * + * -- INTERRUPT (APIs prefixed with XMC_SCU_INTERRUPT_)
+ * ---- Initialization, Manual Assert/Deassert, Acknowledge etc + * + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +#if UC_FAMILY == XMC1 + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define SCU_IRQ_NUM (3U) /**< array index value for list of events that can generate SCU interrupt */ +#define SCU_GCU_PASSWD_PROT_ENABLE (195UL) /**< Password for enabling protection */ +#define SCU_GCU_PASSWD_PROT_DISABLE (192UL) /**< Password for disabling protection */ + + +#define XMC_SCU_CHECK_RTCCLKSRC(source) ( (source == XMC_SCU_CLOCK_RTCCLKSRC_DCO2) || \ + (source == XMC_SCU_CLOCK_RTCCLKSRC_ERU_IOUT0) || \ + (source == XMC_SCU_CLOCK_RTCCLKSRC_ACMP0_OUT) || \ + (source == XMC_SCU_CLOCK_RTCCLKSRC_ACMP1_OUT) || \ + (source == XMC_SCU_CLOCK_RTCCLKSRC_ACMP2_OUT) ) /**< Used to verify + whether provided RTC + clock source is valid + or not */ +#define SCU_GENERAL_INTCR_INTSEL_Msk SCU_GENERAL_INTCR0_INTSEL0_Msk /**< Mask value of Interrupt Source Select + for Node 0 */ +#define SCU_GENERAL_INTCR_INTSEL_Size SCU_GENERAL_INTCR0_INTSEL1_Pos /**< Bit position value of Interrupt Source Select + for Node 1 */ + +#define ANA_TSE_T1 (0x10000F30U) /**< d is a constant data can be retrieved from Flash sector 0 to calculate OFFSET + value for DCO calibration */ +#define ANA_TSE_T2 (0x10000F31U) /**< e is a constant data can be retrieved from Flash sector 0 to calculate OFFSET + value for DCO calibration */ +#define DCO_ADJLO_T1 (0x10000F32U) /**< b is a constant data can be retrieved from Flash sector 0 to calculate OFFSET + value for DCO calibration */ +#define DCO_ADJLO_T2 (0x10000F33U) /**< a is a constant data can be retrieved from Flash sector 0 to calculate OFFSET + value for DCO calibration */ + +#if UC_SERIES == XMC14 +#define XMC_SCU_INTERRUPT_EVENT_MAX (64U) /**< Maximum supported SCU events for XMC14 device. */ +#else +#define XMC_SCU_INTERRUPT_EVENT_MAX (32U) /**< Maximum supported SCU events for XMC11/12/13 device. */ +#endif + +#if UC_SERIES == XMC14 +#define DCO1_DIV2_FREQUENCY_KHZ_Q22_10 (48000U << 10) /**< used to configures main clock (MCLK) frequency to requested + frequency value during runtime for XMC14 device. */ +#else +#define DCO1_DIV2_FREQUENCY_KHZ_Q24_8 (32000U << 8) /**< used to configures main clock (MCLK) frequency to requested + frequency value during runtime for XMC11/12/13 device. */ +#endif + +#define ROM_BmiInstallationReq \ + (*((uint32_t (**)(uint32_t requestedBmiValue))0x00000108U)) /**< Pointer to Request BMI installation routine is + available inside ROM. */ + +#define ROM_CalcTemperature \ + (*((uint32_t (**)(void))0x0000010cU)) /**< Pointer to Calculate chip temperature routine is + available inside ROM. */ + +#define ROM_CalcTSEVAR \ + (*((uint32_t (**)(uint32_t temperature))0x00000120U)) /**< Pointer to Calculate target level for temperature + comparison routine is available inside ROM. */ + +/********************************************************************************************************************* + * LOCAL DATA + ********************************************************************************************************************/ +static XMC_SCU_INTERRUPT_EVENT_HANDLER_t event_handler_list[XMC_SCU_INTERRUPT_EVENT_MAX]; /**< For registering callback + functions on SCU event + occurrence. */ + +static XMC_SCU_INTERRUPT_EVENT_t event_masks[SCU_IRQ_NUM] = +{ + (XMC_SCU_INTERRUPT_EVENT_FLASH_ERROR | + XMC_SCU_INTERRUPT_EVENT_FLASH_COMPLETED | + XMC_SCU_INTERRUPT_EVENT_PESRAM | + XMC_SCU_INTERRUPT_EVENT_PEUSIC0 | +#if defined(USIC1) + XMC_SCU_INTERRUPT_EVENT_PEUSIC1 | +#endif +#if defined(CAN) + XMC_SCU_INTERRUPT_EVENT_PEMCAN | +#endif +#if UC_SERIES == XMC14 + XMC_SCU_INTERRUPT_EVENT_LOSS_EXT_CLOCK | +#endif + XMC_SCU_INTERRUPT_EVENT_LOCI), + + (XMC_SCU_INTERRUPT_EVENT_STDBYCLKFAIL | +#if UC_SERIES == XMC14 + XMC_SCU_INTERRUPT_EVENT_DCO1_OUT_SYNC | +#endif + XMC_SCU_INTERRUPT_EVENT_VDDPI | + XMC_SCU_INTERRUPT_EVENT_VDROP | + XMC_SCU_INTERRUPT_EVENT_VCLIP | + XMC_SCU_INTERRUPT_EVENT_TSE_DONE | + XMC_SCU_INTERRUPT_EVENT_TSE_HIGH | + XMC_SCU_INTERRUPT_EVENT_TSE_LOW | + XMC_SCU_INTERRUPT_EVENT_WDT_WARN | + XMC_SCU_INTERRUPT_EVENT_RTC_PERIODIC | + XMC_SCU_INTERRUPT_EVENT_RTC_ALARM | + XMC_SCU_INTERRUPT_EVENT_RTCCTR_UPDATED | + XMC_SCU_INTERRUPT_EVENT_RTCATIM0_UPDATED | + XMC_SCU_INTERRUPT_EVENT_RTCATIM1_UPDATED | + XMC_SCU_INTERRUPT_EVENT_RTCTIM0_UPDATED | + XMC_SCU_INTERRUPT_EVENT_RTCTIM1_UPDATED), + + ( +#if UC_SERIES != XMC11 + XMC_SCU_INTERRUPT_EVENT_ORC0 | + XMC_SCU_INTERRUPT_EVENT_ORC1 | + XMC_SCU_INTERRUPT_EVENT_ORC2 | + XMC_SCU_INTERRUPT_EVENT_ORC3 | + XMC_SCU_INTERRUPT_EVENT_ORC4 | + XMC_SCU_INTERRUPT_EVENT_ORC5 | + XMC_SCU_INTERRUPT_EVENT_ORC6 | + XMC_SCU_INTERRUPT_EVENT_ORC7 | +#endif +#if defined(COMPARATOR) + XMC_SCU_INTERRUPT_EVENT_ACMP0 | + XMC_SCU_INTERRUPT_EVENT_ACMP1 | + XMC_SCU_INTERRUPT_EVENT_ACMP2 | +#if UC_SERIES == XMC14 + XMC_SCU_INTERRUPT_EVENT_ACMP3 | +#endif +#endif + 0) +}; /**< Defines list of events that can generate SCU interrupt and also indicates SCU events mapping to corresponding + service request number. These event mask values can be used to verify which event is triggered that corresponds + to service request number during runtime. All the event items are tabulated as per service request sources list + table of SCU. */ + +/********************************************************************************************************************* + * LOCAL ROUTINES + ********************************************************************************************************************/ +/* Utility routine to perform frequency up scaling */ +static void XMC_SCU_CLOCK_lFrequencyUpScaling(uint32_t curr_idiv, uint32_t idiv); + +/* Utility routine to perform frequency down scaling */ +static void XMC_SCU_CLOCK_lFrequencyDownScaling(uint32_t curr_idiv, uint32_t idiv); + +/* Calculates the value which must be installed in ANATSEIx register to get indication in + SCU_INTERRUPT->SRRAW bit when the chip temperature is above/below some target/threshold. */ +static uint32_t XMC_SCU_CalcTSEVAR(uint32_t temperature) +{ + uint32_t limit; + + XMC_ASSERT("XMC_SCU_CalcTSEVAR: temperature out of range", (temperature >= 233U) && (temperature <= 388U)); + + limit = ROM_CalcTSEVAR(temperature); + if (limit == 0U) + { + limit = ROM_CalcTSEVAR(temperature + 1U); + if (limit == 0U) + { + limit = ROM_CalcTSEVAR(temperature - 1U); + } + } + + return (limit); +} + +#if UC_SERIES == XMC14 +/* This is a local function used to generate the delay until register get updated with new configured value. */ +static void delay(uint32_t cycles) +{ + while(cycles > 0U) + { + __NOP(); + cycles--; + } +} +#endif + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + #ifdef XMC_ASSERT_ENABLE +/* API to verify SCU event weather it is valid event or not */ +__STATIC_INLINE bool XMC_SCU_INTERRUPT_IsValidEvent(XMC_SCU_INTERRUPT_EVENT_t event) +{ + return ((event == XMC_SCU_INTERRUPT_EVENT_WDT_WARN) || + (event == XMC_SCU_INTERRUPT_EVENT_RTC_PERIODIC) || + (event == XMC_SCU_INTERRUPT_EVENT_RTC_ALARM) || + (event == XMC_SCU_INTERRUPT_EVENT_VDDPI) || +#if defined(USIC1) + (event == XMC_SCU_INTERRUPT_EVENT_PEUSIC1) || +#endif +#if defined(CAN) + (event == XMC_SCU_INTERRUPT_EVENT_PEMCAN) || +#endif +#if UC_SERIES == XMC14 + (event == XMC_SCU_INTERRUPT_EVENT_LOSS_EXT_CLOCK) || + (event == XMC_SCU_INTERRUPT_EVENT_DCO1_OUT_SYNC) || +#endif +#if defined(COMPARATOR) + (event == XMC_SCU_INTERRUPT_EVENT_ACMP0) || + (event == XMC_SCU_INTERRUPT_EVENT_ACMP1) || + (event == XMC_SCU_INTERRUPT_EVENT_ACMP2) || +#if UC_SERIES == XMC14 + (event == XMC_SCU_INTERRUPT_EVENT_ACMP3) || +#endif +#endif + (event == XMC_SCU_INTERRUPT_EVENT_VDROP) || +#if UC_SERIES != XMC11 + (event == XMC_SCU_INTERRUPT_EVENT_ORC0) || + (event == XMC_SCU_INTERRUPT_EVENT_ORC1) || + (event == XMC_SCU_INTERRUPT_EVENT_ORC2) || + (event == XMC_SCU_INTERRUPT_EVENT_ORC3) || + (event == XMC_SCU_INTERRUPT_EVENT_ORC4) || + (event == XMC_SCU_INTERRUPT_EVENT_ORC5) || + (event == XMC_SCU_INTERRUPT_EVENT_ORC6) || + (event == XMC_SCU_INTERRUPT_EVENT_ORC7) || +#endif + (event == XMC_SCU_INTERRUPT_EVENT_LOCI) || + (event == XMC_SCU_INTERRUPT_EVENT_PESRAM) || + (event == XMC_SCU_INTERRUPT_EVENT_PEUSIC0) || + (event == XMC_SCU_INTERRUPT_EVENT_FLASH_ERROR) || + (event == XMC_SCU_INTERRUPT_EVENT_FLASH_COMPLETED) || + (event == XMC_SCU_INTERRUPT_EVENT_VCLIP) || + (event == XMC_SCU_INTERRUPT_EVENT_STDBYCLKFAIL) || + (event == XMC_SCU_INTERRUPT_EVENT_RTCCTR_UPDATED) || + (event == XMC_SCU_INTERRUPT_EVENT_RTCATIM0_UPDATED) || + (event == XMC_SCU_INTERRUPT_EVENT_RTCATIM1_UPDATED) || + (event == XMC_SCU_INTERRUPT_EVENT_RTCTIM0_UPDATED) || + (event == XMC_SCU_INTERRUPT_EVENT_RTCTIM1_UPDATED) || + (event == XMC_SCU_INTERRUPT_EVENT_TSE_DONE) || + (event == XMC_SCU_INTERRUPT_EVENT_TSE_HIGH) || + (event == XMC_SCU_INTERRUPT_EVENT_TSE_LOW)); +} + #endif + +/* API to enable the SCU event */ +void XMC_SCU_INTERRUPT_EnableEvent(const XMC_SCU_INTERRUPT_EVENT_t event) +{ + SCU_INTERRUPT->SRMSK |= (uint32_t)event; +#if UC_SERIES == XMC14 + SCU_INTERRUPT->SRMSK1 |= (uint32_t)(event >> 32U); +#endif +} + +/* API to disable the SCU event */ +void XMC_SCU_INTERRUPT_DisableEvent(const XMC_SCU_INTERRUPT_EVENT_t event) +{ + SCU_INTERRUPT->SRMSK &= ~(uint32_t)event; +#if UC_SERIES == XMC14 + SCU_INTERRUPT->SRMSK1 &= (uint32_t)~(event >> 32U); +#endif +} + +/* API to trigger the SCU event */ +void XMC_SCU_INTERRUPT_TriggerEvent(const XMC_SCU_INTERRUPT_EVENT_t event) +{ + SCU_INTERRUPT->SRSET |= (uint32_t)event; +#if UC_SERIES == XMC14 + SCU_INTERRUPT->SRSET1 |= (uint32_t)(event >> 32U); +#endif +} + +/* API to get the SCU event status */ +XMC_SCU_INTERRUPT_EVENT_t XMC_SCU_INTERUPT_GetEventStatus(void) +{ + XMC_SCU_INTERRUPT_EVENT_t tmp; + + tmp = SCU_INTERRUPT->SRRAW; +#if UC_SERIES == XMC14 + tmp |= ((int64_t)SCU_INTERRUPT->SRRAW1 << 32U); +#endif + return (tmp); +} + +/* API to clear the SCU event status */ +void XMC_SCU_INTERRUPT_ClearEventStatus(const XMC_SCU_INTERRUPT_EVENT_t event) +{ + SCU_INTERRUPT->SRCLR |= (uint32_t)event; +#if UC_SERIES == XMC14 + SCU_INTERRUPT->SRCLR1 |= (uint32_t)(event >> 32U); +#endif +} + +/* API to lock protected bitfields from being modified */ +void XMC_SCU_LockProtectedBits(void) +{ + SCU_GENERAL->PASSWD = SCU_GCU_PASSWD_PROT_ENABLE; +} + +/* API to make protected bitfields available for modification */ +void XMC_SCU_UnlockProtectedBits(void) +{ + SCU_GENERAL->PASSWD = SCU_GCU_PASSWD_PROT_DISABLE; + + while(((SCU_GENERAL->PASSWD) & SCU_GENERAL_PASSWD_PROTS_Msk)) + { + /* Loop until the lock is removed */ + } +} + +/* API to initialize power supply monitoring unit */ +void XMC_SCU_SupplyMonitorInit(const XMC_SCU_SUPPLYMONITOR_t *obj) +{ + uint32_t anavdel; + uint32_t irqmask; + + anavdel = 0UL; + + anavdel |= (uint32_t)((obj-> ext_supply_threshold) << SCU_ANALOG_ANAVDEL_VDEL_SELECT_Pos); + anavdel |= (uint32_t)((obj->ext_supply_monitor_speed) << SCU_ANALOG_ANAVDEL_VDEL_TIM_ADJ_Pos); + + if(true == (obj->enable_at_init)) + { + anavdel |= (uint32_t)SCU_ANALOG_ANAVDEL_VDEL_EN_Msk; + } + SCU_ANALOG->ANAVDEL = (uint16_t) anavdel; + + irqmask = 0UL; + + if(true == (obj->enable_prewarning_int)) + { + irqmask |= (uint32_t)SCU_INTERRUPT_SRMSK_VDDPI_Msk; + } + + if(true == (obj->enable_vdrop_int)) + { + irqmask |= (uint32_t)SCU_INTERRUPT_SRMSK_VDROPI_Msk; + } + + if(true == (obj->enable_vclip_int)) + { + irqmask |= (uint32_t)SCU_INTERRUPT_SRMSK_VCLIPI_Msk; + } + SCU_INTERRUPT->SRMSK |= (uint32_t)irqmask; +} + +/* API to program lower temperature limit */ +XMC_SCU_STATUS_t XMC_SCU_SetTempLowLimit(uint32_t limit) +{ + XMC_SCU_STATUS_t status = XMC_SCU_STATUS_OK; + + limit = XMC_SCU_CalcTSEVAR(limit); + + if (limit != 0) + { + SCU_ANALOG->ANATSEIL = (uint16_t)limit; + } + else + { + status = XMC_SCU_STATUS_ERROR; + } + + return (status); +} + +/* API to program higher temperature limit */ +XMC_SCU_STATUS_t XMC_SCU_SetTempHighLimit(uint32_t limit) +{ + XMC_SCU_STATUS_t status = XMC_SCU_STATUS_OK; + + limit = XMC_SCU_CalcTSEVAR(limit); + + if (limit != 0) + { + SCU_ANALOG->ANATSEIH = (uint16_t)limit; + } + else + { + status = XMC_SCU_STATUS_ERROR; + } + + return (status); +} + +/* API to program temperature limits as raw digital values into temperature sensor */ +void XMC_SCU_SetRawTempLimits(const uint32_t lower_temp, const uint32_t upper_temp) +{ + SCU_ANALOG->ANATSEIH = (uint16_t)(upper_temp & SCU_ANALOG_ANATSEIH_TSE_IH_Msk); + SCU_ANALOG->ANATSEIL = (uint16_t)(lower_temp & SCU_ANALOG_ANATSEIL_TSE_IL_Msk); +} + +/* API to start temperature measurement */ +void XMC_SCU_StartTempMeasurement(void) +{ + SCU_ANALOG->ANATSECTRL |= (uint16_t)SCU_ANALOG_ANATSECTRL_TSE_EN_Msk; +} + +/* API to stop temperature measurement */ +void XMC_SCU_StopTempMeasurement(void) +{ + SCU_ANALOG->ANATSECTRL &= (uint16_t)~SCU_ANALOG_ANATSECTRL_TSE_EN_Msk; +} + +/* API to check if the temperature has gone past the ceiling */ +bool XMC_SCU_HighTemperature(void) +{ + return ((SCU_INTERRUPT->SRRAW & SCU_INTERRUPT_SRRAW_TSE_HIGH_Msk) == SCU_INTERRUPT_SRRAW_TSE_HIGH_Msk); +} + +/* API to check if the temperature is lower than normal */ +bool XMC_SCU_LowTemperature(void) +{ + return ((SCU_INTERRUPT->SRRAW & SCU_INTERRUPT_SRRAW_TSE_LOW_Msk) == SCU_INTERRUPT_SRRAW_TSE_LOW_Msk); +} + +/* API to retrieve the device temperature */ +uint32_t XMC_SCU_GetTemperature(void) +{ + uint32_t temperature; + + temperature = (uint32_t)(SCU_ANALOG->ANATSEMON); + + return (temperature); +} + +/* Calculates the die temperature value using ROM function */ +uint32_t XMC_SCU_CalcTemperature(void) +{ + return (ROM_CalcTemperature()); +} + + +/* API which initializes the clock tree ofthe device */ +void XMC_SCU_CLOCK_Init(const XMC_SCU_CLOCK_CONFIG_t *const config) +{ + /* Remove protection */ + XMC_SCU_UnlockProtectedBits(); + +#if (UC_SERIES == XMC14) + /* OSCHP source selection - OSC mode */ + + if (config->oschp_mode != XMC_SCU_CLOCK_OSCHP_MODE_DISABLED) + { + if (OSCHP_GetFrequency() > 20000000U) + { + SCU_ANALOG->ANAOSCHPCTRL |= (uint16_t)SCU_ANALOG_ANAOSCHPCTRL_HYSCTRL_Msk; + } + + SCU_ANALOG->ANAOSCHPCTRL = (uint16_t)(SCU_ANALOG->ANAOSCHPCTRL & ~(SCU_ANALOG_ANAOSCHPCTRL_SHBY_Msk | SCU_ANALOG_ANAOSCHPCTRL_MODE_Msk)) | + config->oschp_mode; + + do + { + /* Restart OSC_HP oscillator watchdog */ + SCU_INTERRUPT->SRCLR1 = SCU_INTERRUPT_SRCLR1_LOECI_Msk; + + /* Enable OSC_HP oscillator watchdog*/ + SCU_CLK->OSCCSR &= ~SCU_CLK_OSCCSR_XOWDEN_Msk; + SCU_CLK->OSCCSR |= SCU_CLK_OSCCSR_XOWDEN_Msk; + + /* Wait a few DCO2 cycles for the update of the clock detection result */ + delay(2500); + + /* check clock is ok */ + } + while(SCU_INTERRUPT->SRRAW1 & SCU_INTERRUPT_SRRAW1_LOECI_Msk); + } + else /* (config->oschp_mode == XMC_SCU_CLOCK_OSCHP_MODE_DISABLED) */ + { + SCU_ANALOG->ANAOSCHPCTRL |= SCU_ANALOG_ANAOSCHPCTRL_MODE_Msk; + } + + SCU_ANALOG->ANAOSCLPCTRL = (uint16_t)config->osclp_mode; + + SCU_CLK->CLKCR1 = (SCU_CLK->CLKCR1 & ~SCU_CLK_CLKCR1_DCLKSEL_Msk) | + config->dclk_src; + +#endif + /* Update PCLK selection mux. */ + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~(SCU_CLK_CLKCR_PCLKSEL_Msk | SCU_CLK_CLKCR_RTCCLKSEL_Msk)) | + config->rtc_src | + config->pclk_src; + + /* Close the lock opened above. */ + XMC_SCU_LockProtectedBits(); + + /* Update the dividers now */ + XMC_SCU_CLOCK_ScaleMCLKFrequency(config->idiv, config->fdiv); + +} + +/* API which selects one of the available parent clock nodes for a given child clock node */ +void XMC_SCU_CLOCK_SetRtcClockSource(const XMC_SCU_CLOCK_RTCCLKSRC_t source) +{ + XMC_ASSERT("XMC_SCU_CLOCK_SetRtcSourceClock:Wrong Parent Clock", XMC_SCU_CHECK_RTCCLKSRC(source)); + + XMC_SCU_UnlockProtectedBits(); + + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~SCU_CLK_CLKCR_RTCCLKSEL_Msk) | + source; + + XMC_SCU_LockProtectedBits(); +} + +/* API to program the divider placed between fperiph and its parent */ +void XMC_SCU_CLOCK_SetFastPeripheralClockSource(const XMC_SCU_CLOCK_PCLKSRC_t source) +{ + XMC_SCU_UnlockProtectedBits(); + + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~SCU_CLK_CLKCR_PCLKSEL_Msk) | + source; + + XMC_SCU_LockProtectedBits(); +} + +/* API which gates a clock node at its source */ +void XMC_SCU_CLOCK_GatePeripheralClock(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral) +{ + XMC_SCU_UnlockProtectedBits(); + SCU_CLK->CGATSET0 |= (uint32_t)peripheral; + XMC_SCU_LockProtectedBits(); +} + +/* API which ungates a clock note at its source */ +void XMC_SCU_CLOCK_UngatePeripheralClock(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral) +{ + XMC_SCU_UnlockProtectedBits(); + SCU_CLK->CGATCLR0 |= (uint32_t)peripheral; + while ((SCU_CLK->CLKCR) & SCU_CLK_CLKCR_VDDC2LOW_Msk) + { + /* Wait voltage suply stabilization */ + } + XMC_SCU_LockProtectedBits(); +} + +/* Checks the status of peripheral clock gating */ +bool XMC_SCU_CLOCK_IsPeripheralClockGated(const XMC_SCU_PERIPHERAL_CLOCK_t peripheral) +{ + return (bool)((SCU_CLK->CGATSTAT0 & peripheral) != 0); +} + +/* This API configures main clock (MCLK) frequency to requested frequency value. */ +void XMC_SCU_CLOCK_SetMCLKFrequency(uint32_t freq_khz) +{ + uint32_t ratio; + uint32_t ratio_int; + uint32_t ratio_frac; + +#if UC_SERIES == XMC14 + if (((SCU_CLK->CLKCR1) & SCU_CLK_CLKCR1_DCLKSEL_Msk) == 0U) + { + ratio = DCO1_DIV2_FREQUENCY_KHZ_Q22_10 / freq_khz; + } + else + { + ratio = ((OSCHP_GetFrequency() / 1000U) << 10U) / freq_khz; + } + + /* Manage overflow */ + if (ratio > 0xffffffU) + { + ratio = 0xffffffU; + } + + ratio_int = ratio >> 10U; + ratio_frac = ratio & 0x3ffU; +#else + ratio = DCO1_DIV2_FREQUENCY_KHZ_Q24_8 / freq_khz; + + /* Manage overflow */ + if (ratio > 0xffffU) + { + ratio = 0xffffU; + } + + ratio_int = ratio >> 8U; + ratio_frac = ratio & 0xffU; +#endif + + XMC_SCU_CLOCK_ScaleMCLKFrequency(ratio_int, ratio_frac); +} + + +/* A utility routine which updates the fractional dividers in steps */ +void XMC_SCU_CLOCK_ScaleMCLKFrequency(uint32_t idiv, uint32_t fdiv) +{ + /* Find out current and target value of idiv */ + uint32_t curr_idiv; + + XMC_SCU_UnlockProtectedBits(); + + /* Take a snapshot of value already programmed into IDIV */ + curr_idiv = (SCU_CLK->CLKCR & SCU_CLK_CLKCR_IDIV_Msk) >> SCU_CLK_CLKCR_IDIV_Pos; + +#if (UC_SERIES == XMC14) + SCU_CLK->CLKCR1 = (SCU_CLK->CLKCR1 & (uint32_t)~(SCU_CLK_CLKCR1_FDIV_Msk)) | + (uint32_t)((fdiv >> 8U) << SCU_CLK_CLKCR1_FDIV_Pos); + + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~(SCU_CLK_CLKCR_FDIV_Msk | SCU_CLK_CLKCR_CNTADJ_Msk)) | + (uint32_t)((fdiv & 0xffU) << SCU_CLK_CLKCR_FDIV_Pos) | + (uint32_t)(1023UL << SCU_CLK_CLKCR_CNTADJ_Pos); +#else + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~(SCU_CLK_CLKCR_FDIV_Msk | SCU_CLK_CLKCR_CNTADJ_Msk)) | + (uint32_t)(fdiv << SCU_CLK_CLKCR_FDIV_Pos) | + (uint32_t)(1023UL << SCU_CLK_CLKCR_CNTADJ_Pos); +#endif + + while ((SCU_CLK->CLKCR)& SCU_CLK_CLKCR_VDDC2LOW_Msk) + { + /* Spin until the core supply stabilizes */ + } + + if(curr_idiv <= idiv) + { + /* Requested IDIV is greater than currently programmed IDIV. So downscale the frequency */ + XMC_SCU_CLOCK_lFrequencyDownScaling(curr_idiv, idiv); + } + else + { + /* Requested IDIV is lower than currently programmed IDIV. So upscale the frequency */ + XMC_SCU_CLOCK_lFrequencyUpScaling(curr_idiv, idiv); + } + + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~(SCU_CLK_CLKCR_IDIV_Msk | SCU_CLK_CLKCR_CNTADJ_Msk)) | + (uint32_t)(idiv << SCU_CLK_CLKCR_IDIV_Pos) | (uint32_t)(1023UL << SCU_CLK_CLKCR_CNTADJ_Pos); + + while ((SCU_CLK->CLKCR) & SCU_CLK_CLKCR_VDDC2LOW_Msk) + { + /* Wait voltage suply stabilization */ + } + + XMC_SCU_LockProtectedBits(); + + SystemCoreClockUpdate(); + +} + +/* Utility routine to perform frequency up scaling */ +static void XMC_SCU_CLOCK_lFrequencyUpScaling(uint32_t curr_idiv, uint32_t target_idiv) +{ + while (curr_idiv > (target_idiv * 4UL)) + { + curr_idiv = (uint32_t)(curr_idiv >> 2UL); /* Divide by 4. */ + + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~(SCU_CLK_CLKCR_IDIV_Msk | SCU_CLK_CLKCR_CNTADJ_Msk)) | + (uint32_t)(curr_idiv << SCU_CLK_CLKCR_IDIV_Pos) | + (uint32_t)(1023UL << SCU_CLK_CLKCR_CNTADJ_Pos); + + while (SCU_CLK->CLKCR & SCU_CLK_CLKCR_VDDC2LOW_Msk) + { + /* Wait voltage suply stabilization */ + } + } +} + +/* Utility routine to perform frequency down scaling */ +static void XMC_SCU_CLOCK_lFrequencyDownScaling(uint32_t curr_idiv, uint32_t target_idiv) +{ + + while ((curr_idiv * 4UL) < target_idiv) + { + if(0U == curr_idiv) + { + curr_idiv = 1U; + } + curr_idiv = (uint32_t)(curr_idiv << 2UL); /* Multiply by 4. */ + SCU_CLK->CLKCR = (SCU_CLK->CLKCR & (uint32_t)~(SCU_CLK_CLKCR_IDIV_Msk | SCU_CLK_CLKCR_CNTADJ_Msk)) | + (uint32_t)(curr_idiv << SCU_CLK_CLKCR_IDIV_Pos) | + (uint32_t)(1023UL << SCU_CLK_CLKCR_CNTADJ_Pos); + + while (SCU_CLK->CLKCR & SCU_CLK_CLKCR_VDDC2LOW_Msk) + { + /* Wait voltage suply stabilization */ + } + } +} + +/* + * API to retrieve clock frequency of peripherals on the peripheral bus using a shared functional clock + */ +uint32_t XMC_SCU_CLOCK_GetPeripheralClockFrequency(void) +{ + return (SystemCoreClock); +} + +/* Provides the clock frequency of peripherals on the peripheral bus that are using a shared functional clock */ +uint32_t XMC_SCU_CLOCK_GetFastPeripheralClockFrequency(void) +{ + return (SystemCoreClock << ((SCU_CLK->CLKCR & SCU_CLK_CLKCR_PCLKSEL_Msk) >> SCU_CLK_CLKCR_PCLKSEL_Pos)); +} + +/* DCO1 clock frequency can be calibrated during runtime to achieve a better accuracy */ +void XMC_SCU_CLOCK_CalibrateOscillatorOnTemperature(int32_t temperature) +{ + int32_t a; + int32_t b; + int32_t d; + int32_t e; + int32_t offset; + + a = *((uint8_t*)DCO_ADJLO_T2); + b = *((uint8_t*)DCO_ADJLO_T1); + d = *((uint8_t*)ANA_TSE_T1); + e = *((uint8_t*)ANA_TSE_T2); + + offset = b + (((a - b) * (temperature - d)) / (e - d)); + offset &= SCU_ANALOG_ANAOFFSET_ADJL_OFFSET_Msk; + + XMC_SCU_UnlockProtectedBits(); + SCU_ANALOG->ANAOFFSET = (uint16_t)offset; + XMC_SCU_LockProtectedBits(); +} + +/* + * API to assign the event handler function to be executed on occurrence of the selected event + */ +XMC_SCU_STATUS_t XMC_SCU_INTERRUPT_SetEventHandler(XMC_SCU_INTERRUPT_EVENT_t event, XMC_SCU_INTERRUPT_EVENT_HANDLER_t handler) +{ + uint32_t index; + XMC_SCU_STATUS_t status; + + XMC_ASSERT("XMC_SCU_INTERRUPT_SetEventHandler: Invalid event", XMC_SCU_INTERRUPT_IsValidEvent(event)); + XMC_ASSERT("XMC_SCU_INTERRUPT_SetEventHandler: Invalid handler", handler != NULL); + + index = 0U; + + while (((event & ((XMC_SCU_INTERRUPT_EVENT_t)1 << index)) == 0U) && (index < XMC_SCU_INTERRUPT_EVENT_MAX)) + { + index++; + } + + if (index == XMC_SCU_INTERRUPT_EVENT_MAX) + { + status = XMC_SCU_STATUS_ERROR; + } + else + { + event_handler_list[index] = handler; + status = XMC_SCU_STATUS_OK; + } + + return (status); +} + +/* + * A common function to execute callback functions for multiple events + */ +void XMC_SCU_IRQHandler(uint32_t sr_num) +{ + XMC_ASSERT("XMC_SCU_IRQHandler: Invalid sr_num", sr_num < SCU_IRQ_NUM); + + uint32_t index; + XMC_SCU_INTERRUPT_EVENT_t event; + XMC_SCU_INTERRUPT_EVENT_HANDLER_t event_handler; + + index = 0U; + event = XMC_SCU_INTERUPT_GetEventStatus() & event_masks[sr_num]; + XMC_SCU_INTERRUPT_ClearEventStatus(event); + + while ((event != 0) && (index < XMC_SCU_INTERRUPT_EVENT_MAX)) + { + if ((event & ((XMC_SCU_INTERRUPT_EVENT_t)1 << index)) != 0U) + { + event &= ~((XMC_SCU_INTERRUPT_EVENT_t)1 << index); + event_handler = event_handler_list[index]; + if (event_handler != NULL) + { + event_handler(); + } + + /* break; XMC1: Only PULSE interrupts */ + } + index++; + } +} + +/* Install BMI */ +uint32_t XMC_SCU_SetBMI(uint32_t flags, uint8_t timeout) +{ + return ROM_BmiInstallationReq((flags & 0x0fffU) | ((timeout << 12) & 0xf000U)); +} + +#if (UC_SERIES == XMC14) +/* DCO1 clock frequency can be calibrated during runtime to achieve a better accuracy */ +void XMC_SCU_CLOCK_EnableDCO1ExtRefCalibration(XMC_SCU_CLOCK_SYNC_CLKSRC_t sync_clk, uint32_t prescaler, uint32_t syn_preload) +{ + + XMC_SCU_UnlockProtectedBits(); + SCU_ANALOG->ANASYNC2 = (uint16_t)(prescaler << SCU_ANALOG_ANASYNC2_PRESCALER_Pos); + SCU_ANALOG->ANASYNC1 = (uint16_t)(syn_preload | + sync_clk | + SCU_ANALOG_ANASYNC1_SYNC_DCO_EN_Msk); + + XMC_SCU_LockProtectedBits(); + +} + +/* This function stops the automatic DCO1 calibration based on the selected clock source */ +void XMC_SCU_CLOCK_DisableDCO1ExtRefCalibration(void) +{ + XMC_SCU_UnlockProtectedBits(); + SCU_ANALOG->ANASYNC2 = 0U; + SCU_ANALOG->ANASYNC1 = 0U; + XMC_SCU_LockProtectedBits(); +} + +/* This functions checks the status of the synchronisation */ +bool XMC_SCU_CLOCK_IsDCO1ExtRefCalibrationReady(void) +{ + return (bool)((SCU_ANALOG->ANASYNC2 & SCU_ANALOG_ANASYNC2_SYNC_READY_Msk) != 0U); +} + +/** + * This function enables the watchdog on the DCO1 frequency + */ +void XMC_SCU_CLOCK_EnableDCO1OscillatorWatchdog(void) +{ + SCU_CLK->OSCCSR |= SCU_CLK_OSCCSR_OWDEN_Msk; +} + +/** + * This function disables the watchdog on the DCO1 frequency + */ +void XMC_SCU_CLOCK_DisableDCO1OscillatorWatchdog(void) +{ + SCU_CLK->OSCCSR &= ~SCU_CLK_OSCCSR_OWDEN_Msk; +} + +/** + * This function clears the status of the watchdog on the DCO1 frequency + */ +void XMC_SCU_CLOCK_ClearDCO1OscillatorWatchdogStatus(void) +{ + SCU_CLK->OSCCSR |= SCU_CLK_OSCCSR_OWDRES_Msk; +} + +/** + * This function checks if the DCO1 frequency is in the limits of the watchdog. + */ +bool XMC_SCU_CLOCK_IsDCO1ClockFrequencyUsable(void) +{ + return ((SCU_CLK->OSCCSR & (SCU_CLK_OSCCSR_OSC2L_Msk | SCU_CLK_OSCCSR_OSC2H_Msk)) == 0U); +} + +/* This function selects service request source for a NVIC interrupt node */ +void XMC_SCU_SetInterruptControl(uint8_t irq_number, XMC_SCU_IRQCTRL_t source) +{ + XMC_ASSERT("XMC_SCU_SetInterruptControl: Invalid irq_number", irq_number < 32); + XMC_ASSERT("XMC_SCU_SetInterruptControl: Invalid source", (source >> 8) == irq_number); + + source &= 0x3U; + if (irq_number < 16U) + { + SCU_GENERAL->INTCR0 = (SCU_GENERAL->INTCR0 & ~(SCU_GENERAL_INTCR_INTSEL_Msk << (irq_number * SCU_GENERAL_INTCR_INTSEL_Size))) | + (source << (irq_number * SCU_GENERAL_INTCR_INTSEL_Size)); + } + else + { + irq_number &= 0x0fU; + SCU_GENERAL->INTCR1 = (SCU_GENERAL->INTCR1 & ~(SCU_GENERAL_INTCR_INTSEL_Msk << (irq_number * SCU_GENERAL_INTCR_INTSEL_Size))) | + (source << (irq_number * SCU_GENERAL_INTCR_INTSEL_Size)); + } +} + +#endif +#endif /* UC_FAMILY == XMC1 */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_acmp.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_acmp.c new file mode 100644 index 00000000..5e49a6f6 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_acmp.c @@ -0,0 +1,119 @@ +/** + * @file xmc_acmp.c + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2014-12-10: + * - Initial
+ * 2015-02-20: + * - Removed unused declarations
+ * 2015-05-08: + * - Fixed sequence problem of low power mode in XMC_ACMP_Init() API
+ * - Fixed wrong register setting in XMC_ACMP_SetInput() API
+ * - Removed return type variable and by default comparator enable from XMC_ACMP_Init() API.
+ * Additional call to XMC_ACMP_EnableComparator() API needed to start Comparator after Init.
+ * 2015-06-04: + * - Removed return type variable and by default comparator enable from XMC_ACMP_Init() API.
+ * - Divided XMC_ACMP_SetInput into two 3 APIs to reduce the code size and complexity as stated below
+ * (a)XMC_ACMP_EnableReferenceDivider
+ * (b)XMC_ACMP_DisableReferenceDivider
+ * (c)XMC_ACMP_SetInput
+ * - Optimized enable and disable API's and moved to header file as static inline APIs. + * - XMC_ACMP_t typedef changed to structure which overrides the standard header file structure. + * 2015-06-20: + * - Removed definition of GetDriverVersion API + * @endcond + * + */ + + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +/* If ACMP is available*/ +#if defined (COMPARATOR) + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +#define XMC_ACMP_INSTANCE_1 (1U) /* Instance number for Slice-1 */ + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* API to initialize an instance of ACMP module */ +void XMC_ACMP_Init(XMC_ACMP_t *const peripheral, uint32_t instance, const XMC_ACMP_CONFIG_t *const config) +{ + + XMC_ASSERT("XMC_ACMP_Init:NULL Configuration", (config != (XMC_ACMP_CONFIG_t *)NULL)) + XMC_ASSERT("XMC_ACMP_Init:Wrong module pointer", XMC_ACMP_CHECK_MODULE_PTR(peripheral)) + XMC_ASSERT("XMC_ACMP_Init:Wrong instance number", XMC_ACMP_CHECK_INSTANCE(instance) ) + + /* + * Initializes the comparator with configuration supplied. Low power node setting is retained during initialization. + * All the instances passed are handled with low power setting, to avoid conditional check for ACMP0 instance. + * This reduces the code size. No side effects, because this register bit field is empty for other instances. + */ + peripheral->ANACMP[instance] = ((peripheral->ANACMP[instance] & (uint32_t)COMPARATOR_ANACMP0_CMP_LPWR_Msk)) | + (uint32_t)config->anacmp; +} + +/* API to select INP source */ +void XMC_ACMP_SetInput(XMC_ACMP_t *const peripheral, uint32_t instance, XMC_ACMP_INP_SOURCE_t source) +{ + XMC_ASSERT("XMC_ACMP_SetInput:Wrong module pointer", XMC_ACMP_CHECK_MODULE_PTR(peripheral)) + XMC_ASSERT("XMC_ACMP_SetInput:Wrong instance number", ((instance != XMC_ACMP_INSTANCE_1) && + XMC_ACMP_CHECK_INSTANCE(instance)) ) + XMC_ASSERT("XMC_ACMP_SetInput:Wrong input source", ((source == XMC_ACMP_INP_SOURCE_STANDARD_PORT) || + (source == XMC_ACMP_INP_SOURCE_ACMP1_INP_PORT)) ) + + /* + * Three options of Input Setting are listed below + * 1. The comparator inputs aren't connected to other comparator inputs + * 2. Can program the comparators to connect ACMP0.INP to ACMP1.INP in XMC1200 AA or XMC1300 AA + * Can program the comparators to connect ACMP0.INN to ACMP1.INP in XMC1200 AB or XMC1300 AB or XMC1400 AA + * 3. Can program the comparators to connect ACMP2.INP to ACMP1.INP + * 4. Can program the comparators to connect ACMP3.INP to ACMP1.INP in XMC1400 + */ + peripheral->ANACMP[instance] = ((peripheral->ANACMP[instance] & (uint32_t)(~COMPARATOR_ANACMP0_ACMP0_SEL_Msk))) | + (uint32_t)source; +} + +#endif /* #ifdef ACMP_AVAILABLE */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_bccu.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_bccu.c new file mode 100644 index 00000000..731aab60 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_bccu.c @@ -0,0 +1,577 @@ +/** + * @file xmc_bccu.c + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-19: + * - Initial draft
+ * + * 2015-05-08: + * - Minor bug fixes in following APIs: XMC_BCCU_ConcurrentStartDimming(), XMC_BCCU_ConcurrentAbortDimming(), + * XMC_BCCU_SetGlobalDimmingLevel()
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * Detailed description of file:
+ * APIs for the functional blocks of BCCU have been defined:
+ * -- GLOBAL configuration
+ * -- Clock configuration, Function/Event configuration, Interrupt configuration
+ * + * @endcond + * + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +#if defined(BCCU0) +#include + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_BCCU_NO_OF_CHANNELS (9U) +#define XMC_BCCU_CHANNEL_MASK ((0x1 << XMC_BCCU_NO_OF_CHANNELS)-1) +#define XMC_BCCU_NO_OF_DIM_ENGINE (3U) +#define XMC_BCCU_DIM_ENGINE_MASK (((0x1 << XMC_BCCU_NO_OF_DIM_ENGINE)-1)) + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * GLOBAL DATA + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * LOCAL/UTILITY ROUTINES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* + * API to initialise the global resources of a BCCU module + */ +void XMC_BCCU_GlobalInit(XMC_BCCU_t *const bccu, const XMC_BCCU_GLOBAL_CONFIG_t *const config) +{ + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_BCCU0); + + bccu->GLOBCON = config->globcon; + + bccu->GLOBCLK = config->globclk; + bccu->GLOBDIM = config->global_dimlevel; + +} + +/* + * API to configure the global trigger mode & delay of a BCCU module + */ +void XMC_BCCU_ConfigGlobalTrigger(XMC_BCCU_t *const bccu, XMC_BCCU_TRIGMODE_t mode, XMC_BCCU_TRIGDELAY_t delay) +{ + bccu->GLOBCON &= ~(uint32_t)(BCCU_GLOBCON_TM_Msk | BCCU_GLOBCON_TRDEL_Msk); + bccu->GLOBCON |= ((uint32_t)mode | ((uint32_t)delay << BCCU_GLOBCON_TRDEL_Pos)); +} + +/* + * API to configure the trap input selection of a BCCU module + */ +void XMC_BCCU_SelectTrapInput (XMC_BCCU_t *const bccu, XMC_BCCU_CH_TRAP_IN_t input) +{ + bccu->GLOBCON &= ~(uint32_t)(BCCU_GLOBCON_TRAPIS_Msk); + bccu->GLOBCON |= ((uint32_t)input << BCCU_GLOBCON_TRAPIS_Pos); +} + +/* + * API to configure the trap edge selection of a BCCU module + */ +void XMC_BCCU_SetTrapEdge (XMC_BCCU_t *const bccu, XMC_BCCU_CH_TRAP_EDGE_t edge) +{ + bccu->GLOBCON &= ~(uint32_t)(BCCU_GLOBCON_TRAPED_Msk); + bccu->GLOBCON |= ((uint32_t)edge << BCCU_GLOBCON_TRAPED_Pos); +} + +/* + * API to configure the suspend mode of a BCCU module + */ +void XMC_BCCU_ConfigSuspendMode (XMC_BCCU_t *const bccu, XMC_BCCU_SUSPEND_MODE_t mode) +{ + bccu->GLOBCON &= ~(uint32_t)(BCCU_GLOBCON_SUSCFG_Msk); + bccu->GLOBCON |= ((uint32_t)mode << BCCU_GLOBCON_SUSCFG_Pos); +} + +/* + * API to configure number of consecutive zeroes allowed at modulator output (flicker watch-dog number) + */ +void XMC_BCCU_SetFlickerWDThreshold (XMC_BCCU_t *const bccu, uint32_t threshold_no) +{ + XMC_ASSERT("XMC_BCCU_SetFlickerWDThreshold: Invalid threshold no", (threshold_no <= BCCU_GLOBCON_WDMBN_Msk)); + + bccu->GLOBCON &= ~(uint32_t)(BCCU_GLOBCON_WDMBN_Msk); + bccu->GLOBCON |= (uint32_t)(threshold_no << BCCU_GLOBCON_WDMBN_Pos); +} + +/* + * API to configure the fast clock prescaler factor of a BCCU module + */ +void XMC_BCCU_SetFastClockPrescaler (XMC_BCCU_t *const bccu, uint32_t div) +{ + XMC_ASSERT("XMC_BCCU_SetFastClockPrescaler: Invalid divider value", (div <= BCCU_GLOBCLK_FCLK_PS_Msk)); + + bccu->GLOBCLK &= ~(uint32_t)(BCCU_GLOBCLK_FCLK_PS_Msk); + bccu->GLOBCLK |= div; + +} + +/* + * API to configure the dimmer clock prescaler factor of a BCCU module + */ +void XMC_BCCU_SetDimClockPrescaler (XMC_BCCU_t *const bccu, uint32_t div) +{ + XMC_ASSERT("XMC_BCCU_SetDimClockPrescaler: Invalid divider value", (div <= BCCU_GLOBCLK_DCLK_PS_Msk)); + + bccu->GLOBCLK &= ~(uint32_t)(BCCU_GLOBCLK_DCLK_PS_Msk); + bccu->GLOBCLK |= (uint32_t)(div << BCCU_GLOBCLK_DCLK_PS_Pos); + +} + +/* + * API to configure the modulator output (bit-time) clock prescaler factor of a BCCU module + */ +void XMC_BCCU_SelectBitClock (XMC_BCCU_t *const bccu, XMC_BCCU_BCLK_MODE_t div) +{ + bccu->GLOBCLK &= ~(uint32_t)(BCCU_GLOBCLK_BCS_Msk); + bccu->GLOBCLK |= ((uint32_t)div << BCCU_GLOBCLK_BCS_Pos); +} + +/* + * API to enable the channels at the same time + */ +void XMC_BCCU_ConcurrentEnableChannels (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentEnableChannels: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK)); + + bccu->CHEN |= mask; +} + +/* + * API to disable the channels at the same time + */ +void XMC_BCCU_ConcurrentDisableChannels (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentDisableChannels: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK)); + bccu->CHEN &= ~(uint32_t)(mask); +} + +/* + * API to set the channel's output passive levels at the same time + */ +void XMC_BCCU_ConcurrentSetOutputPassiveLevel(XMC_BCCU_t *const bccu, uint32_t chan_mask, XMC_BCCU_CH_ACTIVE_LEVEL_t level) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentSetOutputPassiveLevel: Invalid channel mask", (chan_mask <= XMC_BCCU_CHANNEL_MASK)); + + bccu->CHOCON &= ~(uint32_t)(chan_mask); + bccu->CHOCON |= (chan_mask * (uint32_t)level); +} + +/* + * API to enable the various types of traps at the same time + */ +void XMC_BCCU_ConcurrentEnableTrap (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentEnableTrap: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK)); + + bccu->CHOCON |= (uint32_t)(mask << BCCU_CHOCON_CH0TPE_Pos); +} + +/* + * API to disable the various types of traps at the same time + */ +void XMC_BCCU_ConcurrentDisableTrap (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentDisableTrap: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK)); + + bccu->CHOCON &= ~(uint32_t)(mask << BCCU_CHOCON_CH0TPE_Pos); +} + +/* + * API to configure trigger mode and trigger delay at the same time, and also configure the channel enable + */ +void XMC_BCCU_ConcurrentConfigTrigger (XMC_BCCU_t *const bccu, XMC_BCCU_TRIG_CONFIG_t *trig) +{ + uint32_t reg; + + XMC_ASSERT("XMC_BCCU_ConcurrentConfigTrigger: Invalid channel mask", (trig->mask_chans <= XMC_BCCU_CHANNEL_MASK)); + + bccu->GLOBCON &= ~(uint32_t)(BCCU_GLOBCON_TM_Msk | BCCU_GLOBCON_TRDEL_Msk); + bccu->GLOBCON |= ((uint32_t)trig->mode | ((uint32_t)trig->delay << BCCU_GLOBCON_TRDEL_Pos)); + reg = 0U; + reg |= trig->mask_chans; + reg |= ((uint32_t)trig->mask_trig_lines << BCCU_CHTRIG_TOS0_Pos); + bccu->CHTRIG = reg; +} + +/* + * API to start the linear walk of the channels to change towards target intensity at the same time + */ +void XMC_BCCU_ConcurrentStartLinearWalk (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentStartLinearWalk: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK)); + + bccu->CHSTRCON |= (uint32_t)(mask); +} + +/* + * API to abort the linear walk of the channels at the same time + */ +void XMC_BCCU_ConcurrentAbortLinearWalk (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentAbortLinearWalk: Invalid channel mask", (mask <= XMC_BCCU_CHANNEL_MASK)); + + bccu->CHSTRCON |= (uint32_t)(mask << BCCU_CHSTRCON_CH0A_Pos); +} + +/* + * API to enable the dimming engines at the same time + */ +void XMC_BCCU_ConcurrentEnableDimmingEngine (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentEnableDimmingEngine: Invalid dimming engine mask", (mask <= XMC_BCCU_DIM_ENGINE_MASK)); + + bccu->DEEN = (uint32_t)(mask); +} + +/* + * API to enable the dimming engines at the same time + */ +void XMC_BCCU_ConcurrentDisableDimmingEngine (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentDisableDimmingEngine: Invalid dimming engine mask", (mask <= XMC_BCCU_DIM_ENGINE_MASK)); + + bccu->DEEN &= ~(uint32_t)(mask); +} + +/* + * API to start the dimming engines at the same time to change towards target dim level + */ +void XMC_BCCU_ConcurrentStartDimming (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentStartDimming: Invalid dimming engine mask", (mask <= XMC_BCCU_DIM_ENGINE_MASK)); + + bccu->DESTRCON = (uint32_t)(mask); +} + +/* + * API to abort the dimming engines at the same time + */ +void XMC_BCCU_ConcurrentAbortDimming (XMC_BCCU_t *const bccu, uint32_t mask) +{ + XMC_ASSERT("XMC_BCCU_ConcurrentAbortDimming: Invalid dimming engine mask", (mask <= XMC_BCCU_DIM_ENGINE_MASK)); + + bccu->DESTRCON = (uint32_t)(mask << BCCU_DESTRCON_DE0A_Pos); +} + +/* + * API to configure the dim level of a dimming engine + */ +void XMC_BCCU_SetGlobalDimmingLevel (XMC_BCCU_t *const bccu, uint32_t level) +{ + XMC_ASSERT("XMC_BCCU_SetGlobalDimmingLevel: Invalid global dimming level", (level <= BCCU_GLOBDIM_GLOBDIM_Msk)); + + bccu->GLOBDIM = level; +} + +/* + * API to enable a specific channel + */ +void XMC_BCCU_EnableChannel (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + XMC_ASSERT("XMC_BCCU_EnableChannel: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1))); + + bccu->CHEN |= (uint32_t)(BCCU_CHEN_ECH0_Msk << chan_no); +} + +/* + * API to disable a specific channel + */ +void XMC_BCCU_DisableChannel (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + XMC_ASSERT("XMC_BCCU_DisableChannel: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1))); + + bccu->CHEN &= ~(uint32_t)(BCCU_CHEN_ECH0_Msk << chan_no); +} + +/* + * API to set the specific channel's passive level + */ +void XMC_BCCU_SetOutputPassiveLevel(XMC_BCCU_t *const bccu, uint32_t chan_no, XMC_BCCU_CH_ACTIVE_LEVEL_t level) +{ + XMC_ASSERT("XMC_BCCU_SetOutputPassiveLevel: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1))); + + bccu->CHOCON |= ((uint32_t)level << chan_no); +} + +/* + * API to enable the specific channel trap + */ +void XMC_BCCU_EnableTrap (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + XMC_ASSERT("XMC_BCCU_EnableTrap: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1))); + + bccu->CHOCON |= (uint32_t)(BCCU_CHOCON_CH0TPE_Msk << chan_no); +} + +/* + * API to disable the specific channel trap + */ +void XMC_BCCU_DisableTrap (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + XMC_ASSERT("XMC_BCCU_DisableTrap: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1))); + + bccu->CHOCON &= ~(uint32_t)(BCCU_CHOCON_CH0TPE_Msk << chan_no); +} + +/* + * API to configure specific channel trigger enable and trigger line. + */ +void XMC_BCCU_EnableChannelTrigger (XMC_BCCU_t *const bccu, uint32_t chan_no, XMC_BCCU_CH_TRIGOUT_t trig_line) +{ + uint32_t reg; + XMC_ASSERT("XMC_BCCU_EnableChannelTrigger: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1))); + + bccu->CHTRIG &= ~(uint32_t)(BCCU_CHTRIG_TOS0_Msk << chan_no); + reg = (uint32_t)(BCCU_CHTRIG_ET0_Msk << chan_no); + reg |= ((uint32_t)trig_line << (BCCU_CHTRIG_TOS0_Pos + chan_no)); + bccu->CHTRIG |= reg; +} + +/* + * API to disable specific channel + */ +void XMC_BCCU_DisableChannelTrigger (XMC_BCCU_t *const bccu, uint32_t chan_no) +{ + XMC_ASSERT("XMC_BCCU_DisableChannelTrigger: Invalid channel number", (chan_no <= (XMC_BCCU_NO_OF_CHANNELS-1))); + + bccu->CHTRIG &= ~(uint32_t)(BCCU_CHTRIG_ET0_Msk << chan_no); +} + +/* + * API to initialise the channel of a BCCU module + */ +void XMC_BCCU_CH_Init (XMC_BCCU_CH_t *const channel, const XMC_BCCU_CH_CONFIG_t *const config) +{ + channel->CHCONFIG = config->chconfig; + + channel->PKCMP = config->pkcmp; + + channel->PKCNTR = config->pkcntr; +} + +/* + * API to configure channel trigger edge and force trigger edge + */ +void XMC_BCCU_CH_ConfigTrigger (XMC_BCCU_CH_t *const channel, XMC_BCCU_CH_TRIG_EDGE_t edge, uint32_t force_trig_en) +{ + uint32_t reg; + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_TRED_Msk | BCCU_CH_CHCONFIG_ENFT_Msk); + + reg = ((uint32_t)edge << BCCU_CH_CHCONFIG_TRED_Pos); + reg |= (uint32_t)(force_trig_en << BCCU_CH_CHCONFIG_ENFT_Pos); + channel->CHCONFIG |= reg; +} + +/* + * API to configure the linear walker clock prescaler factor of a BCCU channel + */ +void XMC_BCCU_CH_SetLinearWalkPrescaler (XMC_BCCU_CH_t *const channel, uint32_t clk_div) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_LINPRES_Msk); + channel->CHCONFIG |= (uint32_t)(clk_div << BCCU_CH_CHCONFIG_LINPRES_Pos); +} + +/* + * API to set channel target intensity + */ +void XMC_BCCU_CH_SetTargetIntensity (XMC_BCCU_CH_t *const channel, uint32_t ch_int) +{ + channel->INTS = ch_int; +} + +/* + * API to retrieve the channel actual intensity + */ +uint32_t XMC_BCCU_CH_ReadIntensity (XMC_BCCU_CH_t *const channel) +{ + return (uint32_t)(channel->INT & BCCU_CH_INT_CHINT_Msk); +} + +/* + * API to enable packer. Also configures packer threshold, off-time and on-time compare levels + */ +void XMC_BCCU_CH_EnablePacker (XMC_BCCU_CH_t *const channel, uint32_t thresh, uint32_t off_comp, uint32_t on_comp) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_PEN_Msk | BCCU_CH_CHCONFIG_PKTH_Msk); + channel->CHCONFIG |= thresh; + channel->PKCMP = (off_comp | (uint32_t)(on_comp << BCCU_CH_PKCMP_ONCMP_Pos)); + channel->CHCONFIG |= (uint32_t)BCCU_CH_CHCONFIG_PEN_Msk; +} + +/* + * API to configure packer threshold + */ +void XMC_BCCU_CH_SetPackerThreshold (XMC_BCCU_CH_t *const channel, uint32_t val) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_PKTH_Msk); + channel->CHCONFIG |= val; +} + +/* + * API to configure packer off-time compare level + */ +void XMC_BCCU_CH_SetPackerOffCompare (XMC_BCCU_CH_t *const channel, uint32_t level) +{ + channel->PKCMP &= ~(uint32_t)(BCCU_CH_PKCMP_OFFCMP_Msk); + channel->PKCMP |= level; +} + +/* + * API to configure packer on-time compare level. + */ +void XMC_BCCU_CH_SetPackerOnCompare (XMC_BCCU_CH_t *const channel, uint32_t level) +{ + channel->PKCMP &= ~(uint32_t)(BCCU_CH_PKCMP_ONCMP_Msk); + channel->PKCMP |= (level << BCCU_CH_PKCMP_ONCMP_Pos); +} + +/* + * API to disable a packer. + */ +void XMC_BCCU_CH_DisablePacker (XMC_BCCU_CH_t *const channel) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_PEN_Msk); +} + +/* + * API to set packer off-time counter value + */ +void XMC_BCCU_CH_SetPackerOffCounter (XMC_BCCU_CH_t *const channel, uint32_t cnt_val) +{ + channel->PKCNTR &= ~(uint32_t)(BCCU_CH_PKCNTR_OFFCNTVAL_Msk); + channel->PKCNTR |= cnt_val; +} + +/* + * API to set packer on-time counter value + */ +void XMC_BCCU_CH_SetPackerOnCounter (XMC_BCCU_CH_t *const channel, uint32_t cnt_val) +{ + channel->PKCNTR &= ~(uint32_t)(BCCU_CH_PKCNTR_ONCNTVAL_Msk); + channel->PKCNTR |= (uint32_t)(cnt_val << BCCU_CH_PKCNTR_ONCNTVAL_Pos); +} + +/* + * API to select the dimming engine of a channel + */ +void XMC_BCCU_CH_SelectDimEngine (XMC_BCCU_CH_t *const channel, XMC_BCCU_CH_DIMMING_SOURCE_t sel) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_DSEL_Msk); + channel->CHCONFIG |= ((uint32_t)sel << BCCU_CH_CHCONFIG_DSEL_Pos); +} + +/* + * API to bypass the dimming engine. And the brightness of channel is depending only on + * intensity of the channel. + */ +void XMC_BCCU_CH_EnableDimmingBypass (XMC_BCCU_CH_t *const channel) +{ + channel->CHCONFIG |= (uint32_t)(BCCU_CH_CHCONFIG_DBP_Msk); +} + +/* + * API to disable the bypass of dimming engine. And the brightness of channel is depending + * on intensity of channel and dimming level of dimming engine. + */ +void XMC_BCCU_CH_DisableDimmingBypass (XMC_BCCU_CH_t *const channel) +{ + channel->CHCONFIG &= ~(uint32_t)(BCCU_CH_CHCONFIG_DBP_Msk); +} + +/* + * API to initialise a specific dimming engine of a BCCU module + */ +void XMC_BCCU_DIM_Init (XMC_BCCU_DIM_t *const dim_engine, const XMC_BCCU_DIM_CONFIG_t *const config) +{ + dim_engine->DTT = config->dtt; +} + +/* + * API to set dimming engine target dim level + */ +void XMC_BCCU_DIM_SetTargetDimmingLevel (XMC_BCCU_DIM_t *const dim_engine, uint32_t level) +{ + dim_engine->DLS = level; +} + +/* + * API to configure the dimming clock prescaler factor of a dimming engine + */ +void XMC_BCCU_DIM_SetDimDivider (XMC_BCCU_DIM_t *const dim_engine, uint32_t div) +{ + dim_engine->DTT &= ~(uint32_t)(BCCU_DE_DTT_DIMDIV_Msk); + dim_engine->DTT |= div; +} + +/* + * API to configure the dimming curve + */ +void XMC_BCCU_DIM_ConfigDimCurve (XMC_BCCU_DIM_t *const dim_engine, uint32_t dither_en, XMC_BCCU_DIM_CURVE_t sel) +{ + uint32_t reg; + dim_engine->DTT &= ~(uint32_t)(BCCU_DE_DTT_DTEN_Msk | BCCU_DE_DTT_CSEL_Msk); + reg = (uint32_t)(dither_en << BCCU_DE_DTT_DTEN_Pos); + reg |= ((uint32_t)sel << BCCU_DE_DTT_CSEL_Pos); + dim_engine->DTT |= reg; +} + +#endif /* BCCU0 */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_can.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_can.c new file mode 100644 index 00000000..547ebc39 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_can.c @@ -0,0 +1,744 @@ +/** + * @file xmc_can.c + * @date 2016-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * + * 2015-05-20: + * - New API added: XMC_CAN_MO_ReceiveData()
+ * - XMC_CAN_MO_Config() signature has changed
+ * - Minor fix in XMC_CAN_TXFIFO_ConfigMOSlaveObject().
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * 2015-09-01: + * - Removed fCANB clock support
+ * + * 2015-09-08: + * - Fixed bug in XMC_CAN_Init()
+ * + * 2016-06-07: + * - Changed XMC_CAN_AllocateMOtoNodeList to wait for ready status of list controller + * + * 2015-06-20: + * - Fixed bug in XMC_CAN_MO_Config()
+ * @endcond + * + */ + +/******************************************************************************* + * HEADER FILES + *******************************************************************************/ +#include "xmc_can.h" + +#if defined(CAN) +#include "xmc_scu.h" + +__STATIC_INLINE uint32_t max(uint32_t a, uint32_t b) +{ + return (a > b) ? a : b; +} + +__STATIC_INLINE uint32_t min(uint32_t a, uint32_t b) +{ + return (a < b) ? a : b; +} + +/******************************************************************************* + * API IMPLEMENTATION + *******************************************************************************/ + +/* Baudrate Configuration */ +void XMC_CAN_NODE_NominalBitTimeConfigure (XMC_CAN_NODE_t *const can_node, + const XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t *const can_bit_time) +{ + uint32_t temp_brp = 12U ; + uint32_t temp_tseg1 = 12U; + uint32_t best_brp = 0U; + uint32_t best_tseg1 = 1U; + uint32_t best_tseg2 = 0U; + uint32_t best_tbaud = 0U; + uint32_t best_error = 10000U; + + XMC_ASSERT("XMC_CAN_NODE_NOMINAL_BIT_TIME_Configure: rate not supported", (can_bit_time->baudrate < 1000000U) || + (can_bit_time->baudrate >= 100000U)); + XMC_ASSERT("XMC_CAN_NODE_NOMINAL_BIT_TIME_Configure: fCAN not supported", + can_bit_time->can_frequency <= 120000000U); + XMC_ASSERT("XMC_CAN_NODE_NOMINAL_BIT_TIME_Configure: fCAN not supported", + can_bit_time->can_frequency > 5000000U); + XMC_ASSERT("XMC_CAN_NODE_NOMINAL_BIT_TIME_Configure: sample point not supported", + (can_bit_time->sample_point < 10000U) && ((can_bit_time->sample_point > 0U))); + + /* + * Bit timing & sampling + * Tq = (BRP+1)/Fcan if DIV8 = 0 + * Tq = 8*(BRP+1)/Fcan if DIV8 = 1 + * TSync = 1.Tq + * TSeg1 = (TSEG1+1)*Tq >= 3Tq + * TSeg2 = (TSEG2+1)*Tq >= 2Tq + * Bit Time = TSync + TSeg1 + TSeg2 >= 8Tq + * + * Resynchronization: + * + * Tsjw = (SJW + 1)*Tq + * TSeg1 >= Tsjw + Tprop + * TSeg2 >= Tsjw + */ + /* search for best baudrate */ + for (temp_brp = 1U; temp_brp <= 64U; temp_brp++) + { + + uint32_t f_quanta = (uint32_t)((can_bit_time->can_frequency * 10U) / temp_brp); + uint32_t temp_tbaud = (uint32_t)(f_quanta / (can_bit_time->baudrate)); + uint32_t temp_baudrate; + uint32_t error; + + if((temp_tbaud % 10U) > 5U) + { + temp_tbaud = (uint32_t)(temp_tbaud / 10U); + temp_tbaud++; + } + else + { + temp_tbaud = (uint32_t)(temp_tbaud / 10U); + } + + if(temp_tbaud > 0U) + { + temp_baudrate = (uint32_t) (f_quanta / (temp_tbaud * 10U)); + } + else + { + temp_baudrate = f_quanta / 10U; + temp_tbaud = 1; + } + + if(temp_baudrate >= can_bit_time->baudrate) + { + error = temp_baudrate - can_bit_time->baudrate; + } + else + { + error = can_bit_time->baudrate - temp_baudrate; + } + + if ((temp_tbaud <= 20U) && (best_error > error)) + { + best_brp = temp_brp; + best_tbaud = temp_tbaud; + best_error = (error); + + if (error < 1000U) + { + break; + } + } + } + /* search for best sample point */ + best_error = 10000U; + + for (temp_tseg1 = 64U; temp_tseg1 >= 3U; temp_tseg1--) + { + uint32_t tempSamplePoint = ((temp_tseg1 + 1U) * 10000U) / best_tbaud; + uint32_t error; + if (tempSamplePoint >= can_bit_time->sample_point) + { + error = tempSamplePoint - can_bit_time->sample_point; + } + else + { + error = can_bit_time->sample_point - tempSamplePoint; + } + if (best_error > error) + { + best_tseg1 = temp_tseg1; + best_error = error; + } + if (tempSamplePoint < (can_bit_time->sample_point)) + { + break; + } + } + + best_tseg2 = best_tbaud - best_tseg1 - 1U; + + XMC_CAN_NODE_EnableConfigurationChange(can_node); + /* Configure bit timing register */ + can_node->NBTR = (((uint32_t)(best_tseg2 - 1u) << CAN_NODE_NBTR_TSEG2_Pos) & (uint32_t)CAN_NODE_NBTR_TSEG2_Msk) | + ((((uint32_t)((uint32_t)(can_bit_time->sjw)-1U) << CAN_NODE_NBTR_SJW_Pos)) & (uint32_t)CAN_NODE_NBTR_SJW_Msk)| + (((uint32_t)(best_tseg1-1U) << CAN_NODE_NBTR_TSEG1_Pos) & (uint32_t)CAN_NODE_NBTR_TSEG1_Msk)| + (((uint32_t)(best_brp - 1U) << CAN_NODE_NBTR_BRP_Pos) & (uint32_t)CAN_NODE_NBTR_BRP_Msk)| + (((uint32_t)0U << CAN_NODE_NBTR_DIV8_Pos) & (uint32_t)CAN_NODE_NBTR_DIV8_Msk); + XMC_CAN_NODE_DisableConfigurationChange(can_node); +} +/* Function to allocate message object from free list to node list */ +void XMC_CAN_AllocateMOtoNodeList(XMC_CAN_t *const obj, const uint8_t node_num, const uint8_t mo_num) +{ + /* wait while panel operation is in progress. */ + while (XMC_CAN_IsPanelControlReady(obj) == false) + { + /*Do nothing*/ + }; + + /* Panel Command for allocation of MO to node list */ + XMC_CAN_PanelControl(obj, XMC_CAN_PANCMD_STATIC_ALLOCATE,mo_num,(node_num + 1U)); +} + +/* Disable XMC_CAN Peripheral */ +void XMC_CAN_Disable(XMC_CAN_t *const obj) +{ + /* Disable CAN Module */ + obj->CLC = CAN_CLC_DISR_Msk; +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_MCAN); +#endif +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_MCAN); +#endif +} + +/* Enable XMC_CAN Peripheral */ +void XMC_CAN_Enable(XMC_CAN_t *const obj) +{ +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_MCAN); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_MCAN); +#endif + /* Enable CAN Module */ + obj->CLC &= ~(uint32_t)CAN_CLC_DISR_Msk; + while (obj->CLC & CAN_CLC_DISS_Msk) + { + /*Do nothing*/ + }; +} +#if defined(MULTICAN_PLUS) +uint32_t XMC_CAN_GetBaudrateClockFrequency(XMC_CAN_t *const obj) +{ + uint32_t frequency; + + switch(XMC_CAN_GetBaudrateClockSource(obj)) + { +#if UC_FAMILY == XMC4 + case XMC_CAN_CANCLKSRC_FPERI: + frequency = XMC_SCU_CLOCK_GetPeripheralClockFrequency(); + break; +#else + case XMC_CAN_CANCLKSRC_MCLK: + frequency = XMC_SCU_CLOCK_GetPeripheralClockFrequency(); + break; +#endif + case XMC_CAN_CANCLKSRC_FOHP: + frequency = OSCHP_GetFrequency(); + break; + + default: + frequency = 0; + break; + } + + return frequency; +} + +void XMC_CAN_Init(XMC_CAN_t *const obj, XMC_CAN_CANCLKSRC_t clksrc, uint32_t can_frequency) +{ + uint32_t step_n, step_f; + bool normal_divider; + uint32_t freq_n, freq_f; + uint32_t step; + uint32_t can_frequency_khz; + uint32_t peripheral_frequency_khz; + XMC_CAN_DM_t can_divider_mode; + + uint32_t peripheral_frequency; + /*Enabling the module*/ + XMC_CAN_Enable(obj); + + XMC_CAN_SetBaudrateClockSource(obj, clksrc); + + peripheral_frequency = XMC_CAN_GetBaudrateClockFrequency(obj); + + XMC_ASSERT("XMC_CAN_Init: frequency not supported", can_frequency <= peripheral_frequency); + + /* Normal divider mode */ + step_n = (uint32_t)min(max(0U, (1024U - (peripheral_frequency / can_frequency))), 1023U); + freq_n = (uint32_t) (peripheral_frequency / (1024U - step_n)); + + /* Fractional divider mode */ + can_frequency_khz = (uint32_t) (can_frequency >> 6); + peripheral_frequency_khz = (uint32_t)(peripheral_frequency >> 6); + + step_f = (uint32_t)(min( (((1024U * can_frequency_khz) / peripheral_frequency_khz) ), 1023U )); + freq_f = (uint32_t)((peripheral_frequency_khz * step_f) / 1024U); + freq_f = freq_f << 6; + + normal_divider = (uint32_t)(can_frequency - freq_n) <= (can_frequency - freq_f); + + step = (normal_divider != 0U) ? step_n : step_f; + can_divider_mode = (normal_divider != 0U) ? XMC_CAN_DM_NORMAL : XMC_CAN_DM_FRACTIONAL; + + obj->FDR &= (uint32_t) ~(CAN_FDR_DM_Msk | CAN_FDR_STEP_Msk); + obj->FDR |= ((uint32_t)can_divider_mode << CAN_FDR_DM_Pos) | ((uint32_t)step << CAN_FDR_STEP_Pos); + +} + +void XMC_CAN_SetBaudrateClockSource(XMC_CAN_t *const obj,const XMC_CAN_CANCLKSRC_t source) +{ + obj->MCR = (obj->MCR & ~CAN_MCR_CLKSEL_Msk) | source ; +} + +XMC_CAN_CANCLKSRC_t XMC_CAN_GetBaudrateClockSource(XMC_CAN_t *const obj) +{ + return ((XMC_CAN_CANCLKSRC_t)((obj->MCR & CAN_MCR_CLKSEL_Msk) >> CAN_MCR_CLKSEL_Pos)); +} + +#else +/* Initialization of XMC_CAN GLOBAL Object */ +void XMC_CAN_Init(XMC_CAN_t *const obj, uint32_t can_frequency) +{ + uint32_t step_n, step_f; + bool normal_divider; + uint32_t freq_n, freq_f; + uint32_t step; + uint32_t can_frequency_khz; + uint32_t peripheral_frequency_khz; + XMC_CAN_DM_t can_divider_mode; + + uint32_t peripheral_frequency = (XMC_SCU_CLOCK_GetPeripheralClockFrequency()); + + XMC_ASSERT("XMC_CAN_Init: frequency not supported", can_frequency <= peripheral_frequency); + + /*Enabling the module*/ + XMC_CAN_Enable(obj); + + /* Normal divider mode */ + step_n = (uint32_t)min(max(0U, (1024U - (peripheral_frequency / can_frequency))), 1023U); + freq_n = (uint32_t) (peripheral_frequency / (1024U - step_n)); + + /* Fractional divider mode */ + can_frequency_khz = (uint32_t) (can_frequency >> 6); + peripheral_frequency_khz = (uint32_t)(peripheral_frequency >> 6); + + step_f = (uint32_t)(min( (((1024U * can_frequency_khz) / peripheral_frequency_khz) ), 1023U )); + freq_f = (uint32_t)((peripheral_frequency_khz * step_f) / 1024U); + freq_f = freq_f << 6; + + normal_divider = (uint32_t)(can_frequency - freq_n) <= (can_frequency - freq_f); + + step = (normal_divider != 0U) ? step_n : step_f; + can_divider_mode = (normal_divider != 0U) ? XMC_CAN_DM_NORMAL : XMC_CAN_DM_FRACTIONAL; + + obj->FDR &= (uint32_t) ~(CAN_FDR_DM_Msk | CAN_FDR_STEP_Msk); + obj->FDR |= ((uint32_t)can_divider_mode << CAN_FDR_DM_Pos) | ((uint32_t)step << CAN_FDR_STEP_Pos); +} +#endif + +/* Sets the Identifier of the MO */ +void XMC_CAN_MO_SetIdentifier(XMC_CAN_MO_t *const can_mo, const uint32_t can_identifier) +{ + if ((can_mo->can_mo_ptr->MOAR & CAN_MO_MOAR_IDE_Msk) != (uint32_t)CAN_MO_MOAR_IDE_Msk) + { + can_mo->can_mo_ptr->MOAR = ((can_mo->can_mo_ptr->MOAR) & ~(uint32_t)(CAN_MO_MOAR_ID_Msk)) | + ((can_identifier << XMC_CAN_MO_MOAR_STDID_Pos) & (uint32_t)CAN_MO_MOAR_ID_Msk); + } + else + { + can_mo->can_mo_ptr->MOAR = ((can_mo->can_mo_ptr->MOAR) & ~(uint32_t)(CAN_MO_MOAR_ID_Msk)) | + (can_identifier & (uint32_t)CAN_MO_MOAR_ID_Msk); + } + can_mo->can_identifier = can_identifier; +} + + +/* Gets the Identifier of the MO */ +uint32_t XMC_CAN_MO_GetIdentifier(const XMC_CAN_MO_t *const can_mo) +{ + uint32_t identifier; + if ((can_mo->can_mo_ptr->MOAR & CAN_MO_MOAR_IDE_Msk) != (uint32_t)CAN_MO_MOAR_IDE_Msk) + { + identifier = ((can_mo->can_mo_ptr->MOAR) & (uint32_t)(CAN_MO_MOAR_ID_Msk)) >> XMC_CAN_MO_MOAR_STDID_Pos; + } + else + { + identifier = ((can_mo->can_mo_ptr->MOAR) & (uint32_t)(CAN_MO_MOAR_ID_Msk)); + } + return identifier; +} + +/* Gets the acceptance mask for the CAN MO. */ +uint32_t XMC_CAN_MO_GetAcceptanceMask(const XMC_CAN_MO_t *const can_mo) +{ + uint32_t identifier_mask; + if (((can_mo->can_mo_ptr->MOAMR & CAN_MO_MOAMR_MIDE_Msk) != (uint32_t)CAN_MO_MOAMR_MIDE_Msk) + && ((can_mo->can_mo_ptr->MOAR & CAN_MO_MOAR_IDE_Msk) != (uint32_t)CAN_MO_MOAR_IDE_Msk)) + { + identifier_mask = ((can_mo->can_mo_ptr->MOAMR) & (uint32_t)(CAN_MO_MOAMR_AM_Msk)) >> XMC_CAN_MO_MOAR_STDID_Pos; + } + else + { + identifier_mask = ((can_mo->can_mo_ptr->MOAMR) & (uint32_t)(CAN_MO_MOAMR_AM_Msk)); + } + return identifier_mask; +} + +/* Gets the acceptance mask of the MO */ +void XMC_CAN_MO_SetAcceptanceMask(XMC_CAN_MO_t *const can_mo,const uint32_t can_id_mask) +{ + if (((can_mo->can_mo_ptr->MOAMR & CAN_MO_MOAMR_MIDE_Msk) != (uint32_t)CAN_MO_MOAMR_MIDE_Msk) + && ((can_mo->can_mo_ptr->MOAR & CAN_MO_MOAR_IDE_Msk) != (uint32_t)CAN_MO_MOAR_IDE_Msk)) + { + can_mo->can_mo_ptr->MOAMR = ((can_mo->can_mo_ptr->MOAMR) & ~(uint32_t)(CAN_MO_MOAMR_AM_Msk)) | + (can_id_mask << XMC_CAN_MO_MOAR_STDID_Pos); + } + else + { + can_mo->can_mo_ptr->MOAMR = ((can_mo->can_mo_ptr->MOAMR) & ~(uint32_t)(CAN_MO_MOAMR_AM_Msk)) | + (can_id_mask & (uint32_t)CAN_MO_MOAMR_AM_Msk); + } + can_mo->can_id_mask = can_id_mask; +} + +/* Initialization of XMC_CAN MO Object */ +void XMC_CAN_MO_Config(const XMC_CAN_MO_t *const can_mo) +{ + uint32_t reg; + + /* Configure MPN */ + uint32_t num = ((uint32_t)(can_mo->can_mo_ptr) - CAN_BASE - 0x1000U)/0x0020U; + uint32_t set = (((uint32_t)(num/32) << (CAN_MO_MOIPR_MPN_Pos + 5U)) | ((uint32_t)(num%32) << CAN_MO_MOIPR_MPN_Pos)); + can_mo->can_mo_ptr->MOIPR &= ~(CAN_MO_MOIPR_MPN_Msk); + can_mo->can_mo_ptr->MOIPR |= set; + + if (((can_mo->can_id_mode != (uint32_t) XMC_CAN_FRAME_TYPE_STANDARD_11BITS) && + (can_mo->can_id_mode != (uint32_t) XMC_CAN_FRAME_TYPE_EXTENDED_29BITS)) || + ((can_mo->can_mo_type != XMC_CAN_MO_TYPE_RECMSGOBJ) && + (can_mo->can_mo_type != XMC_CAN_MO_TYPE_TRANSMSGOBJ))) + { + ; /*Do nothing*/ + } + else + { + + /* Disable Message object */ + can_mo->can_mo_ptr->MOCTR = CAN_MO_MOCTR_RESMSGVAL_Msk; + if (can_mo->can_id_mode == (uint32_t)XMC_CAN_FRAME_TYPE_STANDARD_11BITS) + { + reg = can_mo->mo_ar; + reg &= (uint32_t) ~(CAN_MO_MOAR_ID_Msk); + reg |= (can_mo->can_identifier << XMC_CAN_MO_MOAR_STDID_Pos); + can_mo->can_mo_ptr->MOAR = reg; + + reg = can_mo->mo_amr; + reg &= (uint32_t) ~(CAN_MO_MOAMR_AM_Msk); + reg |= (can_mo->can_id_mask << XMC_CAN_MO_MOAR_STDID_Pos); + can_mo->can_mo_ptr->MOAMR = reg; + } + else + { + can_mo->can_mo_ptr->MOAR = can_mo->mo_ar; + can_mo->can_mo_ptr->MOAMR = can_mo->mo_amr; + } + /* Check whether message object is transmit message object */ + if (can_mo->can_mo_type == XMC_CAN_MO_TYPE_TRANSMSGOBJ) + { + /* Set MO as Transmit message object */ + XMC_CAN_MO_UpdateData(can_mo); + can_mo->can_mo_ptr->MOCTR = CAN_MO_MOCTR_SETDIR_Msk; + } + else + { + /* Set MO as Receive message object and set RXEN bit */ + can_mo->can_mo_ptr->MOCTR = CAN_MO_MOCTR_RESDIR_Msk; + } + + /* Reset RTSEL and Set MSGVAL ,TXEN0 and TXEN1 bits */ + can_mo->can_mo_ptr->MOCTR = (CAN_MO_MOCTR_SETTXEN0_Msk | CAN_MO_MOCTR_SETTXEN1_Msk | CAN_MO_MOCTR_SETMSGVAL_Msk | + CAN_MO_MOCTR_SETRXEN_Msk | CAN_MO_MOCTR_RESRTSEL_Msk); + } +} + +/* Update of XMC_CAN Object */ +XMC_CAN_STATUS_t XMC_CAN_MO_UpdateData(const XMC_CAN_MO_t *const can_mo) +{ + XMC_CAN_STATUS_t error = XMC_CAN_STATUS_MO_NOT_ACCEPTABLE; + /* Check whether message object is transmit message object */ + if (can_mo->can_mo_type == XMC_CAN_MO_TYPE_TRANSMSGOBJ) + { + can_mo->can_mo_ptr->MOCTR = CAN_MO_MOCTR_RESMSGVAL_Msk; + /* Configure data length */ + can_mo->can_mo_ptr->MOFCR = ((can_mo->can_mo_ptr->MOFCR) & ~(uint32_t)(CAN_MO_MOFCR_DLC_Msk)) | + (((uint32_t) can_mo->can_data_length << CAN_MO_MOFCR_DLC_Pos) & (uint32_t)CAN_MO_MOFCR_DLC_Msk); + /* Configure Data registers*/ + can_mo->can_mo_ptr->MODATAL = can_mo->can_data[0]; + can_mo->can_mo_ptr->MODATAH = can_mo->can_data[1]; + /* Reset RTSEL and Set MSGVAL ,TXEN0 and TXEN1 bits */ + can_mo->can_mo_ptr->MOCTR = (CAN_MO_MOCTR_SETNEWDAT_Msk| CAN_MO_MOCTR_SETMSGVAL_Msk |CAN_MO_MOCTR_RESRTSEL_Msk); + error = XMC_CAN_STATUS_SUCCESS; + } + else + { + error = XMC_CAN_STATUS_MO_NOT_ACCEPTABLE; + } + return error; +} + +/* This function is will put a transmit request to transmit message object */ +XMC_CAN_STATUS_t XMC_CAN_MO_Transmit(const XMC_CAN_MO_t *const can_mo) +{ + XMC_CAN_STATUS_t error = XMC_CAN_STATUS_ERROR; + uint32_t mo_type = (uint32_t)(((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_MSGVAL_Msk) >> CAN_MO_MOSTAT_MSGVAL_Pos); + uint32_t mo_transmission_ongoing = (uint32_t) ((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_TXRQ_Msk) >> CAN_MO_MOSTAT_TXRQ_Pos; + /* check if message is disabled */ + if (mo_type == 0U) + { + error = XMC_CAN_STATUS_MO_DISABLED; + } + /* check if transmission is ongoing on message object */ + else if (mo_transmission_ongoing == 1U) + { + error = XMC_CAN_STATUS_BUSY; + } + else + { + /* set TXRQ bit */ + can_mo->can_mo_ptr-> MOCTR = CAN_MO_MOCTR_SETTXRQ_Msk | CAN_MO_MOCTR_SETTXEN0_Msk | CAN_MO_MOCTR_SETTXEN1_Msk; + error = XMC_CAN_STATUS_SUCCESS; + } + return error; +} + +/* This function is will read the message object data bytes */ +XMC_CAN_STATUS_t XMC_CAN_MO_ReceiveData (XMC_CAN_MO_t *can_mo) +{ + XMC_CAN_STATUS_t error = XMC_CAN_STATUS_ERROR; + uint8_t rx_pnd = 0U; + uint8_t new_data = 0U; + uint32_t mo_type = (uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_DIR_Msk) >> CAN_MO_MOSTAT_DIR_Pos; + uint32_t mo_recepcion_ongoing = (uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_RXUPD_Msk) >> CAN_MO_MOSTAT_RXUPD_Pos; + /* check if message object is a receive message object */ + if (mo_type != (uint32_t)XMC_CAN_MO_TYPE_RECMSGOBJ) + { + error = XMC_CAN_STATUS_MO_NOT_ACCEPTABLE; + } + /* check if reception is ongoing on message object */ + else if (mo_recepcion_ongoing == 1U) + { + error = XMC_CAN_STATUS_BUSY; + } + else + { + /* read message parameters */ + do + { + can_mo->can_data[0] = can_mo->can_mo_ptr->MODATAL; + can_mo->can_data[1] = can_mo->can_mo_ptr->MODATAH; + + rx_pnd = (uint8_t)((uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_RXUPD_Msk) >> CAN_MO_MOSTAT_RXUPD_Pos); + new_data = (uint8_t)((uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_NEWDAT_Msk) >> CAN_MO_MOSTAT_NEWDAT_Pos); + } while ((rx_pnd != 0U) && (new_data != 0U)); + + error = XMC_CAN_STATUS_SUCCESS; + } + return error; +} + + +/* This function is will read the message object data bytes */ +XMC_CAN_STATUS_t XMC_CAN_MO_Receive (XMC_CAN_MO_t *can_mo) +{ + XMC_CAN_STATUS_t error = XMC_CAN_STATUS_ERROR; + uint8_t rx_pnd = 0U; + uint8_t new_data = 0U; + uint32_t mo_type = (uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_DIR_Msk) >> CAN_MO_MOSTAT_DIR_Pos; + uint32_t mo_recepcion_ongoing = (uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_RXUPD_Msk) >> CAN_MO_MOSTAT_RXUPD_Pos; + /* check if message object is a receive message object */ + if (mo_type != (uint32_t)XMC_CAN_MO_TYPE_RECMSGOBJ) + { + error = XMC_CAN_STATUS_MO_NOT_ACCEPTABLE; + } + /* check if reception is ongoing on message object */ + else if (mo_recepcion_ongoing == 1U) + { + error = XMC_CAN_STATUS_BUSY; + } + else + { + /* read message parameters */ + do + { + can_mo->can_mo_ptr->MOCTR = CAN_MO_MOCTR_RESNEWDAT_Msk; + if ((((can_mo->can_mo_ptr->MOAR) & CAN_MO_MOAR_IDE_Msk) >> CAN_MO_MOAR_IDE_Pos) == 0U) + { + can_mo->can_id_mode = (uint32_t)XMC_CAN_FRAME_TYPE_STANDARD_11BITS; + can_mo->can_identifier = (can_mo->can_mo_ptr->MOAR & XMC_CAN_MO_MOAR_STDID_Msk) >> XMC_CAN_MO_MOAR_STDID_Pos; + can_mo->can_ide_mask = (uint32_t)(can_mo->can_mo_ptr->MOAMR & CAN_MO_MOAMR_MIDE_Msk) >> CAN_MO_MOAMR_MIDE_Pos; + if(can_mo->can_ide_mask == 1U) + { + can_mo->can_id_mask = (uint32_t)(can_mo->can_mo_ptr->MOAMR & XMC_CAN_MO_MOAR_STDID_Msk) >> XMC_CAN_MO_MOAR_STDID_Pos; + } + else + { + can_mo->can_id_mask = (uint32_t)(can_mo->can_mo_ptr->MOAMR & CAN_MO_MOAMR_AM_Msk); + } + } + else + { + can_mo->can_id_mode = (uint32_t)XMC_CAN_FRAME_TYPE_EXTENDED_29BITS; + can_mo->can_identifier = (can_mo->can_mo_ptr->MOAR & CAN_MO_MOAR_ID_Msk); + can_mo->can_id_mask = (uint32_t)(can_mo->can_mo_ptr->MOAMR & CAN_MO_MOAMR_AM_Msk); + can_mo->can_ide_mask = (uint32_t)(can_mo->can_mo_ptr->MOAMR & CAN_MO_MOAMR_MIDE_Msk) >> CAN_MO_MOAMR_MIDE_Pos; + } + can_mo->can_data_length = (uint8_t)((uint32_t)((can_mo->can_mo_ptr->MOFCR) & CAN_MO_MOFCR_DLC_Msk) >> CAN_MO_MOFCR_DLC_Pos); + + can_mo->can_data[0] = can_mo->can_mo_ptr->MODATAL; + can_mo->can_data[1] = can_mo->can_mo_ptr->MODATAH; + + rx_pnd = (uint8_t)((uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_RXUPD_Msk) >> CAN_MO_MOSTAT_RXUPD_Pos); + new_data = (uint8_t)((uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_NEWDAT_Msk) >> CAN_MO_MOSTAT_NEWDAT_Pos); + } while ((rx_pnd != 0U) && (new_data != 0U)); + + can_mo->can_mo_type = XMC_CAN_MO_TYPE_RECMSGOBJ; + error = XMC_CAN_STATUS_SUCCESS; + } + return error; +} + +/* Function to enable node event */ +void XMC_CAN_NODE_EnableEvent(XMC_CAN_NODE_t *const can_node, const XMC_CAN_NODE_EVENT_t event) +{ + if(event != XMC_CAN_NODE_EVENT_CFCIE) + { + can_node->NCR |= (uint32_t)event; + } + else + { + can_node->NFCR |= (uint32_t)event; + } +} + +/* Function to disable node event */ +void XMC_CAN_NODE_DisableEvent(XMC_CAN_NODE_t *const can_node, const XMC_CAN_NODE_EVENT_t event) +{ + if(event != XMC_CAN_NODE_EVENT_CFCIE) + { + can_node->NCR &= ~(uint32_t)event; + } + else + { + can_node->NFCR &= ~(uint32_t)event; + } +} +/* Function to transmit MO from the FIFO */ +XMC_CAN_STATUS_t XMC_CAN_TXFIFO_Transmit(const XMC_CAN_MO_t *const can_mo) +{ + XMC_CAN_STATUS_t error = XMC_CAN_STATUS_ERROR; + uint32_t mo_type = ((uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_MSGVAL_Msk) >> CAN_MO_MOSTAT_MSGVAL_Pos); + uint32_t mo_transmission_ongoing = (uint32_t)((can_mo->can_mo_ptr->MOSTAT) & CAN_MO_MOSTAT_TXRQ_Msk) >> CAN_MO_MOSTAT_TXRQ_Pos; + uint32_t mo_cur = (uint32_t)(can_mo->can_mo_ptr-> MOFGPR & CAN_MO_MOFGPR_CUR_Msk) >> CAN_MO_MOFGPR_CUR_Pos; + CAN_MO_TypeDef* mo = (CAN_MO_TypeDef *)(CAN_BASE + 0x1000UL + (mo_cur * 0x0020UL)); + /* check if message is disabled */ + if (mo_type == 0U) + { + error = XMC_CAN_STATUS_MO_DISABLED; + } + /* check if transmission is ongoing on message object */ + else if (mo_transmission_ongoing == 1U) + { + error = XMC_CAN_STATUS_BUSY; + } + else + { + mo->MOCTR = CAN_MO_MOCTR_SETTXRQ_Msk | CAN_MO_MOCTR_SETTXEN0_Msk | CAN_MO_MOCTR_SETTXEN1_Msk; + error = XMC_CAN_STATUS_SUCCESS; + } + return error; +} + +/* Function to initialize the transmit FIFO MO base object */ +void XMC_CAN_TXFIFO_ConfigMOBaseObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_FIFO_CONFIG_t can_fifo) +{ + can_mo->can_mo_ptr->MOFCR = ((can_mo->can_mo_ptr->MOFCR ) & ~(uint32_t)(CAN_MO_MOFCR_MMC_Msk)) | + (((uint32_t)0x2U << CAN_MO_MOFCR_MMC_Pos) & (uint32_t)CAN_MO_MOFCR_MMC_Msk); + can_mo->can_mo_ptr->MOFGPR = ((can_mo->can_mo_ptr->MOFGPR ) & ~(uint32_t)(CAN_MO_MOFGPR_BOT_Msk | + CAN_MO_MOFGPR_TOP_Msk | + CAN_MO_MOFGPR_CUR_Msk)) | + (((uint32_t)can_fifo.fifo_bottom << CAN_MO_MOFGPR_BOT_Pos) & (uint32_t)CAN_MO_MOFGPR_BOT_Msk) | + (((uint32_t)can_fifo.fifo_base << CAN_MO_MOFGPR_CUR_Pos) & (uint32_t) CAN_MO_MOFGPR_CUR_Msk) | + (((uint32_t)can_fifo.fifo_top << CAN_MO_MOFGPR_TOP_Pos) & (uint32_t) CAN_MO_MOFGPR_TOP_Msk); +} +/* Function to Initialize the receive FIFO MO base object */ +void XMC_CAN_RXFIFO_ConfigMOBaseObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_FIFO_CONFIG_t can_fifo) +{ + can_mo->can_mo_ptr->MOFCR = ((can_mo->can_mo_ptr->MOFCR ) & ~(uint32_t)(CAN_MO_MOFCR_MMC_Msk)) | + (((uint32_t)0x1U << CAN_MO_MOFCR_MMC_Pos) & (uint32_t)CAN_MO_MOFCR_MMC_Msk); + can_mo->can_mo_ptr->MOFGPR = ((can_mo->can_mo_ptr->MOFGPR ) & ~( uint32_t)(CAN_MO_MOFGPR_BOT_Msk | + CAN_MO_MOFGPR_TOP_Msk | + CAN_MO_MOFGPR_CUR_Msk)) | + (((uint32_t)can_fifo.fifo_bottom << CAN_MO_MOFGPR_BOT_Pos) & (uint32_t)CAN_MO_MOFGPR_BOT_Msk) | + (((uint32_t)can_fifo.fifo_base << CAN_MO_MOFGPR_CUR_Pos) & (uint32_t)CAN_MO_MOFGPR_CUR_Msk) | + (((uint32_t)can_fifo.fifo_top << CAN_MO_MOFGPR_TOP_Pos) & (uint32_t)CAN_MO_MOFGPR_TOP_Msk); +} + +/* Function to Initialize the FIFO MO slave object */ +void XMC_CAN_TXFIFO_ConfigMOSlaveObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_FIFO_CONFIG_t can_fifo) +{ + can_mo->can_mo_ptr->MOFCR = ((can_mo->can_mo_ptr->MOFCR ) & ~(uint32_t)(CAN_MO_MOFCR_MMC_Msk)) | + (((uint32_t)0x3U << CAN_MO_MOFCR_MMC_Pos) & (uint32_t)CAN_MO_MOFCR_MMC_Msk); + can_mo->can_mo_ptr->MOFGPR = ((can_mo->can_mo_ptr->MOFGPR ) & ~(uint32_t)(CAN_MO_MOFGPR_CUR_Msk)) | + (((uint32_t)can_fifo.fifo_base << CAN_MO_MOFGPR_CUR_Pos) & (uint32_t)CAN_MO_MOFGPR_CUR_Msk); + + can_mo->can_mo_ptr->MOCTR = CAN_MO_MOCTR_SETTXEN0_Msk| + CAN_MO_MOCTR_RESTXEN1_Msk; +} + +/* Function to Initialize the Gateway Source Object */ +void XMC_CAN_GATEWAY_InitSourceObject(const XMC_CAN_MO_t *const can_mo,const XMC_CAN_GATEWAY_CONFIG_t can_gateway) +{ + can_mo->can_mo_ptr->MOFCR = (((uint32_t)0x4U << CAN_MO_MOFCR_MMC_Pos) & (uint32_t)CAN_MO_MOFCR_MMC_Msk) | + ((((uint32_t)can_gateway.gateway_data_frame_send) << CAN_MO_MOFCR_GDFS_Pos) & (uint32_t)CAN_MO_MOFCR_GDFS_Msk) | + ((((uint32_t)can_gateway.gateway_data_length_code_copy) << CAN_MO_MOFCR_DLCC_Pos) & (uint32_t)CAN_MO_MOFCR_DLCC_Msk) | + ((((uint32_t)can_gateway.gateway_identifier_copy) << CAN_MO_MOFCR_IDC_Pos) & (uint32_t)CAN_MO_MOFCR_IDC_Msk) | + ((((uint32_t)can_gateway.gateway_data_copy) << CAN_MO_MOFCR_DATC_Pos) & (uint32_t)CAN_MO_MOFCR_DATC_Msk) ; + can_mo->can_mo_ptr->MOFGPR = (uint32_t)((((uint32_t)can_gateway.gateway_bottom << CAN_MO_MOFGPR_BOT_Pos) & (uint32_t)CAN_MO_MOFGPR_BOT_Msk) | + (((uint32_t)can_gateway.gateway_base << CAN_MO_MOFGPR_CUR_Pos) & (uint32_t)CAN_MO_MOFGPR_CUR_Msk) | + (((uint32_t)can_gateway.gateway_top << CAN_MO_MOFGPR_TOP_Pos) & (uint32_t)CAN_MO_MOFGPR_TOP_Msk)); +} + +#endif /* XMC_CAN_H */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_ccu4.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_ccu4.c new file mode 100644 index 00000000..c0f3868c --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_ccu4.c @@ -0,0 +1,1136 @@ +/** + * @file xmc_ccu4.c + * @date 2017-02-25 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-06-20: + * - Removed definition of GetDriverVersion API
+ * + * 2015-07-01: + * - In XMC_CCU4_SLICE_StartConfig(), Options in XMC_ASSERT check for start mode is corrected.
+ * + * 2015-07-24: + * - XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent() is updated to support XMC14 device.
+ * + * 2015-08-17: + * - Start of prescaler XMC_CCU4_StartPrescaler() is invoked in XMC_CCU4_Init() API.
+ * - Bug fix XMC_CCU4_SLICE_ConfigureEvent() during the level setting for XMC14 devices.
+ * - XMC_CCU4_EnableShadowTransfer() definition is removed, since the API is made as inline.
+ * + * 2015-10-07: + * - XMC_CCU4_SLICE_GetEvent() is made as inline. + * - DOC updates for the newly added APIs. + * + * 2017-02-25: + * - XMC_CCU4_lAssertReset(), XMC_CCU4_lDeassertReset(), XMC_CCU4_lGateClock() and XMC_CCU4_lUngateClock() fix compilation warnings. + * + * @endcond + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include "xmc_ccu4.h" + +#if defined(CCU40) +#include "xmc_scu.h" +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_CCU4_NUM_SLICES_PER_MODULE (4U) +#define XMC_CCU4_SLICE_DITHER_PERIOD_MASK (1U) +#define XMC_CCU4_SLICE_DITHER_DUTYCYCLE_MASK (2U) +#define XMC_CCU4_SLICE_EVENT_EDGE_CONFIG_MASK (3U) +#define XMC_CCU4_SLICE_EVENT_LEVEL_CONFIG_MASK (1U) +#define XMC_CCU4_SLICE_EVENT_FILTER_CONFIG_MASK (3U) +#if defined(CCU4V3) /* Defined for XMC1400 devices only */ +#define XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK CCU4_CC4_INS1_EV0IS_Msk +#else +#define XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK CCU4_CC4_INS_EV0IS_Msk +#endif +#define XMC_CCU4_GIDLC_CLOCK_MASK (15U) +#define XMC_CCU4_GCSS_SLICE0_MASK (1U) +#define XMC_CCU4_GCSS_SLICE1_MASK (16U) +#define XMC_CCU4_GCSS_SLICE2_MASK (256U) +#define XMC_CCU4_GCSS_SLICE3_MASK (4096U) + +/** Macro to check if the clock selected enum passed is valid */ +#define XMC_CCU4_SLICE_CHECK_CLOCK(clock) \ + ((clock == XMC_CCU4_CLOCK_SCU) || \ + (clock == XMC_CCU4_CLOCK_EXTERNAL_A) || \ + (clock == XMC_CCU4_CLOCK_EXTERNAL_B) || \ + (clock == XMC_CCU4_CLOCK_EXTERNAL_C)) + +/** Macro used to check if the event ID is valid*/ +#define XMC_CCU4_SLICE_CHECK_EVENT_ID(event_id) \ + ((event_id == XMC_CCU4_SLICE_EVENT_NONE)|| \ + (event_id == XMC_CCU4_SLICE_EVENT_0) || \ + (event_id == XMC_CCU4_SLICE_EVENT_1) || \ + (event_id == XMC_CCU4_SLICE_EVENT_2)) + +/** Macro used to check if the edge sensitivity is valid*/ +#define XMC_CCU4_SLICE_CHECK_EDGE_SENSITIVITY(edge) \ + ((edge == XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_NONE) || \ + (edge == XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_RISING_EDGE) || \ + (edge == XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_FALLING_EDGE)|| \ + (edge == XMC_CCU4_SLICE_EVENT_EDGE_SENSITIVITY_DUAL_EDGE)) + +/** Macro used to check if the filter clock cycles are valid */ +#define XMC_CCU4_SLICE_CHECK_EVENT_FILTER(cycles) \ + ((cycles == XMC_CCU4_SLICE_EVENT_FILTER_DISABLED) || \ + (cycles == XMC_CCU4_SLICE_EVENT_FILTER_3_CYCLES) || \ + (cycles == XMC_CCU4_SLICE_EVENT_FILTER_5_CYCLES) || \ + (cycles == XMC_CCU4_SLICE_EVENT_FILTER_7_CYCLES)) + +/** Macro used to check if the Multi-channel input related action is valid*/ +#define XMC_CCU4_SLICE_CHECK_MCS_ACTION(mcs_action) \ + ((mcs_action == XMC_CCU4_SLICE_MCMS_ACTION_TRANSFER_PR_CR) || \ + (mcs_action == XMC_CCU4_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP) || \ + (mcs_action == XMC_CCU4_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP_DIT)) + +/** Macro used to check if the SR line is valid*/ +#define XMC_CCU4_SLICE_CHECK_SR_ID(id) \ + ((id == XMC_CCU4_SLICE_SR_ID_0) || \ + (id == XMC_CCU4_SLICE_SR_ID_1) || \ + (id == XMC_CCU4_SLICE_SR_ID_2) || \ + (id == XMC_CCU4_SLICE_SR_ID_3)) + +/** Macro to check if the end mode enum passed is valid */ +#define XMC_CCU4_CHECK_END_MODE(end_mode) \ + ((end_mode == XMC_CCU4_SLICE_END_MODE_TIMER_STOP) || \ + (end_mode == XMC_CCU4_SLICE_END_MODE_TIMER_CLEAR) || \ + (end_mode == XMC_CCU4_SLICE_END_MODE_TIMER_STOP_CLEAR)) + +/********************************************************************************************************************* + * LOCAL ROUTINES + ********************************************************************************************************************/ +#if defined(PERIPHERAL_RESET_SUPPORTED) +__STATIC_INLINE void XMC_CCU4_lAssertReset(const XMC_CCU4_MODULE_t *const module) +{ + if (module == CCU40) + { + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU40); + } +#if defined(CCU41) + else if (module == CCU41) + { + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU41); + } +#endif +#if defined(CCU42) + else if (module == CCU42) + { + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU42); + } +#endif +#if defined(CCU43) + else if (module == CCU43) + { + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU43); + } +#endif + else + { + XMC_ASSERT("XMC_CCU4_lAssertReset:Invalid Module Pointer", 0); + } +} + +__STATIC_INLINE void XMC_CCU4_lDeassertReset(const XMC_CCU4_MODULE_t *const module) +{ + if (module == CCU40) + { + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU40); + } +#if defined(CCU41) + else if (module == CCU41) + { + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU41); + } +#endif +#if defined(CCU42) + else if (module == CCU42) + { + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU42); + } +#endif +#if defined(CCU43) + else if (module == CCU43) + { + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU43); + } +#endif + else + { + XMC_ASSERT("XMC_CCU4_lDeassertReset:Invalid Module Pointer", 0); + } +} +#endif + +#if defined(CLOCK_GATING_SUPPORTED) +__STATIC_INLINE void XMC_CCU4_lGateClock(const XMC_CCU4_MODULE_t *const module) +{ + + if (module == CCU40) + { + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU40); + } +#if defined(CCU41) + else if (module == CCU41) + { + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU41); + } +#endif +#if defined(CCU42) + else if (module == CCU42) + { + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU42); + } +#endif +#if defined(CCU43) + else if (module == CCU43) + { + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU43); + } +#endif + else + { + XMC_ASSERT("XMC_CCU4_lGateClock:Invalid Module Pointer", 0); + } +} + +__STATIC_INLINE void XMC_CCU4_lUngateClock(const XMC_CCU4_MODULE_t *const module) +{ + if (module == CCU40) + { + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU40); + } +#if defined(CCU41) + else if (module == CCU41) + { + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU41); + } +#endif +#if defined(CCU42) + else if (module == CCU42) + { + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU42); + } +#endif +#if defined(CCU43) + else if (module == CCU43) + { + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU43); + } +#endif + else + { + XMC_ASSERT("XMC_CCU4_lUngateClock:Invalid Module Pointer", 0); + } +} +#endif + +#if defined (XMC_ASSERT_ENABLE) +__STATIC_INLINE bool XMC_CCU4_SLICE_IsInputvalid(XMC_CCU4_SLICE_INPUT_t input) +{ +#if (UC_SERIES == XMC14) + return (input < 48U); +#else + return (input < 16U); +#endif +} +#endif +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +void XMC_CCU4_EnableModule(XMC_CCU4_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU4_EnableModule:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + +#if UC_FAMILY == XMC4 + /* Enable CCU4 module clock */ + XMC_SCU_CLOCK_EnableClock(XMC_SCU_CLOCK_CCU); +#endif + +#if defined(CLOCK_GATING_SUPPORTED) + XMC_CCU4_lUngateClock(module); +#endif + +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_CCU4_lDeassertReset(module); +#endif +} + +void XMC_CCU4_DisableModule(XMC_CCU4_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU4_DisableModule:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_CCU4_lAssertReset(module); +#endif + +#if defined(CLOCK_GATING_SUPPORTED) + XMC_CCU4_lGateClock(module); +#endif +} + +/* API to initialize CCU4 global resources */ +void XMC_CCU4_Init(XMC_CCU4_MODULE_t *const module, const XMC_CCU4_SLICE_MCMS_ACTION_t mcs_action) +{ + uint32_t gctrl; + + XMC_ASSERT("XMC_CCU4_Init:Invalid module pointer", XMC_CCU4_IsValidModule(module)); + XMC_ASSERT("XMC_CCU4_Init:Invalid mcs action", XMC_CCU4_SLICE_CHECK_MCS_ACTION(mcs_action)); + + /* Enable CCU4 module */ + XMC_CCU4_EnableModule(module); + /* Start the prescaler */ + XMC_CCU4_StartPrescaler(module); + + gctrl = module->GCTRL; + gctrl &= ~((uint32_t) CCU4_GCTRL_MSDE_Msk); + gctrl |= ((uint32_t) mcs_action) << CCU4_GCTRL_MSDE_Pos; + + module->GCTRL = gctrl; +} + +/* API to select CCU4 module clock */ +void XMC_CCU4_SetModuleClock(XMC_CCU4_MODULE_t *const module, const XMC_CCU4_CLOCK_t clock) +{ + uint32_t gctrl; + + XMC_ASSERT("XMC_CCU4_SetModuleClock:Invalid Module Pointer", XMC_CCU4_IsValidModule(module)); + XMC_ASSERT("XMC_CCU4_SetModuleClock:Invalid Module Clock", XMC_CCU4_SLICE_CHECK_CLOCK(clock)); + + gctrl = module->GCTRL; + gctrl &= ~((uint32_t) CCU4_GCTRL_PCIS_Msk); + gctrl |= ((uint32_t) clock) << CCU4_GCTRL_PCIS_Pos; + + module->GCTRL = gctrl; +} + +/* API to configure the multichannel shadow transfer request via SW and via the CCU4x.MCSS input. */ +void XMC_CCU4_SetMultiChannelShadowTransferMode(XMC_CCU4_MODULE_t *const module, const uint32_t slice_mode_msk) +{ + uint32_t gctrl; + + XMC_ASSERT("XMC_CCU4_SetMultiChannelShadowTransferMode:Invalid module Pointer", XMC_CCU4_IsValidModule(module)); + + gctrl = module->GCTRL; + gctrl &= ~((uint32_t)slice_mode_msk >> 16U); + gctrl |= ((uint32_t)slice_mode_msk & 0xFFFFU); + module->GCTRL = gctrl; +} + +/* API to configure CC4 Slice as Timer */ +void XMC_CCU4_SLICE_CompareInit(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_COMPARE_CONFIG_t *const compare_init) +{ + XMC_ASSERT("XMC_CCU4_SLICE_CompareInit:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_CompareInit:Compare Init Pointer is NULL", + (XMC_CCU4_SLICE_COMPARE_CONFIG_t *) NULL != compare_init); + + /* Program the timer mode */ + slice->TC = compare_init->tc; + /* Enable the timer concatenation */ + slice->CMC = ((uint32_t) compare_init->timer_concatenation << CCU4_CC4_CMC_TCE_Pos); + /* Program initial prescaler divider value */ + slice->PSC = (uint32_t) compare_init->prescaler_initval; + /* Program the dither compare value */ + slice->DITS = (uint32_t) compare_init->dither_limit; + /* Program timer output passive level */ + slice->PSL = (uint32_t) compare_init->passive_level; + /* Program floating prescaler compare value */ + slice->FPCS = (uint32_t) compare_init->float_limit; +} + +/* API to configure CC4 Slice for Capture */ +void XMC_CCU4_SLICE_CaptureInit(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_CAPTURE_CONFIG_t *const capture_init) +{ + XMC_ASSERT("XMC_CCU4_SLICE_CaptureInit:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_CaptureInit:Capture Init Pointer is NULL", + (XMC_CCU4_SLICE_CAPTURE_CONFIG_t *) NULL != capture_init); + + /* Program the capture mode */ + slice->TC = capture_init->tc; + /* Enable the timer concatenation */ + slice->CMC = ((uint32_t)capture_init->timer_concatenation << CCU4_CC4_CMC_TCE_Pos); + /* Program initial prescaler divider value */ + slice->PSC = (uint32_t) capture_init->prescaler_initval; + /* Program initial floating prescaler compare value */ + slice->FPCS = (uint32_t) capture_init->float_limit; +} + + +/* API to configure the Start trigger function of a slice */ +void XMC_CCU4_SLICE_StartConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_START_MODE_t start_mode) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU4_SLICE_StartConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_StartConfig:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU4_SLICE_StartConfig:Invalid Start Mode", + ((start_mode == XMC_CCU4_SLICE_START_MODE_TIMER_START_CLEAR) ||\ + (start_mode == XMC_CCU4_SLICE_START_MODE_TIMER_START))); + /* First, Bind the event with the stop function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_STRTS_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_STRTS_Pos; + + slice->CMC = cmc; + + tc = slice->TC; + /* Next, Configure the start mode */ + if (start_mode == XMC_CCU4_SLICE_START_MODE_TIMER_START_CLEAR) + { + tc |= (uint32_t)CCU4_CC4_TC_STRM_Msk; + } + else + { + tc &= ~((uint32_t)CCU4_CC4_TC_STRM_Msk); + } + + slice->TC = tc; +} + +/* API to configure the Stop trigger function of a slice */ +void XMC_CCU4_SLICE_StopConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_END_MODE_t end_mode) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU4_SLICE_StopConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_StopConfig:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU4_SLICE_StopConfig:Invalid Start Mode", XMC_CCU4_CHECK_END_MODE(end_mode)); + + /* First, Bind the event with the stop function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_ENDS_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_ENDS_Pos; + + slice->CMC = cmc; + + /* Next, Configure the stop mode */ + tc = slice->TC; + tc &= ~((uint32_t) CCU4_CC4_TC_ENDM_Msk); + tc |= ((uint32_t) end_mode) << CCU4_CC4_TC_ENDM_Pos; + + slice->TC = tc; +} + +/* API to configure the Load trigger function of a slice */ +void XMC_CCU4_SLICE_LoadConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU4_SLICE_LoadConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_LoadConfig:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + + /* Bind the event with the load function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_LDS_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_LDS_Pos; + + slice->CMC = cmc; +} + +/* API to configure the slice modulation function */ +void XMC_CCU4_SLICE_ModulationConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_MODULATION_MODE_t mod_mode, + const bool synch_with_pwm) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU4_SLICE_ModulationConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_ModulationConfig:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU4_SLICE_ModulationConfig:Invalid Modulation Mode", + ((mod_mode == XMC_CCU4_SLICE_MODULATION_MODE_CLEAR_OUT) ||\ + (mod_mode == XMC_CCU4_SLICE_MODULATION_MODE_CLEAR_ST_OUT))); + + tc = slice->TC; + cmc = slice->CMC; + + /* First, Bind the event with the modulation function */ + cmc &= ~((uint32_t) CCU4_CC4_CMC_MOS_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_MOS_Pos; + slice->CMC = cmc; + + /* Next, Modulation mode */ + if (mod_mode == XMC_CCU4_SLICE_MODULATION_MODE_CLEAR_OUT) + { + tc |= (uint32_t) CCU4_CC4_TC_EMT_Msk; + } + else + { + tc &= ~((uint32_t) CCU4_CC4_TC_EMT_Msk); + } + + /* Synchronization of modulation effect with PWM cycle */ + if (synch_with_pwm == (bool) true) + { + tc |= (uint32_t) CCU4_CC4_TC_EMS_Msk; + } + else + { + tc &= ~((uint32_t) CCU4_CC4_TC_EMS_Msk); + } + + slice->TC = tc; +} + +/* API to configure the slice count function */ +void XMC_CCU4_SLICE_CountConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU4_SLICE_CountConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_CountConfig:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + + /* Bind the event with the count function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_CNTS_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_CNTS_Pos; + + slice->CMC = cmc; +} + +/* API to configure slice gate function */ +void XMC_CCU4_SLICE_GateConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU4_SLICE_GateConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_GateConfig:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + + /* Bind the event with the gate function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_GATES_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_GATES_Pos; + + slice->CMC = cmc; +} + +/* API to configure Capture-0 function */ +void XMC_CCU4_SLICE_Capture0Config(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU4_SLICE_Capture0Config:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_Capture0Config:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + + /* Bind the event with the gate function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_CAP0S_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_CAP0S_Pos; + + slice->CMC = cmc; +} + +/* API to configure Capture-1 function */ +void XMC_CCU4_SLICE_Capture1Config(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU4_SLICE_Capture1Config:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_Capture1Config:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + + /* Bind the event with the gate function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_CAP1S_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_CAP1S_Pos; + + slice->CMC = cmc; +} + +/* API to configure direction function */ +void XMC_CCU4_SLICE_DirectionConfig(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU4_SLICE_DirectionConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_DirectionConfig:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + + /* Bind the event with the direction function */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_UDS_Msk); + cmc |= ((uint32_t) event) << CCU4_CC4_CMC_UDS_Pos; + + slice->CMC = cmc; +} + +/* API to configure slice status bit override function */ +void XMC_CCU4_SLICE_StatusBitOverrideConfig(XMC_CCU4_SLICE_t *const slice) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU4_SLICE_StatusBitOverrideConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + + /* Bind the event with the override function */ + cmc = slice->CMC; + /* Map status bit trigger override to Event 1 & + status bit value override to Event 2 */ + cmc &= ~((uint32_t) CCU4_CC4_CMC_OFS_Msk); + cmc |= ((uint32_t) 1) << CCU4_CC4_CMC_OFS_Pos; + + slice->CMC = cmc; +} + +/* API to configure trap function */ +void XMC_CCU4_SLICE_TrapConfig(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_TRAP_EXIT_MODE_t exit_mode, + const bool synch_with_pwm) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU4_SLICE_TrapConfig:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_TrapConfig:Invalid Exit Mode", ((exit_mode == XMC_CCU4_SLICE_TRAP_EXIT_MODE_AUTOMATIC) ||\ + (exit_mode == XMC_CCU4_SLICE_TRAP_EXIT_MODE_SW))); + + /* First, Map trap function to Event 2 */ + cmc = slice->CMC; + cmc &= ~((uint32_t) CCU4_CC4_CMC_TS_Msk); + cmc |= ((uint32_t) 1) << CCU4_CC4_CMC_TS_Pos; + slice->CMC = cmc; + + /* Next, Configure synchronization option */ + tc = slice->TC; + + if (synch_with_pwm == (bool) true) + { + tc |= (uint32_t) CCU4_CC4_TC_TRPSE_Msk; + } + else + { + tc &= ~((uint32_t) CCU4_CC4_TC_TRPSE_Msk); + } + + /* Configure exit mode */ + if (exit_mode == XMC_CCU4_SLICE_TRAP_EXIT_MODE_SW) + { + tc |= (uint32_t) CCU4_CC4_TC_TRPSW_Msk; + } + else + { + tc &= ~((uint32_t) CCU4_CC4_TC_TRPSW_Msk); + } + + slice->TC = tc; +} + +/* API to configure a slice Status Bit Override event */ +void XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_CONFIG_t *const ev1_config, + const XMC_CCU4_SLICE_EVENT_CONFIG_t *const ev2_config) +{ + uint32_t ins; + + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Input", + XMC_CCU4_SLICE_IsInputvalid(ev1_config->mapped_input)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Edge Sensitivity", + XMC_CCU4_SLICE_CHECK_EDGE_SENSITIVITY(ev1_config->edge)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Level Sensitivity", + ((ev1_config->level == XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH) ||\ + (ev1_config->level == XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW))); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Debounce Period", + XMC_CCU4_SLICE_CHECK_EVENT_FILTER(ev1_config->duration)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Input", + XMC_CCU4_SLICE_IsInputvalid(ev2_config->mapped_input)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Edge Sensitivity", + XMC_CCU4_SLICE_CHECK_EDGE_SENSITIVITY(ev2_config->edge)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Level Sensitivity", + ((ev2_config->level == XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH) ||\ + (ev2_config->level == XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW))); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent:Invalid Debounce Period", + XMC_CCU4_SLICE_CHECK_EVENT_FILTER(ev2_config->duration)); +#if defined(CCU4V3) /* Defined for XMC1400 devices only */ + ins = slice->INS2; + + /* Configure the edge sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU4_CC4_INS2_EV1EM_Pos); + ins |= ((uint32_t) ev1_config->edge) << CCU4_CC4_INS2_EV1EM_Pos; + + /* Configure the edge sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU4_CC4_INS2_EV2EM_Pos); + ins |= ((uint32_t) ev2_config->edge) << CCU4_CC4_INS2_EV2EM_Pos; + + /* Configure the level sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU4_CC4_INS2_EV1LM_Pos); + ins |= ((uint32_t) ev1_config->level) << CCU4_CC4_INS2_EV1LM_Pos; + + /* Configure the level sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU4_CC4_INS2_EV2LM_Pos); + ins |= ((uint32_t) ev2_config->level) << CCU4_CC4_INS2_EV2LM_Pos; + + /* Configure the debounce filter for event 1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU4_CC4_INS2_LPF1M_Pos); + ins |= ((uint32_t) ev1_config->duration) << CCU4_CC4_INS2_LPF1M_Pos; + + /* Configure the debounce filter for event 2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU4_CC4_INS2_LPF2M_Pos); + ins |= ((uint32_t) ev2_config->duration) << CCU4_CC4_INS2_LPF2M_Pos; + + slice->INS2 = ins; + + ins = slice->INS1; + + /* Next, the input for Event1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU4_CC4_INS1_EV1IS_Pos); + ins |= ((uint32_t) ev1_config->mapped_input) << CCU4_CC4_INS1_EV1IS_Pos; + + /* Finally, the input for Event2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU4_CC4_INS1_EV2IS_Pos); + ins |= ((uint32_t) ev2_config->mapped_input) << CCU4_CC4_INS1_EV2IS_Pos; + + slice->INS1 = ins; +#else + ins = slice->INS; + + /* Configure the edge sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU4_CC4_INS_EV1EM_Pos); + ins |= ((uint32_t) ev1_config->edge) << CCU4_CC4_INS_EV1EM_Pos; + + /* Configure the edge sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU4_CC4_INS_EV2EM_Pos); + ins |= ((uint32_t) ev2_config->edge) << CCU4_CC4_INS_EV2EM_Pos; + + /* Configure the level sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU4_CC4_INS_EV1LM_Pos); + ins |= ((uint32_t) ev1_config->level) << CCU4_CC4_INS_EV1LM_Pos; + + /* Configure the level sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU4_CC4_INS_EV2LM_Pos); + ins |= ((uint32_t) ev2_config->level) << CCU4_CC4_INS_EV2LM_Pos; + + /* Configure the debounce filter for event 1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU4_CC4_INS_LPF1M_Pos); + ins |= ((uint32_t) ev1_config->duration) << CCU4_CC4_INS_LPF1M_Pos; + + /* Configure the debounce filter for event 2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU4_CC4_INS_LPF2M_Pos); + ins |= ((uint32_t) ev2_config->duration) << CCU4_CC4_INS_LPF2M_Pos; + + /* Next, the input for Event1 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU4_CC4_INS_EV1IS_Pos); + ins |= ((uint32_t) ev1_config->mapped_input) << CCU4_CC4_INS_EV1IS_Pos; + + /* Finally, the input for Event2 */ + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU4_CC4_INS_EV2IS_Pos); + ins |= ((uint32_t) ev2_config->mapped_input) << CCU4_CC4_INS_EV2IS_Pos; + + slice->INS = ins; +#endif +} + +/* API to configure a slice trigger event */ +void XMC_CCU4_SLICE_ConfigureEvent(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_EVENT_CONFIG_t *const config) +{ + uint32_t ins; + uint8_t pos; + uint8_t offset; + + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureEvent:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureEvent:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureEvent:Invalid Input", XMC_CCU4_SLICE_IsInputvalid(config->mapped_input)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureEvent:Invalid Edge Sensitivity", + XMC_CCU4_SLICE_CHECK_EDGE_SENSITIVITY(config->edge)); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureEvent:Invalid Level Sensitivity", + ((config->level == XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH) ||\ + (config->level == XMC_CCU4_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW))); + XMC_ASSERT("XMC_CCU4_SLICE_ConfigureEvent:Invalid Debounce Period", + XMC_CCU4_SLICE_CHECK_EVENT_FILTER(config->duration)); + /* Calculate offset with reference to event */ + offset = ((uint8_t) event) - 1U; + +#if defined(CCU4V3) /* Defined for XMC1400 devices only */ + ins = slice->INS2; + + /* First, configure the edge sensitivity */ + pos = ((uint8_t) CCU4_CC4_INS2_EV0EM_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_EDGE_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->edge) << pos; + + /* Next, the level */ + pos = ((uint8_t) CCU4_CC4_INS2_EV0LM_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_LEVEL_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->level) << pos; + + /* Next, the debounce filter */ + pos = ((uint8_t) CCU4_CC4_INS2_LPF0M_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_FILTER_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->duration) << pos; + + slice->INS2 = ins; + + ins = slice->INS1; + + /* Finally the input */ + pos = ((uint8_t) CCU4_CC4_INS1_EV0IS_Pos) + (uint8_t)(offset << 3U); + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->mapped_input) << pos; + + slice->INS1 = ins; + +#else + ins = slice->INS; + + /* First, configure the edge sensitivity */ + pos = ((uint8_t) CCU4_CC4_INS_EV0EM_Pos) + (uint8_t)(offset << 1U); + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_EDGE_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->edge) << pos; + + /* Next, the level */ + pos = ((uint8_t) CCU4_CC4_INS_EV0LM_Pos) + offset; + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_LEVEL_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->level) << pos; + + /* Next, the debounce filter */ + pos = ((uint8_t) CCU4_CC4_INS_LPF0M_Pos) + (uint8_t)(offset << 1U); + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_FILTER_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->duration) << pos; + + /* Finally the input */ + pos = ((uint8_t) CCU4_CC4_INS_EV0IS_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->mapped_input) << pos; + + slice->INS = ins; +#endif +} + +/* API to bind an input to a slice trigger event */ +void XMC_CCU4_SLICE_SetInput(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_EVENT_t event, + const XMC_CCU4_SLICE_INPUT_t input) +{ + uint32_t ins; + uint8_t pos; + uint8_t offset; + + XMC_ASSERT("XMC_CCU4_SLICE_SetInput:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_SetInput:Invalid Event ID", XMC_CCU4_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU4_SLICE_SetInput:Invalid Input", XMC_CCU4_SLICE_IsInputvalid(input)); + + /* Calculate offset with reference to event */ + offset = ((uint8_t) event) - 1U; + +#if defined(CCU4V3) /* Defined for XMC1400 devices only */ + pos = ((uint8_t) CCU4_CC4_INS1_EV0IS_Pos) + (uint8_t) (offset << 3U); + + ins = slice->INS1; + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) input) << pos; + + slice->INS1 = ins; +#else + pos = ((uint8_t) CCU4_CC4_INS_EV0IS_Pos) + (uint8_t) (offset << 2U); + + ins = slice->INS; + ins &= ~(((uint32_t) XMC_CCU4_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) input) << pos; + + slice->INS = ins; +#endif +} + +/* API to program timer repeat mode - Single shot vs repeat */ +void XMC_CCU4_SLICE_SetTimerRepeatMode(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t mode) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerRepeatMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerRepeatMode:Invalid Timer Repeat Mode", + ((mode == XMC_CCU4_SLICE_TIMER_REPEAT_MODE_REPEAT) ||\ + (mode == XMC_CCU4_SLICE_TIMER_REPEAT_MODE_SINGLE))); + + if (XMC_CCU4_SLICE_TIMER_REPEAT_MODE_REPEAT == mode) + { + slice->TC &= ~((uint32_t) CCU4_CC4_TC_TSSM_Msk); + } + else + { + slice->TC |= (uint32_t) CCU4_CC4_TC_TSSM_Msk; + } +} + +/* Programs timer counting mode */ +void XMC_CCU4_SLICE_SetTimerCountingMode(XMC_CCU4_SLICE_t *const slice, const XMC_CCU4_SLICE_TIMER_COUNT_MODE_t mode) +{ + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerCountingMode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_SetTimerCountingMode:Invalid Timer Count Mode", ((mode == XMC_CCU4_SLICE_TIMER_COUNT_MODE_EA) ||\ + (mode == XMC_CCU4_SLICE_TIMER_COUNT_MODE_CA))); + + if (XMC_CCU4_SLICE_TIMER_COUNT_MODE_EA == mode) + { + slice->TC &= ~((uint32_t) CCU4_CC4_TC_TCM_Msk); + } + else + { + slice->TC |= (uint32_t) CCU4_CC4_TC_TCM_Msk; + } +} + +/* Retrieves desired capture register value */ +uint32_t XMC_CCU4_SLICE_GetCaptureRegisterValue(const XMC_CCU4_SLICE_t *const slice, const uint8_t reg_num) +{ + XMC_ASSERT("XMC_CCU4_SLICE_GetCaptureRegisterValue:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_GetCaptureRegisterValue:Invalid register number", (reg_num < 4U)); + return(slice->CV[reg_num]); +} + +/* @brief Retrieves the latest captured timer value */ +XMC_CCU4_STATUS_t XMC_CCU4_SLICE_GetLastCapturedTimerValue(const XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_CAP_REG_SET_t set, + uint32_t *val_ptr) +{ + XMC_CCU4_STATUS_t retval; + uint8_t i; + uint8_t start; + uint8_t end; + + XMC_ASSERT("XMC_CCU4_SLICE_GetLastCapturedTimerValue:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_GetLastCapturedTimerValue:Invalid Register Set", ((set == XMC_CCU4_SLICE_CAP_REG_SET_LOW) ||\ + (set == XMC_CCU4_SLICE_CAP_REG_SET_HIGH))); + + retval = XMC_CCU4_STATUS_ERROR; + + /* First check if extended capture mode is enabled */ + if ((slice->TC) & CCU4_CC4_TC_ECM_Msk) + { + /* Extended capture mode has been enabled. So start with the lowest capture register and work your way up */ + start = 0U; + end = XMC_CCU4_NUM_SLICES_PER_MODULE; + } + else + { + /* Extended capture mode is not enabled */ + if (set == XMC_CCU4_SLICE_CAP_REG_SET_HIGH) + { + start = ((uint8_t) XMC_CCU4_NUM_SLICES_PER_MODULE) >> 1U; + end = (uint8_t) XMC_CCU4_NUM_SLICES_PER_MODULE; + } + else + { + start = 0U; + end = ((uint8_t) XMC_CCU4_NUM_SLICES_PER_MODULE) >> 1U; + } + } + + for(i=start; i < end; i++) + { + if ( (slice->CV[i]) & CCU4_CC4_CV_FFL_Msk ) + { + *val_ptr = slice->CV[i]; + retval = XMC_CCU4_STATUS_OK; + break; + } + } + + return retval; +} + +/* Retrieves timer capture value from a FIFO made of capture registers */ +#if defined(CCU4V1) /* Defined for XMC4500, XMC400, XMC4200, XMC4100 devices only */ +int32_t XMC_CCU4_GetCapturedValueFromFifo(const XMC_CCU4_MODULE_t *const module, const uint8_t slice_number) +{ + int32_t cap; + uint32_t extracted_slice; + + XMC_ASSERT("XMC_CCU4_GetCapturedValueFromFifo:Invalid Slice Pointer", XMC_CCU4_IsValidModule(module)); + + /* First read the global fifo register */ + cap = (int32_t) module->ECRD; + + extracted_slice = (((uint32_t) cap) & ((uint32_t) CCU4_ECRD_SPTR_Msk)) >> CCU4_ECRD_SPTR_Pos; + + /* Return captured result only if it were applicable to this slice */ + if(extracted_slice != ((uint32_t)slice_number)) + { + cap = -1; + } + + return (cap); +} +#else +uint32_t XMC_CCU4_SLICE_GetCapturedValueFromFifo(const XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_CAP_REG_SET_t set) +{ + uint32_t cap; + + XMC_ASSERT("XMC_CCU4_SLICE_GetCapturedValueFromFifo:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_GetCapturedValueFromFifo:Invalid Register Set", + ((set == XMC_CCU4_SLICE_CAP_REG_SET_LOW) ||\ + (set == XMC_CCU4_SLICE_CAP_REG_SET_HIGH))); + + if(XMC_CCU4_SLICE_CAP_REG_SET_LOW == set) + { + cap = slice->ECRD0; + } + else + { + cap = slice->ECRD1; + } + + return cap; +} +#endif + +/* Enables PWM dithering feature */ +void XMC_CCU4_SLICE_EnableDithering(XMC_CCU4_SLICE_t *const slice, + const bool period_dither, + const bool duty_dither, + const uint8_t spread) +{ + uint32_t tc; + + XMC_ASSERT("XMC_CCU4_SLICE_EnableDithering:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + + tc = slice->TC; + tc &= ~((uint32_t) CCU4_CC4_TC_DITHE_Msk); + + if ((bool) true == period_dither) + { + tc |= (((uint32_t) XMC_CCU4_SLICE_DITHER_PERIOD_MASK) << CCU4_CC4_TC_DITHE_Pos); + } + if ((bool) true == duty_dither) + { + tc |= (((uint32_t) XMC_CCU4_SLICE_DITHER_DUTYCYCLE_MASK) << CCU4_CC4_TC_DITHE_Pos); + } + + slice->TC = tc; + + XMC_CCU4_SLICE_SetDitherCompareValue((XMC_CCU4_SLICE_t *)slice, (uint8_t)spread); +} + +/* Programs Pre-scalar divider */ +void XMC_CCU4_SLICE_SetPrescaler(XMC_CCU4_SLICE_t *const slice, const uint8_t div_val) +{ + uint32_t fpc; + + XMC_ASSERT("XMC_CCU4_SLICE_SetPrescaler:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + + fpc = slice->FPC; + fpc &= ~((uint32_t) CCU4_CC4_FPC_PVAL_Msk); + fpc |= ((uint32_t) div_val) << CCU4_CC4_FPC_PVAL_Pos; + slice->FPC = fpc; + /* + * In any case, update the initial value of the divider which is to be loaded once the prescaler increments to the + * compare value. + */ + slice->PSC = (uint32_t) div_val; +} + +/* Binds a capcom event to an NVIC node */ +void XMC_CCU4_SLICE_SetInterruptNode(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_IRQ_ID_t event, + const XMC_CCU4_SLICE_SR_ID_t sr) +{ + uint32_t srs; + uint32_t pos; + uint32_t mask; + + XMC_ASSERT("XMC_CCU4_SLICE_SetInterruptNode:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_SetInterruptNode:Invalid SR ID ", XMC_CCU4_SLICE_CHECK_SR_ID(sr)); + XMC_ASSERT("XMC_CCU4_SLICE_SetInterruptNode:Invalid event", XMC_CCU4_SLICE_CHECK_INTERRUPT(event)); + + srs = slice->SRS; + + switch(event) + { + case XMC_CCU4_SLICE_IRQ_ID_PERIOD_MATCH: + case XMC_CCU4_SLICE_IRQ_ID_ONE_MATCH: + mask = ((uint32_t) CCU4_CC4_SRS_POSR_Msk); + pos = CCU4_CC4_SRS_POSR_Pos; + break; + + case XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_UP: + case XMC_CCU4_SLICE_IRQ_ID_COMPARE_MATCH_DOWN: + mask = ((uint32_t) CCU4_CC4_SRS_CMSR_Msk); + pos = CCU4_CC4_SRS_CMSR_Pos; + break; + + case XMC_CCU4_SLICE_IRQ_ID_EVENT0: + mask = ((uint32_t) CCU4_CC4_SRS_E0SR_Msk); + pos = CCU4_CC4_SRS_E0SR_Pos; + break; + + case XMC_CCU4_SLICE_IRQ_ID_EVENT1: + mask = ((uint32_t) CCU4_CC4_SRS_E1SR_Msk); + pos = CCU4_CC4_SRS_E1SR_Pos; + break; + + default: + mask = ((uint32_t) CCU4_CC4_SRS_E2SR_Msk); + pos = CCU4_CC4_SRS_E2SR_Pos; + break; + } + + srs &= ~mask; + srs |= (uint32_t)sr << pos; + slice->SRS = srs; +} + +/* Asserts passive level for the slice output */ +void XMC_CCU4_SLICE_SetPassiveLevel(XMC_CCU4_SLICE_t *const slice, + const XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_t level) +{ + uint32_t psl; + + XMC_ASSERT("XMC_CCU4_SLICE_SetPassiveLevel:Invalid Slice Pointer", XMC_CCU4_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU4_SLICE_SetPassiveLevel:Invalid Passive level", ((level == XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_LOW) ||\ + (level == XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_HIGH))); + + psl = slice->PSL; + psl &= ~((uint32_t) CCU4_CC4_PSL_PSL_Msk); + psl |= (uint32_t) level; + + /* Program CC4 slice output passive level */ + slice->PSL = psl; +} + +#endif /* CCU40 */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_ccu8.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_ccu8.c new file mode 100644 index 00000000..e5ece680 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_ccu8.c @@ -0,0 +1,1320 @@ +/** + * @file xmc_ccu8.c + * @date 2017-02-25 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-06-20: + * - Removed definition of GetDriverVersion API
+ * - Added XMC_CCU8_SLICE_LoadSelector() API, to select which compare register value has to be loaded + * during external load event. + * + * 2015-07-24: + * - XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent() is updated to support XMC14 device.
+ * + * 2015-08-17: + * - XMC_CCU8_SLICE_CHC_CONFIG_MASK is not applicable to XMC14 devices.
+ * - Start of prescaler XMC_CCU8_StartPrescaler() is invoked in XMC_CCU8_Init() API.
+ * - In XMC_CCU8_SLICE_CompareInit(), CHC register is updated according to the device.
+ * - Bug fix XMC_CCU8_SLICE_ConfigureEvent() during the level setting for XMC14 devices.
+ * - XMC_CCU8_EnableShadowTransfer() definition is removed, since the API is made as inline.
+ * + * 2015-10-07: + * - XMC_CCU8_SLICE_GetEvent() is made as inline. + * - DOC updates for the newly added APIs. + * + * 2017-02-25: + * - XMC_CCU8_lAssertReset(), XMC_CCU8_lDeassertReset(), XMC_CCU8_lGateClock() and XMC_CCU8_lUngateClock() fix compilation warnings. + * + * @endcond + */ +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include "xmc_ccu8.h" + +#if defined(CCU80) +#include "xmc_scu.h" + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_CCU8_NUM_SLICES_PER_MODULE (4U) +#define XMC_CCU8_SLICE_DITHER_PERIOD_MASK (1U) +#define XMC_CCU8_SLICE_DITHER_DUTYCYCLE_MASK (2U) +#define XMC_CCU8_SLICE_EVENT_EDGE_CONFIG_MASK (3U) +#define XMC_CCU8_SLICE_EVENT_LEVEL_CONFIG_MASK (1U) +#define XMC_CCU8_SLICE_EVENT_FILTER_CONFIG_MASK (3U) +#if defined(CCU8V3) /* Defined for XMC1400 devices */ +#define XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK CCU8_CC8_INS1_EV0IS_Msk +#else +#define XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK CCU8_CC8_INS_EV0IS_Msk +#endif +#define XMC_CCU8_GIDLC_CLOCK_MASK (15U) +#define XMC_CCU8_GCSS_SLICE0_MASK (1U) +#define XMC_CCU8_GCSS_SLICE1_MASK (16U) +#define XMC_CCU8_GCSS_SLICE2_MASK (256U) +#define XMC_CCU8_GCSS_SLICE3_MASK (4096U) +#define XMC_CCU8_SLICE_DEAD_TIME_CONFIG_MASK (63U) +#if !defined(CCU8V3) /* Defined for all devices except XMC1400 */ +#define XMC_CCU8_SLICE_CHC_CONFIG_MASK (20U) +#endif + +#define XMC_CCU8_SLICE_CHECK_DTC_DIV(div) \ + ((div == XMC_CCU8_SLICE_DTC_DIV_1) || \ + (div == XMC_CCU8_SLICE_DTC_DIV_2) || \ + (div == XMC_CCU8_SLICE_DTC_DIV_4) || \ + (div == XMC_CCU8_SLICE_DTC_DIV_8)) + +#define XMC_CCU8_SLICE_CHECK_CLOCK(clock) \ + ((clock == XMC_CCU8_CLOCK_SCU) || \ + (clock == XMC_CCU8_CLOCK_EXTERNAL_A) || \ + (clock == XMC_CCU8_CLOCK_EXTERNAL_B) || \ + (clock == XMC_CCU8_CLOCK_EXTERNAL_C)) + +#define XMC_CCU8_SLICE_CHECK_OUTPUT(out) \ + ((out == XMC_CCU8_SLICE_OUTPUT_0) || \ + (out == XMC_CCU8_SLICE_OUTPUT_1) || \ + (out == XMC_CCU8_SLICE_OUTPUT_2) || \ + (out == XMC_CCU8_SLICE_OUTPUT_3)) + +#define XMC_CCU8_SLICE_CHECK_END_MODE(end_mode) \ + ((end_mode == XMC_CCU8_SLICE_END_MODE_TIMER_STOP) || \ + (end_mode == XMC_CCU8_SLICE_END_MODE_TIMER_CLEAR) || \ + (end_mode == XMC_CCU8_SLICE_END_MODE_TIMER_STOP_CLEAR)) + +#define XMC_CCU8_SLICE_CHECK_EVENT_ID(event_id) \ + ((event_id == XMC_CCU8_SLICE_EVENT_NONE)|| \ + (event_id == XMC_CCU8_SLICE_EVENT_0) || \ + (event_id == XMC_CCU8_SLICE_EVENT_1) || \ + (event_id == XMC_CCU8_SLICE_EVENT_2)) + +#define XMC_CCU8_SLICE_CHECK_EDGE_SENSITIVITY(edge) \ + ((edge == XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_NONE) || \ + (edge == XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_RISING_EDGE) || \ + (edge == XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_FALLING_EDGE)|| \ + (edge == XMC_CCU8_SLICE_EVENT_EDGE_SENSITIVITY_DUAL_EDGE)) + +#define XMC_CCU8_SLICE_CHECK_EVENT_FILTER(cycles) \ + ((cycles == XMC_CCU8_SLICE_EVENT_FILTER_DISABLED) || \ + (cycles == XMC_CCU8_SLICE_EVENT_FILTER_3_CYCLES) || \ + (cycles == XMC_CCU8_SLICE_EVENT_FILTER_5_CYCLES) || \ + (cycles == XMC_CCU8_SLICE_EVENT_FILTER_7_CYCLES)) + +#define XMC_CCU8_SLICE_CHECK_CAP_TIMER_CLEAR_MODE(mode) \ + ((mode == XMC_CCU8_SLICE_TIMER_CLEAR_MODE_NEVER) || \ + (mode == XMC_CCU8_SLICE_TIMER_CLEAR_MODE_CAP_HIGH)|| \ + (mode == XMC_CCU8_SLICE_TIMER_CLEAR_MODE_CAP_LOW) || \ + (mode == XMC_CCU8_SLICE_TIMER_CLEAR_MODE_ALWAYS)) + +#define XMC_CCU8_SLICE_CHECK_MCS_ACTION(mcs_action) \ + ((mcs_action == XMC_CCU8_SLICE_MCMS_ACTION_TRANSFER_PR_CR) || \ + (mcs_action == XMC_CCU8_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP) || \ + (mcs_action == XMC_CCU8_SLICE_MCMS_ACTION_TRANSFER_PR_CR_PCMP_DIT)) + +#define XMC_CCU8_SLICE_CHECK_SR_ID(id) \ + ((id == XMC_CCU8_SLICE_SR_ID_0) || \ + (id == XMC_CCU8_SLICE_SR_ID_1) || \ + (id == XMC_CCU8_SLICE_SR_ID_2) || \ + (id == XMC_CCU8_SLICE_SR_ID_3)) + +#define XMC_CCU8_SLICE_CHECK_MODULATION_CHANNEL(channel) \ + ((channel == XMC_CCU8_SLICE_MODULATION_CHANNEL_NONE) || \ + (channel == XMC_CCU8_SLICE_MODULATION_CHANNEL_1) || \ + (channel == XMC_CCU8_SLICE_MODULATION_CHANNEL_2) || \ + (channel == XMC_CCU8_SLICE_MODULATION_CHANNEL_1_AND_2)) + +#if((UC_SERIES == XMC13) || (UC_SERIES == XMC14)) +#define XMC_CCU8_SLICE_CHECK_SLICE_STATUS(channel) \ + ((channel == XMC_CCU8_SLICE_STATUS_CHANNEL_1) || \ + (channel == XMC_CCU8_SLICE_STATUS_CHANNEL_2) || \ + (channel == XMC_CCU8_SLICE_STATUS_CHANNEL_1_AND_2) || \ + (channel == XMC_CCU8_SLICE_STATUS_CHANNEL_1_OR_2)) +#else +#define XMC_CCU8_SLICE_CHECK_SLICE_STATUS(channel) \ + ((channel == XMC_CCU8_SLICE_STATUS_CHANNEL_1) || \ + (channel == XMC_CCU8_SLICE_STATUS_CHANNEL_2) || \ + (channel == XMC_CCU8_SLICE_STATUS_CHANNEL_1_AND_2)) +#endif + +/********************************************************************************************************************* + * LOCAL ROUTINES + ********************************************************************************************************************/ +#if defined(PERIPHERAL_RESET_SUPPORTED) +__STATIC_INLINE void XMC_CCU8_lAssertReset(const XMC_CCU8_MODULE_t *const module) +{ + if (module == CCU80) + { + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU80); + } +#if defined(CCU81) + else if (module == CCU81) + { + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU81); + } +#endif + else + { + XMC_ASSERT("XMC_CCU8_lAssertReset:Invalid Module Pointer", 0); + } +} + +__STATIC_INLINE void XMC_CCU8_lDeassertReset(const XMC_CCU8_MODULE_t *const module) +{ + if (module == CCU80) + { + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU80); + } +#if defined(CCU81) + else if (module == CCU81) + { + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_CCU81); + } +#endif + else + { + XMC_ASSERT("XMC_CCU8_lDeassertReset:Invalid Module Pointer", 0); + } +} +#endif + +#if defined(CLOCK_GATING_SUPPORTED) +__STATIC_INLINE void XMC_CCU8_lGateClock(XMC_CCU8_MODULE_t *const module) +{ + if (module == CCU80) + { + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU80); + } +#if defined(CCU81) + else if (module == CCU81) + { + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU81); + } +#endif + else + { + XMC_ASSERT("XMC_CCU8_lGateClock:Invalid Module Pointer", 0); + } +} + +__STATIC_INLINE void XMC_CCU8_lUngateClock(XMC_CCU8_MODULE_t *const module) +{ + if (module == CCU80) + { + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU80); + } +#if defined(CCU81) + else if (module == CCU81) + { + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_CCU81); + } +#endif + else + { + XMC_ASSERT("XMC_CCU8_lUngateClock:Invalid Module Pointer", 0); + } +} +#endif + +#if defined (XMC_ASSERT_ENABLE) +__STATIC_INLINE bool XMC_CCU8_SLICE_IsInputvalid(XMC_CCU8_SLICE_INPUT_t input) +{ +#if (UC_SERIES == XMC14) + return (input < 48U); +#else + return (input < 16U); +#endif +} +#endif +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* API to set the CCU8 module as active and enable the clock */ +void XMC_CCU8_EnableModule(XMC_CCU8_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU8_EnableModule:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + +#if (UC_FAMILY == XMC4) + /* Enable CCU8 module clock */ + XMC_SCU_CLOCK_EnableClock(XMC_SCU_CLOCK_CCU); +#endif + +#if defined(CLOCK_GATING_SUPPORTED) + XMC_CCU8_lUngateClock(module); +#endif + +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_CCU8_lDeassertReset(module); +#endif +} + +/* API to set the CCU8 module as idle and disable the clock */ +void XMC_CCU8_DisableModule(XMC_CCU8_MODULE_t *const module) +{ + XMC_ASSERT("XMC_CCU8_DisableModule:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_CCU8_lAssertReset(module); +#endif + +#if defined(CLOCK_GATING_SUPPORTED) + XMC_CCU8_lGateClock(module); +#endif +} + +/* API to initialize CCU8 global resources */ +void XMC_CCU8_Init(XMC_CCU8_MODULE_t *const module, const XMC_CCU8_SLICE_MCMS_ACTION_t mcs_action) +{ + uint32_t gctrl; + + XMC_ASSERT("XMC_CCU8_Init:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + XMC_ASSERT("XMC_CCU8_Init:Invalid mcs action", XMC_CCU8_SLICE_CHECK_MCS_ACTION(mcs_action)); + + /* Enable CCU8 module */ + XMC_CCU8_EnableModule(module); + /* Start the prescaler */ + XMC_CCU8_StartPrescaler(module); + + gctrl = module->GCTRL; + gctrl &= ~((uint32_t) CCU8_GCTRL_MSDE_Msk); + gctrl |= (uint32_t)mcs_action << CCU8_GCTRL_MSDE_Pos; + + module->GCTRL = gctrl; +} + +/* API to select CCU8 module clock */ +void XMC_CCU8_SetModuleClock(XMC_CCU8_MODULE_t *const module, const XMC_CCU8_CLOCK_t clock) +{ + uint32_t gctrl; + + XMC_ASSERT("XMC_CCU8_SetModuleClock:Invalid Module Pointer", XMC_CCU8_IsValidModule(module)); + XMC_ASSERT("XMC_CCU8_SetModuleClock:Invalid Module Clock", XMC_CCU8_SLICE_CHECK_CLOCK(clock)); + + gctrl = module->GCTRL; + gctrl &= ~((uint32_t) CCU8_GCTRL_PCIS_Msk); + gctrl |= ((uint32_t) clock) << CCU8_GCTRL_PCIS_Pos; + + module->GCTRL = gctrl; +} + +/* API to configure CC8 Slice in Compare mode */ +void XMC_CCU8_SLICE_CompareInit(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CONFIG_t *const compare_init) +{ + XMC_ASSERT("XMC_CCU8_SLICE_CompareInit:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_CompareInit:Timer Init Pointer is NULL", + (XMC_CCU8_SLICE_COMPARE_CONFIG_t *) NULL != compare_init); + /* Stops the timer */ + XMC_CCU8_SLICE_StopTimer(slice); + /* Program the timer mode */ + slice->TC = compare_init->tc; + /* Enable the timer concatenation */ + slice->CMC = (uint32_t)compare_init->timer_concatenation << CCU8_CC8_CMC_TCE_Pos; + /* Program initial prescaler divider value */ + slice->PSC = (uint32_t) compare_init->prescaler_initval; + /* Program floating prescaler compare value */ + slice->FPCS = (uint32_t) compare_init->float_limit; + /* Program the dither compare value */ + slice->DITS = (uint32_t) compare_init->dither_limit; + /* Program timer output passive level */ + slice->PSL = (uint32_t) compare_init->psl; + /* Asymmetric PWM and Slice output routing configuration */ +#if defined(CCU8V3) /* Defined for XMC1400 devices only */ + slice->CHC = (uint32_t) compare_init->chc; +#else + slice->CHC = (uint32_t)((uint32_t)compare_init->chc ^ XMC_CCU8_SLICE_CHC_CONFIG_MASK); +#endif +} + +/* API to configure CC8 Slice in Capture mode */ +void XMC_CCU8_SLICE_CaptureInit(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_CAPTURE_CONFIG_t *const capture_init) +{ + XMC_ASSERT("XMC_CCU8_SLICE_CaptureInit:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_CaptureInit:Capture Init Pointer is NULL", + (XMC_CCU8_SLICE_CAPTURE_CONFIG_t *) NULL != capture_init); + /* Stops the timer */ + XMC_CCU8_SLICE_StopTimer(slice); + /* Capture mode configuration */ + slice->TC = capture_init->tc; + /* Enable the timer concatenation */ + slice->CMC = (uint32_t)capture_init->timer_concatenation << CCU8_CC8_CMC_TCE_Pos; + /* Program floating prescaler compare value */ + slice->FPCS = (uint32_t) capture_init->float_limit; + /* Program initial prescaler divider value */ + slice->PSC = (uint32_t) capture_init->prescaler_initval; +} + +/* API to configure the each output of the slice with either STx or inverted STx. */ +void XMC_CCU8_SLICE_SetOutPath(XMC_CCU8_SLICE_t *const slice, const uint32_t out_path_msk) +{ + uint32_t chc; + XMC_ASSERT("XMC_CCU8_SLICE_SetOutPath:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + chc = slice->CHC; +#if !defined(CCU8V3) /* Defined for all devices except XMC1400 */ + chc &= ~((uint32_t)out_path_msk >> 16U); + chc |= ((uint32_t)out_path_msk & 0xFFFFU); +#else + chc &= ~((uint32_t)((uint32_t)(out_path_msk & 0xCCCC0U) >> 2U)); + chc |= ((uint32_t)out_path_msk & 0x33330U); +#endif + slice->CHC = chc; +} + +/* API to configure the multichannel shadow transfer request via SW and via the CCU8x.MCSS input. */ +void XMC_CCU8_SetMultiChannelShadowTransferMode(XMC_CCU8_MODULE_t *const module, const uint32_t slice_mode_msk) +{ + uint32_t gctrl; + + XMC_ASSERT("XMC_CCU8_SetMultiChannelShadowTransferMode:Invalid module Pointer", XMC_CCU8_IsValidModule(module)); + + gctrl = module->GCTRL; + gctrl &= ~((uint32_t)slice_mode_msk >> 16U); + gctrl |= ((uint32_t)slice_mode_msk & 0xFFFFU); + module->GCTRL = gctrl; +} + + +/* API to configure the Start trigger function of a slice*/ +void XMC_CCU8_SLICE_StartConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_START_MODE_t start_mode) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_StartConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_StartConfig:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU8_SLICE_StartConfig:Invalid Start Mode", + ((start_mode == XMC_CCU8_SLICE_START_MODE_TIMER_START) ||\ + (start_mode == XMC_CCU8_SLICE_START_MODE_TIMER_START_CLEAR))); + cmc = slice->CMC; + + cmc &= ~((uint32_t) CCU8_CC8_CMC_STRTS_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_STRTS_Pos; + + slice->CMC = cmc; + + tc = slice->TC; + + if(start_mode == XMC_CCU8_SLICE_START_MODE_TIMER_START_CLEAR) + { + tc |= (uint32_t) CCU8_CC8_TC_STRM_Msk; + } + else + { + tc &= ~((uint32_t) CCU8_CC8_TC_STRM_Msk); + } + + slice->TC = tc; +} + +/* API to configure the Stop trigger function of a slice */ +void XMC_CCU8_SLICE_StopConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_END_MODE_t end_mode) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_StopConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_StopConfig:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU8_SLICE_StopConfig:Invalid End Mode", XMC_CCU8_SLICE_CHECK_END_MODE(end_mode)); + + cmc = slice->CMC; + /* First, Bind the event with the stop function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_ENDS_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_ENDS_Pos; + + slice->CMC = cmc; + + /* Configure the stop mode */ + tc = slice->TC; + tc &= ~((uint32_t) CCU8_CC8_TC_ENDM_Msk); + tc |= ((uint32_t) end_mode) << CCU8_CC8_TC_ENDM_Pos; + + slice->TC = tc; +} + +/* API to configure the Load trigger function of a slice*/ +void XMC_CCU8_SLICE_LoadConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU8_SLICE_LoadConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_LoadConfig:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + + cmc = slice->CMC; + + /* First, Bind the event with the load function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_LDS_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_LDS_Pos; + + slice->CMC = cmc; +} + +/* API to configure, which compare register value has to be loaded during external load event */ +void XMC_CCU8_SLICE_LoadSelector(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_COMPARE_CHANNEL_t ch_num) +{ + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_LoadSelector:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_LoadSelector:Invalid Channel number", XMC_CCU8_SLICE_CHECK_COMP_CHANNEL(ch_num)); + + tc = slice->TC; + + /* First, Bind the event with the load function */ + tc &= ~((uint32_t) CCU8_CC8_TC_TLS_Msk); + tc |= (uint32_t)ch_num << CCU8_CC8_TC_TLS_Pos; + + slice->TC = tc; +} + +/* API to configure the slice modulation function */ +void XMC_CCU8_SLICE_ModulationConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_MODULATION_MODE_t mod_mode, + const XMC_CCU8_SLICE_MODULATION_CHANNEL_t channel, + const bool synch_with_pwm) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_ModulationConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_ModulationConfig:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU8_SLICE_ModulationConfig:Invalid channel for modulation", + XMC_CCU8_SLICE_CHECK_MODULATION_CHANNEL(channel)); + XMC_ASSERT("XMC_CCU8_SLICE_ModulationConfig:Invalid Modulation Mode", + ((mod_mode == XMC_CCU8_SLICE_MODULATION_MODE_CLEAR_ST_OUT) ||\ + (mod_mode == XMC_CCU8_SLICE_MODULATION_MODE_CLEAR_OUT))); + + cmc = slice->CMC; + + /* First, Bind the event with the modulation function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_MOS_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_MOS_Pos; + + slice->CMC = cmc; + + tc = slice->TC; + + /* Next, Modulation mode */ + if(mod_mode == XMC_CCU8_SLICE_MODULATION_MODE_CLEAR_OUT) + { + tc |= (uint32_t) CCU8_CC8_TC_EMT_Msk; + } + else + { + tc &= ~((uint32_t) CCU8_CC8_TC_EMT_Msk); + } + + /* Synchronization of modulation effect with PWM cycle */ + if(synch_with_pwm == true) + { + tc |= (uint32_t) CCU8_CC8_TC_EMS_Msk; + } + else + { + tc &= ~((uint32_t) CCU8_CC8_TC_EMS_Msk); + } + + /* Configure on which channel external modulation to be applied */ + tc &= ~((uint32_t) CCU8_CC8_TC_EME_Msk); + tc |= (uint32_t)channel << CCU8_CC8_TC_EME_Pos; + + slice->TC = tc; +} + +/* API to configure the slice count function */ +void XMC_CCU8_SLICE_CountConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU8_SLICE_CountConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_CountConfig:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + + cmc = slice->CMC; + + /* First, Bind the event with the count function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_CNTS_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_CNTS_Pos; + + slice->CMC = cmc; +} + +/* API to configure slice gate function */ +void XMC_CCU8_SLICE_GateConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU8_SLICE_GateConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_GateConfig:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + + cmc = slice->CMC; + + /* First, Bind the event with the gate function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_GATES_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_GATES_Pos; + + slice->CMC = cmc; +} + +/* API to configure Capture-0 function */ +void XMC_CCU8_SLICE_Capture0Config(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU8_SLICE_Capture0Config:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_Capture0Config:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + + cmc = slice->CMC; + + /* First, Bind the event with the gate function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_CAP0S_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_CAP0S_Pos; + + slice->CMC = cmc; +} + +/* API to configure Capture-1 function */ +void XMC_CCU8_SLICE_Capture1Config(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU8_SLICE_Capture1Config:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_Capture1Config:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + + + cmc = slice->CMC; + + /* First, Bind the event with the gate function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_CAP1S_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_CAP1S_Pos; + + slice->CMC = cmc; +} + +/* API to configure direction function */ +void XMC_CCU8_SLICE_DirectionConfig(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_EVENT_t event) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU8_SLICE_DirectionConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_DirectionConfig:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + + cmc = slice->CMC; + + /* First, Bind the event with the direction function */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_UDS_Msk); + cmc |= ((uint32_t) event) << CCU8_CC8_CMC_UDS_Pos; + + slice->CMC = cmc; +} + +/* API to configure slice status bit override function */ +void XMC_CCU8_SLICE_StatusBitOverrideConfig(XMC_CCU8_SLICE_t *const slice) +{ + uint32_t cmc; + + XMC_ASSERT("XMC_CCU8_SLICE_StatusBitOverrideConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + + cmc = slice->CMC; + + /* Map status bit trigger override to Event 1 & + status bit value override to Event 2 */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_OFS_Msk); + cmc |= ((uint32_t) 1) << CCU8_CC8_CMC_OFS_Pos; + + slice->CMC = cmc; +} + +/* API to configure trap function*/ +void XMC_CCU8_SLICE_TrapConfig(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_TRAP_EXIT_MODE_t exit_mode, + const bool synch_with_pwm) +{ + uint32_t cmc; + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_TrapConfig:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_TrapConfig:Invalid Exit Mode", ((exit_mode == XMC_CCU8_SLICE_TRAP_EXIT_MODE_AUTOMATIC) ||\ + (exit_mode == XMC_CCU8_SLICE_TRAP_EXIT_MODE_SW))); + + cmc = slice->CMC; + + /* Map trap function to Event 2 */ + cmc &= ~((uint32_t) CCU8_CC8_CMC_TS_Msk); + cmc |= ((uint32_t) 1) << CCU8_CC8_CMC_TS_Pos; + + slice->CMC = cmc; + + tc = slice->TC; + + /* Configure synchronization option */ + if(synch_with_pwm == true) + { + tc |= (uint32_t) CCU8_CC8_TC_TRPSE_Msk; + } + else + { + tc &= ~((uint32_t) CCU8_CC8_TC_TRPSE_Msk); + } + + /* Configure exit mode */ + if(exit_mode == XMC_CCU8_SLICE_TRAP_EXIT_MODE_SW) + { + tc |= (uint32_t) CCU8_CC8_TC_TRPSW_Msk; + } + else + { + tc &= ~((uint32_t) CCU8_CC8_TC_TRPSW_Msk); + } + + slice->TC = tc; +} + +/* API to configure a slice Status Bit Override event */ +void XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_CONFIG_t *const ev1_config, + const XMC_CCU8_SLICE_EVENT_CONFIG_t *const ev2_config) +{ + uint32_t ins; + + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Input", + XMC_CCU8_SLICE_IsInputvalid(ev1_config->mapped_input)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Edge Sensitivity", + XMC_CCU8_SLICE_CHECK_EDGE_SENSITIVITY(ev1_config->edge)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Level Sensitivity", + ((ev1_config->level == XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH) ||\ + (ev1_config->level == XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW))); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Debounce Period", + XMC_CCU8_SLICE_CHECK_EVENT_FILTER(ev1_config->duration)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Input", + XMC_CCU8_SLICE_IsInputvalid(ev2_config->mapped_input)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Edge Sensitivity", + XMC_CCU8_SLICE_CHECK_EDGE_SENSITIVITY(ev2_config->edge)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Level Sensitivity", + ((ev2_config->level == XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH) ||\ + (ev2_config->level == XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW))); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOverrideEvent:Invalid Debounce Period", + XMC_CCU8_SLICE_CHECK_EVENT_FILTER(ev2_config->duration)); + +#if defined(CCU8V3) /* Defined for XMC1400 devices only */ + ins = slice->INS2; + + /* Configure the edge sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU8_CC8_INS2_EV1EM_Pos); + ins |= ((uint32_t) ev1_config->edge) << CCU8_CC8_INS2_EV1EM_Pos; + + /* Configure the edge sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU8_CC8_INS2_EV2EM_Pos); + ins |= ((uint32_t) ev2_config->edge) << CCU8_CC8_INS2_EV2EM_Pos; + + /* Configure the level sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU8_CC8_INS2_EV1LM_Pos); + ins |= ((uint32_t) ev1_config->level) << CCU8_CC8_INS2_EV1LM_Pos; + + /* Configure the level sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU8_CC8_INS2_EV2LM_Pos); + ins |= ((uint32_t) ev2_config->level) << CCU8_CC8_INS2_EV2LM_Pos; + + /* Configure the debounce filter for event 1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU8_CC8_INS2_LPF1M_Pos); + ins |= ((uint32_t) ev1_config->duration) << CCU8_CC8_INS2_LPF1M_Pos; + + /* Configure the debounce filter for event 2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU8_CC8_INS2_LPF2M_Pos); + ins |= ((uint32_t) ev2_config->duration) << CCU8_CC8_INS2_LPF2M_Pos; + + slice->INS2 = ins; + + ins = slice->INS1; + /* Next, the input for Event1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU8_CC8_INS1_EV1IS_Pos); + ins |= ((uint32_t) ev1_config->mapped_input) << CCU8_CC8_INS1_EV1IS_Pos; + + /* Finally, the input for Event2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU8_CC8_INS1_EV2IS_Pos); + ins |= ((uint32_t) ev2_config->mapped_input) << CCU8_CC8_INS1_EV2IS_Pos; + + slice->INS1 = ins; +#else + ins = slice->INS; + + /* Configure the edge sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU8_CC8_INS_EV1EM_Pos); + ins |= ((uint32_t) ev1_config->edge) << CCU8_CC8_INS_EV1EM_Pos; + + /* Configure the edge sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_EDGE_CONFIG_MASK) << CCU8_CC8_INS_EV2EM_Pos); + ins |= ((uint32_t) ev2_config->edge) << CCU8_CC8_INS_EV2EM_Pos; + + /* Configure the level sensitivity for event 1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU8_CC8_INS_EV1LM_Pos); + ins |= ((uint32_t) ev1_config->level) << CCU8_CC8_INS_EV1LM_Pos; + + /* Configure the level sensitivity for event 2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_LEVEL_CONFIG_MASK) << CCU8_CC8_INS_EV2LM_Pos); + ins |= ((uint32_t) ev2_config->level) << CCU8_CC8_INS_EV2LM_Pos; + + /* Configure the debounce filter for event 1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU8_CC8_INS_LPF1M_Pos); + ins |= ((uint32_t) ev1_config->duration) << CCU8_CC8_INS_LPF1M_Pos; + + /* Configure the debounce filter for event 2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_FILTER_CONFIG_MASK) << CCU8_CC8_INS_LPF2M_Pos); + ins |= ((uint32_t) ev2_config->duration) << CCU8_CC8_INS_LPF2M_Pos; + + /* Next, the input for Event1 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU8_CC8_INS_EV1IS_Pos); + ins |= ((uint32_t) ev1_config->mapped_input) << CCU8_CC8_INS_EV1IS_Pos; + + /* Finally, the input for Event2 */ + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << CCU8_CC8_INS_EV2IS_Pos); + ins |= ((uint32_t) ev2_config->mapped_input) << CCU8_CC8_INS_EV2IS_Pos; + + slice->INS = ins; +#endif +} + +/* API to configure a slice trigger event */ +void XMC_CCU8_SLICE_ConfigureEvent(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_EVENT_CONFIG_t *const config) +{ + uint32_t ins; + uint8_t pos; + uint8_t offset; + + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureEvent:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureEvent:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureEvent:Invalid Input", XMC_CCU8_SLICE_IsInputvalid(config->mapped_input)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureEvent:Invalid Edge Sensitivity", + XMC_CCU8_SLICE_CHECK_EDGE_SENSITIVITY(config->edge)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureEvent:Invalid Level Sensitivity", + ((config->level == XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_HIGH) ||\ + (config->level == XMC_CCU8_SLICE_EVENT_LEVEL_SENSITIVITY_ACTIVE_LOW))); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureEvent:Invalid Debounce Period", + XMC_CCU8_SLICE_CHECK_EVENT_FILTER(config->duration)); + + /* Calculate offset with reference to event */ + offset = ((uint8_t) event) - 1U; + +#if defined(CCU8V3) /* Defined for XMC1400 devices only */ + ins = slice->INS2; + + /* First, configure the edge sensitivity */ + pos = ((uint8_t) CCU8_CC8_INS2_EV0EM_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_EDGE_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->edge) << pos; + + /* Next, the level */ + pos = ((uint8_t) CCU8_CC8_INS2_EV0LM_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_LEVEL_CONFIG_MASK) << pos); + ins |= ((uint32_t) (config->level)) << pos; + + /* Next, the debounce filter */ + pos = ((uint8_t) CCU8_CC8_INS2_LPF0M_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_FILTER_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->duration) << pos; + + slice->INS2 = ins; + + ins = slice->INS1; + + /* Finally the input */ + pos = ((uint8_t) CCU8_CC8_INS1_EV0IS_Pos) + (uint8_t)(offset << 3U); + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->mapped_input) << pos; + + slice->INS1 = ins; + +#else + ins = slice->INS; + + /* First, configure the edge sensitivity */ + pos = ((uint8_t) CCU8_CC8_INS_EV0EM_Pos) + (uint8_t)(offset << 1U); + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_EDGE_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->edge) << pos; + + /* Next, the level */ + pos = ((uint8_t) CCU8_CC8_INS_EV0LM_Pos) + offset; + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_LEVEL_CONFIG_MASK) << pos); + ins |= ((uint32_t) (config->level)) << pos; + + /* Next, the debounce filter */ + pos = ((uint8_t) CCU8_CC8_INS_LPF0M_Pos) + (uint8_t)(offset << 1U); + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_FILTER_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->duration) << pos; + + /* Finally the input */ + pos = ((uint8_t) CCU8_CC8_INS_EV0IS_Pos) + (uint8_t)(offset << 2U); + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) config->mapped_input) << pos; + + slice->INS = ins; +#endif +} + +/* API to bind an input to a slice trigger event */ +void XMC_CCU8_SLICE_SetInput(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_EVENT_t event, + const XMC_CCU8_SLICE_INPUT_t input) +{ + uint32_t ins; + uint8_t pos; + uint8_t offset; + + XMC_ASSERT("XMC_CCU8_SLICE_SetInput:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetInput:Invalid Event ID", XMC_CCU8_SLICE_CHECK_EVENT_ID(event)); + XMC_ASSERT("XMC_CCU8_SLICE_SetInput:Invalid Input", XMC_CCU8_SLICE_IsInputvalid(input)); + + /* Calculate offset with reference to event */ + offset = ((uint8_t) event) - 1U; + +#if defined(CCU8V3) /* Defined for XMC1400 devices only */ + pos = ((uint8_t) CCU8_CC8_INS1_EV0IS_Pos) + (uint8_t) (offset << 3U); + ins = slice->INS1; + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) input) << pos; + + slice->INS1 = ins; +#else + + pos = ((uint8_t) CCU8_CC8_INS_EV0IS_Pos) + (uint8_t) (offset << 2U); + ins = slice->INS; + ins &= ~(((uint32_t) XMC_CCU8_SLICE_EVENT_INPUT_CONFIG_MASK) << pos); + ins |= ((uint32_t) input) << pos; + + slice->INS = ins; +#endif +} + +/* API to program timer repeat mode - Single shot vs repeat */ +void XMC_CCU8_SLICE_SetTimerRepeatMode(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_TIMER_REPEAT_MODE_t mode) +{ + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerRepeatMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerRepeatMode:Invalid Timer Repeat Mode", + ((mode == XMC_CCU8_SLICE_TIMER_REPEAT_MODE_REPEAT) ||\ + (mode == (mode == XMC_CCU8_SLICE_TIMER_REPEAT_MODE_REPEAT)))); + + tc = slice->TC; + + if(XMC_CCU8_SLICE_TIMER_REPEAT_MODE_REPEAT == mode) + { + tc &= ~((uint32_t) CCU8_CC8_TC_TSSM_Msk); + } + else + { + tc |= (uint32_t) CCU8_CC8_TC_TSSM_Msk; + } + + slice->TC = tc; +} + +/* Programs timer counting mode */ +void XMC_CCU8_SLICE_SetTimerCountingMode(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_TIMER_COUNT_MODE_t mode) +{ + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerCountingMode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerCountingMode:Invalid Timer Count Mode", + ((mode == XMC_CCU8_SLICE_TIMER_COUNT_MODE_EA) ||\ + (mode == XMC_CCU8_SLICE_TIMER_COUNT_MODE_CA))); + + tc = slice->TC; + + if(XMC_CCU8_SLICE_TIMER_COUNT_MODE_EA == mode) + { + tc &= ~((uint32_t) CCU8_CC8_TC_TCM_Msk); + } + else + { + tc |= (uint32_t) CCU8_CC8_TC_TCM_Msk; + } + + slice->TC = tc; +} + +/* Programs period match value of the timer */ +void XMC_CCU8_SLICE_SetTimerPeriodMatch(XMC_CCU8_SLICE_t *const slice, const uint16_t period_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerPeriodMatch:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + slice->PRS = (uint32_t) period_val; +} + +/* Retrieves desired capture register value */ +uint32_t XMC_CCU8_SLICE_GetCaptureRegisterValue(const XMC_CCU8_SLICE_t *const slice, const uint8_t reg_num) +{ + XMC_ASSERT("XMC_CCU8_SLICE_GetCaptureRegisterValue:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_GetCaptureRegisterValue:Invalid register number", (reg_num < 4U)); + return(slice->CV[reg_num]); +} + +/* @brief Retrieves the latest captured timer value */ +XMC_CCU8_STATUS_t XMC_CCU8_SLICE_GetLastCapturedTimerValue(const XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_CAP_REG_SET_t set, + uint32_t *val_ptr) +{ + + XMC_CCU8_STATUS_t retval; + uint8_t i; + uint8_t start; + uint8_t end; + + XMC_ASSERT("XMC_CCU8_SLICE_GetLastCapturedTimerValue:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_GetLastCapturedTimerValue:Invalid Register Set", + ((set == XMC_CCU8_SLICE_CAP_REG_SET_LOW) ||\ + (set == XMC_CCU8_SLICE_CAP_REG_SET_HIGH))); + + retval = XMC_CCU8_STATUS_ERROR; + + /* First check if extended capture mode is enabled */ + if((slice->TC) & CCU8_CC8_TC_ECM_Msk) + { + /* Extended capture mode has been enabled. So start with the lowest capture register and work your way up */ + start = 0U; + end = XMC_CCU8_NUM_SLICES_PER_MODULE; + } + else + { + /* Extended capture mode is not enabled */ + if(set == XMC_CCU8_SLICE_CAP_REG_SET_HIGH) + { + start = ((uint8_t) XMC_CCU8_NUM_SLICES_PER_MODULE) >> 1U; + end = (uint8_t) XMC_CCU8_NUM_SLICES_PER_MODULE; + } + else + { + start = 0U; + end = ((uint8_t) XMC_CCU8_NUM_SLICES_PER_MODULE) >> 1U; + } + } + + for(i=start; iCV[i]) & CCU8_CC8_CV_FFL_Msk ) + { + *val_ptr = slice->CV[i]; + retval = XMC_CCU8_STATUS_OK; + break; + } + } + + return retval; +} +/* Retrieves timer capture value from a FIFO made of capture registers */ +#if defined(CCU8V1) /* Defined for XMC4800, XMC4700, XMC4500, XMC4400, XMC4200, XMC4100 devices only */ +int32_t XMC_CCU8_GetCapturedValueFromFifo(const XMC_CCU8_MODULE_t *const module, const uint8_t slice_number) +{ + int32_t cap; + uint32_t extracted_slice; + + XMC_ASSERT("XMC_CCU8_GetCapturedValueFromFifo:Invalid Slice Pointer", XMC_CCU8_IsValidModule(module)); + + /* First read the global fifo register */ + cap = (int32_t) module->ECRD; + + extracted_slice = (((uint32_t) cap) & ((uint32_t) CCU8_ECRD_SPTR_Msk)) >> CCU8_ECRD_SPTR_Pos; + + /* Return captured result only if it were applicable to this slice */ + if(extracted_slice != ((uint32_t)slice_number)) + { + cap = -1; + } + + return (cap); +} +#else +/* Retrieves timer capture value from a FIFO made of capture registers */ +uint32_t XMC_CCU8_SLICE_GetCapturedValueFromFifo(const XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_CAP_REG_SET_t set) +{ + uint32_t cap; + + XMC_ASSERT("XMC_CCU8_SLICE_GetCapturedValueFromFifo:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_GetCapturedValueFromFifo:Invalid Register Set", + ((set == XMC_CCU8_SLICE_CAP_REG_SET_LOW) ||\ + (set == XMC_CCU8_SLICE_CAP_REG_SET_HIGH))); + + if(XMC_CCU8_SLICE_CAP_REG_SET_LOW == set) + { + cap = slice->ECRD0; + } + else + { + cap = slice->ECRD1; + } + + return cap; +} +#endif + +/* Enables PWM dithering feature */ +void XMC_CCU8_SLICE_EnableDithering(XMC_CCU8_SLICE_t *const slice, + const bool period_dither, + const bool duty_dither, + const uint8_t spread) +{ + uint32_t tc; + + XMC_ASSERT("XMC_CCU8_SLICE_EnableDithering:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + + tc = slice->TC; + tc &= ~((uint32_t) CCU8_CC8_TC_DITHE_Msk); + + if(true == period_dither) + { + tc |= (((uint32_t) XMC_CCU8_SLICE_DITHER_PERIOD_MASK) << CCU8_CC8_TC_DITHE_Pos); + } + if(true == duty_dither) + { + tc |= (((uint32_t) XMC_CCU8_SLICE_DITHER_DUTYCYCLE_MASK) << CCU8_CC8_TC_DITHE_Pos); + } + + slice->TC = tc; + + XMC_CCU8_SLICE_SetDitherCompareValue((XMC_CCU8_SLICE_t *)slice, (uint8_t)spread); +} + +/* Programs Pre-scaler divider */ +void XMC_CCU8_SLICE_SetPrescaler(XMC_CCU8_SLICE_t *const slice, const uint8_t div_val) +{ + uint32_t fpc; + + XMC_ASSERT("XMC_CCU8_SLICE_SetPrescaler:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + + /* If the prescaler is not running, update directly the divider*/ + fpc = slice->FPC; + fpc &= ~((uint32_t) CCU8_CC8_FPC_PVAL_Msk); + fpc |= ((uint32_t) div_val) << CCU8_CC8_FPC_PVAL_Pos; + slice->FPC = fpc; + + /* + * In any case, update the initial value of the divider which is to be loaded once the prescaler increments to the + * compare value. + */ + slice->PSC = (uint32_t) div_val; +} + +/* Programs timer compare match value for channel 1 or 2 */ +void XMC_CCU8_SLICE_SetTimerCompareMatch(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t channel, + const uint16_t compare_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerCompareMatch:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetTimerCompareMatch:Invalid channel", XMC_CCU8_SLICE_CHECK_COMP_CHANNEL(channel)); + + if (XMC_CCU8_SLICE_COMPARE_CHANNEL_1 == channel) + { + slice->CR1S = (uint32_t) compare_val; + } + else + { + slice->CR2S = (uint32_t) compare_val; + } +} + +/* Returns the timer compare match value for channel 1 or 2 */ +uint16_t XMC_CCU8_SLICE_GetTimerCompareMatch(const XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t channel) +{ + uint16_t compare_value; + + XMC_ASSERT("XMC_CCU8_SLICE_GetCompareMatch:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_GetCompareMatch:Invalid channel", XMC_CCU8_SLICE_CHECK_COMP_CHANNEL(channel)); + + if (XMC_CCU8_SLICE_COMPARE_CHANNEL_1 == channel) + { + compare_value = (uint16_t) slice->CR1; + } + else + { + compare_value = (uint16_t) slice->CR2; + } + + return(compare_value); +} + +/* Binds a capcom event to an NVIC node */ +void XMC_CCU8_SLICE_SetInterruptNode(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_IRQ_ID_t event, + const XMC_CCU8_SLICE_SR_ID_t sr) +{ + uint32_t srs; + uint32_t mask; + uint32_t pos; + + XMC_ASSERT("XMC_CCU8_SLICE_SetInterruptNode:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetInterruptNode:Invalid SR ID ", XMC_CCU8_SLICE_CHECK_SR_ID(sr)); + XMC_ASSERT("XMC_CCU8_SLICE_SetInterruptNode:Invalid event", XMC_CCU8_SLICE_CHECK_INTERRUPT(event)); + + srs = slice->SRS; + + switch(event) + { + case XMC_CCU8_SLICE_IRQ_ID_PERIOD_MATCH: + case XMC_CCU8_SLICE_IRQ_ID_ONE_MATCH: + mask = ((uint32_t) CCU8_CC8_SRS_POSR_Msk); + pos = CCU8_CC8_SRS_POSR_Pos; + break; + + case XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_UP_CH_1: + case XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_DOWN_CH_1: + mask = ((uint32_t) CCU8_CC8_SRS_CM1SR_Msk); + pos = CCU8_CC8_SRS_CM1SR_Pos; + break; + + case XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_UP_CH_2: + case XMC_CCU8_SLICE_IRQ_ID_COMPARE_MATCH_DOWN_CH_2: + mask = ((uint32_t) CCU8_CC8_SRS_CM2SR_Msk); + pos = CCU8_CC8_SRS_CM2SR_Pos; + break; + + case XMC_CCU8_SLICE_IRQ_ID_EVENT0: + mask = ((uint32_t) CCU8_CC8_SRS_E0SR_Msk); + pos = CCU8_CC8_SRS_E0SR_Pos; + break; + + case XMC_CCU8_SLICE_IRQ_ID_EVENT1: + mask = ((uint32_t) CCU8_CC8_SRS_E1SR_Msk); + pos = CCU8_CC8_SRS_E1SR_Pos; + break; + + default: + mask = ((uint32_t) CCU8_CC8_SRS_E2SR_Msk); + pos = CCU8_CC8_SRS_E2SR_Pos; + break; + } + + srs &= ~mask; + srs |= (uint32_t)sr << pos; + + slice->SRS = srs; +} + +/* Asserts passive level for the slice output */ +void XMC_CCU8_SLICE_SetPassiveLevel(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_OUTPUT_t out, + const XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_t level) +{ + uint32_t psl; + + XMC_ASSERT("XMC_CCU8_SLICE_SetPassiveLevel:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetPassiveLevel:Invalid Slice Output", XMC_CCU8_SLICE_CHECK_OUTPUT(out)); + XMC_ASSERT("XMC_CCU8_SLICE_SetPassiveLevel:Invalid Passive Level", + ((level == XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_LOW) ||\ + (level == XMC_CCU8_SLICE_OUTPUT_PASSIVE_LEVEL_HIGH))); + + psl = slice->PSL; + + psl &= ~((uint32_t) out); + psl |= (uint32_t) level << ((uint32_t)out >> 1U); + + /* Program CC8 slice output passive level */ + slice->PSL = psl; +} + +/* Initializes Dead time configuration for the slice outputs */ +void XMC_CCU8_SLICE_DeadTimeInit(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_DEAD_TIME_CONFIG_t *const config) +{ + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureDeadTime:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + + /* Program dead time value for channel 1 */ + slice->DC1R = config->dc1r; + /* Program dead time value for channel 2 */ + slice->DC2R = config->dc2r; + /* Program dead time control configuration */ + slice->DTC = config->dtc; +} + +/* Activates or deactivates dead time for compare channel and ST path */ +void XMC_CCU8_SLICE_ConfigureDeadTime(XMC_CCU8_SLICE_t *const slice, const uint8_t mask) +{ + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureDeadTime:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureDeadTime:Invalid Channel", (mask <= XMC_CCU8_SLICE_DEAD_TIME_CONFIG_MASK)); + + slice->DTC &= ~((uint32_t) XMC_CCU8_SLICE_DEAD_TIME_CONFIG_MASK); + slice->DTC |= (uint32_t) mask; +} + +/* Configures rising edge delay and falling edge delay for dead time */ +void XMC_CCU8_SLICE_SetDeadTimeValue(XMC_CCU8_SLICE_t *const slice, + const XMC_CCU8_SLICE_COMPARE_CHANNEL_t channel, + const uint8_t rise_value, + const uint8_t fall_value) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetDeadTimeValue:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetDeadTimeValue:Invalid channel", XMC_CCU8_SLICE_CHECK_COMP_CHANNEL(channel)); + + if (XMC_CCU8_SLICE_COMPARE_CHANNEL_1 == channel) + { + slice->DC1R = (((uint32_t) fall_value) << CCU8_CC8_DC1R_DT1F_Pos) | ((uint32_t) rise_value); + } + else + { + slice->DC2R = (((uint32_t) fall_value) << CCU8_CC8_DC2R_DT2F_Pos) | ((uint32_t) rise_value); + } +} + +/* Configures clock division factor for dead time */ +void XMC_CCU8_SLICE_SetDeadTimePrescaler(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_DTC_DIV_t div_val) +{ + XMC_ASSERT("XMC_CCU8_SLICE_SetDeadTimePrescaler:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_SetDeadTimePrescaler:Invalid divider value", XMC_CCU8_SLICE_CHECK_DTC_DIV(div_val)); + + slice->DTC &= ~((uint32_t) CCU8_CC8_DTC_DTCC_Msk); + slice->DTC |= ((uint32_t) div_val) << CCU8_CC8_DTC_DTCC_Pos; +} + +/* Configures status ST1, ST2 mapping to STy */ +void XMC_CCU8_SLICE_ConfigureStatusBitOutput(XMC_CCU8_SLICE_t *const slice, const XMC_CCU8_SLICE_STATUS_t channel) +{ + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOutput:Invalid Slice Pointer", XMC_CCU8_IsValidSlice(slice)); + XMC_ASSERT("XMC_CCU8_SLICE_ConfigureStatusBitOutput:Invalid Channel", XMC_CCU8_SLICE_CHECK_SLICE_STATUS(channel)); + + slice->TC &= ~((uint32_t) CCU8_CC8_TC_STOS_Msk); + slice->TC |= ((uint32_t) channel) << CCU8_CC8_TC_STOS_Pos; +} + +#endif /* CCU80 */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_common.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_common.c new file mode 100644 index 00000000..73101ee4 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_common.c @@ -0,0 +1,219 @@ +/** + * @file xmc_common.c + * @date 2017-02-25 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2017-02-25: + * - Remove the need to define XMC_USER_ASSERT_FUNCTION + * - XMC_AssertHandler fixed compilation warnings + * + * @endcond + * + */ + +#include "xmc_common.h" + +/******************************************************************************* + * DATA STRUCTURES + *******************************************************************************/ +struct list +{ + struct list *next; +}; + +/******************************************************************************* + * API IMPLEMENTATION + *******************************************************************************/ +#if defined(XMC_ASSERT_ENABLE) +__WEAK void XMC_AssertHandler(const char *const msg, const char *const file, uint32_t line) +{ + XMC_UNUSED_ARG(msg); + XMC_UNUSED_ARG(file); + XMC_UNUSED_ARG(line); + + while(1) + { + /* Endless loop */ + } +} +#endif + +void XMC_LIST_Init(XMC_LIST_t *list) +{ + *list = NULL; +} + +void *XMC_LIST_GetHead(XMC_LIST_t *list) +{ + return *list; +} + +void *XMC_LIST_GetTail(XMC_LIST_t *list) +{ + struct list *tail; + + if (*list == NULL) + { + tail = NULL; + } + else + { + for (tail = (struct list *)*list; tail->next != NULL; tail = tail->next) + { + /* Loop through the list */ + } + } + + return tail; +} + +void XMC_LIST_Add(XMC_LIST_t *list, void *item) +{ + struct list *tail; + + ((struct list *)item)->next = NULL; + tail = (struct list *)XMC_LIST_GetTail(list); + + if (tail == NULL) + { + *list = item; + } + else + { + tail->next = (struct list *)item; + } +} + +void XMC_LIST_Remove(XMC_LIST_t *list, void *item) +{ + struct list *right, *left; + + if (*list != NULL) + { + left = NULL; + for(right = (struct list *)*list; right != NULL; right = right->next) + { + if(right == item) + { + if(left == NULL) + { + /* First on list */ + *list = right->next; + } + else + { + /* Not first on list */ + left->next = right->next; + } + right->next = NULL; + break; + } + left = right; + } + } +} + +void XMC_LIST_Insert(XMC_LIST_t *list, void *prev_item, void *new_item) +{ + if (prev_item == NULL) + { + ((struct list *)new_item)->next = (struct list *)*list; + *list = new_item; + } + else + { + ((struct list *)new_item)->next = ((struct list *)prev_item)->next; + ((struct list *)prev_item)->next = (struct list *)new_item; + } +} + +void XMC_PRIOARRAY_Init(XMC_PRIOARRAY_t *prioarray) +{ + XMC_ASSERT("XMC_PRIOARRAY_Init: NULL pointer", prioarray != NULL); + + /* Initialize head, next points to tail, previous to NULL and the priority is MININT */ + prioarray->items[prioarray->size].next = prioarray->size + 1; + prioarray->items[prioarray->size].previous = -1; + prioarray->items[prioarray->size].priority = INT32_MAX; + + /* Initialize tail, next points to NULL, previous is the head and the priority is MAXINT */ + prioarray->items[prioarray->size + 1].next = -1; + prioarray->items[prioarray->size + 1].previous = prioarray->size; + prioarray->items[prioarray->size + 1].priority = INT32_MIN; + +} + +void XMC_PRIOARRAY_Add(XMC_PRIOARRAY_t *prioarray, int32_t item, int32_t priority) +{ + int32_t next; + int32_t previous; + + XMC_ASSERT("XMC_PRIOARRAY_Add: item out of range", (item >= 0) && (item < prioarray->size)); + + next = XMC_PRIOARRAY_GetHead(prioarray); + while (XMC_PRIOARRAY_GetItemPriority(prioarray, next) > priority) + { + next = XMC_PRIOARRAY_GetItemNext(prioarray, next); + } + + previous = prioarray->items[next].previous; + + prioarray->items[item].next = next; + prioarray->items[item].previous = previous; + prioarray->items[item].priority = priority; + + prioarray->items[previous].next = item; + prioarray->items[next].previous = item; +} + +void XMC_PRIOARRAY_Remove(XMC_PRIOARRAY_t *prioarray, int32_t item) +{ + int32_t next; + int32_t previous; + + XMC_ASSERT("XMC_PRIOARRAY_Add: item out of range", (item >= 0) && (item < prioarray->size)); + + next = prioarray->items[item].next; + previous = prioarray->items[item].previous; + + prioarray->items[previous].next = next; + prioarray->items[next].previous = previous; +} + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_eru.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_eru.c new file mode 100644 index 00000000..9141b9b2 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_eru.c @@ -0,0 +1,295 @@ +/** + * @file xmc_eru.c + * @date 2016-03-10 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-06-20: + * - Removed definition of GetDriverVersion API
+ * + * 2016-03-10: + * - XMC_ERU_ETL_GetEdgeDetection() API is added to get the configured edge for event generation.
+ * + * @endcond + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ + +#include "xmc_eru.h" + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ + +#define ERU_EXISEL_BITSIZE (4UL) /* Used to set the input for path A and path B based on the channel */ +#define ERU_EXISEL_INPUT_BITSIZE (2UL) + +#define XMC_ERU_ETL_CHECK_INPUT_A(input) \ + ((input == XMC_ERU_ETL_INPUT_A0) || \ + (input == XMC_ERU_ETL_INPUT_A1) || \ + (input == XMC_ERU_ETL_INPUT_A2) || \ + (input == XMC_ERU_ETL_INPUT_A3)) + +#define XMC_ERU_ETL_CHECK_INPUT_B(input) \ + ((input == XMC_ERU_ETL_INPUT_B0) || \ + (input == XMC_ERU_ETL_INPUT_B1) || \ + (input == XMC_ERU_ETL_INPUT_B2) || \ + (input == XMC_ERU_ETL_INPUT_B3)) + +#define XMC_ERU_ETL_CHECK_STATUS_FLAG_MODE(mode) \ + ((mode == XMC_ERU_ETL_STATUS_FLAG_MODE_SWCTRL) || \ + (mode == XMC_ERU_ETL_STATUS_FLAG_MODE_HWCTRL)) + +#define XMC_ERU_ETL_CHECK_EVENT_SOURCE(source) \ + ((source == XMC_ERU_ETL_SOURCE_A) || \ + (source == XMC_ERU_ETL_SOURCE_B) || \ + (source == XMC_ERU_ETL_SOURCE_A_OR_B) || \ + (source == XMC_ERU_ETL_SOURCE_A_AND_B) || \ + (source == XMC_ERU_ETL_SOURCE_NOT_A) || \ + (source == XMC_ERU_ETL_SOURCE_NOT_A_OR_B) || \ + (source == XMC_ERU_ETL_SOURCE_NOT_A_AND_B) || \ + (source == XMC_ERU_ETL_SOURCE_NOT_B) || \ + (source == XMC_ERU_ETL_SOURCE_A_OR_NOT_B) || \ + (source == XMC_ERU_ETL_SOURCE_A_AND_NOT_B) || \ + (source == XMC_ERU_ETL_SOURCE_NOT_A_OR_NOT_B) || \ + (source == XMC_ERU_ETL_SOURCE_NOT_A_AND_NOT_B)) + +#define XMC_ERU_ETL_CHECK_TRIGGER_EDGE(edge) \ + ((edge == XMC_ERU_ETL_EDGE_DETECTION_DISABLED) || \ + (edge == XMC_ERU_ETL_EDGE_DETECTION_RISING) || \ + (edge == XMC_ERU_ETL_EDGE_DETECTION_FALLING) || \ + (edge == XMC_ERU_ETL_EDGE_DETECTION_BOTH)) + +#define XMC_ERU_ETL_CHECK_TRIGGER_CHANNEL(channel) \ + ((channel == XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL0) || \ + (channel == XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL1) || \ + (channel == XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL2) || \ + (channel == XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL3)) + +#define XMC_ERU_OGU_CHECK_PATTERN_INPUT(input) \ + ((input == XMC_ERU_OGU_PATTERN_DETECTION_INPUT0) || \ + (input == XMC_ERU_OGU_PATTERN_DETECTION_INPUT1) || \ + (input == XMC_ERU_OGU_PATTERN_DETECTION_INPUT2) || \ + (input == XMC_ERU_OGU_PATTERN_DETECTION_INPUT3)) + +#define XMC_ERU_OGU_CHECK_PERIPHERAL_TRIGGER(trigger) \ + ((trigger == XMC_ERU_OGU_PERIPHERAL_TRIGGER1) || \ + (trigger == XMC_ERU_OGU_PERIPHERAL_TRIGGER2) || \ + (trigger == XMC_ERU_OGU_PERIPHERAL_TRIGGER3)) + +#define XMC_ERU_OGU_CHECK_SERIVCE_REQUEST(service) \ + ((service == XMC_ERU_OGU_SERVICE_REQUEST_DISABLED) || \ + (service == XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER) || \ + (service == XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER_AND_PATTERN_MATCH) || \ + (service == XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER_AND_PATTERN_MISMATCH)) + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ +/* Initializes the selected ERU_ETLx channel with the config structure. */ +void XMC_ERU_ETL_Init(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_CONFIG_t *const config) +{ + XMC_ASSERT("XMC_ERU_ETL_Init:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_Init:Invalid Channel Number", (channel < 4U)); + + XMC_ERU_Enable(eru); + + eru->EXISEL = (eru->EXISEL & + ~((uint32_t)(ERU_EXISEL_EXS0A_Msk | ERU_EXISEL_EXS0B_Msk) << (channel * ERU_EXISEL_BITSIZE))) | + (config->input << (channel * (uint32_t)ERU_EXISEL_BITSIZE)); + + eru->EXICON[channel] = config->raw; +} + +/* Initializes the selected ERU_OGUy channel with the config structure. */ +void XMC_ERU_OGU_Init(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_CONFIG_t *const config) +{ + XMC_ASSERT("XMC_ERU_OGU_Init:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_OGU_Init:Invalid Channel Number", (channel < 4U)); + + XMC_ERU_Enable(eru); + + eru->EXOCON[channel] = config->raw; +} + +/* Configures the event source for path A and path B, with selected input_a and input_b respectively.*/ +void XMC_ERU_ETL_SetInput(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_INPUT_A_t input_a, + const XMC_ERU_ETL_INPUT_B_t input_b) +{ + XMC_ASSERT("XMC_ERU_ETL_SetInput:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_SetInput:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_ETL_SetInput:Invalid A", XMC_ERU_ETL_CHECK_INPUT_A(input_a)); + XMC_ASSERT("XMC_ERU_ETL_SetInput:Invalid B", XMC_ERU_ETL_CHECK_INPUT_B(input_b)); + + eru->EXISEL = (eru->EXISEL & ~((uint32_t)(ERU_EXISEL_EXS0A_Msk | ERU_EXISEL_EXS0B_Msk) << (channel * ERU_EXISEL_BITSIZE))) | + (((uint32_t)input_a | (uint32_t)(input_b << ERU_EXISEL_INPUT_BITSIZE)) << (channel * ERU_EXISEL_BITSIZE)); +} + +/* Select input path combination along with polarity for event generation by setting (SS, NA, NB) bits of + EXICONx(x = [0 to 3]) register */ +void XMC_ERU_ETL_SetSource(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_SOURCE_t source) +{ + XMC_ASSERT("XMC_ERU_ETL_SetSource:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_SetSource:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_ETL_SetSource:Invalid Source", XMC_ERU_ETL_CHECK_EVENT_SOURCE(source)); + + eru->EXICON_b[channel].SS = (uint8_t)source; +} + +/* Configure event trigger edge/s by setting (RE, FE) bits of EXICONx(x = [0 to 3]) register.*/ +void XMC_ERU_ETL_SetEdgeDetection(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_EDGE_DETECTION_t edge_detection) +{ + XMC_ASSERT("XMC_ERU_ETL_SetEdgeDetection:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_SetEdgeDetection:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_ETL_SetEdgeDetection:Invalid Trigger Edge", XMC_ERU_ETL_CHECK_TRIGGER_EDGE(edge_detection)); + + eru->EXICON_b[channel].ED = (uint8_t)edge_detection; +} + +/* Returns the configured event trigger edge/s by reading (RE, FE) bits of EXICONx(x = [0 to 3]) register. */ +XMC_ERU_ETL_EDGE_DETECTION_t XMC_ERU_ETL_GetEdgeDetection(XMC_ERU_t *const eru, const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_ETL_GetEdgeDetection:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_GetEdgeDetection:Invalid Channel Number", (channel < 4U)); + return ((XMC_ERU_ETL_EDGE_DETECTION_t)(eru->EXICON_b[channel].ED)); +} + +/* Set the status flag bit(FL) in EXICONx(x = [0 to 3]). */ +void XMC_ERU_ETL_SetStatusFlagMode(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_STATUS_FLAG_MODE_t mode) +{ + XMC_ASSERT("XMC_ERU_ETL_SetStatusFlagMode:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_SetStatusFlagMode:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_ETL_SetStatusFlagMode:Invalid Status Flag Mode", XMC_ERU_ETL_CHECK_STATUS_FLAG_MODE(mode)); + + eru->EXICON_b[channel].LD = (uint8_t)mode; +} + +/* Configure which Channel of OGUy(Output gating unit y = [0 to 3]) to be mapped by the trigger pulse generated by + * ETLx(Event Trigger Logic, x = [0 to 3]) by setting (OCS and PE) bit fields. */ +void XMC_ERU_ETL_EnableOutputTrigger(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_ETL_OUTPUT_TRIGGER_CHANNEL_t trigger) +{ + XMC_ASSERT("XMC_ERU_ETL_EnableOutputTrigger:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_EnableOutputTrigger:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_ETL_EnableOutputTrigger:Invalid Output Channel", XMC_ERU_ETL_CHECK_TRIGGER_CHANNEL(trigger)); + + eru->EXICON_b[channel].OCS = (uint8_t)trigger; + eru->EXICON_b[channel].PE = (uint8_t)true; +} + +/* Disables the trigger pulse generation by clearing the (PE) of the EXICONx(x = [0 to 3]). */ +void XMC_ERU_ETL_DisableOutputTrigger(XMC_ERU_t *const eru, const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_ETL_DisableOutputTrigger:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_ETL_DisableOutputTrigger:Invalid Channel Number", (channel < 4U)); + + eru->EXICON_b[channel].PE = false; +} + +/* Configures ERU_ETLx(x = [0 to 3]) for pattern match detection by setting IPENx(x = [0 to 3) and GEEN bits. */ +void XMC_ERU_OGU_EnablePatternDetection(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_PATTERN_DETECTION_INPUT_t input) +{ + XMC_ASSERT("XMC_ERU_OGU_EnablePatternDetection:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_OGU_EnablePatternDetection:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_OGU_EnablePatternDetection:Invalid Pattern input", XMC_ERU_OGU_CHECK_PATTERN_INPUT(input)); + + eru->EXOCON_b[channel].IPEN = (uint8_t)input; + eru->EXOCON_b[channel].GEEN = true; +} + +/* Disable the pattern detection by clearing (GEEN) bit. */ +void XMC_ERU_OGU_DisablePatternDetection(XMC_ERU_t *const eru, const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_OGU_DisablePatternDetection:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_OGU_DisablePatternDetection:Invalid Channel Number", (channel < 4U)); + + eru->EXOCON_b[channel].GEEN = false; +} + +/* Configures peripheral trigger input, by setting (ISS) bit. */ +void XMC_ERU_OGU_EnablePeripheralTrigger(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_PERIPHERAL_TRIGGER_t peripheral_trigger) +{ + XMC_ASSERT("XMC_ERU_OGU_EnablePeripheralTrigger:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_OGU_EnablePeripheralTrigger:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_OGU_EnablePeripheralTrigger:Invalid Peripheral Trigger Input", + XMC_ERU_OGU_CHECK_PERIPHERAL_TRIGGER(peripheral_trigger)); + + eru->EXOCON_b[channel].ISS = (uint8_t)peripheral_trigger; +} + +/* Disables event generation based on peripheral trigger by clearing (ISS) bit. */ +void XMC_ERU_OGU_DisablePeripheralTrigger(XMC_ERU_t *const eru, + const uint8_t channel) +{ + XMC_ASSERT("XMC_ERU_OGU_DisablePeripheralTrigger:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_OGU_DisablePeripheralTrigger:Invalid Channel Number", (channel < 4U)); + + eru->EXOCON_b[channel].ISS = (uint8_t)0; +} + +/* Configures the gating scheme for service request generation by setting (GP) bit. */ +void XMC_ERU_OGU_SetServiceRequestMode(XMC_ERU_t *const eru, + const uint8_t channel, + const XMC_ERU_OGU_SERVICE_REQUEST_t mode) +{ + XMC_ASSERT("XMC_ERU_OGU_SetServiceRequestMode:Invalid Module Pointer", XMC_ERU_CHECK_MODULE_PTR(eru)); + XMC_ASSERT("XMC_ERU_OGU_SetServiceRequestMode:Invalid Channel Number", (channel < 4U)); + XMC_ASSERT("XMC_ERU_OGU_SetServiceRequestMode:Invalid Service Request Mode", XMC_ERU_OGU_CHECK_SERIVCE_REQUEST(mode)); + + eru->EXOCON_b[channel].GP = (uint8_t)mode; + +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_gpio.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_gpio.c new file mode 100644 index 00000000..208b32dd --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_gpio.c @@ -0,0 +1,81 @@ +/** + * @file xmc_gpio.c + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * @endcond + * + */ + +/******************************************************************************* + * HEADER FILES + *******************************************************************************/ + +#include + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +#define PORT_HWSEL_Msk PORT0_HWSEL_HW0_Msk + +/******************************************************************************* + * API IMPLEMENTATION + *******************************************************************************/ + +void XMC_GPIO_SetMode(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_MODE_t mode) +{ + XMC_ASSERT("XMC_GPIO_SetMode: Invalid port", XMC_GPIO_CHECK_PORT(port)); + XMC_ASSERT("XMC_GPIO_SetMode: Invalid mode", XMC_GPIO_IsModeValid(mode)); + + port->IOCR[(uint32_t)pin >> 2U] &= ~(uint32_t)((uint32_t)PORT_IOCR_PC_Msk << ((uint32_t)PORT_IOCR_PC_Size * ((uint32_t)pin & 0x3U))); + port->IOCR[(uint32_t)pin >> 2U] |= (uint32_t)mode << ((uint32_t)PORT_IOCR_PC_Size * ((uint32_t)pin & 0x3U)); +} + +void XMC_GPIO_SetHardwareControl(XMC_GPIO_PORT_t *const port, const uint8_t pin, const XMC_GPIO_HWCTRL_t hwctrl) +{ + XMC_ASSERT("XMC_GPIO_SetHardwareControl: Invalid port", XMC_GPIO_CHECK_PORT(port)); + XMC_ASSERT("XMC_GPIO_SetHardwareControl: Invalid hwctrl", XMC_GPIO_CHECK_HWCTRL(hwctrl)); + + port->HWSEL &= ~(uint32_t)((uint32_t)PORT_HWSEL_Msk << ((uint32_t)pin << 1U)); + port->HWSEL |= (uint32_t)hwctrl << ((uint32_t)pin << 1U); +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_i2c.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_i2c.c new file mode 100644 index 00000000..7d9e3802 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_i2c.c @@ -0,0 +1,402 @@ +/** + * @file xmc_i2c.c + * @date 2015-10-02 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-05-20: + - Modified XMC_I2C_CH_Stop() API for not setting to IDLE the channel if it is busy
+ * + * 2015-06-20: + * - Removed GetDriverVersion API
+ * + * 2015-08-14: + * - updated the XMC_I2C_CH_SetBaudrate API to support dynamic change from 400K to low frequencies
+ * + * 2015-09-01: + * - Modified XMC_I2C_CH_EnableEvent() and XMC_I2C_CH_DisableEvent() for supporting multiple events configuration
+ * + * 2015-10-02: + * - Fixed 10bit addressing + * + * @endcond + * + */ + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ +#include + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ +#define XMC_I2C_7BIT_ADDR_Pos (8U) /**< 7-bit address position */ +#define TRANSMISSION_MODE (3U) /**< The shift control signal is considered active + without referring to the actual signal level. Data + frame transfer is possible after each edge of the signal.*/ +#define WORDLENGTH (7U) /**< Word length */ +#define SET_TDV (1U) /**< Transmission data valid */ +#define XMC_I2C_10BIT_ADDR_MASK (0x7C00U) /**< Address mask for 10-bit mode */ + +/********************************************************************************************************************* + * ENUMS + *********************************************************************************************************************/ + +typedef enum XMC_I2C_CH_TDF +{ + XMC_I2C_CH_TDF_MASTER_SEND = 0U, + XMC_I2C_CH_TDF_SLAVE_SEND = (uint32_t)1U << 8U, + XMC_I2C_CH_TDF_MASTER_RECEIVE_ACK = (uint32_t)2U << 8U, + XMC_I2C_CH_TDF_MASTER_RECEIVE_NACK = (uint32_t)3U << 8U, + XMC_I2C_CH_TDF_MASTER_START = (uint32_t)4U << 8U, + XMC_I2C_CH_TDF_MASTER_RESTART = (uint32_t)5U << 8U, + XMC_I2C_CH_TDF_MASTER_STOP = (uint32_t)6U << 8U +} XMC_I2C_CH_TDF_t; + +typedef enum XMC_I2C_CH_MAX_SPEED +{ + XMC_I2C_CH_MAX_SPEED_STANDARD = 100000U, + XMC_I2C_CH_MAX_SPEED_FAST = 400000U +} XMC_I2C_CH_MAX_SPEED_t; + +typedef enum XMC_I2C_CH_CLOCK_OVERSAMPLING +{ + XMC_I2C_CH_CLOCK_OVERSAMPLING_STANDARD = 10U, + XMC_I2C_CH_CLOCK_OVERSAMPLING_FAST = 25U +} XMC_I2C_CH_CLOCK_OVERSAMPLINGS_t; + +/********************************************************************************************************************* + * API IMPLEMENTATION + *********************************************************************************************************************/ +/* Initializes the USIC channel by setting the data format, slave address, baudrate, transfer buffer */ +void XMC_I2C_CH_Init(XMC_USIC_CH_t *const channel, const XMC_I2C_CH_CONFIG_t *const config) +{ + XMC_USIC_CH_Enable(channel); + + /* Data format configuration */ + channel->SCTR = ((uint32_t)TRANSMISSION_MODE << (uint32_t)USIC_CH_SCTR_TRM_Pos) | /* Transmision mode */ + ((uint32_t)WORDLENGTH << (uint32_t)USIC_CH_SCTR_WLE_Pos) | /* 8 data bits */ + USIC_CH_SCTR_FLE_Msk | /* unlimited data flow */ + USIC_CH_SCTR_SDIR_Msk | /* MSB shifted first */ + USIC_CH_SCTR_PDL_Msk; /* Passive Data Level */ + + XMC_I2C_CH_SetSlaveAddress(channel, config->address); + (void)XMC_I2C_CH_SetBaudrate(channel, config->baudrate); + + /* Enable transfer buffer */ + channel->TCSR = ((uint32_t)SET_TDV << (uint32_t)USIC_CH_TCSR_TDEN_Pos) | USIC_CH_TCSR_TDSSM_Msk; + + /* Clear status flags */ + channel->PSCR = 0xFFFFFFFFU; + + /* Disable parity generation */ + channel->CCR = 0x0U; +} +/* Sets the slave address */ +void XMC_I2C_CH_SetSlaveAddress(XMC_USIC_CH_t *const channel, const uint16_t address) +{ + if ((address & XMC_I2C_10BIT_ADDR_MASK) == XMC_I2C_10BIT_ADDR_GROUP) + { + channel->PCR_IICMode = (address & 0xffU) | ((address << 1) & 0xfe00U); + } + else + { + channel->PCR_IICMode = ((uint32_t)address) << XMC_I2C_7BIT_ADDR_Pos; + } +} +/* Read the slave address */ +uint16_t XMC_I2C_CH_GetSlaveAddress(const XMC_USIC_CH_t *const channel) +{ + uint32_t address = channel->PCR_IICMode & (uint32_t)USIC_CH_PCR_IICMode_SLAD_Msk; + + if ((address & 0xffU) == 0U) + { + address = address >> XMC_I2C_7BIT_ADDR_Pos; + } + else + { + address = (address & 0xffU) | ((address >> 1) & 0x0300U); + } + + return (uint16_t)address; +} +/* Sets the baudrate and oversampling based on standard speed or fast speed */ +XMC_I2C_CH_STATUS_t XMC_I2C_CH_SetBaudrate(XMC_USIC_CH_t *const channel, uint32_t rate) +{ + XMC_I2C_CH_STATUS_t status; + + status = XMC_I2C_CH_STATUS_ERROR; + + if (rate <= (uint32_t)XMC_I2C_CH_MAX_SPEED_STANDARD) + { + channel->PCR_IICMode &= (uint32_t)~USIC_CH_PCR_IICMode_STIM_Msk; + if (XMC_USIC_CH_SetBaudrate(channel, rate, (uint32_t)XMC_I2C_CH_CLOCK_OVERSAMPLING_STANDARD) == XMC_USIC_CH_STATUS_OK) + { + status = XMC_I2C_CH_STATUS_OK; + } + } + else if (rate <= (uint32_t)XMC_I2C_CH_MAX_SPEED_FAST) + { + channel->PCR_IICMode |= (uint32_t)USIC_CH_PCR_IICMode_STIM_Msk; + if (XMC_USIC_CH_SetBaudrate(channel, rate, (uint32_t)XMC_I2C_CH_CLOCK_OVERSAMPLING_FAST) == XMC_USIC_CH_STATUS_OK) + { + status = XMC_I2C_CH_STATUS_OK; + } + } + else + { + status = XMC_I2C_CH_STATUS_ERROR; + } + + return status; +} +/* Sends master start condition along with read/write command to IN/TBUF register based on FIFO/non-FIFO modes. */ +void XMC_I2C_CH_MasterStart(XMC_USIC_CH_t *const channel, const uint16_t addr, const XMC_I2C_CH_CMD_t command) +{ + uint32_t temp; + + temp = addr | (uint32_t)XMC_I2C_CH_TDF_MASTER_START; + if (command == XMC_I2C_CH_CMD_READ) + { + temp |= 0x1U; + } + + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while (XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + /* check TDV, wait until TBUF is ready */ + } + + /* clear PSR_TBIF */ + XMC_I2C_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[0] = temp; + } + else + { + channel->IN[0U] = temp; + } +} +/* Sends master repeated start condition along with read/write command to IN/TBUF register based on FIFO/non-FIFO modes. */ +void XMC_I2C_CH_MasterRepeatedStart(XMC_USIC_CH_t *const channel, const uint16_t addr, const XMC_I2C_CH_CMD_t command) +{ + uint32_t tmp; + tmp = addr | (uint32_t)XMC_I2C_CH_TDF_MASTER_RESTART; + if (command == XMC_I2C_CH_CMD_READ) + { + tmp |= 0x1U; + } + + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while (XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + /* check TDV, wait until TBUF is ready */ + } + + /* clear PSR_TBIF */ + XMC_I2C_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[0] = tmp; + } + else + { + channel->IN[0U] = tmp; + } +} + +/* Sends master stop command to IN/TBUF register based on FIFO/non-FIFO modes. */ +void XMC_I2C_CH_MasterStop(XMC_USIC_CH_t *const channel) +{ + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while (XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + /* check TDV, wait until TBUF is ready */ + } + + /* clear PSR_TBIF */ + XMC_I2C_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[0] = (uint32_t)XMC_I2C_CH_TDF_MASTER_STOP; + } + else + { + channel->IN[0U] = (uint32_t)XMC_I2C_CH_TDF_MASTER_STOP; + } +} + +/* Sends master send command along with data to IN/TBUF register based on FIFO/non-FIFO modes. */ +void XMC_I2C_CH_MasterTransmit(XMC_USIC_CH_t *const channel, const uint8_t data) +{ + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while (XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + /* check TDV, wait until TBUF is ready */ + } + + /* clear PSR_TBIF */ + XMC_I2C_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[0] = (uint32_t)XMC_I2C_CH_TDF_MASTER_SEND | data; + } + else + { + channel->IN[0] = (uint32_t)XMC_I2C_CH_TDF_MASTER_SEND | data; + } +} + +/* Sends slave send command along with data to IN/TBUF register based on FIFO/non-FIFO modes. */ +void XMC_I2C_CH_SlaveTransmit(XMC_USIC_CH_t *const channel, const uint8_t data) +{ + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while(XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + /* check TDV, wait until TBUF is ready */ + } + + /* clear PSR_TBIF */ + XMC_I2C_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[0] = (uint32_t)XMC_I2C_CH_TDF_SLAVE_SEND | data; + } + else + { + channel->IN[0] = (uint32_t)XMC_I2C_CH_TDF_SLAVE_SEND | data; + } +} + +/* Sends master receive ack command to IN/TBUF register based on FIFO/non-FIFO modes. */ +void XMC_I2C_CH_MasterReceiveAck(XMC_USIC_CH_t *const channel) +{ +/* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while(XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + /* check TDV, wait until TBUF is ready */ + } + + /* clear PSR_TBIF */ + XMC_I2C_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[0] = (uint32_t)XMC_I2C_CH_TDF_MASTER_RECEIVE_ACK; + } + else + { + channel->IN[0] = (uint32_t)XMC_I2C_CH_TDF_MASTER_RECEIVE_ACK; + } +} + +/* Sends master receive nack command to IN/TBUF register based on FIFO/non-FIFO modes. */ +void XMC_I2C_CH_MasterReceiveNack(XMC_USIC_CH_t *const channel) +{ + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while(XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + /* check TDV, wait until TBUF is ready */ + } + + /* clear PSR_TBIF */ + XMC_I2C_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2C_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[0] = (uint32_t)XMC_I2C_CH_TDF_MASTER_RECEIVE_NACK; + } + else + { + channel->IN[0] = (uint32_t)XMC_I2C_CH_TDF_MASTER_RECEIVE_NACK; + } +} + +/* Reads the data from RBUF if FIFO size is 0 otherwise from OUTR. */ +uint8_t XMC_I2C_CH_GetReceivedData(const XMC_USIC_CH_t *const channel) +{ + uint8_t retval; + + /* Check FIFO size */ + if ((channel->RBCTR & USIC_CH_RBCTR_SIZE_Msk) == 0U) + { + retval = (uint8_t)channel->RBUF; + } + else + { + retval = (uint8_t)channel->OUTR; + } + + return retval; +} + +/* Sets the operating mode of USIC to IDLE */ +XMC_I2C_CH_STATUS_t XMC_I2C_CH_Stop(XMC_USIC_CH_t *const channel) +{ + XMC_I2C_CH_STATUS_t status = XMC_I2C_CH_STATUS_OK; + + if (((uint32_t)XMC_USIC_CH_GetTransmitBufferStatus(channel) & (uint32_t)XMC_USIC_CH_TBUF_STATUS_BUSY) != 0U) + { + status = XMC_I2C_CH_STATUS_BUSY; + } + else + { + /* USIC channel in IDLE mode */ + XMC_USIC_CH_SetMode(channel, XMC_USIC_CH_OPERATING_MODE_IDLE); + } + return status; +} + +void XMC_I2C_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR |= (event&0x1fc00U); + channel->PCR_IICMode |= ((event) & 0x41fc0000U); +} + +void XMC_I2C_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR &= (uint32_t)~(event&0x1fc00U); + channel->PCR_IICMode &= (uint32_t)~((event) & 0x41fc0000U); +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_i2s.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_i2s.c new file mode 100644 index 00000000..332195e3 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_i2s.c @@ -0,0 +1,268 @@ +/** + * @file xmc_i2s.c + * @date 2015-06-30 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-08-21: + * - Initial
+ * + * 2015-09-01: + * - Modified XMC_I2S_CH_EnableEvent() and XMC_I2S_CH_DisableEvent() for supporting multiple events configuration
+ * + * 2015-09-14: + * - Modified XMC_I2S_CH_SetSystemWordLength for supporting up to 63 system word length. + * - Removed parity configuration
+ * + * 2015-09-28: + * - Fixed bugs in the XMC_I2S_CH_Init() and in the ASSERTs
+ * + * 2015-11-04: + * - Modified the check of XMC_USIC_CH_GetTransmitBufferStatus() in the XMC_I2S_CH_Transmit() API
+ * + * 2016-06-30: + * - Modified XMC_I2S_CH_Init: + * + change default passive level to 0 + * + Call XMC_I2S_CH_SetSystemWordLength() to set the system frame length equal to the frame length. + * - Modified XMC_I2S_CH_SetBaudrate: + * + Optional Master clock output signal generated with a fixed phase relation to SCLK. + * + * @endcond + * + */ +/** + * + * @brief I2S driver for XMC microcontroller family + * + */ +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ + +#include +#include + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +/* To take into account the SCLK divider by 2 and the PPPEN divider (see Divider Mode Counter figure in RM) */ +#define XMC_I2S_CH_OVERSAMPLING (4UL) + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* Initializes the selected I2S channel with the config structure. */ +void XMC_I2S_CH_Init(XMC_USIC_CH_t *const channel, const XMC_I2S_CH_CONFIG_t *const config) +{ + XMC_ASSERT("XMC_I2S_CH_Init: data_delayed_sclk_periods value not valid",(config->data_delayed_sclk_periods > 0U) && + (config->data_delayed_sclk_periods < config->frame_length)); + XMC_USIC_CH_Enable(channel); + + if(config->bus_mode == XMC_I2S_CH_BUS_MODE_MASTER) + { + /* Configure baud rate */ + (void)XMC_I2S_CH_SetBaudrate(channel, config->baudrate); + } + /* Configuration of USIC Shift Control */ + /* Transmission Mode (TRM) = 1 */ + channel->SCTR = (uint32_t)(0x3UL << USIC_CH_SCTR_TRM_Pos) | + (uint32_t)((config->frame_length -1U) << USIC_CH_SCTR_FLE_Pos) | + (uint32_t)((config->data_bits - 1U) << USIC_CH_SCTR_WLE_Pos) | + USIC_CH_SCTR_SDIR_Msk; + + /* Configuration of USIC Transmit Control/Status Register */ + /* TBUF Data Enable (TDEN) = 1 */ + /* TBUF Data Single Shot Mode (TDSSM) = 1 */ + /* WA mode enabled(WAMD) = 1 */ + channel->TCSR = (uint32_t)((channel->TCSR & (~(USIC_CH_TCSR_WLEMD_Msk | + USIC_CH_TCSR_SELMD_Msk | + USIC_CH_TCSR_FLEMD_Msk | + USIC_CH_TCSR_HPCMD_Msk))) | + USIC_CH_TCSR_WAMD_Msk | + (0x01UL << USIC_CH_TCSR_TDEN_Pos) | + USIC_CH_TCSR_TDSSM_Msk); + + if(config->bus_mode == XMC_I2S_CH_BUS_MODE_MASTER) + { + /* Configuration of Protocol Control Register */ + channel->PCR_IISMode = (uint32_t)USIC_CH_PCR_IISMode_WAGEN_Msk; + } + + /* Configuration of Protocol Control Register */ + channel->PCR_IISMode |= (uint32_t)(USIC_CH_PCR_IISMode_DTEN_Msk | + (uint32_t)config->wa_inversion) | + ((uint32_t)((uint32_t)config->data_delayed_sclk_periods - 1U) << USIC_CH_PCR_IISMode_TDEL_Pos); + + XMC_I2S_CH_SetSystemWordLength(channel, config->frame_length); + + /* Clear protocol status */ + channel->PSCR = 0xFFFFFFFFUL; +} + + +XMC_I2S_CH_STATUS_t XMC_I2S_CH_SetBaudrate(XMC_USIC_CH_t *const channel, const uint32_t rate) +{ + XMC_I2S_CH_STATUS_t status; + + status = XMC_I2S_CH_STATUS_ERROR; + + if (rate <= (XMC_SCU_CLOCK_GetPeripheralClockFrequency() >> 1U)) + { + if (XMC_USIC_CH_SetBaudrate(channel, rate, XMC_I2S_CH_OVERSAMPLING) == XMC_USIC_CH_STATUS_OK) + { + channel->BRG = (uint32_t)((channel->BRG & ~(USIC_CH_BRG_CTQSEL_Msk)) | + (0x2UL << USIC_CH_BRG_CTQSEL_Pos)) | + USIC_CH_BRG_PPPEN_Msk; + + status = XMC_I2S_CH_STATUS_OK; + } + + } + return status; +} + +void XMC_I2S_CH_SetSystemWordLength(XMC_USIC_CH_t *const channel,uint32_t sclk_cycles_system_word_length) +{ + uint32_t sclk_cycles_system_word_length_temp; + uint8_t dctq_temp; + uint8_t pctq_temp; + uint8_t dctq = 1U; + uint8_t pctq = 1U; + uint8_t best_error = 64U; + uint8_t error; + XMC_ASSERT("XMC_I2S_CH_Init: data_delayed_sclk_periods value not valid",(sclk_cycles_system_word_length > 0U) && (sclk_cycles_system_word_length < 65U)); + + + for (dctq_temp =1U; dctq_temp < 33U ; dctq_temp++) + { + for (pctq_temp =1U; pctq_temp < 5U ; pctq_temp++) + { + sclk_cycles_system_word_length_temp = ((uint32_t)dctq_temp) * ((uint32_t)pctq_temp); + if(sclk_cycles_system_word_length_temp == sclk_cycles_system_word_length) + { + dctq = dctq_temp; + pctq = pctq_temp; + break; + } + if (sclk_cycles_system_word_length_temp > sclk_cycles_system_word_length) + { + error = (uint8_t)(sclk_cycles_system_word_length_temp - sclk_cycles_system_word_length); + } + else + { + error = (uint8_t)(sclk_cycles_system_word_length - sclk_cycles_system_word_length_temp); + } + + if(error < best_error) + { + best_error = error; + dctq = dctq_temp; + pctq = pctq_temp; + } + } + } + channel->BRG = (uint32_t)((channel->BRG & ~((uint32_t)(USIC_CH_BRG_DCTQ_Msk | + USIC_CH_BRG_PCTQ_Msk))) | + (uint32_t)((uint32_t)((uint32_t)((uint32_t)dctq- 1U) << USIC_CH_BRG_DCTQ_Pos) | + (uint32_t)((uint32_t)((uint32_t)pctq- 1U) << USIC_CH_BRG_PCTQ_Pos))); +} + +/* Puts the data into FIFO if FIFO mode is enabled or else into standard buffers, by setting the proper mode. */ +void XMC_I2S_CH_Transmit(XMC_USIC_CH_t *const channel, const uint16_t data, const XMC_I2S_CH_CHANNEL_t channel_number) +{ + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while((uint32_t)XMC_USIC_CH_GetTransmitBufferStatus(channel) == (uint32_t)XMC_USIC_CH_TBUF_STATUS_BUSY) + { + } + + XMC_I2S_CH_ClearStatusFlag(channel, (uint32_t)XMC_I2S_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[(uint32_t)channel_number << 4] = data; + } + else + { + channel->IN[(uint32_t)channel_number << 4] = data; + } +} + +/* Reads the data from the buffers based on the FIFO mode selection. */ +uint16_t XMC_I2S_CH_GetReceivedData(XMC_USIC_CH_t *const channel) +{ + uint16_t retval; + + /* Check FIFO size */ + if ((channel->RBCTR & USIC_CH_RBCTR_SIZE_Msk) == 0U) + { + retval = (uint16_t)channel->RBUF; + } + else + { + retval = (uint16_t)channel->OUTR; + } + + return retval; +} + +XMC_I2S_CH_STATUS_t XMC_I2S_CH_Stop(XMC_USIC_CH_t *const channel) +{ + XMC_I2S_CH_STATUS_t status = XMC_I2S_CH_STATUS_OK; + + if (((uint32_t)XMC_USIC_CH_GetTransmitBufferStatus(channel) & (uint32_t)XMC_USIC_CH_TBUF_STATUS_BUSY) != 0U) + { + status = XMC_I2S_CH_STATUS_BUSY; + } + else + { + /* USIC channel in IDLE mode */ + XMC_USIC_CH_SetMode(channel, XMC_USIC_CH_OPERATING_MODE_IDLE); + } + + return status; +} + +void XMC_I2S_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR |= (event&0x1fc00U); + channel->PCR_IISMode |= ((event >> 2U) & 0x8070U); +} + +void XMC_I2S_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR &= (uint32_t)~(event&0x1fc00U); + channel->PCR_IISMode &= (uint32_t)~((event >> 2U) & 0x8070U); +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_ledts.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_ledts.c new file mode 100644 index 00000000..72ac5cd6 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_ledts.c @@ -0,0 +1,383 @@ +/** + * @file xmc_ledts.c + * @date 2017-02-25 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * - New API added: XMC_LEDTS_SetActivePADNo()
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * 2017-02-25: + * - XMC_LEDTS_InitGlobal() fixed compilation warnings + * + * Detailed description of file:
+ * APIs for the functional blocks of LEDTS have been defined:
+ * -- GLOBAL (APIs prefixed with LEDTS_GLOBAL_)
+ * -- Clock configuration, Function/Event configuration, Interrupt configuration + * + * @endcond + * + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +#if defined(LEDTS0) +#include "xmc_scu.h" + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_LEDTS_CLOCK_NOT_RUNNING 0U + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * GLOBAL DATA + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * LOCAL/UTILITY ROUTINES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/** + * Initialization of global register + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitGlobal(XMC_LEDTS_t *const ledts, const XMC_LEDTS_GLOBAL_CONFIG_t *config) +{ + XMC_ASSERT("XMC_LEDTS_InitGlobal:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + XMC_ASSERT("XMC_LEDTS_InitGlobal:Null Pointer", (config != (XMC_LEDTS_GLOBAL_CONFIG_t *)NULL)); + + if (ledts == XMC_LEDTS0) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_LEDTS0); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_LEDTS0); +#endif + } +#if defined(LEDTS1) + else if (ledts == XMC_LEDTS1) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_LEDTS1); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_LEDTS1); +#endif + } +#endif +#if defined(LEDTS2) + else if (ledts == XMC_LEDTS2) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_LEDTS2); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_LEDTS2); +#endif + } +#endif + else + { + XMC_ASSERT("XMC_LEDTS_InitGlobal:Invalid Module Pointer", 0); + } + + if((ledts->GLOBCTL & LEDTS_GLOBCTL_CLK_PS_Msk) != XMC_LEDTS_CLOCK_NOT_RUNNING) + { + return XMC_LEDTS_STATUS_RUNNING; + } + + ledts->GLOBCTL = config->globctl; + + return XMC_LEDTS_STATUS_SUCCESS; +} + +/** + * Initialization of registers for LED-driving function + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitLED(XMC_LEDTS_t *const ledts, const XMC_LEDTS_LED_CONFIG_t *config) +{ + XMC_ASSERT("XMC_LEDTS_LED_Init:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + XMC_ASSERT("XMC_LEDTS_LED_Init:Null Pointer", (config != (XMC_LEDTS_LED_CONFIG_t *)NULL)); + + if((ledts->GLOBCTL & LEDTS_GLOBCTL_CLK_PS_Msk) != XMC_LEDTS_CLOCK_NOT_RUNNING) + { + return XMC_LEDTS_STATUS_RUNNING; + } + + ledts->FNCTL &= ~(LEDTS_FNCTL_COLLEV_Msk | LEDTS_FNCTL_NR_LEDCOL_Msk); + ledts->FNCTL |= (config->fnctl); + + /* Enable LED function */ + ledts->GLOBCTL |= LEDTS_GLOBCTL_LD_EN_Msk; + + return XMC_LEDTS_STATUS_SUCCESS; +} + +/** + * Initialization of registers for basic Touch-Sense control function + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitTSBasic(XMC_LEDTS_t *const ledts, const XMC_LEDTS_TS_CONFIG_BASIC_t *config) +{ + uint32_t reg; + + XMC_ASSERT("XMC_LEDTS_TS_Basic_Init:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + XMC_ASSERT("XMC_LEDTS_TS_Basic_Init:Null Pointer", (config != (XMC_LEDTS_TS_CONFIG_BASIC_t *)NULL)); + + if((ledts->GLOBCTL & LEDTS_GLOBCTL_CLK_PS_Msk) != XMC_LEDTS_CLOCK_NOT_RUNNING) + { + return XMC_LEDTS_STATUS_RUNNING; + } + + reg = ~(LEDTS_FNCTL_ACCCNT_Msk | LEDTS_FNCTL_TSCCMP_Msk | LEDTS_FNCTL_TSCTRR_Msk | LEDTS_FNCTL_TSCTRSAT_Msk | + LEDTS_FNCTL_NR_TSIN_Msk); + ledts->FNCTL &= (reg); + ledts->FNCTL |= (config->fnctl); + + /* Enable TS function */ + ledts->GLOBCTL |= LEDTS_GLOBCTL_TS_EN_Msk; + + return XMC_LEDTS_STATUS_SUCCESS; +} + +/** + * Initialization of registers for advanced Touch-Sense control function + */ +XMC_LEDTS_STATUS_t XMC_LEDTS_InitTSAdvanced (XMC_LEDTS_t *const ledts, const XMC_LEDTS_TS_CONFIG_ADVANCED_t *config) +{ + uint32_t reg; + + XMC_ASSERT("XMC_LEDTS_TS_Advanced_Init:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + XMC_ASSERT("XMC_LEDTS_TS_Advanced_Init:Null Pointer", (config != (XMC_LEDTS_TS_CONFIG_ADVANCED_t *)NULL)); + + if((ledts->GLOBCTL & LEDTS_GLOBCTL_CLK_PS_Msk) != XMC_LEDTS_CLOCK_NOT_RUNNING) + { + return XMC_LEDTS_STATUS_RUNNING; + } + + reg = ~(LEDTS_GLOBCTL_MASKVAL_Msk | LEDTS_GLOBCTL_FENVAL_Msk); + ledts->GLOBCTL &= (reg); + ledts->GLOBCTL |= (config->globctl); + + reg = ~(LEDTS_FNCTL_PADT_Msk | LEDTS_FNCTL_PADTSW_Msk | LEDTS_FNCTL_EPULL_Msk | LEDTS_FNCTL_TSOEXT_Msk); + ledts->FNCTL &= (reg); + ledts->FNCTL |= (config->fnctl); + + return XMC_LEDTS_STATUS_SUCCESS; +} + +/** + * Starts LEDTS-counter + */ +void XMC_LEDTS_StartCounter(XMC_LEDTS_t *const ledts, const uint16_t prescaler) +{ + XMC_ASSERT("XMC_LEDTS_Start_Counter:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + ledts->GLOBCTL |= prescaler<<16U; +} + +/** + * Stops LEDTS-counter + */ +void XMC_LEDTS_StopCounter(XMC_LEDTS_t *const ledts) +{ + XMC_ASSERT("XMC_LEDTS_Stop_Counter:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + ledts->GLOBCTL &= 0x0000FFFF; +} + +/** + * Reads time interrupt flags + */ +uint32_t XMC_LEDTS_ReadInterruptFlag(XMC_LEDTS_t *const ledts) +{ + XMC_ASSERT("XMC_LEDTS_ReadInterruptFlag:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + return (ledts->EVFR & 0xF); +} + +/** + * Set the active pad number + */ +void XMC_LEDTS_SetActivePADNo(XMC_LEDTS_t *const ledts, XMC_LEDTS_NUMBER_TS_INPUT_t pad_num) +{ + uint32_t reg; + + XMC_ASSERT("XMC_LEDTS_SetActivePADNo:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + reg = ledts->FNCTL; + reg &= ~(LEDTS_FNCTL_PADT_Msk); + reg |= (uint32_t)pad_num; + ledts->FNCTL = reg; +} + +/** + * Clears interrupt indication flags + */ +void XMC_LEDTS_ClearInterruptFlag(XMC_LEDTS_t *const ledts, uint32_t interrupt_mask) +{ + XMC_ASSERT("XMC_LEDTS_ClearInterruptFlag:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + ledts->EVFR = (interrupt_mask << LEDTS_EVFR_CTSF_Pos); +} + +/** + * Programming of registers to output pattern on an LED column in LED matrix + */ +void XMC_LEDTS_SetLEDLinePattern(XMC_LEDTS_t *const ledts, XMC_LEDTS_LED_COLUMN_t column, const uint8_t pattern) +{ + uint32_t reg; + uint8_t reg_index = ((uint8_t)column) >> 2; + uint8_t bit_shift_count = ((uint8_t)column & 0x03) * 8; + + XMC_ASSERT("XMC_LEDTS_Set_LED_Line_Pattern:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + reg = ledts->LINE[reg_index]; + reg &= (~(0xff << bit_shift_count)); + reg |= pattern << bit_shift_count; + ledts->LINE[reg_index] = reg; + +} + +/** + * Programming of registers to adjust brightness of an LED column in LED matrix + */ +void XMC_LEDTS_SetColumnBrightness(XMC_LEDTS_t *const ledts, XMC_LEDTS_LED_COLUMN_t column, const uint8_t brightness) +{ + uint32_t reg; + uint8_t reg_index = ((uint8_t)column) >> 2; + uint8_t bit_shift_count = ((uint8_t)column & 0x03) * 8; + + XMC_ASSERT("XMC_LEDTS_Set_Column_Brightness:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + reg = ledts->LDCMP[reg_index]; + reg &= (~(0xff << bit_shift_count)); + reg |= brightness << bit_shift_count; + ledts->LDCMP[reg_index] = reg; +} + +/** + * Programming of registers to set common oscillation window size for touch-sense inputs + */ +void XMC_LEDTS_SetCommonOscillationWindow(XMC_LEDTS_t *const ledts, const uint8_t common_size) +{ + uint32_t reg; + + XMC_ASSERT("XMC_LEDTS_Set_Common_Oscillation_Window:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + reg = ledts->LDCMP[1]; + reg &= ~LEDTS_LDCMP1_CMP_LDA_TSCOM_Msk; + reg |= (common_size << LEDTS_LDCMP1_CMP_LDA_TSCOM_Pos); + ledts->LDCMP[1] = reg; +} + +/** + * Checking the previous active function or LED column status + */ +uint32_t XMC_LEDTS_ReadFNCOL(XMC_LEDTS_t *const ledts) +{ + uint32_t fncol_read; + + XMC_ASSERT("XMC_LEDTS_Read_FNCOL:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + fncol_read = ledts->FNCTL & LEDTS_FNCTL_FNCOL_Msk; + fncol_read >>= LEDTS_FNCTL_FNCOL_Pos; + + return fncol_read; +} + +/** + * Set the number of LED column Enabled + */ +void XMC_LEDTS_SetNumOfLEDColumns(XMC_LEDTS_t *const ledts, uint8_t count) +{ + + XMC_ASSERT("XMC_LEDTS_SetNumOfLEDColumns:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + ledts->FNCTL &= ~(LEDTS_FNCTL_NR_LEDCOL_Msk); + ledts->FNCTL |= (count << LEDTS_FNCTL_NR_LEDCOL_Pos); +} + +/** + * Reading recorded number of oscillation counts + */ +uint16_t XMC_LEDTS_ReadTSVAL(XMC_LEDTS_t *const ledts) +{ + uint16_t no_of_oscillations; + + XMC_ASSERT("XMC_LEDTS_Read_TSVAL:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + no_of_oscillations = (ledts->TSVAL & 0xFFFF); + + return no_of_oscillations; +} + +/** + * Programming of registers to adjust the size of oscillation window + */ +void XMC_LEDTS_SetOscillationWindow(XMC_LEDTS_t *const ledts, XMC_LEDTS_NUMBER_TS_INPUT_t touchpad, const uint8_t size) +{ + uint32_t reg; + uint8_t reg_index = ((uint8_t)touchpad) >> 2; + uint8_t bit_shift_count = ((uint8_t)touchpad & 0x03) * 8; + + XMC_ASSERT("XMC_LEDTS_Set_Oscillation_Window:Wrong Module Pointer", XMC_LEDTS_CHECK_KERNEL_PTR(ledts)); + + reg = ledts->TSCMP[reg_index]; + reg &= (~(0xff << bit_shift_count)); + reg |= size << bit_shift_count; + ledts->TSCMP[reg_index] = reg; +} + +#endif /* LEDTS0 */ + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_math.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_math.c new file mode 100644 index 00000000..5af1191e --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_math.c @@ -0,0 +1,473 @@ + +/** + * @file xmc_math.c + * @date 2017-04-20 + * + * @cond + ********************************************************************************** + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification,are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share + * modifications, enhancements or bug fixes with Infineon Technologies AG + * dave@infineon.com). + ********************************************************************************** + * + * Change History + * -------------- + * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * - Updated copyright and change history section. + * + * 2015-09-23: + * - Added SQRT functions + * + * 2015-10-08: + * - Return values for sin(), cos(), sinh(), cosh(), arctan() are corrected. + * + * 2017-04-20: + * - Foward declaration of __aeabi_* to fix link time optimization (-flto) compilation errors + * + * @endcond + * + */ + +/** + * + * @brief MATH driver - API implementation for XMC13 family MATH libraries.
+ * + * Detailed description of file
+ * APIs provided in this file cover the following functional blocks of MATH:
+ * + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +#if defined (MATH) +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +/* Reciprocal of Circular gain in XMC_MATH_Q0_23_t format ((2^23)/1.646760258121) */ +#define XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023 (0x4DBA76U) +/* Reciprocal of Hyperbolic gain in XMC_MATH_Q1_22_t format ((2^22)/0.828159360960) */ +#define XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22 (0x4D47A1U) +/* Signed division is selected */ +#define XMC_MATH_SIGNED_DIVISION ((uint32_t) 0 << MATH_DIVCON_USIGN_Pos) +/* Unsigned division is selected */ +#define XMC_MATH_UNSIGNED_DIVISION ((uint32_t) 1 << MATH_DIVCON_USIGN_Pos) + +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * GLOBAL DATA + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * LOCAL ROUTINES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * API IMPLEMENTATION - Utility functions + ********************************************************************************************************************/ + +/* Utility function to check if the DIV unit is busy */ +bool XMC_MATH_DIV_IsBusy(void) +{ + bool status; + if (MATH->DIVST & MATH_DIVST_BSY_Msk) + { + status = true; /* DIV unit is busy running a division operation */ + } + else + { + status = false; /* DIV unit is idle */ + } + + return (status); +} + +/* Utility function to check if the CORDIC unit is busy */ +bool XMC_MATH_CORDIC_IsBusy(void) +{ + bool status; + if (MATH->STATC & MATH_STATC_BSY_Msk) + { + status = true; /* CORDIC unit is busy running an operation */ + } + else + { + status = false; /* CORDIC unit is idle */ + } + + return (status); +} + +/* This functions returns the status of a requested event */ +bool XMC_MATH_GetEventStatus(const XMC_MATH_EVENT_t event) +{ + bool status; + if (MATH->EVFR & (uint32_t) event) + { + status = true; /* Requested event has been detected */ + } + else + { + status = false; /* Requested event has not been detected */ + } + return (status); +} + +#ifndef XMC_MATH_DISABLE_DIV_ABI + +/* Forward prototypes. */ +uint32_t __aeabi_uidiv(uint32_t dividend, uint32_t divisor) __attribute__((externally_visible)); +int32_t __aeabi_idiv(int32_t dividend, int32_t divisor) __attribute__((externally_visible)); +uint64_t __aeabi_uidivmod(uint32_t dividend, uint32_t divisor) __attribute__((externally_visible)); +int64_t __aeabi_idivmod(int32_t dividend, int32_t divisor) __attribute__((externally_visible)); + +/*********************************************************************************************************************** + * API IMPLEMENTATION - aeabi routines + **********************************************************************************************************************/ +/* This function performs unsigned integer division */ +uint32_t __aeabi_uidiv(uint32_t dividend, uint32_t divisor) +{ + MATH->DIVCON = XMC_MATH_UNSIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; + + return ((uint32_t) MATH->QUOT); +} + +/* This function performs signed integer division */ +int32_t __aeabi_idiv(int32_t dividend, int32_t divisor) +{ + MATH->DIVCON = XMC_MATH_SIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; + + return ((int32_t) MATH->QUOT); +} + +/* This function performs unsigned integer division modulo */ +uint64_t __aeabi_uidivmod(uint32_t dividend, uint32_t divisor) +{ + uint64_t remainder; + + MATH->DIVCON = XMC_MATH_UNSIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; + + remainder = ((uint64_t) MATH->RMD) << 32U; + return (remainder | MATH->QUOT); +} + +/* This function performs signed integer division modulo */ +int64_t __aeabi_idivmod(int32_t dividend, int32_t divisor) +{ + uint64_t remainder; + uint64_t result; + + MATH->DIVCON = XMC_MATH_SIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; + + remainder = ((uint64_t) MATH->RMD) << 32U; + result = (remainder | MATH->QUOT); + return ((int64_t) result); +} +#endif + +/*********************************************************************************************************************** + * API IMPLEMENTATION - Blocking functions + **********************************************************************************************************************/ +/* This function computes the cosine of a given angle in radians */ +XMC_MATH_Q0_23_t XMC_MATH_CORDIC_Cos(XMC_MATH_Q0_23_t angle_in_radians) +{ + int32_t result; + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t) angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023 << MATH_CORDX_DATA_Pos; + result = ((int32_t)MATH->CORRX) >> MATH_CORRX_RESULT_Pos; + return ((XMC_MATH_Q0_23_t) result); +} + +/* This function computes the sine of a given angle in radians */ +XMC_MATH_Q0_23_t XMC_MATH_CORDIC_Sin(XMC_MATH_Q0_23_t angle_in_radians) +{ + int32_t result; + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t)angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023 << MATH_CORDX_DATA_Pos; + result = ((int32_t)MATH->CORRY) >> MATH_CORRY_RESULT_Pos; + return ((XMC_MATH_Q0_23_t) result); +} + +/* This function computes the tangent of a given angle in radians */ +XMC_MATH_Q0_11_t XMC_MATH_CORDIC_Tan(XMC_MATH_Q0_23_t angle_in_radians) +{ + uint32_t result; + MATH->GLBCON = (uint32_t) XMC_MATH_DIV_DVDRC_CORRY_IS_SOURCE + \ + (uint32_t) XMC_MATH_DIV_DVSRC_CORRX_IS_SOURCE; /* Chain the results of CORDIC operation to DIV unit */ + MATH->DIVCON = (uint32_t) 11 << MATH_DIVCON_DVSSRC_Pos; /* Right Shifts Divisor by 11 places prior to division */ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t)angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023 << MATH_CORDX_DATA_Pos; + result = MATH->QUOT; + return ((XMC_MATH_Q0_11_t) result); +} + +/* This function computes the arc tangent of a given angle in radians */ +XMC_MATH_Q0_23_t XMC_MATH_CORDIC_ArcTan(XMC_MATH_Q8_15_t x, XMC_MATH_Q8_15_t y) +{ + uint32_t result; + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR; + MATH->CORDZ = 0U; /* Clear register */ + MATH->CORDY = ((uint32_t) y) << MATH_CORDY_DATA_Pos; + MATH->CORDX = ((uint32_t) x) << MATH_CORDX_DATA_Pos; + result = ((int32_t)MATH->CORRZ) >> MATH_CORRZ_RESULT_Pos; + return ((XMC_MATH_Q0_23_t) result); +} + +/* This function computes the hyperbolic cosine of a given angle in radians */ +XMC_MATH_Q1_22_t XMC_MATH_CORDIC_Cosh(XMC_MATH_Q0_23_t angle_in_radians) +{ + int32_t result; + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t) angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22 << MATH_CORDX_DATA_Pos; + result = ((int32_t)MATH->CORRX) >> MATH_CORRX_RESULT_Pos; + return ((XMC_MATH_Q1_22_t) result); +} + +/* This function computes the hyperbolic sine of a given angle in radians */ +XMC_MATH_Q1_22_t XMC_MATH_CORDIC_Sinh(XMC_MATH_Q0_23_t angle_in_radians) +{ + int32_t result; + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t)angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22 << MATH_CORDX_DATA_Pos; + result = ((int32_t)MATH->CORRY) >> MATH_CORRY_RESULT_Pos; + return ((XMC_MATH_Q1_22_t) result); +} + +/* This function computes the hyperbolic tangent of a given angle in radians */ +XMC_MATH_Q0_11_t XMC_MATH_CORDIC_Tanh(XMC_MATH_Q0_23_t angle_in_radians) +{ + uint32_t result; + MATH->GLBCON = (uint32_t) XMC_MATH_DIV_DVDRC_CORRY_IS_SOURCE + \ + (uint32_t) XMC_MATH_DIV_DVSRC_CORRX_IS_SOURCE; /* Chain the results of CORDIC operation to DIV unit */ + MATH->DIVCON = (uint32_t) 11 << MATH_DIVCON_DVSSRC_Pos; /* Right Shifts Divisor by 11 places prior to division */ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t) angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22 << MATH_CORDX_DATA_Pos; + result = MATH->QUOT; + return ((XMC_MATH_Q0_11_t) result); +} + +/*********************************************************************************************************************** + * API IMPLEMENTATION - Non blocking functions + **********************************************************************************************************************/ +/* This function computes the cosine of a given angle in radians */ +void XMC_MATH_CORDIC_CosNB(XMC_MATH_Q0_23_t angle_in_radians) +{ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t) angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023 << MATH_CORDX_DATA_Pos; +} + +/* This function computes the sine of a given angle in radians */ +void XMC_MATH_CORDIC_SinNB(XMC_MATH_Q0_23_t angle_in_radians) +{ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t)angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023 << MATH_CORDX_DATA_Pos; +} + +/* This function computes the tangent of a given angle in radians */ +void XMC_MATH_CORDIC_TanNB(XMC_MATH_Q0_23_t angle_in_radians) +{ + MATH->GLBCON = (uint32_t) XMC_MATH_DIV_DVDRC_CORRY_IS_SOURCE + \ + (uint32_t) XMC_MATH_DIV_DVSRC_CORRX_IS_SOURCE; /* Chain the results of CORDIC operation to DIV unit */ + MATH->DIVCON = (uint32_t) 11 << MATH_DIVCON_DVSSRC_Pos; /* Right Shifts Divisor by 11 places prior to division */ + + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t)angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_CIRCULAR_GAIN_IN_Q023 << MATH_CORDX_DATA_Pos; +} + +/* This function computes the arc tangent of a given value */ +void XMC_MATH_CORDIC_ArcTanNB(XMC_MATH_Q8_15_t x, XMC_MATH_Q8_15_t y) +{ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_CIRCULAR; + MATH->CORDZ = 0U; /* Clear register */ + MATH->CORDY = ((uint32_t) y) << MATH_CORDY_DATA_Pos; + MATH->CORDX = ((uint32_t) x) << MATH_CORDX_DATA_Pos; +} + +/* This function computes the hyperbolic cosine of a given angle in radians */ +void XMC_MATH_CORDIC_CoshNB(XMC_MATH_Q0_23_t angle_in_radians) +{ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t)angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22 << MATH_CORDX_DATA_Pos; +} + +/* This function computes the hyperbolic sine of a given angle in radians */ +void XMC_MATH_CORDIC_SinhNB(XMC_MATH_Q0_23_t angle_in_radians) +{ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t)angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22 << MATH_CORDX_DATA_Pos; +} + +/* This function computes the hyperbolic tangent of a given angle in radians */ +void XMC_MATH_CORDIC_TanhNB(XMC_MATH_Q0_23_t angle_in_radians) +{ + MATH->GLBCON = (uint32_t) XMC_MATH_DIV_DVDRC_CORRY_IS_SOURCE + \ + (uint32_t) XMC_MATH_DIV_DVSRC_CORRX_IS_SOURCE; /* Chain the results of CORDIC operation to DIV unit */ + MATH->DIVCON = (uint32_t) 11 << MATH_DIVCON_DVSSRC_Pos; /* Right Shifts Divisor by 11 places prior to division */ + MATH->STATC = 0U; /* Clear register */ + MATH->CON = (uint32_t) XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC + \ + (uint32_t) XMC_MATH_CORDIC_ROTVEC_MODE_ROTATION; + MATH->CORDZ = ((uint32_t) angle_in_radians) << MATH_CORDZ_DATA_Pos; + MATH->CORDY = 0U; /* Clear register */ + MATH->CORDX = XMC_MATH_RECIPROC_HYPERBOLIC_GAIN_IN_Q1_22 << MATH_CORDX_DATA_Pos; +} + +/* This function performs division for given two unsigned arguments */ +void XMC_MATH_DIV_UnsignedDivNB(uint32_t dividend, uint32_t divisor) +{ + MATH->DIVCON = XMC_MATH_UNSIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; +} + +/* This function performs division for given two signed arguments */ +void XMC_MATH_DIV_SignedDivNB(int32_t dividend, int32_t divisor) +{ + MATH->DIVCON = XMC_MATH_SIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; +} + +/* This function performs modulo operation for given two unsigned arguments */ +void XMC_MATH_DIV_UnsignedModNB(uint32_t dividend, uint32_t divisor) +{ + MATH->DIVCON = XMC_MATH_UNSIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; +} + +/* This function performs modulo operation for given two signed arguments */ +void XMC_MATH_DIV_SignedModNB(int32_t dividend, int32_t divisor) +{ + MATH->DIVCON = XMC_MATH_SIGNED_DIVISION; + MATH->DVD = dividend; + MATH->DVS = divisor; +} + +int16_t XMC_MATH_CORDIC_Q15_Sqrt(int16_t x) +{ + int32_t temp; + MATH->STATC = 0U; /* Clear register */ + + MATH->CON = (uint32_t)XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC | + (uint32_t)XMC_MATH_CORDIC_ROTVEC_MODE_VECTORING; + + temp = (int32_t)x << 15; /* Q30 to handle numbers > 1.0 */ + + MATH->CORDY = (temp - 0x10000000U); /* x - 0.25 */ + MATH->CORDX = (temp + 0x10000000U); /* x + 0.25 */ + + return (int16_t)(((MATH->CORRX >> 14) * 39568) >> 16); /* Q16 * Q15 */ +} + +int32_t XMC_MATH_CORDIC_Q31_Sqrt(int32_t x) +{ + MATH->STATC = 0U; /* Clear register */ + + MATH->CON = (uint32_t)XMC_MATH_CORDIC_OPERATING_MODE_HYPERBOLIC | + (uint32_t)XMC_MATH_CORDIC_ROTVEC_MODE_VECTORING; + + x >>= 1; /* Q30 to handle numbers > 1.0 */ + + MATH->CORDY = (x - 0x10000000U); /* x - 0.25 */ + MATH->CORDX = (x + 0x10000000U); /* x + 0.25 */ + + return ((MATH->CORRX >> 14) * 39568); /* Q16 * Q15 */ +} + +#endif /* end of #if defined (MATH) */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_pau.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_pau.c new file mode 100644 index 00000000..ccb37ff4 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_pau.c @@ -0,0 +1,109 @@ +/** + * @file xmc_pau.c + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-06-20: + * - Removed GetDriverVersion API + * @endcond + * + */ + +/** + * + * @brief PAU driver for XMC1 microcontroller family. + * + */ + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ +#include "xmc_pau.h" + +#if defined(PAU) + +/********************************************************************************************************************** + * API IMPLEMENTATION + *********************************************************************************************************************/ + +/* + * Enable peripheral access + */ +void XMC_PAU_EnablePeripheralAccess(XMC_PAU_PERIPHERAL_t peripheral) +{ + uint32_t reg_num; + + reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U; + XMC_PAU->PRIVDIS[reg_num] &= (uint32_t)~((uint32_t)peripheral & 0x0fffffffUL); +} + +/* + * Disable peripheral access + */ +void XMC_PAU_DisablePeripheralAccess(XMC_PAU_PERIPHERAL_t peripheral) +{ + uint32_t reg_num; + + reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U; + XMC_PAU->PRIVDIS[reg_num] |= (uint32_t)((uint32_t)peripheral & 0x0fffffffUL); +} + +/* + * Check if peripheral access is enabled + */ +bool XMC_PAU_IsPeripheralAccessEnabled(XMC_PAU_PERIPHERAL_t peripheral) +{ + uint32_t reg_num; + + reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U; + return (bool)(XMC_PAU->PRIVDIS[reg_num] & ((uint32_t)peripheral & 0x0fffffffUL)); +} + +/* + * Check if peripheral is available + */ +bool XMC_PAU_IsPeripheralAvailable(XMC_PAU_PERIPHERAL_t peripheral) +{ + uint32_t reg_num; + + reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U; + return (bool)(XMC_PAU->AVAIL[reg_num] & ((uint32_t)peripheral & 0x0fffffffUL)); +} + +#endif /* defined(PAU) */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_posif.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_posif.c new file mode 100644 index 00000000..a8b50a22 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_posif.c @@ -0,0 +1,275 @@ +/** + * @file xmc_posif.c + * @date 2017-02-25 + * + * @cond + ********************************************************************************** + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification,are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share + * modifications, enhancements or bug fixes with Infineon Technologies AG + * dave@infineon.com). + ********************************************************************************** + * + * Change History + * -------------- + * + * 2015-02-18: + * - Initial version + * + * 2015-02-20: + * - Driver description added
+ * + * 2015-04-30: + * - XMC_POSIF_Enable and XMC_POSIF_Disable APIs updated for POSIF1 peripheral check
+ * + * 2015-06-19: + * - Removed GetDriverVersion API
+ * + * 2017-02-25: + * - XMC_POSIF_Enable() and XMC_POSIF_Disable() fixed compilation warnings + * + * @endcond + * + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +/* POSIF is not available on XMC1100 and XMC1200 */ +#if defined(POSIF0) +#include + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_POSIF_PCONF_INSEL_Msk (0x3fUL << POSIF_PCONF_INSEL0_Pos) /*< Mask for input pins selection */ +#define XMC_POSIF_INSEL_MAX (4U) /*< Maximum possible input selector */ + +/********************************************************************************************************************* + * LOCAL ROUTINES + ********************************************************************************************************************/ +#ifdef XMC_ASSERT_ENABLE +__STATIC_INLINE bool XMC_POSIF_IsPeripheralValid(const XMC_POSIF_t *const peripheral) +{ + bool tmp; + + tmp = (peripheral == POSIF0); +#if defined(POSIF1) + tmp |= (peripheral == POSIF1); +#endif + + return tmp; +} +#endif +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* API to enable the POSIF module */ +void XMC_POSIF_Enable(XMC_POSIF_t *const peripheral) +{ +#if UC_FAMILY == XMC4 + XMC_SCU_CLOCK_EnableClock(XMC_SCU_CLOCK_CCU); +#endif + + if (peripheral == POSIF0) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_POSIF0); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_POSIF0); +#endif + } +#if defined(POSIF1) + else if (peripheral == POSIF1) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_POSIF1); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_POSIF1); +#endif + } +#endif + else + { + XMC_ASSERT("XMC_POSIF_Disable:Invalid module pointer", 0); + } +} + +/* API to disable the POSIF module */ +void XMC_POSIF_Disable(XMC_POSIF_t *const peripheral) +{ + if (peripheral == POSIF0) + { +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_POSIF0); +#endif +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_POSIF0); +#endif + } +#if defined(POSIF1) + else if (peripheral == POSIF1) + { +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_POSIF1); +#endif +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_POSIF1); +#endif + } +#endif + else + { + XMC_ASSERT("XMC_POSIF_Disable:Invalid module pointer", 0); + } +} + +/* API to initialize POSIF global resources */ +void XMC_POSIF_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_CONFIG_t *const config) +{ + XMC_ASSERT("XMC_POSIF_Init:Invalid module pointer", XMC_POSIF_IsPeripheralValid(peripheral)); + XMC_ASSERT("XMC_POSIF_Init:NULL Pointer", (config != (XMC_POSIF_CONFIG_t *)NULL) ); + + /* Enable the POSIF module */ + XMC_POSIF_Enable(peripheral); + + /* Stop POSIF */ + XMC_POSIF_Stop(peripheral); + + /* Program the operational mode, input selectors and debounce filter */ + peripheral->PCONF = config->pconf; +} + +/* API to initialize hall sensor interface */ +XMC_POSIF_STATUS_t XMC_POSIF_HSC_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_HSC_CONFIG_t * const config) +{ + XMC_POSIF_STATUS_t retval; + + XMC_ASSERT("XMC_POSIF_HSC_Init:Invalid module pointer\n", XMC_POSIF_IsPeripheralValid(peripheral)); + XMC_ASSERT("XMC_POSIF_HSC_Init:NULL Pointer\n", (config != (XMC_POSIF_HSC_CONFIG_t *)NULL) ); + + if (XMC_POSIF_MODE_HALL_SENSOR == (XMC_POSIF_MODE_t)((peripheral->PCONF) & (uint32_t)POSIF_PCONF_FSEL_Msk) ) + { + peripheral->PCONF |= config->hall_config; + retval = XMC_POSIF_STATUS_OK; + } + else + { + retval = XMC_POSIF_STATUS_ERROR; + } + return retval; +} + +/* API to initialize quadrature decoder interface */ +XMC_POSIF_STATUS_t XMC_POSIF_QD_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_QD_CONFIG_t * const config) +{ + uint8_t reg; + XMC_POSIF_STATUS_t retval; + + XMC_ASSERT("XMC_POSIF_QD_Init:Invalid module pointer", XMC_POSIF_IsPeripheralValid(peripheral)); + XMC_ASSERT("XMC_POSIF_QD_Init:NULL Pointer", (config != (XMC_POSIF_QD_CONFIG_t *)NULL) ); + + reg = (uint8_t)((peripheral->PCONF) & (uint32_t)POSIF_PCONF_FSEL_Msk); + if (((uint32_t)XMC_POSIF_MODE_QD == reg) || ((uint32_t)XMC_POSIF_MODE_MCM_QD == reg)) + { + /* Program the quadrature mode */ + peripheral->PCONF |= (uint32_t)(config->mode) << POSIF_PCONF_QDCM_Pos; + peripheral->QDC = config->qdc; + retval = XMC_POSIF_STATUS_OK; + } + else + { + retval = XMC_POSIF_STATUS_ERROR; + } + + return retval; +} + +/* API to initialize multi-channel mode. + * This is used in Hall mode, standalone multi-channel mode and quadrature with multi-channel mode + */ +XMC_POSIF_STATUS_t XMC_POSIF_MCM_Init(XMC_POSIF_t *const peripheral, const XMC_POSIF_MCM_CONFIG_t * const config) +{ + XMC_POSIF_STATUS_t retval; + + XMC_ASSERT("XMC_POSIF_MCM_Init:Invalid module pointer", XMC_POSIF_IsPeripheralValid(peripheral)); + XMC_ASSERT("XMC_POSIF_MCM_Init:NULL Pointer", (config != (XMC_POSIF_MCM_CONFIG_t *)NULL) ); + + if ((XMC_POSIF_MODE_t)((peripheral->PCONF) & (uint32_t)POSIF_PCONF_FSEL_Msk) != XMC_POSIF_MODE_QD) + { + peripheral->PCONF |= config->mcm_config; + retval = XMC_POSIF_STATUS_OK; + } + else + { + retval = XMC_POSIF_STATUS_ERROR; + } + return retval; +} + +/* API to configure input source */ +void XMC_POSIF_SelectInputSource (XMC_POSIF_t *const peripheral, const XMC_POSIF_INPUT_PORT_t input0, + const XMC_POSIF_INPUT_PORT_t input1, const XMC_POSIF_INPUT_PORT_t input2) +{ + uint32_t reg; + XMC_ASSERT("XMC_POSIF_SelectInputSource:Invalid module pointer", XMC_POSIF_IsPeripheralValid(peripheral)); + XMC_ASSERT("XMC_POSIF_SelectInputSource:Wrong input port input0", (input0 < XMC_POSIF_INSEL_MAX)); + XMC_ASSERT("XMC_POSIF_SelectInputSource:Wrong input port input1", (input1 < XMC_POSIF_INSEL_MAX)); + XMC_ASSERT("XMC_POSIF_SelectInputSource:Wrong input port input2", (input2 < XMC_POSIF_INSEL_MAX)); + + reg = (uint32_t)((((uint32_t)input0 << POSIF_PCONF_INSEL0_Pos) & (uint32_t)POSIF_PCONF_INSEL0_Msk) | + (((uint32_t)input1 << POSIF_PCONF_INSEL1_Pos) & (uint32_t)POSIF_PCONF_INSEL1_Msk) | + (((uint32_t)input2 << POSIF_PCONF_INSEL2_Pos) & (uint32_t)POSIF_PCONF_INSEL2_Msk)); + peripheral->PCONF = ((peripheral->PCONF & ~(uint32_t)XMC_POSIF_PCONF_INSEL_Msk) | reg); +} + +/* API to select an interrupt node */ +void XMC_POSIF_SetInterruptNode(XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event, const XMC_POSIF_SR_ID_t sr) +{ + uint32_t reg; + + XMC_ASSERT("XMC_POSIF_SetInterruptNode:Invalid module pointer", XMC_POSIF_IsPeripheralValid(peripheral)); + XMC_ASSERT("XMC_POSIF_SetInterruptNode:Wrong IRQ event", (event <= XMC_POSIF_IRQ_EVENT_PCLK) ); + XMC_ASSERT("XMC_POSIF_SetInterruptNode:Wrong SR ID", (sr <= XMC_POSIF_SR_ID_1) ); + + reg = peripheral->PFLGE; + reg &= ~((uint32_t)1 << ((uint32_t)event + (uint32_t)POSIF_PFLGE_CHESEL_Pos)); + reg |= (uint32_t)sr << ((uint32_t)event + (uint32_t)POSIF_PFLGE_CHESEL_Pos); + peripheral->PFLGE = reg; +} +#endif /* #if defined(POSIF0) */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_prng.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_prng.c new file mode 100644 index 00000000..9685ba8d --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_prng.c @@ -0,0 +1,107 @@ + +/** + * @file xmc_prng.c + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * - Removed GetDriverVersion API
+ * + * 2015-06-20 + * - Removed definition of GetDriverVersion API
+ * + * @endcond + */ + +#include "xmc_prng.h" + +#if defined (PRNG) + +/********************************************************************************************************************* + * API IMPLEMENTATION + *********************************************************************************************************************/ + +/* + * Initializes the PRNG peripheral with the settings in the + * initialization structure XMC_PRNG_INIT_t + */ +XMC_PRNG_INIT_STATUS_t XMC_PRNG_Init(const XMC_PRNG_INIT_t *prng) +{ + volatile uint16_t read_warm_up; + uint16_t reg_val, iter; + XMC_PRNG_INIT_STATUS_t status = XMC_PRNG_INITIALIZED; + + XMC_ASSERT("XMC_PRNG_Init:Null Pointer", (prng != (XMC_PRNG_INIT_t *)NULL)); + + /* Configure block size for key loading mode */ + XMC_PRNG_SetRandomDataBlockSize(XMC_PRNG_RDBS_WORD); + + /* Enable key loading mode */ + XMC_PRNG_EnableKeyLoadingMode(); + + /* Load key words (80 bits) and wait till RDV is set */ + for (iter = (uint16_t)0UL; iter < (uint16_t)5UL; iter++) + { + XMC_PRNG_LoadKeyWords(prng->key_words[iter]); + while (PRNG_CHK_RDV_Msk != XMC_PRNG_CheckValidStatus()); + } + + XMC_PRNG_EnableStreamingMode(); + + /* Warm up phase: Read and discard 64 bits */ + read_warm_up = PRNG->WORD; + read_warm_up = PRNG->WORD; + read_warm_up = PRNG->WORD; + reg_val = PRNG->WORD; + read_warm_up &= reg_val; + + /* Configure block size either byte (8 bit) or word (16 bit) */ + XMC_PRNG_SetRandomDataBlockSize(prng->block_size); + + /* + * Checks for reset value for "random data block size". If reset, + * PRNG is not initialized + */ + if ((uint16_t)XMC_PRNG_RDBS_RESET == (PRNG->CTRL & (uint16_t)PRNG_CTRL_RDBS_Msk)) + { + status = XMC_PRNG_NOT_INITIALIZED; + } + + return status; +} + +#endif /* #if defined (PRNG) */ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_rtc.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_rtc.c new file mode 100644 index 00000000..6a115952 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_rtc.c @@ -0,0 +1,298 @@ +/** + * @file xmc_rtc.c + * @date 2015-05-19 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-06-20: + * - Removed GetDriverVersion API + * + * 2016-05-19: + * - Added XMC_RTC_SetTimeStdFormat() and XMC_RTC_SetAlarmStdFormat() + * + * @endcond + * + */ + +/** + * + * @brief RTC driver for XMC microcontroller family. + * + */ + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ + +#include "xmc_scu.h" +#include "xmc_rtc.h" + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ + +#define XMC_RTC_MAXSECONDS (59U) /**< RTC time : Maximum seconds */ +#define XMC_RTC_MAXMINUTES (59U) /**< RTC time : Maximum minutes */ +#define XMC_RTC_MAXHOURS (23U) /**< RTC time : Maximum hours */ +#define XMC_RTC_MAXDAYS (31U) /**< RTC time : Maximum days */ +#define XMC_RTC_MAXDAYSOFWEEK (7U) /**< RTC time : Maximum days of week */ +#define XMC_RTC_MAXMONTH (12U) /**< RTC time : Maximum month */ +#define XMC_RTC_MAXYEAR (0xFFFFU) /**< RTC time : Maximum year */ +#define XMC_RTC_MAXPRESCALER (0xFFFFU) /**< RTC time : Maximum prescaler */ +#define XMC_RTC_YEAR_OFFSET (1900U) /**< RTC year offset : Year offset */ + +#if (UC_FAMILY == XMC4) +#define XMC_RTC_INIT_SEQUENCE (1U) +#endif +#if (UC_FAMILY == XMC1) +#define XMC_RTC_INIT_SEQUENCE (0U) +#endif + +/********************************************************************************************************************* + * API IMPLEMENTATION + *********************************************************************************************************************/ + +/* + * Enables RTC peripheral to start counting time + */ +void XMC_RTC_Start(void) +{ + while((XMC_SCU_GetMirrorStatus() & SCU_GENERAL_MIRRSTS_RTC_CTR_Msk) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->CTR |= (uint32_t)RTC_CTR_ENB_Msk; +} + +/* + * Disables RTC peripheral to start counting time + */ +void XMC_RTC_Stop(void) +{ + while((XMC_SCU_GetMirrorStatus() & SCU_GENERAL_MIRRSTS_RTC_CTR_Msk) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->CTR &= ~(uint32_t)RTC_CTR_ENB_Msk; +} + +/* + * Sets the RTC module prescaler value + */ +void XMC_RTC_SetPrescaler(uint16_t prescaler) +{ + XMC_ASSERT("XMC_RTC_SetPrescaler:Wrong prescaler value", (prescaler < XMC_RTC_MAXPRESCALER)); + + while((XMC_SCU_GetMirrorStatus() & SCU_GENERAL_MIRRSTS_RTC_CTR_Msk) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->CTR = (RTC->CTR & ~(uint32_t)RTC_CTR_DIV_Msk) | + ((uint32_t)prescaler << (uint32_t)RTC_CTR_DIV_Pos); +} + +/* + * Sets the RTC_TIM0, RTC_TIM1 registers with time values + */ +void XMC_RTC_SetTime(const XMC_RTC_TIME_t *const time) +{ + XMC_ASSERT("XMC_RTC_SetTime:Wrong seconds value", ((uint32_t)time->seconds < XMC_RTC_MAXSECONDS)); + XMC_ASSERT("XMC_RTC_SetTime:Wrong minutes value", ((uint32_t)time->minutes < XMC_RTC_MAXMINUTES)); + XMC_ASSERT("XMC_RTC_SetTime:Wrong hours value", ((uint32_t)time->hours < XMC_RTC_MAXHOURS)); + XMC_ASSERT("XMC_RTC_SetTime:Wrong month day value", ((uint32_t)time->days < XMC_RTC_MAXDAYS)); + XMC_ASSERT("XMC_RTC_SetTime:Wrong week day value", ((uint32_t)time->daysofweek < XMC_RTC_MAXDAYSOFWEEK)); + XMC_ASSERT("XMC_RTC_SetTime:Wrong month value", ((uint32_t)time->month < XMC_RTC_MAXMONTH)); + XMC_ASSERT("XMC_RTC_SetTime:Wrong year value", ((uint32_t)time->year < XMC_RTC_MAXYEAR)); + + #if (XMC_RTC_INIT_SEQUENCE == 1U) + while ((XMC_SCU_GetMirrorStatus() & SCU_GENERAL_MIRRSTS_RTC_TIM0_Msk) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->TIM0 = time->raw0; + + while ((XMC_SCU_GetMirrorStatus() & SCU_GENERAL_MIRRSTS_RTC_TIM1_Msk) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->TIM1 = time->raw1; + #endif + #if (XMC_RTC_INIT_SEQUENCE == 0U) + while ((XMC_SCU_GetMirrorStatus() & (SCU_GENERAL_MIRRSTS_RTC_TIM0_Msk | SCU_GENERAL_MIRRSTS_RTC_TIM1_Msk)) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->TIM0 = time->raw0; + RTC->TIM1 = time->raw1; ; + #endif +} + +/* + * Gets the RTC module time value + */ +void XMC_RTC_GetTime(XMC_RTC_TIME_t *const time) +{ + time->raw0 = RTC->TIM0; + time->raw1 = RTC->TIM1; +} + +/* + * Sets the RTC module time values in standard format + */ +void XMC_RTC_SetTimeStdFormat(const struct tm *const stdtime) +{ + + XMC_RTC_TIME_t time; + + time.seconds = stdtime->tm_sec; + time.minutes = stdtime->tm_min; + time.hours = stdtime->tm_hour; + time.days = stdtime->tm_mday - 1; + time.month = stdtime->tm_mon; + time.year = stdtime->tm_year + XMC_RTC_YEAR_OFFSET; + time.daysofweek = stdtime->tm_wday; + + XMC_RTC_SetTime(&time); +} + +/* + * Gets the RTC module time values in standard format + */ +void XMC_RTC_GetTimeStdFormat(struct tm *const stdtime) +{ + XMC_RTC_TIME_t time; + time.raw0 = RTC->TIM0; + time.raw1 = RTC->TIM1; + + stdtime->tm_sec = (int8_t)time.seconds; + stdtime->tm_min = (int8_t)time.minutes; + stdtime->tm_hour = (int8_t)time.hours; + stdtime->tm_mday = ((int8_t)time.days + (int8_t)1); + stdtime->tm_mon = (int8_t)time.month; + stdtime->tm_year = (int32_t)time.year - (int32_t)XMC_RTC_YEAR_OFFSET; + stdtime->tm_wday = (int8_t)time.daysofweek; +} + +/* + * Sets the RTC module alarm time value + */ +void XMC_RTC_SetAlarm(const XMC_RTC_ALARM_t *const alarm) +{ + XMC_ASSERT("XMC_RTC_SetAlarm:Wrong seconds value", ((uint32_t)alarm->seconds < XMC_RTC_MAXSECONDS)); + XMC_ASSERT("XMC_RTC_SetAlarm:Wrong minutes value", ((uint32_t)alarm->minutes < XMC_RTC_MAXMINUTES)); + XMC_ASSERT("XMC_RTC_SetAlarm:Wrong hours value", ((uint32_t)alarm->hours < XMC_RTC_MAXHOURS)); + XMC_ASSERT("XMC_RTC_SetAlarm:Wrong days value", ((uint32_t)alarm->days < XMC_RTC_MAXDAYS)); + XMC_ASSERT("XMC_RTC_SetAlarm:Wrong month value", ((uint32_t)alarm->month < XMC_RTC_MAXMONTH)); + XMC_ASSERT("XMC_RTC_SetAlarm:Wrong year value", ((uint32_t)alarm->year < XMC_RTC_MAXYEAR)); + + #if (XMC_RTC_INIT_SEQUENCE == 1U) + while ((XMC_SCU_GetMirrorStatus() & SCU_GENERAL_MIRRSTS_RTC_ATIM0_Msk) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->ATIM0 = alarm->raw0; + + while ((XMC_SCU_GetMirrorStatus() & SCU_GENERAL_MIRRSTS_RTC_ATIM1_Msk) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->ATIM1 = alarm->raw1; + #endif + #if (XMC_RTC_INIT_SEQUENCE == 0U) + while ((XMC_SCU_GetMirrorStatus() & (SCU_GENERAL_MIRRSTS_RTC_ATIM0_Msk | SCU_GENERAL_MIRRSTS_RTC_ATIM1_Msk)) != 0U) + { + /* check SCU_MIRRSTS to ensure that no transfer over serial interface is pending */ + } + RTC->ATIM0 = alarm->raw0; + RTC->ATIM1 = alarm->raw1; + #endif +} + +/* + * Gets the RTC module alarm time value + */ +void XMC_RTC_GetAlarm(XMC_RTC_ALARM_t *const alarm) +{ + alarm->raw0 = RTC->ATIM0; + alarm->raw1 = RTC->ATIM1; +} + + +/* + * Sets the RTC module alarm time value in standard format + */ +void XMC_RTC_SetAlarmStdFormat(const struct tm *const stdtime) +{ + XMC_RTC_ALARM_t alarm; + + + alarm.seconds = stdtime->tm_sec; + alarm.minutes = stdtime->tm_min; + alarm.hours = stdtime->tm_hour; + alarm.days = stdtime->tm_mday - 1; + alarm.month = stdtime->tm_mon; + alarm.year = stdtime->tm_year + XMC_RTC_YEAR_OFFSET; + + XMC_RTC_SetAlarm(&alarm); +} + +/* + * Gets the RTC module alarm time value in standard format + */ +void XMC_RTC_GetAlarmStdFormat(struct tm *const stdtime) +{ + XMC_RTC_ALARM_t alarm; + + alarm.raw0 = RTC->ATIM0; + alarm.raw1 = RTC->ATIM1; + + stdtime->tm_sec = (int8_t)alarm.seconds; + stdtime->tm_min = (int8_t)alarm.minutes; + stdtime->tm_hour = (int8_t)alarm.hours; + stdtime->tm_mday = ((int8_t)alarm.days + (int8_t)1); + stdtime->tm_mon = (int8_t)alarm.month; + stdtime->tm_year = (int32_t)alarm.year - (int32_t)XMC_RTC_YEAR_OFFSET; +} + +/* + * Gets the RTC periodic and alarm event(s) status + */ +uint32_t XMC_RTC_GetEventStatus(void) +{ + return RTC->STSSR; +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_spi.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_spi.c new file mode 100644 index 00000000..8d324a32 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_spi.c @@ -0,0 +1,279 @@ +/** + * @file xmc_spi.c + * @date 2015-11-04 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-05-20: + * - Modified XMC_SPI_CH_Stop() API for not setting to IDLE the channel if it is busy + * - Modified XMC_SPI_CH_SetInterwordDelay() implementation in order to gain accuracy
+ * + * 2015-06-20: + * - Removed GetDriverVersion API
+ * + * 2015-09-01: + * - Modified XMC_SPI_CH_EnableEvent() and XMC_SPI_CH_DisableEvent() for supporting multiple events configuration
+ * + * 2015-11-04: + * - Modified the check of XMC_USIC_CH_GetTransmitBufferStatus() in the XMC_SPI_CH_Transmit() flag
+ * @endcond + * + */ +/** + * + * @brief SPI driver for XMC microcontroller family + * + */ +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ + +#include +#include + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_SPI_CH_OVERSAMPLING (2UL) + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* Initializes the selected SPI channel with the config structure. */ +void XMC_SPI_CH_Init(XMC_USIC_CH_t *const channel, const XMC_SPI_CH_CONFIG_t *const config) +{ + XMC_USIC_CH_Enable(channel); + + if(config->bus_mode == XMC_SPI_CH_BUS_MODE_MASTER) + { + /* Configure baud rate */ + (void)XMC_USIC_CH_SetBaudrate(channel, config->baudrate, XMC_SPI_CH_OVERSAMPLING); + } + + /* Configuration of USIC Shift Control */ + /* Transmission Mode (TRM) = 1 */ + /* Passive Data Level (PDL) = 1 */ + channel->SCTR = USIC_CH_SCTR_PDL_Msk | + (0x1UL << USIC_CH_SCTR_TRM_Pos) | + (0x3fUL << USIC_CH_SCTR_FLE_Pos)| + (0x7UL << USIC_CH_SCTR_WLE_Pos); + + /* Configuration of USIC Transmit Control/Status Register */ + /* TBUF Data Enable (TDEN) = 1 */ + /* TBUF Data Single Shot Mode (TDSSM) = 1 */ + channel->TCSR = (uint32_t)(USIC_CH_TCSR_HPCMD_Msk | + (0x01UL << USIC_CH_TCSR_TDEN_Pos) | + USIC_CH_TCSR_TDSSM_Msk); + + if(config->bus_mode == XMC_SPI_CH_BUS_MODE_MASTER) + { + /* Configuration of Protocol Control Register */ + channel->PCR_SSCMode = (uint32_t)(USIC_CH_PCR_SSCMode_MSLSEN_Msk | + USIC_CH_PCR_SSCMode_SELCTR_Msk | + (uint32_t)config->selo_inversion | + USIC_CH_PCR_SSCMode_FEM_Msk); + } + + /* Clear protocol status */ + channel->PSCR = 0xFFFFFFFFUL; + + /* Set parity settings */ + channel->CCR = (uint32_t)config->parity_mode; +} + +XMC_SPI_CH_STATUS_t XMC_SPI_CH_SetBaudrate(XMC_USIC_CH_t *const channel, const uint32_t rate) +{ + XMC_SPI_CH_STATUS_t status; + + status = XMC_SPI_CH_STATUS_ERROR; + + if (rate <= (XMC_SCU_CLOCK_GetPeripheralClockFrequency() >> 1U)) + { + if (XMC_USIC_CH_SetBaudrate(channel, rate, XMC_SPI_CH_OVERSAMPLING) == XMC_USIC_CH_STATUS_OK) + { + status = XMC_SPI_CH_STATUS_OK; + } + } + return status; +} + +/* Enable the selected slave signal by setting (SELO) bits in PCR register. */ +void XMC_SPI_CH_EnableSlaveSelect(XMC_USIC_CH_t *const channel, const XMC_SPI_CH_SLAVE_SELECT_t slave) +{ + /* Configuration of Protocol Control Register */ + channel->PCR_SSCMode &= (uint32_t)~USIC_CH_PCR_SSCMode_SELO_Msk; + channel->PCR_SSCMode |= (uint32_t)slave; +} + +/* Disable the slave signals by clearing (SELO) bits in PCR register. */ +void XMC_SPI_CH_DisableSlaveSelect(XMC_USIC_CH_t *const channel) +{ + XMC_SPI_CH_ClearStatusFlag(channel, (uint32_t)XMC_SPI_CH_STATUS_FLAG_MSLS); + + /* Configuration of Protocol Control Register */ + channel->PCR_SSCMode &= (uint32_t)~USIC_CH_PCR_SSCMode_SELO_Msk; +} + +/* Puts the data into FIFO if FIFO mode is enabled or else into standard buffers, by setting the proper mode. */ +void XMC_SPI_CH_Transmit(XMC_USIC_CH_t *const channel, const uint16_t data, const XMC_SPI_CH_MODE_t mode) +{ + + channel->CCR = (channel->CCR & (uint32_t)(~USIC_CH_CCR_HPCEN_Msk)) | + (((uint32_t) mode << USIC_CH_CCR_HPCEN_Pos) & (uint32_t)USIC_CH_CCR_HPCEN_Msk); + + + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0U) + { + while((uint32_t)XMC_USIC_CH_GetTransmitBufferStatus(channel) == (uint32_t)XMC_USIC_CH_TBUF_STATUS_BUSY) + { + } + + XMC_SPI_CH_ClearStatusFlag(channel, (uint32_t)XMC_SPI_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + channel->TBUF[mode] = data; + } + else + { + channel->IN[mode] = data; + } +} + +/* Reads the data from the buffers based on the FIFO mode selection. */ +uint16_t XMC_SPI_CH_GetReceivedData(XMC_USIC_CH_t *const channel) +{ + uint16_t retval; + + /* Check FIFO size */ + if ((channel->RBCTR & USIC_CH_RBCTR_SIZE_Msk) == 0U) + { + retval = (uint16_t)channel->RBUF; + } + else + { + retval = (uint16_t)channel->OUTR; + } + + return retval; +} + +/* Configures the inter word delay by setting PCR.PCTQ1, PCR.DCTQ1 bit fields. */ +void XMC_SPI_CH_SetInterwordDelay(XMC_USIC_CH_t *const channel,uint32_t tinterword_delay_us) +{ + uint32_t peripheral_clock; + uint32_t pdiv; + uint32_t step; + uint32_t fFD; + uint32_t fpdiv; + uint32_t divider_factor1 = 0U; + uint32_t divider_factor2 = 32U; + uint32_t divider_factor1_int = 0U; + uint32_t divider_factor1_int_min = 4U; + uint32_t divider_factor1_frac_min =100U; + uint32_t divider_factor1_frac = 0U; + uint32_t divider_factor2_temp = 0U; + peripheral_clock = XMC_SCU_CLOCK_GetPeripheralClockFrequency(); + pdiv = (uint32_t)(channel->BRG & USIC_CH_BRG_PDIV_Msk) >> USIC_CH_BRG_PDIV_Pos; + step = (uint32_t)(channel->FDR & USIC_CH_FDR_STEP_Msk) >> USIC_CH_FDR_STEP_Pos; + fFD = (uint32_t)((peripheral_clock >> 10U) * step); + fpdiv= fFD/(1U+pdiv); + + if(tinterword_delay_us < (128000000/fpdiv)) + { + for(divider_factor2_temp = 32U; divider_factor2_temp > 0U; --divider_factor2_temp) + { + + divider_factor1 = (tinterword_delay_us*fpdiv)/(divider_factor2_temp*10000); + divider_factor1_frac = divider_factor1%100U; + + if(divider_factor1_frac > 50) + { + divider_factor1_int = (divider_factor1/100U)+1; + divider_factor1_frac = (divider_factor1_int*100)-divider_factor1; + } + else + { + divider_factor1_int = (divider_factor1/100U); + } + + if ((divider_factor1_int < 5U) && (divider_factor1_int > 0) && (divider_factor1_frac < divider_factor1_frac_min)) + { + divider_factor1_frac_min = divider_factor1_frac; + divider_factor1_int_min = divider_factor1_int; + divider_factor2= divider_factor2_temp; + } + } + } + + channel->PCR_SSCMode = (uint32_t)((channel->PCR_SSCMode) & (~(USIC_CH_PCR_SSCMode_DCTQ1_Msk | + USIC_CH_PCR_SSCMode_PCTQ1_Msk | + USIC_CH_PCR_SSCMode_CTQSEL1_Msk))) | + (((divider_factor1_int_min - 1) << USIC_CH_PCR_SSCMode_PCTQ1_Pos) & (uint32_t)USIC_CH_PCR_SSCMode_PCTQ1_Msk) | + (((divider_factor2 - 1 ) << USIC_CH_PCR_SSCMode_DCTQ1_Pos) & (uint32_t)USIC_CH_PCR_SSCMode_DCTQ1_Msk); +} + +XMC_SPI_CH_STATUS_t XMC_SPI_CH_Stop(XMC_USIC_CH_t *const channel) +{ + XMC_SPI_CH_STATUS_t status = XMC_SPI_CH_STATUS_OK; + + if (((uint32_t)XMC_USIC_CH_GetTransmitBufferStatus(channel) & (uint32_t)XMC_USIC_CH_TBUF_STATUS_BUSY) != 0U) + { + status = XMC_SPI_CH_STATUS_BUSY; + } + else + { + + /* USIC channel in IDLE mode */ + XMC_USIC_CH_SetMode(channel, XMC_USIC_CH_OPERATING_MODE_IDLE); + } + + return status; +} + +void XMC_SPI_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR |= (event&0x1fc00U); + channel->PCR_SSCMode |= ((event << 13U) & 0xe000U); +} + +void XMC_SPI_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR &= (uint32_t)~(event&0x1fc00U); + channel->PCR_SSCMode &= (uint32_t)~((event << 13U) & 0xe000U); +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_uart.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_uart.c new file mode 100644 index 00000000..3641315a --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_uart.c @@ -0,0 +1,216 @@ +/** + * @file xmc_uart.c + * @date 2016-07-22 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-05-20: + * - xmc_uart_ch_stop API implementation corrected. + * - Modified XMC_UART_CH_Stop() API for not setting to IDLE the channel if it is busy
+ * + * 2015-06-20: + * - Removed GetDriverVersion API
+ * + * 2015-09-01: + * - Modified XMC_UART_CH_EnableEvent() and XMC_UART_CH_DisableEvent() for supporting multiple events configuration
+ * + * 2016-07-22: + * - Modified XMC_UART_CH_Init() to enable transfer status BUSY + * - Modified XMC_UART_CH_Stop() to check for transfer status + * + * @endcond + * + */ + +/********************************************************************************************************************* + * HEADER FILES + *********************************************************************************************************************/ + +#include +#include + +/********************************************************************************************************************* + * MACROS + *********************************************************************************************************************/ + +#define XMC_UART_CH_OVERSAMPLING (16UL) +#define XMC_UART_CH_OVERSAMPLING_MIN_VAL (4UL) + +/********************************************************************************************************************* + * API IMPLEMENTATION + *********************************************************************************************************************/ + +void XMC_UART_CH_Init(XMC_USIC_CH_t *channel, const XMC_UART_CH_CONFIG_t *const config) +{ + uint32_t oversampling = XMC_UART_CH_OVERSAMPLING; + + /* USIC channel switched on*/ + XMC_USIC_CH_Enable(channel); + + if(config->oversampling != 0U) + { + oversampling = (uint32_t)config->oversampling; + } + + /* Configure baud rate */ + (void)XMC_USIC_CH_SetBaudrate(channel, config->baudrate, oversampling); + + /* Configure frame format + * Configure the number of stop bits + * Pulse length is set to 0 to have standard UART signaling, + * i.e. the 0 level is signaled during the complete bit time + * Sampling point set equal to the half of the oversampling period + * Enable Sample Majority Decision + * Enable Transfer Status BUSY + */ + channel->PCR_ASCMode = (uint32_t)(((config->stop_bits - 1UL) << USIC_CH_PCR_ASCMode_STPB_Pos) | + (((oversampling >> 1UL) + 1UL) << USIC_CH_PCR_ASCMode_SP_Pos) | + USIC_CH_PCR_ASCMode_SMD_Msk | + USIC_CH_PCR_ASCMode_RSTEN_Msk | USIC_CH_PCR_ASCMode_TSTEN_Msk); + + /* Set passive data level, high + Set word length. Data bits - 1 + If frame length is > 0, frame_lemgth-1; else, FLE = WLE (Data bits - 1) + Transmission Mode: The shift control signal is considered active if it + is at 1-level. This is the setting to be programmed to allow data transfers */ + channel->SCTR = (uint32_t)((((uint32_t)config->data_bits - 1UL) << USIC_CH_SCTR_WLE_Pos) | + ((0x1UL << USIC_CH_SCTR_TRM_Pos) | USIC_CH_SCTR_PDL_Msk)); + + if (config->frame_length != 0U) + { + channel->SCTR |= (uint32_t)(((uint32_t)config->frame_length - 1UL) << USIC_CH_SCTR_FLE_Pos); + } + else + { + channel->SCTR |= (uint32_t)(((uint32_t)config->data_bits - 1UL) << USIC_CH_SCTR_FLE_Pos); + } + + /* Enable transfer buffer */ + channel->TCSR = (0x1UL << USIC_CH_TCSR_TDEN_Pos) | + USIC_CH_TCSR_TDSSM_Msk; + + /* Clear protocol status */ + channel->PSCR = 0xFFFFFFFFUL; + + /* Set parity settings */ + channel->CCR = (uint32_t)config->parity_mode; +} + +XMC_UART_CH_STATUS_t XMC_UART_CH_SetBaudrate(XMC_USIC_CH_t *const channel, uint32_t rate, uint32_t oversampling) +{ + XMC_UART_CH_STATUS_t status; + + status = XMC_UART_CH_STATUS_ERROR; + + if ((rate <= (XMC_SCU_CLOCK_GetPeripheralClockFrequency() >> 2U)) && (oversampling >= XMC_UART_CH_OVERSAMPLING_MIN_VAL)) + { + if (XMC_USIC_CH_SetBaudrate(channel, rate, oversampling) == XMC_USIC_CH_STATUS_OK) + { + status = XMC_UART_CH_STATUS_OK; + } + } + return status; +} + +void XMC_UART_CH_Transmit(XMC_USIC_CH_t *const channel, const uint16_t data) +{ + /* Check FIFO size */ + if ((channel->TBCTR & USIC_CH_TBCTR_SIZE_Msk) == 0UL) + { + /* Wait till the Transmit Buffer is free for transmission */ + while(XMC_USIC_CH_GetTransmitBufferStatus(channel) == XMC_USIC_CH_TBUF_STATUS_BUSY) + { + } + + /* Clear the Transmit Buffer indication flag */ + XMC_UART_CH_ClearStatusFlag(channel, (uint32_t)XMC_UART_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION); + + /*Transmit data */ + channel->TBUF[0U] = data; + } + else + { + channel->IN[0U] = data; + } +} + +uint16_t XMC_UART_CH_GetReceivedData(XMC_USIC_CH_t *const channel) +{ + uint16_t retval; + + /* Check FIFO size */ + if ((channel->RBCTR & USIC_CH_RBCTR_SIZE_Msk) == 0U) + { + retval = (uint16_t)channel->RBUF; + } + else + { + retval = (uint16_t)channel->OUTR; + } + + return retval; +} + +XMC_UART_CH_STATUS_t XMC_UART_CH_Stop(XMC_USIC_CH_t *const channel) +{ + XMC_UART_CH_STATUS_t status = XMC_UART_CH_STATUS_OK; + + if (((XMC_USIC_CH_GetTransmitBufferStatus(channel) & (uint32_t) XMC_USIC_CH_TBUF_STATUS_BUSY) != 0U) || + ((XMC_UART_CH_GetStatusFlag(channel) & XMC_UART_CH_STATUS_FLAG_TRANSFER_STATUS_BUSY) != 0)) + { + status = XMC_UART_CH_STATUS_BUSY; + } + else + { + /* USIC channel in IDLE mode */ + XMC_USIC_CH_SetMode(channel, XMC_USIC_CH_OPERATING_MODE_IDLE); + } + return status; +} + +void XMC_UART_CH_EnableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR |= (event&0x1fc00U); + channel->PCR_ASCMode |= (event&0xf8U); +} + +void XMC_UART_CH_DisableEvent(XMC_USIC_CH_t *const channel, const uint32_t event) +{ + channel->CCR &= (uint32_t)~(event&0x1fc00U); + channel->PCR_ASCMode &= (uint32_t)~(event&0xf8U); +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_usic.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_usic.c new file mode 100644 index 00000000..d6f3b0c7 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_usic.c @@ -0,0 +1,373 @@ +/** + * @file xmc_usic.c + * @date 2015-09-01 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial draft
+ * - Documentation improved
+ * + * 2015-05-08: + * - Clearing bit fields PDIV, PCTQ, PPPEN in XMC_USIC_CH_SetBaudrate() API
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API
+ * + * 2015-08-27: + * - Added APIs for external input for BRG configuration:XMC_USIC_CH_ConfigExternalInputSignalToBRG()
+ * + * 2015-08-28: + * - Added asserts to XMC_USIC_CH_ConfigExternalInputSignalToBRG()
+ * + * 2015-09-01: + * - Fixed warning in the asserts
+ * + * @endcond + * + */ + +/******************************************************************************* + * HEADER FILES + *******************************************************************************/ + +#include "xmc_usic.h" +#include "xmc_scu.h" + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +#define USIC_CH_INPR_Msk (0x7UL) + +/******************************************************************************* + * API IMPLEMENTATION + *******************************************************************************/ + +void XMC_USIC_CH_Enable(XMC_USIC_CH_t *const channel) +{ + XMC_ASSERT("XMC_USIC_CH_Enable: channel not valid", XMC_USIC_IsChannelValid(channel)); + + if ((channel == XMC_USIC0_CH0) || (channel == XMC_USIC0_CH1)) + { + XMC_USIC_Enable(XMC_USIC0); + } +#if defined(USIC1) + else if((channel == XMC_USIC1_CH0) || (channel == XMC_USIC1_CH1)) + { + XMC_USIC_Enable(XMC_USIC1); + } +#endif +#if defined(USIC2) + else if((channel == XMC_USIC2_CH0) || (channel == XMC_USIC2_CH1)) + { + XMC_USIC_Enable(XMC_USIC2); + } +#endif + else + { + XMC_ASSERT("USIC module not available", 0U/*Always*/); + } + + /* USIC channel switched on*/ + channel->KSCFG = (USIC_CH_KSCFG_MODEN_Msk | USIC_CH_KSCFG_BPMODEN_Msk); + while ((channel->KSCFG & USIC_CH_KSCFG_MODEN_Msk) == 0U) + { + /* Wait till the channel is enabled */ + } + + /* Set USIC channel in IDLE mode */ + channel->CCR &= (uint32_t)~USIC_CH_CCR_MODE_Msk; +} + +void XMC_USIC_CH_Disable(XMC_USIC_CH_t *const channel) +{ + channel->KSCFG = (uint32_t)((channel->KSCFG & (~USIC_CH_KSCFG_MODEN_Msk)) | USIC_CH_KSCFG_BPMODEN_Msk); +} + +XMC_USIC_CH_STATUS_t XMC_USIC_CH_SetBaudrate(XMC_USIC_CH_t *const channel, uint32_t rate, uint32_t oversampling) +{ + XMC_USIC_CH_STATUS_t status; + + uint32_t peripheral_clock; + + uint32_t clock_divider; + uint32_t clock_divider_min; + + uint32_t pdiv; + uint32_t pdiv_int; + uint32_t pdiv_int_min; + + uint32_t pdiv_frac; + uint32_t pdiv_frac_min; + + /* The rate and peripheral clock are divided by 100 to be able to use only 32bit arithmetic */ + if ((rate >= 100U) && (oversampling != 0U)) + { + peripheral_clock = XMC_SCU_CLOCK_GetPeripheralClockFrequency() / 100U; + rate = rate / 100U; + + clock_divider_min = 1U; + pdiv_int_min = 1U; + pdiv_frac_min = 0x3ffU; + + for(clock_divider = 1023U; clock_divider > 0U; --clock_divider) + { + pdiv = ((peripheral_clock * clock_divider) / (rate * oversampling)); + pdiv_int = pdiv >> 10U; + pdiv_frac = pdiv & 0x3ffU; + + if ((pdiv_int < 1024U) && (pdiv_frac < pdiv_frac_min)) + { + pdiv_frac_min = pdiv_frac; + pdiv_int_min = pdiv_int; + clock_divider_min = clock_divider; + } + } + + channel->FDR = XMC_USIC_CH_BRG_CLOCK_DIVIDER_MODE_FRACTIONAL | + (clock_divider_min << USIC_CH_FDR_STEP_Pos); + + channel->BRG = (channel->BRG & ~(USIC_CH_BRG_DCTQ_Msk | + USIC_CH_BRG_PDIV_Msk | + USIC_CH_BRG_PCTQ_Msk | + USIC_CH_BRG_PPPEN_Msk)) | + ((oversampling - 1U) << USIC_CH_BRG_DCTQ_Pos) | + ((pdiv_int_min - 1U) << USIC_CH_BRG_PDIV_Pos); + + status = XMC_USIC_CH_STATUS_OK; + } + else + { + status = XMC_USIC_CH_STATUS_ERROR; + } + + return status; +} + +void XMC_USIC_CH_ConfigExternalInputSignalToBRG(XMC_USIC_CH_t *const channel, + const uint16_t pdiv, + const uint32_t oversampling, + const XMC_USIC_CH_INPUT_COMBINATION_MODE_t combination_mode) +{ + XMC_ASSERT("XMC_USIC_CH_ConfigExternalInputSignalToBRG: Divider out of range", ((1U < pdiv) || (pdiv < 1024U))); + XMC_ASSERT("XMC_USIC_CH_ConfigExternalInputSignalToBRG: Oversampling out of range", ((1U < oversampling) || (oversampling < 32U))); + + /* Setting the external input frequency source through DX1 */ + XMC_USIC_CH_SetBRGInputClockSource(channel, XMC_USIC_CH_BRG_CLOCK_SOURCE_DX1T); + + /* Setting the trigger combination mode */ + XMC_USIC_CH_SetInputTriggerCombinationMode(channel,XMC_USIC_CH_INPUT_DX1,combination_mode); + + /* Configuring the dividers and oversampling */ + channel->BRG = (channel->BRG & ~(USIC_CH_BRG_DCTQ_Msk | + USIC_CH_BRG_PDIV_Msk | + USIC_CH_BRG_PCTQ_Msk | + USIC_CH_BRG_PPPEN_Msk)) | + (((oversampling) - 1U) << USIC_CH_BRG_DCTQ_Pos) | + (((pdiv) - 1U) << USIC_CH_BRG_PDIV_Pos); +} + +void XMC_USIC_CH_TXFIFO_Configure(XMC_USIC_CH_t *const channel, + const uint32_t data_pointer, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit) +{ + /* Disable FIFO */ + channel->TBCTR &= (uint32_t)~USIC_CH_TBCTR_SIZE_Msk; + + /* LOF = 0, A standard transmit buffer event occurs when the filling level equals the limit value and gets + * lower due to transmission of a data word + * STBTEN = 0, the trigger of the standard transmit buffer event is based on the transition of the fill level + * from equal to below the limit, not the fact being below + */ + channel->TBCTR = (uint32_t)(channel->TBCTR & (uint32_t)~(USIC_CH_TBCTR_LIMIT_Msk | + USIC_CH_TBCTR_DPTR_Msk | + USIC_CH_TBCTR_SIZE_Msk)) | + (uint32_t)((limit << USIC_CH_TBCTR_LIMIT_Pos) | + (data_pointer << USIC_CH_TBCTR_DPTR_Pos) | + ((uint32_t)size << USIC_CH_TBCTR_SIZE_Pos)); +} + + +void XMC_USIC_CH_RXFIFO_Configure(XMC_USIC_CH_t *const channel, + const uint32_t data_pointer, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit) +{ + /* Disable FIFO */ + channel->RBCTR &= (uint32_t)~USIC_CH_RBCTR_SIZE_Msk; + + /* LOF = 1, A standard receive buffer event occurs when the filling level equals the limit value and gets bigger + * due to the reception of a new data word + */ + channel->RBCTR = (uint32_t)((channel->RBCTR & (uint32_t)~(USIC_CH_RBCTR_LIMIT_Msk | + USIC_CH_RBCTR_DPTR_Msk | + USIC_CH_RBCTR_LOF_Msk)) | + ((limit << USIC_CH_RBCTR_LIMIT_Pos) | + (data_pointer << USIC_CH_RBCTR_DPTR_Pos) | + ((uint32_t)size << USIC_CH_RBCTR_SIZE_Pos) | + (uint32_t)USIC_CH_RBCTR_LOF_Msk)); +} + +void XMC_USIC_CH_TXFIFO_SetSizeTriggerLimit(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit) +{ + /* Disable FIFO */ + channel->TBCTR &= (uint32_t)~USIC_CH_TBCTR_SIZE_Msk; + + /* STBTEN = 0, the trigger of the standard transmit buffer event is based on the transition of the fill level + * from equal to below the limit, not the fact being below + */ + channel->TBCTR = (uint32_t)((uint32_t)(channel->TBCTR & (uint32_t)~USIC_CH_TBCTR_LIMIT_Msk) | + (limit << USIC_CH_TBCTR_LIMIT_Pos) | + ((uint32_t)size << USIC_CH_TBCTR_SIZE_Pos)); +} + +void XMC_USIC_CH_RXFIFO_SetSizeTriggerLimit(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_FIFO_SIZE_t size, + const uint32_t limit) +{ + /* Disable FIFO */ + channel->RBCTR &= (uint32_t)~USIC_CH_RBCTR_SIZE_Msk; + + channel->RBCTR = (uint32_t)((uint32_t)(channel->RBCTR & (uint32_t)~USIC_CH_RBCTR_LIMIT_Msk) | + (limit << USIC_CH_RBCTR_LIMIT_Pos) | + ((uint32_t)size << USIC_CH_RBCTR_SIZE_Pos)); +} + +void XMC_USIC_CH_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request) +{ + channel->INPR = (uint32_t)((channel->INPR & (~(uint32_t)(USIC_CH_INPR_Msk << (uint32_t)interrupt_node))) | + (service_request << (uint32_t)interrupt_node)); +} + +void XMC_USIC_CH_TXFIFO_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_TXFIFO_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request) +{ + channel->TBCTR = (uint32_t)((channel->TBCTR & (~(uint32_t)(USIC_CH_INPR_Msk << (uint32_t)interrupt_node))) | + (service_request << (uint32_t)interrupt_node)); +} + +void XMC_USIC_CH_RXFIFO_SetInterruptNodePointer(XMC_USIC_CH_t *const channel, + const XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_t interrupt_node, + const uint32_t service_request) +{ + channel->RBCTR = (uint32_t)((channel->RBCTR & (~(uint32_t)(USIC_CH_INPR_Msk << (uint32_t)interrupt_node))) | + (service_request << (uint32_t)interrupt_node)); +} + +void XMC_USIC_Enable(XMC_USIC_t *const usic) +{ + if (usic == USIC0) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_USIC0); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_USIC0); +#endif + } +#if defined(USIC1) + else if (usic == USIC1) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_USIC1); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_USIC1); +#endif + } +#endif +#if defined(USIC2) + else if (usic == USIC2) + { +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_USIC2); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_USIC2); +#endif + } +#endif + else + { + XMC_ASSERT("USIC module not available", 0/*Always*/); + } +} + +void XMC_USIC_Disable(XMC_USIC_t *const usic) +{ + if (usic == (XMC_USIC_t *)USIC0) + { +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_USIC0); +#endif +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_USIC0); +#endif + } +#if defined(USIC1) + else if (usic == (XMC_USIC_t *)USIC1) + { +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_USIC1); +#endif +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_USIC1); +#endif + } +#endif +#if defined(USIC2) + else if (usic == (XMC_USIC_t *)USIC2) + { +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_USIC2); +#endif +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_USIC2); +#endif + } +#endif + else + { + XMC_ASSERT("USIC module not available", 0/*Always*/); + } + +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_vadc.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_vadc.c new file mode 100644 index 00000000..30298969 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_vadc.c @@ -0,0 +1,2121 @@ +/** + * @file xmc_vadc.c + * @date 2016-06-17 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-15: + * - Initial
+ * + * 2015-02-20: + * - Revised for XMC1201 device.
+ * + * 2015-04-27: + * - Added new APIs for SHS.
+ * - Added New APIs for trigger edge selection.
+ * - Added new APIs for Queue flush entries, boundary selection, Boundary node pointer.
+ * - Revised GatingMode APIs and EMUX Control Init API.
+ * + * 2015-06-20: + * - Removed version macros and declaration of GetDriverVersion API + * + * 2015-06-25: + * - BFL configuration in channel initialization fixed. + * + * 2015-07-28: + * - CLOCK_GATING_SUPPORTED and PERIPHERAL_RESET_SUPPORTED macros used + * - Clubbed the macro definitions for XMC13 XMC12 and XMC14 + * - Clubbed the macro definitions for XMC44 XMC47 and XMC48 + * - New APIs Created. + * - XMC_VADC_GLOBAL_SetIndividualBoundary + * - XMC_VADC_GROUP_SetIndividualBoundary + * - XMC_VADC_GROUP_GetAlias + * - XMC_VADC_GROUP_GetInputClass + * - XMC_VADC_GROUP_ChannelSetIclass + * - XMC_VADC_GROUP_ChannelGetResultAlignment + * - XMC_VADC_GROUP_ChannelGetInputClass + * - XMC_VADC_GROUP_SetResultSubtractionValue + * + * 2015-12-01: + * - Fixed the analog calibration voltage for XMC1100 to external reference upper supply range. + * - Fixed the XMC_VADC_GLOBAL_StartupCalibration() for XMC1100. + * + * 2016-06-17: + * - New macros added XMC_VADC_SHS_FULL_SET_REG, XMC_VADC_RESULT_PRIORITY_AVAILABLE + * and XMC_VADC_SYNCTR_START_LOCATION + * - New Enum added XMC_VADC_SHS_GAIN_LEVEL_t and XMC_VADC_SYNCTR_EVAL_t + * - Fixed the EVAL configuration in API XMC_VADC_GROUP_CheckSlaveReadiness and XMC_VADC_GROUP_IgnoreSlaveReadiness + * - New APIs added are: + * - XMC_VADC_GROUP_SetSyncSlaveReadySignal + * - XMC_VADC_GROUP_ChannelGetAssertedEvents + * - XMC_VADC_GROUP_GetAssertedResultEvents + * - XMC_VADC_GROUP_SetResultRegPriority + * - XMC_VADC_GROUP_SetSyncReadySignal + * - XMC_VADC_GROUP_GetSyncReadySignal + * - XMC_VADC_GROUP_GetResultRegPriority + * + * 2017-01-11: + * - Fix assertion in XMC_VADC_GROUP_CheckSlaveReadiness() and XMC_VADC_GROUP_IgnoreSlaveReadiness() checking the slave_group parameter + * + * @endcond + * + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include + +/********************************************************************************************************************* + * MACROS + ********************************************************************************************************************/ +#define XMC_VADC_MAX_ICLASS_SET (2U) /**< Defines the maximum number of conversion parameter sets */ +#define XMC_VADC_NUM_EMUX_INTERFACES (2U) /**< Defines the maximum number of external multiplexer interfaces */ + +#define XMC_VADC_RESULT_LEFT_ALIGN_10BIT (2U) /**< Defines the 10 bit converted result register left align mask. It \ + is used in the XMC_VADC_GLOBAL_SetCompareValue() API */ + +#define XMC_VADC_SYNCTR_START_LOCATION (3U) /**< Defines the location in SYNCTR needed for calculations*/ +/********************************************************************************************************************* + * ENUMS + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * DATA STRUCTURES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * GLOBAL DATA + ********************************************************************************************************************/ + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) + +#if (XMC_VADC_MAXIMUM_NUM_GROUPS == 4U) +static VADC_G_TypeDef *const g_xmc_vadc_group_array[XMC_VADC_MAXIMUM_NUM_GROUPS] = {(VADC_G_TypeDef*)(void*)VADC_G0, + (VADC_G_TypeDef*)(void*)VADC_G1, + (VADC_G_TypeDef*)(void*)VADC_G2, + (VADC_G_TypeDef*)(void*)VADC_G3 }; +#else +static VADC_G_TypeDef *const g_xmc_vadc_group_array[XMC_VADC_MAXIMUM_NUM_GROUPS] = {(VADC_G_TypeDef* )(void *) VADC_G0, + (VADC_G_TypeDef* )(void *)VADC_G1 }; +#endif + +#endif + +/********************************************************************************************************************* + * LOCAL ROUTINES + ********************************************************************************************************************/ + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/*API to enable the VADC Module*/ +void XMC_VADC_GLOBAL_EnableModule(void) +{ + /* + * Enable Out of Range Comparator for ADC channels pins P2.2to P2.9. This hack is applicable only for XMC1xxx devices + * and in particular the G11 step. + * + * Please refer to the XMC1000 Errata sheet V1.4 released 2014-06 Errata ID : ADC_AI.003 Additonal bit to enable ADC + * function + */ + +#if defined (COMPARATOR) + COMPARATOR->ORCCTRL = (uint32_t)0xFF; +#endif + +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_VADC); +#endif + +#if defined(PERIPHERAL_RESET_SUPPORTED) + /* Reset the Hardware */ + XMC_SCU_RESET_DeassertPeripheralReset((XMC_SCU_PERIPHERAL_RESET_t)XMC_SCU_PERIPHERAL_RESET_VADC ); +#endif +} + +/*API to Disable the VADC Module*/ +void XMC_VADC_GLOBAL_DisableModule(void) +{ +#if defined(PERIPHERAL_RESET_SUPPORTED) + /* Reset the Hardware */ + XMC_SCU_RESET_AssertPeripheralReset((XMC_SCU_PERIPHERAL_RESET_t)XMC_SCU_PERIPHERAL_RESET_VADC ); +#endif + +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_VADC); +#endif + +} + + +/* API to initialize global resources */ +void XMC_VADC_GLOBAL_Init(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_GLOBAL_CONFIG_t *config) +{ +#if (XMC_VADC_GROUP_AVAILABLE == 0U) + uint32_t reg; +#endif + XMC_ASSERT("XMC_VADC_GLOBAL_Init:Wrong Module Pointer", (global_ptr == VADC)) + + /* Enable the VADC module*/ + XMC_VADC_GLOBAL_EnableModule(); + + global_ptr->CLC = (uint32_t)(config->clc); + + /* Clock configuration */ + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) + global_ptr->GLOBCFG = (uint32_t)(config->clock_config.globcfg | (uint32_t)(VADC_GLOBCFG_DIVWC_Msk)); +#endif + + /* ICLASS-0 configuration */ + global_ptr->GLOBICLASS[0] = (uint32_t)(config->class0.globiclass); + + /* ICLASS-1 configuration */ + global_ptr->GLOBICLASS[1] = (uint32_t)(config->class1.globiclass); + + + /*Result generation related configuration */ + global_ptr->GLOBRCR = (uint32_t)(config->globrcr); + +#if (XMC_VADC_BOUNDARY_AVAILABLE == 1U) + + /* Boundaries */ + global_ptr->GLOBBOUND = (uint32_t)(config->globbound); + +#endif + + /* Configure the SHS register that are needed for XMC11xx devices*/ +#if (XMC_VADC_GROUP_AVAILABLE == 0U) + + /* Enabling the Analog part of the converter*/ + reg = SHS0->SHSCFG | SHS_SHSCFG_SCWC_Msk; + reg &= ~(SHS_SHSCFG_ANOFF_Msk); + SHS0->SHSCFG = reg; + + /* From the Errata sheet of XMC1100 V1.7*/ + XMC_VADC_CONV_ENABLE_FOR_XMC11 = 1U; +#endif + +} + +/* API to Set the Global IClass registers*/ +void XMC_VADC_GLOBAL_InputClassInit(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_GLOBAL_CLASS_t config, + const XMC_VADC_GROUP_CONV_t conv_type, const uint32_t set_num) +{ + + XMC_ASSERT("XMC_VADC_GLOBAL_InputClassInit:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_InputClassInit:Wrong Conversion Type", ((conv_type) <= XMC_VADC_GROUP_CONV_EMUX)) + XMC_ASSERT("XMC_VADC_GLOBAL_InputClassInit:Wrong ICLASS set number", (set_num < XMC_VADC_MAX_ICLASS_SET)) + +#if(XMC_VADC_EMUX_AVAILABLE == 1U) + if (conv_type == XMC_VADC_GROUP_CONV_STD ) + { +#endif + global_ptr->GLOBICLASS[set_num] = config.globiclass & + (uint32_t)(VADC_GLOBICLASS_CMS_Msk | VADC_GLOBICLASS_STCS_Msk); +#if(XMC_VADC_EMUX_AVAILABLE == 1U) + } + else + { + global_ptr->GLOBICLASS[set_num] = config.globiclass & (uint32_t)(VADC_GLOBICLASS_CME_Msk | VADC_GLOBICLASS_STCE_Msk); + } +#endif +} + +/* API to enable startup calibration feature */ +void XMC_VADC_GLOBAL_StartupCalibration(XMC_VADC_GLOBAL_t *const global_ptr) +{ +#if (XMC_VADC_GROUP_AVAILABLE == 1U) + uint8_t i; + VADC_G_TypeDef *group_ptr; +#endif + + XMC_ASSERT("XMC_VADC_GLOBAL_StartupCalibration:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->GLOBCFG |= (uint32_t)VADC_GLOBCFG_SUCAL_Msk; + +#if (XMC_VADC_GROUP_AVAILABLE == 1U) + /* Loop until all active groups finish calibration */ + for(i=0U; iARBCFG) & (uint32_t)VADC_G_ARBCFG_ANONS_Msk) + { + /* This group is active. Loop until it finishes calibration */ + while((group_ptr->ARBCFG) & (uint32_t)VADC_G_ARBCFG_CAL_Msk) + { + /* NOP */ + } + } + } +#else + /* Loop until it finishes calibration */ + while ((((SHS0->SHSCFG) & (uint32_t)SHS_SHSCFG_STATE_Msk) >> (uint32_t)SHS_SHSCFG_STATE_Pos) == + XMC_VADC_SHS_START_UP_CAL_ACTIVE ) + { + /* NOP */ + } +#endif +} + +/* API to set boudaries for result of conversion. Should the boundaries be violated, interrupts are generated */ +#if (XMC_VADC_BOUNDARY_AVAILABLE == 1U) +void XMC_VADC_GLOBAL_SetBoundaries(XMC_VADC_GLOBAL_t *const global_ptr, + const uint32_t boundary0, + const uint32_t boundary1) +{ + uint32_t globbound; + + XMC_ASSERT("XMC_VADC_GLOBAL_SetBoundaries:Wrong Module Pointer", (global_ptr == VADC)) + + globbound = 0U; + globbound |= (uint32_t) (boundary0 << VADC_GLOBBOUND_BOUNDARY0_Pos); + globbound |= (uint32_t) (boundary1 << VADC_GLOBBOUND_BOUNDARY1_Pos); + + global_ptr->GLOBBOUND = globbound; +} + +/* API to set an individual boundary for conversion results */ +void XMC_VADC_GLOBAL_SetIndividualBoundary(XMC_VADC_GLOBAL_t *const global_ptr, + const XMC_VADC_CHANNEL_BOUNDARY_t selection, + const uint16_t boundary_value) +{ + + uint32_t globbound; + + XMC_ASSERT("XMC_VADC_GLOBAL_SetBoundaries:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_SetBoundaries:Wrong Boundary Selection", + ((XMC_VADC_CHANNEL_BOUNDARY_GLOBAL_BOUND0 == selection) || + (XMC_VADC_CHANNEL_BOUNDARY_GLOBAL_BOUND1 == selection))) + + /* Program the Boundary registers */ + globbound = global_ptr->GLOBBOUND; + + if (XMC_VADC_CHANNEL_BOUNDARY_GLOBAL_BOUND0 == selection) + { + globbound &= ~((uint32_t) VADC_GLOBBOUND_BOUNDARY0_Msk); + globbound |= (uint32_t) ((uint32_t) boundary_value << VADC_GLOBBOUND_BOUNDARY0_Pos); + } + else if (XMC_VADC_CHANNEL_BOUNDARY_GLOBAL_BOUND1 == selection) + { + globbound &= ~((uint32_t) VADC_GLOBBOUND_BOUNDARY1_Msk); + globbound |= (uint32_t) ((uint32_t) boundary_value << VADC_GLOBBOUND_BOUNDARY1_Pos); + } + else + { + /* For MISRA*/ + } + global_ptr->GLOBBOUND = globbound; + +} + +#endif + +/* API to set compare value for the result register. Result of conversion is compared against this compare value */ +void XMC_VADC_GLOBAL_SetCompareValue(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_RESULT_SIZE_t compare_val) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SetCompareValue:Wrong Module Pointer", (global_ptr == VADC)) + + global_ptr->GLOBRES &= ~((uint32_t)VADC_GLOBRES_RESULT_Msk); + global_ptr->GLOBRES |= (uint32_t)((uint32_t)compare_val << XMC_VADC_RESULT_LEFT_ALIGN_10BIT); +} + +/* API to retrieve the result of comparison */ +XMC_VADC_FAST_COMPARE_t XMC_VADC_GLOBAL_GetCompareResult(XMC_VADC_GLOBAL_t *const global_ptr) +{ + XMC_VADC_FAST_COMPARE_t result; + uint32_t res; + + XMC_ASSERT("XMC_VADC_GLOBAL_GetCompareResult:Wrong Module Pointer", (global_ptr == VADC)) + + res = global_ptr->GLOBRES; + + if (res & (uint32_t)VADC_GLOBRES_VF_Msk) + { + result = (XMC_VADC_FAST_COMPARE_t)((uint32_t)(res >> (uint32_t)VADC_GLOBRES_FCR_Pos) & (uint32_t)1); + } + else + { + result = XMC_VADC_FAST_COMPARE_UNKNOWN; + } + + return result; +} + +/* Bind one of the four groups to one of the two EMUX interfaces */ +#if (XMC_VADC_EMUX_AVAILABLE == 1U) +void XMC_VADC_GLOBAL_BindGroupToEMux(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t emuxif, const uint32_t group) +{ + uint32_t mask; + uint32_t pos; + + XMC_ASSERT("XMC_VADC_GLOBAL_BindGroupToEMux:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BindGroupToEMux:Wrong EMUX Group", (emuxif < XMC_VADC_NUM_EMUX_INTERFACES)) + XMC_ASSERT("XMC_VADC_GLOBAL_BindGroupToEMux:Wrong VADC Group", (group < XMC_VADC_MAXIMUM_NUM_GROUPS)) + + if (0U == emuxif) + { + pos = (uint32_t)VADC_EMUXSEL_EMUXGRP0_Pos; + mask = (uint32_t)VADC_EMUXSEL_EMUXGRP0_Msk; + } + else + { + pos = (uint32_t)VADC_EMUXSEL_EMUXGRP1_Pos; + mask = (uint32_t)VADC_EMUXSEL_EMUXGRP1_Msk; + } + + global_ptr->EMUXSEL &= ~(mask); + global_ptr->EMUXSEL |= (uint32_t) (group << pos); + +} +#endif + +/* API to bind result event with a service request line */ +void XMC_VADC_GLOBAL_SetResultEventInterruptNode(XMC_VADC_GLOBAL_t *const global_ptr, XMC_VADC_SR_t sr) +{ + uint32_t node; + + XMC_ASSERT("XMC_VADC_GLOBAL_SetResultEventInterruptNode:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_SetResultEventInterruptNode:Wrong SR Number", (sr <= XMC_VADC_SR_SHARED_SR3)) + + if (sr >= XMC_VADC_SR_SHARED_SR0) + { + node = (uint32_t)sr - (uint32_t)XMC_VADC_SR_SHARED_SR0; + } + else + { + node = (uint32_t)sr; + } + + global_ptr->GLOBEVNP &= ~((uint32_t)VADC_GLOBEVNP_REV0NP_Msk); + global_ptr->GLOBEVNP |= (uint32_t)(node << VADC_GLOBEVNP_REV0NP_Pos); +} + +/* API to bind request source event with a service request line */ +void XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode(XMC_VADC_GLOBAL_t *const global_ptr, XMC_VADC_SR_t sr) +{ + uint32_t node; + + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode:Wrong Module Pointer", (global_ptr == VADC)) + + if (sr >= XMC_VADC_SR_SHARED_SR0) + { + node = (uint32_t)sr - (uint32_t)XMC_VADC_SR_SHARED_SR0; + } + else + { + node = (uint32_t)sr; + } + + global_ptr->GLOBEVNP &= ~((uint32_t)VADC_GLOBEVNP_SEV0NP_Msk); + global_ptr->GLOBEVNP |= (uint32_t) (node << VADC_GLOBEVNP_SEV0NP_Pos); +} + +/* API to initialize an instance of group of VADC hardware */ +#if (XMC_VADC_GROUP_AVAILABLE == 1U) +void XMC_VADC_GROUP_Init( XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GROUP_CONFIG_t *config) +{ + XMC_ASSERT("XMC_VADC_GROUP_Init:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* Program the input classes */ + XMC_VADC_GROUP_InputClassInit(group_ptr, config->class0, XMC_VADC_GROUP_CONV_STD, 0U); + XMC_VADC_GROUP_InputClassInit(group_ptr, config->class0, XMC_VADC_GROUP_CONV_EMUX, 0U); + XMC_VADC_GROUP_InputClassInit(group_ptr, config->class1, XMC_VADC_GROUP_CONV_STD, 1U); + XMC_VADC_GROUP_InputClassInit(group_ptr, config->class1, XMC_VADC_GROUP_CONV_EMUX, 1U); + + group_ptr->ARBCFG = config->g_arbcfg; + + group_ptr->BOUND = config->g_bound; + + /* External mux configuration */ + XMC_VADC_GROUP_ExternalMuxControlInit(group_ptr,config->emux_config); + +} + +/* API to program conversion characteristics */ +void XMC_VADC_GROUP_InputClassInit(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GROUP_CLASS_t config, + const XMC_VADC_GROUP_CONV_t conv_type, const uint32_t set_num) +{ + uint32_t conv_class; + uint32_t conv_mode_pos; + uint32_t sample_time_pos; + uint32_t conv_mode_mask; + uint32_t sample_time_mask; + uint32_t sample_time; + XMC_VADC_CONVMODE_t conv_mode; + + XMC_ASSERT("XMC_VADC_GROUP_InputClassInit:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_InputClassInit:Wrong Conversion Type", ((conv_type) <= XMC_VADC_GROUP_CONV_EMUX)) + XMC_ASSERT("XMC_VADC_GROUP_InputClassInit:Wrong ICLASS set number", (set_num < XMC_VADC_MAX_ICLASS_SET)) + + /* + * Obtain the mask and position macros of the parameters based on what is being requested - Standard channels vs + * external mux channels. + */ + if (XMC_VADC_GROUP_CONV_STD == conv_type) + { + conv_mode_pos = (uint32_t) VADC_G_ICLASS_CMS_Pos; + conv_mode_mask = (uint32_t) VADC_G_ICLASS_CMS_Msk; + sample_time_pos = (uint32_t) VADC_G_ICLASS_STCS_Pos; + sample_time_mask = (uint32_t) VADC_G_ICLASS_STCS_Msk; + sample_time = (uint32_t) config.sample_time_std_conv; + conv_mode = (XMC_VADC_CONVMODE_t)config.conversion_mode_standard; + } + else + { + conv_mode_pos = (uint32_t) VADC_G_ICLASS_CME_Pos; + conv_mode_mask = (uint32_t) VADC_G_ICLASS_CME_Msk; + sample_time_pos = (uint32_t) VADC_G_ICLASS_STCE_Pos; + sample_time_mask = (uint32_t) VADC_G_ICLASS_STCE_Msk; + sample_time = (uint32_t) config.sampling_phase_emux_channel; + conv_mode = (XMC_VADC_CONVMODE_t)config.conversion_mode_emux; + } + + /* Determine the class */ + conv_class = group_ptr->ICLASS[set_num]; + + /* Program the class register */ + conv_class &= ~(conv_mode_mask); + conv_class |= (uint32_t)((uint32_t) conv_mode << conv_mode_pos); + conv_class &= ~(sample_time_mask); + conv_class |= (uint32_t)(sample_time << sample_time_pos); + group_ptr->ICLASS[set_num] = conv_class; +} + +/* API which sets the power mode of analog converter of a VADC group */ +void XMC_VADC_GROUP_SetPowerMode(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GROUP_POWERMODE_t power_mode) +{ + uint32_t arbcfg; + + XMC_ASSERT("XMC_VADC_GROUP_SetPowerMode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_SetPowerMode:Wrong Power Mode", (power_mode <= XMC_VADC_GROUP_POWERMODE_NORMAL)) + + arbcfg = group_ptr->ARBCFG; + + arbcfg &= ~((uint32_t)VADC_G_ARBCFG_ANONC_Msk); + arbcfg |= (uint32_t)power_mode; + + group_ptr->ARBCFG = arbcfg; +} + +/* API which programs a group as a slave group during sync conversions */ +void XMC_VADC_GROUP_SetSyncSlave(XMC_VADC_GROUP_t *const group_ptr, uint32_t master_grp, uint32_t slave_grp) +{ + uint32_t synctr; + #if (XMC_VADC_MULTIPLE_SLAVEGROUPS == 1U ) + #endif + XMC_ASSERT("XMC_VADC_GROUP_SetSyncSlave:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + #if (XMC_VADC_MULTIPLE_SLAVEGROUPS == 1U ) + + /* Determine the coding of SYNCTR */ + if (slave_grp > master_grp) + { + master_grp = master_grp + 1U; + } + #endif + + /* Program SYNCTR */ + synctr = group_ptr->SYNCTR; + synctr &= ~((uint32_t)VADC_G_SYNCTR_STSEL_Msk); + synctr |= master_grp; + group_ptr->SYNCTR = synctr; +} + +/* API which programs a group as a master group during sync conversions */ +void XMC_VADC_GROUP_SetSyncMaster(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t synctr; + + XMC_ASSERT("XMC_VADC_GROUP_SetSyncMaster:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + synctr = group_ptr->SYNCTR; + synctr &= ~((uint32_t)VADC_G_SYNCTR_STSEL_Msk); + group_ptr->SYNCTR = synctr; +} + +/* API to enable checking of readiness of slaves before a synchronous conversion request is issued */ +void XMC_VADC_GROUP_CheckSlaveReadiness(XMC_VADC_GROUP_t *const group_ptr, uint32_t slave_group) +{ + uint32_t i,master_grp_num; + XMC_ASSERT("XMC_VADC_GROUP_CheckSlaveReadiness:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_CheckSlaveReadiness:Wrong Slave group", ((slave_group >= 0) && (slave_group <= (XMC_VADC_MAXIMUM_NUM_GROUPS - 1)))) + + master_grp_num =0; + for(i=0; iSYNCTR |= (1U << (slave_group + XMC_VADC_SYNCTR_START_LOCATION)); +} + +/* API to disable checking of readiness of slaves during synchronous conversions */ +void XMC_VADC_GROUP_IgnoreSlaveReadiness(XMC_VADC_GROUP_t *const group_ptr, uint32_t slave_group) +{ + uint32_t i,master_grp_num; + XMC_ASSERT("XMC_VADC_GROUP_IgnoreSlaveReadiness:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_IgnoreSlaveReadiness:Wrong Slave group", ((slave_group >= 0) && (slave_group <= (XMC_VADC_MAXIMUM_NUM_GROUPS - 1)))) + + master_grp_num =0; + for(i=0; iSYNCTR &= ~(1U << (slave_group + XMC_VADC_SYNCTR_START_LOCATION)); +} + +/* API to configure EVAL bit in the slave groups*/ +void XMC_VADC_GROUP_SetSyncSlaveReadySignal(XMC_VADC_GROUP_t *const group_ptr, + uint32_t eval_waiting_group, + uint32_t eval_origin_group) +{ + XMC_ASSERT("XMC_VADC_GROUP_SetSyncSlaveReadySignal:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_SetSyncSlaveReadySignal:Wrong Group numbers", (eval_waiting_group == eval_origin_group )) + + if(eval_origin_group < eval_waiting_group) + { + eval_origin_group++; + } + group_ptr->SYNCTR |= (1U << (eval_origin_group + XMC_VADC_SYNCTR_START_LOCATION)); +} + + +/* API to enable the synchronous conversion feature - Applicable only to kernel configured as master */ +void XMC_VADC_GROUP_EnableChannelSyncRequest(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + uint32_t synctr; + + XMC_ASSERT("XMC_VADC_GROUP_EnableChannelSyncRequest:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_EnableChannelSyncRequest:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + synctr = group_ptr->SYNCTR; + + if (!(synctr & (uint32_t)VADC_G_SYNCTR_STSEL_Msk)) + { + group_ptr->CHCTR[ch_num] |= (uint32_t)((uint32_t)1 << VADC_G_CHCTR_SYNC_Pos); + } +} + +/* API to disable synchronous conversion feature */ +void XMC_VADC_GROUP_DisableChannelSyncRequest(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + uint32_t synctr; + + XMC_ASSERT("XMC_VADC_GROUP_DisableChannelSyncRequest:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_DisableChannelSyncRequest:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + synctr = group_ptr->SYNCTR; + + if (synctr & (uint32_t)VADC_G_SYNCTR_STSEL_Msk) + { + group_ptr->CHCTR[ch_num] &= ~((uint32_t)VADC_G_CHCTR_SYNC_Msk); + } +} + +/* API to retrieve the converter state - Idle vs Busy */ +XMC_VADC_GROUP_STATE_t XMC_VADC_GROUP_IsConverterBusy(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t arbcfg; + + XMC_ASSERT("XMC_VADC_GROUP_IsConverterBusy:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + arbcfg = group_ptr->ARBCFG; + arbcfg &= (uint32_t)VADC_G_ARBCFG_BUSY_Msk; + arbcfg = arbcfg >> VADC_G_ARBCFG_BUSY_Pos; + + return( (XMC_VADC_GROUP_STATE_t)arbcfg); +} + +/* API to set boundaries for conversion results */ +void XMC_VADC_GROUP_SetBoundaries(XMC_VADC_GROUP_t *const group_ptr, const uint32_t boundary0, const uint32_t boundary1) +{ + uint32_t bound; + + XMC_ASSERT("XMC_VADC_GROUP_SetBoundaries:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* Program the Boundary registers */ + bound = group_ptr->BOUND; + bound &= ~((uint32_t) VADC_G_BOUND_BOUNDARY0_Msk); + bound &= ~((uint32_t) VADC_G_BOUND_BOUNDARY1_Msk); + bound |= (uint32_t) ((uint32_t) boundary0 << VADC_G_BOUND_BOUNDARY0_Pos); + bound |= (uint32_t) ((uint32_t) boundary1 << VADC_G_BOUND_BOUNDARY1_Pos); + group_ptr->BOUND = bound; +} + +/* API to set an individual boundary for conversion results */ +void XMC_VADC_GROUP_SetIndividualBoundary(XMC_VADC_GROUP_t *const group_ptr, + const XMC_VADC_CHANNEL_BOUNDARY_t selection, + const uint16_t boundary_value) +{ + + uint32_t bound; + + XMC_ASSERT("XMC_VADC_GROUP_SetIndividualBoundary:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_SetIndividualBoundary:Wrong Boundary Selection", + ((XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND0 == selection) || + (XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND1 == selection))) + + /* Program the Boundary registers */ + bound = group_ptr->BOUND; + if (XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND0 == selection) + { + bound &= ~((uint32_t) VADC_G_BOUND_BOUNDARY0_Msk); + bound |= (uint32_t) ((uint32_t) boundary_value << VADC_G_BOUND_BOUNDARY0_Pos); + } + else if (XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND1 == selection) + { + bound &= ~((uint32_t) VADC_G_BOUND_BOUNDARY1_Msk); + bound |= (uint32_t) ((uint32_t) boundary_value << VADC_G_BOUND_BOUNDARY1_Pos); + } + else + { + /* For MISRA*/ + } + group_ptr->BOUND = bound; + +} + +/* Manually assert service request (Interrupt) to NVIC */ +void XMC_VADC_GROUP_TriggerServiceRequest(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t sr_num, + const XMC_VADC_GROUP_IRQ_t type) +{ + uint32_t sract; + + XMC_ASSERT("XMC_VADC_GROUP_TriggerServiceRequest:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_TriggerServiceRequest:Wrong SR number", (sr_num <= XMC_VADC_SR_SHARED_SR3)) + XMC_ASSERT("XMC_VADC_GROUP_TriggerServiceRequest:Wrong SR type", ((type)<= XMC_VADC_GROUP_IRQ_SHARED)) + + sract = group_ptr->SRACT; + + if (XMC_VADC_GROUP_IRQ_KERNEL == type) + { + sract |= (uint32_t)((uint32_t)1 << sr_num); + } + else + { + sract |= (uint32_t)((uint32_t)1 << (sr_num + (uint32_t)8)); + } + + group_ptr->SRACT = sract; +} + +#if XMC_VADC_BOUNDARY_FLAG_SELECT == 1U + +/* API to set the SR line for the Boundary flag node pointer*/ +void XMC_VADC_GROUP_SetBoundaryEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, + const uint8_t boundary_flag_num, + const XMC_VADC_BOUNDARY_NODE_t sr) +{ + uint32_t flag_pos; + XMC_ASSERT("XMC_VADC_GROUP_SetBoundaryEventInterruptNode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* Program the GxBFLNP */ + flag_pos = (uint32_t)boundary_flag_num << (uint32_t)2; + group_ptr->BFLNP &= ~((uint32_t)VADC_G_BFLNP_BFL0NP_Msk << flag_pos); + group_ptr->BFLNP |= (uint32_t)sr << flag_pos; +} + +#endif + +#endif + +#if(XMC_VADC_SHS_AVAILABLE == 1U) + +/* API to Initialize the Sample and hold features*/ +void XMC_VADC_GLOBAL_SHS_Init(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, const XMC_VADC_GLOBAL_SHS_CONFIG_t *config) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_Init:Wrong SHS Pointer", (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_Init:Wrong Index number",(config == (XMC_VADC_GLOBAL_SHS_CONFIG_t*)NULL)) + + /* Initialize the SHS Configuration register*/ + shs_ptr->SHSCFG = (uint32_t)((uint32_t)config->shscfg | (uint32_t)SHS_SHSCFG_SCWC_Msk); + +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) + /* Select the Calibration order*/ + shs_ptr->CALCTR &= ~((uint32_t)SHS_CALCTR_CALORD_Msk); + shs_ptr->CALCTR |= (uint32_t) ((uint32_t)config->calibration_order << SHS_CALCTR_CALORD_Pos); +#endif +} + +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) +/* API to enable the accelerated mode of conversion */ +void XMC_VADC_GLOBAL_SHS_EnableAcceleratedMode(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, XMC_VADC_GROUP_INDEX_t group_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_EnableAcceleratedMode:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_EnableAcceleratedMode:Wrong Index number",(group_num <= XMC_VADC_GROUP_INDEX_1)) + + /* Set the converted to Accelerated mode from compatible mode*/ + if (group_num == XMC_VADC_GROUP_INDEX_0 ) + { + shs_ptr->TIMCFG0 |= (uint32_t)SHS_TIMCFG0_AT_Msk; + } + else if (group_num == XMC_VADC_GROUP_INDEX_1 ) + { + shs_ptr->TIMCFG1 |= (uint32_t)SHS_TIMCFG1_AT_Msk; + } + else + { + /* for MISRA*/ + } +} + +/* API to disable the accelerated mode of conversion */ +void XMC_VADC_GLOBAL_SHS_DisableAcceleratedMode(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, XMC_VADC_GROUP_INDEX_t group_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_DisableAcceleratedMode:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_DisableAcceleratedMode:Wrong Index number",(group_num <= XMC_VADC_GROUP_INDEX_1)) + + /* Set the converted to Accelerated mode from compatible mode*/ + if (group_num == XMC_VADC_GROUP_INDEX_0 ) + { + shs_ptr->TIMCFG0 &= ~(uint32_t)SHS_TIMCFG0_AT_Msk; + } + else if (group_num == XMC_VADC_GROUP_INDEX_1 ) + { + shs_ptr->TIMCFG1 &= ~(uint32_t)SHS_TIMCFG1_AT_Msk; + } + else + { + /* for MISRA*/ + } +} + +/* API to set the Short sample time of the Sample and hold module*/ +void XMC_VADC_GLOBAL_SHS_SetShortSampleTime(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + uint8_t sst_value) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetShortSampleTime:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetShortSampleTime:Wrong Index number",(group_num <= XMC_VADC_GROUP_INDEX_1)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetShortSampleTime:Wrong SST value",(sst_value < 64U)) + + /* Set the short sample time for the Accelerated mode of operation*/ + if (group_num == XMC_VADC_GROUP_INDEX_0 ) + { + shs_ptr->TIMCFG0 &= ~((uint32_t)SHS_TIMCFG0_SST_Msk); + shs_ptr->TIMCFG0 |= (uint32_t)((uint32_t)sst_value << SHS_TIMCFG0_SST_Pos ); + } + else if (group_num == XMC_VADC_GROUP_INDEX_1 ) + { + shs_ptr->TIMCFG1 &= ~((uint32_t)SHS_TIMCFG1_SST_Msk); + shs_ptr->TIMCFG1 |= (uint32_t)((uint32_t)sst_value << SHS_TIMCFG1_SST_Pos ); + } + else + { + /* for MISRA*/ + } +} +#endif + +/* API to set the gain factor of the Sample and hold module*/ +void XMC_VADC_GLOBAL_SHS_SetGainFactor(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + uint8_t gain_value, + XMC_VADC_GROUP_INDEX_t group_num, + uint8_t ch_num) +{ + uint32_t ch_mask; + + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetGainFactor:Wrong SHS Pointer", (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetGainFactor:Wrong Index number",(group_num <= XMC_VADC_GROUP_INDEX_1)) + + /*Calculate location of channel bit-field*/ + ch_mask = ((uint32_t)ch_num << (uint32_t)2); + if (group_num == XMC_VADC_GROUP_INDEX_0 ) + { + shs_ptr->GNCTR00 &= ~((uint32_t)SHS_GNCTR00_GAIN0_Msk << ch_mask) ; + shs_ptr->GNCTR00 |= ((uint32_t)gain_value << ch_mask); + } + else if (group_num == XMC_VADC_GROUP_INDEX_1 ) + { + shs_ptr->GNCTR10 &= ~((uint32_t)SHS_GNCTR10_GAIN0_Msk << ch_mask); + shs_ptr->GNCTR10 |= ((uint32_t)gain_value << ch_mask); + } + else + { + /* for MISRA*/ + } +} + +#if(XMC_VADC_SHS_FULL_SET_REG == 1U) +/* API to enable the gain and offset calibration of the Sample and hold module*/ +void XMC_VADC_GLOBAL_SHS_EnableGainAndOffsetCalibrations(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_EnableGainAndOffsetCalibrations:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_EnableGainAndOffsetCalibrations:Wrong group selected", + (group_num <= (uint32_t)XMC_VADC_GROUP_INDEX_1)) + + /* Enable gain and offset calibration*/ + if ( XMC_VADC_GROUP_INDEX_0 == group_num) + { + shs_ptr->CALOC0 &= ~((uint32_t)SHS_CALOC0_DISCAL_Msk); + } + else if ( XMC_VADC_GROUP_INDEX_1 == group_num) + { + shs_ptr->CALOC1 &= ~((uint32_t)SHS_CALOC1_DISCAL_Msk); + } + else + { + /* for MISRA */ + } +} + +/* API to enable the gain and offset calibration of the Sample and hold module*/ +void XMC_VADC_GLOBAL_SHS_DisableGainAndOffsetCalibrations(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_DisableGainAndOffsetCalibrations:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_DisableGainAndOffsetCalibrations:Wrong group selected", + (group_num <= (uint32_t)XMC_VADC_GROUP_INDEX_1)) + + if ( XMC_VADC_GROUP_INDEX_0 == group_num) + { + shs_ptr->CALOC0 |= (uint32_t)SHS_CALOC0_DISCAL_Msk; + } + else if ( XMC_VADC_GROUP_INDEX_1 == group_num) + { + shs_ptr->CALOC1 |= (uint32_t)SHS_CALOC1_DISCAL_Msk; + } + else + { + /* for MISRA */ + } +} + +/* API to get the offset calibration value of the Sample and hold module*/ +uint8_t XMC_VADC_GLOBAL_SHS_GetOffsetCalibrationValue(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + XMC_VADC_SHS_GAIN_LEVEL_t gain_level) +{ + uint32_t calibration_value; + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_GetOffsetCalibrationValue:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_GetOffsetCalibrationValue:Wrong Group number selected", + (group_num == XMC_VADC_GROUP_INDEX_0)||(group_num == XMC_VADC_GROUP_INDEX_1)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_GetOffsetCalibrationValue:Wrong gain level selected", + (gain_level == XMC_VADC_SHS_GAIN_LEVEL_0)||(gain_level == XMC_VADC_SHS_GAIN_LEVEL_1)|| + (gain_level == XMC_VADC_SHS_GAIN_LEVEL_2)||(gain_level == XMC_VADC_SHS_GAIN_LEVEL_3)) + + calibration_value = 0U; + if ( XMC_VADC_GROUP_INDEX_0 == group_num) + { + calibration_value = (shs_ptr->CALOC0 >> (uint32_t)gain_level) & (uint32_t)SHS_CALOC0_CALOFFVAL0_Msk; + } + else if ( XMC_VADC_GROUP_INDEX_1 == group_num) + { + calibration_value = (shs_ptr->CALOC1 >> (uint32_t)gain_level) & (uint32_t)SHS_CALOC1_CALOFFVAL0_Msk; + } + else + { + /* for MISRA */ + } + return ((uint8_t)calibration_value); +} + +/* API to set the offset calibration value of the Sample and hold module*/ +void XMC_VADC_GLOBAL_SHS_SetOffsetCalibrationValue(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + XMC_VADC_SHS_GAIN_LEVEL_t gain_level, + uint8_t offset_calibration_value) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetOffsetCalibrationValue:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetOffsetCalibrationValue:Wrong Group number selected", + (group_num == XMC_VADC_GROUP_INDEX_0)||(group_num == XMC_VADC_GROUP_INDEX_1)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetOffsetCalibrationValue:Wrong gain level selected", + (gain_level == XMC_VADC_SHS_GAIN_LEVEL_0)||(gain_level == XMC_VADC_SHS_GAIN_LEVEL_1)|| + (gain_level == XMC_VADC_SHS_GAIN_LEVEL_2)||(gain_level == XMC_VADC_SHS_GAIN_LEVEL_3)) + + if ( XMC_VADC_GROUP_INDEX_0 == group_num) + { + shs_ptr->CALOC0 = (shs_ptr->CALOC0 & ~((uint32_t)SHS_CALOC0_CALOFFVAL0_Msk << (uint32_t)gain_level)) | + (uint32_t)SHS_CALOC0_OFFWC_Msk; + shs_ptr->CALOC0 |= ((uint32_t)offset_calibration_value << (uint32_t)gain_level) | (uint32_t)SHS_CALOC0_OFFWC_Msk; + } + else if ( XMC_VADC_GROUP_INDEX_1 == group_num) + { + shs_ptr->CALOC1 = (shs_ptr->CALOC1 & ~((uint32_t)SHS_CALOC1_CALOFFVAL0_Msk << (uint32_t)gain_level)) | + (uint32_t)SHS_CALOC1_OFFWC_Msk; + shs_ptr->CALOC1 |= ((uint32_t)offset_calibration_value << (uint32_t)gain_level) | (uint32_t)SHS_CALOC1_OFFWC_Msk; + } + else + { + /* for MISRA */ + } +} +#endif + +/* API to set the values of sigma delta loop of the Sample and hold module*/ +void XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop(XMC_VADC_GLOBAL_SHS_t *const shs_ptr, + XMC_VADC_GROUP_INDEX_t group_num, + XMC_VADC_SHS_LOOP_CH_t loop_select, + uint8_t ch_num) +{ + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop:Wrong SHS Pointer", + (shs_ptr == (XMC_VADC_GLOBAL_SHS_t*)(void*)SHS0)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop:Wrong Group number selected", + (group_num == XMC_VADC_GROUP_INDEX_0)||(group_num == XMC_VADC_GROUP_INDEX_1)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop:Wrong Delta sigma loop selected", + (loop_select == XMC_VADC_SHS_LOOP_CH_0)||(loop_select == XMC_VADC_SHS_LOOP_CH_1)) + XMC_ASSERT("XMC_VADC_GLOBAL_SHS_SetSigmaDeltaLoop:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + shs_ptr->LOOP &= ~(((uint32_t)SHS_LOOP_LPCH0_Msk | (uint32_t)SHS_LOOP_LPSH0_Msk | (uint32_t)SHS_LOOP_LPEN0_Msk) + << (uint32_t)loop_select); + shs_ptr->LOOP |= ((uint32_t)ch_num | ((uint32_t)group_num << (uint32_t)SHS_LOOP_LPSH0_Pos)) << (uint32_t)loop_select; + +} + +#endif + +#if (XMC_VADC_GSCAN_AVAILABLE == 1U) +/* API to initialize the group scan hardware of a kernel */ +void XMC_VADC_GROUP_ScanInit(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_SCAN_CONFIG_t *config) +{ + uint32_t reg; + + XMC_ASSERT("XMC_VADC_GROUP_ScanInit:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* All configurations have to be performed with the arbitration slot disabled */ + XMC_VADC_GROUP_ScanDisableArbitrationSlot(group_ptr); + + /* Read in the existing contents of arbitration priority register */ + reg = group_ptr->ARBPR; + + /* Program the priority of the request source */ + reg &= ~(uint32_t)VADC_G_ARBPR_PRIO1_Msk; + reg |= (uint32_t)((uint32_t)config->req_src_priority << VADC_G_ARBPR_PRIO1_Pos); + + /* Program the start mode */ + if (XMC_VADC_STARTMODE_WFS != (XMC_VADC_STARTMODE_t)(config->conv_start_mode)) + { + reg |= (uint32_t)(VADC_G_ARBPR_CSM1_Msk); + } + + group_ptr->ARBPR = reg; + + group_ptr->ASCTRL = (uint32_t)(config->asctrl |(VADC_G_ASCTRL_XTWC_Msk) |(VADC_G_ASCTRL_GTWC_Msk) | + (VADC_G_ASCTRL_TMWC_Msk)); + + group_ptr->ASMR = (uint32_t)((config->asmr)| (uint32_t)((uint32_t)XMC_VADC_GATEMODE_IGNORE << VADC_G_ASMR_ENGT_Pos)); + + if (XMC_VADC_STARTMODE_CNR == (XMC_VADC_STARTMODE_t)(config->conv_start_mode)) + { + group_ptr->ASMR |= (uint32_t)VADC_G_ASMR_RPTDIS_Msk; + } + + /* Enable arbitration slot now */ + XMC_VADC_GROUP_ScanEnableArbitrationSlot(group_ptr); + +} + +/* API to select one of the 16 inputs as a trigger input for Group Scan request source */ +void XMC_VADC_GROUP_ScanSelectTrigger(XMC_VADC_GROUP_t *const group_ptr, XMC_VADC_TRIGGER_INPUT_SELECT_t trigger_input) +{ + uint32_t scanctrl; + + XMC_ASSERT("XMC_VADC_GROUP_ScanSelectTrigger:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanSelectTrigger:Wrong Trigger Port", ((trigger_input)< XMC_VADC_NUM_PORTS)) + + scanctrl = group_ptr->ASCTRL; + scanctrl |= (uint32_t) VADC_G_ASCTRL_XTWC_Msk; + scanctrl &= ~((uint32_t)VADC_G_ASCTRL_XTSEL_Msk); + scanctrl |= (uint32_t)((uint32_t)trigger_input << VADC_G_ASCTRL_XTSEL_Pos); + group_ptr->ASCTRL = scanctrl; +} + +/* Select a trigger edge*/ +void XMC_VADC_GROUP_ScanSelectTriggerEdge(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_TRIGGER_EDGE_t trigger_edge) +{ + uint32_t scanctrl; + + XMC_ASSERT("XMC_VADC_GROUP_ScanSelectTriggerEdge:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanSelectTriggerEdge:Wrong Trigger Port", ((trigger_edge)<= XMC_VADC_TRIGGER_EDGE_ANY)) + + scanctrl = group_ptr->ASCTRL; + scanctrl |= (uint32_t) VADC_G_ASCTRL_XTWC_Msk; + scanctrl &= ~((uint32_t)VADC_G_ASCTRL_XTMODE_Msk); + scanctrl |= (uint32_t)((uint32_t)trigger_edge << VADC_G_ASCTRL_XTMODE_Pos); + group_ptr->ASCTRL = scanctrl; +} + +/* API to select one of the 16 inputs as a trigger gating input for Group Scan request source */ +void XMC_VADC_GROUP_ScanSelectGating(XMC_VADC_GROUP_t *const group_ptr, XMC_VADC_GATE_INPUT_SELECT_t gating_input) +{ + uint32_t scanctrl; + + XMC_ASSERT("XMC_VADC_GROUP_ScanSelectGating:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanSelectGating:Wrong Gating Port", ((gating_input)< XMC_VADC_NUM_PORTS)) + + scanctrl = group_ptr->ASCTRL; + scanctrl |= (uint32_t)VADC_G_ASCTRL_GTWC_Msk; + scanctrl &= ~((uint32_t)VADC_G_ASCTRL_GTSEL_Msk); + scanctrl |= (uint32_t)((uint32_t)gating_input << VADC_G_ASCTRL_GTSEL_Pos); + group_ptr->ASCTRL = scanctrl; +} + +/* API to stop an ongoing conversion of a sequence */ +void XMC_VADC_GROUP_ScanSequenceAbort(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t asctrl; + bool arbitration_status; + + XMC_ASSERT("XMC_VADC_GROUP_ScanSequenceAbort:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* To disable trigger and gating before abort*/ + asctrl = group_ptr->ASCTRL; + + group_ptr->ASCTRL =(0U | (uint32_t)VADC_G_ASCTRL_XTWC_Msk | + (uint32_t)VADC_G_ASCTRL_GTWC_Msk | (uint32_t)VADC_G_ASCTRL_TMWC_Msk ); + + /* To disable Arbitration before abort*/ + arbitration_status = (bool)((uint32_t)(group_ptr->ARBPR >> VADC_G_ARBPR_ASEN1_Pos) & 1U); + XMC_VADC_GROUP_ScanDisableArbitrationSlot(group_ptr); + + group_ptr->ASMR &= ~((uint32_t)VADC_G_ASMR_ENGT_Msk); + group_ptr->ASMR |= (uint32_t)VADC_G_ASMR_CLRPND_Msk; + + /* Enable the arbitration slot 1*/ + group_ptr->ARBPR |= (uint32_t)((uint32_t)arbitration_status << VADC_G_ARBPR_ASEN1_Pos); + + /* Enable any disabled gating*/ + group_ptr->ASCTRL =(asctrl | (uint32_t)VADC_G_ASCTRL_XTWC_Msk | + (uint32_t)VADC_G_ASCTRL_GTWC_Msk | (uint32_t)VADC_G_ASCTRL_TMWC_Msk ); +} + +/* API to find out number of channels awaiting conversion */ +uint32_t XMC_VADC_GROUP_ScanGetNumChannelsPending(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t reg; + uint32_t i; + uint32_t count; + + XMC_ASSERT("XMC_VADC_GROUP_ScanGetNumChannelsPending:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + + count = 0U; + + if (group_ptr->ASPND) + { + reg = group_ptr->ASPND; + + for(i=0U;i> (uint32_t)1); + } + } + + return count; +} + +/* API to select a service request line (NVIC Node) for request source event */ +void XMC_VADC_GROUP_ScanSetReqSrcEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_SR_t sr) +{ + uint32_t sevnp; + sevnp = group_ptr->SEVNP; + + XMC_ASSERT("XMC_VADC_GROUP_ScanSetReqSrcEventInterruptNode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanSetReqSrcEventInterruptNode:Wrong Service Request", ((sr) <= XMC_VADC_SR_SHARED_SR3)) + + sevnp &= ~((uint32_t)VADC_G_SEVNP_SEV1NP_Msk); + sevnp |= (uint32_t)((uint32_t)sr << VADC_G_SEVNP_SEV1NP_Pos); + + group_ptr->SEVNP = sevnp; +} + +/* Removes the selected channel from conversion*/ +void XMC_VADC_GROUP_ScanRemoveChannel(XMC_VADC_GROUP_t *const group_ptr, const uint32_t channel_num) +{ + uint32_t assel; + + XMC_ASSERT("XMC_VADC_GROUP_ScanRemoveChannel:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ScanRemoveChannel:Wrong channel number", ((channel_num)< XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + assel = group_ptr->ASSEL; + assel &= (~( 1 << channel_num)); + group_ptr->ASSEL = assel; +} +#endif + +/* API to initialize background scan request source hardware */ +void XMC_VADC_GLOBAL_BackgroundInit(XMC_VADC_GLOBAL_t *const global_ptr, const XMC_VADC_BACKGROUND_CONFIG_t *config) +{ + #if (XMC_VADC_GROUP_AVAILABLE ==1U) + uint8_t i; + uint32_t reg; + uint32_t conv_start_mask; + #endif + + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundInit:Wrong Module Pointer", (global_ptr == VADC)) + + #if (XMC_VADC_GROUP_AVAILABLE ==1U) + for(i=(uint8_t)0; i < XMC_VADC_MAXIMUM_NUM_GROUPS; i++) + { + XMC_VADC_GROUP_BackgroundDisableArbitrationSlot((XMC_VADC_GROUP_t *)g_xmc_vadc_group_array[i]); + } + + conv_start_mask = (uint32_t) 0; + if (XMC_VADC_STARTMODE_WFS != (XMC_VADC_STARTMODE_t)config->conv_start_mode) + { + conv_start_mask = (uint32_t)VADC_G_ARBPR_CSM2_Msk; + } + + for(i=0U; i < XMC_VADC_MAXIMUM_NUM_GROUPS; i++) + { + reg = g_xmc_vadc_group_array[i]->ARBPR; + + reg &= ~(uint32_t)(VADC_G_ARBPR_PRIO2_Msk); + + /* Program the priority of the request source */ + reg |= (uint32_t)((uint32_t)config->req_src_priority << VADC_G_ARBPR_PRIO2_Pos); + + /* Program the start mode */ + reg |= conv_start_mask; + + g_xmc_vadc_group_array[i]->ARBPR = reg; + + } + #endif + + /* program BRSCTRL register */ + global_ptr->BRSCTRL = (uint32_t)(config->asctrl | (uint32_t)VADC_BRSCTRL_XTWC_Msk | (uint32_t)VADC_BRSCTRL_GTWC_Msk); + + /* program BRSMR register */ + global_ptr->BRSMR = (uint32_t)((config->asmr)| (uint32_t)((uint32_t)XMC_VADC_GATEMODE_IGNORE << VADC_BRSMR_ENGT_Pos)); + +#if (XMC_VADC_GROUP_AVAILABLE ==1U) + if (XMC_VADC_STARTMODE_CNR == (XMC_VADC_STARTMODE_t)(config->conv_start_mode)) + { + global_ptr->BRSMR |= (uint32_t)VADC_BRSMR_RPTDIS_Msk; + } +#endif + + #if (XMC_VADC_GROUP_AVAILABLE ==1U) + for(i=(uint8_t)0; i < XMC_VADC_MAXIMUM_NUM_GROUPS; i++) + { + XMC_VADC_GROUP_BackgroundEnableArbitrationSlot((XMC_VADC_GROUP_t *)g_xmc_vadc_group_array[i]); + } + #endif + +} + +/* API to select one of the 16 inputs as a trigger for background scan request source */ +void XMC_VADC_GLOBAL_BackgroundSelectTrigger(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t input_num) +{ + uint32_t scanctrl; + + XMC_ASSERT("VADC_BCKGND_SelectTriggerInput:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSelectTrigger:Wrong Trigger Port", ((input_num)< XMC_VADC_NUM_PORTS)) + + + scanctrl = global_ptr->BRSCTRL; + scanctrl |= (uint32_t)VADC_BRSCTRL_XTWC_Msk; + scanctrl &= ~((uint32_t)VADC_BRSCTRL_XTSEL_Msk); + scanctrl |= (uint32_t)(input_num << VADC_BRSCTRL_XTSEL_Pos); + global_ptr->BRSCTRL = scanctrl; +} + +/* Select a trigger edge*/ +void XMC_VADC_GLOBAL_BackgroundSelectTriggerEdge(XMC_VADC_GLOBAL_t *const global_ptr, + const XMC_VADC_TRIGGER_EDGE_t trigger_edge) +{ + uint32_t scanctrl; + + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSelectTriggerEdge:Wrong Global Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSelectTriggerEdge:Wrong Trigger Port", + ((trigger_edge)<= XMC_VADC_TRIGGER_EDGE_ANY)) + + scanctrl = global_ptr->BRSCTRL; + scanctrl |= (uint32_t) VADC_BRSCTRL_XTWC_Msk; + scanctrl &= ~((uint32_t)VADC_BRSCTRL_XTMODE_Msk); + scanctrl |= (uint32_t)((uint32_t)trigger_edge << VADC_BRSCTRL_XTMODE_Pos); + global_ptr->BRSCTRL = scanctrl; +} + + +/* API to select one of the 16 inputs as a trigger gate for background scan request source */ +void XMC_VADC_GLOBAL_BackgroundSelectGating(XMC_VADC_GLOBAL_t *const global_ptr, const uint32_t input_num) +{ + uint32_t scanctrl; + + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSelectGating:Wrong Module Pointer", (global_ptr == VADC)) + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundSelectGating:Wrong Gating Port", ((input_num)< XMC_VADC_NUM_PORTS)) + + scanctrl = global_ptr->BRSCTRL; + scanctrl |= (uint32_t)VADC_BRSCTRL_GTWC_Msk; + scanctrl &= ~((uint32_t)VADC_BRSCTRL_GTSEL_Msk); + scanctrl |= (uint32_t)(input_num << VADC_BRSCTRL_GTSEL_Pos); + global_ptr->BRSCTRL = scanctrl; +} + +/* API to abort ongoing conversion of a sequence */ +void XMC_VADC_GLOBAL_BackgroundAbortSequence(XMC_VADC_GLOBAL_t *const global_ptr) +{ + uint32_t brsctrl; +#if (XMC_VADC_GROUP_AVAILABLE ==1U) + uint32_t i; + uint8_t grp_asen2_flag[XMC_VADC_MAXIMUM_NUM_GROUPS]; +#endif + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundAbortSequence:Wrong Module Pointer", (global_ptr == VADC)) + + /* To disable trigger and gating before abort*/ + brsctrl = global_ptr->BRSCTRL; + + global_ptr->BRSCTRL =(0U | (uint32_t)VADC_BRSCTRL_XTWC_Msk | (uint32_t)VADC_BRSCTRL_GTWC_Msk); + + /* Disable Background Request source */ + +#if (XMC_VADC_GROUP_AVAILABLE ==1U) + for(i=(uint8_t)0; i < XMC_VADC_MAXIMUM_NUM_GROUPS; i++) + { + grp_asen2_flag[i] = (uint8_t)(g_xmc_vadc_group_array[i]->ARBPR >> VADC_G_ARBPR_ASEN2_Pos); + XMC_VADC_GROUP_BackgroundDisableArbitrationSlot((XMC_VADC_GROUP_t *)g_xmc_vadc_group_array[i]); + } +#endif + + /* Abort the ongoing sequence */ + global_ptr->BRSMR |= (uint32_t)VADC_BRSMR_CLRPND_Msk; + +#if (XMC_VADC_GROUP_AVAILABLE ==1U) + /* Enable Background Request source */ + for(i=(uint8_t)0; i < XMC_VADC_MAXIMUM_NUM_GROUPS; i++) + { + if ((uint8_t)1 == grp_asen2_flag[i]) + { + XMC_VADC_GROUP_BackgroundEnableArbitrationSlot((XMC_VADC_GROUP_t*)g_xmc_vadc_group_array[i]); + } + } +#endif + + /* Re-enable any disabled trigger and gating*/ + global_ptr->BRSCTRL =(brsctrl | (uint32_t)VADC_BRSCTRL_XTWC_Msk | (uint32_t)VADC_BRSCTRL_GTWC_Msk); +} + +/* API to determine how many channels are awaiting conversion */ +uint32_t XMC_VADC_GLOBAL_BackgroundGetNumChannelsPending(XMC_VADC_GLOBAL_t *const global_ptr) +{ + uint32_t reg; + uint32_t i; + uint32_t j; + uint32_t count; + + XMC_ASSERT("XMC_VADC_GLOBAL_BackgroundGetNumChannelsPending:Wrong Module Pointer", (global_ptr == VADC)) + + count = 0U; + + /* Loop through all groups and find out who is awaiting conversion */ + for(i = 0U; i < XMC_VADC_MAXIMUM_NUM_GROUPS; i++) + { + if (global_ptr->BRSSEL[i]) + { + reg = global_ptr->BRSPND[i]; + + for(j=0U;j> 1U; + } + } + } + + return count; +} + +#if (XMC_VADC_QUEUE_AVAILABLE == 1U) +/* API to initialize queue request source */ +void XMC_VADC_GROUP_QueueInit(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_QUEUE_CONFIG_t *config) +{ + uint32_t reg; + + XMC_ASSERT("XMC_VADC_GROUP_QueueInit:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* Disable arbitration slot of the queue request source */ + XMC_VADC_GROUP_QueueDisableArbitrationSlot(group_ptr); + + reg = group_ptr->ARBPR; + + /* Request Source priority */ + reg &= ~((uint32_t)VADC_G_ARBPR_PRIO0_Msk); + reg |= (uint32_t) ((uint32_t)config->req_src_priority << VADC_G_ARBPR_PRIO0_Pos); + + /* Conversion Start mode */ + if (XMC_VADC_STARTMODE_WFS != (XMC_VADC_STARTMODE_t)config->conv_start_mode) + { + reg |= (uint32_t)(VADC_G_ARBPR_CSM0_Msk); + } + + group_ptr->ARBPR = reg; + + + group_ptr->QCTRL0 = (uint32_t)((config->qctrl0)|(uint32_t)(VADC_G_QCTRL0_XTWC_Msk)| + (uint32_t)(VADC_G_QCTRL0_TMWC_Msk)| + (uint32_t)(VADC_G_QCTRL0_GTWC_Msk)); + + /* Gating mode */ + group_ptr->QMR0 = ((uint32_t)(config->qmr0) | (uint32_t)((uint32_t)XMC_VADC_GATEMODE_IGNORE << VADC_G_QMR0_ENGT_Pos)); + + if (XMC_VADC_STARTMODE_CNR == (XMC_VADC_STARTMODE_t)(config->conv_start_mode) ) + { + group_ptr->QMR0 |= (uint32_t)((uint32_t)1 << VADC_G_QMR0_RPTDIS_Pos); + } + /* Enable arbitration slot for the queue request source */ + XMC_VADC_GROUP_QueueEnableArbitrationSlot(group_ptr); + +} + +/* API to select one of the 16 possible triggers as a conversion trigger for queue request source */ +void XMC_VADC_GROUP_QueueSelectTrigger(XMC_VADC_GROUP_t *const group_ptr, + const XMC_VADC_TRIGGER_INPUT_SELECT_t input_num) +{ + uint32_t qctrl; + + XMC_ASSERT("XMC_VADC_GROUP_QueueSelectTrigger:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_QueueSelectTrigger:Wrong Trigger Port", ((input_num)< XMC_VADC_NUM_PORTS)) + + + /* Now select the conversion trigger */ + qctrl = group_ptr->QCTRL0; + qctrl |= (uint32_t)VADC_G_QCTRL0_XTWC_Msk; + qctrl &= ~((uint32_t)VADC_G_QCTRL0_XTSEL_Msk); + qctrl |= (uint32_t)((uint32_t)input_num << VADC_G_QCTRL0_XTSEL_Pos); + group_ptr->QCTRL0 = qctrl; +} + +/* Select a trigger edge*/ +void XMC_VADC_GROUP_QueueSelectTriggerEdge(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_TRIGGER_EDGE_t trigger_edge) +{ + uint32_t qctrl; + + XMC_ASSERT("XMC_VADC_GROUP_QueueSelectTriggerEdge:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_QueueSelectTriggerEdge:Wrong Gating Port", ((trigger_edge)<= XMC_VADC_TRIGGER_EDGE_ANY)) + + /* Now select the gating input */ + qctrl = group_ptr->QCTRL0; + qctrl |= (uint32_t)VADC_G_QCTRL0_XTWC_Msk; + qctrl &= ~((uint32_t)VADC_G_QCTRL0_XTMODE_Msk); + qctrl |= (uint32_t)((uint32_t)trigger_edge << VADC_G_QCTRL0_XTMODE_Pos); + group_ptr->QCTRL0 = qctrl; +} + +/* API to select one of the 16 possible trigger gates as a trigger gating signal for queue request source */ +void XMC_VADC_GROUP_QueueSelectGating(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_GATE_INPUT_SELECT_t input_num) +{ + uint32_t qctrl; + + XMC_ASSERT("XMC_VADC_GROUP_QueueSelectGating:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_QueueSelectGating:Wrong Gating Port", ((input_num)< XMC_VADC_NUM_PORTS)) + + /* Now select the gating input */ + qctrl = group_ptr->QCTRL0; + qctrl |= (uint32_t)VADC_G_QCTRL0_GTWC_Msk; + qctrl &= ~((uint32_t)VADC_G_QCTRL0_GTSEL_Msk); + qctrl |= (uint32_t)((uint32_t)input_num << VADC_G_QCTRL0_GTSEL_Pos); + group_ptr->QCTRL0 = qctrl; +} + +/* API to determine the number of channels in the queue (length includes the valid channel in the Backup register)*/ +uint32_t XMC_VADC_GROUP_QueueGetLength(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t qsr; + uint32_t qbur0; + uint32_t length; + + XMC_ASSERT("XMC_VADC_GROUP_QueueGetLength:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + qsr = group_ptr->QSR0; + qbur0 = group_ptr->QBUR0; + + if (qsr & (uint32_t)VADC_G_QSR0_EMPTY_Msk) + { + length = 0U; + } + else + { + length = (qsr & (uint32_t)VADC_G_QSR0_FILL_Msk) + 1U; + } + + if (qbur0 & (uint32_t)VADC_G_QBUR0_V_Msk ) + { + length++; + } + + return length; +} + +/* API to abort ongoing conversion of a channel sequence */ +void XMC_VADC_GROUP_QueueAbortSequence(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t qctrl0; + bool arbitration_status; + + XMC_ASSERT("XMC_VADC_GROUP_QueueAbortSequence:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* Disable any gating if present*/ + qctrl0 = group_ptr->QCTRL0; + + group_ptr->QCTRL0 =(0U | (uint32_t)VADC_G_QCTRL0_XTWC_Msk | + (uint32_t)VADC_G_QCTRL0_GTWC_Msk | (uint32_t)VADC_G_QCTRL0_TMWC_Msk ); + + /* Disable the Arbitration 0 in the group before abort*/ + arbitration_status = (bool)((uint32_t)(group_ptr->ARBPR >> VADC_G_ARBPR_ASEN0_Pos) & 1U); + XMC_VADC_GROUP_QueueDisableArbitrationSlot(group_ptr); + + /* Flush the Entries from queue*/ + XMC_VADC_GROUP_QueueFlushEntries(group_ptr); + + /* Enable the arbitration slot 0*/ + group_ptr->ARBPR |= (uint32_t)((uint32_t)arbitration_status << VADC_G_ARBPR_ASEN0_Pos); + + /* Enable any disabled gating*/ + group_ptr->QCTRL0 = (qctrl0 | (uint32_t)VADC_G_QCTRL0_XTWC_Msk | + (uint32_t)VADC_G_QCTRL0_GTWC_Msk | (uint32_t)VADC_G_QCTRL0_TMWC_Msk ); +} + +/* API to abort conversion of the channel queued up next */ +void XMC_VADC_GROUP_QueueRemoveChannel(XMC_VADC_GROUP_t *const group_ptr) +{ + uint32_t length_before_abort; + uint32_t length_after_abort; + uint32_t qctrl0; + bool arbitration_status; + + XMC_ASSERT("XMC_VADC_GROUP_QueueRemoveChannel:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* Disable any gating if present*/ + qctrl0= group_ptr->QCTRL0; + + group_ptr->QCTRL0 =(0U | (uint32_t)VADC_G_QCTRL0_XTWC_Msk | + (uint32_t)VADC_G_QCTRL0_GTWC_Msk | (uint32_t)VADC_G_QCTRL0_TMWC_Msk ); + + /* Disable the Arbitration 0 in the group before abort*/ + arbitration_status = (bool)((uint32_t)(group_ptr->ARBPR >> VADC_G_ARBPR_ASEN0_Pos) & 1U); + XMC_VADC_GROUP_QueueDisableArbitrationSlot(group_ptr); + + length_before_abort = XMC_VADC_GROUP_QueueGetLength(group_ptr); + + if (length_before_abort) + { + /* Remove the first entry of the queue */ + group_ptr->QMR0 |= (uint32_t)VADC_G_QMR0_CLRV_Msk; + + length_after_abort = XMC_VADC_GROUP_QueueGetLength(group_ptr); + + /* Loop until a reduction in queue length is assessed */ + while(length_after_abort == length_before_abort) + { + length_after_abort = XMC_VADC_GROUP_QueueGetLength(group_ptr); + } + } + /* Enable the arbitration slot 0*/ + group_ptr->ARBPR |= (uint32_t)((uint32_t)arbitration_status << VADC_G_ARBPR_ASEN0_Pos); + + /* Enable any disabled gating*/ + group_ptr->QCTRL0 = (qctrl0 | (uint32_t)VADC_G_QCTRL0_XTWC_Msk | + (uint32_t)VADC_G_QCTRL0_GTWC_Msk | (uint32_t)VADC_G_QCTRL0_TMWC_Msk ); +} + +/* Get details of channel meant to be converted right after the ongoing conversion */ +int32_t XMC_VADC_GROUP_QueueGetNextChannel(XMC_VADC_GROUP_t *const group_ptr) +{ + int32_t ch_num; + + XMC_ASSERT("XMC_VADC_GROUP_QueueGetNextChannel:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + /* + * Check if there is something in the backup stage. If not, read queue-0 + * entry. + */ + if ( (group_ptr->QBUR0) & (uint32_t)VADC_G_QBUR0_V_Msk) + { + ch_num = (int32_t)(group_ptr->QBUR0 & (uint32_t)VADC_G_QBUR0_REQCHNR_Msk); + } + else if ( (group_ptr->Q0R0) & (uint32_t)VADC_G_Q0R0_V_Msk) + { + ch_num = (int32_t)(group_ptr->Q0R0 & (uint32_t)VADC_G_Q0R0_REQCHNR_Msk); + } + else + { + /* Nothing is pending */ + ch_num = -1; + } + + return ch_num; +} + +/* Get the channel number of the channel whose conversion had been interrupted */ +int32_t XMC_VADC_GROUP_QueueGetInterruptedChannel(XMC_VADC_GROUP_t *const group_ptr) +{ + int32_t ch_num; + + XMC_ASSERT("XMC_VADC_GROUP_QueueGetInterruptedChannel:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + if ((group_ptr->QBUR0) & (uint32_t)VADC_G_QBUR0_V_Msk) + { + ch_num = (int32_t)(group_ptr->QBUR0 & (uint32_t)VADC_G_QBUR0_REQCHNR_Msk); + } + else + { + /* No such channel */ + ch_num = -1; + } + + return ch_num; +} + +/* Select a Service Request line for the request source event */ +void XMC_VADC_GROUP_QueueSetReqSrcEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, const XMC_VADC_SR_t sr) +{ + uint32_t sevnp; + + XMC_ASSERT("XMC_VADC_GROUP_QueueSetReqSrcEventInterruptNode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_QueueSetReqSrcEventInterruptNode:Wrong Service Request", ((sr) <= XMC_VADC_SR_SHARED_SR3)) + + sevnp = group_ptr->SEVNP; + + sevnp &= ~((uint32_t)VADC_G_SEVNP_SEV0NP_Msk); + sevnp |= (uint32_t)((uint32_t)sr << VADC_G_SEVNP_SEV0NP_Pos); + + group_ptr->SEVNP = sevnp; + +} +#endif + +#if (XMC_VADC_GROUP_AVAILABLE ==1U) +/* API to initialize a channel unit */ +void XMC_VADC_GROUP_ChannelInit(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num, + const XMC_VADC_CHANNEL_CONFIG_t *config) +{ + uint32_t prio; + uint32_t ch_assign; + uint32_t mask; + + + XMC_ASSERT("XMC_VADC_GROUP_ChannelInit:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelInit:Wrong Channel Number", ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + prio = (uint32_t)config->channel_priority; + + /* Priority channel */ + ch_assign = group_ptr->CHASS; + ch_assign &= ~((uint32_t)((uint32_t)1 << ch_num)); + ch_assign |= (uint32_t)(prio << ch_num); + group_ptr->CHASS = ch_assign; + + /* Alias channel */ + if (config->alias_channel >= (int32_t)0) + { + mask = (uint32_t)0; + if ((uint32_t)1 == ch_num) + { + mask = VADC_G_ALIAS_ALIAS1_Pos; + group_ptr->ALIAS &= ~(uint32_t)(VADC_G_ALIAS_ALIAS1_Msk); + } + else if ((uint32_t)0 == ch_num) + { + mask = VADC_G_ALIAS_ALIAS0_Pos; + group_ptr->ALIAS &= ~(uint32_t)(VADC_G_ALIAS_ALIAS0_Msk); + } + + group_ptr->ALIAS |= (uint32_t)(config->alias_channel << mask); + } + + group_ptr->BFL |= config->bfl; + +#if (XMC_VADC_BOUNDARY_FLAG_SELECT == 1U) + group_ptr->BFLC |= config->bflc; +#endif + /* Program the CHCTR register */ + group_ptr->CHCTR[ch_num] = config->chctr; + +} + +/* API to set an alias channel for channels numbered 2 through 7 */ +void XMC_VADC_GROUP_SetChannelAlias(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t src_ch_num, + const uint32_t alias_ch_num) +{ + uint32_t alias; + uint32_t mask; + uint32_t pos; + + XMC_ASSERT("XMC_VADC_GROUP_SetChannelAlias:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_SetChannelAlias:Wrong Alias Channel", ((alias_ch_num == 0)|| (alias_ch_num == 1U))) + XMC_ASSERT("XMC_VADC_GROUP_SetChannelAlias:Wrong Aliased Channel", ((src_ch_num < 8U))) + + alias = group_ptr->ALIAS; + + if (0U == alias_ch_num) + { + mask = (uint32_t) VADC_G_ALIAS_ALIAS0_Msk; + pos = (uint32_t) VADC_G_ALIAS_ALIAS0_Pos; + } + else + { + mask = (uint32_t) VADC_G_ALIAS_ALIAS1_Msk; + pos = (uint32_t) VADC_G_ALIAS_ALIAS1_Pos; + } + alias &= ~mask; + alias |= (uint32_t)(src_ch_num << pos); + + group_ptr->ALIAS = alias; +} + +/* API to determine whether input to a channel has violated boundary conditions */ +bool XMC_VADC_GROUP_ChannelIsResultOutOfBounds(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + bool retval; + uint32_t chctr; + uint32_t ceflag; + + XMC_ASSERT("XMC_VADC_GROUP_ChannelIsResultOutOfBounds:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelIsResultOutOfBounds:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + retval = (bool)false; + /* + Check if the Channel event is configured to be generated in the event of + boundary violation and if affirmative, check if the channel event is set. + */ + /* Extract CHEVMODE for requested channel */ + chctr = group_ptr->CHCTR[ch_num]; + chctr = (uint32_t)(chctr >> (uint32_t)VADC_G_CHCTR_CHEVMODE_Pos)& (uint32_t)0x3; + + /* Extract CEFLAG for the requested channel */ + ceflag = group_ptr->CEFLAG; + ceflag = ceflag & ((uint32_t)((uint32_t)1 << ch_num) ); + + /* Check what was the channel event generation criteria */ + if ( (( (uint32_t)XMC_VADC_CHANNEL_EVGEN_INBOUND == chctr) \ + || ((uint32_t) XMC_VADC_CHANNEL_EVGEN_OUTBOUND == chctr)) && (ceflag) ) + { + retval = (bool)true; + } + + return retval; +} + +/* Set a reference voltage for conversion */ +void XMC_VADC_GROUP_ChannelSetInputReference(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const XMC_VADC_CHANNEL_REF_t ref) +{ + uint32_t chctr; + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetInputReference:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetInputReference:Wrong Channel Number", ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetInputReference:Wrong Voltage Reference", ((ref)<= XMC_VADC_CHANNEL_REF_ALT_CH0)) + + chctr = group_ptr->CHCTR[ch_num]; + chctr &= ~((uint32_t)VADC_G_CHCTR_REFSEL_Msk); + chctr |= (uint32_t)((uint32_t)ref << VADC_G_CHCTR_REFSEL_Pos); + + group_ptr->CHCTR[ch_num] = chctr; +} + +/* API to select one of the available 16 registers for storing the channel result */ +void XMC_VADC_GROUP_ChannelSetResultRegister(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const uint32_t result_reg_num) +{ + uint32_t chctr; + + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetResultRegister:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetResultRegister:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetResultRegister:Wrong Result Register", + ((result_reg_num) < XMC_VADC_NUM_RESULT_REGISTERS)) + + chctr = group_ptr->CHCTR[ch_num]; + chctr &= ~((uint32_t)VADC_G_CHCTR_RESREG_Msk); + chctr |= (uint32_t)(result_reg_num << VADC_G_CHCTR_RESREG_Pos); + + group_ptr->CHCTR[ch_num] = chctr; +} + +/* API to select one of the available 4 class conversion */ +void XMC_VADC_GROUP_ChannelSetIclass(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const XMC_VADC_CHANNEL_CONV_t conversion_class) +{ + + uint32_t chctr; + + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetIclass:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetIclass:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetIclass:Wrong input class ", + (XMC_VADC_CHANNEL_CONV_GLOBAL_CLASS1 >= conversion_class)) + + chctr = group_ptr->CHCTR[ch_num]; + chctr &= ~((uint32_t)VADC_G_CHCTR_ICLSEL_Msk); + chctr |= (uint32_t)((uint32_t)conversion_class << (uint32_t)VADC_G_CHCTR_ICLSEL_Pos); + + group_ptr->CHCTR[ch_num] = chctr; + +} + +/* API to retrieve the result register bound with specified channel */ +uint8_t XMC_VADC_GROUP_ChannelGetResultRegister(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + uint8_t resreg; + + XMC_ASSERT("XMC_VADC_GROUP_ChannelGetResultRegister:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelGetResultRegister:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + resreg = (uint8_t)((group_ptr->CHCTR[ch_num] & (uint32_t)VADC_G_CHCTR_RESREG_Msk) >> VADC_G_CHCTR_RESREG_Pos) ; + + return resreg; +} + +/* API to manually assert channel event */ +void XMC_VADC_GROUP_ChannelTriggerEvent(XMC_VADC_GROUP_t *const group_ptr, const uint32_t ch_num) +{ + uint32_t ceflag; + + XMC_ASSERT("XMC_VADC_GROUP_ChannelTriggerEvent:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelTriggerEvent:Wrong Channel Number", ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + ceflag = group_ptr->CEFLAG; + ceflag |= (uint32_t)((uint32_t)1 << ch_num); + group_ptr->CEFLAG = ceflag; +} + +/* API to bind channel event with a service request (NVIC Node) */ +void XMC_VADC_GROUP_ChannelSetEventInterruptNode(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const XMC_VADC_SR_t sr) +{ + uint32_t route_mask; + + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetEventInterruptNode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetEventInterruptNode:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetEventInterruptNode:Wrong Service Request", ((sr) <= XMC_VADC_SR_SHARED_SR3)) + + route_mask = group_ptr->CEVNP0; + route_mask &= ~((uint32_t)15 << (ch_num * (uint32_t)4)); + route_mask |= (uint32_t)( (uint32_t)sr << (ch_num * (uint32_t)4)); + group_ptr->CEVNP0 = route_mask; +} + +/* API to configure conditions for generation of channel event */ +void XMC_VADC_GROUP_ChannelTriggerEventGenCriteria( XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + const XMC_VADC_CHANNEL_EVGEN_t criteria) +{ + uint32_t chctr; + + XMC_ASSERT("XMC_VADC_GROUP_ChannelTriggerEventGenCriteria:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelTriggerEventGenCriteria:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelTriggerEventGenCriteria:Wrong Event Generation Criteria", + ((criteria) <= XMC_VADC_CHANNEL_EVGEN_ALWAYS)) + + chctr = group_ptr->CHCTR[ch_num]; + chctr &= ~((uint32_t)VADC_G_CHCTR_CHEVMODE_Msk); + chctr |= (uint32_t)((uint32_t)criteria << VADC_G_CHCTR_CHEVMODE_Pos); + group_ptr->CHCTR[ch_num] = chctr; +} + +/* API to configure the boundary selection */ +void XMC_VADC_GROUP_ChannelSetBoundarySelection(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t ch_num, + XMC_VADC_BOUNDARY_SELECT_t boundary_sel, + XMC_VADC_CHANNEL_BOUNDARY_t selection) +{ + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetBoundarySelection:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_ChannelSetBoundarySelection:Wrong Channel Number", + ((ch_num) < XMC_VADC_NUM_CHANNELS_PER_GROUP)) + + group_ptr->CHCTR[ch_num] &= ~((uint32_t)VADC_G_CHCTR_BNDSELL_Msk << boundary_sel); + group_ptr->CHCTR[ch_num] |= (selection<< ((uint32_t)VADC_G_CHCTR_BNDSELL_Pos + (uint32_t)boundary_sel)); +} + +/* Make the specified result register part of Result FIFO */ +void XMC_VADC_GROUP_AddResultToFifo(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + uint32_t fen; + + XMC_ASSERT("XMC_VADC_GROUP_AddResultToFifo:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_AddResultToFifo:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + + /* Extract and clear the FIFO enable field */ + fen = group_ptr->RCR[res_reg]; + fen &= ~((uint32_t)VADC_G_RCR_FEN_Msk); + /* Set this register up as a FIFO member */ + fen |= (uint32_t)((uint32_t)1 << VADC_G_RCR_FEN_Pos); + group_ptr->RCR[res_reg] = fen; +} + + +/* Applicable to fast compare mode, this API sets up the value which is to be compared against conversion result */ +void XMC_VADC_GROUP_SetResultFastCompareValue(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t res_reg, + const XMC_VADC_RESULT_SIZE_t compare_val) +{ + uint32_t res = group_ptr->RES[res_reg]; + + XMC_ASSERT("XMC_VADC_GROUP_SetResultFastCompareValue:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_SetResultFastCompareValue:Wrong Result Register", + ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + + res &= ~((uint32_t)VADC_G_RES_RESULT_Msk); + res |= (uint32_t)((uint32_t)compare_val << XMC_VADC_RESULT_LEFT_ALIGN_10BIT); + group_ptr->RES[res_reg] = res; +} + +/* API to retrieve the result of fast mode comparison */ +XMC_VADC_FAST_COMPARE_t XMC_VADC_GROUP_GetFastCompareResult(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + XMC_VADC_FAST_COMPARE_t result; + uint32_t res; + + XMC_ASSERT("XMC_VADC_GROUP_GetFastCompareResult:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_GetFastCompareResult:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + + res = group_ptr->RES[res_reg]; + + if (res & (uint32_t)VADC_G_RES_VF_Msk) + { + result = (XMC_VADC_FAST_COMPARE_t)((uint32_t)(res >> (uint32_t)VADC_G_RES_FCR_Pos) & (uint32_t)1); + } + else + { + result = XMC_VADC_FAST_COMPARE_UNKNOWN; + } + + return result; +} + +/* Applicable to fast compare mode, this API sets up the value which is to be compared against conversion result */ +void XMC_VADC_GROUP_SetResultSubtractionValue(XMC_VADC_GROUP_t *const group_ptr, + const uint16_t subtraction_val) +{ + uint32_t res; + + XMC_ASSERT("XMC_VADC_GROUP_SetResultSubtractionValue:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + + res = group_ptr->RES[0]; + res &= ~((uint32_t)VADC_G_RES_RESULT_Msk); + res |= (uint32_t)subtraction_val; + group_ptr->RES[0] = res; +} + + +/* API to select a service request line (NVIC Node) for result event of specified unit of result hardware */ +void XMC_VADC_GROUP_SetResultInterruptNode(XMC_VADC_GROUP_t *const group_ptr, + const uint32_t res_reg, + const XMC_VADC_SR_t sr) +{ + uint32_t route_mask; + + XMC_ASSERT("XMC_VADC_GROUP_SetResultInterruptNode:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_SetResultInterruptNode:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + XMC_ASSERT("XMC_VADC_GROUP_SetResultInterruptNode:Wrong Service Request", ((sr) <= XMC_VADC_SR_SHARED_SR3)) + + if (res_reg <= 7U) + { + route_mask = group_ptr->REVNP0; + route_mask &= ~((uint32_t)((uint32_t)15 << (res_reg * (uint32_t)4) )); + route_mask |= (uint32_t)((uint32_t)sr << (res_reg * (uint32_t)4)); + group_ptr->REVNP0 = route_mask; + } + else + { + route_mask = group_ptr->REVNP1; + route_mask &= ~((uint32_t)((uint32_t)15 << (( res_reg - (uint32_t)8) * (uint32_t)4) )); + route_mask |= (uint32_t)((uint32_t)sr << ((res_reg - (uint32_t)8) * (uint32_t)4)); + group_ptr->REVNP1 = route_mask; + } +} + +/* API to retrieve the tail of the fifo which the specified result register is a part of */ +uint32_t XMC_VADC_GROUP_GetResultFifoTail(XMC_VADC_GROUP_t *const group_ptr, uint32_t res_reg) +{ + uint32_t tail; + uint32_t rcr; + int32_t i; + bool exit_flag; + + XMC_ASSERT("XMC_VADC_GROUP_GetResultFifoTail:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_GetResultFifoTail:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + + tail = 0U; + exit_flag= (bool)false; + + if ((bool)true == XMC_VADC_GROUP_IsResultRegisterFifoHead(group_ptr, res_reg)) + { + res_reg = res_reg - 1U; + } + + /* Border condition */ + if (0U == res_reg) + { + tail = 0U; + } + else + { + /* Stop either at a node that does not have FEN set or at Node-0 */ + for(i = (int32_t)res_reg; i >= (int32_t)0; i--) + { + rcr = group_ptr->RCR[i]; + rcr &= (uint32_t)VADC_G_RCR_FEN_Msk; + + if (rcr) + { + if ((int32_t)0 == i) + { + /* No more nodes. Stop here */ + tail = (uint32_t)0; + exit_flag = (bool)true; + } + } + else + { + /* The preceding register forms the tail of the FIFO */ + tail = (uint32_t)i + (uint32_t)1; + exit_flag = (bool)true; + } + if (exit_flag) + { + break; + } + } + } + return tail; +} + +/* API to retrieve the head of the fifo which the specified result register is a part of */ +uint32_t XMC_VADC_GROUP_GetResultFifoHead(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + uint32_t head; + uint32_t rcr; + uint32_t i; + + XMC_ASSERT("XMC_VADC_GROUP_GetResultFifoHead:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_GetResultFifoHead:Wrong Result Register", ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + + if ((bool)true == XMC_VADC_GROUP_IsResultRegisterFifoHead(group_ptr, res_reg)) + { + head = res_reg; + } + else + { + head = XMC_VADC_NUM_RESULT_REGISTERS - (uint32_t)1; + + for(i = res_reg; i < XMC_VADC_NUM_RESULT_REGISTERS ; i++) + { + rcr = group_ptr->RCR[i]; + rcr &= (uint32_t)VADC_G_RCR_FEN_Msk; + + if (!rcr) + { + /* This node forms the head of the FIFO */ + head = i ; + break; + } + } + } + return head; +} + +/* API to determine if the specified result register is the head of a result fifo */ +bool XMC_VADC_GROUP_IsResultRegisterFifoHead(XMC_VADC_GROUP_t *const group_ptr, const uint32_t res_reg) +{ + bool ret_val; + uint32_t rcr_head; + uint32_t rcr_next; + + XMC_ASSERT("XMC_VADC_GROUP_IsResultRegisterFifoHead:Wrong Group Pointer", XMC_VADC_CHECK_GROUP_PTR(group_ptr)) + XMC_ASSERT("XMC_VADC_GROUP_IsResultRegisterFifoHead:Wrong Result Register", + ((res_reg) < XMC_VADC_NUM_RESULT_REGISTERS)) + + rcr_head = group_ptr->RCR[res_reg]; + rcr_head &= (uint32_t)VADC_G_RCR_FEN_Msk; + rcr_next = group_ptr->RCR[res_reg - (uint32_t)1]; + rcr_next &= (uint32_t)VADC_G_RCR_FEN_Msk; + + if (rcr_head) + { + ret_val = (bool)false; + } + else if (rcr_next) + { + ret_val = (bool)true; + } + else + { + ret_val = (bool)false; + } + + return ret_val; +} + +#endif diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_wdt.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_wdt.c new file mode 100644 index 00000000..43018b1d --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Libraries/XMCLib/src/xmc_wdt.c @@ -0,0 +1,94 @@ +/** + * @file xmc_wdt.c + * @date 2015-06-20 + * + * @cond + ********************************************************************************************************************* + * XMClib v2.1.12 - XMC Peripheral Driver Library + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-02-20: + * - Initial
+ * + * 2015-06-20: + * - Removed definition of GetDriverVersion API
+ * + * @endcond + */ + +/********************************************************************************************************************* + * HEADER FILES + ********************************************************************************************************************/ +#include "xmc_wdt.h" +#include "xmc_scu.h" + +/********************************************************************************************************************* + * API IMPLEMENTATION + ********************************************************************************************************************/ + +/* Enables watchdog clock and releases watchdog reset. */ +void XMC_WDT_Enable(void) +{ +#if UC_FAMILY == XMC4 + XMC_SCU_CLOCK_EnableClock(XMC_SCU_CLOCK_WDT); +#endif + +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_WDT); +#endif +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_WDT); +#endif +} + +/* Disables watchdog clock and resets watchdog. */ +void XMC_WDT_Disable(void) +{ +#if defined(PERIPHERAL_RESET_SUPPORTED) + XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_WDT); +#endif +#if defined(CLOCK_GATING_SUPPORTED) + XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_WDT); +#endif + +#if UC_FAMILY == XMC4 + XMC_SCU_CLOCK_DisableClock(XMC_SCU_CLOCK_WDT); +#endif +} +/* Initializes and configures watchdog with configuration data pointed by \a config. */ +void XMC_WDT_Init(const XMC_WDT_CONFIG_t *const config) +{ + XMC_WDT_Enable(); + WDT->CTR = config->wdt_ctr; + WDT->WLB = config->window_lower_bound; + WDT->WUB = config->window_upper_bound; +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Prog Debug.launch b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Prog Debug.launch new file mode 100644 index 00000000..9e8fcde5 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Prog Debug.launch @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Startup/startup_XMC1400.S b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Startup/startup_XMC1400.S new file mode 100644 index 00000000..8574277b --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Startup/startup_XMC1400.S @@ -0,0 +1,380 @@ +/********************************************************************************************************************* + * @file startup_XMC1400.S + * @brief CMSIS Core Device Startup File for Infineon XMC1400 Device Series + * @version V1.1 + * @date 05 Jan 2016 + * + * @cond + ********************************************************************************************************************* + * Copyright (c) 2015-2016, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + **************************** Change history ******************************** + * V1.0, Sep, 03, 2015 JFT:Initial version + * MCLK=8MHz, PCLK=16MHz + * V1.1, Jan, 05, 2016 JFT:Fix .reset section attributes + * + * @endcond + */ + +/***************************************************************************** + * Clock system handling by SSW + * CLK_VAL1 Configuration + * FDIV Fractional Divider Selection <0-1023> + * Deafult: 0. Fractional part of clock divider, MCLK = DCO1 / (IDIV + (FDIV / 1024)) + * IDIV Divider Selection <1-16> + * Deafult: 6. Interger part of clock divider, MCLK = DCO1 / (IDIV + (FDIV / 1024) = 8MHz) + * PCLKSEL PCLK Clock Select + * <0=> PCLK = MCLK + * <1=> PCLK = 2 x MCLK + * Deafult: 2 x MCLK + * RTCCLKSEL RTC Clock Select + * <0=> 32.768kHz standby clock + * <1=> 32.768kHz external clock from ERU0.IOUT0 + * <2=> 32.768kHz external clock from ACMP0.OUT + * <3=> 32.768kHz external clock from ACMP1.OUT + * <4=> 32.768kHz external clock from ACMP2.OUT + * <5=> 32.768kHz XTAL clock via OSC_LP + * <6=> Reserved + * <7=> Reserved + * Deafult: 32.768kHz standby clock + * do not move CLK_VAL1 to SCU_CLKCR[0..19] + * + *****************************************************************************/ +#define CLKVAL1_SSW 0x00041800 + +/***************************************************************************** + * CLK_VAL2 Configuration + * disable VADC and SHS Gating + * disable CCU80 Gating + * disable CCU40 Gating + * disable USIC0 Gating + * disable BCCU0 Gating + * disable LEDTS0 Gating + * disable LEDTS1 Gating + * disable POSIF0 Gating + * disable MATH Gating + * disable WDT Gating + * disable RTC Gating + * disable CCU81 Gating + * disable CCU41 Gating + * disable USIC1 Gating + * disable LEDTS2 Gating + * disable POSIF1 Gating + * disable MCAN0 Gating + * do not move CLK_VAL2 to SCU_CGATCLR0[0..10] + * + *****************************************************************************/ +#define CLKVAL2_SSW 0x00000100 + +/* A couple of macros to ease definition of the various handlers */ +.macro Insert_InterruptHandler Interrupt + .weak \Interrupt\()_Handler + .thumb_set \Interrupt\()_Handler, Default_Handler +.endm + +.macro Insert_InterruptVeener Interrupt + .globl \Interrupt\()_Veener +\Interrupt\()_Veener: + LDR R0, =\Interrupt\()_Handler + BX R0 +.endm + +/* ================== START OF VECTOR TABLE DEFINITION ====================== */ +/* Vector Table - This is indirectly branched to through the veneers */ + .syntax unified + .cpu cortex-m0 + + .section .reset, "a", %progbits + + .align 2 + + .globl __Vectors + .type __Vectors, %object +__Vectors: + .long __initial_sp /* Top of Stack */ + .long Reset_Handler /* Reset Handler */ +/* + * All entries below are redundant for M0, but are retained because they can + * in the future be directly ported to M0 Plus devices. + */ + .long 0 /* Reserved */ + .long HardFault_Handler /* Hard Fault Handler */ + .long CLKVAL1_SSW /* Reserved */ + .long CLKVAL2_SSW /* Reserved */ + .long 0x55AA11EE /* Reserved for OpenBLT checksum*/ +#ifdef RETAIN_VECTOR_TABLE + .long 0x55AA11EE /* Reserved for OpenBLT checksum*/ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long SVC_Handler /* SVCall Handler */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long PendSV_Handler /* PendSV Handler */ + .long SysTick_Handler /* SysTick Handler */ + + /* Interrupt Handlers for Service Requests (SR) from XMC1400 Peripherals */ + .long IRQ0_Handler /* SCU.SR0, CAN0.SR0, CCU40.SR0, SCU.SR0 | CAN0.SR0 */ + .long IRQ1_Handler /* SCU.SR1, CAN0.SR1, CCU80.SR0, SCU.SR1 | CAN0.SR1 */ + .long IRQ2_Handler /* SCU.SR2, CAN0.SR2, CCU80.SR1, SCU.SR2 | CAN0.SR2 */ + .long IRQ3_Handler /* ERU0.SR0, ERU1.SR0, CAN0.SR0, ERU0.SR0 | ERU1.SR0 */ + .long IRQ4_Handler /* ERU0.SR1, ERU1.SR1, CAN0.SR1, ERU0.SR1 | ERU1.SR1 */ + .long IRQ5_Handler /* ERU0.SR2, ERU1.SR2, CAN0.SR2, ERU0.SR2 | ERU1.SR2 */ + .long IRQ6_Handler /* ERU0.SR3, ERU1.SR3, CAN0.SR3, ERU0.SR3 | ERU1.SR3 */ + .long IRQ7_Handler /* MATH.SR0, CAN0.SR3, CCU40.SR1, MATH.SR0 | CAN0.SR3 */ + .long IRQ8_Handler /* LEDTS2.SR0, CCU40.SR0, CCU80.SR0, LEDTS2.SR0 | CCU40.SR0 */ + .long IRQ9_Handler /* USIC0.SR0, USIC1.SR0, ERU0.SR0, USIC0.SR0 | USIC1.SR0 */ + .long IRQ10_Handler /* USIC0.SR1, USIC1.SR1, ERU0.SR1, USIC0.SR1 | USIC1.SR1 */ + .long IRQ11_Handler /* USIC0.SR2, USIC1.SR2, ERU0.SR2, USIC0.SR2 | USIC1.SR2 */ + .long IRQ12_Handler /* USIC0.SR3, USIC1.SR3, ERU0.SR3, USIC0.SR3 | USIC1.SR3 */ + .long IRQ13_Handler /* USIC0.SR4, USIC1.SR4, CCU80.SR1, USIC0.SR4 | USIC1.SR4 */ + .long IRQ14_Handler /* USIC0.SR5, USIC1.SR5, POSIF0.SR0, USIC0.SR5 | USIC1.SR5 */ + .long IRQ15_Handler /* VADC0.C0SR0, USIC0.SR0, POSIF0.SR1, VADC0.C0SR0 | USIC0.SR0 */ + .long IRQ16_Handler /* VADC0.C0SR1, USIC0.SR1, CCU40.SR2, VADC0.C0SR1 | USIC0.SR1 */ + .long IRQ17_Handler /* VADC0.G0SR0, USIC0.SR2, CAN0.SR0, VADC0.G0SR0 | USIC0.SR2 */ + .long IRQ18_Handler /* VADC0.G0SR1, USIC0.SR3, CAN0.SR1, VADC0.G0SR1 | USIC0.SR3 */ + .long IRQ19_Handler /* VADC0.G1SR0, USIC0.SR4, CAN0.SR2, VADC0.G1SR0 | USIC0.SR4 */ + .long IRQ20_Handler /* VADC0.G1SR1, USIC0.SR5, CAN0.SR3, VADC0.G1SR1 | USIC0.SR5 */ + .long IRQ21_Handler /* CCU40.SR0, CCU41.SR0, USIC0.SR0, CCU40.SR0 | CCU41.SR0 */ + .long IRQ22_Handler /* CCU40.SR1, CCU41.SR1, USIC0.SR1, CCU40.SR1 | CCU41.SR1 */ + .long IRQ23_Handler /* CCU40.SR2, CCU41.SR2, USIC0.SR2, CCU40.SR2 | CCU41.SR2 */ + .long IRQ24_Handler /* CCU40.SR3, CCU41.SR3, USIC0.SR3, CCU40.SR3 | CCU41.SR3 */ + .long IRQ25_Handler /* CCU80.SR0, CCU81.SR0, USIC0.SR4, CCU80.SR0 | CCU81.SR0 */ + .long IRQ26_Handler /* CCU80.SR1, CCU81.SR1, USIC0.SR5, CCU80.SR1 | CCU81.SR1 */ + .long IRQ27_Handler /* POSIF0.SR0, POSIF1.SR0, CCU40.SR3, POSIF0.SR0 | POSIF1.SR0 */ + .long IRQ28_Handler /* POSIF0.SR1, POSIF1.SR1, ERU0.SR0, POSIF0.SR1 | POSIF1.SR1 */ + .long IRQ29_Handler /* LEDTS0.SR0, CCU40.SR1, ERU0.SR1, LEDTS0.SR0 | CCU40.SR1 */ + .long IRQ30_Handler /* LEDTS1.SR0, CCU40.SR2, ERU0.SR2, LEDTS1.SR0 | CCU40.SR2 */ + .long IRQ31_Handler /* BCCU0.SR0, CCU40.SR3, ERU0.SR3, BCCU0.SR0 | CCU40.SR3 */ +#endif + + .size __Vectors, . - __Vectors +/* ================== END OF VECTOR TABLE DEFINITION ======================= */ + +/* ================== START OF VECTOR ROUTINES ============================= */ + + .thumb + .align 1 + +/* Reset Handler */ + .thumb_func + .globl Reset_Handler + .type Reset_Handler, %function +Reset_Handler: +/* Initialize the stack pointer */ + ldr r0, =__initial_sp + mov sp, r0 + +/* Initialize interrupt veneer */ + ldr r1, =eROData + ldr r2, =VeneerStart + ldr r3, =VeneerEnd + bl __copy_data + + ldr r0, =SystemInit + blx r0 + +/* Initialize data */ + ldr r1, =DataLoadAddr + ldr r2, =__data_start + ldr r3, =__data_end + bl __copy_data + +/* RAM code */ + ldr r1, =__ram_code_load + ldr r2, =__ram_code_start + ldr r3, =__ram_code_end + bl __copy_data + +/* Define __SKIP_BSS_CLEAR to disable zeroing uninitialzed data in startup. + * The BSS section is specified by following symbols + * __bss_start__: start of the BSS section. + * __bss_end__: end of the BSS section. + * + * Both addresses must be aligned to 4 bytes boundary. + */ +#ifndef __SKIP_BSS_CLEAR + ldr r1, =__bss_start + ldr r2, =__bss_end + + movs r0, 0 + + subs r2, r1 + ble .L_loop3_done + +.L_loop3: + subs r2, #4 + str r0, [r1, r2] + bgt .L_loop3 +.L_loop3_done: +#endif /* __SKIP_BSS_CLEAR */ + +#ifndef __SKIP_LIBC_INIT_ARRAY + ldr r0, =__libc_init_array + blx r0 +#endif + + ldr r0, =main + blx r0 + + .thumb_func + .type __copy_data, %function +__copy_data: +/* The ranges of copy from/to are specified by following symbols + * r1: start of the section to copy from. + * r2: start of the section to copy to + * r3: end of the section to copy to + * + * All addresses must be aligned to 4 bytes boundary. + * Uses r0 + */ + subs r3, r2 + ble .L_loop_done + +.L_loop: + subs r3, #4 + ldr r0, [r1,r3] + str r0, [r2,r3] + bgt .L_loop + +.L_loop_done: + bx lr + + .pool + .size Reset_Handler,.-Reset_Handler +/* ======================================================================== */ +/* ========== START OF EXCEPTION HANDLER DEFINITION ======================== */ + + .align 1 + + .thumb_func + .weak Default_handler + .type Default_handler, %function +Default_Handler: + b . + .size Default_Handler, . - Default_Handler + + Insert_InterruptHandler HardFault + Insert_InterruptHandler SVC + Insert_InterruptHandler PendSV + Insert_InterruptHandler SysTick + + Insert_InterruptHandler IRQ0 + Insert_InterruptHandler IRQ1 + Insert_InterruptHandler IRQ2 + Insert_InterruptHandler IRQ3 + Insert_InterruptHandler IRQ4 + Insert_InterruptHandler IRQ5 + Insert_InterruptHandler IRQ6 + Insert_InterruptHandler IRQ7 + Insert_InterruptHandler IRQ8 + Insert_InterruptHandler IRQ9 + Insert_InterruptHandler IRQ10 + Insert_InterruptHandler IRQ11 + Insert_InterruptHandler IRQ12 + Insert_InterruptHandler IRQ13 + Insert_InterruptHandler IRQ14 + Insert_InterruptHandler IRQ15 + Insert_InterruptHandler IRQ16 + Insert_InterruptHandler IRQ17 + Insert_InterruptHandler IRQ18 + Insert_InterruptHandler IRQ19 + Insert_InterruptHandler IRQ20 + Insert_InterruptHandler IRQ21 + Insert_InterruptHandler IRQ22 + Insert_InterruptHandler IRQ23 + Insert_InterruptHandler IRQ24 + Insert_InterruptHandler IRQ25 + Insert_InterruptHandler IRQ26 + Insert_InterruptHandler IRQ27 + Insert_InterruptHandler IRQ28 + Insert_InterruptHandler IRQ29 + Insert_InterruptHandler IRQ30 + Insert_InterruptHandler IRQ31 + +/* ======================================================================== */ + +/* ==================VENEERS VENEERS VENEERS VENEERS VENEERS=============== */ + .section ".XmcVeneerCode","ax",%progbits + + .align 1 + + Insert_InterruptVeener HardFault + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + .long 0 + Insert_InterruptVeener SVC + .long 0 + .long 0 + Insert_InterruptVeener PendSV + Insert_InterruptVeener SysTick + + Insert_InterruptVeener IRQ0 + Insert_InterruptVeener IRQ1 + Insert_InterruptVeener IRQ2 + Insert_InterruptVeener IRQ3 + Insert_InterruptVeener IRQ4 + Insert_InterruptVeener IRQ5 + Insert_InterruptVeener IRQ6 + Insert_InterruptVeener IRQ7 + Insert_InterruptVeener IRQ8 + Insert_InterruptVeener IRQ9 + Insert_InterruptVeener IRQ10 + Insert_InterruptVeener IRQ11 + Insert_InterruptVeener IRQ12 + Insert_InterruptVeener IRQ13 + Insert_InterruptVeener IRQ14 + Insert_InterruptVeener IRQ15 + Insert_InterruptVeener IRQ16 + Insert_InterruptVeener IRQ17 + Insert_InterruptVeener IRQ18 + Insert_InterruptVeener IRQ19 + Insert_InterruptVeener IRQ20 + Insert_InterruptVeener IRQ21 + Insert_InterruptVeener IRQ22 + Insert_InterruptVeener IRQ23 + Insert_InterruptVeener IRQ24 + Insert_InterruptVeener IRQ25 + Insert_InterruptVeener IRQ26 + Insert_InterruptVeener IRQ27 + Insert_InterruptVeener IRQ28 + Insert_InterruptVeener IRQ29 + Insert_InterruptVeener IRQ30 + Insert_InterruptVeener IRQ31 + +/* ======================================================================== */ +/* ======================================================================== */ + +/* ============= END OF INTERRUPT HANDLER DEFINITION ======================== */ + + .end diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Startup/system_XMC1400.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Startup/system_XMC1400.c new file mode 100644 index 00000000..d359ae5d --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/Startup/system_XMC1400.c @@ -0,0 +1,276 @@ +/********************************************************************************************************************* + * @file system_XMC1400.c + * @brief Device specific initialization for the XMC1400-Series according to CMSIS + * @version V1.1 + * @date 09 Dec 2015 + * + * @cond + ********************************************************************************************************************* + * Copyright (c) 2015-2016, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * *************************** Change history ******************************** + * V1.0, 03 Sep 2015, JFT : Initial version + * MCLK = 48MHz, PCLK = 96MHz + * V1.1, 09 Dec 2015, JFT : Enable prefetch unit + * + * @endcond + */ + +/******************************************************************************* + * HEADER FILES + *******************************************************************************/ + +#include +#include "system_XMC1400.h" + +/******************************************************************************* + * MACROS + *******************************************************************************/ + +/* Define WEAK attribute */ +#if !defined(__WEAK) +#if defined ( __CC_ARM ) +#define __WEAK __attribute__ ((weak)) +#elif defined ( __ICCARM__ ) +#define __WEAK __weak +#elif defined ( __GNUC__ ) +#define __WEAK __attribute__ ((weak)) +#elif defined ( __TASKING__ ) +#define __WEAK __attribute__ ((weak)) +#endif +#endif + +#define DCO1_FREQUENCY (48000000U) + +/* +//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------ +*/ + +/* +// Clock configuration +*/ + +/* +// External crystal frequency [Hz] +// <8000000=> 8MHz +// <12000000=> 12MHz +// <16000000=> 16MHz +// <20000000=> 20MHz +// Defines external crystal frequency +// Default: 20MHz +*/ +#define OSCHP_FREQUENCY (20000000U) + +/* +// DCLK clock source selection +// <0=> Internal oscillator DCO1 (48MHz) +// <1=> External crystal oscillator +// Default: Internal oscillator DCO1 (48MHz) +*/ +#define DCLK_CLOCK_SRC 0 +#define DCLK_CLOCK_SRC_DCO1 0 +#define DCLK_CLOCK_SRC_EXT_XTAL 1 + +/* +// OSCHP external oscillator mode +// <0=> Crystal mode +// <1=> External clock direct input mode +// Default: Crystal mode +*/ +#define OSCHP_MODE 0 +#define OSCHP_MODE_XTAL 0 +#define OSCHP_MODE_DIRECT 1 + +/* +// RTC clock source selection +// <0=> Internal oscillator DCO2 (32768Hz) +// <5=> External crystal oscillator +// Default: Internal oscillator DCO2 (32768Hz) +*/ +#define RTC_CLOCK_SRC 0 +#define RTC_CLOCK_SRC_DCO2 0 +#define RTC_CLOCK_SRC_EXT_XTAL 5 +/* +// PCLK clock source selection +// <0=> MCLK +// <1=> 2xMCLK +// Default: 2xMCLK +*/ +#define PCLK_CLOCK_SRC 1 +#define PCLK_CLOCK_SRC_MCLK 0 +#define PCLK_CLOCK_SRC_2XMCLK 1 + +/* +//-------- <<< end of configuration section >>> ------------------ +*/ + +/******************************************************************************* + * GLOBAL VARIABLES + *******************************************************************************/ + +#if defined ( __CC_ARM ) +uint32_t SystemCoreClock __attribute__((at(0x20003FFC))); +#elif defined ( __ICCARM__ ) +__no_init uint32_t SystemCoreClock; +#elif defined ( __GNUC__ ) +uint32_t SystemCoreClock __attribute__((section(".no_init"))); +#elif defined ( __TASKING__ ) +uint32_t SystemCoreClock __at( 0x20003FFC ); +#endif + +/******************************************************************************* + * LOCAL FUNCTIONS + *******************************************************************************/ +#if DCLK_CLOCK_SRC != DCLK_CLOCK_SRC_DCO1 +static inline void delay(uint32_t cycles) +{ + while(cycles > 0) + { + __NOP(); + cycles--; + } +} +#endif + +/******************************************************************************* + * API IMPLEMENTATION + *******************************************************************************/ + +__WEAK void SystemInit(void) +{ + SystemCoreSetup(); + SystemCoreClockSetup(); +} + +__WEAK void SystemCoreSetup(void) +{ + /* Enable Prefetch unit */ + SCU_GENERAL->PFUCR &= ~SCU_GENERAL_PFUCR_PFUBYP_Msk; +} + +__WEAK void SystemCoreClockSetup(void) +{ + /* Clock setup done during SSW using the CLOCK_VAL1 and CLOCK_VAL2 defined in vector table */ + + /* disable bit protection */ + SCU_GENERAL->PASSWD = 0x000000C0UL; + +#if DCLK_CLOCK_SRC != DCLK_CLOCK_SRC_DCO1 + + if (OSCHP_GetFrequency() > 20000000U) + { + SCU_ANALOG->ANAOSCHPCTRL |= SCU_ANALOG_ANAOSCHPCTRL_HYSCTRL_Msk; + } + + /* OSCHP source selection - OSC mode */ + SCU_ANALOG->ANAOSCHPCTRL = (SCU_ANALOG->ANAOSCHPCTRL & ~SCU_ANALOG_ANAOSCHPCTRL_MODE_Msk) | + (OSCHP_MODE << SCU_ANALOG_ANAOSCHPCTRL_MODE_Pos); + + /* Enable OSC_HP oscillator watchdog*/ + SCU_CLK->OSCCSR |= SCU_CLK_OSCCSR_XOWDEN_Msk; + + do + { + /* Restart OSC_HP oscillator watchdog */ + SCU_INTERRUPT->SRCLR1 = SCU_INTERRUPT_SRCLR1_LOECI_Msk; + SCU_CLK->OSCCSR |= SCU_CLK_OSCCSR_XOWDRES_Msk; + + /* Wait a few DCO2 cycles for the update of the clock detection result */ + delay(2500); + + /* check clock is ok */ + } + while(SCU_INTERRUPT->SRRAW1 & SCU_INTERRUPT_SRRAW1_LOECI_Msk); + + /* DCLK source using OSC_HP */ + SCU_CLK->CLKCR1 |= SCU_CLK_CLKCR1_DCLKSEL_Msk; + +#else + + /* DCLK source using DCO1 */ + SCU_CLK->CLKCR1 &= ~SCU_CLK_CLKCR1_DCLKSEL_Msk; + +#endif + +#if RTC_CLOCK_SRC == RTC_CLOCK_SRC_EXT_XTAL + /* Enable OSC_LP */ + SCU_ANALOG->ANAOSCLPCTRL &= ~SCU_ANALOG_ANAOSCLPCTRL_MODE_Msk; +#endif + + /* Update PCLK selection mux. */ + /* Fractional divider enabled, MCLK frequency equal DCO1 frequency or external crystal frequency */ + SCU_CLK->CLKCR = (1023UL <PASSWD = 0x000000C3UL; + + SystemCoreClockUpdate(); +} + +__WEAK void SystemCoreClockUpdate(void) +{ + static uint32_t IDIV, FDIV; + + IDIV = ((SCU_CLK->CLKCR) & SCU_CLK_CLKCR_IDIV_Msk) >> SCU_CLK_CLKCR_IDIV_Pos; + + if (IDIV != 0) + { + FDIV = ((SCU_CLK->CLKCR) & SCU_CLK_CLKCR_FDIV_Msk) >> SCU_CLK_CLKCR_FDIV_Pos; + FDIV |= ((SCU_CLK->CLKCR1) & SCU_CLK_CLKCR1_FDIV_Msk) << 8; + + /* Fractional divider is enabled and used */ + if (((SCU_CLK->CLKCR1) & SCU_CLK_CLKCR1_DCLKSEL_Msk) == 0U) + { + SystemCoreClock = ((uint32_t)((DCO1_FREQUENCY << 6U) / ((IDIV << 10) + FDIV))) << 4U; + } + else + { + SystemCoreClock = ((uint32_t)((OSCHP_GetFrequency() << 6U) / ((IDIV << 10) + FDIV))) << 4U; + } + } + else + { + /* Fractional divider bypassed. */ + if (((SCU_CLK->CLKCR1) & SCU_CLK_CLKCR1_DCLKSEL_Msk) == 0U) + { + SystemCoreClock = DCO1_FREQUENCY; + } + else + { + SystemCoreClock = OSCHP_GetFrequency(); + } + } +} + +__WEAK uint32_t OSCHP_GetFrequency(void) +{ + return OSCHP_FREQUENCY; +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/boot.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/boot.c new file mode 100644 index 00000000..bf770b9e --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/boot.c @@ -0,0 +1,351 @@ +/************************************************************************************//** +* \file Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_GCC\Prog\boot.c +* \brief Demo program bootloader interface source file. +* \ingroup Prog_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +* \internal +*---------------------------------------------------------------------------------------- +* C O P Y R I G H T +*---------------------------------------------------------------------------------------- +* Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +* +*---------------------------------------------------------------------------------------- +* L I C E N S E +*---------------------------------------------------------------------------------------- +* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published by the Free +* Software Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You have received a copy of the GNU General Public License along with OpenBLT. It +* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +* +* \endinternal +****************************************************************************************/ + +/**************************************************************************************** +* Include files +****************************************************************************************/ +#include "header.h" /* generic header */ +#include "xmc_gpio.h" /* GPIO module */ +#include "xmc_uart.h" /* UART driver header */ +#include "xmc_can.h" /* CAN driver header */ + + +/**************************************************************************************** +* Function prototypes +****************************************************************************************/ +#if (BOOT_COM_UART_ENABLE > 0) +static void BootComUartInit(void); +static void BootComUartCheckActivationRequest(void); +#endif +#if (BOOT_COM_CAN_ENABLE > 0) +static void BootComCanInit(void); +static void BootComCanCheckActivationRequest(void); +#endif + +/************************************************************************************//** +** \brief Initializes the communication interface. +** \return none. +** +****************************************************************************************/ +void BootComInit(void) +{ +#if (BOOT_COM_UART_ENABLE > 0) + BootComUartInit(); +#endif +#if (BOOT_COM_CAN_ENABLE > 0) + BootComCanInit(); +#endif +} /*** end of BootComInit ***/ + + +/************************************************************************************//** +** \brief Receives the CONNECT request from the host, which indicates that the +** bootloader should be activated and, if so, activates it. +** \return none. +** +****************************************************************************************/ +void BootComCheckActivationRequest(void) +{ +#if (BOOT_COM_UART_ENABLE > 0) + BootComUartCheckActivationRequest(); +#endif +#if (BOOT_COM_CAN_ENABLE > 0) + BootComCanCheckActivationRequest(); +#endif +} /*** end of BootComCheckActivationRequest ***/ + + +/************************************************************************************//** +** \brief Bootloader activation function. +** \return none. +** +****************************************************************************************/ +void BootActivate(void) +{ + /* perform software reset to activate the bootoader again */ + NVIC_SystemReset(); +} /*** end of BootActivate ***/ + + +#if (BOOT_COM_UART_ENABLE > 0) +/**************************************************************************************** +* U N I V E R S A L A S Y N C H R O N O U S R X T X I N T E R F A C E +****************************************************************************************/ + +/**************************************************************************************** +* Function prototypes +****************************************************************************************/ +static unsigned char UartReceiveByte(unsigned char *data); + + +/************************************************************************************//** +** \brief Initializes the UART communication interface. +** \return none. +** +****************************************************************************************/ +static void BootComUartInit(void) +{ + XMC_GPIO_CONFIG_t rx_config; + XMC_GPIO_CONFIG_t tx_config; + XMC_UART_CH_CONFIG_t uart_config; + + /* set configuration and initialize UART channel */ + uart_config.baudrate = BOOT_COM_UART_BAUDRATE; + uart_config.data_bits = 8; + uart_config.frame_length = 8; + uart_config.stop_bits = 1; + uart_config.oversampling = 16; + uart_config.parity_mode = XMC_USIC_CH_PARITY_MODE_NONE; + XMC_UART_CH_Init(XMC_UART0_CH1, &uart_config); + /* initialize UART Rx pin */ + rx_config.mode = XMC_GPIO_MODE_INPUT_TRISTATE; + XMC_GPIO_Init(P1_3, &rx_config); + /* initialize UART Tx pin */ + tx_config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT7; + XMC_GPIO_Init(P1_2, &tx_config); + /* set input source path to DXnA to connect P1_3 to ASC Receive. note that this + * function must be called after XMC_UART_CH_Init(), which is called when initializing + * the bootloader core with BootInit(). + */ + XMC_UART_CH_SetInputSource(XMC_UART0_CH1, XMC_UART_CH_INPUT_RXD, USIC0_C1_DX0_P1_3); + /* configure small transmit and receive FIFO */ + XMC_USIC_CH_TXFIFO_Configure(XMC_UART0_CH1, 16U, XMC_USIC_CH_FIFO_SIZE_16WORDS, 1U); + XMC_USIC_CH_RXFIFO_Configure(XMC_UART0_CH1, 0U, XMC_USIC_CH_FIFO_SIZE_16WORDS, 1U); + /* start UART */ + XMC_UART_CH_Start(XMC_UART0_CH1); +} /*** end of BootComUartInit ***/ + + +/************************************************************************************//** +** \brief Receives the CONNECT request from the host, which indicates that the +** bootloader should be activated and, if so, activates it. +** \return none. +** +****************************************************************************************/ +static void BootComUartCheckActivationRequest(void) +{ + static unsigned char xcpCtoReqPacket[BOOT_COM_UART_RX_MAX_DATA+1]; + static unsigned char xcpCtoRxLength; + static unsigned char xcpCtoRxInProgress = 0; + + /* start of cto packet received? */ + if (xcpCtoRxInProgress == 0) + { + /* store the message length when received */ + if (UartReceiveByte(&xcpCtoReqPacket[0]) == 1) + { + /* indicate that a cto packet is being received */ + xcpCtoRxInProgress = 1; + + /* reset packet data count */ + xcpCtoRxLength = 0; + } + } + else + { + /* store the next packet byte */ + if (UartReceiveByte(&xcpCtoReqPacket[xcpCtoRxLength+1]) == 1) + { + /* increment the packet data count */ + xcpCtoRxLength++; + + /* check to see if the entire packet was received */ + if (xcpCtoRxLength == xcpCtoReqPacket[0]) + { + /* done with cto packet reception */ + xcpCtoRxInProgress = 0; + + /* check if this was an XCP CONNECT command */ + if ((xcpCtoReqPacket[1] == 0xff) && (xcpCtoReqPacket[2] == 0x00)) + { + /* connection request received so start the bootloader */ + BootActivate(); + } + } + } + } +} /*** end of BootComUartCheckActivationRequest ***/ + + +/************************************************************************************//** +** \brief Receives a communication interface byte if one is present. +** \param data Pointer to byte where the data is to be stored. +** \return 1 if a byte was received, 0 otherwise. +** +****************************************************************************************/ +static unsigned char UartReceiveByte(unsigned char *data) +{ + if (XMC_USIC_CH_RXFIFO_IsEmpty(XMC_UART0_CH1) == 0) + { + /* retrieve and store the newly received byte */ + *data = (unsigned char)XMC_UART_CH_GetReceivedData(XMC_UART0_CH1); + /* all done */ + return 1; + } + /* still here to no new byte received */ + return 0; +} /*** end of UartReceiveByte ***/ +#endif /* BOOT_COM_UART_ENABLE > 0 */ + + +#if (BOOT_COM_CAN_ENABLE > 0) +/**************************************************************************************** +* C O N T R O L L E R A R E A N E T W O R K I N T E R F A C E +****************************************************************************************/ + +/**************************************************************************************** +* Local data declarations +****************************************************************************************/ +/** \brief Receive message object data structure. */ +static XMC_CAN_MO_t receiveMsgObj; + + +/************************************************************************************//** +** \brief Initializes the CAN communication interface. +** \return none. +** +****************************************************************************************/ +static void BootComCanInit(void) +{ + XMC_GPIO_CONFIG_t rx_can_config; + XMC_GPIO_CONFIG_t tx_can_config; + unsigned char byteIdx; + unsigned long canModuleFreqHz; + XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t baud; + + /* decide on fCAN frequency. it should be in the 5-120MHz range. according to the + * datasheet, it must be at least 12MHz if 1 node (channel) is used with up to + * 16 message objects. This is sufficient for this CAN driver. + */ + canModuleFreqHz = XMC_SCU_CLOCK_GetPeripheralClockFrequency(); + /* increase if too low */ + while (canModuleFreqHz < 12000000) + { + canModuleFreqHz *= 2; + } + /* decrease if too high */ + while (canModuleFreqHz > 120000000) + { + canModuleFreqHz /= 2; + } + + /* configure CAN module*/ + XMC_CAN_Init(CAN, XMC_CAN_CANCLKSRC_MCLK, canModuleFreqHz); + + /* configure CAN node baudrate */ + baud.can_frequency = canModuleFreqHz; + baud.baudrate = BOOT_COM_CAN_BAUDRATE; + baud.sample_point = 8000; + baud.sjw = 1, + XMC_CAN_NODE_NominalBitTimeConfigure(CAN_NODE1, &baud); + + /* set CCE and INIT bit NCR for node configuration */ + XMC_CAN_NODE_EnableConfigurationChange(CAN_NODE1); + XMC_CAN_NODE_SetInitBit(CAN_NODE1); + + /* configure the receive message object */ + receiveMsgObj.can_mo_ptr = CAN_MO1; + receiveMsgObj.can_priority = XMC_CAN_ARBITRATION_MODE_IDE_DIR_BASED_PRIO_2; + receiveMsgObj.can_identifier = BOOT_COM_CAN_RX_MSG_ID; + receiveMsgObj.can_id_mask= BOOT_COM_CAN_RX_MSG_ID; + receiveMsgObj.can_id_mode = XMC_CAN_FRAME_TYPE_STANDARD_11BITS; + receiveMsgObj.can_ide_mask = 1; + receiveMsgObj.can_data_length = BOOT_COM_CAN_RX_MAX_DATA; + for (byteIdx=0; byteIdx 0 */ + + +/*********************************** end of boot.c *************************************/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/boot.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/boot.h new file mode 100644 index 00000000..908ed39c --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/boot.h @@ -0,0 +1,40 @@ +/************************************************************************************//** +* \file Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_GCC\Prog\boot.h +* \brief Demo program bootloader interface header file. +* \ingroup Prog_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +* \internal +*---------------------------------------------------------------------------------------- +* C O P Y R I G H T +*---------------------------------------------------------------------------------------- +* Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +* +*---------------------------------------------------------------------------------------- +* L I C E N S E +*---------------------------------------------------------------------------------------- +* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published by the Free +* Software Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You have received a copy of the GNU General Public License along with OpenBLT. It +* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +* +* \endinternal +****************************************************************************************/ +#ifndef BOOT_H +#define BOOT_H + +/**************************************************************************************** +* Function prototypes +****************************************************************************************/ +void BootComInit(void); +void BootComCheckActivationRequest(void); +void BootActivate(void); + + +#endif /* BOOT_H */ +/*********************************** end of boot.h *************************************/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/header.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/header.h new file mode 100644 index 00000000..63c8fa80 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/header.h @@ -0,0 +1,42 @@ +/************************************************************************************//** +* \file Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_GCC\Prog\header.h +* \brief Generic header file. +* \ingroup Prog_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +* \internal +*---------------------------------------------------------------------------------------- +* C O P Y R I G H T +*---------------------------------------------------------------------------------------- +* Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +* +*---------------------------------------------------------------------------------------- +* L I C E N S E +*---------------------------------------------------------------------------------------- +* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published by the Free +* Software Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You have received a copy of the GNU General Public License along with OpenBLT. It +* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +* +* \endinternal +****************************************************************************************/ +#ifndef HEADER_H +#define HEADER_H + +/**************************************************************************************** +* Include files +****************************************************************************************/ +#include "../Boot/blt_conf.h" /* bootloader configuration */ +#include "XMC1400.h" /* XMC1400 peripheral access */ +#include "boot.h" /* bootloader interface driver */ +#include "led.h" /* LED driver */ +#include "timer.h" /* Timer driver */ + + +#endif /* HEADER_H */ +/*********************************** end of header.h ***********************************/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/led.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/led.c new file mode 100644 index 00000000..76140fcf --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/led.c @@ -0,0 +1,95 @@ +/************************************************************************************//** +* \file Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_GCC\Prog\led.c +* \brief LED driver source file. +* \ingroup Prog_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +* \internal +*---------------------------------------------------------------------------------------- +* C O P Y R I G H T +*---------------------------------------------------------------------------------------- +* Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +* +*---------------------------------------------------------------------------------------- +* L I C E N S E +*---------------------------------------------------------------------------------------- +* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published by the Free +* Software Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You have received a copy of the GNU General Public License along with OpenBLT. It +* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +* +* \endinternal +****************************************************************************************/ + +/**************************************************************************************** +* Include files +****************************************************************************************/ +#include "header.h" /* generic header */ +#include "xmc_gpio.h" /* GPIO module */ + + +/**************************************************************************************** +* Macro definitions +****************************************************************************************/ +/** \brief Toggle interval time in milliseconds. */ +#define LED_TOGGLE_MS (500) + + +/************************************************************************************//** +** \brief Initializes the LED. The board doesn't have a dedicted LED so an +** indicator on the LCD is used instead. +** \return none. +** +****************************************************************************************/ +void LedInit(void) +{ + /* initialize and turn off the LED */ + XMC_GPIO_SetMode(P4_0, XMC_GPIO_MODE_OUTPUT_PUSH_PULL); + XMC_GPIO_SetOutputLevel(P4_0, XMC_GPIO_OUTPUT_LEVEL_HIGH); +} /*** end of LedInit ***/ + + +/************************************************************************************//** +** \brief Toggles the LED at a fixed time interval. +** \return none. +** +****************************************************************************************/ +void LedToggle(void) +{ + static unsigned char led_toggle_state = 0; + static unsigned long timer_counter_last = 0; + unsigned long timer_counter_now; + + /* check if toggle interval time passed */ + timer_counter_now = TimerGet(); + if ( (timer_counter_now - timer_counter_last) < LED_TOGGLE_MS) + { + /* not yet time to toggle */ + return; + } + + /* determine toggle action */ + if (led_toggle_state == 0) + { + led_toggle_state = 1; + /* turn the LED on */ + XMC_GPIO_SetOutputLevel(P4_0, XMC_GPIO_OUTPUT_LEVEL_LOW); + } + else + { + led_toggle_state = 0; + /* turn the LED off */ + XMC_GPIO_SetOutputLevel(P4_0, XMC_GPIO_OUTPUT_LEVEL_HIGH); + } + + /* store toggle time to determine next toggle interval */ + timer_counter_last = timer_counter_now; +} /*** end of LedToggle ***/ + + +/*********************************** end of led.c **************************************/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/led.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/led.h new file mode 100644 index 00000000..137daedd --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/led.h @@ -0,0 +1,39 @@ +/************************************************************************************//** +* \file Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_GCC\Prog\led.h +* \brief LED driver header file. +* \ingroup Prog_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +* \internal +*---------------------------------------------------------------------------------------- +* C O P Y R I G H T +*---------------------------------------------------------------------------------------- +* Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +* +*---------------------------------------------------------------------------------------- +* L I C E N S E +*---------------------------------------------------------------------------------------- +* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published by the Free +* Software Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You have received a copy of the GNU General Public License along with OpenBLT. It +* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +* +* \endinternal +****************************************************************************************/ +#ifndef LED_H +#define LED_H + +/**************************************************************************************** +* Function prototypes +****************************************************************************************/ +void LedInit(void); +void LedToggle(void); + + +#endif /* LED_H */ +/*********************************** end of led.h **************************************/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/linker_script.ld b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/linker_script.ld new file mode 100644 index 00000000..ce0ef878 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/linker_script.ld @@ -0,0 +1,295 @@ +/** + * @file XMC1400x0200.ld + * @date 2017-04-20 + * + * @cond + ********************************************************************************************************************* + * Linker file for the GNU C Compiler v1.6 + * Supported devices: XMC1402-Q064X0200 + * XMC1402-T038X0200 + * XMC1402-Q040X0200 + * XMC1402-Q048X0200 + * XMC1403-Q040X0200 + * XMC1403-Q048X0200 + * XMC1403-Q064X0200 + * XMC1404-Q048X0200 + * XMC1404-Q064X0200 + * XMC1404-F064X0200 + * + * Copyright (c) 2015-2017, Infineon Technologies AG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the + * following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the distribution. + * + * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with + * Infineon Technologies AG dave@infineon.com). + ********************************************************************************************************************* + * + * Change History + * -------------- + * + * 2015-07-07: + * - Product splitting + * - Copyright notice update + * + * 2015-11-24: + * - Compatibility with GCC 4.9 2015q2 + * + * 2016-03-15: + * - Add assertion to check that region SRAM_combined does not overflowed no_init section + * + * 2016-06-07: + * - Add XMC1403-Q040X0200 + * + * 2016-07-20: + * - Add XMC1402-T038X0200, XMC1402-Q040X0200, XMC1402-Q048X0200 + * + * 2016-10-28: + * - Fix linker not complaining if sum of data + text sections is bigger that physical FLASH size + * + * 2017-04-07: + * - Added new symbols __text_size and eText + * + * 2017-04-20: + * - Change vtable location to flash area to save ram + * + * @endcond + * + */ + +OUTPUT_FORMAT("elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(Reset_Handler) + +MEMORY +{ + FLASH(RX) : ORIGIN = 0x10003000, LENGTH = 0x30000 + SRAM(!RX) : ORIGIN = 0x20000000, LENGTH = 0x4000 +} + +stack_size = DEFINED(stack_size) ? stack_size : 1024; +no_init_size = 4; + +SECTIONS +{ + /* TEXT section */ + + .text : + { + sText = .; + KEEP(*(.reset)); + *(.text .text.* .gnu.linkonce.t.*); + + /* C++ Support */ + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata .rodata.*) + *(.gnu.linkonce.r*) + + *(vtable) + + . = ALIGN(4); + } > FLASH + + .eh_frame_hdr : ALIGN (4) + { + KEEP (*(.eh_frame_hdr)) + } > FLASH + + .eh_frame : ALIGN (4) + { + KEEP (*(.eh_frame)) + } > FLASH + + /* Exception handling, exidx needs a dedicated section */ + .ARM.extab : ALIGN(4) + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + . = ALIGN(4); + __exidx_start = .; + .ARM.exidx : ALIGN(4) + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + . = ALIGN(4); + + /* DSRAM layout (Lowest to highest)*/ + /* Veneer <-> Stack <-> DATA <-> BSS <-> HEAP */ + + .VENEER_Code ABSOLUTE(0x2000000C): + { + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + VeneerStart = .; + KEEP(*(.XmcVeneerCode)); + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + VeneerEnd = .; + } > SRAM AT > FLASH + eROData = LOADADDR (.VENEER_Code); + VeneerSize = ABSOLUTE(VeneerEnd) - ABSOLUTE(VeneerStart); + + /* Dummy section for stack */ + Stack (NOLOAD) : AT(0) + { + . = ALIGN(8); + . = . + stack_size; + __initial_sp = .; + } > SRAM + + /* Standard DATA and user defined DATA/BSS/CONST sections */ + .data : + { + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __data_start = .; + * (.data); + * (.data*); + *(*.data); + *(.gnu.linkonce.d*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __data_end = .; + } > SRAM AT > FLASH + DataLoadAddr = LOADADDR (.data); + __data_size = __data_end - __data_start; + + .ram_code : + { + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __ram_code_start = .; + /* functions with __attribute__ ((section (".ram_code")))*/ + *(.ram_code) + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __ram_code_end = .; + } > SRAM AT > FLASH + __ram_code_load = LOADADDR (.ram_code); + __ram_code_size = __ram_code_end - __ram_code_start; + + __text_size = (__exidx_end - sText) + VeneerSize + __data_size + __ram_code_size; + eText = sText + __text_size; + + /* BSS section */ + .bss (NOLOAD) : + { + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __bss_start = .; + * (.bss); + * (.bss*); + * (COMMON); + *(.gnu.linkonce.b*) + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __bss_end = .; + . = ALIGN(8); + Heap_Bank1_Start = .; + } > SRAM + __bss_size = __bss_end - __bss_start; + + /* .no_init section contains SystemCoreClock. See system.c file */ + .no_init ORIGIN(SRAM) + LENGTH(SRAM) - no_init_size (NOLOAD) : + { + Heap_Bank1_End = .; + * (.no_init); + } > SRAM + + /* Heap - Bank1*/ + Heap_Bank1_Size = Heap_Bank1_End - Heap_Bank1_Start; + + ASSERT(Heap_Bank1_Start <= Heap_Bank1_End, "region SRAM overflowed no_init section") + + /DISCARD/ : + { + *(.comment) + } + + .stab 0 (NOLOAD) : { *(.stab) } + .stabstr 0 (NOLOAD) : { *(.stabstr) } + + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_pubtypes 0 : { *(.debug_pubtypes) } + + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + + /* DWARF 2.1 */ + .debug_ranges 0 : { *(.debug_ranges) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + + /* Build attributes */ + .build_attributes 0 : { *(.ARM.attributes) } +} diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/main.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/main.c new file mode 100644 index 00000000..48a64488 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/main.c @@ -0,0 +1,80 @@ +/************************************************************************************//** +* \file Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_GCC\Prog\main.c +* \brief Demo program application source file. +* \ingroup Prog_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +* \internal +*---------------------------------------------------------------------------------------- +* C O P Y R I G H T +*---------------------------------------------------------------------------------------- +* Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +* +*---------------------------------------------------------------------------------------- +* L I C E N S E +*---------------------------------------------------------------------------------------- +* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published by the Free +* Software Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You have received a copy of the GNU General Public License along with OpenBLT. It +* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +* +* \endinternal +****************************************************************************************/ + +/**************************************************************************************** +* Include files +****************************************************************************************/ +#include "header.h" /* generic header */ + + +/**************************************************************************************** +* Function prototypes +****************************************************************************************/ +static void Init(void); + + +/************************************************************************************//** +** \brief This is the entry point for the bootloader application and is called +** by the reset interrupt vector after the C-startup routines executed. +** \return Program exit code. +** +****************************************************************************************/ +int main(void) +{ + /* initialize the microcontroller */ + Init(); + /* initialize the bootloader interface */ + BootComInit(); + + /* start the infinite program loop */ + while (1) + { + /* toggle LED with a fixed frequency */ + LedToggle(); + /* check for bootloader activation request */ + BootComCheckActivationRequest(); + } + return 0; +} /*** end of main ***/ + + +/************************************************************************************//** +** \brief Initializes the microcontroller. +** \return none. +** +****************************************************************************************/ +static void Init(void) +{ + /* init the led driver */ + LedInit(); + /* init the timer driver */ + TimerInit(); +} /*** end of Init ***/ + + +/*********************************** end of main.c *************************************/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/prog.dox b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/prog.dox new file mode 100644 index 00000000..badce026 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/prog.dox @@ -0,0 +1,7 @@ +/** +\defgroup Prog_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC User Program +\brief User Program. +\ingroup ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +*/ + + diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/timer.c b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/timer.c new file mode 100644 index 00000000..e03d393f --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/timer.c @@ -0,0 +1,106 @@ +/************************************************************************************//** +* \file Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_GCC\Prog\timer.c +* \brief Timer driver source file. +* \ingroup Prog_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +* \internal +*---------------------------------------------------------------------------------------- +* C O P Y R I G H T +*---------------------------------------------------------------------------------------- +* Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +* +*---------------------------------------------------------------------------------------- +* L I C E N S E +*---------------------------------------------------------------------------------------- +* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published by the Free +* Software Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You have received a copy of the GNU General Public License along with OpenBLT. It +* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +* +* \endinternal +****************************************************************************************/ + +/**************************************************************************************** +* Include files +****************************************************************************************/ +#include "header.h" /* generic header */ + + +/**************************************************************************************** +* Local data declarations +****************************************************************************************/ +/** \brief Local variable for storing the number of milliseconds that have elapsed since + * startup. + */ +static unsigned long millisecond_counter; + + +/************************************************************************************//** +** \brief Initializes the timer. +** \return none. +** +****************************************************************************************/ +void TimerInit(void) +{ + /* configure the SysTick timer for 1 ms period */ + SysTick_Config(SystemCoreClock / 1000); + /* reset the millisecond counter */ + TimerSet(0); +} /*** end of TimerInit ***/ + + +/************************************************************************************//** +** \brief Stops and disables the timer. +** \return none. +** +****************************************************************************************/ +void TimerDeinit(void) +{ + SysTick->CTRL = 0; +} /*** end of TimerDeinit ***/ + + +/************************************************************************************//** +** \brief Sets the initial counter value of the millisecond timer. +** \param timer_value initialize value of the millisecond timer. +** \return none. +** +****************************************************************************************/ +void TimerSet(unsigned long timer_value) +{ + /* set the millisecond counter */ + millisecond_counter = timer_value; +} /*** end of TimerSet ***/ + + +/************************************************************************************//** +** \brief Obtains the counter value of the millisecond timer. +** \return Current value of the millisecond timer. +** +****************************************************************************************/ +unsigned long TimerGet(void) +{ + /* read and return the millisecond counter value */ + return millisecond_counter; +} /*** end of TimerGet ***/ + + +/************************************************************************************//** +** \brief Interrupt service routine of the timer. +** \return none. +** +****************************************************************************************/ +void SysTick_Handler(void) +{ + /* increment the millisecond counter */ + millisecond_counter++; +} /*** end of SysTick_Handler ***/ + + +/*********************************** end of timer.c ************************************/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/timer.h b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/timer.h new file mode 100644 index 00000000..d3ed7112 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/Prog/timer.h @@ -0,0 +1,40 @@ +/************************************************************************************//** +* \file Demo\ARMCM0_XMC1_XMC1400_Boot_Kit_GCC\Prog\timer.h +* \brief Timer driver header file. +* \ingroup Prog_ARMCM0_XMC1_XMC1400_Boot_Kit_GCC +* \internal +*---------------------------------------------------------------------------------------- +* C O P Y R I G H T +*---------------------------------------------------------------------------------------- +* Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +* +*---------------------------------------------------------------------------------------- +* L I C E N S E +*---------------------------------------------------------------------------------------- +* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published by the Free +* Software Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You have received a copy of the GNU General Public License along with OpenBLT. It +* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +* +* \endinternal +****************************************************************************************/ +#ifndef TIMER_H +#define TIMER_H + +/**************************************************************************************** +* Function prototypes +****************************************************************************************/ +void TimerInit(void); +void TimerDeinit(void); +void TimerSet(unsigned long timer_value); +unsigned long TimerGet(void); + +#endif /* TIMER_H */ +/*********************************** end of timer.h ************************************/ diff --git a/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/demo.dox b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/demo.dox new file mode 100644 index 00000000..3d7b6916 --- /dev/null +++ b/Target/Demo/ARMCM0_XMC1_XMC1400_Boot_Kit_GCC/demo.dox @@ -0,0 +1,9 @@ +/** +\defgroup ARMCM0_XMC1_XMC1400_Boot_Kit_GCC Demo for XMC1400 Boot Kit/GCC +\brief Preconfigured programs for the Infineon XMC1400 Boot Kit board and the Dave 4 + development environment, which is based on the ARM GCC toolchain. +\details Refer to http://feaser.com/openblt/doku.php?id=manual:demos + for detailed getting started instructions. +*/ + + diff --git a/Target/Source/ARMCM0_XMC1/GCC/cpu_comp.c b/Target/Source/ARMCM0_XMC1/GCC/cpu_comp.c new file mode 100644 index 00000000..ecfa62ad --- /dev/null +++ b/Target/Source/ARMCM0_XMC1/GCC/cpu_comp.c @@ -0,0 +1,58 @@ +/************************************************************************************//** +* \file Source\ARMCM0_XMC1\GCC\cpu_comp.c +* \brief Bootloader cpu module source file. +* \ingroup Target_ARMCM0_XMC1 +* \internal +*---------------------------------------------------------------------------------------- +* C O P Y R I G H T +*---------------------------------------------------------------------------------------- +* Copyright (c) 2017 by Feaser http://www.feaser.com All rights reserved +* +*---------------------------------------------------------------------------------------- +* L I C E N S E +*---------------------------------------------------------------------------------------- +* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or +* modify it under the terms of the GNU General Public License as published by the Free +* Software Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +* PURPOSE. See the GNU General Public License for more details. +* +* You have received a copy of the GNU General Public License along with OpenBLT. It +* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. +* +* \endinternal +****************************************************************************************/ + +/**************************************************************************************** +* Include files +****************************************************************************************/ +#include "boot.h" /* bootloader generic header */ +#include "cmsis_compiler.h" /* compiler specific CMSIS header */ + + +/************************************************************************************//** +** \brief Disable global interrupts. +** \return none. +** +****************************************************************************************/ +void CpuIrqDisable(void) +{ + __disable_irq(); +} /*** end of CpuIrqDisable ***/ + + +/************************************************************************************//** +** \brief Enable global interrupts. +** \return none. +** +****************************************************************************************/ +void CpuIrqEnable(void) +{ + __enable_irq(); +} /*** end of CpuIrqEnable ***/ + + +/*********************************** end of cpu_comp.c *********************************/ diff --git a/Target/Source/ARMCM0_XMC1/GCC/memory.x b/Target/Source/ARMCM0_XMC1/GCC/memory.x new file mode 100644 index 00000000..ff7e585d --- /dev/null +++ b/Target/Source/ARMCM0_XMC1/GCC/memory.x @@ -0,0 +1,218 @@ +OUTPUT_FORMAT("elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(Reset_Handler) + +MEMORY +{ + FLASH(RX) : ORIGIN = 0x10001000, LENGTH = 0x8000 + SRAM(!RX) : ORIGIN = 0x20000000, LENGTH = 0x2000 +} + +stack_size = DEFINED(stack_size) ? stack_size : 2048; +no_init_size = 4; + +SECTIONS +{ + /* TEXT section */ + + .text : + { + sText = .; + KEEP(*(.reset)); + *(.text .text.* .gnu.linkonce.t.*); + + /* C++ Support */ + KEEP(*(.init)) + KEEP(*(.fini)) + + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.rodata .rodata.*) + *(.gnu.linkonce.r*) + + *(vtable) + + . = ALIGN(4); + } > FLASH + + .eh_frame_hdr : ALIGN (4) + { + KEEP (*(.eh_frame_hdr)) + } > FLASH + + .eh_frame : ALIGN (4) + { + KEEP (*(.eh_frame)) + } > FLASH + + /* Exception handling, exidx needs a dedicated section */ + .ARM.extab : ALIGN(4) + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + . = ALIGN(4); + __exidx_start = .; + .ARM.exidx : ALIGN(4) + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; + . = ALIGN(4); + + /* DSRAM layout (Lowest to highest)*/ + /* Veneer <-> Stack <-> DATA <-> BSS <-> HEAP */ + + .VENEER_Code ABSOLUTE(0x2000000C): + { + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + VeneerStart = .; + KEEP(*(.XmcVeneerCode)); + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + VeneerEnd = .; + } > SRAM AT > FLASH + eROData = LOADADDR (.VENEER_Code); + VeneerSize = ABSOLUTE(VeneerEnd) - ABSOLUTE(VeneerStart); + + /* Dummy section for stack */ + Stack (NOLOAD) : AT(0) + { + . = ALIGN(8); + . = . + stack_size; + __initial_sp = .; + } > SRAM + + /* Standard DATA and user defined DATA/BSS/CONST sections */ + .data : + { + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __data_start = .; + * (.data); + * (.data*); + *(*.data); + *(.gnu.linkonce.d*) + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __data_end = .; + } > SRAM AT > FLASH + DataLoadAddr = LOADADDR (.data); + __data_size = __data_end - __data_start; + + .ram_code : + { + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __ram_code_start = .; + /* functions with __attribute__ ((section (".ram_code")))*/ + *(.ram_code) + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __ram_code_end = .; + } > SRAM AT > FLASH + __ram_code_load = LOADADDR (.ram_code); + __ram_code_size = __ram_code_end - __ram_code_start; + + __text_size = (__exidx_end - sText) + VeneerSize + __data_size + __ram_code_size; + eText = sText + __text_size; + + /* BSS section */ + .bss (NOLOAD) : + { + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __bss_start = .; + * (.bss); + * (.bss*); + * (COMMON); + *(.gnu.linkonce.b*) + . = ALIGN(4); /* section size must be multiply of 4. See startup.S file */ + __bss_end = .; + . = ALIGN(8); + Heap_Bank1_Start = .; + } > SRAM + __bss_size = __bss_end - __bss_start; + + /* .no_init section contains SystemCoreClock. See system.c file */ + .no_init ORIGIN(SRAM) + LENGTH(SRAM) - no_init_size (NOLOAD) : + { + Heap_Bank1_End = .; + * (.no_init); + } > SRAM + + /* Heap - Bank1*/ + Heap_Bank1_Size = Heap_Bank1_End - Heap_Bank1_Start; + + ASSERT(Heap_Bank1_Start <= Heap_Bank1_End, "region SRAM overflowed no_init section") + + /DISCARD/ : + { + *(.comment) + } + + .stab 0 (NOLOAD) : { *(.stab) } + .stabstr 0 (NOLOAD) : { *(.stabstr) } + + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_pubtypes 0 : { *(.debug_pubtypes) } + + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + + /* DWARF 2.1 */ + .debug_ranges 0 : { *(.debug_ranges) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + + /* Build attributes */ + .build_attributes 0 : { *(.ARM.attributes) } +} diff --git a/Target/Source/ARMCM0_XMC1/cpu.c b/Target/Source/ARMCM0_XMC1/cpu.c index b1174369..1b58a742 100644 --- a/Target/Source/ARMCM0_XMC1/cpu.c +++ b/Target/Source/ARMCM0_XMC1/cpu.c @@ -99,7 +99,7 @@ void CpuStartUserProgram(void) * user program's reset handler. */ pProgResetHandler = (void(*)(void))(*((blt_addr *)CPU_USER_PROGRAM_STARTADDR_PTR)); - /* The Cortex-M4 core has interrupts enabled out of reset. the bootloader + /* The Cortex-M0 core has interrupts enabled out of reset. the bootloader * explicitly disables these for security reasons. Enable them here again, so it does * not have to be done by the user program. */