itp.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * ITP code for ST-Ericsson CW1200 mac80211 driver
  3. *
  4. * Copyright (c) 2011, ST-Ericsson
  5. * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef CW1200_ITP_H_INCLUDED
  12. #define CW1200_ITP_H_INCLUDED
  13. struct cw200_common;
  14. struct wsm_tx_confirm;
  15. struct dentry;
  16. #ifdef CONFIG_CW1200_ITP
  17. /*extern*/ struct ieee80211_channel;
  18. #define TEST_MODE_NO_TEST (0)
  19. #define TEST_MODE_RX_TEST (1)
  20. #define TEST_MODE_TX_TEST (2)
  21. #define ITP_DEFAULT_DA_ADDR {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
  22. #define ITP_MIN_DATA_SIZE 6
  23. #define ITP_MAX_DATA_SIZE 1600
  24. #define ITP_TIME_THRES_US 10000
  25. #define ITP_US_TO_MS(x) ((x)/1000)
  26. #define ITP_MS_TO_US(x) ((x)*1000)
  27. #define ITP_BUF_SIZE 255
  28. enum cw1200_itp_data_modes {
  29. ITP_DATA_ZEROS,
  30. ITP_DATA_ONES,
  31. ITP_DATA_ZERONES,
  32. ITP_DATA_RANDOM,
  33. ITP_DATA_MAX_MODE,
  34. };
  35. enum cw1200_itp_version_type {
  36. ITP_CHIP_ID,
  37. ITP_FW_VER,
  38. };
  39. enum cw1200_itp_preamble_type {
  40. ITP_PREAMBLE_LONG,
  41. ITP_PREAMBLE_SHORT,
  42. ITP_PREAMBLE_OFDM,
  43. ITP_PREAMBLE_MIXED,
  44. ITP_PREAMBLE_GREENFIELD,
  45. ITP_PREAMBLE_MAX,
  46. };
  47. struct cw1200_itp {
  48. struct cw1200_common *priv;
  49. atomic_t open_count;
  50. atomic_t awaiting_confirm;
  51. struct sk_buff_head log_queue;
  52. wait_queue_head_t read_wait;
  53. wait_queue_head_t write_wait;
  54. wait_queue_head_t close_wait;
  55. struct ieee80211_channel *saved_channel;
  56. atomic_t stop_tx;
  57. struct delayed_work tx_work;
  58. struct delayed_work tx_finish;
  59. spinlock_t tx_lock;
  60. struct timespec last_sent;
  61. atomic_t test_mode;
  62. int rx_cnt;
  63. long rx_rssi;
  64. int rx_rssi_max;
  65. int rx_rssi_min;
  66. unsigned band;
  67. unsigned ch;
  68. unsigned rate;
  69. unsigned preamble;
  70. unsigned int number;
  71. unsigned data_mode;
  72. int interval_us;
  73. int power;
  74. u8 *data;
  75. int hdr_len;
  76. int data_len;
  77. };
  78. int cw1200_itp_init(struct cw1200_common *priv);
  79. void cw1200_itp_release(struct cw1200_common *priv);
  80. bool cw1200_is_itp(struct cw1200_common *priv);
  81. bool cw1200_itp_rxed(struct cw1200_common *priv, struct sk_buff *skb);
  82. void cw1200_itp_wake_up_tx(struct cw1200_common *priv);
  83. int cw1200_itp_get_tx(struct cw1200_common *priv, u8 **data,
  84. size_t *tx_len, int *burst);
  85. bool cw1200_itp_tx_running(struct cw1200_common *priv);
  86. #else /* CONFIG_CW1200_ITP */
  87. static inline int cw1200_itp_init(struct cw1200_common *priv)
  88. {
  89. return 0;
  90. }
  91. static inline void cw1200_itp_release(struct cw1200_common *priv)
  92. {
  93. }
  94. static inline bool cw1200_is_itp(struct cw1200_common *priv)
  95. {
  96. return false;
  97. }
  98. static inline bool cw1200_itp_rxed(struct cw1200_common *priv,
  99. struct sk_buff *skb)
  100. {
  101. return false;
  102. }
  103. static inline void cw1200_itp_consume_txed(struct cw1200_common *priv)
  104. {
  105. }
  106. static inline void cw1200_itp_wake_up_tx(struct cw1200_common *priv)
  107. {
  108. }
  109. static inline int cw1200_itp_get_tx(struct cw1200_common *priv, u8 **data,
  110. size_t *tx_len, int *burst)
  111. {
  112. return 0;
  113. }
  114. static inline bool cw1200_itp_tx_running(struct cw1200_common *priv)
  115. {
  116. return false;
  117. }
  118. #endif /* CONFIG_CW1200_ITP */
  119. #endif /* CW1200_ITP_H_INCLUDED */