Merged in alinjerpelea/nuttx (pull request #1021)

boards: cxd56xx: add SCU sensors (2/2)

* boards: cxd56xx: add cxd56_bh1721fvc initialization

    We are adding the sensor initialization for cxd56xx boards in the
    common board folder.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: cxd56xx: add cxd56_bh1745nuc initialization

    We are adding the sensor initialization for cxd56xx boards in the
    common board folder.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: cxd56xx: add cxd56_bm1383glv initialization

    We are adding the sensor initialization for cxd56xx boards in the
    common board folder.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: cxd56xx: add cxd56_bm1422gmv initialization

    We are adding the sensor initialization for cxd56xx boards in the
    common board folder.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: cxd56xx: add cxd56_bmi160 initialization

    We are adding the sensor initialization for cxd56xx boards in the
    common board folder.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: cxd56xx: add cxd56_bmp280 initialization

    We are adding the sensor initialization for cxd56xx boards in the
    common board folder.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: cxd56xx: add cxd56_kx022 initialization

    We are adding the sensor initialization for cxd56xx boards in the
    common board folder.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: cxd56xx: add cxd56_lt1pa01 initialization

    We are adding the sensor initialization for cxd56xx boards in the
    common board folder.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: cxd56xx: add cxd56_rpr0521rs initialization

    We are adding the sensor initialization for cxd56xx boards in the
    common board folder.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: cxd56xx: add cxd56_sensors initialization

    We are adding the sensor initialization for cxd56xx boards in the
    common board folder.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* arch: arm: cxd56: add Backup Log driver

    The driver will be used to backup logs on crash.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: arm: cxd56xx: common: add crashlog driver

    Add Crashlog driver with support for reset on crash

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: arm: cxd56xx: move gs2200m initialization

    Move the board gs2200m initalization to the common board folder

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: arm: cxd56xx: move ili9340 initialization

    Move the board ili9340 initalization to the common board folder

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: arm: cxd56xx: move lpm013m091a initialization

    Move the board lpm013m091a initalization to the common board folder

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* boards: arm: cxd56xx: common: typo fixes

    HEADER: Updates on file location
    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Alin Jerpelea
2019-08-23 13:28:35 +00:00
committed by Gregory Nutt
parent 3613ae33a7
commit 6ecee7e403
38 changed files with 3209 additions and 25 deletions
@@ -59,7 +59,16 @@
#include "cxd56_ak09912.h"
#include "cxd56_apds9930.h"
#include "cxd56_apds9960.h"
#include "cxd56_bh1721fvc.h"
#include "cxd56_bh1745nuc.h"
#include "cxd56_bm1383glv.h"
#include "cxd56_bm1422gmv.h"
#include "cxd56_bmi160.h"
#include "cxd56_bmp280.h"
#include "cxd56_kx022.h"
#include "cxd56_lt1pa01.h"
#include "cxd56_rpr0521rs.h"
#include "cxd56_sensors.h"
/****************************************************************************
* Pre-processor Definitions
@@ -243,6 +252,11 @@ enum board_power_device
#endif
/* Sensor device bus definitions *******************************************/
#define SENSOR_I2C 0
#define SENSOR_SPI 3
/* Set signal id for notify USB device connection status and
* supply current value.
* signal returns "usbdev_notify_s" struct pointer in sival_ptr.
@@ -0,0 +1,85 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/include/cxd56_bh1721fvc.h
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of Sony Semiconductor Solutions Corporation 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 OWNER 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.
*
****************************************************************************/
#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_BH1721FVC_H
#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_BH1721FVC_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_bh1721fvc_initialize
*
* Description:
* Initialize BH1721FVC i2c driver and register the BH1721FVC device.
*
****************************************************************************/
#if defined(CONFIG_SENSORS_BH1721FVC) || defined(CONFIG_SENSORS_BH1721FVC_SCU)
int board_bh1721fvc_initialize(FAR const char *devpath, int bus);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_BH1721FVC_H */
@@ -0,0 +1,86 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/include/cxd56_bh1745nuc.h
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of Sony Semiconductor Solutions Corporation 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 OWNER 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.
*
****************************************************************************/
#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_BH1745NUC_H
#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_BH1745NUC_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_bh1745nuc_initialize
*
* Description:
* Initialize BH1745NUC i2c driver and register the BH1745NUC device.
*
****************************************************************************/
#if defined(CONFIG_SENSORS_BH1745NUC) || defined(CONFIG_SENSORS_BH1745NUC_SCU)
int board_bh1745nuc_initialize(FAR const char *devpath, int bus);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_BH1745NUC_H */
@@ -0,0 +1,86 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/include/cxd56_bm1383glv.h
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of Sony Semiconductor Solutions Corporation 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 OWNER 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.
*
****************************************************************************/
#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_BM1383GLV_H
#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_BM1383GLV_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_bm1383glv_initialize
*
* Description:
* Initialize BM1383GLV i2c driver and register the BM1383GLV device.
*
****************************************************************************/
#if defined(CONFIG_SENSORS_BM1383GLV) || defined(CONFIG_SENSORS_BM1383GLV_SCU)
int board_bm1383glv_initialize(FAR const char *devpath, int bus);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_BM1383GLV_H */
@@ -0,0 +1,86 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/include/cxd56_bm1422gmv.h
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of Sony Semiconductor Solutions Corporation 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 OWNER 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.
*
****************************************************************************/
#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_BM1422GMV_H
#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_BM1422GMV_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_bm1422gmv_initialize
*
* Description:
* Initialize BM1422GMV i2c driver and register the BM1422GMV device.
*
****************************************************************************/
#if defined(CONFIG_SENSORS_BM1422GMV) || defined(CONFIG_SENSORS_BM1422GMV_SCU)
int board_bm1422gmv_initialize(FAR const char *devpath, int bus);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_BM1422GMV_H */
@@ -0,0 +1,86 @@
/****************************************************************************
* board/arm/cxd56xx/spresense/include/cxd56_bmp280.h
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of Sony Semiconductor Solutions Corporation 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 OWNER 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.
*
****************************************************************************/
#ifndef __BOARDS_ARM_CXD56X_SPRESENSE_INCLUDE_CXD56_BMP280_H
#define __BOARDS_ARM_CXD56X_SPRESENSE_INCLUDE_CXD56_BMP280_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_bmp280_initialize
*
* Description:
* Initialize BMP280 i2c driver and register the BMP280 device.
*
****************************************************************************/
#if defined(CONFIG_SENSORS_BMP280) || defined(CONFIG_SENSORS_BMP280_SCU)
int board_bmp280_initialize(int bus);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_CX56XX_SPRESENSE_INCLUDE_CXD56_BMP280_H */
@@ -0,0 +1,86 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/include/cxd56_kx022.h
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of Sony Semiconductor Solutions Corporation 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 OWNER 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.
*
****************************************************************************/
#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_KX022_H
#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_KX022_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_kx022_initialize
*
* Description:
* Initialize KX022 i2c driver and register the KX022 device.
*
****************************************************************************/
#if defined(CONFIG_SENSORS_KX022)||defined(CONFIG_SENSORS_KX022_SCU)
int board_kx022_initialize(FAR const char *devpath, int bus);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_CXD56XX_SENSORS_INCLUDE_CXD56_KX022_H */
@@ -0,0 +1,86 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/include/cxd56_lt1pa01.h
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of Sony Semiconductor Solutions Corporation 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 OWNER 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.
*
****************************************************************************/
#ifndef __BOARDS_ARM_CXD56XX_SPESENSE_INCLUDE_CXD56_LT1PA01_H
#define __BOARDS_ARM_CXD56XX_SPESENSE_INCLUDE_CXD56_LT1PA01_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_lt1pa01_initialize
*
* Description:
* Initialize LT1PA01 i2c driver and register the LT1PA01 device.
*
****************************************************************************/
#if defined(CONFIG_SENSORS_LT1PA01) || defined(CONFIG_SENSORS_LT1PA01_SCU)
int board_lt1pa01_initialize(int bus);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_CXD56XX_SPESENSE_INCLUDE_CXD56_LT1PA01_H */
@@ -0,0 +1,86 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/include/cxd56_rpr0521rs.h
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of Sony Semiconductor Solutions Corporation 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 OWNER 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.
*
****************************************************************************/
#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_RPR0521RS_H
#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_RPR0521RS_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_rpr0521rs_initialize
*
* Description:
* Initialize RPR0521RS i2c driver and register the RPR0521RS device.
*
****************************************************************************/
#if defined(CONFIG_SENSORS_RPR0521RS) || defined(CONFIG_SENSORS_RPR0521RS_SCU)
int board_rpr0521rs_initialize(int bus);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_RPR0521RS_H */
@@ -1,8 +1,7 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/src/cxd56_netinit.c
* boards/arm/cxd56xx/spresense/include/cxd56_sensors.h
*
* Copyright 2019 Sony Home Entertainment & Sound Products Inc.
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -14,9 +13,10 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
* 3. Neither the name of Sony Semiconductor Solutions Corporation 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
@@ -33,6 +33,9 @@
*
****************************************************************************/
#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_SENSORS_H
#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_SENSORS_H
/****************************************************************************
* Included Files
****************************************************************************/
@@ -40,16 +43,38 @@
#include <nuttx/config.h>
/****************************************************************************
* Public Functions
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Name: up_netinitialize
* Public Data
****************************************************************************/
#if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT)
void up_netinitialize(void)
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Name: board_sensors_initialize
*
* Description:
* Perform sensor devices initialization
*
****************************************************************************/
int board_sensors_initialize(void);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_SENSORS_H */
@@ -102,26 +102,10 @@ ifeq ($(CONFIG_USBDEV_COMPOSITE),y)
CSRCS += cxd56_composite.c
endif
ifeq ($(CONFIG_NETDEVICES),y)
CSRCS += cxd56_netinit.c
endif
ifeq ($(CONFIG_WL_GS2200M),y)
CSRCS += cxd56_gs2200m.c
endif
ifeq ($(CONFIG_CXD56_I2C_DRIVER),y)
CSRCS += cxd56_i2cdev.c
endif
ifeq ($(CONFIG_LCD_LPM013M091A),y)
CSRCS += cxd56_lpm013m091a.c
endif
ifeq ($(CONFIG_LCD_ILI9340),y)
CSRCS += cxd56_ili9340.c
endif
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)
@@ -1,249 +0,0 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/src/cxd56_gs2200m.c
*
* Copyright 2019 Sony Home Entertainment & Sound Products Inc.
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of Sony Semiconductor Solutions Corporation 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 OWNER 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <nuttx/spi/spi.h>
#include <nuttx/irq.h>
#include <nuttx/wireless/gs2200m.h>
#include <arch/chip/pin.h>
#include "cxd56_pinconfig.h"
#include "cxd56_spi.h"
#include "cxd56_gpio.h"
#include "cxd56_gpioint.h"
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static int gs2200m_irq_attach(xcpt_t, FAR void *);
static void gs2200m_irq_enable(void);
static void gs2200m_irq_disable(void);
static uint32_t gs2200m_dready(int *);
/****************************************************************************
* Private Data
****************************************************************************/
static const struct gs2200m_lower_s g_wifi_lower =
{
.attach = gs2200m_irq_attach,
.enable = gs2200m_irq_enable,
.disable = gs2200m_irq_disable,
.dready = gs2200m_dready,
};
static FAR void *g_devhandle = NULL;
static volatile int32_t _enable_count = 0;
static volatile uint32_t _n_called;
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: gs2200m_irq_attach
****************************************************************************/
static int gs2200m_irq_attach(xcpt_t handler, FAR void *arg)
{
(void)cxd56_gpioint_config(PIN_UART2_CTS,
GPIOINT_LEVEL_HIGH,
handler,
arg);
return 0;
}
/****************************************************************************
* Name: gs2200m_irq_enable
****************************************************************************/
static void gs2200m_irq_enable(void)
{
irqstate_t flags = spin_lock_irqsave();
wlinfo("== ec:%d called=%d \n", _enable_count, _n_called++);
if (1 == _enable_count)
{
/* NOTE: This would happen if we received an event */
return;
}
_enable_count++;
if (1 == _enable_count)
{
cxd56_gpioint_enable(PIN_UART2_CTS);
}
spin_unlock_irqrestore(flags);
}
/****************************************************************************
* Name: gs2200m_irq_disable
****************************************************************************/
static void gs2200m_irq_disable(void)
{
irqstate_t flags = spin_lock_irqsave();
wlinfo("== ec:%d called=%d \n", _enable_count, _n_called++);
_enable_count--;
if (0 == _enable_count)
{
cxd56_gpioint_disable(PIN_UART2_CTS);
}
spin_unlock_irqrestore(flags);
}
/****************************************************************************
* Name: gs2200m_disable
****************************************************************************/
static uint32_t gs2200m_dready(int *ec)
{
irqstate_t flags = spin_lock_irqsave();
uint32_t r = cxd56_gpio_read(PIN_UART2_CTS);
if (ec)
{
/* Copy enable count (just for debug) */
*ec = _enable_count;
}
spin_unlock_irqrestore(flags);
return r;
}
/****************************************************************************
* Name: spi_pincontrol
*
* Description:
* Configure the SPI pin
*
* Input Parameter:
* on - true: enable pin, false: disable pin
****************************************************************************/
static void spi_pincontrol(int bus, bool on)
{
if (bus == 5)
{
#ifdef CONFIG_CXD56_SPI5_PINMAP_EMMC
if (on)
{
CXD56_PIN_CONFIGS(PINCONFS_EMMCA_SPI5);
}
else
{
CXD56_PIN_CONFIGS(PINCONFS_EMMCA_GPIO);
}
#endif
#ifdef CONFIG_CXD56_SPI5_PINMAP_SDIO
if (on)
{
CXD56_PIN_CONFIGS(PINCONFS_SDIOA_SPI5);
}
else
{
CXD56_PIN_CONFIGS(PINCONFS_SDIOA_GPIO);
}
#endif
}
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_gs2200m_initialize
****************************************************************************/
int board_gs2200m_initialize(FAR const char *devpath, int bus)
{
FAR struct spi_dev_s *spi;
wlinfo("Initializing GS2200M..\n");
if (!g_devhandle)
{
/* Change UART2 to GPIO */
CXD56_PIN_CONFIGS(PINCONFS_UART2_GPIO);
(void)cxd56_gpio_config(PIN_UART2_CTS, true);
/* Initialize spi deivce */
spi = cxd56_spibus_initialize(bus);
if (!spi)
{
wlerr("ERROR: Failed to initialize spi%d.\n", bus);
return -ENODEV;
}
/* Enable SPI5 */
spi_pincontrol(5, true);
g_devhandle = gs2200m_register(devpath, spi, &g_wifi_lower);
if (!g_devhandle)
{
wlerr("ERROR: Failed to register gs2200m driver.\n");
return -ENODEV;
}
}
return OK;
}
@@ -1,398 +0,0 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/src/cxd56_ili9340.c
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of Sony Semiconductor Solutions Corporation 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 OWNER 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/spi/spi.h>
#include <nuttx/lcd/lcd.h>
#include <nuttx/lcd/ili9340.h>
#include <arch/board/board.h>
#include "cxd56_gpio.h"
#include "cxd56_spi.h"
#include "cxd56_pinconfig.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Check if the following are defined in the board.h */
#ifndef DISPLAY_RST
# error "DISPLAY_RST must be defined in board.h !!"
#endif
#ifndef DISPLAY_DC
# error "DISPLAY_DC must be defined in board.h !!"
#endif
#ifndef DISPLAY_SPI
# error "DISPLAY_SPI must be defined in board.h !!"
#endif
/****************************************************************************
* Private Type Definition
****************************************************************************/
#ifndef ILI9340_SPI_MAXFREQUENCY
# define ILI9340_SPI_MAXFREQUENCY 20000000
#endif
/****************************************************************************
* Private Function Protototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
struct ili93404ws_lcd_s
{
struct ili9340_lcd_s dev;
struct spi_dev_s *spi;
};
static struct ili93404ws_lcd_s g_lcddev;
static struct lcd_dev_s *g_lcd = NULL;
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: cxd56_ili93404ws_select
*
* Description:
* Select the SPI, locking and re-configuring if necessary
*
* Input Parameters:
* spi - Reference to the public driver structure
*
* Returned Value:
*
****************************************************************************/
static void cxd56_ili93404ws_select(FAR struct ili9340_lcd_s *lcd)
{
FAR struct ili93404ws_lcd_s *priv = (FAR struct ili93404ws_lcd_s *)lcd;
SPI_LOCK(priv->spi, true);
SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), true);
}
/****************************************************************************
* Name: cxd56_ili93404ws_deselect
*
* Description:
* De-select the SPI
*
* Input Parameters:
* spi - Reference to the public driver structure
*
* Returned Value:
*
****************************************************************************/
static void cxd56_ili93404ws_deselect(FAR struct ili9340_lcd_s *lcd)
{
FAR struct ili93404ws_lcd_s *priv = (FAR struct ili93404ws_lcd_s *)lcd;
SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), false);
SPI_LOCK(priv->spi, false);
}
/****************************************************************************
* Name: cxd56_ili93404ws_backlight
*
* Description:
* Set the backlight level of the connected display.
*
* Input Parameters:
* spi - Reference to the public driver structure
* level - backligth level
*
* Returned Value:
* OK - On Success
*
****************************************************************************/
static int cxd56_ili93404ws_backlight(FAR struct ili9340_lcd_s *lcd,
int level)
{
if (level > 0)
{
lcd->sendcmd(lcd, ILI9340_WRITE_CTRL_DISPLAY);
lcd->sendparam(lcd, 0x24);
}
else
{
lcd->sendcmd(lcd, ILI9340_WRITE_CTRL_DISPLAY);
lcd->sendparam(lcd, 0x0);
}
return OK;
}
/****************************************************************************
* Name: cxd56_ili93404ws_sendcmd
*
* Description:
* Send a command to the lcd driver.
*
* Input Parameters:
* lcd - Reference to the ili9340_lcd_s driver structure
* cmd - command to send
*
* Returned Value:
* On success - OK
*
****************************************************************************/
static int cxd56_ili93404ws_sendcmd(FAR struct ili9340_lcd_s *lcd,
const uint8_t cmd)
{
FAR struct ili93404ws_lcd_s *priv = (FAR struct ili93404ws_lcd_s *)lcd;
lcdinfo("%02x\n", cmd);
SPI_SETBITS(priv->spi, 8);
/* FIXME: This function can be replaced with SPI_CMDDATA().
* This feature is needed to enable CONFIG_SPI_CMDDATA and board specific
* cmddata() function.
*/
cxd56_gpio_write(DISPLAY_DC, false); /* Indicate CMD */
(void) SPI_SEND(priv->spi, cmd);
cxd56_gpio_write(DISPLAY_DC, true); /* Indicate DATA */
return OK;
}
/****************************************************************************
* Name: cxd56_ili93404ws_sendparam
*
* Description:
* Send a parameter to the lcd driver.
*
* Input Parameters:
* lcd - Reference to the ili9340_lcd_s driver structure
* param - parameter to send
*
* Returned Value:
* OK - On Success
*
****************************************************************************/
static int cxd56_ili93404ws_sendparam(FAR struct ili9340_lcd_s *lcd,
const uint8_t param)
{
FAR struct ili93404ws_lcd_s *priv = (FAR struct ili93404ws_lcd_s *)lcd;
cxd56_gpio_write(DISPLAY_DC, true); /* Indicate DATA */
(void) SPI_SEND(priv->spi, param);
return OK;
}
/****************************************************************************
* Name: cxd56_ili93404ws_sendgram
*
* Description:
* Send a number of pixel words to the lcd driver gram.
*
* Input Parameters:
* lcd - Reference to the ili9340_lcd_s driver structure
* wd - Reference to the words to send
* nwords - number of words to send
*
* Returned Value:
* OK - On Success
*
****************************************************************************/
static int cxd56_ili93404ws_sendgram(FAR struct ili9340_lcd_s *lcd,
const uint16_t *wd, uint32_t nwords)
{
FAR struct ili93404ws_lcd_s *priv = (FAR struct ili93404ws_lcd_s *)lcd;
lcdinfo("lcd:%p, wd=%p, nwords=%d\n", lcd, wd, nwords);
SPI_SETBITS(priv->spi, 16);
(void) SPI_SNDBLOCK(priv->spi, wd, nwords);
return OK;
}
/****************************************************************************
* Name: cxd56_ili93404ws_recvparam
*
* Description:
* Receive a parameter from the lcd driver.
*
* Input Parameters:
* lcd - Reference to the ili9340_lcd_s driver structure
* param - Reference to where parameter receive
*
* Returned Value:
* OK - On Success
*
****************************************************************************/
static int cxd56_ili93404ws_recvparam(FAR struct ili9340_lcd_s *lcd,
uint8_t *param)
{
FAR struct ili93404ws_lcd_s *priv = (FAR struct ili93404ws_lcd_s *)lcd;
cxd56_gpio_write(DISPLAY_DC, true); /* Indicate DATA */
*param = (uint8_t)(SPI_SEND(priv->spi, param) & 0xff);
return OK;
}
/****************************************************************************
* Name: cxd56_ili93404ws_recvgram
*
* Description:
* Receive pixel words from the lcd driver gram.
*
* Input Parameters:
* lcd - Reference to the public driver structure
* wd - Reference to where the pixel words receive
* nwords - number of pixel words to receive
*
* Returned Value:
* OK - On Success
*
****************************************************************************/
static int cxd56_ili93404ws_recvgram(FAR struct ili9340_lcd_s *lcd,
uint16_t *wd, uint32_t nwords)
{
lcdinfo("wd=%p, nwords=%d\n", wd, nwords);
return OK;
};
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_lcd_initialize
*
* Description:
* Initialize the LCD video hardware. The initial state of the LCD is
* fully initialized, display memory cleared, and the LCD ready to use,
* but with the power setting at 0 (full off).
*
****************************************************************************/
int board_lcd_initialize(void)
{
FAR struct ili93404ws_lcd_s *priv = &g_lcddev;
FAR struct spi_dev_s *spi;
lcdinfo("Initializing lcd\n");
if (g_lcd == NULL)
{
spi = cxd56_spibus_initialize(DISPLAY_SPI);
if (!spi)
{
lcderr("ERROR: Failed to initialize spi bus.\n");
return -ENODEV;
}
priv->spi = spi;
/* Reset ILI9340 */
up_mdelay(10);
cxd56_gpio_write(DISPLAY_RST, false);
up_mdelay(10);
cxd56_gpio_write(DISPLAY_RST, true);
up_mdelay(50);
/* Configure SPI */
SPI_SETMODE(priv->spi, SPIDEV_MODE3);
SPI_SETBITS(priv->spi, 8);
(void)SPI_HWFEATURES(priv->spi, 0);
(void)SPI_SETFREQUENCY(priv->spi, ILI9340_SPI_MAXFREQUENCY);
/* Initialize ILI9340 driver with necessary methods */
priv->dev.select = cxd56_ili93404ws_select;
priv->dev.deselect = cxd56_ili93404ws_deselect;
priv->dev.sendcmd = cxd56_ili93404ws_sendcmd;
priv->dev.sendparam = cxd56_ili93404ws_sendparam;
priv->dev.recvparam = cxd56_ili93404ws_recvparam;
priv->dev.sendgram = cxd56_ili93404ws_sendgram;
priv->dev.recvgram = cxd56_ili93404ws_recvgram;
priv->dev.backlight = cxd56_ili93404ws_backlight;
g_lcd = ili9340_initialize(&priv->dev, 0);
}
return OK;
}
/****************************************************************************
* Name: board_lcd_getdev
*
* Description:
* Return a a reference to the LCD object for the specified LCD. This
* allows support for multiple LCD devices.
*
****************************************************************************/
FAR struct lcd_dev_s *board_lcd_getdev(int lcddev)
{
if (lcddev == 0)
{
return g_lcd;
}
return NULL;
}
@@ -1,398 +0,0 @@
/****************************************************************************
* boards/arm/cxd56xx/spresense/src/cxd56_lpm013m091a.c
*
* Copyright 2018 Sony Semiconductor Solutions Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name of Sony Semiconductor Solutions Corporation 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 OWNER 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/spi/spi.h>
#include <nuttx/lcd/lcd.h>
#include <nuttx/lcd/lpm013m091a.h>
#include <arch/board/board.h>
#include "cxd56_gpio.h"
#include "cxd56_spi.h"
#include "cxd56_pinconfig.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Check if the following are defined in the board.h */
#ifndef DISPLAY_RST
# error "DISPLAY_RST must be defined in board.h !!"
#endif
#ifndef DISPLAY_DC
# error "DISPLAY_DC must be defined in board.h !!"
#endif
#ifndef DISPLAY_SPI
# error "DISPLAY_SPI must be defined in board.h !!"
#endif
/****************************************************************************
* Private Type Definition
****************************************************************************/
#ifndef LPM013M091A_SPI_MAXFREQUENCY
# define LPM013M091A_SPI_MAXFREQUENCY 20000000
#endif
/****************************************************************************
* Private Function Protototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
struct lpm013m091a_lcd_s
{
struct lpm013m091a_lcd_s dev;
struct spi_dev_s *spi;
};
static struct lpm013m091a_lcd_s g_lcddev;
static struct lcd_dev_s *g_lcd = NULL;
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: cxd56_lpm013m091a4ws_select
*
* Description:
* Select the SPI, locking and re-configuring if necessary
*
* Input Parameters:
* spi - Reference to the public driver structure
*
* Returned Value:
*
****************************************************************************/
static void cxd56_lpm013m091a4ws_select(FAR struct lpm013m091a_lcd_s *lcd)
{
FAR struct lpm013m091a_lcd_s *priv = (FAR struct lpm013m091a_lcd_s *)lcd;
SPI_LOCK(priv->spi, true);
SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), true);
}
/****************************************************************************
* Name: cxd56_lpm013m091a4ws_deselect
*
* Description:
* De-select the SPI
*
* Input Parameters:
* spi - Reference to the public driver structure
*
* Returned Value:
*
****************************************************************************/
static void cxd56_lpm013m091a4ws_deselect(FAR struct lpm013m091a_lcd_s *lcd)
{
FAR struct lpm013m091a_lcd_s *priv = (FAR struct lpm013m091a_lcd_s *)lcd;
SPI_SELECT(priv->spi, SPIDEV_DISPLAY(0), false);
SPI_LOCK(priv->spi, false);
}
/****************************************************************************
* Name: cxd56_lpm013m091a4ws_backlight
*
* Description:
* Set the backlight level of the connected display.
*
* Input Parameters:
* spi - Reference to the public driver structure
* level - backligth level
*
* Returned Value:
* OK - On Success
*
****************************************************************************/
static int cxd56_lpm013m091a4ws_backlight(FAR struct lpm013m091a_lcd_s *lcd,
int level)
{
if (level > 0)
{
lcd->sendcmd(lcd, 0x53);
lcd->sendparam(lcd, 0x24);
}
else
{
lcd->sendcmd(lcd, 0x53);
lcd->sendparam(lcd, 0x0);
}
return OK;
}
/****************************************************************************
* Name: cxd56_lpm013m091a4ws_sendcmd
*
* Description:
* Send a command to the lcd driver.
*
* Input Parameters:
* lcd - Reference to the lpm013m091a_lcd_s driver structure
* cmd - command to send
*
* Returned Value:
* On success - OK
*
****************************************************************************/
static int cxd56_lpm013m091a4ws_sendcmd(FAR struct lpm013m091a_lcd_s *lcd,
const uint8_t cmd)
{
FAR struct lpm013m091a_lcd_s *priv = (FAR struct lpm013m091a_lcd_s *)lcd;
lcdinfo("%02x\n", cmd);
SPI_SETBITS(priv->spi, 8);
/* FIXME: This function can be replaced with SPI_CMDDATA().
* This feature is needed to enable CONFIG_SPI_CMDDATA and board specific
* cmddata() function.
*/
cxd56_gpio_write(DISPLAY_DC, false); /* Indicate CMD */
(void) SPI_SEND(priv->spi, cmd);
cxd56_gpio_write(DISPLAY_DC, true); /* Indicate DATA */
return OK;
}
/****************************************************************************
* Name: cxd56_lpm013m091a4ws_sendparam
*
* Description:
* Send a parameter to the lcd driver.
*
* Input Parameters:
* lcd - Reference to the lpm013m091a_lcd_s driver structure
* param - parameter to send
*
* Returned Value:
* OK - On Success
*
****************************************************************************/
static int cxd56_lpm013m091a4ws_sendparam(FAR struct lpm013m091a_lcd_s *lcd,
const uint8_t param)
{
FAR struct lpm013m091a_lcd_s *priv = (FAR struct lpm013m091a_lcd_s *)lcd;
cxd56_gpio_write(DISPLAY_DC, true); /* Indicate DATA */
(void) SPI_SEND(priv->spi, param);
return OK;
}
/****************************************************************************
* Name: cxd56_lpm013m091a4ws_sendgram
*
* Description:
* Send a number of pixel words to the lcd driver gram.
*
* Input Parameters:
* lcd - Reference to the lpm013m091a_lcd_s driver structure
* wd - Reference to the words to send
* nwords - number of words to send
*
* Returned Value:
* OK - On Success
*
****************************************************************************/
static int cxd56_lpm013m091a4ws_sendgram(FAR struct lpm013m091a_lcd_s *lcd,
const uint16_t *wd, uint32_t nwords)
{
FAR struct lpm013m091a_lcd_s *priv = (FAR struct lpm013m091a_lcd_s *)lcd;
lcdinfo("lcd:%p, wd=%p, nwords=%d\n", lcd, wd, nwords);
SPI_SETBITS(priv->spi, 16);
(void) SPI_SNDBLOCK(priv->spi, wd, nwords);
return OK;
}
/****************************************************************************
* Name: cxd56_lpm013m091a4ws_recvparam
*
* Description:
* Receive a parameter from the lcd driver.
*
* Input Parameters:
* lcd - Reference to the lpm013m091a_lcd_s driver structure
* param - Reference to where parameter receive
*
* Returned Value:
* OK - On Success
*
****************************************************************************/
static int cxd56_lpm013m091a4ws_recvparam(FAR struct lpm013m091a_lcd_s *lcd,
uint8_t *param)
{
FAR struct lpm013m091a_lcd_s *priv = (FAR struct lpm013m091a_lcd_s *)lcd;
cxd56_gpio_write(DISPLAY_DC, true); /* Indicate DATA */
*param = (uint8_t)(SPI_SEND(priv->spi, param) & 0xff);
return OK;
}
/****************************************************************************
* Name: cxd56_lpm013m091a4ws_recvgram
*
* Description:
* Receive pixel words from the lcd driver gram.
*
* Input Parameters:
* lcd - Reference to the public driver structure
* wd - Reference to where the pixel words receive
* nwords - number of pixel words to receive
*
* Returned Value:
* OK - On Success
*
****************************************************************************/
static int cxd56_lpm013m091a4ws_recvgram(FAR struct lpm013m091a_lcd_s *lcd,
uint16_t *wd, uint32_t nwords)
{
lcdinfo("wd=%p, nwords=%d\n", wd, nwords);
return OK;
};
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_lcd_initialize
*
* Description:
* Initialize the LCD video hardware. The initial state of the LCD is
* fully initialized, display memory cleared, and the LCD ready to use,
* but with the power setting at 0 (full off).
*
****************************************************************************/
int board_lcd_initialize(void)
{
FAR struct lpm013m091a_lcd_s *priv = &g_lcddev;
FAR struct spi_dev_s *spi;
lcdinfo("Initializing lcd\n");
if (g_lcd == NULL)
{
spi = cxd56_spibus_initialize(DISPLAY_SPI);
if (!spi)
{
lcderr("ERROR: Failed to initialize spi bus.\n");
return -ENODEV;
}
priv->spi = spi;
/* Reset LPM013M091A */
up_mdelay(10);
cxd56_gpio_write(DISPLAY_RST, false);
up_mdelay(10);
cxd56_gpio_write(DISPLAY_RST, true);
up_mdelay(50);
/* Configure SPI */
SPI_SETMODE(priv->spi, SPIDEV_MODE3);
SPI_SETBITS(priv->spi, 8);
(void)SPI_HWFEATURES(priv->spi, 0);
(void)SPI_SETFREQUENCY(priv->spi, LPM013M091A_SPI_MAXFREQUENCY);
/* Initialize LPM013M091A driver with necessary methods */
priv->dev.select = cxd56_lpm013m091a4ws_select;
priv->dev.deselect = cxd56_lpm013m091a4ws_deselect;
priv->dev.sendcmd = cxd56_lpm013m091a4ws_sendcmd;
priv->dev.sendparam = cxd56_lpm013m091a4ws_sendparam;
priv->dev.recvparam = cxd56_lpm013m091a4ws_recvparam;
priv->dev.sendgram = cxd56_lpm013m091a4ws_sendgram;
priv->dev.recvgram = cxd56_lpm013m091a4ws_recvgram;
priv->dev.backlight = cxd56_lpm013m091a4ws_backlight;
g_lcd = lpm013m091a_initialize(&priv->dev, 0);
}
return OK;
}
/****************************************************************************
* Name: board_lcd_getdev
*
* Description:
* Return a a reference to the LCD object for the specified LCD. This
* allows support for multiple LCD devices.
*
****************************************************************************/
FAR struct lcd_dev_s *board_lcd_getdev(int lcddev)
{
if (lcddev == 0)
{
return g_lcd;
}
return NULL;
}