From 6be40fd2275271a780a96f07989fb1033654aac2 Mon Sep 17 00:00:00 2001 From: cinsights Date: Fri, 16 Apr 2021 01:33:11 +0000 Subject: [PATCH] Fix assignment of currcore when PORT_CORES_NUMBER not defined git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14195 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/rt/include/chsys.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/os/rt/include/chsys.h b/os/rt/include/chsys.h index c9838a990..2449ad31c 100644 --- a/os/rt/include/chsys.h +++ b/os/rt/include/chsys.h @@ -60,14 +60,18 @@ * @brief Access to current core's instance structure. */ #if defined(PORT_INSTANCE_ACCESS) -#define currcore PORT_INSTANCE_ACCESS -#else -#if (PORT_CORES_NUMBER == 0) || defined(__DOXYGEN__) -#define currcore (&ch0) -#else -#define currcore ch_system.instances[port_get_core_id()] -#endif -#endif + #define currcore PORT_INSTANCE_ACCESS +#else /* !defined(PORT_INSTANCE_ACCESS) */ + #if defined(PORT_CORES_NUMBER) + #if (PORT_CORES_NUMBER > 1) || defined(__DOXYGEN__) + #define currcore ch_system.instances[port_get_core_id()] + #else + #define currcore (&ch0) + #endif + #else + #define currcore (&ch0) + #endif /* defined(PORT_CORES_NUMBER) */ +#endif /* defined(PORT_INSTANCE_ACCESS) */ /*===========================================================================*/ /* Module macros. */