You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2023/05/31 18:53:05 UTC
[nuttx] 03/05: arch/risc-v/src/mpfs/mpfs_corespi.c: Fix the usage of MPFS_CORESPI_INSTANCES macro
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 8d646fc49c247a706a5308b94d3d95a4eefc15a5
Author: Jukka Laitinen <ju...@ssrc.tii.ae>
AuthorDate: Tue May 16 11:24:01 2023 +0300
arch/risc-v/src/mpfs/mpfs_corespi.c: Fix the usage of MPFS_CORESPI_INSTANCES macro
Signed-off-by: Jukka Laitinen <ju...@ssrc.tii.ae>
---
arch/risc-v/src/mpfs/mpfs_corespi.c | 42 ++++++++++++++++++++++---------------
1 file changed, 25 insertions(+), 17 deletions(-)
diff --git a/arch/risc-v/src/mpfs/mpfs_corespi.c b/arch/risc-v/src/mpfs/mpfs_corespi.c
index 6180fa5ff1..85f77951b7 100644
--- a/arch/risc-v/src/mpfs/mpfs_corespi.c
+++ b/arch/risc-v/src/mpfs/mpfs_corespi.c
@@ -229,7 +229,7 @@ static const struct spi_ops_s mpfs_spi_ops =
static struct mpfs_spi_priv_s g_mpfs_spi_priv[MPFS_CORESPI_INSTANCES] =
{
-#if MPFS_CORESPI_INSTANCES < 2
+#if MPFS_CORESPI_INSTANCES > 0
[0] =
{
.spi_dev =
@@ -243,8 +243,9 @@ static struct mpfs_spi_priv_s g_mpfs_spi_priv[MPFS_CORESPI_INSTANCES] =
.devid = 0,
.lock = NXMUTEX_INITIALIZER,
.sem_isr = SEM_INITIALIZER(0),
- }
-#elif MPFS_CORESPI_INSTANCES == 2
+ },
+#endif
+#if MPFS_CORESPI_INSTANCES > 1
[1] =
{
.spi_dev =
@@ -258,8 +259,9 @@ static struct mpfs_spi_priv_s g_mpfs_spi_priv[MPFS_CORESPI_INSTANCES] =
.devid = 0,
.lock = NXMUTEX_INITIALIZER,
.sem_isr = SEM_INITIALIZER(0),
- }
-#elif MPFS_CORESPI_INSTANCES == 3
+ },
+#endif
+#if MPFS_CORESPI_INSTANCES > 2
[2] =
{
.spi_dev =
@@ -273,8 +275,9 @@ static struct mpfs_spi_priv_s g_mpfs_spi_priv[MPFS_CORESPI_INSTANCES] =
.devid = 0,
.lock = NXMUTEX_INITIALIZER,
.sem_isr = SEM_INITIALIZER(0),
- }
-#elif MPFS_CORESPI_INSTANCES == 4
+ },
+#endif
+#if MPFS_CORESPI_INSTANCES > 3
[3] =
{
.spi_dev =
@@ -288,8 +291,9 @@ static struct mpfs_spi_priv_s g_mpfs_spi_priv[MPFS_CORESPI_INSTANCES] =
.devid = 0,
.lock = NXMUTEX_INITIALIZER,
.sem_isr = SEM_INITIALIZER(0),
- }
-#elif MPFS_CORESPI_INSTANCES == 5
+ },
+#endif
+#if MPFS_CORESPI_INSTANCES > 4
[4] =
{
.spi_dev =
@@ -303,8 +307,9 @@ static struct mpfs_spi_priv_s g_mpfs_spi_priv[MPFS_CORESPI_INSTANCES] =
.devid = 0,
.lock = NXMUTEX_INITIALIZER,
.sem_isr = SEM_INITIALIZER(0),
- }
-#elif MPFS_CORESPI_INSTANCES == 6
+ },
+#endif
+#if MPFS_CORESPI_INSTANCES > 5
[5] =
{
.spi_dev =
@@ -318,8 +323,9 @@ static struct mpfs_spi_priv_s g_mpfs_spi_priv[MPFS_CORESPI_INSTANCES] =
.devid = 0,
.lock = NXMUTEX_INITIALIZER,
.sem_isr = SEM_INITIALIZER(0),
- }
-#elif MPFS_CORESPI_INSTANCES == 7
+ },
+#endif
+#if MPFS_CORESPI_INSTANCES > 6
[6] =
{
.spi_dev =
@@ -333,8 +339,9 @@ static struct mpfs_spi_priv_s g_mpfs_spi_priv[MPFS_CORESPI_INSTANCES] =
.devid = 0,
.lock = NXMUTEX_INITIALIZER,
.sem_isr = SEM_INITIALIZER(0),
- }
-#elif MPFS_CORESPI_INSTANCES == 8
+ },
+#endif
+#if MPFS_CORESPI_INSTANCES > 7
[7] =
{
.spi_dev =
@@ -348,8 +355,9 @@ static struct mpfs_spi_priv_s g_mpfs_spi_priv[MPFS_CORESPI_INSTANCES] =
.devid = 0,
.lock = NXMUTEX_INITIALIZER,
.sem_isr = SEM_INITIALIZER(0),
- }
-#else
+ },
+#endif
+#if MPFS_CORESPI_INSTANCES > 8
# error "Too many CoreSPI instances, maximum is 8"
#endif
};