Wireless and TSC: Add infrastructure to assure that all IOCTL commands are uniquely numbered.
This commit is contained in:
parent
eb984e08d9
commit
f15f17a63d
@ -59,8 +59,8 @@
|
||||
* IN: None
|
||||
* OUT: None */
|
||||
|
||||
#define AN_FIRST 0x0001 /* First required command */
|
||||
#define AN_NCMDS 1 /* Two required commands */
|
||||
#define AN_FIRST 0x0001 /* First common command */
|
||||
#define AN_NCMDS 1 /* Two 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()
|
||||
|
@ -197,8 +197,8 @@
|
||||
#define CANIOC_GET_CONNMODES _CANIOC(8)
|
||||
#define CANIOC_SET_CONNMODES _CANIOC(9)
|
||||
|
||||
#define CAN_FIRST 0x0001 /* First required command */
|
||||
#define CAN_NCMDS 9 /* Two required commands */
|
||||
#define CAN_FIRST 0x0001 /* First common command */
|
||||
#define CAN_NCMDS 9 /* Nine common commands */
|
||||
|
||||
/* User defined ioctl commands are also supported. These will be forwarded
|
||||
* by the upper-half CAN driver to the lower-half CAN driver via the co_ioctl()
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* include/nuttx/input/touchscreen.h
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -57,18 +57,41 @@
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* IOCTL Commands *******************************************************************/
|
||||
/* Common TSC IOCTL commands */
|
||||
|
||||
#define TSIOC_SETCALIB _TSIOC(0x0001) /* arg: Pointer to int calibration value */
|
||||
#define TSIOC_GETCALIB _TSIOC(0x0002) /* arg: Pointer to int calibration value */
|
||||
#define TSIOC_SETFREQUENCY _TSIOC(0x0003) /* arg: Pointer to uint32_t frequency value */
|
||||
#define TSIOC_GETFREQUENCY _TSIOC(0x0004) /* arg: Pointer to uint32_t frequency value */
|
||||
|
||||
/* Specific touchscreen drivers may support additional, device specific ioctl
|
||||
* commands, beginning with this value:
|
||||
*/
|
||||
#define TSC_FIRST 0x0001 /* First common command */
|
||||
#define TSC_NCMDS 4 /* Four common commands */
|
||||
|
||||
#define TSIOC_USER 0x0005 /* Lowest, unused TSC ioctl command */
|
||||
/* User defined ioctl commands are also supported. However, the TSC driver must
|
||||
* reserve a block of commands as follows in order prevent IOCTL command numbers
|
||||
* from overlapping.
|
||||
*
|
||||
* This is generally done as follows. The first reservation for TSC driver A would
|
||||
* look like:
|
||||
*
|
||||
* TSC_A_FIRST (TSC_FIRST + TSC_NCMDS) <- First command
|
||||
* TSC_A_NCMDS 42 <- Number of commands
|
||||
*
|
||||
* IOCTL commands for TSC driver A would then be defined in a TSC A header file like:
|
||||
*
|
||||
* CANIOC_A_CMD1 _CANIOC(TSC_A_FIRST+0)
|
||||
* CANIOC_A_CMD2 _CANIOC(TSC_A_FIRST+1)
|
||||
* CANIOC_A_CMD3 _CANIOC(TSC_A_FIRST+2)
|
||||
* ...
|
||||
* CANIOC_A_CMD42 _CANIOC(TSC_A_FIRST+41)
|
||||
*
|
||||
* The next reservation would look like:
|
||||
*
|
||||
* TSC_B_FIRST (TSC_A_FIRST + TSC_A_NCMDS) <- Next command
|
||||
* TSC_B_NCMDS 77 <- Number of commands
|
||||
*/
|
||||
|
||||
/* These definitions provide the meaning of all of the bits that may be
|
||||
* reported in the struct touch_point_s flags.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/wireless/cc3000.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
@ -67,13 +67,13 @@
|
||||
|
||||
/* IOCTL commands */
|
||||
|
||||
#define CC3000IOC_GETQUESEMID _WLIOC_USER(0x0001) /* arg: Address of int for number*/
|
||||
#define CC3000IOC_ADDSOCKET _WLIOC_USER(0x0002) /* arg: Address of int for result*/
|
||||
#define CC3000IOC_REMOVESOCKET _WLIOC_USER(0x0003) /* arg: Address of int for result*/
|
||||
#define CC3000IOC_SELECTDATA _WLIOC_USER(0x0004) /* arg: Address of int for result*/
|
||||
#define CC3000IOC_SELECTACCEPT _WLIOC_USER(0x0005) /* arg: Address of struct cc3000_acceptcfg_s */
|
||||
#define CC3000IOC_SETRX_SIZE _WLIOC_USER(0x0006) /* arg: Address of int for new size */
|
||||
#define CC3000IOC_REMOTECLOSEDSOCKET _WLIOC_USER(0x0007) /* arg: Address of int for result*/
|
||||
#define CC3000IOC_GETQUESEMID _WLIOC(CC3000_FIRST+0) /* arg: Address of int for number*/
|
||||
#define CC3000IOC_ADDSOCKET _WLIOC(CC3000_FIRST+1) /* arg: Address of int for result*/
|
||||
#define CC3000IOC_REMOVESOCKET _WLIOC(CC3000_FIRST+2) /* arg: Address of int for result*/
|
||||
#define CC3000IOC_SELECTDATA _WLIOC(CC3000_FIRST+3) /* arg: Address of int for result*/
|
||||
#define CC3000IOC_SELECTACCEPT _WLIOC(CC3000_FIRST+4) /* arg: Address of struct cc3000_acceptcfg_s */
|
||||
#define CC3000IOC_SETRX_SIZE _WLIOC(CC3000_FIRST+5) /* arg: Address of int for new size */
|
||||
#define CC3000IOC_REMOTECLOSEDSOCKET _WLIOC(CC3000_FIRST+6) /* arg: Address of int for result*/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
@ -52,36 +52,36 @@
|
||||
* Pre-Processor Declarations
|
||||
****************************************************************************/
|
||||
|
||||
#define NRF24L01_MIN_ADDR_LEN 3 /* Minimal length (in bytes) of a pipe address */
|
||||
#define NRF24L01_MAX_ADDR_LEN 5 /* Maximum length (in bytes) of a pipe address */
|
||||
#define NRF24L01_MAX_PAYLOAD_LEN 32 /* Maximum length (in bytes) of a payload */
|
||||
#define NRF24L01_MAX_XMIT_RETR 15 /* Maximum auto retransmit count (for AA transmissions) */
|
||||
#define NRF24L01_PIPE_COUNT 6 /* Number of available pipes */
|
||||
#define NRF24L01_MIN_ADDR_LEN 3 /* Minimal length (in bytes) of a pipe address */
|
||||
#define NRF24L01_MAX_ADDR_LEN 5 /* Maximum length (in bytes) of a pipe address */
|
||||
#define NRF24L01_MAX_PAYLOAD_LEN 32 /* Maximum length (in bytes) of a payload */
|
||||
#define NRF24L01_MAX_XMIT_RETR 15 /* Maximum auto retransmit count (for AA transmissions) */
|
||||
#define NRF24L01_PIPE_COUNT 6 /* Number of available pipes */
|
||||
|
||||
#define NRF24L01_MIN_FREQ 2400 /* Lower bound for RF frequency */
|
||||
#define NRF24L01_MAX_FREQ 2525 /* Upper bound for RF frequency */
|
||||
#define NRF24L01_MIN_FREQ 2400 /* Lower bound for RF frequency */
|
||||
#define NRF24L01_MAX_FREQ 2525 /* Upper bound for RF frequency */
|
||||
|
||||
#define NRF24L01_DYN_LENGTH 33 /* Specific length value to use to enable dynamic packet length */
|
||||
#define NRF24L01_XMIT_MAXRT 255 /* Specific value returned by Number of available pipes */
|
||||
#define NRF24L01_DYN_LENGTH 33 /* Specific length value to use to enable dynamic packet length */
|
||||
#define NRF24L01_XMIT_MAXRT 255 /* Specific value returned by Number of available pipes */
|
||||
|
||||
/* #define NRF24L01_DEBUG 1 */
|
||||
/* #define NRF24L01_DEBUG 1 */
|
||||
|
||||
/* IOCTL commands */
|
||||
|
||||
#define NRF24L01IOC_SETRETRCFG _WLIOC_USER(0x0001) /* arg: Pointer to nrf24l01_retrcfg_t structure */
|
||||
#define NRF24L01IOC_GETRETRCFG _WLIOC_USER(0x0002) /* arg: Pointer to nrf24l01_retrcfg_t structure */
|
||||
#define NRF24L01IOC_SETPIPESCFG _WLIOC_USER(0x0003) /* arg: Pointer to an array of nrf24l01_pipecfg_t pointers */
|
||||
#define NRF24L01IOC_GETPIPESCFG _WLIOC_USER(0x0004) /* arg: Pointer to an array of nrf24l01_pipecfg_t pointers */
|
||||
#define NRF24L01IOC_SETPIPESENABLED _WLIOC_USER(0x0005) /* arg: Pointer to a uint8_t value, bit field of enabled / disabled pipes */
|
||||
#define NRF24L01IOC_GETPIPESENABLED _WLIOC_USER(0x0006) /* arg: Pointer to a uint8_t value, bit field of enabled / disabled pipes */
|
||||
#define NRF24L01IOC_SETDATARATE _WLIOC_USER(0x0007) /* arg: Pointer to a nrf24l01_datarate_t value */
|
||||
#define NRF24L01IOC_GETDATARATE _WLIOC_USER(0x0008) /* arg: Pointer to a nrf24l01_datarate_t value */
|
||||
#define NRF24L01IOC_SETADDRWIDTH _WLIOC_USER(0x0009) /* arg: Pointer to an uint32_t value, width of the address */
|
||||
#define NRF24L01IOC_GETADDRWIDTH _WLIOC_USER(0x000A) /* arg: Pointer to an uint32_t value, width of the address */
|
||||
#define NRF24L01IOC_SETSTATE _WLIOC_USER(0x000B) /* arg: Pointer to a nrf24l01_state_t value */
|
||||
#define NRF24L01IOC_GETSTATE _WLIOC_USER(0x000C) /* arg: Pointer to a nrf24l01_state_t value */
|
||||
#define NRF24L01IOC_GETLASTXMITCOUNT _WLIOC_USER(0x000D) /* arg: Pointer to an uint32_t value, retransmission count of the last send operation (NRF24L01_XMIT_MAXRT if no ACK received)*/
|
||||
#define NRF24L01IOC_GETLASTPIPENO _WLIOC_USER(0x000E) /* arg: Pointer to an uint32_t value, pipe # of the last received packet */
|
||||
#define NRF24L01IOC_SETRETRCFG _WLIOC(NRF24L01_FIRST+0) /* arg: Pointer to nrf24l01_retrcfg_t structure */
|
||||
#define NRF24L01IOC_GETRETRCFG _WLIOC(NRF24L01_FIRST+1) /* arg: Pointer to nrf24l01_retrcfg_t structure */
|
||||
#define NRF24L01IOC_SETPIPESCFG _WLIOC(NRF24L01_FIRST+2) /* arg: Pointer to an array of nrf24l01_pipecfg_t pointers */
|
||||
#define NRF24L01IOC_GETPIPESCFG _WLIOC(NRF24L01_FIRST+3) /* arg: Pointer to an array of nrf24l01_pipecfg_t pointers */
|
||||
#define NRF24L01IOC_SETPIPESENABLED _WLIOC(NRF24L01_FIRST+4) /* arg: Pointer to a uint8_t value, bit field of enabled / disabled pipes */
|
||||
#define NRF24L01IOC_GETPIPESENABLED _WLIOC(NRF24L01_FIRST+5) /* arg: Pointer to a uint8_t value, bit field of enabled / disabled pipes */
|
||||
#define NRF24L01IOC_SETDATARATE _WLIOC(NRF24L01_FIRST+6) /* arg: Pointer to a nrf24l01_datarate_t value */
|
||||
#define NRF24L01IOC_GETDATARATE _WLIOC(NRF24L01_FIRST+7) /* arg: Pointer to a nrf24l01_datarate_t value */
|
||||
#define NRF24L01IOC_SETADDRWIDTH _WLIOC(NRF24L01_FIRST+8) /* arg: Pointer to an uint32_t value, width of the address */
|
||||
#define NRF24L01IOC_GETADDRWIDTH _WLIOC(NRF24L01_FIRST+9) /* arg: Pointer to an uint32_t value, width of the address */
|
||||
#define NRF24L01IOC_SETSTATE _WLIOC(NRF24L01_FIRST+10) /* arg: Pointer to a nrf24l01_state_t value */
|
||||
#define NRF24L01IOC_GETSTATE _WLIOC(NRF24L01_FIRST+11) /* arg: Pointer to a nrf24l01_state_t value */
|
||||
#define NRF24L01IOC_GETLASTXMITCOUNT _WLIOC(NRF24L01_FIRST+12) /* arg: Pointer to an uint32_t value, retransmission count of the last send operation (NRF24L01_XMIT_MAXRT if no ACK received)*/
|
||||
#define NRF24L01IOC_GETLASTPIPENO _WLIOC(NRF24L01_FIRST+13) /* arg: Pointer to an uint32_t value, pipe # of the last received packet */
|
||||
|
||||
/* Aliased name for these commands */
|
||||
|
||||
@ -92,7 +92,7 @@
|
||||
|
||||
#ifdef NRF24L01_DEBUG
|
||||
# define werr(format, ...) _err(format, ##__VA_ARGS__)
|
||||
# define werr(format, ...) _err(format, ##__VA_ARGS__)
|
||||
# define werr(format, ...) _err(format, ##__VA_ARGS__)
|
||||
# define winfo(format, ...) _info(format, ##__VA_ARGS__)
|
||||
#else
|
||||
# define werr(x...)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* include/nuttx/wireless/wireless.h
|
||||
*
|
||||
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* 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
|
||||
@ -52,7 +52,9 @@
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* IOCTL Commands *******************************************************************/
|
||||
/* Common wireless IOCTL commands */
|
||||
|
||||
#define WLIOC_SETRADIOFREQ _WLIOC(0x0001) /* arg: Pointer to uint32_t, frequency value (in Mhz) */
|
||||
#define WLIOC_GETRADIOFREQ _WLIOC(0x0002) /* arg: Pointer to uint32_t, frequency value (in Mhz) */
|
||||
@ -61,14 +63,25 @@
|
||||
#define WLIOC_SETTXPOWER _WLIOC(0x0005) /* arg: Pointer to int32_t, output power (in dBm) */
|
||||
#define WLIOC_GETTXPOWER _WLIOC(0x0006) /* arg: Pointer to int32_t, output power (in dBm) */
|
||||
|
||||
/* Wireless drivers can provide additional, device specific ioctl
|
||||
* commands, beginning with this value:
|
||||
#define WL_FIRST 0x0001 /* First common command */
|
||||
#define WL_NCMDS 6 /* Six 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.
|
||||
*/
|
||||
|
||||
#define WLIOC_USER 0x0007 /* Lowest, unused WL ioctl command */
|
||||
/* See include/nuttx/wireless/cc3000.h */
|
||||
|
||||
#define _WLIOC_USER(nr) _WLIOC(nr + WLIOC_USER)
|
||||
#define CC3000_FIRST (WL_FIRST + WL_NCMDS)
|
||||
#define CC3000_NCMDS 7
|
||||
|
||||
#endif
|
||||
/* See include/nuttx/wireless/nrf24l01.h */
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_WIRELESS_H */
|
||||
#define NRF24L01_FIRST (CC3000_FIRST + CC3000_NCMDS)
|
||||
#define NRF24L01_NCMDS 14
|
||||
|
||||
#endif /* CONFIG_DRIVERS_WIRELESS */
|
||||
#endif /* __INCLUDE_NUTTX_WIRELESS_H */
|
||||
|
Loading…
Reference in New Issue
Block a user