1
0
Fork 0
forked from nuttx/nuttx-update

Merged in alinjerpelea/nuttx (pull request #1014)

boards: add stub drivers folder for later use

* boards: add stub drivers folder for later use

    The board/drivers folder is added for future use.

    In this folder we should place drives that are platform specific and
    depend on HW that is present only on a specific platform.

    NOTE: All shared drivers should go to the regular driver folder
    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* tools: shift BOARD_DIR one level up

    In preparation for drivers and common folders we are moving the
    BOARD_DIR path up one level.

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

* tools: add drivers/platform symlink

    Link the boards/<arch>/<chip>/drivers dir to drivers/platform

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

* drivers: add platform specifc drivers extension

    There are platforms that use specific drivers and we should be able to
    include those drivers in the build

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

* board: cxd56xx: drivers: add AK09912 driver for SCU

    This is a platform specific driver connected on the SCU unit.

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

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Alin Jerpelea 2019-08-21 13:39:29 +00:00 committed by Gregory Nutt
parent 507e01cb8e
commit c6355f58d6
57 changed files with 952 additions and 21 deletions

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,6 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
source "drivers/platform/sensors/Kconfig"

View file

@ -0,0 +1,36 @@
############################################################################
# drivers/Makefile
#
# 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.
#
############################################################################
include platform$(DELIM)sensors$(DELIM)Make.defs

View file

@ -0,0 +1,20 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
menuconfig SCU_SENSORS
bool "SCU Sensor Drivers"
if SCU_SENSORS
config SENSORS_AK09912_SCU
bool "Asahi AK09911/AK09912 Compass Sensor"
default n
select CXD56_I2C
select CXD56_SCU
---help---
Enable driver for AK09911/AK09912 Compass sensor.
NOTE: This sensor is connected to the SCU unit
endif # SCU_SENSORS

View file

@ -0,0 +1,42 @@
############################################################################
# drivers/platform/sensors/Make.defs
#
# 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.
#
############################################################################
ifeq ($(CONFIG_SENSORS_AK09912_SCU),y)
CSRCS += ak09912_scu.c
endif
DEPPATH += --dep-path platform$(DELIM)sensors
VPATH += :platform$(DELIM)sensors
CFLAGS += $(shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)platform$(DELIM)sensors)

View file

@ -0,0 +1,582 @@
/****************************************************************************
* drivers/platform/sensors/ak09912_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 <nuttx/config.h>
#include <stdlib.h>
#include <stdio.h>
#include <fixedmath.h>
#include <errno.h>
#include <debug.h>
#include <semaphore.h>
#include <arch/types.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs/fs.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/sensors/ak09912.h>
#include <nuttx/irq.h>
#include <arch/chip/scu.h>
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_AK09912_SCU)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifdef CONFIG_CXD56_DECI_AK09912
# define MAG_SEQ_TYPE SEQ_TYPE_DECI
#else
# define MAG_SEQ_TYPE SEQ_TYPE_NORMAL
#endif
#define AK09912_ADDR 0x0C
#define AK09912_FREQ 400000
#define AK09912_DEVID 0x0448
#define AK09911_DEVID 0x0548
/* REGISTER: WIA
* Who I am.
*/
#define AK09912_WIA1 0x00
#define AK09912_WIA2 0x01
/* REGISTER: CNTL2
* Power mode
*/
#define POWER_MODE_ADDR 0x31
/* REGISTER: ASAX
* Sensitivity values
*/
#define AK09912_ASAX 0x60
/* REGISTER: CNTL1
* Enable or disable temparature measure or enable or disable Noise
* suppression filter.
*/
#define AK09912_CTRL1 0x30
/* REGISTER: HXL
* The start address of data registers.
*/
#define AK09912_HXL 0x11
/* The parameter for compensating. */
#define AK09912_SENSITIVITY (128)
#define AK09912_SENSITIVITY_DIV (256)
/* Noise Suppression Filter */
#define AK09912_NSF_MASK (0x3 << 5)
#define AK09912_NSF_NONE (0x0 << 5)
#define AK09912_NSF_LOW (0x1 << 5)
#define AK09912_NSF_MIDDLE (0x2 << 5)
#define AK09912_NSF_HIGH (0x3 << 5)
/* Power mode */
#define AKM_POWER_DOWN_MODE 0b0000
#define AKM_SINGL_MEAS_MODE 0b00001
#define AKM_CONT_MEAS_1 0b00010
#define AKM_CONT_MEAS_2 0b00100
#define AKM_CONT_MEAS_3 0b00110
#define AKM_CONT_MEAS_4 0b01000
#define AKM_EXT_TRIG_MODE 0b01010
#define AKM_SELF_TEST_MODE 0b10000
#define AKM_FUSE_ROM_MODE 0b11111
/* REGISTER: ST1
* DRDY: Data ready bit. 0: not ready, 1: ready
* DOR: Data overrun. 0: Not overrun, 1: overrun
*/
#define AK09912_ST1 0x10
/* AK09912 is magnetometer */
#define AK09912_BYTESPERSAMPLE 6
#define AK09912_ELEMENTSIZE 2
#ifndef itemsof
# define itemsof(array) (sizeof(array)/sizeof(array[0]))
#endif
/****************************************************************************
* Private Type Definitions
****************************************************************************/
/**
* @brief Structure for ak09912 device
*/
struct ak09912_dev_s
{
FAR struct i2c_master_s *i2c; /* I2C interface */
uint8_t addr; /* I2C address */
int freq; /* Frequency <= 3.4MHz */
int port; /* I2C port */
struct seq_s *seq;
int id;
};
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/* Character driver methods */
static int ak09912_open(FAR struct file *filep);
static int ak09912_close(FAR struct file *filep);
static ssize_t ak09912_read(FAR struct file *filep, FAR char *buffer,
size_t buflen);
static ssize_t ak09912_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen);
static int ak09912_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
/****************************************************************************
* Private Data
****************************************************************************/
static const struct file_operations g_ak09912fops =
{
ak09912_open, /* open */
ak09912_close, /* close */
ak09912_read, /* read */
ak09912_write, /* write */
0, /* seek */
ak09912_ioctl, /* ioctl */
#ifndef CONFIG_DISABLE_POLL
0, /* poll */
#endif
0 /* unlink */
};
/* Take XYZ data, temperature and Status 2 register.
* Status 2 register has a role as data reading end.
*/
static const uint16_t g_ak09912inst[] =
{
SCU_INST_SEND(AK09912_HXL),
SCU_INST_RECV(AK09912_BYTESPERSAMPLE + 2) | SCU_INST_LAST,
};
static struct ak09912_sensadj_s g_asa;
/* Sequencer instance */
static FAR struct seq_s *g_seq = NULL;
/* Reference count */
static int g_refcnt = 0;
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: ak09912_getreg8
*
* Description:
* Read from an 8-bit AK09912 register
*
****************************************************************************/
static uint8_t ak09912_getreg8(FAR struct ak09912_dev_s *priv,
uint8_t regaddr)
{
uint8_t regval = 0;
uint16_t inst[2];
/* Send register to read and get the next byte */
inst[0] = SCU_INST_SEND(regaddr);
inst[1] = SCU_INST_RECV(1) | SCU_INST_LAST;
scu_i2ctransfer(priv->port, priv->addr, inst, 2, &regval, 1);
return regval;
}
/****************************************************************************
* Name: ak09912_putreg8
*
* Description:
* Write to an 8-bit AK09912 register
*
****************************************************************************/
static void ak09912_putreg8(FAR struct ak09912_dev_s *priv, uint8_t regaddr,
uint8_t regval)
{
uint16_t inst[2];
/* Send register address and set the value */
inst[0] = SCU_INST_SEND(regaddr);
inst[1] = SCU_INST_SEND(regval) | SCU_INST_LAST;
scu_i2ctransfer(priv->port, priv->addr, inst, 2, NULL, 0);
}
/****************************************************************************
* Name: ak09912_getreg
*
* Description:
* Read cnt bytes from a ak09912 register
*
****************************************************************************/
static int ak09912_getreg(FAR struct ak09912_dev_s *priv, uint8_t regaddr,
uint8_t* buffer, uint32_t cnt)
{
uint16_t inst[2];
/* Send register to read and get the next byte */
inst[0] = SCU_INST_SEND(regaddr);
inst[1] = SCU_INST_RECV(cnt) | SCU_INST_LAST;
scu_i2ctransfer(priv->port, priv->addr, inst, 2, buffer, cnt);
return OK;
}
/****************************************************************************
* Name: ak09912_checkid
*
* Description:
* Read and verify the AK09911/AK09912 chip ID
*
****************************************************************************/
static int ak09912_checkid(FAR struct ak09912_dev_s *priv)
{
uint16_t devid = 0;
/* Read device ID */
devid = ak09912_getreg8(priv, AK09912_WIA1);
devid += ak09912_getreg8(priv, AK09912_WIA2) << 8;
sninfo("devid: 0x%04x\n", devid);
if (devid != AK09911_DEVID && devid != AK09912_DEVID)
{
/* ID is not Correct */
snerr("Wrong Device ID! %02x\n", devid);
return -ENODEV;
}
return OK;
}
static int ak09912_seqinit(FAR struct ak09912_dev_s *priv)
{
DEBUGASSERT(g_seq == NULL);
/* Open sequencer */
g_seq = seq_open(MAG_SEQ_TYPE, SCU_BUS_I2C0);
if (!g_seq)
{
return -ENOENT;
}
priv->seq = g_seq;
seq_setaddress(priv->seq, priv->addr);
/* Set instruction and sample data information to sequencer */
seq_setinstruction(priv->seq, g_ak09912inst, itemsof(g_ak09912inst));
seq_setsample(priv->seq, AK09912_BYTESPERSAMPLE, 0,
AK09912_ELEMENTSIZE, false);
return OK;
}
/****************************************************************************
* Name: ak09912_open
*
* Description:
* This function is called whenever the AK09912 device is opened.
*
****************************************************************************/
static int ak09912_open(FAR struct file *filep)
{
FAR struct inode *inode = filep->f_inode;
FAR struct ak09912_dev_s *priv = inode->i_private;
if (g_refcnt == 0)
{
int ret;
ret = ak09912_seqinit(priv);
if (ret < 0)
{
return ret;
}
ak09912_putreg8(priv, POWER_MODE_ADDR, AKM_CONT_MEAS_4);
up_mdelay(1);
}
else
{
/* Set existing sequencer */
priv->seq = g_seq;
}
g_refcnt++;
return OK;
}
/****************************************************************************
* Name: ak09912_close
*
* Description:
* This routine is called when the AK09912 device is closed.
*
****************************************************************************/
static int ak09912_close(FAR struct file *filep)
{
FAR struct inode *inode = filep->f_inode;
FAR struct ak09912_dev_s *priv = inode->i_private;
g_refcnt--;
(void) seq_ioctl(priv->seq, priv->id, SCUIOC_STOP, 0);
if (g_refcnt == 0)
{
DEBUGASSERT(g_seq);
ak09912_putreg8(priv, POWER_MODE_ADDR, AKM_POWER_DOWN_MODE);
up_mdelay(1);
seq_close(g_seq);
g_seq = NULL;
}
else
{
(void) seq_ioctl(priv->seq, priv->id, SCUIOC_FREEFIFO, 0);
}
return OK;
}
/****************************************************************************
* Name: ak09912_read
****************************************************************************/
static ssize_t ak09912_read(FAR struct file *filep, FAR char *buffer,
size_t len)
{
FAR struct inode *inode = filep->f_inode;
FAR struct ak09912_dev_s *priv = inode->i_private;
len = len / AK09912_BYTESPERSAMPLE * AK09912_BYTESPERSAMPLE;
len = seq_read(priv->seq, priv->id, buffer, len);
return len;
}
/****************************************************************************
* Name: ak09912_write
****************************************************************************/
static ssize_t ak09912_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen)
{
return -ENOSYS;
}
/****************************************************************************
* Name: ak09912_write
****************************************************************************/
static int ak09912_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
FAR struct inode *inode = filep->f_inode;
FAR struct ak09912_dev_s *priv = inode->i_private;
int ret = OK;
switch (cmd)
{
/* Get sensitivity adjustment value
* Arg: Pointer to struct ak09912_sensadj_s
*/
case SNIOC_GETADJ:
{
struct ak09912_sensadj_s *user = (struct ak09912_sensadj_s *)(uintptr_t)arg;
user->x = g_asa.x;
user->y = g_asa.y;
user->z = g_asa.z;
}
break;
default:
{
if (_SCUIOCVALID(cmd))
{
/* Redirect SCU commands */
ret = seq_ioctl(priv->seq, priv->id, cmd, arg);
}
else
{
snerr("Unrecognized cmd: %d\n", cmd);
ret = - ENOTTY;
}
}
break;
}
return ret;
}
/****************************************************************************
* Public Functions
****************************************************************************/
int ak09912_init(FAR struct i2c_master_s *i2c, int port)
{
FAR struct ak09912_dev_s tmp, *priv = &tmp;
uint8_t val;
int ret;
/* Setup temporary device structure for initialization */
priv->i2c = i2c;
priv->addr = AK09912_ADDR;
priv->freq = AK09912_FREQ;
priv->port = port;
/* Check Device ID */
ret = ak09912_checkid(priv);
if (ret < 0)
{
snerr("Failed to register driver: %d\n", ret);
return ret;
}
ak09912_putreg8(priv, POWER_MODE_ADDR, AKM_FUSE_ROM_MODE);
up_mdelay(1);
ak09912_getreg(priv, AK09912_ASAX, (uint8_t *)&g_asa,
sizeof(struct ak09912_sensadj_s));
ak09912_putreg8(priv, POWER_MODE_ADDR, AKM_POWER_DOWN_MODE);
up_mdelay(1);
/* Set noise suppression filter to LOW */
val = ak09912_getreg8(priv, AK09912_CTRL1);
val = (val & ~AK09912_NSF_MASK) | AK09912_NSF_LOW;
ak09912_putreg8(priv, AK09912_CTRL1, val);
return OK;
}
/****************************************************************************
* Name: ak09912_register
*
* Description:
* Register the AK09912 character device as 'devpath'
*
* Input Parameters:
* devpath - The full path to the driver to register. E.g., "/dev/mag"
* i2c - An instance of the I2C interface to use to communicate with
* AK09912
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int ak09912_register(FAR const char *devpath, int minor,
FAR struct i2c_master_s *i2c, int port)
{
FAR struct ak09912_dev_s *priv;
char path[16];
int ret;
/* Initialize the AK09912 device structure */
priv = (FAR struct ak09912_dev_s *)kmm_malloc(sizeof(struct ak09912_dev_s));
if (!priv)
{
snerr("Failed to allocate instance\n");
return -ENOMEM;
}
priv->i2c = i2c;
priv->id = minor;
priv->addr = AK09912_ADDR;
priv->freq = AK09912_FREQ;
priv->port = port;
/* Register the character driver */
(void) snprintf(path, sizeof(path), "%s%d", devpath, minor);
ret = register_driver(path, &g_ak09912fops, 0666, priv);
if (ret < 0)
{
snerr("Failed to register driver: %d\n", ret);
kmm_free(priv);
}
sninfo("AK09912 driver loaded successfully!\n");
return ret;
}
#endif /* CONFIG_I2C && CONFIG_SENSORS_AK09912_SCU */

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -407,3 +407,13 @@ menuconfig 1WIRE
source drivers/1wire/Kconfig
source drivers/syslog/Kconfig
menuconfig SPECIFIC_DRIVERS
bool "Board specific drivers"
default n
---help---
Board specific drivers located in each board/driver folder.
if SPECIFIC_DRIVERS
source drivers/platform/Kconfig
endif # SPECIFIC_DRIVERS

View file

@ -83,6 +83,10 @@ include wireless$(DELIM)Make.defs
include contactless$(DELIM)Make.defs
include 1wire$(DELIM)Make.defs
ifeq ($(CONFIG_SPECIFIC_DRIVERS),y)
include platform$(DELIM)Make.defs
endif
CSRCS += dev_null.c dev_zero.c
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)

View file

@ -38,7 +38,8 @@
#include <nuttx/config.h>
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_AK09912)
#if defined(CONFIG_I2C) && (defined(CONFIG_SENSORS_AK09912) || defined (CONFIG_SENSORS_AK09912_SCU))
/****************************************************************************
* Pre-processor Definitions
@ -75,7 +76,6 @@ extern "C"
/* Arg: 0: Disable compensated
* 1: Enable compensated
*/
#define ENABLE_COMPENSATED (1)
#define DISABLE_COMPENSATED (0)
#define SNIOC_ENABLE_COMPENSATED _SNIOC(0x0001)
@ -96,6 +96,25 @@ struct ak09912_sensadj_s
uint8_t z;
};
#ifdef CONFIG_SENSORS_AK09912_SCU
/****************************************************************************
* Name: ak09912_init
*
* Description:
* Initialize AK09912 magnetometer device
*
* Input Parameters:
* i2c - An instance of the I2C interface to use to communicate with
* AK09912
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int ak09912_init(FAR struct i2c_master_s *i2c, int port);
#endif
/****************************************************************************
* Name: ak09912_register
*
@ -111,7 +130,12 @@ struct ak09912_sensadj_s
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
#ifdef CONFIG_SENSORS_AK09912_SCU
int ak09912_register(FAR const char *devpath, int minor,
FAR struct i2c_master_s *i2c, int port);
#else
int ak09912_register(FAR const char *devpath, FAR struct i2c_master_s *i2c);
#endif
#undef EXTERN
#ifdef __cplusplus
@ -119,4 +143,4 @@ int ak09912_register(FAR const char *devpath, FAR struct i2c_master_s *i2c);
#endif
#endif /* CONFIG_I2C && CONFIG_AK09912 */
#endif /* __DRIVERS_AK09912_H */
#endif /* __INCLUDE_NUTTX_SENSORS_AK09912_H */

View file

@ -78,7 +78,7 @@ else
BOARD_DIR = $(CONFIG_ARCH_BOARD_CUSTOM_DIR)
endif
else
BOARD_DIR = $(TOPDIR)$(DELIM)boards$(DELIM)$(CONFIG_ARCH)$(DELIM)$(CONFIG_ARCH_CHIP)$(DELIM)$(CONFIG_ARCH_BOARD)
BOARD_DIR = $(TOPDIR)$(DELIM)boards$(DELIM)$(CONFIG_ARCH)$(DELIM)$(CONFIG_ARCH_CHIP)
endif
# CONFIG_APPS_DIR can be over-ridden from the command line or in the .config file.
@ -314,17 +314,23 @@ include/arch: .config
@echo "LN: include/arch to $(ARCH_DIR)/include"
$(Q) $(DIRLINK) $(TOPDIR)/$(ARCH_DIR)/include include/arch
# Link the boards/<arch>/<chip><board>/include directory to include/arch/board
# Link the boards/<arch>/<chip>/<board>/include directory to include/arch/board
include/arch/board: include/arch
@echo "LN: include/arch/board to $(BOARD_DIR)/include"
$(Q) $(DIRLINK) $(BOARD_DIR)/include include/arch/board
@echo "LN: include/arch/board to $(BOARD_DIR)/$(CONFIG_ARCH_BOARD)/include"
$(Q) $(DIRLINK) $(BOARD_DIR)/$(CONFIG_ARCH_BOARD)/include include/arch/board
# Link the boards/<arch>/<chip><board>/src dir to arch/<arch-name>/src/board
# Link the boards/<arch>/<chip>/<board>/src dir to arch/<arch-name>/src/board
$(ARCH_SRC)/board: .config
@echo "LN: $(ARCH_SRC)/board to $(BOARD_DIR)/src"
$(Q) $(DIRLINK) $(BOARD_DIR)/src $(ARCH_SRC)/board
@echo "LN: $(ARCH_SRC)/board to $(BOARD_DIR)/$(CONFIG_ARCH_BOARD)/src"
$(Q) $(DIRLINK) $(BOARD_DIR)/$(CONFIG_ARCH_BOARD)/src $(ARCH_SRC)/board
# Link the boards/<arch>/<chip>/drivers dir to drivers/platform
$(ARCH_SRC)/drivers: .config
@echo "LN: $(ARCH_SRC)/drivers to $(BOARD_DIR)/drivers/platform"
$(Q) $(DIRLINK) $(BOARD_DIR)/drivers $(TOPDIR)/drivers/platform
# Link arch/<arch-name>/include/<chip-name> to arch/<arch-name>/include/chip
@ -342,7 +348,7 @@ ifneq ($(CONFIG_ARCH_CHIP),)
$(Q) $(DIRLINK) $(TOPDIR)/$(ARCH_INC)/$(CONFIG_ARCH_CHIP) include/arch/chip
endif
dirlinks: include/arch include/arch/board include/arch/chip $(ARCH_SRC)/board $(ARCH_SRC)/chip
dirlinks: include/arch include/arch/board include/arch/chip $(ARCH_SRC)/board $(ARCH_SRC)/chip $(ARCH_SRC)/drivers
$(Q) $(MAKE) -C boards dirlinks TOPDIR="$(TOPDIR)"
$(Q) $(MAKE) -C $(CONFIG_APPS_DIR) dirlinks TOPDIR="$(TOPDIR)"
@ -376,6 +382,7 @@ clean_context:
$(Q) $(DIRUNLINK) include/arch
$(Q) $(DIRUNLINK) $(ARCH_SRC)/board
$(Q) $(DIRUNLINK) $(ARCH_SRC)/chip
$(Q) $(DIRUNLINK) $(TOPDIR)/drivers/platform
# check_context
#

View file

@ -73,7 +73,7 @@ else
BOARD_DIR = $(CONFIG_ARCH_BOARD_CUSTOM_DIR)
endif
else
BOARD_DIR = $(TOPDIR)$(DELIM)boards$(DELIM)$(CONFIG_ARCH)$(DELIM)$(CONFIG_ARCH_CHIP)$(DELIM)$(CONFIG_ARCH_BOARD)
BOARD_DIR = $(TOPDIR)$(DELIM)boards$(DELIM)$(CONFIG_ARCH)$(DELIM)$(CONFIG_ARCH_CHIP)
endif
# CONFIG_APPS_DIR can be over-ridden from the command line or in the .config file.
@ -316,25 +316,36 @@ else
$(Q) echo FAKELNK > include\arch\.fakelnk
endif
# Link the boards\<arch>\<chip><board>\include directory to include\arch\board
# Link the boards\<arch>\<chip>\<board>\include directory to include\arch\board
include\arch\board: include\arch
@echo LN: include\arch\board to $(BOARD_DIR)\include
@echo LN: include\arch\board to $(BOARD_DIR)\$(CONFIG_ARCH_BOARD)\include
ifeq ($(CONFIG_WINDOWS_MKLINK),y)
$(Q) /user:administrator mklink /d include\arch\board $(BOARD_DIR)\include
$(Q) /user:administrator mklink /d include\arch\board $(BOARD_DIR)\$(CONFIG_ARCH_BOARD)\include
else
$(Q) xcopy $(BOARD_DIR)\include include\arch\board /c /q /s /e /y /i
$(Q) xcopy $(BOARD_DIR)\$(CONFIG_ARCH_BOARD)\include include\arch\board /c /q /s /e /y /i
$(Q) echo FAKELNK > include\arch\board\.fakelnk
endif
# Link the boards\<arch>\<chip><board>\src dir to arch\<arch-name>\src\board
# Link the boards\<arch>\<chip>\drivers dir to drivers\platform
$(ARCH_SRC)\drivers: .config
@echo LN: drivers\platform to $(BOARD_DIR)\drivers
ifeq ($(CONFIG_WINDOWS_MKLINK),y)
$(Q) /user:administrator mklink /d $(TOPDIR)\drivers\platform $(BOARD_DIR)\drivers
else
$(Q) xcopy $(BOARD_DIR)\drivers $(TOPDIR)\drivers\platform /c /q /s /e /y /i
$(Q) echo FAKELNK > $(TOPDIR)\drivers\platform .fakelnk
endif
# Link the boards\<arch>\<chip>\<board>\src dir to arch\<arch-name>\src\board
$(ARCH_SRC)\board: .config
@echo LN: $(ARCH_SRC)\board to $(BOARD_DIR)\src
@echo LN: $(ARCH_SRC)\board to $(BOARD_DIR)\$(CONFIG_ARCH_BOARD)\src
ifeq ($(CONFIG_WINDOWS_MKLINK),y)
$(Q) /user:administrator mklink /d $(ARCH_SRC)\board $(BOARD_DIR)\src
$(Q) /user:administrator mklink /d $(ARCH_SRC)\board $(BOARD_DIR)\$(CONFIG_ARCH_BOARD)\src
else
$(Q) xcopy $(BOARD_DIR)\src $(ARCH_SRC)\board /c /q /s /e /y /i
$(Q) xcopy $(BOARD_DIR)\$(CONFIG_ARCH_BOARD)\src $(ARCH_SRC)\board /c /q /s /e /y /i
$(Q) echo FAKELNK > $(ARCH_SRC)\board\.fakelnk
endif
@ -364,7 +375,7 @@ else
endif
endif
dirlinks: include\arch include\arch\board include\arch\chip $(ARCH_SRC)\board $(ARCH_SRC)\chip
dirlinks: include\arch include\arch\board include\arch\chip $(ARCH_SRC)\board $(ARCH_SRC)\chip $(ARCH_SRC)\drivers
$(Q) $(MAKE) -C boards dirlinks TOPDIR="$(TOPDIR)"
$(Q) $(MAKE) -C $(CONFIG_APPS_DIR) dirlinks TOPDIR="$(TOPDIR)"
@ -396,6 +407,7 @@ clean_context:
$(call DELDIR, include\arch)
$(call DELDIR, $(ARCH_SRC)\board)
$(call DELDIR, $(ARCH_SRC)\chip)
$(call DELDIR, $(TOPDIR)\drivers\platform)
# check_context
#