gs2200m.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /****************************************************************************
  2. * include/nuttx/wireless/gs2200m.h
  3. *
  4. * Copyright 2019 Sony Home Entertainment & Sound Products Inc.
  5. * Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. *
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. * 2. Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in
  15. * the documentation and/or other materials provided with the
  16. * distribution.
  17. * 3. Neither the name NuttX nor the names of its contributors may be
  18. * used to endorse or promote products derived from this software
  19. * without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  31. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32. * POSSIBILITY OF SUCH DAMAGE.
  33. *
  34. ****************************************************************************/
  35. #ifndef __INCLUDE_NUTTX_WIRELESS_GS2200M_H
  36. #define __INCLUDE_NUTTX_WIRELESS_GS2200M_H
  37. /****************************************************************************
  38. * Included Files
  39. ****************************************************************************/
  40. #include <stdint.h>
  41. #include <sys/ioctl.h>
  42. #include <netinet/in.h>
  43. #include <net/if.h>
  44. #include <nuttx/config.h>
  45. #include <nuttx/irq.h>
  46. #include <nuttx/wireless/ioctl.h>
  47. /****************************************************************************
  48. * Public Data Types
  49. ****************************************************************************/
  50. #ifndef __ASSEMBLY__
  51. #undef EXTERN
  52. #if defined(__cplusplus)
  53. # define EXTERN extern "C"
  54. extern "C"
  55. {
  56. #else
  57. # define EXTERN extern
  58. #endif
  59. #define GS2200M_IOC_CONNECT _WLCIOC(GS2200M_FIRST + 0)
  60. #define GS2200M_IOC_SEND _WLCIOC(GS2200M_FIRST + 1)
  61. #define GS2200M_IOC_RECV _WLCIOC(GS2200M_FIRST + 2)
  62. #define GS2200M_IOC_CLOSE _WLCIOC(GS2200M_FIRST + 3)
  63. #define GS2200M_IOC_BIND _WLCIOC(GS2200M_FIRST + 4)
  64. #define GS2200M_IOC_ACCEPT _WLCIOC(GS2200M_FIRST + 5)
  65. #define GS2200M_IOC_ASSOC _WLCIOC(GS2200M_FIRST + 6)
  66. #define GS2200M_IOC_IFREQ _WLCIOC(GS2200M_FIRST + 7)
  67. #define GS2200M_IOC_NAME _WLCIOC(GS2200M_FIRST + 8)
  68. /* NOTE: do not forget to update include/nuttx/wireless/ioctl.h */
  69. struct gs2200m_connect_msg
  70. {
  71. char cid;
  72. uint8_t type;
  73. char addr[17];
  74. char port[6];
  75. };
  76. struct gs2200m_bind_msg
  77. {
  78. char cid;
  79. uint8_t type;
  80. bool is_tcp;
  81. char port[6];
  82. };
  83. struct gs2200m_accept_msg
  84. {
  85. char cid;
  86. uint8_t type;
  87. };
  88. struct gs2200m_send_msg
  89. {
  90. struct sockaddr_in addr; /* used for udp */
  91. bool is_tcp;
  92. char cid;
  93. uint8_t type;
  94. FAR uint8_t *buf;
  95. uint16_t len;
  96. };
  97. struct gs2200m_recv_msg
  98. {
  99. struct sockaddr_in addr; /* used for udp */
  100. bool is_tcp;
  101. char cid;
  102. uint8_t type;
  103. FAR uint8_t *buf;
  104. uint16_t len; /* actual buffer length */
  105. uint16_t reqlen; /* requested size */
  106. int32_t flags; /* MSG_* flags */
  107. };
  108. struct gs2200m_close_msg
  109. {
  110. char cid;
  111. uint8_t type;
  112. };
  113. struct gs2200m_assoc_msg
  114. {
  115. FAR char *ssid;
  116. FAR char *key;
  117. uint8_t mode;
  118. uint8_t ch;
  119. };
  120. struct gs2200m_ifreq_msg
  121. {
  122. uint32_t cmd;
  123. struct ifreq ifr;
  124. };
  125. struct gs2200m_name_msg
  126. {
  127. struct sockaddr_in addr;
  128. bool local;
  129. char cid;
  130. };
  131. struct gs2200m_lower_s
  132. {
  133. int (*attach)(xcpt_t handler, FAR void *arg);
  134. void (*enable)(void);
  135. void (*disable)(void);
  136. uint32_t (*dready)(int *);
  137. void (*reset)(bool);
  138. };
  139. FAR void *gs2200m_register(FAR const char *devpath,
  140. FAR struct spi_dev_s *dev,
  141. FAR const struct gs2200m_lower_s *lower);
  142. #undef EXTERN
  143. #if defined(__cplusplus)
  144. }
  145. #endif
  146. #endif /* __ASSEMBLY__ */
  147. #endif /* __INCLUDE_NUTTX_WIRELESS_GS2200M_H */