You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/11/28 05:39:17 UTC

[incubator-nuttx] 24/24: boards/arm/lpc214x/zp214xpa/src/lpc2148_spi1.c: Fix syslog formats

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 4b6d117a937098d56ddc79b1ca1114dfe762f1c1
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Sat Nov 28 10:28:12 2020 +0900

    boards/arm/lpc214x/zp214xpa/src/lpc2148_spi1.c: Fix syslog formats
---
 boards/arm/lpc214x/zp214xpa/src/lpc2148_spi1.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/boards/arm/lpc214x/zp214xpa/src/lpc2148_spi1.c b/boards/arm/lpc214x/zp214xpa/src/lpc2148_spi1.c
index e31722b..078fe7b 100644
--- a/boards/arm/lpc214x/zp214xpa/src/lpc2148_spi1.c
+++ b/boards/arm/lpc214x/zp214xpa/src/lpc2148_spi1.c
@@ -65,6 +65,7 @@
 #include <nuttx/config.h>
 
 #include <sys/types.h>
+#include <inttypes.h>
 #include <stdint.h>
 #include <stdbool.h>
 #include <assert.h>
@@ -236,7 +237,7 @@ static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid,
       /* Enable slave select (low enables) */
 
       putreg32(bit, CS_CLR_REGISTER);
-      spiinfo("CS asserted: %08x->%08x\n",
+      spiinfo("CS asserted: %08" PRIx32 "->%08" PRIx32 "\n",
               regval, getreg32(CS_PIN_REGISTER));
     }
   else
@@ -244,7 +245,7 @@ static void spi_select(FAR struct spi_dev_s *dev, uint32_t devid,
       /* Disable slave select (low enables) */
 
       putreg32(bit, CS_SET_REGISTER);
-      spiinfo("CS de-asserted: %08x->%08x\n", regval,
+      spiinfo("CS de-asserted: %08" PRIx32 "->%08" PRIx32 "\n", regval,
                getreg32(CS_PIN_REGISTER));
 
       /* Wait for the TX FIFO not full indication */
@@ -302,7 +303,8 @@ static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev,
   divisor = (divisor + 1) & ~1;
   putreg8(divisor, LPC214X_SPI1_CPSR);
 
-  spiinfo("Frequency %d->%d\n", frequency, LPC214X_PCLKFREQ / divisor);
+  spiinfo("Frequency %" PRId32 "->%" PRId32 "\n",
+          frequency, (uint32_t)(LPC214X_PCLKFREQ / divisor));
   return LPC214X_PCLKFREQ / divisor;
 }
 
@@ -380,14 +382,16 @@ static int spi_cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd)
       /* L: the inputs at D0 to D7 are transferred to the command registers */
 
       putreg32(bit, CS_CLR_REGISTER);
-      spiinfo("Command: %08x->%08x\n", regval, getreg32(CS_PIN_REGISTER));
+      spiinfo("Command: %08" PRIx32 "->%08" PRIx32 "\n",
+              regval, getreg32(CS_PIN_REGISTER));
     }
   else
     {
       /* H: the inputs at D0 to D7 are treated as display data. */
 
       putreg32(bit, CS_SET_REGISTER);
-      spiinfo("Data: %08x->%08x\n", regval, getreg32(CS_PIN_REGISTER));
+      spiinfo("Data: %08" PRIx32 "->%08" PRIx32 "\n",
+              regval, getreg32(CS_PIN_REGISTER));
     }
 
   return OK;
@@ -429,7 +433,7 @@ static uint32_t spi_send(FAR struct spi_dev_s *dev, uint32_t wd)
   /* Get the value from the RX FIFO and return it */
 
   regval = getreg16(LPC214X_SPI1_DR);
-  spiinfo("%04x->%04x\n", wd, regval);
+  spiinfo("%04" PRIx32 "->%04x\n", wd, regval);
   return regval;
 }
 
@@ -545,7 +549,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer,
        * and (3) there are more bytes to be sent.
        */
 
-      spiinfo("TX: rxpending: %d nwords: %d\n", rxpending, nwords);
+      spiinfo("TX: rxpending: %" PRId32 " nwords: %d\n", rxpending, nwords);
       while ((getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_TNF) &&
              (rxpending < LPC214X_SPI1_FIFOSZ) && nwords)
         {
@@ -556,7 +560,7 @@ static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer,
 
       /* Now, read RX data from RX FIFO while RX FIFO is not empty */
 
-      spiinfo("RX: rxpending: %d\n", rxpending);
+      spiinfo("RX: rxpending: %" PRId32 "\n", rxpending);
       while (getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_RNE)
         {
           *ptr++ = (uint8_t)getreg16(LPC214X_SPI1_DR);
@@ -636,7 +640,8 @@ FAR struct spi_dev_s *lpc214x_spibus_initialize(int port)
   regval32 |= getreg32(CS_DIR_REGISTER);
   putreg32(regval32, CS_DIR_REGISTER);
 
-  spiinfo("CS Pin Config: PINSEL1: %08x PIN: %08x DIR: %08x\n",
+  spiinfo("CS Pin Config: PINSEL1: %08" PRIx32
+          " PIN: %08" PRIx32 " DIR: %08" PRIx32 "\n",
           getreg32(LPC214X_PINSEL1), getreg32(CS_PIN_REGISTER),
           getreg32(CS_DIR_REGISTER));