IOCTLS. Separate wireless character driver IOCTL commands from wireless network driver IOCTL commands. Move from wireless.h to ioctl.h.

This commit is contained in:
Gregory Nutt 2017-04-27 16:58:30 -06:00
parent b608afc484
commit 2e6908b384
13 changed files with 147 additions and 73 deletions

View File

@ -1,5 +1,5 @@
/************************************************************************************
* arch/arm/src/stm32/chip/stm32fo_flash.h
* arch/arm/src/stm32/chip/stm32f0_flash.h
*
* Copyright (C) 20017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>

View File

@ -47,7 +47,6 @@
#include <nuttx/irq.h>
#include <nuttx/spi/spi.h>
#include <nuttx/wireless/wireless.h>
#include <nuttx/wireless/cc3000.h>
#include <nuttx/wireless/cc3000/include/cc3000_upif.h>

View File

@ -47,7 +47,6 @@
#include <nuttx/irq.h>
#include <nuttx/spi/spi.h>
#include <nuttx/wireless/wireless.h>
#include <nuttx/wireless/cc3000.h>
#include <nuttx/wireless/cc3000/include/cc3000_upif.h>

View File

@ -47,7 +47,6 @@
#include <nuttx/irq.h>
#include <nuttx/spi/spi.h>
#include <nuttx/wireless/wireless.h>
#include <nuttx/wireless/cc3000.h>
#include <nuttx/wireless/cc3000/include/cc3000_upif.h>

View File

@ -73,7 +73,7 @@
#include <nuttx/fs/fs.h>
#include <nuttx/spi/spi.h>
#include <nuttx/wireless/wireless.h>
#include <nuttx/wireless/ioctl.h>
#include <nuttx/wireless/cc3000.h>
#include <nuttx/wireless/cc3000/include/cc3000_upif.h>
#include <nuttx/wireless/cc3000/cc3000_common.h>

View File

@ -53,9 +53,10 @@
#include <stdint.h>
#include <mqueue.h>
#include <pthread.h>
#include <nuttx/spi/spi.h>
#include <nuttx/irq.h>
#include <nuttx/wireless/wireless.h>
#include <nuttx/wireless/ioctl.h>
#include <nuttx/wireless/cc3000.h>
#include <nuttx/wireless/cc3000/cc3000_common.h>

View File

@ -43,7 +43,6 @@
#include <nuttx/config.h>
#include <nuttx/spi/spi.h>
#include <nuttx/irq.h>
#include <nuttx/wireless/wireless.h>
#include <stdint.h>
#include <stdbool.h>

View File

@ -68,25 +68,26 @@
#define _QEIOCBASE (0x0f00) /* Quadrature encoder ioctl commands */
#define _AUDIOIOCBASE (0x1000) /* Audio ioctl commands */
#define _SLCDIOCBASE (0x1100) /* Segment LCD ioctl commands */
#define _WLIOCBASE (0x1200) /* Wireless modules ioctl commands */
#define _CFGDIOCBASE (0x1300) /* Config Data device (app config) ioctl commands */
#define _TCIOCBASE (0x1400) /* Timer ioctl commands */
#define _DJOYBASE (0x1500) /* Discrete joystick ioctl commands */
#define _AJOYBASE (0x1600) /* Analog joystick ioctl commands */
#define _PIPEBASE (0x1700) /* FIFO/pipe ioctl commands */
#define _RTCBASE (0x1800) /* RTC ioctl commands */
#define _RELAYBASE (0x1900) /* Relay devices ioctl commands */
#define _CANBASE (0x1a00) /* CAN ioctl commands */
#define _BTNBASE (0x1b00) /* Button ioctl commands */
#define _ULEDBASE (0x1c00) /* User LED ioctl commands */
#define _ZCBASE (0x1d00) /* Zero Cross ioctl commands */
#define _LOOPBASE (0x1e00) /* Loop device commands */
#define _MODEMBASE (0x1f00) /* Modem ioctl commands */
#define _I2CBASE (0x2000) /* I2C driver commands */
#define _SPIBASE (0x2100) /* SPI driver commands */
#define _GPIOBASE (0x2200) /* GPIO driver commands */
#define _CLIOCBASE (0x2300) /* Contactless modules ioctl commands */
#define _USBCBASE (0x2400) /* USB-C controller ioctl commands */
#define _WLIOCBASE (0x1200) /* Wireless modules ioctl network commands */
#define _WLCIOCBASE (0x1300) /* Wireless modules ioctl character driver commands */
#define _CFGDIOCBASE (0x1400) /* Config Data device (app config) ioctl commands */
#define _TCIOCBASE (0x1500) /* Timer ioctl commands */
#define _DJOYBASE (0x1600) /* Discrete joystick ioctl commands */
#define _AJOYBASE (0x1700) /* Analog joystick ioctl commands */
#define _PIPEBASE (0x1800) /* FIFO/pipe ioctl commands */
#define _RTCBASE (0x1900) /* RTC ioctl commands */
#define _RELAYBASE (0x1a00) /* Relay devices ioctl commands */
#define _CANBASE (0x1b00) /* CAN ioctl commands */
#define _BTNBASE (0x1c00) /* Button ioctl commands */
#define _ULEDBASE (0x1d00) /* User LED ioctl commands */
#define _ZCBASE (0x1e00) /* Zero Cross ioctl commands */
#define _LOOPBASE (0x1f00) /* Loop device commands */
#define _MODEMBASE (0x2000) /* Modem ioctl commands */
#define _I2CBASE (0x2100) /* I2C driver commands */
#define _SPIBASE (0x2200) /* SPI driver commands */
#define _GPIOBASE (0x2300) /* GPIO driver commands */
#define _CLIOCBASE (0x2400) /* Contactless modules ioctl commands */
#define _USBCBASE (0x2500) /* USB-C controller ioctl commands */
/* boardctl() commands share the same number space */
@ -294,12 +295,18 @@
#define _SLCDIOCVALID(c) (_IOC_TYPE(c)==_SLCDIOCBASE)
#define _SLCDIOC(nr) _IOC(_SLCDIOCBASE,nr)
/* Wireless driver ioctl definitions ****************************************/
/* Wireless driver networki ioctl definitions *******************************/
/* (see nuttx/include/wireless/wireless.h */
#define _WLIOCVALID(c) (_IOC_TYPE(c)==_WLIOCBASE)
#define _WLIOC(nr) _IOC(_WLIOCBASE,nr)
/* Wireless driver character driver ioctl definitions ***********************/
/* (see nuttx/include/wireless/ioctl.h */
#define _WLCIOCVALID(c) (_IOC_TYPE(c)==_WLCIOCBASE)
#define _WLCIOC(nr) _IOC(_WLCIOCBASE,nr)
/* Application Config Data driver ioctl definitions *************************/
/* (see nuttx/include/configdata.h */

View File

@ -50,7 +50,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/wireless/wireless.h>
#include <nuttx/wireless/ioctl.h>
/****************************************************************************
* Pre-processor Definitions

View File

@ -54,7 +54,6 @@
#include <nuttx/config.h>
#include <nuttx/spi/spi.h>
#include <nuttx/irq.h>
#include <nuttx/wireless/wireless.h>
#if defined(CONFIG_DRIVERS_WIRELESS) && defined(CONFIG_WL_CC3000)

View File

@ -0,0 +1,108 @@
/************************************************************************************
* include/nuttx/wireless/ioctl.h
* Wireless character driver IOCTL commands
*
* Copyright (C) 2011-2013, 2017 Gregory Nutt. All rights reserved.
* Author: Laurent Latil <gnutt@nuttx.org>
*
* 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.
*
************************************************************************************/
/* This file includes common definitions to be used in all wireless character drivers
* (when applicable).
*/
#ifndef __INCLUDE_NUTTX_WIRELESS_IOCTL_H
#define __INCLUDE_NUTTX_WIRELESS_IOCTL_H
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <nuttx/fs/ioctl.h>
#ifdef CONFIG_DRIVERS_WIRELESS
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/* Character Driver IOCTL commands *************************************************/
/* Non-compatible, NuttX only IOCTL definitions for use with low-level wireless
* drivers that are accessed via a character device. Use of these IOCTL commands
* requires a file descriptor created by the open() interface.
*/
#define WLIOC_SETRADIOFREQ _WLCIOC(0x0001) /* arg: Pointer to uint32_t, frequency
* value (in Mhz) */
#define WLIOC_GETRADIOFREQ _WLCIOC(0x0002) /* arg: Pointer to uint32_t, frequency
* value (in Mhz) */
#define WLIOC_SETADDR _WLCIOC(0x0003) /* arg: Pointer to address value, format
* of the address is driver specific */
#define WLIOC_GETADDR _WLCIOC(0x0004) /* arg: Pointer to address value, format
* of the address is driver specific */
#define WLIOC_SETTXPOWER _WLCIOC(0x0005) /* arg: Pointer to int32_t, output power
* (in dBm) */
#define WLIOC_GETTXPOWER _WLCIOC(0x0006) /* arg: Pointer to int32_t, output power
* (in dBm) */
/* Device-specific IOCTL commands **************************************************/
#define WL_FIRST 0x0001 /* First common command */
#define WL_NCMDS 0x0006 /* Number of common commands */
/* User defined ioctl commands are also supported. These will be forwarded
* by the upper-half QE driver to the lower-half QE driver via the ioctl()
* method fo the QE lower-half interface. However, the lower-half driver
* must reserve a block of commands as follows in order prevent IOCTL
* command numbers from overlapping.
*/
/* See include/nuttx/wireless/cc3000.h */
#define CC3000_FIRST (WL_FIRST + WL_NCMDS)
#define CC3000_NCMDS 7
/* See include/nuttx/wireless/nrf24l01.h */
#define NRF24L01_FIRST (CC3000_FIRST + CC3000_NCMDS)
#define NRF24L01_NCMDS 14
/* See include/nuttx/wireless/ieee802154/ieee802154_ioctl.h */
#define IEEE802154_FIRST (NRF24L01_FIRST + NRF24L01_NCMDS)
#define IEEE802154_NCMDS 2
/************************************************************************************
* Public Types
************************************************************************************/
#endif /* CONFIG_DRIVERS_WIRELESS */
#endif /* __INCLUDE_NUTTX_WIRELESS_IOCTL_H */

View File

@ -43,7 +43,7 @@
#include <nuttx/config.h>
#include <nuttx/spi/spi.h>
#include <nuttx/irq.h>
#include <nuttx/wireless/wireless.h>
#include <nuttx/wireless/ioctl.h>
#include <stdint.h>
#include <stdbool.h>

View File

@ -1,5 +1,6 @@
/************************************************************************************
* include/nuttx/wireless/wireless.h
* Wireless network IOCTL commands
*
* Copyright (C) 2011-2013, 2017 Gregory Nutt. All rights reserved.
* Author: Laurent Latil <gnutt@nuttx.org>
@ -33,7 +34,7 @@
*
************************************************************************************/
/* This file includes common definitions to be used in all wireless drivers
/* This file includes common definitions to be used in all wireless network drivers
* (when applicable).
*/
@ -153,49 +154,11 @@
#define SIOCSIWPMKSA _WLIOC(0x0032) /* PMKSA cache operation */
#define WL_FIRSTCHAR 0x0033
#define WL_NNETCMDS 0x0032
/* Device-specific network IOCTL commands ******************************************/
/* Character Driver IOCTL commands *************************************************/
/* Non-compatible, NuttX only IOCTL definitions for use with low-level wireless
* drivers that are accessed via a character device. Use of these IOCTL commands
* requires a file descriptor created by the open() interface.
*/
#define WLIOC_SETRADIOFREQ _WLIOC(0x0033) /* arg: Pointer to uint32_t, frequency
* value (in Mhz) */
#define WLIOC_GETRADIOFREQ _WLIOC(0x0034) /* arg: Pointer to uint32_t, frequency
* value (in Mhz) */
#define WLIOC_SETADDR _WLIOC(0x0035) /* arg: Pointer to address value, format
* of the address is driver specific */
#define WLIOC_GETADDR _WLIOC(0x0036) /* arg: Pointer to address value, format
* of the address is driver specific */
#define WLIOC_SETTXPOWER _WLIOC(0x0037) /* arg: Pointer to int32_t, output power
* (in dBm) */
#define WLIOC_GETTXPOWER _WLIOC(0x0038) /* arg: Pointer to int32_t, output power
* (in dBm) */
/* Device-specific IOCTL commands **************************************************/
#define WL_FIRST 0x0001 /* First common command */
#define WL_NCMDS 0x0038 /* Number of common commands */
/* User defined ioctl commands are also supported. These will be forwarded
* by the upper-half QE driver to the lower-half QE driver via the ioctl()
* method fo the QE lower-half interface. However, the lower-half driver
* must reserve a block of commands as follows in order prevent IOCTL
* command numbers from overlapping.
*/
/* See include/nuttx/wireless/cc3000.h */
#define CC3000_FIRST (WL_FIRST + WL_NCMDS)
#define CC3000_NCMDS 7
/* See include/nuttx/wireless/nrf24l01.h */
#define NRF24L01_FIRST (CC3000_FIRST + CC3000_NCMDS)
#define NRF24L01_NCMDS 14
#define WL_NETFIRST 0x0001 /* First network command */
#define WL_NNETCMDS 0x0032 /* Number of network commands */
#define WL_USERFIRST (WL_NETFIRST + WL_NNETCMDS)
/* Other Common Wireless Definitions ***********************************************/