diff --git a/arch/arm/include/cxd56xx/backuplog.h b/arch/arm/include/cxd56xx/backuplog.h new file mode 100644 index 00000000000..eedf9c129b7 --- /dev/null +++ b/arch/arm/include/cxd56xx/backuplog.h @@ -0,0 +1,148 @@ +/**************************************************************************** + * arch/arm/include/cxd56xx/backuplog.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 __ARCH_ARM_INCLUDE_CXD56XX_BACKUPLOG_H +#define __ARCH_ARM_INCLUDE_CXD56XX_BACKUPLOG_H + +/**************************************************************************** + * Included Files + ***************************************************************************/ + +#include + +#include +#include + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_backuplog_initialize + * + * Description: + * Initialize the log header where the address and size of each log area + * are decribed. If the log header has been already configured as a wakeup + * from sleeping or reboot case, then do nothing and return OK. + * + * Returned Value: + * OK on success; A negated errno value on failure. + * + ****************************************************************************/ + +int up_backuplog_initialize(void); + +/**************************************************************************** + * Name: up_backuplog_alloc + * + * Description: + * Allocate the log memory region + * + * Input Parameters: + * name - The log region name + * size - The size to allocate + * + * Returned Value: + * The allocated address on success; NULL value on failure. + * + ****************************************************************************/ + +void *up_backuplog_alloc(const char *name, size_t size); + +/**************************************************************************** + * Name: up_backuplog_free + * + * Description: + * De-allocate the log memory region + * + * Input Parameters: + * name - The log region name + * + ****************************************************************************/ + +void up_backuplog_free(const char *name); + +/**************************************************************************** + * Name: up_backuplog_region + * + * Description: + * Get the address and size of the specified log region name + * + * Input Parameters: + * name - The log region name + * addr - The returned address + * size - The returned size + * + * Returned Value: + * The index of log entry on success; A negated errno value on failure. + * + ****************************************************************************/ + +int up_backuplog_region(const char *name, void **addr, size_t *size); + +/**************************************************************************** + * Name: up_backuplog_entry + * + * Description: + * Get the entry name, address and size + * + * Input Parameters: + * name - The returned entry name + * addr - The returned address + * size - The returned size + * + * Returned Value: + * OK on success; A negated errno value on failure. + * + ****************************************************************************/ + +int up_backuplog_entry(char *name, void **addr, size_t *size); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif +#endif /* __ASSEMBLY__ */ + +#endif /* __ARCH_ARM_INCLUDE_CXD56XX_BACKUPLOG_H */ diff --git a/arch/arm/include/cxd56xx/crashdump.h b/arch/arm/include/cxd56xx/crashdump.h new file mode 100644 index 00000000000..c4a3ee50e63 --- /dev/null +++ b/arch/arm/include/cxd56xx/crashdump.h @@ -0,0 +1,165 @@ +/**************************************************************************** + * arch/include/CXD56XX/crashdump.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 __ARCH_ARM_INCLUDE_CXD56XX_CRASHDUMP_H +#define __ARCH_ARM_INCLUDE_CXD56XX_CRASHDUMP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +/* The following guides in the amount of the user and interrupt stack + * data we can save. The amount of storage left will dictate the actual + * number of entries of the user stack data saved. + */ + +#define CRASHLOG_SIZE 1024 +#if CONFIG_ARCH_INTERRUPTSTACK <= 3 +# define NUMBER_STACKS 1 +#else +# define NUMBER_STACKS 2 +#endif +#define CRASHLOG_LEFTOVER (CRASHLOG_SIZE - sizeof(info_t)) +#define CONFIG_ISTACK_SIZE (CRASHLOG_LEFTOVER / NUMBER_STACKS / \ + sizeof(stack_word_t)) +#define CONFIG_USTACK_SIZE (CRASHLOG_LEFTOVER / NUMBER_STACKS / \ + sizeof(stack_word_t)) + +#define ARRAYSIZE(a) (sizeof((a))/sizeof(a[0])) + +/* For Assert keep this much of the file name*/ + +#define MAX_FILE_PATH_LENGTH 40 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/* Used for stack frame storage */ + +typedef uint32_t stack_word_t; + +/* Stack related data */ + +typedef struct +{ + uint32_t sp; + uint32_t top; + uint32_t size; +} _stack_t; + +typedef struct +{ + _stack_t user; +#if CONFIG_ARCH_INTERRUPTSTACK > 3 + _stack_t interrupt; +#endif +} stack_t; + +/* Flags to identify what is in the dump */ + +typedef enum +{ + REGS_PRESENT = 0x01, + USERSTACK_PRESENT = 0x02, + INTSTACK_PRESENT = 0x04, + INVALID_USERSTACK_PTR = 0x20, + INVALID_INTSTACK_PTR = 0x40, +} fault_flags_t; + +typedef struct +{ + struct timespec ts; /* timestamp */ + fault_flags_t flags; /* What is in the dump */ + uintptr_t current_regs; /* Used to validate the dump */ + int lineno; /* __LINE__ to up_assert */ + int pid; /* Process ID */ + uint32_t regs[XCPTCONTEXT_REGS]; /* Interrupt register save area */ + stack_t stacks; /* Stack info */ +#if CONFIG_TASK_NAME_SIZE > 0 + char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NULL + * terminator) */ +#endif + char filename[MAX_FILE_PATH_LENGTH]; /* the Last of chars in + * __FILE__ to up_assert */ +} info_t; + +typedef struct +{ + info_t info; +#if CONFIG_ARCH_INTERRUPTSTACK > 3 + stack_word_t istack[CONFIG_ISTACK_SIZE]; +#endif + stack_word_t ustack[CONFIG_USTACK_SIZE]; +} fullcontext_t; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __ARCH_ARM_INCLUDE_CXD56XX_CRASHDUMP_H */ diff --git a/arch/arm/src/cxd56xx/Kconfig b/arch/arm/src/cxd56xx/Kconfig index 3dcfe81281d..474934ac089 100644 --- a/arch/arm/src/cxd56xx/Kconfig +++ b/arch/arm/src/cxd56xx/Kconfig @@ -26,6 +26,19 @@ config CXD56_WLCSP endchoice +comment "Debug Features" + +config CXD56_BACKUPLOG + bool "Backup Log driver" + default y + +config CXD56_RESET_ON_CRASH + bool "Enable Board Reset on crash" + default n + ---help--- + If selected the board_crashdump should reset the machine after + saveing the state of the machine + comment "Basic Options" config CXD56_XOSC_CLOCK diff --git a/arch/arm/src/cxd56xx/Make.defs b/arch/arm/src/cxd56xx/Make.defs index fff61e0645b..34c56d3f737 100644 --- a/arch/arm/src/cxd56xx/Make.defs +++ b/arch/arm/src/cxd56xx/Make.defs @@ -200,3 +200,7 @@ endif ifeq ($(CONFIG_CXD56_GEOFENCE),y) CHIP_CSRCS += cxd56_geofence.c endif + +ifeq ($(CONFIG_CXD56_BACKUPLOG),y) +CHIP_CSRCS += cxd56_backuplog.c +endif diff --git a/arch/arm/src/cxd56xx/cxd56_backuplog.c b/arch/arm/src/cxd56xx/cxd56_backuplog.c new file mode 100644 index 00000000000..ca9d315be0f --- /dev/null +++ b/arch/arm/src/cxd56xx/cxd56_backuplog.c @@ -0,0 +1,420 @@ +/**************************************************************************** + * bsp/src/cxd56_backuplog.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 + +#include +#include +#include +#include +#include +#include "chip.h" +#include "hardware/cxd5602_backupmem.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Log header information */ + +#define CXD56_LOG_MAGIC (0x48474F4C) /* 'L''O''G''H' */ +#define CXD56_LOG_ENTRY_NUM (31) +#define CXD56_LOG_ENTRY_NAME (8) + +/* Log header magic check */ + +#define CXD56_LOG_MAGIC_CHECK(h) do { \ + if ((h)->magic != CXD56_LOG_MAGIC) \ + { \ + up_backuplog_initialize(); \ + } \ +} while (0) + +/* Log region area definitions */ + +#define AREASIZE (512) +#define AREASHIFT (9) +#define AREAMASK (0x000001ff) + +/* Alignment macros */ + +#define AREA_ALIGNDOWN(size) ((size) & ~AREAMASK) +#define AREA_ALIGNUP(size) (((size) + AREAMASK) & ~AREAMASK) + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +struct entry_s +{ + char name[CXD56_LOG_ENTRY_NAME]; + void *addr; + size_t size; +}; + +struct logheader_s +{ + uint32_t magic; + uint32_t flags; + uint64_t used; + struct entry_s entry[CXD56_LOG_ENTRY_NUM]; +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static struct logheader_s *get_logheader(void) +{ + return (struct logheader_s *)BKUP->log; +} + +static int search_entry(const char *name) +{ + struct logheader_s *header = get_logheader(); + int i; + + for (i = 0; i < CXD56_LOG_ENTRY_NUM; i++) + { + if (0 == strncmp(header->entry[i].name, name, CXD56_LOG_ENTRY_NAME)) + { + return i; + } + } + + return -ENOENT; +} + +static void *get_allocated_memory(const char *name, size_t size) +{ + int index; + void *memaddr; + size_t memsize; + + index = up_backuplog_region(name, &memaddr, &memsize); + if (index >= 0) + { + /* Already allocated */ + + if (memsize == size) + { + return memaddr; + } + else + { + /* If size is different, free here and re-allocate later */ + + up_backuplog_free(name); + } + } + return NULL; +} + +static int allocate_memory(size_t size) +{ + struct logheader_s *header = get_logheader(); + int allocated = 0; + int alloc_num; + uint64_t alloc_bits; + int i; + + alloc_num = AREA_ALIGNUP(size) >> AREASHIFT; + alloc_bits = (1ULL << alloc_num) - 1; + for (i = 0; i <= 64 - alloc_num; i++) + { + if ((~header->used & alloc_bits) == alloc_bits) + { + allocated = i; + break; + } + alloc_bits <<= 1; + } + + if (allocated) + { + header->used |= alloc_bits; + } + + return allocated; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_backuplog_initialize + * + * Description: + * Initialize the log header where the address and size of each log area + * are decribed. If the log header has been already configured in a wakeup + * from sleeping or reboot case, then do nothing and return OK. + * + * Returned Value: + * OK on success; A negated errno value on failure. + * + ****************************************************************************/ + +int up_backuplog_initialize(void) +{ + struct logheader_s *header = get_logheader(); + + if (header->magic != CXD56_LOG_MAGIC) + { + /* Initialize log header */ + + memset(header, 0, sizeof(struct logheader_s)); + + header->magic = CXD56_LOG_MAGIC; + header->flags = 0; + header->used = 0x1; + } + + return 0; +} + +/**************************************************************************** + * Name: up_backuplog_alloc + * + * Description: + * Allocate the log memory region + * + * Input Parameters: + * name - The log region name + * size - The size to allocate + * + * Returned Value: + * The allocated address on success; NULL value on failure. + * + ****************************************************************************/ + +void *up_backuplog_alloc(const char *name, size_t size) +{ + struct logheader_s *header = get_logheader(); + irqstate_t flags; + int index; + int allocated = 0; + void *addr = NULL; + + if (0 == size) + { + return NULL; + } + + flags = enter_critical_section(); + + CXD56_LOG_MAGIC_CHECK(header); + + /* Already allocated or not */ + + addr = get_allocated_memory(name, size); + if (addr) + { + goto exit; + } + + /* Allocate a new memory region */ + + allocated = allocate_memory(size); + if (0 == allocated) + { + goto exit; + } + + /* Register a entry into empty region */ + + for (index = 0; index < CXD56_LOG_ENTRY_NUM; index++) + { + if (0 == header->entry[index].size) + { + strncpy(header->entry[index].name, name, CXD56_LOG_ENTRY_NAME); + header->entry[index].addr = (void *)((uint32_t)header + + (allocated << AREASHIFT)); + header->entry[index].size = size; + + addr = header->entry[index].addr; + break; + } + } + +exit: + leave_critical_section(flags); + return addr; +} + +/**************************************************************************** + * Name: up_backuplog_free + * + * Description: + * De-allocate the log memory region + * + * Input Parameters: + * name - The log region name + * + ****************************************************************************/ + +void up_backuplog_free(const char *name) +{ + struct logheader_s *header = get_logheader(); + irqstate_t flags; + int index; + void *addr; + size_t size; + uint64_t alloc_bits; + int offset; + + flags = enter_critical_section(); + + CXD56_LOG_MAGIC_CHECK(header); + + index = up_backuplog_region(name, &addr, &size); + if (index >= 0) + { + alloc_bits = (1ULL << (AREA_ALIGNUP(size) >> AREASHIFT)) - 1; + offset = ((uint32_t)addr - (uint32_t)header) >> AREASHIFT; + alloc_bits <<= offset; + + header->used &= ~alloc_bits; + memset(&header->entry[index], 0, sizeof(struct entry_s)); + } + + leave_critical_section(flags); + + return; +} + +/**************************************************************************** + * Name: up_backuplog_region + * + * Description: + * Get the address and size of the specified log region name + * + * Input Parameters: + * name - The log region name + * addr - The returned address + * size - The returned size + * + * Returned Value: + * The index of log entry on success; A negated errno value on failure. + * + ****************************************************************************/ + +int up_backuplog_region(const char *name, void **addr, size_t *size) +{ + struct logheader_s *header = get_logheader(); + irqstate_t flags; + int index; + + DEBUGASSERT(addr); + DEBUGASSERT(size); + + *addr = NULL; + *size = 0; + + flags = enter_critical_section(); + + CXD56_LOG_MAGIC_CHECK(header); + + index = search_entry(name); + if (index >= 0) + { + *addr = header->entry[index].addr; + *size = header->entry[index].size; + } + + leave_critical_section(flags); + + return index; +} + +/**************************************************************************** + * Name: up_backuplog_entry + * + * Description: + * Get the entry name, address and size + * + * Input Parameters: + * name - The returned entry name + * addr - The returned address + * size - The returned size + * + * Returned Value: + * OK on success; A negated errno value on failure. + * + ****************************************************************************/ + +int up_backuplog_entry(char *name, void **addr, size_t *size) +{ + struct logheader_s *header = get_logheader(); + irqstate_t flags; + int index; + + DEBUGASSERT(name); + DEBUGASSERT(addr); + DEBUGASSERT(size); + + *addr = NULL; + *size = 0; + + flags = enter_critical_section(); + + CXD56_LOG_MAGIC_CHECK(header); + + for (index = 0; index < CXD56_LOG_ENTRY_NUM; index++) + { + if ('\0' != header->entry[index].name[0]) + { + break; + } + } + + leave_critical_section(flags); + + if (index < CXD56_LOG_ENTRY_NUM) + { + memcpy(name, header->entry[index].name, CXD56_LOG_ENTRY_NAME); + *addr = header->entry[index].addr; + *size = header->entry[index].size; + return 0; + } + else + { + return -ENOENT; + } +} diff --git a/boards/arm/cxd56xx/common/src/Make.defs b/boards/arm/cxd56xx/common/src/Make.defs index 19a888aa355..0e8a37acdad 100644 --- a/boards/arm/cxd56xx/common/src/Make.defs +++ b/boards/arm/cxd56xx/common/src/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/arm/cxd56x/spresense/common/Make.defs +# boards/arm/cxd56xx/common/src/Make.defs # # Copyright 2018 Sony Semiconductor Solutions Corporation # @@ -32,6 +32,14 @@ # ############################################################################ +ifeq ($(CONFIG_CXD56_BACKUPLOG),y) +CSRCS += cxd56_crashdump.c +endif + +ifeq ($(CONFIG_SENSORS),y) +CSRCS += cxd56_sensors.c +endif + ifeq ($(CONFIG_SENSORS_AK09912),y) CSRCS += cxd56_ak09912_i2c.c endif @@ -48,10 +56,70 @@ ifeq ($(CONFIG_SENSORS_APDS9960),y) CSRCS += cxd56_apds9960_i2c.c endif +ifeq ($(CONFIG_SENSORS_BH1721FVC_SCU),y) +CSRCS += cxd56_bh1721fvc_scu.c +endif + +ifeq ($(CONFIG_SENSORS_BH1745NUC_SCU),y) +CSRCS += cxd56_bh1745nuc_scu.c +endif + +ifeq ($(CONFIG_SENSORS_BM1383GLV_SCU),y) +CSRCS += cxd56_bm1383glv_scu.c +endif + +ifeq ($(CONFIG_SENSORS_BM1422GMV_SCU),y) +CSRCS += cxd56_bm1422gmv_scu.c +endif + ifeq ($(CONFIG_SENSORS_BMI160_I2C),y) CSRCS += cxd56_bmi160_i2c.c endif +ifeq ($(CONFIG_SENSORS_BMI160_SCU),y) +CSRCS += cxd56_bmi160_scu.c +endif + +ifeq ($(CONFIG_SENSORS_BMI160_SPI),y) +CSRCS += cxd56_bmi160_spi.c +endif + +ifeq ($(CONFIG_SENSORS_BMP280_I2C),y) +CSRCS += cxd56_bmp280_i2c.c +endif + +ifeq ($(CONFIG_SENSORS_BMP280_SCU),y) +CSRCS += cxd56_bmp280_scu.c +endif + +ifeq ($(CONFIG_SENSORS_KX022_SCU),y) +CSRCS += cxd56_kx022_scu.c +endif + +ifeq ($(CONFIG_SENSORS_LT1PA01_SCU),y) +CSRCS += cxd56_lt1pa01_scu.c +endif + +ifeq ($(CONFIG_SENSORS_RPR0521RS_SCU),y) +CSRCS += cxd56_rpr0521rs_scu.c +endif + +ifeq ($(CONFIG_NETDEVICES),y) +CSRCS += cxd56_netinit.c +endif + +ifeq ($(CONFIG_WL_GS2200M),y) +CSRCS += cxd56_gs2200m.c +endif + +ifeq ($(CONFIG_LCD_ILI9340),y) +CSRCS += cxd56_ili9340.c +endif + +ifeq ($(CONFIG_LCD_LPM013M091A),y) +CSRCS += cxd56_lpm013m091a.c +endif + DEPPATH += --dep-path src VPATH += :src CFLAGS += $(shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src) diff --git a/boards/arm/cxd56xx/common/src/cxd56_ak09912_i2c.c b/boards/arm/cxd56xx/common/src/cxd56_ak09912_i2c.c index 7c72d0950eb..b9122ff19ec 100644 --- a/boards/arm/cxd56xx/common/src/cxd56_ak09912_i2c.c +++ b/boards/arm/cxd56xx/common/src/cxd56_ak09912_i2c.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/cxd56xx/spresense/src/cxd56_ak09912.c + * boards/arm/cxd56xx/common/src/cxd56_ak09912.c * * Copyright 2018 Sony Semiconductor Solutions Corporation * diff --git a/boards/arm/cxd56xx/common/src/cxd56_ak09912_scu.c b/boards/arm/cxd56xx/common/src/cxd56_ak09912_scu.c index bb1b5977efa..06d2b57688e 100644 --- a/boards/arm/cxd56xx/common/src/cxd56_ak09912_scu.c +++ b/boards/arm/cxd56xx/common/src/cxd56_ak09912_scu.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/cxd56xx/spresense/src/cxd56_ak09912.c + * boards/arm/cxd56xx/common/src/cxd56_ak09912.c * * Copyright 2018 Sony Semiconductor Solutions Corporation * diff --git a/boards/arm/cxd56xx/common/src/cxd56_bh1721fvc_scu.c b/boards/arm/cxd56xx/common/src/cxd56_bh1721fvc_scu.c new file mode 100644 index 00000000000..19deb78185d --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_bh1721fvc_scu.c @@ -0,0 +1,88 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_bh1721fvc_scu.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 + +#include +#include +#include + +#include + +#include +#include + +#include "cxd56_i2c.h" + +#ifdef CONFIG_SENSORS_BH1721FVC_SCU +int board_bh1721fvc_initialize(FAR const char *devpath, int bus) +{ + int ret; + FAR struct i2c_master_s *i2c; + + sninfo("Initializing BH1721FVC...\n"); + + /* Initialize i2c deivce */ + + i2c = cxd56_i2cbus_initialize(bus); + if (!i2c) + { + snerr("ERROR: Failed to initialize i2c%d.\n", bus); + return -ENODEV; + } + + ret = bh1721fvc_init(i2c, bus); + if (ret < 0) + { + snerr("Error initialize BH1721FVC.\n"); + return ret; + } + + /* Register devices for each FIFOs at I2C bus */ + + ret = bh1721fvc_register(devpath, 0, i2c, bus); + if (ret < 0) + { + snerr("Error registering BH1721FVC.\n"); + return ret; + } + + return ret; +} +#endif /* CONFIG_SENSORS_BH1721FVC_SCU */ diff --git a/boards/arm/cxd56xx/common/src/cxd56_bh1745nuc_scu.c b/boards/arm/cxd56xx/common/src/cxd56_bh1745nuc_scu.c new file mode 100644 index 00000000000..0acfeed73cd --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_bh1745nuc_scu.c @@ -0,0 +1,88 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_bh1745nuc_scu.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 + +#include +#include +#include + +#include + +#include +#include + +#include "cxd56_i2c.h" + +#ifdef CONFIG_SENSORS_BH1745NUC_SCU +int board_bh1745nuc_initialize(FAR const char *devpath, int bus) +{ + int ret; + FAR struct i2c_master_s *i2c; + + sninfo("Initializing BH1745NUC...\n"); + + /* Initialize i2c deivce */ + + i2c = cxd56_i2cbus_initialize(bus); + if (!i2c) + { + snerr("ERROR: Failed to initialize i2c%d.\n", bus); + return -ENODEV; + } + + ret = bh1745nuc_init(i2c, bus); + if (ret < 0) + { + snerr("Error initialize BH1745NUC.\n"); + return ret; + } + + /* Register devices for each FIFOs at I2C bus */ + + ret = bh1745nuc_register(devpath, 0, i2c, bus); + if (ret < 0) + { + snerr("Error registering BH1745NUC.\n"); + return ret; + } + + return ret; +} +#endif /* CONFIG_SENSORS_BH1745NUC_SCU */ diff --git a/boards/arm/cxd56xx/common/src/cxd56_bm1383glv_scu.c b/boards/arm/cxd56xx/common/src/cxd56_bm1383glv_scu.c new file mode 100644 index 00000000000..a7a7f1df8d8 --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_bm1383glv_scu.c @@ -0,0 +1,88 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_bm1383glv_scu.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 + +#include +#include +#include + +#include + +#include +#include + +#include "cxd56_i2c.h" + +#ifdef CONFIG_SENSORS_BM1383GLV_SCU +int board_bm1383glv_initialize(FAR const char *devpath, int bus) +{ + int ret; + FAR struct i2c_master_s *i2c; + + sninfo("Initializing BM1383GLV...\n"); + + /* Initialize i2c deivce */ + + i2c = cxd56_i2cbus_initialize(bus); + if (!i2c) + { + snerr("ERROR: Failed to initialize i2c%d.\n", bus); + return -ENODEV; + } + + ret = bm1383glv_init(i2c, bus); + if (ret < 0) + { + snerr("Error initialize BM1383GLV.\n"); + return ret; + } + + /* Register devices for each FIFOs at I2C bus */ + + ret = bm1383glv_register(devpath, 0, i2c, bus); + if (ret < 0) + { + snerr("Error registering BM1383GLV.\n"); + return ret; + } + + return ret; +} +#endif /* CONFIG_SENSORS_BM1383GLV_SCU */ diff --git a/boards/arm/cxd56xx/common/src/cxd56_bm1422gmv_scu.c b/boards/arm/cxd56xx/common/src/cxd56_bm1422gmv_scu.c new file mode 100644 index 00000000000..0e9feb2093b --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_bm1422gmv_scu.c @@ -0,0 +1,98 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_bm1422gmv_scu.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 + +#include +#include +#include + +#include + +#include +#include + +#include "cxd56_i2c.h" + +#ifdef CONFIG_CXD56_DECI_BM1422GMV +# define BM1422GMV_PATH_CNT 3 +#else +# define BM1422GMV_PATH_CNT 1 +#endif + +#ifdef CONFIG_SENSORS_BM1422GMV_SCU +int board_bm1422gmv_initialize(FAR const char *devpath, int bus) +{ + int id = 0; + int ret; + FAR struct i2c_master_s *i2c; + + sninfo("Initializing BM1422GMV...\n"); + + /* Initialize i2c deivce */ + + i2c = cxd56_i2cbus_initialize(bus); + if (!i2c) + { + snerr("ERROR: Failed to initialize i2c%d.\n", bus); + return -ENODEV; + } + + ret = bm1422gmv_init(i2c, bus); + if (ret < 0) + { + snerr("Error initialize BM1422GMV.\n"); + return ret; + } + + /* Register devices for each FIFOs at I2C bus */ + + for (id = 0; id < BM1422GMV_PATH_CNT; id++) + { + ret = bm1422gmv_register(devpath, id, i2c, bus); + if (ret < 0) + { + snerr("Error registering BM1422GMV.\n"); + return ret; + } + } + + return ret; +} +#endif /* CONFIG_SENSORS_BM1422GMV_SCU */ diff --git a/boards/arm/cxd56xx/common/src/cxd56_bmi160_scu.c b/boards/arm/cxd56xx/common/src/cxd56_bmi160_scu.c new file mode 100644 index 00000000000..182f3f56e6f --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_bmi160_scu.c @@ -0,0 +1,119 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_bmi160_scu.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 + +#include +#include +#include + +#include +#include +#include +#include + +#include "cxd56_spi.h" + +#ifdef CONFIG_CXD56_DECI_GYRO +# define GYRO_NR_SEQS 3 +#else +# define GYRO_NR_SEQS 1 +#endif + +#ifdef CONFIG_CXD56_DECI_ACCEL +# define ACCEL_NR_SEQS 3 +#else +# define ACCEL_NR_SEQS 1 +#endif + +#if defined(CONFIG_SENSORS_BMI160_SCU) + +int board_bmi160_initialize(int bus) +{ + int ret; + FAR struct spi_dev_s *spi; + + sninfo("Initializing BMI160..\n"); + + /* Initialize spi deivce */ + + spi = cxd56_spibus_initialize(bus); + if (!spi) + { + snerr("ERROR: Failed to initialize spi%d.\n", bus); + return -ENODEV; + } + + int i; + + ret = bmi160_init(spi); + if (ret < 0) + { + snerr("Error initialize BMI160\n"); + return ret; + } + + /* Create char devices for each FIFOs */ + + for (i = 0; i < GYRO_NR_SEQS; i++) + { + ret = bmi160gyro_register("/dev/gyro", i, spi); + if (ret < 0) + { + snerr("Error registering gyroscope. %d\n", ret); + return ret; + } + } + + /* Create char devices for each FIFOs */ + + for (i = 0; i < ACCEL_NR_SEQS; i++) + { + ret = bmi160accel_register("/dev/accel", i, spi); + if (ret < 0) + { + snerr("Error registering accelerometer. %d\n", ret); + return ret; + } + } + + return ret; +} + +#endif diff --git a/boards/arm/cxd56xx/common/src/cxd56_bmi160_spi.c b/boards/arm/cxd56xx/common/src/cxd56_bmi160_spi.c new file mode 100644 index 00000000000..f0740adf838 --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_bmi160_spi.c @@ -0,0 +1,91 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_bmi160_spi.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 + +#include +#include +#include + +#include +#include +#include + +#include "cxd56_spi.h" + +#ifdef CONFIG_CXD56_DECI_GYRO +# define GYRO_NR_SEQS 3 +#else +# define GYRO_NR_SEQS 1 +#endif + +#ifdef CONFIG_CXD56_DECI_ACCEL +# define ACCEL_NR_SEQS 3 +#else +# define ACCEL_NR_SEQS 1 +#endif + +#if defined(CONFIG_CXD56_SPI) && defined(CONFIG_SENSORS_BMI160) + +int board_bmi160_initialize(int bus) +{ + int ret; + FAR struct spi_dev_s *spi; + + sninfo("Initializing BMI160..\n"); + + /* Initialize spi deivce */ + + spi = cxd56_spibus_initialize(bus); + if (!spi) + { + snerr("ERROR: Failed to initialize spi%d.\n", bus); + return -ENODEV; + } + + ret = bmi160_register("/dev/accel0", spi); + if (ret < 0) + { + snerr("Error registering BMI160\n"); + } + + return ret; +} + +#endif diff --git a/boards/arm/cxd56xx/common/src/cxd56_bmp280_i2c.c b/boards/arm/cxd56xx/common/src/cxd56_bmp280_i2c.c new file mode 100644 index 00000000000..cdc69c31184 --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_bmp280_i2c.c @@ -0,0 +1,77 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_bmp280_i2c.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 + +#include +#include +#include + +#include + +#include + +#include "cxd56_i2c.h" + +#if defined(CONFIG_CXD56_I2C) && defined(CONFIG_SENSORS_BMP280) +int board_bmp280_initialize(int bus) +{ + int ret; + FAR struct i2c_master_s *i2c; + + snerr("Initializing BMP280..\n"); + + /* Initialize i2c deivce */ + + i2c = cxd56_i2cbus_initialize(bus); + if (!i2c) + { + snerr("ERROR: Failed to initialize i2c%d.\n", bus); + return -ENODEV; + } + + ret = bmp280_register("/dev/press0", i2c); + if (ret < 0) + { + snerr("Error registering BMP280\n"); + } + + return ret; +} +#endif diff --git a/boards/arm/cxd56xx/common/src/cxd56_bmp280_scu.c b/boards/arm/cxd56xx/common/src/cxd56_bmp280_scu.c new file mode 100644 index 00000000000..da14b1693b9 --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_bmp280_scu.c @@ -0,0 +1,117 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_bmp280_scu.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 + +#include +#include +#include + +#include + +#include +#include + +#include "cxd56_i2c.h" + +#ifdef CONFIG_CXD56_DECI_PRESS +# define PRESS_NR_SEQS 3 +#else +# define PRESS_NR_SEQS 1 +#endif + +#ifdef CONFIG_CXD56_DECI_TEMP +# define TEMP_NR_SEQS 3 +#else +# define TEMP_NR_SEQS 1 +#endif + +#ifdef CONFIG_SENSORS_BMP280_SCU +int board_bmp280_initialize(int bus) +{ + int i; + int ret; + FAR struct i2c_master_s *i2c; + + sninfo("Initializing BMP280..\n"); + + /* Initialize i2c deivce */ + + i2c = cxd56_i2cbus_initialize(bus); + if (!i2c) + { + snerr("ERROR: Failed to initialize i2c%d.\n", bus); + return -ENODEV; + } + + ret = bmp280_init(i2c, bus); + if (ret < 0) + { + snerr("Error initialize BMP280.\n"); + return ret; + } + + /* Create char devices for each FIFOs */ + + for (i = 0; i < PRESS_NR_SEQS; i++) + { + ret = bmp280press_register("/dev/press", i, i2c, bus); + if (ret < 0) + { + snerr("Error registering pressure. %d\n", ret); + return ret; + } + } + + /* Create char devices for each FIFOs */ + + for (i = 0; i < TEMP_NR_SEQS; i++) + { + ret = bmp280temp_register("/dev/temp", i, i2c, bus); + if (ret < 0) + { + snerr("Error registering temperature. %d\n", ret); + return ret; + } + } + + return ret; +} + +#endif diff --git a/boards/arm/cxd56xx/common/src/cxd56_crashdump.c b/boards/arm/cxd56xx/common/src/cxd56_crashdump.c new file mode 100644 index 00000000000..b8409921e16 --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_crashdump.c @@ -0,0 +1,261 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_crashdump.c + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: David Sidrane + * 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 NuttX 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 + +#include +#include +#include +#include +#include +#include + +#include +#include +#include "cxd56_wdt.h" + +#include "up_arch.h" +#include "up_internal.h" + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_reset_on_crash + * + * Description: + * System reboot. This API can be called from the interrupt handler. + * + ****************************************************************************/ + +#if defined(CONFIG_CXD56_RESET_ON_CRASH) +static int nmi_handler(int irq, FAR void *context, FAR void *arg) +{ + return 0; +} + +static void board_reset_on_crash(void) +{ + /* Overwrite NMI handler to the empty dummy function, + * because of preventing PANIC() from occurring again. + */ + + irq_attach(CXD56_IRQ_NMI, nmi_handler, NULL); + + /* Output the reset signal by self watchdog timer, + * so then the system cpu resets the system. + */ + + putreg32(WDOGLOCK_UNLOCK_KEY, CXD56_WDT_WDOGLOCK); + putreg32(WDOGITCR_ENABLE, CXD56_WDT_WDOGITCR); + putreg32(WDOGITOP_WDOGRES, CXD56_WDT_WDOGITOP); + + __asm volatile ("dsb"); + for (; ; ); +} +#endif /* CONFIG_CXD56_RESET_ON_CRASH */ + +/**************************************************************************** + * Name: copy_reverse + ****************************************************************************/ + +static void copy_reverse(stack_word_t *dest, stack_word_t *src, int size) +{ + while (size--) + { + *dest++ = *src--; + } +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_crashdump + ****************************************************************************/ + +void board_crashdump(uintptr_t currentsp, FAR void *tcb, + FAR const uint8_t *filename, int lineno) +{ + FAR struct tcb_s *rtcb; + fullcontext_t *pdump; + + (void)enter_critical_section(); + + rtcb = (FAR struct tcb_s *)tcb; +#ifdef CONFIG_CXD56_BACKUPLOG + pdump = up_backuplog_alloc("crash", sizeof(fullcontext_t)); +#else + pdump = malloc(sizeof(fullcontext_t)); +#endif + if (!pdump) + { + goto exit; + } + + /* Zero out everything */ + + memset(pdump, 0, sizeof(fullcontext_t)); + + /* Save Info */ + + clock_gettime(CLOCK_REALTIME, &pdump->info.ts); + pdump->info.lineno = lineno; + + if (filename) + { + int offset = 0; + unsigned int len = strlen((char *)filename) + 1; + + if (len > sizeof(pdump->info.filename)) + { + offset = len - sizeof(pdump->info.filename); + } + + strncpy(pdump->info.filename, (char *)&filename[offset], + sizeof(pdump->info.filename)); + } + + /* Save the value of the pointer for current_regs as debugging info. + * It should be NULL in case of an ASSERT and will aid in cross + * checking the validity of system memory at the time of the + * fault. + */ + + pdump->info.current_regs = (uintptr_t)CURRENT_REGS; + + /* Save Context */ + +#if CONFIG_TASK_NAME_SIZE > 0 + strncpy(pdump->info.name, rtcb->name, CONFIG_TASK_NAME_SIZE); +#endif + + pdump->info.pid = rtcb->pid; + + /* If current_regs is not NULL then we are in an interrupt context + * and the user context is in current_regs else we are running in + * the users context + */ + + if (CURRENT_REGS) + { +#if CONFIG_ARCH_INTERRUPTSTACK > 3 + pdump->info.stacks.interrupt.sp = currentsp; +#endif + pdump->info.flags |= (REGS_PRESENT | USERSTACK_PRESENT | \ + INTSTACK_PRESENT); + memcpy(pdump->info.regs, (void *)CURRENT_REGS, + sizeof(pdump->info.regs)); + pdump->info.stacks.user.sp = pdump->info.regs[REG_R13]; + } + else + { + /* users context */ + + pdump->info.flags |= USERSTACK_PRESENT; + pdump->info.stacks.user.sp = currentsp; + } + + if (pdump->info.pid == 0) + { + pdump->info.stacks.user.top = g_idle_topstack - 4; + pdump->info.stacks.user.size = CONFIG_IDLETHREAD_STACKSIZE; + } + else + { + pdump->info.stacks.user.top = (uint32_t)rtcb->adj_stack_ptr; + pdump->info.stacks.user.size = (uint32_t)rtcb->adj_stack_size; + } + +#if CONFIG_ARCH_INTERRUPTSTACK > 3 + /* Get the limits on the interrupt stack memory */ + + pdump->info.stacks.interrupt.top = (uint32_t)&g_intstackbase; + pdump->info.stacks.interrupt.size = (CONFIG_ARCH_INTERRUPTSTACK & ~3); + + /* If In interrupt Context save the interrupt stack data centered + * about the interrupt stack pointer + */ + + if ((pdump->info.flags & INTSTACK_PRESENT) != 0) + { + stack_word_t *ps = (stack_word_t *) pdump->info.stacks.interrupt.sp; + copy_reverse(pdump->istack, &ps[ARRAYSIZE(pdump->istack) / 2], + ARRAYSIZE(pdump->istack)); + } + + /* Is it Invalid? */ + + if (!(pdump->info.stacks.interrupt.sp <= pdump->info.stacks.interrupt.top && + pdump->info.stacks.interrupt.sp > pdump->info.stacks.interrupt.top - + pdump->info.stacks.interrupt.size)) + { + pdump->info.flags |= INVALID_INTSTACK_PTR; + } + +#endif + /* If In interrupt context or User save the user stack data centered + * about the user stack pointer + */ + + if ((pdump->info.flags & USERSTACK_PRESENT) != 0) + { + stack_word_t *ps = (stack_word_t *) pdump->info.stacks.user.sp; + copy_reverse(pdump->ustack, &ps[ARRAYSIZE(pdump->ustack) / 2], + ARRAYSIZE(pdump->ustack)); + } + + /* Is it Invalid? */ + + if (!(pdump->info.stacks.user.sp <= pdump->info.stacks.user.top && + pdump->info.stacks.user.sp > pdump->info.stacks.user.top - + pdump->info.stacks.user.size)) + { + pdump->info.flags |= INVALID_USERSTACK_PTR; + } + +exit: +#if defined(CONFIG_CXD56_RESET_ON_CRASH) + board_reset_on_crash(); +#endif + return; +} diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_gs2200m.c b/boards/arm/cxd56xx/common/src/cxd56_gs2200m.c similarity index 99% rename from boards/arm/cxd56xx/spresense/src/cxd56_gs2200m.c rename to boards/arm/cxd56xx/common/src/cxd56_gs2200m.c index 04e21339a95..64845da1bc6 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_gs2200m.c +++ b/boards/arm/cxd56xx/common/src/cxd56_gs2200m.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/cxd56xx/spresense/src/cxd56_gs2200m.c + * boards/arm/cxd56xx/common/src/cxd56_gs2200m.c * * Copyright 2019 Sony Home Entertainment & Sound Products Inc. * Author: Masayuki Ishikawa diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_ili9340.c b/boards/arm/cxd56xx/common/src/cxd56_ili9340.c similarity index 99% rename from boards/arm/cxd56xx/spresense/src/cxd56_ili9340.c rename to boards/arm/cxd56xx/common/src/cxd56_ili9340.c index d1caa1b41a9..8120ffab52d 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_ili9340.c +++ b/boards/arm/cxd56xx/common/src/cxd56_ili9340.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/cxd56xx/spresense/src/cxd56_ili9340.c + * boards/arm/cxd56xx/common/src/cxd56_ili9340.c * * Copyright 2018 Sony Semiconductor Solutions Corporation * diff --git a/boards/arm/cxd56xx/common/src/cxd56_kx022_scu.c b/boards/arm/cxd56xx/common/src/cxd56_kx022_scu.c new file mode 100644 index 00000000000..cc36de64dc4 --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_kx022_scu.c @@ -0,0 +1,98 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_kx022_scu.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 + +#include +#include +#include + +#include + +#include +#include + +#include "cxd56_i2c.h" + +#ifdef CONFIG_CXD56_DECI_KX022 +# define KX022_FIFO_CNT 3 +#else +# define KX022_FIFO_CNT 1 +#endif + +#ifdef CONFIG_SENSORS_KX022_SCU +int board_kx022_initialize(FAR const char *devpath, int bus) +{ + int fifoid = 0; + int ret; + FAR struct i2c_master_s *i2c; + + sninfo("Initializing KX022...\n"); + + /* Initialize i2c deivce */ + + i2c = cxd56_i2cbus_initialize(bus); + if (!i2c) + { + snerr("ERROR: Failed to initialize i2c%d.\n", bus); + return -ENODEV; + } + + ret = kx022_init(i2c, bus); + if (ret < 0) + { + snerr("Error initialize KX022.\n"); + return ret; + } + + /* Register devices for each FIFOs at I2C bus */ + + for (fifoid = 0; fifoid < KX022_FIFO_CNT; fifoid++) + { + ret = kx022_register(devpath, fifoid, i2c, bus); + if (ret < 0) + { + snerr("Error registering KX022.\n"); + return ret; + } + } + + return ret; +} +#endif /* CONFIG_SENSORS_KX022_SCU */ diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_lpm013m091a.c b/boards/arm/cxd56xx/common/src/cxd56_lpm013m091a.c similarity index 99% rename from boards/arm/cxd56xx/spresense/src/cxd56_lpm013m091a.c rename to boards/arm/cxd56xx/common/src/cxd56_lpm013m091a.c index 923789652c9..78e70ac7f11 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_lpm013m091a.c +++ b/boards/arm/cxd56xx/common/src/cxd56_lpm013m091a.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/cxd56xx/spresense/src/cxd56_lpm013m091a.c + * boards/arm/cxd56xx/common/src/cxd56_lpm013m091a.c * * Copyright 2018 Sony Semiconductor Solutions Corporation * diff --git a/boards/arm/cxd56xx/common/src/cxd56_lt1pa01_scu.c b/boards/arm/cxd56xx/common/src/cxd56_lt1pa01_scu.c new file mode 100644 index 00000000000..dc3978b061e --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_lt1pa01_scu.c @@ -0,0 +1,95 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_lt1pa01_scu.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 + +#include +#include +#include + +#include + +#include +#include + +#include "cxd56_i2c.h" + +#ifdef CONFIG_SENSORS_LT1PA01_SCU +int board_lt1pa01_initialize(int bus) +{ + int ret; + FAR struct i2c_master_s *i2c; + + sninfo("Initializing LT1PA01...\n"); + + /* Initialize i2c deivce */ + + i2c = cxd56_i2cbus_initialize(bus); + if (!i2c) + { + snerr("ERROR: Failed to initialize i2c%d.\n", bus); + return -ENODEV; + } + + ret = lt1pa01_init(i2c, bus); + if (ret < 0) + { + snerr("Error initialize LT1PA01.\n"); + return ret; + } + + /* Register devices for each FIFOs at I2C bus */ + + ret = lt1pa01als_register("/dev/light", 0, i2c, bus); + if (ret < 0) + { + snerr("Error registering LT1PA01[ALS].\n"); + return ret; + } + + ret = lt1pa01prox_register("/dev/proximity", 0, i2c, bus); + if (ret < 0) + { + snerr("Error registering LT1PA01[PS].\n"); + return ret; + } + + return ret; +} +#endif /* CONFIG_SENSORS_LT1PA01_SCU */ diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_netinit.c b/boards/arm/cxd56xx/common/src/cxd56_netinit.c similarity index 97% rename from boards/arm/cxd56xx/spresense/src/cxd56_netinit.c rename to boards/arm/cxd56xx/common/src/cxd56_netinit.c index 3826993c2d8..adec9f65990 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_netinit.c +++ b/boards/arm/cxd56xx/common/src/cxd56_netinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/cxd56xx/spresense/src/cxd56_netinit.c + * boards/arm/cxd56xx/common/src/cxd56_netinit.c * * Copyright 2019 Sony Home Entertainment & Sound Products Inc. * Author: Masayuki Ishikawa diff --git a/boards/arm/cxd56xx/common/src/cxd56_rpr0521rs_scu.c b/boards/arm/cxd56xx/common/src/cxd56_rpr0521rs_scu.c new file mode 100644 index 00000000000..213915b49ec --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_rpr0521rs_scu.c @@ -0,0 +1,95 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_rpr0521rs_src.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 + +#include +#include +#include + +#include + +#include +#include + +#include "cxd56_i2c.h" + +#ifdef CONFIG_SENSORS_RPR0521RS_SCU +int board_rpr0521rs_initialize(int bus) +{ + int ret; + FAR struct i2c_master_s *i2c; + + sninfo("Initializing RPR0521RS...\n"); + + /* Initialize i2c deivce */ + + i2c = cxd56_i2cbus_initialize(bus); + if (!i2c) + { + snerr("ERROR: Failed to initialize i2c%d.\n", bus); + return -ENODEV; + } + + ret = rpr0521rs_init(i2c, bus); + if (ret < 0) + { + snerr("Error initialize RPR0521RS.\n"); + return ret; + } + + /* Register devices for each FIFOs at I2C bus */ + + ret = rpr0521rsals_register("/dev/light", 0, i2c, bus); + if (ret < 0) + { + snerr("Error registering RPR0521RS[ALS].\n"); + return ret; + } + + ret = rpr0521rsps_register("/dev/proximity", 0, i2c, bus); + if (ret < 0) + { + snerr("Error registering RPR0521RS[PS].\n"); + return ret; + } + + return ret; +} +#endif /* CONFIG_SENSORS_RPR0521RS_SCU */ diff --git a/boards/arm/cxd56xx/common/src/cxd56_sensors.c b/boards/arm/cxd56xx/common/src/cxd56_sensors.c new file mode 100644 index 00000000000..f9fa4dcea35 --- /dev/null +++ b/boards/arm/cxd56xx/common/src/cxd56_sensors.c @@ -0,0 +1,286 @@ +/**************************************************************************** + * boards/arm/cxd56xx/common/src/cxd56_sensors.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 + +#include +#include +#include + +#include +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Check if the following are defined in the board.h */ + +#ifndef SENSOR_I2C +# error "SENSOR_I2C must be defined in board.h !!" +#endif +#ifndef SENSOR_SPI +# error "SENSOR_SPI must be defined in board.h !!" +#endif + +/* Configuration Sanity check */ + +#if defined(CONFIG_SENSORS_BMI160) || defined(CONFIG_SENSORS_BMI160_SCU) +# define _BMI160 1 +#else +# define _BMI160 0 +#endif + +#if defined(CONFIG_SENSORS_KX022) || defined(CONFIG_SENSORS_KX022_SCU) +# define _KX022 1 +#else +# define _KX022 0 +#endif + +#if defined(CONFIG_SENSORS_BMP280) || defined(CONFIG_SENSORS_BMP280_SCU) +# define _BMP280 1 +#else +# define _BMP280 0 +#endif + +#if defined(CONFIG_SENSORS_BM1383GLV)&& defined(CONFIG_SENSORS_BM1383GLV_SCU) +# define _BM1383GLV 1 +#else +# define _BM1383GLV 0 +#endif + +#if defined(CONFIG_SENSORS_AK09912) || defined(CONFIG_SENSORS_AK09912_SCU) +# define _AK09912 1 +#else +# define _AK09912 0 +#endif + +#if defined(CONFIG_SENSORS_BM1422GMV) || defined(CONFIG_SENSORS_BM1422GMV_SCU) +# define _BM1422GMV 1 +#else +# define _BM1422GMV 0 +#endif + +#if defined(CONFIG_SENSORS_APDS9930) || defined (CONFIG_SENSORS_APDS9930_SCU) +# define _APDS9930 1 +#else +# define _APDS9930 0 +#endif + +#if defined(CONFIG_SENSORS_LT1PA01) || defined(CONFIG_SENSORS_LT1PA01_SCU) +# define _LT1PA01 1 +#else +# define _LT1PA01 0 +#endif + +#if defined(CONFIG_SENSORS_BH1721FVC) || defined(CONFIG_SENSORS_BH1721FVC_SCU) +# define _BH1721FVC 1 +#else +# define _BH1721FVC 0 +#endif + +#if defined(CONFIG_SENSORS_RPR0521RS) || defined(CONFIG_SENSORS_RPR0521RS_SCU) +# define _RPR0521RS 1 +#else +# define _RPR0521RS 0 +#endif + +#if (_BMI160 + _KX022) > 1 +# error "Duplicate accelerometer sensor device." +#endif + +#if (_AK09912 + _BM1422GMV) > 1 +# error "Duplicate magnetic sensor device." +#endif + +#if (_BMP280 + _BM1383GLV) > 1 +# error "Duplicate pressure sensor device." +#endif + +#if (_APDS9930 + _LT1PA01 + _BH1721FVC + _RPR0521RS) > 1 +# error "Duplicate proximity and ambient light sensor device." +#endif + +/* Sensor Device Registration Macro */ + +#define _DEVICE_WOPATH(_name, _bus) \ + { \ + .name = #_name, \ + .devpath = NULL, \ + .bus = _bus, \ + { \ + .init = board_ ## _name ##_initialize, \ + }, \ + } + +#define _DEVICE(_name, _path, _bus) \ + { \ + .name = #_name, \ + .devpath = _path, \ + .bus = _bus, \ + { \ + .initdev = board_ ## _name ##_initialize, \ + }, \ + } + +#define _I2C_DEVICE(_name, _path) _DEVICE(_name, _path, SENSOR_I2C) +#define _SPI_DEVICE(_name, _path) _DEVICE(_name, _path, SENSOR_SPI) + +#define _I2C_DEVICE_WOPATH(_name) _DEVICE_WOPATH(_name, SENSOR_I2C) +#define _SPI_DEVICE_WOPATH(_name) _DEVICE_WOPATH(_name, SENSOR_SPI) + +/************************************************************************************ + * Private Types + ************************************************************************************/ + +typedef int (*_init_t)(int bus); +typedef int (*_initdev_t)(FAR const char *devpath, int bus); + +struct sensor_device_s +{ + const char *name; /* Sensor device name */ + const char *devpath; /* Sensor device path */ + int bus; /* I2C or SPI bus number */ + union + { + _init_t init; /* Sensor initializer w/o devpath */ + _initdev_t initdev; /* Sensor initializer with devpath */ + } init_u; +}; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static struct sensor_device_s sensor_device[] = +{ +#if defined(CONFIG_SENSORS_BMI160) || defined(CONFIG_SENSORS_BMI160_SCU) +# ifdef CONFIG_SENSORS_BMI160_I2C + _I2C_DEVICE_WOPATH(bmi160), /* Accel + Gyro */ +# else /* CONFIG_SENSORS_BMI160_SPI */ + _SPI_DEVICE_WOPATH(bmi160), +# endif +#endif +#if defined(CONFIG_SENSORS_KX022) || defined(CONFIG_SENSORS_KX022_SCU) + _I2C_DEVICE(kx022, "/dev/accel"), /* Accel */ +#endif +#if defined(CONFIG_SENSORS_BMP280) || defined(CONFIG_SENSORS_BMP280_SCU) + _I2C_DEVICE_WOPATH(bmp280), /* Pressure */ +#endif +#if defined(CONFIG_SENSORS_BM1383GLV) || defined(CONFIG_SENSORS_BM1383GLV_SCU) + _I2C_DEVICE(bm1383glv, "/dev/press"), +#endif +#if defined(CONFIG_SENSORS_AK09912) || defined(CONFIG_SENSORS_AK09912_SCU) + _I2C_DEVICE(ak09912, "/dev/mag"), /* Magnetic */ +#endif +#if defined(CONFIG_SENSORS_BM1422GMV) || defined(CONFIG_SENSORS_BM1422GMV_SCU) + _I2C_DEVICE(bm1422gmv, "/dev/mag"), +#endif +#if defined(CONFIG_SENSORS_APDS9930) || defined(CONFIG_SENSORS_APDS9930_SCU) + _I2C_DEVICE_WOPATH(apds9930), /* Proximity + Light */ +#endif +#if defined(CONFIG_SENSORS_LT1PA01) || defined(CONFIG_SENSORS_LT1PA01_SCU) + _I2C_DEVICE_WOPATH(lt1pa01), +#endif +#if defined(CONFIG_SENSORS_BH1721FVC) || defined(CONFIG_SENSORS_BH1721FVC_SCU) + _I2C_DEVICE(bh1721fvc, "/dev/light"), +#endif +#if defined(CONFIG_SENSORS_RPR0521RS) || defined(CONFIG_SENSORS_RPR0521RS_SCU) + _I2C_DEVICE_WOPATH(rpr0521rs), +#endif +#if defined(CONFIG_SENSORS_APDS9960) || defined(CONFIG_SENSORS_APDS9960_SCU) + _I2C_DEVICE(apds9960, "/dev/gesture"), /* Gesture */ +#endif +#if defined(CONFIG_SENSORS_BH1745NUC) || defined(CONFIG_SENSORS_BH1745NUC_SCU) + _I2C_DEVICE(bh1745nuc, "/dev/color"), /* Color */ +#endif +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_sensors_initialize + * + * Description: + * Perform sensor devices initialization + * + ****************************************************************************/ + +int board_sensors_initialize(void) +{ + int ret = 0; + int i; + FAR struct sensor_device_s *dev; + + ret = board_power_control(POWER_SENSOR, true); + if (ret) + { + _err("Failed to power on sensor: %d\n", ret); + return -EPERM; + } + + /* Wait for power-up max time */ + + up_mdelay(10); + + /* Initialize each sensor device */ + + for (i = 0; i < sizeof(sensor_device) / sizeof(sensor_device[0]); i++) + { + dev = &sensor_device[i]; + if (dev->devpath) + { + ret = dev->init_u.initdev(dev->devpath, dev->bus); + } + else + { + ret = dev->init_u.init(dev->bus); + } + + if (ret < 0) + { + _err("Failed to init %s at bus %d: %d\n", dev->name, dev->bus, ret); + } + } + + return ret; +} diff --git a/boards/arm/cxd56xx/spresense/include/board.h b/boards/arm/cxd56xx/spresense/include/board.h index 761197c1382..f49a2c23b60 100644 --- a/boards/arm/cxd56xx/spresense/include/board.h +++ b/boards/arm/cxd56xx/spresense/include/board.h @@ -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. diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_bh1721fvc.h b/boards/arm/cxd56xx/spresense/include/cxd56_bh1721fvc.h new file mode 100644 index 00000000000..0cf07434258 --- /dev/null +++ b/boards/arm/cxd56xx/spresense/include/cxd56_bh1721fvc.h @@ -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 + +/**************************************************************************** + * 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 */ diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_bh1745nuc.h b/boards/arm/cxd56xx/spresense/include/cxd56_bh1745nuc.h new file mode 100644 index 00000000000..bdf1674353c --- /dev/null +++ b/boards/arm/cxd56xx/spresense/include/cxd56_bh1745nuc.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 + +/**************************************************************************** + * 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 */ diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_bm1383glv.h b/boards/arm/cxd56xx/spresense/include/cxd56_bm1383glv.h new file mode 100644 index 00000000000..afa96043c12 --- /dev/null +++ b/boards/arm/cxd56xx/spresense/include/cxd56_bm1383glv.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 + +/**************************************************************************** + * 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 */ diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_bm1422gmv.h b/boards/arm/cxd56xx/spresense/include/cxd56_bm1422gmv.h new file mode 100644 index 00000000000..a0ac4ec468a --- /dev/null +++ b/boards/arm/cxd56xx/spresense/include/cxd56_bm1422gmv.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 + +/**************************************************************************** + * 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 */ diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_bmp280.h b/boards/arm/cxd56xx/spresense/include/cxd56_bmp280.h new file mode 100644 index 00000000000..49d11cff891 --- /dev/null +++ b/boards/arm/cxd56xx/spresense/include/cxd56_bmp280.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 + +/**************************************************************************** + * 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 */ diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_kx022.h b/boards/arm/cxd56xx/spresense/include/cxd56_kx022.h new file mode 100644 index 00000000000..96c5f6ab2ec --- /dev/null +++ b/boards/arm/cxd56xx/spresense/include/cxd56_kx022.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 + +/**************************************************************************** + * 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 */ diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_lt1pa01.h b/boards/arm/cxd56xx/spresense/include/cxd56_lt1pa01.h new file mode 100644 index 00000000000..76781887150 --- /dev/null +++ b/boards/arm/cxd56xx/spresense/include/cxd56_lt1pa01.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 + +/**************************************************************************** + * 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 */ diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_rpr0521rs.h b/boards/arm/cxd56xx/spresense/include/cxd56_rpr0521rs.h new file mode 100644 index 00000000000..3689dc67001 --- /dev/null +++ b/boards/arm/cxd56xx/spresense/include/cxd56_rpr0521rs.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 + +/**************************************************************************** + * 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 */ diff --git a/boards/arm/cxd56xx/spresense/include/cxd56_sensors.h b/boards/arm/cxd56xx/spresense/include/cxd56_sensors.h new file mode 100644 index 00000000000..5356a1e585c --- /dev/null +++ b/boards/arm/cxd56xx/spresense/include/cxd56_sensors.h @@ -0,0 +1,80 @@ +/**************************************************************************** + * boards/arm/cxd56xx/spresense/include/cxd56_sensors.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_SENSORS_H +#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_SENSORS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#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 */ diff --git a/boards/arm/cxd56xx/spresense/src/Make.defs b/boards/arm/cxd56xx/spresense/src/Make.defs index 83960ee52d2..f315448ac63 100644 --- a/boards/arm/cxd56xx/spresense/src/Make.defs +++ b/boards/arm/cxd56xx/spresense/src/Make.defs @@ -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) diff --git a/include/nuttx/sensors/bh1721fvc.h b/include/nuttx/sensors/bh1721fvc.h index 37f80516e4b..1f689466a80 100644 --- a/include/nuttx/sensors/bh1721fvc.h +++ b/include/nuttx/sensors/bh1721fvc.h @@ -38,7 +38,7 @@ #include -#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_BH1721FVC) || defined(CONFIG_SENORS_BH1721FVC_SCU) +#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_BH1721FVC) || defined(CONFIG_SENSORS_BH1721FVC_SCU) /**************************************************************************** * Pre-processor Definitions diff --git a/include/nuttx/sensors/bh1745nuc.h b/include/nuttx/sensors/bh1745nuc.h index 6f0646fe1d0..59056e89ee8 100644 --- a/include/nuttx/sensors/bh1745nuc.h +++ b/include/nuttx/sensors/bh1745nuc.h @@ -38,7 +38,7 @@ #include -#if defined(CONFIG_I2C) && (defined(CONFIG_SENSORS_BH1745NUC) || defined(CONFIG_SENSORS_BH1745NUC_SRC)) +#if defined(CONFIG_I2C) && (defined(CONFIG_SENSORS_BH1745NUC) || defined(CONFIG_SENSORS_BH1745NUC_SCU)) /**************************************************************************** * Pre-processor Definitions