| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 1 | /****************************************************************************** | 
|  | 2 | * | 
|  | 3 | * Copyright(c) 2009-2010  Realtek Corporation. | 
|  | 4 | * | 
|  | 5 | * This program is free software; you can redistribute it and/or modify it | 
|  | 6 | * under the terms of version 2 of the GNU General Public License as | 
|  | 7 | * published by the Free Software Foundation. | 
|  | 8 | * | 
|  | 9 | * This program is distributed in the hope that it will be useful, but WITHOUT | 
|  | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 
|  | 11 | * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | 
|  | 12 | * more details. | 
|  | 13 | * | 
|  | 14 | * You should have received a copy of the GNU General Public License along with | 
|  | 15 | * this program; if not, write to the Free Software Foundation, Inc., | 
|  | 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA | 
|  | 17 | * | 
|  | 18 | * The full GNU General Public License is included in this distribution in the | 
|  | 19 | * file called LICENSE. | 
|  | 20 | * | 
|  | 21 | * Contact Information: | 
|  | 22 | * wlanfae <wlanfae@realtek.com> | 
|  | 23 | * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, | 
|  | 24 | * Hsinchu 300, Taiwan. | 
|  | 25 | * | 
|  | 26 | * Larry Finger <Larry.Finger@lwfinger.net> | 
| Chaoming_Li | acd4857 | 2011-04-25 12:52:54 -0500 | [diff] [blame] | 27 | * | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 28 | *****************************************************************************/ | 
|  | 29 |  | 
|  | 30 | #ifndef __RTL_BASE_H__ | 
|  | 31 | #define __RTL_BASE_H__ | 
|  | 32 |  | 
| Chaoming_Li | acd4857 | 2011-04-25 12:52:54 -0500 | [diff] [blame] | 33 | enum ap_peer { | 
|  | 34 | PEER_UNKNOWN = 0, | 
|  | 35 | PEER_RTL = 1, | 
|  | 36 | PEER_RTL_92SE = 2, | 
|  | 37 | PEER_BROAD = 3, | 
|  | 38 | PEER_RAL = 4, | 
|  | 39 | PEER_ATH = 5, | 
|  | 40 | PEER_CISCO = 6, | 
|  | 41 | PEER_MARV = 7, | 
|  | 42 | PEER_AIRGO = 9, | 
|  | 43 | PEER_MAX = 10, | 
|  | 44 | } ; | 
|  | 45 |  | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 46 | #define RTL_DUMMY_OFFSET	0 | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 47 | #define RTL_DUMMY_UNIT		8 | 
|  | 48 | #define RTL_TX_DUMMY_SIZE	(RTL_DUMMY_OFFSET * RTL_DUMMY_UNIT) | 
|  | 49 | #define RTL_TX_DESC_SIZE	32 | 
|  | 50 | #define RTL_TX_HEADER_SIZE	(RTL_TX_DESC_SIZE + RTL_TX_DUMMY_SIZE) | 
|  | 51 |  | 
|  | 52 | #define HT_AMSDU_SIZE_4K	3839 | 
|  | 53 | #define HT_AMSDU_SIZE_8K	7935 | 
|  | 54 |  | 
|  | 55 | #define MAX_BIT_RATE_40MHZ_MCS15	300	/* Mbps */ | 
|  | 56 | #define MAX_BIT_RATE_40MHZ_MCS7		150	/* Mbps */ | 
|  | 57 |  | 
|  | 58 | #define RTL_RATE_COUNT_LEGACY		12 | 
|  | 59 | #define RTL_CHANNEL_COUNT		14 | 
|  | 60 |  | 
|  | 61 | #define FRAME_OFFSET_FRAME_CONTROL	0 | 
|  | 62 | #define FRAME_OFFSET_DURATION		2 | 
|  | 63 | #define FRAME_OFFSET_ADDRESS1		4 | 
|  | 64 | #define FRAME_OFFSET_ADDRESS2		10 | 
|  | 65 | #define FRAME_OFFSET_ADDRESS3		16 | 
|  | 66 | #define FRAME_OFFSET_SEQUENCE		22 | 
|  | 67 | #define FRAME_OFFSET_ADDRESS4		24 | 
|  | 68 |  | 
| Chaoming_Li | acd4857 | 2011-04-25 12:52:54 -0500 | [diff] [blame] | 69 | #define SET_80211_HDR_FRAME_CONTROL(_hdr, _val)		\ | 
|  | 70 | WRITEEF2BYTE(_hdr, _val) | 
|  | 71 | #define SET_80211_HDR_TYPE_AND_SUBTYPE(_hdr, _val)	\ | 
|  | 72 | WRITEEF1BYTE(_hdr, _val) | 
|  | 73 | #define SET_80211_HDR_PWR_MGNT(_hdr, _val)		\ | 
|  | 74 | SET_BITS_TO_LE_2BYTE(_hdr, 12, 1, _val) | 
|  | 75 | #define SET_80211_HDR_TO_DS(_hdr, _val)			\ | 
|  | 76 | SET_BITS_TO_LE_2BYTE(_hdr, 8, 1, _val) | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 77 |  | 
|  | 78 | #define SET_80211_PS_POLL_AID(_hdr, _val)		\ | 
| Larry Finger | 9e0bc67 | 2011-02-19 16:30:02 -0600 | [diff] [blame] | 79 | (*(u16 *)((u8 *)(_hdr) + 2) = le16_to_cpu(_val)) | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 80 | #define SET_80211_PS_POLL_BSSID(_hdr, _val)		\ | 
| Larry Finger | 9e0bc67 | 2011-02-19 16:30:02 -0600 | [diff] [blame] | 81 | memcpy(((u8 *)(_hdr)) + 4, (u8 *)(_val), ETH_ALEN) | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 82 | #define SET_80211_PS_POLL_TA(_hdr, _val)		\ | 
| Larry Finger | 9e0bc67 | 2011-02-19 16:30:02 -0600 | [diff] [blame] | 83 | memcpy(((u8 *)(_hdr)) + 10, (u8 *)(_val), ETH_ALEN) | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 84 |  | 
|  | 85 | #define SET_80211_HDR_DURATION(_hdr, _val)	\ | 
| Larry Finger | 9e0bc67 | 2011-02-19 16:30:02 -0600 | [diff] [blame] | 86 | (*(u16 *)((u8 *)(_hdr) + FRAME_OFFSET_DURATION) = le16_to_cpu(_val)) | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 87 | #define SET_80211_HDR_ADDRESS1(_hdr, _val)	\ | 
| Chaoming_Li | acd4857 | 2011-04-25 12:52:54 -0500 | [diff] [blame] | 88 | CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS1, (u8 *)(_val)) | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 89 | #define SET_80211_HDR_ADDRESS2(_hdr, _val)	\ | 
| Chaoming_Li | acd4857 | 2011-04-25 12:52:54 -0500 | [diff] [blame] | 90 | CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS2, (u8 *)(_val)) | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 91 | #define SET_80211_HDR_ADDRESS3(_hdr, _val)	\ | 
| Chaoming_Li | acd4857 | 2011-04-25 12:52:54 -0500 | [diff] [blame] | 92 | CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS3, (u8 *)(_val)) | 
|  | 93 | #define SET_80211_HDR_FRAGMENT_SEQUENCE(_hdr, _val)  \ | 
|  | 94 | WRITEEF2BYTE((u8 *)(_hdr)+FRAME_OFFSET_SEQUENCE, _val) | 
|  | 95 |  | 
|  | 96 | #define SET_BEACON_PROBE_RSP_TIME_STAMP_LOW(__phdr, __val)	\ | 
|  | 97 | WRITEEF4BYTE(((u8 *)(__phdr)) + 24, __val) | 
|  | 98 | #define SET_BEACON_PROBE_RSP_TIME_STAMP_HIGH(__phdr, __val) \ | 
|  | 99 | WRITEEF4BYTE(((u8 *)(__phdr)) + 28, __val) | 
|  | 100 | #define SET_BEACON_PROBE_RSP_BEACON_INTERVAL(__phdr, __val) \ | 
|  | 101 | WRITEEF2BYTE(((u8 *)(__phdr)) + 32, __val) | 
|  | 102 | #define GET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr)		\ | 
|  | 103 | READEF2BYTE(((u8 *)(__phdr)) + 34) | 
|  | 104 | #define SET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, __val) \ | 
|  | 105 | WRITEEF2BYTE(((u8 *)(__phdr)) + 34, __val) | 
|  | 106 | #define MASK_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, __val) \ | 
|  | 107 | SET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, \ | 
|  | 108 | (GET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr) & (~(__val)))) | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 109 |  | 
|  | 110 | int rtl_init_core(struct ieee80211_hw *hw); | 
|  | 111 | void rtl_deinit_core(struct ieee80211_hw *hw); | 
|  | 112 | void rtl_init_rx_config(struct ieee80211_hw *hw); | 
|  | 113 | void rtl_init_rfkill(struct ieee80211_hw *hw); | 
|  | 114 | void rtl_deinit_rfkill(struct ieee80211_hw *hw); | 
|  | 115 |  | 
|  | 116 | void rtl_watch_dog_timer_callback(unsigned long data); | 
|  | 117 | void rtl_deinit_deferred_work(struct ieee80211_hw *hw); | 
|  | 118 |  | 
|  | 119 | bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx); | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 120 | u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx); | 
|  | 121 |  | 
|  | 122 | void rtl_watch_dog_timer_callback(unsigned long data); | 
| Chaoming_Li | acd4857 | 2011-04-25 12:52:54 -0500 | [diff] [blame] | 123 | int rtl_tx_agg_start(struct ieee80211_hw *hw, struct ieee80211_sta *sta, | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 124 | u16 tid, u16 *ssn); | 
| Chaoming_Li | acd4857 | 2011-04-25 12:52:54 -0500 | [diff] [blame] | 125 | int rtl_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_sta *sta, | 
|  | 126 | u16 tid); | 
|  | 127 | int rtl_tx_agg_oper(struct ieee80211_hw *hw, struct ieee80211_sta *sta, | 
|  | 128 | u16 tid); | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 129 | void rtl_watchdog_wq_callback(void *data); | 
|  | 130 |  | 
|  | 131 | void rtl_get_tcb_desc(struct ieee80211_hw *hw, | 
|  | 132 | struct ieee80211_tx_info *info, | 
| Chaoming_Li | acd4857 | 2011-04-25 12:52:54 -0500 | [diff] [blame] | 133 | struct ieee80211_sta *sta, | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 134 | struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc); | 
|  | 135 |  | 
| Chaoming_Li | acd4857 | 2011-04-25 12:52:54 -0500 | [diff] [blame] | 136 | int rtl_send_smps_action(struct ieee80211_hw *hw, | 
|  | 137 | struct ieee80211_sta *sta, u8 *da, u8 *bssid, | 
|  | 138 | enum ieee80211_smps_mode smps); | 
|  | 139 | u8 *rtl_find_ie(u8 *data, unsigned int len, u8 ie); | 
|  | 140 | void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len); | 
|  | 141 | u8 rtl_tid_to_ac(struct ieee80211_hw *hw, u8 tid); | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 142 | extern struct attribute_group rtl_attribute_group; | 
| Larry Finger | 7ad0ce3 | 2011-08-22 16:50:14 -0500 | [diff] [blame] | 143 | int rtlwifi_rate_mapping(struct ieee80211_hw *hw, | 
|  | 144 | bool isht, u8 desc_rate, bool first_ampdu); | 
| Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 145 | #endif |