You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2022/04/11 22:55:06 UTC

[incubator-nuttx] branch master updated (a594a5d7a8 -> 64e5867a8b)

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

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


    from a594a5d7a8 sched/init: drivers_initialize() should be late than up_initialize()
     new 5be940080b arch: cxd56xx: update loader and gnssfw version
     new e725829547 cxd56xx/cxd56_emmc.c: Fix compile warning
     new 39f7c4aea0 arch: cxd56xx: Fix critical section in scu driver
     new c2e45444ff boards: cxd56xx: Fix an issue i2c tool not working
     new 22d2ef0bf4 boards: cxd56xx: Make board_late_initialize a weak function
     new 771bd8ca17 board/spresense: Add pin selection of ILI934x
     new 81534df8a3 boards: cxd56xx: Add board function for scd41 sensor driver
     new 64e5867a8b cxd56/spresense: Add callback mechanism to notice SDCard injection

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/arm/src/cxd56xx/cxd56_emmc.c                  |   1 +
 arch/arm/src/cxd56xx/cxd56_farapistub.h            |   2 +-
 arch/arm/src/cxd56xx/cxd56_scu.c                   |   6 +
 boards/arm/cxd56xx/common/src/Make.defs            |   4 +
 boards/arm/cxd56xx/common/src/cxd56_i2cdev.c       |   1 +
 .../src/{cxd56_ak09912_i2c.c => cxd56_scd41_i2c.c} |  14 +-
 boards/arm/cxd56xx/common/src/cxd56_sensors.c      |   3 +
 boards/arm/cxd56xx/spresense/Kconfig               | 183 +++++++++++++++++++++
 boards/arm/cxd56xx/spresense/include/board.h       |  16 +-
 .../arm/cxd56xx/spresense/include/board_lcdpins.h  | 146 ++++++++++++++++
 .../include/{cxd56_flash.h => cxd56_scd41.h}       |  16 +-
 .../arm/cxd56xx/spresense/include/cxd56_sdcard.h   |  13 ++
 boards/arm/cxd56xx/spresense/src/cxd56_appinit.c   |   3 +-
 boards/arm/cxd56xx/spresense/src/cxd56_ioctl.c     |  17 ++
 boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c    |  36 ++++
 15 files changed, 438 insertions(+), 23 deletions(-)
 copy boards/arm/cxd56xx/common/src/{cxd56_ak09912_i2c.c => cxd56_scd41_i2c.c} (85%)
 create mode 100644 boards/arm/cxd56xx/spresense/include/board_lcdpins.h
 copy boards/arm/cxd56xx/spresense/include/{cxd56_flash.h => cxd56_scd41.h} (82%)


[incubator-nuttx] 03/08: arch: cxd56xx: Fix critical section in scu driver

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 39f7c4aea0d32c0d95a30b69c8cafda2e1f700a6
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Mon Apr 11 19:05:59 2022 +0900

    arch: cxd56xx: Fix critical section in scu driver
    
    Add critical section to scu one-shot sequencer.
---
 arch/arm/src/cxd56xx/cxd56_scu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/src/cxd56xx/cxd56_scu.c b/arch/arm/src/cxd56xx/cxd56_scu.c
index f84e7a4cb0..dd605b2ae3 100644
--- a/arch/arm/src/cxd56xx/cxd56_scu.c
+++ b/arch/arm/src/cxd56xx/cxd56_scu.c
@@ -939,8 +939,11 @@ static void seq_setstartphase(int sid, int phase)
 static void seq_startseq(int sid)
 {
   uint32_t val;
+  irqstate_t flags;
+  flags = enter_critical_section();
   val = getreg32(SCU_START_MODE0);
   putreg32(val | (1 << sid), SCU_START_MODE0);
+  leave_critical_section(flags);
 }
 
 /****************************************************************************
@@ -957,8 +960,11 @@ static void seq_startseq(int sid)
 static void seq_stopseq(int sid)
 {
   uint32_t val;
+  irqstate_t flags;
+  flags = enter_critical_section();
   val = getreg32(SCU_START_MODE0);
   putreg32(val & ~(1 << sid), SCU_START_MODE0);
+  leave_critical_section(flags);
 }
 
 /****************************************************************************


[incubator-nuttx] 06/08: board/spresense: Add pin selection of ILI934x

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 771bd8ca17ef8eed32309af32eb101aab6b04893
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Mon Apr 11 20:10:54 2022 +0900

    board/spresense: Add pin selection of ILI934x
    
    Add Kconfig choice for selecting RST and DC pins on ILI934x LCD.
---
 boards/arm/cxd56xx/spresense/Kconfig               | 183 +++++++++++++++++++++
 boards/arm/cxd56xx/spresense/include/board.h       |  11 +-
 .../arm/cxd56xx/spresense/include/board_lcdpins.h  | 146 ++++++++++++++++
 3 files changed, 334 insertions(+), 6 deletions(-)

diff --git a/boards/arm/cxd56xx/spresense/Kconfig b/boards/arm/cxd56xx/spresense/Kconfig
index 57323d459e..872b400409 100644
--- a/boards/arm/cxd56xx/spresense/Kconfig
+++ b/boards/arm/cxd56xx/spresense/Kconfig
@@ -514,6 +514,189 @@ config LCD_ON_MAIN_BOARD
 		Display connected to main board.
 
 endchoice
+
+if LCD_ON_MAIN_BOARD
+
+choice
+	prompt "LCD ILI934x RST Pin selection"
+	default LCD_RSTPIN_I2S0_BCK
+
+config LCD_RSTPIN_UART2_TX
+	bool "UART2_TX (D01) PIN"
+
+config LCD_RSTPIN_UART2_RX
+	bool "UART2_RX (D00) PIN"
+
+config LCD_RSTPIN_UART2_RTS
+	bool "UART2_RTS (D28) PIN"
+
+config LCD_RSTPIN_UART2_CTS
+	bool "UART2_CTS (D27) PIN"
+
+config LCD_RSTPIN_I2S0_BCK
+	bool "I2S0_BCK (D26) PIN"
+
+config LCD_RSTPIN_I2S0_LRCK
+	bool "I2S0_LRCK (D25) PIN"
+
+config LCD_RSTPIN_SEN_IRQ_IN
+	bool "SEN_IRQ_IN (D22) PIN"
+
+config LCD_RSTPIN_EMMC_DATA3
+	bool "EMMC_DATA3 (D21) PIN"
+
+config LCD_RSTPIN_EMMC_DATA2
+	bool "EMMC_DATA2 (D20) PIN"
+
+config LCD_RSTPIN_I2S0_DATA_IN
+	bool "I2S0_DATA_IN (D19) PIN"
+
+config LCD_RSTPIN_I2S0_DATA_OUT
+	bool "I2S0_DATA_OUT (D18) PIN"
+
+config LCD_RSTPIN_I2C0_SCL
+	bool "I2C0_SCL (D15) PIN"
+
+config LCD_RSTPIN_I2C0_SDA
+	bool "I2C0_SDA (D14) PIN"
+
+endchoice
+
+choice
+	prompt "LCD ILI934x DC Pin selection"
+	default LCD_DCPIN_I2S0_LRCK
+
+config LCD_DCPIN_UART2_TX
+	bool "UART2_TX (D01) PIN"
+
+config LCD_DCPIN_UART2_RX
+	bool "UART2_RX (D00) PIN"
+
+config LCD_DCPIN_UART2_RTS
+	bool "UART2_RTS (D28) PIN"
+
+config LCD_DCPIN_UART2_CTS
+	bool "UART2_CTS (D27) PIN"
+
+config LCD_DCPIN_I2S0_BCK
+	bool "I2S0_BCK (D26) PIN"
+
+config LCD_DCPIN_I2S0_LRCK
+	bool "I2S0_LRCK (D25) PIN"
+
+config LCD_DCPIN_SEN_IRQ_IN
+	bool "SEN_IRQ_IN (D22) PIN"
+
+config LCD_DCPIN_EMMC_DATA3
+	bool "EMMC_DATA3 (D21) PIN"
+
+config LCD_DCPIN_EMMC_DATA2
+	bool "EMMC_DATA2 (D20) PIN"
+
+config LCD_DCPIN_I2S0_DATA_IN
+	bool "I2S0_DATA_IN (D19) PIN"
+
+config LCD_DCPIN_I2S0_DATA_OUT
+	bool "I2S0_DATA_OUT (D18) PIN"
+
+config LCD_DCPIN_I2C0_SCL
+	bool "I2C0_SCL (D15) PIN"
+
+config LCD_DCPIN_I2C0_SDA
+	bool "I2C0_SDA (D14) PIN"
+
+endchoice
+
+endif
+
+if LCD_ON_EXTENSION_BOARD
+
+choice
+	prompt "LCD ILI934x RST Pin selection"
+	default LCD_RSTPIN_SPI2_MISO
+
+config LCD_RSTPIN_I2C0_SCL_E
+	bool "I2C0_SCL (D15) PIN"
+
+config LCD_RSTPIN_I2C0_SDA_E
+	bool "I2C0_SDA (D14) PIN"
+
+config LCD_RSTPIN_PWM2
+	bool "PWM2 (D09) PIN"
+
+config LCD_RSTPIN_SPI2_MISO
+	bool "SPI2_MISO (D08) PIN"
+
+config LCD_RSTPIN_SPI3_CS1_X
+	bool "SPI3_CS1_X (D07) PIN"
+
+config LCD_RSTPIN_PWM0
+	bool "PWM0 (D06) PIN"
+
+config LCD_RSTPIN_PWM1
+	bool "PWM1 (D05) PIN"
+
+config LCD_RSTPIN_SPI2_MOSI
+	bool "SPI2_MOSI (D04) PIN"
+
+config LCD_RSTPIN_PWM3
+	bool "PWM3 (D03) PIN"
+
+config LCD_RSTPIN_HIF_IRQ_OUT
+	bool "HIF_IRQ_OUT (D02) PIN"
+
+config LCD_RSTPIN_UART2_TX_E
+	bool "UART2_TX (D01) PIN"
+
+config LCD_RSTPIN_UART2_RX_E
+	bool "UART2_RX (D00) PIN"
+
+endchoice
+
+choice
+	prompt "LCD ILI934x DC Pin selection"
+	default LCD_DCPIN_PWM2
+
+config LCD_DCPIN_I2C0_SCL_E
+	bool "I2C0_SCL (D15) PIN"
+
+config LCD_DCPIN_I2C0_SDA_E
+	bool "I2C0_SDA (D14) PIN"
+
+config LCD_DCPIN_PWM2
+	bool "PWM2 (D09) PIN"
+
+config LCD_DCPIN_SPI2_MISO
+	bool "SPI2_MISO (D08) PIN"
+
+config LCD_DCPIN_SPI3_CS1_X
+	bool "SPI3_CS1_X (D07) PIN"
+
+config LCD_DCPIN_PWM0
+	bool "PWM0 (D06) PIN"
+
+config LCD_DCPIN_PWM1
+	bool "PWM1 (D05) PIN"
+
+config LCD_DCPIN_SPI2_MOSI
+	bool "SPI2_MOSI (D04) PIN"
+
+config LCD_DCPIN_PWM3
+	bool "PWM3 (D03) PIN"
+
+config LCD_DCPIN_HIF_IRQ_OUT
+	bool "HIF_IRQ_OUT (D02) PIN"
+
+config LCD_DCPIN_UART2_TX_E
+	bool "UART2_TX (D01) PIN"
+
+config LCD_DCPIN_UART2_RX_E
+	bool "UART2_RX (D00) PIN"
+
+endchoice
+
+endif
+
 endif
 
 choice
diff --git a/boards/arm/cxd56xx/spresense/include/board.h b/boards/arm/cxd56xx/spresense/include/board.h
index 029ac60671..20cce16a99 100644
--- a/boards/arm/cxd56xx/spresense/include/board.h
+++ b/boards/arm/cxd56xx/spresense/include/board.h
@@ -30,6 +30,8 @@
 #include <sys/boardctl.h>
 #include <stdbool.h>
 
+#include "board_lcdpins.h"
+
 #include "cxd56_clock.h"
 #include "cxd56_power.h"
 #include "cxd56_flash.h"
@@ -212,9 +214,6 @@ enum board_power_device
 
 #if defined(CONFIG_LCD_ON_MAIN_BOARD) /* Display connected to main board. */
 
-#define DISPLAY_RST     PIN_I2S0_BCK
-#define DISPLAY_DC      PIN_I2S0_LRCK
-
 #define DISPLAY_SPI     5
 
 #define DISPLAY_DMA_TXCH       (4)
@@ -226,9 +225,6 @@ enum board_power_device
 
 #else /* Display is connected through extension board. */
 
-#define DISPLAY_RST     PIN_SPI2_MISO
-#define DISPLAY_DC      PIN_PWM2
-
 #define DISPLAY_SPI     4
 
 #define DISPLAY_DMA_TXCH       (2)
@@ -240,6 +236,9 @@ enum board_power_device
 
 #endif
 
+#define DISPLAY_RST     ILI934X_RST_PIN
+#define DISPLAY_DC      ILI934X_DC_PIN
+
 /* Sensor device bus definitions ********************************************/
 
 #define SENSOR_I2C      0
diff --git a/boards/arm/cxd56xx/spresense/include/board_lcdpins.h b/boards/arm/cxd56xx/spresense/include/board_lcdpins.h
new file mode 100644
index 0000000000..f17d394fe2
--- /dev/null
+++ b/boards/arm/cxd56xx/spresense/include/board_lcdpins.h
@@ -0,0 +1,146 @@
+/****************************************************************************
+ * boards/arm/cxd56xx/spresense/include/board_lcdpins.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you 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
+ *
+ *   http://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 __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_BOARD_LCDPINS_H
+#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_BOARD_LCDPINS_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* ILI934X RST pin definition */
+
+#if defined(CONFIG_LCD_RSTPIN_UART2_TX) \
+    || defined(CONFIG_LCD_RSTPIN_UART2_TX_E)
+# define ILI934X_RST_PIN PIN_UART2_TXD
+#elif defined(CONFIG_LCD_RSTPIN_UART2_RX) \
+    || defined(CONFIG_LCD_RSTPIN_UART2_RX_E)
+# define ILI934X_RST_PIN PIN_UART2_RXD
+#elif defined(CONFIG_LCD_RSTPIN_UART2_RTS)
+# define ILI934X_RST_PIN PIN_UART2_RTS
+#elif defined(CONFIG_LCD_RSTPIN_UART2_CTS)
+# define ILI934X_RST_PIN PIN_UART2_CTS
+#elif defined(CONFIG_LCD_RSTPIN_I2S0_BCK)
+# define ILI934X_RST_PIN PIN_I2S0_BCK
+#elif defined(CONFIG_LCD_RSTPIN_I2S0_LRCK)
+# define ILI934X_RST_PIN PIN_I2S0_LRCK
+#elif defined(CONFIG_LCD_RSTPIN_SEN_IRQ_IN)
+# define ILI934X_RST_PIN PIN_SEN_IRQ_IN
+#elif defined(CONFIG_LCD_RSTPIN_EMMC_DATA3)
+# define ILI934X_RST_PIN PIN_EMMC_DATA3
+#elif defined(CONFIG_LCD_RSTPIN_EMMC_DATA2)
+# define ILI934X_RST_PIN PIN_EMMC_DATA2
+#elif defined(CONFIG_LCD_RSTPIN_I2S0_DATA_IN)
+# define ILI934X_RST_PIN PIN_I2S0_DATA_IN
+#elif defined(CONFIG_LCD_RSTPIN_I2S0_DATA_OUT)
+# define ILI934X_RST_PIN PIN_I2S0_DATA_OUT
+#elif defined(CONFIG_LCD_RSTPIN_I2C0_SCL) \
+    || defined(CONFIG_LCD_RSTPIN_I2C0_SCL_E)
+# define ILI934X_RST_PIN PIN_I2C0_BCK
+#elif defined(CONFIG_LCD_RSTPIN_I2C0_SDA) \
+    || defined(CONFIG_LCD_RSTPIN_I2C0_SDA_E)
+# define ILI934X_RST_PIN PIN_I2C0_BDT
+#elif defined(CONFIG_LCD_RSTPIN_PWM2)
+# define ILI934X_RST_PIN PIN_PWM2
+#elif defined(CONFIG_LCD_RSTPIN_SPI2_MISO)
+# define ILI934X_RST_PIN PIN_SPI2_MISO
+#elif defined(CONFIG_LCD_RSTPIN_SPI3_CS1_X)
+# define ILI934X_RST_PIN PIN_SPI3_CS1_X
+#elif defined(CONFIG_LCD_RSTPIN_PWM0)
+# define ILI934X_RST_PIN PIN_PWM0
+#elif defined(CONFIG_LCD_RSTPIN_PWM1)
+# define ILI934X_RST_PIN PIN_PWM1
+#elif defined(CONFIG_LCD_RSTPIN_SPI2_MOSI)
+# define ILI934X_RST_PIN PIN_SPI2_MOSI
+#elif defined(CONFIG_LCD_RSTPIN_PWM3)
+# define ILI934X_RST_PIN PIN_PWM3
+#elif defined(CONFIG_LCD_RSTPIN_HIF_IRQ_OUT)
+# define ILI934X_RST_PIN PIN_HIF_IRQ_OUT
+#endif
+
+/* ILI934X DC pin definition */
+
+#if defined(CONFIG_LCD_DCPIN_UART2_TX) \
+    || defined(CONFIG_LCD_DCPIN_UART2_TX_E)
+# define ILI934X_DC_PIN PIN_UART2_TXD
+#elif defined(CONFIG_LCD_DCPIN_UART2_RX) \
+    || defined(CONFIG_LCD_DCPIN_UART2_RX_E)
+# define ILI934X_DC_PIN PIN_UART2_RXD
+#elif defined(CONFIG_LCD_DCPIN_UART2_RTS)
+# define ILI934X_DC_PIN PIN_UART2_RTS
+#elif defined(CONFIG_LCD_DCPIN_UART2_CTS)
+# define ILI934X_DC_PIN PIN_UART2_CTS
+#elif defined(CONFIG_LCD_DCPIN_I2S0_BCK)
+# define ILI934X_DC_PIN PIN_I2S0_BCK
+#elif defined(CONFIG_LCD_DCPIN_I2S0_LRCK)
+# define ILI934X_DC_PIN PIN_I2S0_LRCK
+#elif defined(CONFIG_LCD_DCPIN_SEN_IRQ_IN)
+# define ILI934X_DC_PIN PIN_SEN_IRQ_IN
+#elif defined(CONFIG_LCD_DCPIN_EMMC_DATA3)
+# define ILI934X_DC_PIN PIN_EMMC_DATA3
+#elif defined(CONFIG_LCD_DCPIN_EMMC_DATA2)
+# define ILI934X_DC_PIN PIN_EMMC_DATA2
+#elif defined(CONFIG_LCD_DCPIN_I2S0_DATA_IN)
+# define ILI934X_DC_PIN PIN_I2S0_DATA_IN
+#elif defined(CONFIG_LCD_DCPIN_I2S0_DATA_OUT)
+# define ILI934X_DC_PIN PIN_I2S0_DATA_OUT
+#elif defined(CONFIG_LCD_DCPIN_I2C0_SCL) \
+    || defined(CONFIG_LCD_DCPIN_I2C0_SCL_E)
+# define ILI934X_DC_PIN PIN_I2C0_BCK
+#elif defined(CONFIG_LCD_DCPIN_I2C0_SDA) \
+    || defined(CONFIG_LCD_DCPIN_I2C0_SDA_E)
+# define ILI934X_DC_PIN PIN_I2C0_BDT
+#elif defined(CONFIG_LCD_DCPIN_PWM2)
+# define ILI934X_DC_PIN PIN_PWM2
+#elif defined(CONFIG_LCD_DCPIN_SPI2_MISO)
+# define ILI934X_DC_PIN PIN_SPI2_MISO
+#elif defined(CONFIG_LCD_DCPIN_SPI3_CS1_X)
+# define ILI934X_DC_PIN PIN_SPI3_CS1_X
+#elif defined(CONFIG_LCD_DCPIN_PWM0)
+# define ILI934X_DC_PIN PIN_PWM0
+#elif defined(CONFIG_LCD_DCPIN_PWM1)
+# define ILI934X_DC_PIN PIN_PWM1
+#elif defined(CONFIG_LCD_DCPIN_SPI2_MOSI)
+# define ILI934X_DC_PIN PIN_SPI2_MOSI
+#elif defined(CONFIG_LCD_DCPIN_PWM3)
+# define ILI934X_DC_PIN PIN_PWM3
+#elif defined(CONFIG_LCD_DCPIN_HIF_IRQ_OUT)
+# define ILI934X_DC_PIN PIN_HIF_IRQ_OUT
+#endif
+
+#if !defined(CONFIG_LCD)
+
+# if !defined(ILI934X_RST_PIN)
+#  define ILI934X_RST_PIN 0
+# endif
+
+# if !defined(ILI934X_DC_PIN)
+#  define ILI934X_DC_PIN 0
+# endif
+
+#endif
+
+#endif  /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_BOARD_LCDPINS_H */


[incubator-nuttx] 05/08: boards: cxd56xx: Make board_late_initialize a weak function

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 22d2ef0bf42270a1841735b6249b5bf07b5ebc54
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Mon Apr 11 20:10:10 2022 +0900

    boards: cxd56xx: Make board_late_initialize a weak function
    
    Add a weak_function to the board_late_initialize function so that
    it can be replaced by another file, such as a user application.
---
 boards/arm/cxd56xx/spresense/src/cxd56_appinit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_appinit.c b/boards/arm/cxd56xx/spresense/src/cxd56_appinit.c
index eb0f656bdf..d0b88ba21b 100644
--- a/boards/arm/cxd56xx/spresense/src/cxd56_appinit.c
+++ b/boards/arm/cxd56xx/spresense/src/cxd56_appinit.c
@@ -23,6 +23,7 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+#include <nuttx/compiler.h>
 
 #include <nuttx/board.h>
 
@@ -93,7 +94,7 @@ int board_app_initialize(uintptr_t arg)
  ****************************************************************************/
 
 #ifdef CONFIG_BOARD_LATE_INITIALIZE
-void board_late_initialize(void)
+void weak_function board_late_initialize(void)
 {
   /* Perform board bring-up here instead of from the
    * board_app_initialize().


[incubator-nuttx] 01/08: arch: cxd56xx: update loader and gnssfw version

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5be940080bdbbac4541100ac96331cb4ebfd6b5d
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Mon Apr 11 19:03:53 2022 +0900

    arch: cxd56xx: update loader and gnssfw version
    
    Update loader and gnssfw to version 2.2.20585
---
 arch/arm/src/cxd56xx/cxd56_farapistub.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/src/cxd56xx/cxd56_farapistub.h b/arch/arm/src/cxd56xx/cxd56_farapistub.h
index 3e12f7551e..a58e2eca95 100644
--- a/arch/arm/src/cxd56xx/cxd56_farapistub.h
+++ b/arch/arm/src/cxd56xx/cxd56_farapistub.h
@@ -21,6 +21,6 @@
 #ifndef __ARCH_ARM_SRC_CXD56XX_CXD56_FARAPISTUB_H
 #define __ARCH_ARM_SRC_CXD56XX_CXD56_FARAPISTUB_H
 
-#define FARAPISTUB_VERSION 20175
+#define FARAPISTUB_VERSION 20585
 
 #endif /* __ARCH_ARM_SRC_CXD56XX_CXD56_FARAPISTUB_H */


[incubator-nuttx] 08/08: cxd56/spresense: Add callback mechanism to notice SDCard injection

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 64e5867a8b9645f9a43e93052e1babbcba1495b4
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Mon Apr 11 20:12:20 2022 +0900

    cxd56/spresense: Add callback mechanism to notice SDCard injection
    
    Add a mechanism to callback to an application to notice the SDCard
    status is changed (inserted or ejected).
---
 boards/arm/cxd56xx/spresense/include/board.h       |  4 +++
 .../arm/cxd56xx/spresense/include/cxd56_sdcard.h   | 13 ++++++++
 boards/arm/cxd56xx/spresense/src/cxd56_ioctl.c     | 17 ++++++++++
 boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c    | 36 ++++++++++++++++++++++
 4 files changed, 70 insertions(+)

diff --git a/boards/arm/cxd56xx/spresense/include/board.h b/boards/arm/cxd56xx/spresense/include/board.h
index af64cfd1c4..fa720ca65c 100644
--- a/boards/arm/cxd56xx/spresense/include/board.h
+++ b/boards/arm/cxd56xx/spresense/include/board.h
@@ -261,6 +261,10 @@ enum board_power_device
 
 #define BOARDIOC_USBDEV_SETNOTIFYSIG      (BOARDIOC_USER+0x0001)
 
+/* Set callback function pointer for notify SDCard state change *************/
+
+#define BOARDIOC_SDCARD_SETNOTIFYCB       (BOARDIOC_USER+0x0002)
+
 /* Altair modem device pin definitions **************************************/
 
 #define ALTMDM_SLAVE_REQ          PIN_SPI2_SCK
diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_sdcard.h b/boards/arm/cxd56xx/spresense/include/cxd56_sdcard.h
index 1553af5e90..0b8a3f4ab7 100644
--- a/boards/arm/cxd56xx/spresense/include/cxd56_sdcard.h
+++ b/boards/arm/cxd56xx/spresense/include/cxd56_sdcard.h
@@ -26,6 +26,7 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+#include <stdint.h>
 
 /****************************************************************************
  * Public Types
@@ -130,6 +131,18 @@ void board_sdcard_set_high_voltage(void);
 
 void board_sdcard_set_low_voltage(void);
 
+/****************************************************************************
+ * Name: board_sdcard_set_state_cb
+ *
+ * Description:
+ *   Register callback function to notify state change of card slot.
+ *   This function is called by board_ioctl()
+ *    as BOARDIOC_SDCARD_SETNOTIFYCB command.
+ *
+ ****************************************************************************/
+
+int board_sdcard_set_state_cb(uintptr_t cb);
+
 #undef EXTERN
 #if defined(__cplusplus)
 }
diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_ioctl.c b/boards/arm/cxd56xx/spresense/src/cxd56_ioctl.c
index 025ff6b67c..b174d37aa2 100644
--- a/boards/arm/cxd56xx/spresense/src/cxd56_ioctl.c
+++ b/boards/arm/cxd56xx/spresense/src/cxd56_ioctl.c
@@ -34,6 +34,7 @@
 #include <arch/chip/chip.h>
 
 #include "cxd56_usbdev.h"
+#include "arch/board/cxd56_sdcard.h"
 
 #ifdef CONFIG_BOARDCTL_IOCTL
 
@@ -91,6 +92,22 @@ int board_ioctl(unsigned int cmd, uintptr_t arg)
         }
         break;
 #endif
+
+#ifdef CONFIG_CXD56_SDIO
+      /* CMD:           BOARDIOC_SDCARD_SETNOTIFYCB
+       * DESCRIPTION:   Set a callback function pointer to SDCard driver
+       *                to notify when card status is changed.
+       * ARG:           Callback function.
+       * CONFIGURATION: CONFIG_BOARDCTL & CONFIG_CXD56_SDIO
+       * DEPENDENCIES:  Board logic must provide board_app_initialization
+       */
+
+      case BOARDIOC_SDCARD_SETNOTIFYCB:
+        {
+          ret = board_sdcard_set_state_cb(arg);
+        }
+        break;
+#endif
       default:
         break;
     }
diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c b/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c
index bfb88697a0..7f6c75fe98 100644
--- a/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c
+++ b/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c
@@ -70,6 +70,7 @@ struct cxd56_sdhci_state_s
   struct sdio_dev_s *sdhci;   /* R/W device handle */
   bool initialized;           /* TRUE: SDHCI block driver is initialized */
   bool inserted;              /* TRUE: card is inserted */
+  void (*cb)(bool);           /* Callback function pointer to application */
 };
 
 /****************************************************************************
@@ -165,6 +166,13 @@ static void board_sdcard_enable(FAR void *arg)
         }
 
       g_sdhci.initialized = true;
+
+      /* Callback to application to notice card is inserted */
+
+      if (g_sdhci.cb != NULL)
+        {
+          g_sdhci.cb(true);
+        }
     }
 
 release_frequency_lock:
@@ -203,6 +211,13 @@ static void board_sdcard_disable(FAR void *arg)
       cxd56_sdhci_finalize(0);
 
       g_sdhci.initialized = false;
+
+      /* Callback to application to notice card is ejected */
+
+      if (g_sdhci.cb != NULL)
+        {
+          g_sdhci.cb(false);
+        }
     }
 }
 
@@ -515,3 +530,24 @@ void board_sdcard_set_high_voltage(void)
 void board_sdcard_set_low_voltage(void)
 {
 }
+
+/****************************************************************************
+ * Name: board_sdcard_set_state_cb
+ *
+ * Description:
+ *   Register callback function to notify state change of card slot.
+ *   This function is called by board_ioctl()
+ *    as BOARDIOC_SDCARD_SETNOTIFYCB command.
+ *
+ ****************************************************************************/
+
+int board_sdcard_set_state_cb(uintptr_t cb)
+{
+  if (g_sdhci.cb != NULL && cb != 0)
+    {
+      return -EBUSY;
+    }
+
+  g_sdhci.cb = (void (*)(bool))cb;
+  return OK;
+}


[incubator-nuttx] 02/08: cxd56xx/cxd56_emmc.c: Fix compile warning

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e725829547f63cd45917122352c5985cb87675c0
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Thu Feb 10 19:28:23 2022 +0900

    cxd56xx/cxd56_emmc.c: Fix compile warning
    
    Add necessary include header named debug.h for using ferr and
    finfo.
---
 arch/arm/src/cxd56xx/cxd56_emmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/src/cxd56xx/cxd56_emmc.c b/arch/arm/src/cxd56xx/cxd56_emmc.c
index f74857492d..8d3bb18c6f 100644
--- a/arch/arm/src/cxd56xx/cxd56_emmc.c
+++ b/arch/arm/src/cxd56xx/cxd56_emmc.c
@@ -28,6 +28,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <assert.h>
+#include <debug.h>
 #include <errno.h>
 
 #include <nuttx/arch.h>


[incubator-nuttx] 07/08: boards: cxd56xx: Add board function for scd41 sensor driver

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 81534df8a3c44d516f8b5814c9d321e74104fc5b
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Mon Apr 11 20:11:45 2022 +0900

    boards: cxd56xx: Add board function for scd41 sensor driver
    
    Add board function for SCD41 CO2, temperature and humidity sensor driver.
---
 boards/arm/cxd56xx/common/src/Make.defs            |  4 ++
 boards/arm/cxd56xx/common/src/cxd56_scd41_i2c.c    | 72 ++++++++++++++++++++++
 boards/arm/cxd56xx/common/src/cxd56_sensors.c      |  3 +
 boards/arm/cxd56xx/spresense/include/board.h       |  1 +
 boards/arm/cxd56xx/spresense/include/cxd56_scd41.h | 71 +++++++++++++++++++++
 5 files changed, 151 insertions(+)

diff --git a/boards/arm/cxd56xx/common/src/Make.defs b/boards/arm/cxd56xx/common/src/Make.defs
index 0dae761637..572a772536 100644
--- a/boards/arm/cxd56xx/common/src/Make.defs
+++ b/boards/arm/cxd56xx/common/src/Make.defs
@@ -110,6 +110,10 @@ ifeq ($(CONFIG_SENSORS_RPR0521RS_SCU),y)
 CSRCS += cxd56_rpr0521rs_scu.c
 endif
 
+ifeq ($(CONFIG_SENSORS_SCD41),y)
+CSRCS += cxd56_scd41_i2c.c
+endif
+
 ifeq ($(CONFIG_NETDEVICES),y)
 CSRCS += cxd56_netinit.c
 endif
diff --git a/boards/arm/cxd56xx/common/src/cxd56_scd41_i2c.c b/boards/arm/cxd56xx/common/src/cxd56_scd41_i2c.c
new file mode 100644
index 0000000000..d3f0b15e23
--- /dev/null
+++ b/boards/arm/cxd56xx/common/src/cxd56_scd41_i2c.c
@@ -0,0 +1,72 @@
+/****************************************************************************
+ * boards/arm/cxd56xx/common/src/cxd56_scd41_i2c.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you 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
+ *
+ *   http://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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/board.h>
+
+#include <nuttx/sensors/scd41.h>
+
+#include "cxd56_i2c.h"
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_SCD41)
+
+int board_scd41_initialize(FAR const char *devpath, int bus)
+{
+  int ret;
+  FAR struct i2c_master_s *i2c;
+
+  sninfo("Initializing SCD41...\n");
+
+  /* Initialize i2c device */
+
+  i2c = cxd56_i2cbus_initialize(bus);
+  if (!i2c)
+    {
+      snerr("ERROR: Failed to initialize i2c%d.\n", bus);
+      return -ENODEV;
+    }
+
+  ret = scd41_register_i2c(devpath, i2c);
+  if (ret < 0)
+    {
+      snerr("Error registering SCD41.\n");
+    }
+
+  return ret;
+}
+
+#endif
diff --git a/boards/arm/cxd56xx/common/src/cxd56_sensors.c b/boards/arm/cxd56xx/common/src/cxd56_sensors.c
index a01a6d634f..26fe4b58d8 100644
--- a/boards/arm/cxd56xx/common/src/cxd56_sensors.c
+++ b/boards/arm/cxd56xx/common/src/cxd56_sensors.c
@@ -216,6 +216,9 @@ static struct sensor_device_s sensor_device[] =
 #if defined(CONFIG_SENSORS_BH1745NUC) || defined(CONFIG_SENSORS_BH1745NUC_SCU)
   _I2C_DEVICE(bh1745nuc, "/dev/color"), /* Color */
 #endif
+#if defined(CONFIG_SENSORS_SCD41)
+  _I2C_DEVICE(scd41, "/dev/co2"), /* CO2 */
+#endif
 };
 
 /****************************************************************************
diff --git a/boards/arm/cxd56xx/spresense/include/board.h b/boards/arm/cxd56xx/spresense/include/board.h
index 20cce16a99..af64cfd1c4 100644
--- a/boards/arm/cxd56xx/spresense/include/board.h
+++ b/boards/arm/cxd56xx/spresense/include/board.h
@@ -61,6 +61,7 @@
 #include "cxd56_kx022.h"
 #include "cxd56_lt1pa01.h"
 #include "cxd56_rpr0521rs.h"
+#include "cxd56_scd41.h"
 #include "cxd56_sensors.h"
 
 #include "cxd56_isx012.h"
diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_scd41.h b/boards/arm/cxd56xx/spresense/include/cxd56_scd41.h
new file mode 100644
index 0000000000..4a7243a12d
--- /dev/null
+++ b/boards/arm/cxd56xx/spresense/include/cxd56_scd41.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+ * boards/arm/cxd56xx/spresense/include/cxd56_scd41.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you 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
+ *
+ *   http://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 __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_SCD41_H
+#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_SCD41_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_scd41_initialize
+ *
+ * Description:
+ *   Initialize SCD41 i2c driver and register the SCD41 device.
+ *
+ ****************************************************************************/
+
+#if defined (CONFIG_SENSORS_SCD41)
+int board_scd41_initialize(FAR const char *devpath, int bus);
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_SCD41_H */


[incubator-nuttx] 04/08: boards: cxd56xx: Fix an issue i2c tool not working

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c2e45444ff0f0591a1648b5a511944dac7328133
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Mon Apr 11 20:09:30 2022 +0900

    boards: cxd56xx: Fix an issue i2c tool not working
    
    It caused i2c tool not to work due to i2c uninitializing processing.
    Since this process is not necessary in the normal case, we will
    move it to the error case.
---
 boards/arm/cxd56xx/common/src/cxd56_i2cdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/boards/arm/cxd56xx/common/src/cxd56_i2cdev.c b/boards/arm/cxd56xx/common/src/cxd56_i2cdev.c
index 38eb039564..4d3b1bd294 100644
--- a/boards/arm/cxd56xx/common/src/cxd56_i2cdev.c
+++ b/boards/arm/cxd56xx/common/src/cxd56_i2cdev.c
@@ -62,6 +62,7 @@ int board_i2cdev_initialize(int port)
   if (ret < 0)
     {
       _err("ERROR: Failed to register i2c%d: %d\n", port, ret);
+      cxd56_i2cbus_uninitialize(i2c);
     }
 
   return ret;