Solomon Peachy | a910e4a | 2013-05-24 20:04:38 -0400 | [diff] [blame] | 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 | |
| 12 | #ifndef CW1200_ITP_H_INCLUDED |
| 13 | #define CW1200_ITP_H_INCLUDED |
| 14 | |
| 15 | struct cw200_common; |
| 16 | struct wsm_tx_confirm; |
| 17 | struct dentry; |
| 18 | |
| 19 | #ifdef CONFIG_CW1200_ITP |
| 20 | |
| 21 | /*extern*/ struct ieee80211_channel; |
| 22 | |
| 23 | #define TEST_MODE_NO_TEST (0) |
| 24 | #define TEST_MODE_RX_TEST (1) |
| 25 | #define TEST_MODE_TX_TEST (2) |
| 26 | #define ITP_DEFAULT_DA_ADDR {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} |
| 27 | #define ITP_MIN_DATA_SIZE 6 |
| 28 | #define ITP_MAX_DATA_SIZE 1600 |
| 29 | #define ITP_TIME_THRES_US 10000 |
| 30 | #define ITP_US_TO_MS(x) ((x)/1000) |
| 31 | #define ITP_MS_TO_US(x) ((x)*1000) |
| 32 | #define ITP_BUF_SIZE 255 |
| 33 | |
| 34 | |
| 35 | enum cw1200_itp_data_modes { |
| 36 | ITP_DATA_ZEROS, |
| 37 | ITP_DATA_ONES, |
| 38 | ITP_DATA_ZERONES, |
| 39 | ITP_DATA_RANDOM, |
| 40 | ITP_DATA_MAX_MODE, |
| 41 | }; |
| 42 | |
| 43 | enum cw1200_itp_version_type { |
| 44 | ITP_CHIP_ID, |
| 45 | ITP_FW_VER, |
| 46 | }; |
| 47 | |
| 48 | enum cw1200_itp_preamble_type { |
| 49 | ITP_PREAMBLE_LONG, |
| 50 | ITP_PREAMBLE_SHORT, |
| 51 | ITP_PREAMBLE_OFDM, |
| 52 | ITP_PREAMBLE_MIXED, |
| 53 | ITP_PREAMBLE_GREENFIELD, |
| 54 | ITP_PREAMBLE_MAX, |
| 55 | }; |
| 56 | |
| 57 | |
| 58 | struct cw1200_itp { |
| 59 | struct cw1200_common *priv; |
| 60 | atomic_t open_count; |
| 61 | atomic_t awaiting_confirm; |
| 62 | struct sk_buff_head log_queue; |
| 63 | wait_queue_head_t read_wait; |
| 64 | wait_queue_head_t write_wait; |
| 65 | wait_queue_head_t close_wait; |
| 66 | struct ieee80211_channel *saved_channel; |
| 67 | atomic_t stop_tx; |
| 68 | struct delayed_work tx_work; |
| 69 | struct delayed_work tx_finish; |
| 70 | spinlock_t tx_lock; |
| 71 | struct timespec last_sent; |
| 72 | atomic_t test_mode; |
| 73 | int rx_cnt; |
| 74 | long rx_rssi; |
| 75 | int rx_rssi_max; |
| 76 | int rx_rssi_min; |
| 77 | unsigned band; |
| 78 | unsigned ch; |
| 79 | unsigned rate; |
| 80 | unsigned preamble; |
| 81 | unsigned int number; |
| 82 | unsigned data_mode; |
| 83 | int interval_us; |
| 84 | int power; |
| 85 | u8 *data; |
| 86 | int hdr_len; |
| 87 | int data_len; |
| 88 | }; |
| 89 | |
| 90 | int cw1200_itp_init(struct cw1200_common *priv); |
| 91 | void cw1200_itp_release(struct cw1200_common *priv); |
| 92 | |
| 93 | bool cw1200_is_itp(struct cw1200_common *priv); |
| 94 | bool cw1200_itp_rxed(struct cw1200_common *priv, struct sk_buff *skb); |
| 95 | void cw1200_itp_wake_up_tx(struct cw1200_common *priv); |
| 96 | int cw1200_itp_get_tx(struct cw1200_common *priv, u8 **data, |
| 97 | size_t *tx_len, int *burst); |
| 98 | bool cw1200_itp_tx_running(struct cw1200_common *priv); |
| 99 | |
| 100 | #else /* CONFIG_CW1200_ITP */ |
| 101 | |
| 102 | static inline int cw1200_itp_init(struct cw1200_common *priv) |
| 103 | { |
| 104 | return 0; |
| 105 | } |
| 106 | |
| 107 | static inline void cw1200_itp_release(struct cw1200_common *priv) |
| 108 | { |
| 109 | } |
| 110 | |
| 111 | static inline bool cw1200_is_itp(struct cw1200_common *priv) |
| 112 | { |
| 113 | return false; |
| 114 | } |
| 115 | |
| 116 | static inline bool cw1200_itp_rxed(struct cw1200_common *priv, |
| 117 | struct sk_buff *skb) |
| 118 | { |
| 119 | return false; |
| 120 | } |
| 121 | |
| 122 | |
| 123 | static inline void cw1200_itp_consume_txed(struct cw1200_common *priv) |
| 124 | { |
| 125 | } |
| 126 | |
| 127 | static inline void cw1200_itp_wake_up_tx(struct cw1200_common *priv) |
| 128 | { |
| 129 | } |
| 130 | |
| 131 | static inline int cw1200_itp_get_tx(struct cw1200_common *priv, u8 **data, |
| 132 | size_t *tx_len, int *burst) |
| 133 | { |
| 134 | return 0; |
| 135 | } |
| 136 | |
| 137 | static inline bool cw1200_itp_tx_running(struct cw1200_common *priv) |
| 138 | { |
| 139 | return false; |
| 140 | } |
| 141 | |
| 142 | #endif /* CONFIG_CW1200_ITP */ |
| 143 | |
| 144 | #endif /* CW1200_ITP_H_INCLUDED */ |