Add include/sensors/ioctl.h; make sure that all IOCTL values are unique to avoid all misuse.
This commit is contained in:
parent
fab80037aa
commit
595f00e271
@ -43,6 +43,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/sensors/ioctl.h>
|
||||
|
||||
#if defined(CONFIG_BH1750FVI)
|
||||
|
||||
@ -50,17 +51,7 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* IOCTL Commands ***********************************************************/
|
||||
|
||||
#define SNIOC_CHRM _SNIOC(0x0001) /* Contin. H-Res Mode Arg: None */
|
||||
#define SNIOC_CHRM2 _SNIOC(0x0002) /* Contin. H-Res Mode2 Arg: None */
|
||||
#define SNIOC_CLRM _SNIOC(0x0003) /* Contin. L-Res Mode Arg: None */
|
||||
#define SNIOC_OTHRM _SNIOC(0x0004) /* One Time H-Res Mode Arg: None */
|
||||
#define SNIOC_OTHRM2 _SNIOC(0x0005) /* One Time H-Res Mode2 Arg: None */
|
||||
#define SNIOC_OTLRM _SNIOC(0x0006) /* One Time L-Res Mode Arg: None */
|
||||
#define SNIOC_CHMEATIME _SNIOC(0x0007) /* Change Meas. Time Arg: uint8_t */
|
||||
|
||||
/* Device I2C Address*/
|
||||
/* Device I2C Address */
|
||||
|
||||
#define BH1750FVI_I2C_ADDR 0x23
|
||||
|
||||
|
118
include/nuttx/sensors/ioctl.h
Normal file
118
include/nuttx/sensors/ioctl.h
Normal file
@ -0,0 +1,118 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/input/ioctl.h
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Alan Carvalho de Assis <acassis@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_SENSORS_IOCTL_H
|
||||
#define __INCLUDE_NUTTX_SENSORS_IOCTL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* IOCTL commands unique to the BH1750FVI */
|
||||
|
||||
#define SNIOC_CHRM _SNIOC(0x0001) /* Contin. H-Res Mode Arg: None */
|
||||
#define SNIOC_CHRM2 _SNIOC(0x0002) /* Contin. H-Res Mode2 Arg: None */
|
||||
#define SNIOC_CLRM _SNIOC(0x0003) /* Contin. L-Res Mode Arg: None */
|
||||
#define SNIOC_OTHRM _SNIOC(0x0004) /* One Time H-Res Mode Arg: None */
|
||||
#define SNIOC_OTHRM2 _SNIOC(0x0005) /* One Time H-Res Mode2 Arg: None */
|
||||
#define SNIOC_OTLRM _SNIOC(0x0006) /* One Time L-Res Mode Arg: None */
|
||||
#define SNIOC_CHMEATIME _SNIOC(0x0007) /* Change Meas. Time Arg: uint8_t */
|
||||
|
||||
/* IOCTL commands unique to the KXJT9 */
|
||||
|
||||
#define SNIOC_ENABLE _SNIOC(0x0008) /* Arg: None */
|
||||
#define SNIOC_DISABLE _SNIOC(0x0009) /* Arg: None */
|
||||
#define SNIOC_CONFIGURE _SNIOC(0x000a) /* Arg: enum kxtj9_odr_e value */
|
||||
|
||||
/* IOCTL commands common to the LM75, LM92 (and compatible parts) */
|
||||
|
||||
#define SNIOC_READCONF _SNIOC(0x000b) /* Arg: uint8_t* pointer */
|
||||
#define SNIOC_WRITECONF _SNIOC(0x000c) /* Arg: uint8_t value */
|
||||
#define SNIOC_SHUTDOWN _SNIOC(0x000d) /* Arg: None */
|
||||
#define SNIOC_POWERUP _SNIOC(0x000e) /* Arg: None */
|
||||
#define SNIOC_FAHRENHEIT _SNIOC(0x000f) /* Arg: None */
|
||||
#define SNIOC_CENTIGRADE _SNIOC(0x0010) /* Arg: None */
|
||||
#define SNIOC_READTHYS _SNIOC(0x0011) /* Arg: b16_t* pointer */
|
||||
#define SNIOC_WRITETHYS _SNIOC(0x0012) /* Arg: b16_t value */
|
||||
|
||||
/* IOCTL commands unique to the LM75 */
|
||||
|
||||
#define SNIOC_READTOS _SNIOC(0x0013) /* Arg: b16_t* pointer */
|
||||
#define SNIOC_WRITETOS _SNIOC(0x0014) /* Arg: b16_t value */
|
||||
|
||||
/* IOCTL commands unique to the LM92 */
|
||||
|
||||
#define SNIOC_READTCRIT _SNIOC(0x0015) /* Arg: b16_t* pointer */
|
||||
#define SNIOC_WRITETCRIT _SNIOC(0x0016) /* Arg: b16_t value */
|
||||
#define SNIOC_READTLOW _SNIOC(0x0017) /* Arg: b16_t* pointer */
|
||||
#define SNIOC_WRITETLOW _SNIOC(0x0018) /* Arg: b16_t value */
|
||||
#define SNIOC_READTHIGH _SNIOC(0x0019) /* Arg: b16_t* pointer */
|
||||
#define SNIOC_WRITETHIGH _SNIOC(0x001a) /* Arg: b16_t value */
|
||||
#define SNIOC_READID _SNIOC(0x001b) /* Arg: uint16_t* pointer */
|
||||
|
||||
/* IOCTL commands unique to the LSM9DS1 */
|
||||
|
||||
#define SNIOC_START _SNIOC(0x001c) /* Arg: None */
|
||||
#define SNIOC_STOP _SNIOC(0x001d) /* Arg: None */
|
||||
#define SNIOC_SETSAMPLERATE _SNIOC(0x001e) /* Arg: uint32_t value */
|
||||
#define SNIOC_SETFULLSCALE _SNIOC(0x001f) /* Arg: uint32_t value */
|
||||
|
||||
/* IOCTL commands unique to the MB7040 */
|
||||
|
||||
#define SNIOC_MEASURE _SNIOC(0x0020) /* Arg: None */
|
||||
#define SNIOC_RANGE _SNIOC(0x0021) /* Arg: int32_t* pointer */
|
||||
#define SNIOC_CHANGEADDR _SNIOC(0x0022) /* Arg: uint8_t value */
|
||||
|
||||
/* IOCTL commands unique to the MCP9844 */
|
||||
|
||||
#define SNIOC_READTEMP _SNIOC(0x0023) /* Arg: mcp9844_temp_arg_s* pointer */
|
||||
#define SNIOC_SETRESOLUTION _SNIOC(0x0024) /* Arg: uint16_t value */
|
||||
|
||||
/* IOCTL commands unique to the MS58XX */
|
||||
|
||||
#define SNIOC_MEASURE _SNIOC(0x0025) /* Arg: None */
|
||||
#define SNIOC_TEMPERATURE _SNIOC(0x0026) /* Arg: int32_t* pointer */
|
||||
#define SNIOC_PRESSURE _SNIOC(0x0027) /* Arg: int32_t* pointer */
|
||||
#define SNIOC_RESET _SNIOC(0x0028) /* Arg: None */
|
||||
#define SNIOC_OVERSAMPLING _SNIOC(0x0029) /* Arg: uint16_t value */
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_IOCTL_H */
|
@ -44,19 +44,10 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdint.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/sensors/ioctl.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_SENSOR_KXTJ9)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* IOCTL Commands ***********************************************************/
|
||||
|
||||
#define SNIOC_ENABLE _SNIOC(0x0001) /* Arg: None */
|
||||
#define SNIOC_DISABLE _SNIOC(0x0002) /* Arg: None */
|
||||
#define SNIOC_CONFIGURE _SNIOC(0x0003) /* Arg: enum kxtj9_odr_e value */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
@ -41,7 +41,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/sensors/ioctl.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_I2C_LM75)
|
||||
|
||||
@ -63,19 +63,6 @@
|
||||
#define CONFIG_LM75_ADDR6 (CONFIG_LM75_BASEADDR + 6)
|
||||
#define CONFIG_LM75_ADDR7 (CONFIG_LM75_BASEADDR + 7)
|
||||
|
||||
/* IOCTL Commands ***********************************************************/
|
||||
|
||||
#define SNIOC_READCONF _SNIOC(0x0001) /* Arg: uint8_t* pointer */
|
||||
#define SNIOC_WRITECONF _SNIOC(0x0002) /* Arg: uint8_t value */
|
||||
#define SNIOC_SHUTDOWN _SNIOC(0x0003) /* Arg: None */
|
||||
#define SNIOC_POWERUP _SNIOC(0x0004) /* Arg: None */
|
||||
#define SNIOC_FAHRENHEIT _SNIOC(0x0005) /* Arg: None */
|
||||
#define SNIOC_CENTIGRADE _SNIOC(0x0006) /* Arg: None */
|
||||
#define SNIOC_READTHYS _SNIOC(0x0007) /* Arg: b16_t* pointer */
|
||||
#define SNIOC_WRITETHYS _SNIOC(0x0008) /* Arg: b16_t value */
|
||||
#define SNIOC_READTOS _SNIOC(0x0009) /* Arg: b16_t* pointer */
|
||||
#define SNIOC_WRITETOS _SNIOC(0x000a) /* Arg: b16_t value */
|
||||
|
||||
/* LM-75 Register Definitions ***********************************************/
|
||||
/* LM-75 Registers addresses */
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/sensors/ioctl.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_LM92)
|
||||
|
||||
@ -61,24 +61,6 @@
|
||||
#define CONFIG_LM92_ADDR2 (CONFIG_LM92_BASEADDR + 2)
|
||||
#define CONFIG_LM92_ADDR3 (CONFIG_LM92_BASEADDR + 3)
|
||||
|
||||
/* IOCTL Commands ***********************************************************/
|
||||
|
||||
#define SNIOC_READCONF _SNIOC(0x0001) /* Arg: uint8_t* pointer */
|
||||
#define SNIOC_WRITECONF _SNIOC(0x0002) /* Arg: uint8_t value */
|
||||
#define SNIOC_SHUTDOWN _SNIOC(0x0003) /* Arg: None */
|
||||
#define SNIOC_POWERUP _SNIOC(0x0004) /* Arg: None */
|
||||
#define SNIOC_FAHRENHEIT _SNIOC(0x0005) /* Arg: None */
|
||||
#define SNIOC_CENTIGRADE _SNIOC(0x0006) /* Arg: None */
|
||||
#define SNIOC_READTHYS _SNIOC(0x0007) /* Arg: b16_t* pointer */
|
||||
#define SNIOC_WRITETHYS _SNIOC(0x0008) /* Arg: b16_t value */
|
||||
#define SNIOC_READTCRIT _SNIOC(0x0009) /* Arg: b16_t* pointer */
|
||||
#define SNIOC_WRITETCRIT _SNIOC(0x000a) /* Arg: b16_t value */
|
||||
#define SNIOC_READTLOW _SNIOC(0x000b) /* Arg: b16_t* pointer */
|
||||
#define SNIOC_WRITETLOW _SNIOC(0x000c) /* Arg: b16_t value */
|
||||
#define SNIOC_READTHIGH _SNIOC(0x000d) /* Arg: b16_t* pointer */
|
||||
#define SNIOC_WRITETHIGH _SNIOC(0x000e) /* Arg: b16_t value */
|
||||
#define SNIOC_READID _SNIOC(0x000f) /* Arg: uint16_t* pointer */
|
||||
|
||||
/* LM92 Register Definitions ***********************************************/
|
||||
/* LM92 Register Addresses */
|
||||
|
||||
|
@ -41,19 +41,13 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/sensors/ioctl.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_SN_LSM9DS1)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* IOCTL Commands ***********************************************************/
|
||||
|
||||
#define SNIOC_START _SNIOC(0x0001) /* Arg: None */
|
||||
#define SNIOC_STOP _SNIOC(0x0002) /* Arg: None */
|
||||
#define SNIOC_SETSAMPLERATE _SNIOC(0x0003) /* Arg: uint32_t value */
|
||||
#define SNIOC_SETFULLSCALE _SNIOC(0x0004) /* Arg: uint32_t value */
|
||||
|
||||
/* I2C Addresses ************************************************************/
|
||||
/* Accelerometer addresses */
|
||||
|
@ -41,7 +41,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/sensors/ioctl.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_MB7040)
|
||||
|
||||
@ -57,12 +57,6 @@
|
||||
* Enables support for the MB7040 driver
|
||||
*/
|
||||
|
||||
/* IOCTL Commands ***********************************************************/
|
||||
|
||||
#define SNIOC_MEASURE _SNIOC(0x0001) /* Arg: None */
|
||||
#define SNIOC_RANGE _SNIOC(0x0002) /* Arg: int32_t* pointer */
|
||||
#define SNIOC_CHANGEADDR _SNIOC(0x0003) /* Arg: uint8_t value */
|
||||
|
||||
/* I2C Addresses ************************************************************/
|
||||
|
||||
#define MB7040_DEFAULTADDR 0x70 /* Default I2C Address */
|
||||
|
@ -41,7 +41,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/sensors/ioctl.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_MCP9844)
|
||||
|
||||
@ -49,11 +49,6 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* IOCTL Commands ***********************************************************/
|
||||
|
||||
#define SNIOC_READTEMP _SNIOC(0x0001) /* Arg: mcp9844_temp_arg_s* pointer */
|
||||
#define SNIOC_SETRESOLUTION _SNIOC(0x0002) /* Arg: uint16_t value */
|
||||
|
||||
/* MCP9844 Register Definitions *********************************************/
|
||||
|
||||
/* MCP9844 Registers addresses */
|
||||
|
@ -41,7 +41,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/fs/ioctl.h>
|
||||
#include <nuttx/sensors/ioctl.h>
|
||||
|
||||
#if defined(CONFIG_I2C) && defined(CONFIG_MS58XX)
|
||||
|
||||
@ -58,14 +58,6 @@
|
||||
* CONFIG_MS58XX_VDD
|
||||
*/
|
||||
|
||||
/* IOCTL Commands ***********************************************************/
|
||||
|
||||
#define SNIOC_MEASURE _SNIOC(0x0001) /* Arg: None */
|
||||
#define SNIOC_TEMPERATURE _SNIOC(0x0002) /* Arg: int32_t* pointer */
|
||||
#define SNIOC_PRESSURE _SNIOC(0x0003) /* Arg: int32_t* pointer */
|
||||
#define SNIOC_RESET _SNIOC(0x0004) /* Arg: None */
|
||||
#define SNIOC_OVERSAMPLING _SNIOC(0x0005) /* Arg: uint16_t value */
|
||||
|
||||
/* I2C Address **************************************************************/
|
||||
|
||||
#define MS58XX_ADDR0 0x76
|
||||
|
Loading…
x
Reference in New Issue
Block a user