ioctl.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /****************************************************************************
  2. * include/nuttx/wireless/ioctl.h
  3. * Wireless character driver IOCTL commands
  4. *
  5. * Copyright (C) 2011-2013, 2017 Gregory Nutt. All rights reserved.
  6. * Author: Laurent Latil <gnutt@nuttx.org>
  7. * Gregory Nutt <gnutt@nuttx.org>
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. *
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in
  17. * the documentation and/or other materials provided with the
  18. * distribution.
  19. * 3. Neither the name NuttX nor the names of its contributors may be
  20. * used to endorse or promote products derived from this software
  21. * without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  24. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  25. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  26. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  27. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  28. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  29. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  30. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  31. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  32. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  33. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  34. * POSSIBILITY OF SUCH DAMAGE.
  35. *
  36. ****************************************************************************/
  37. /* This file includes common definitions to be used in all wireless
  38. * character drivers (when applicable).
  39. */
  40. #ifndef __INCLUDE_NUTTX_WIRELESS_IOCTL_H
  41. #define __INCLUDE_NUTTX_WIRELESS_IOCTL_H
  42. /****************************************************************************
  43. * Included Files
  44. ****************************************************************************/
  45. #include <nuttx/config.h>
  46. #include <nuttx/fs/ioctl.h>
  47. #ifdef CONFIG_DRIVERS_WIRELESS
  48. /****************************************************************************
  49. * Pre-processor Definitions
  50. ****************************************************************************/
  51. /****************************************************************************
  52. * Character Driver IOCTL commands
  53. * Non-compatible, NuttX only IOCTL definitions for use with low-level
  54. * wireless drivers that are accessed via a character device.
  55. * Use of these IOCTL commands requires a file descriptor created by
  56. * the open() interface.
  57. ****************************************************************************/
  58. #define WLIOC_SETRADIOFREQ _WLCIOC(0x0001) /* arg: Pointer to uint32_t, */
  59. /* frequency value (in MHz) */
  60. #define WLIOC_GETRADIOFREQ _WLCIOC(0x0002) /* arg: Pointer to uint32_t, */
  61. /* frequency value (in MHz) */
  62. #define WLIOC_SETADDR _WLCIOC(0x0003) /* arg: Pointer to address value, format
  63. * of the address is driver specific */
  64. #define WLIOC_GETADDR _WLCIOC(0x0004) /* arg: Pointer to address value, format
  65. * of the address is driver specific */
  66. #define WLIOC_SETTXPOWER _WLCIOC(0x0005) /* arg: Pointer to int32_t, */
  67. /* output power (in dBm) */
  68. #define WLIOC_GETTXPOWER _WLCIOC(0x0006) /* arg: Pointer to int32_t, */
  69. /* output power (in dBm) */
  70. /****************************************************************************
  71. * Device-specific IOCTL commands
  72. ****************************************************************************/
  73. #define WL_FIRST 0x0001 /* First common command */
  74. #define WL_NCMDS 0x0006 /* Number of common commands */
  75. /* User defined ioctl commands are also supported. These will be forwarded
  76. * by the upper-half driver to the lower-half driver via the ioctl()
  77. * method of the lower-half interface. However, the lower-half driver
  78. * must reserve a block of commands as follows in order prevent IOCTL
  79. * command numbers from overlapping.
  80. */
  81. /* See include/nuttx/wireless/nrf24l01.h */
  82. #define NRF24L01_FIRST (WL_FIRST + WL_NCMDS)
  83. #define NRF24L01_NCMDS 16
  84. /* See include/nuttx/wireless/lpwan/sx127x.h */
  85. #define SX127X_FIRST (NRF24L01_FIRST + NRF24L01_NCMDS)
  86. #define SX127X_NCMDS 11
  87. /* See include/nuttx/wireless/gs2200m.h */
  88. #define GS2200M_FIRST (SX127X_FIRST + SX127X_NCMDS)
  89. #define GS2200M_NCMDS 9
  90. /****************************************************************************
  91. * Public Types
  92. ****************************************************************************/
  93. #endif /* CONFIG_DRIVERS_WIRELESS */
  94. #endif /* __INCLUDE_NUTTX_WIRELESS_IOCTL_H */