Linux Audio

Check our new training course

Loading...
v6.9.4
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/* Copyright(c) 2009-2012  Realtek Corporation.*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  3
  4#ifndef __RTL_BASE_H__
  5#define __RTL_BASE_H__
  6
  7enum ap_peer {
  8	PEER_UNKNOWN = 0,
  9	PEER_RTL = 1,
 10	PEER_RTL_92SE = 2,
 11	PEER_BROAD = 3,
 12	PEER_RAL = 4,
 13	PEER_ATH = 5,
 14	PEER_CISCO = 6,
 15	PEER_MARV = 7,
 16	PEER_AIRGO = 9,
 17	PEER_MAX = 10,
 18};
 19
 20#define RTL_DUMMY_OFFSET	0
 21#define RTL_DUMMY_UNIT		8
 22#define RTL_TX_DUMMY_SIZE	(RTL_DUMMY_OFFSET * RTL_DUMMY_UNIT)
 23#define RTL_TX_DESC_SIZE	32
 24#define RTL_TX_HEADER_SIZE	(RTL_TX_DESC_SIZE + RTL_TX_DUMMY_SIZE)
 25
 26#define MAX_BIT_RATE_40MHZ_MCS15	300	/* Mbps */
 27#define MAX_BIT_RATE_40MHZ_MCS7		150	/* Mbps */
 28
 29#define MAX_BIT_RATE_SHORT_GI_2NSS_80MHZ_MCS9	867	/* Mbps */
 30#define MAX_BIT_RATE_SHORT_GI_2NSS_80MHZ_MCS7	650	/* Mbps */
 31#define MAX_BIT_RATE_LONG_GI_2NSS_80MHZ_MCS9	780	/* Mbps */
 32#define MAX_BIT_RATE_LONG_GI_2NSS_80MHZ_MCS7	585	/* Mbps */
 33
 34#define MAX_BIT_RATE_SHORT_GI_1NSS_80MHZ_MCS9	434	/* Mbps */
 35#define MAX_BIT_RATE_SHORT_GI_1NSS_80MHZ_MCS7	325	/* Mbps */
 36#define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS9	390	/* Mbps */
 37#define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS7	293	/* Mbps */
 38
 39#define FRAME_OFFSET_FRAME_CONTROL	0
 40#define FRAME_OFFSET_DURATION		2
 41#define FRAME_OFFSET_ADDRESS1		4
 42#define FRAME_OFFSET_ADDRESS2		10
 43#define FRAME_OFFSET_ADDRESS3		16
 44#define FRAME_OFFSET_SEQUENCE		22
 45#define FRAME_OFFSET_ADDRESS4		24
 46#define MAX_LISTEN_INTERVAL		10
 47#define MAX_RATE_TRIES			4
 
 
 
 
 
 
 
 48
 49#define SET_80211_PS_POLL_AID(_hdr, _val)		\
 50	(*(u16 *)((u8 *)(_hdr) + 2) = _val)
 51#define SET_80211_PS_POLL_BSSID(_hdr, _val)		\
 52	ether_addr_copy(((u8 *)(_hdr)) + 4, (u8 *)(_val))
 53#define SET_80211_PS_POLL_TA(_hdr, _val)		\
 54	ether_addr_copy(((u8 *)(_hdr))+10, (u8 *)(_val))
 55
 
 
 56#define SET_80211_HDR_ADDRESS1(_hdr, _val)	\
 57	CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS1, (u8 *)(_val))
 58#define SET_80211_HDR_ADDRESS2(_hdr, _val)	\
 59	CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS2, (u8 *)(_val))
 60#define SET_80211_HDR_ADDRESS3(_hdr, _val)	\
 61	CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS3, (u8 *)(_val))
 
 
 62
 63#define SET_TX_DESC_SPE_RPT(__pdesc, __val)			\
 64	le32p_replace_bits((__le32 *)(__pdesc + 8), __val, BIT(19))
 65#define SET_TX_DESC_SW_DEFINE(__pdesc, __val)	\
 66	le32p_replace_bits((__le32 *)(__pdesc + 24), __val, GENMASK(11, 0))
 
 
 
 
 
 
 
 
 
 67
 68int rtl_init_core(struct ieee80211_hw *hw);
 69void rtl_deinit_core(struct ieee80211_hw *hw);
 70void rtl_init_rx_config(struct ieee80211_hw *hw);
 71void rtl_init_rfkill(struct ieee80211_hw *hw);
 72void rtl_deinit_rfkill(struct ieee80211_hw *hw);
 73
 74void rtl_watch_dog_timer_callback(struct timer_list *t);
 75void rtl_deinit_deferred_work(struct ieee80211_hw *hw, bool ips_wq);
 76
 77bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx);
 78int rtlwifi_rate_mapping(struct ieee80211_hw *hw, bool isht,
 79			 bool isvht, u8 desc_rate);
 80bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb);
 81u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx,
 82		       bool is_enc);
 83
 84void rtl_tx_ackqueue(struct ieee80211_hw *hw, struct sk_buff *skb);
 85bool rtl_is_tx_report_skb(struct ieee80211_hw *hw, struct sk_buff *skb);
 86void rtl_set_tx_report(struct rtl_tcb_desc *ptcb_desc, u8 *pdesc,
 87		       struct ieee80211_hw *hw, struct rtlwifi_tx_info *info);
 88void rtl_tx_report_handler(struct ieee80211_hw *hw, u8 *tmp_buf,
 89			   u8 c2h_cmd_len);
 90bool rtl_check_tx_report_acked(struct ieee80211_hw *hw);
 91void rtl_wait_tx_report_acked(struct ieee80211_hw *hw, u32 wait_ms);
 92u32 rtl_get_hal_edca_param(struct ieee80211_hw *hw,
 93			   struct ieee80211_vif *vif,
 94			   enum wireless_mode wirelessmode,
 95			   struct ieee80211_tx_queue_params *param);
 96
 97void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb);
 98void rtl_collect_scan_list(struct ieee80211_hw *hw, struct sk_buff *skb);
 99void rtl_scan_list_expire(struct ieee80211_hw *hw);
100int rtl_tx_agg_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
101	struct ieee80211_sta *sta, u16 tid, u16 *ssn);
102int rtl_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
103	struct ieee80211_sta *sta, u16 tid);
104int rtl_tx_agg_oper(struct ieee80211_hw *hw,
105		    struct ieee80211_sta *sta, u16 tid);
106int rtl_rx_agg_start(struct ieee80211_hw *hw,
107		     struct ieee80211_sta *sta, u16 tid);
108int rtl_rx_agg_stop(struct ieee80211_hw *hw,
109		    struct ieee80211_sta *sta, u16 tid);
110void rtl_rx_ampdu_apply(struct rtl_priv *rtlpriv);
111void rtl_c2hcmd_launcher(struct ieee80211_hw *hw, int exec);
112void rtl_c2hcmd_enqueue(struct ieee80211_hw *hw, struct sk_buff *skb);
113
114u8 rtl_mrate_idx_to_arfr_id(struct ieee80211_hw *hw, u8 rate_index,
115			    enum wireless_mode wirelessmode);
116void rtl_get_tcb_desc(struct ieee80211_hw *hw,
117		      struct ieee80211_tx_info *info,
118		      struct ieee80211_sta *sta,
119		      struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc);
120
121int rtl_send_smps_action(struct ieee80211_hw *hw,
122		struct ieee80211_sta *sta,
123		enum ieee80211_smps_mode smps);
124u8 *rtl_find_ie(u8 *data, unsigned int len, u8 ie);
125void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len);
126u8 rtl_tid_to_ac(u8 tid);
 
 
127extern struct rtl_global_var rtl_global_var;
128void rtl_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation);
129
130#endif
v4.6
  1/******************************************************************************
  2 *
  3 * Copyright(c) 2009-2012  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 * The full GNU General Public License is included in this distribution in the
 15 * file called LICENSE.
 16 *
 17 * Contact Information:
 18 * wlanfae <wlanfae@realtek.com>
 19 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
 20 * Hsinchu 300, Taiwan.
 21 *
 22 * Larry Finger <Larry.Finger@lwfinger.net>
 23 *
 24 *****************************************************************************/
 25
 26#ifndef __RTL_BASE_H__
 27#define __RTL_BASE_H__
 28
 29enum ap_peer {
 30	PEER_UNKNOWN = 0,
 31	PEER_RTL = 1,
 32	PEER_RTL_92SE = 2,
 33	PEER_BROAD = 3,
 34	PEER_RAL = 4,
 35	PEER_ATH = 5,
 36	PEER_CISCO = 6,
 37	PEER_MARV = 7,
 38	PEER_AIRGO = 9,
 39	PEER_MAX = 10,
 40};
 41
 42#define RTL_DUMMY_OFFSET	0
 43#define RTL_DUMMY_UNIT		8
 44#define RTL_TX_DUMMY_SIZE	(RTL_DUMMY_OFFSET * RTL_DUMMY_UNIT)
 45#define RTL_TX_DESC_SIZE	32
 46#define RTL_TX_HEADER_SIZE	(RTL_TX_DESC_SIZE + RTL_TX_DUMMY_SIZE)
 47
 48#define MAX_BIT_RATE_40MHZ_MCS15	300	/* Mbps */
 49#define MAX_BIT_RATE_40MHZ_MCS7		150	/* Mbps */
 50
 51#define MAX_BIT_RATE_SHORT_GI_2NSS_80MHZ_MCS9	867	/* Mbps */
 52#define MAX_BIT_RATE_SHORT_GI_2NSS_80MHZ_MCS7	650	/* Mbps */
 53#define MAX_BIT_RATE_LONG_GI_2NSS_80MHZ_MCS9	780	/* Mbps */
 54#define MAX_BIT_RATE_LONG_GI_2NSS_80MHZ_MCS7	585	/* Mbps */
 55
 56#define MAX_BIT_RATE_SHORT_GI_1NSS_80MHZ_MCS9	434	/* Mbps */
 57#define MAX_BIT_RATE_SHORT_GI_1NSS_80MHZ_MCS7	325	/* Mbps */
 58#define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS9	390	/* Mbps */
 59#define MAX_BIT_RATE_LONG_GI_1NSS_80MHZ_MCS7	293	/* Mbps */
 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
 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)
 77
 78#define SET_80211_PS_POLL_AID(_hdr, _val)		\
 79	(*(u16 *)((u8 *)(_hdr) + 2) = _val)
 80#define SET_80211_PS_POLL_BSSID(_hdr, _val)		\
 81	ether_addr_copy(((u8 *)(_hdr)) + 4, (u8 *)(_val))
 82#define SET_80211_PS_POLL_TA(_hdr, _val)		\
 83	ether_addr_copy(((u8 *)(_hdr))+10, (u8 *)(_val))
 84
 85#define SET_80211_HDR_DURATION(_hdr, _val)	\
 86	(*(u16 *)((u8 *)(_hdr) + FRAME_OFFSET_DURATION) = le16_to_cpu(_val))
 87#define SET_80211_HDR_ADDRESS1(_hdr, _val)	\
 88	CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS1, (u8 *)(_val))
 89#define SET_80211_HDR_ADDRESS2(_hdr, _val)	\
 90	CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS2, (u8 *)(_val))
 91#define SET_80211_HDR_ADDRESS3(_hdr, _val)	\
 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))))
109
110int rtl_init_core(struct ieee80211_hw *hw);
111void rtl_deinit_core(struct ieee80211_hw *hw);
112void rtl_init_rx_config(struct ieee80211_hw *hw);
113void rtl_init_rfkill(struct ieee80211_hw *hw);
114void rtl_deinit_rfkill(struct ieee80211_hw *hw);
115
116void rtl_watch_dog_timer_callback(unsigned long data);
117void rtl_deinit_deferred_work(struct ieee80211_hw *hw);
118
119bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx);
120int rtlwifi_rate_mapping(struct ieee80211_hw *hw, bool isht,
121			 bool isvht, u8 desc_rate);
122bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb);
123u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx,
124		       bool is_enc);
125
 
 
 
 
 
 
 
 
 
 
 
 
 
126void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb);
 
 
127int rtl_tx_agg_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
128	struct ieee80211_sta *sta, u16 tid, u16 *ssn);
129int rtl_tx_agg_stop(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
130	struct ieee80211_sta *sta, u16 tid);
131int rtl_tx_agg_oper(struct ieee80211_hw *hw,
132		    struct ieee80211_sta *sta, u16 tid);
133int rtl_rx_agg_start(struct ieee80211_hw *hw,
134		     struct ieee80211_sta *sta, u16 tid);
135int rtl_rx_agg_stop(struct ieee80211_hw *hw,
136		    struct ieee80211_sta *sta, u16 tid);
137void rtl_watchdog_wq_callback(void *data);
138void rtl_fwevt_wq_callback(void *data);
 
139
 
 
140void rtl_get_tcb_desc(struct ieee80211_hw *hw,
141		      struct ieee80211_tx_info *info,
142		      struct ieee80211_sta *sta,
143		      struct sk_buff *skb, struct rtl_tcb_desc *tcb_desc);
144
145int rtl_send_smps_action(struct ieee80211_hw *hw,
146		struct ieee80211_sta *sta,
147		enum ieee80211_smps_mode smps);
148u8 *rtl_find_ie(u8 *data, unsigned int len, u8 ie);
149void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len);
150u8 rtl_tid_to_ac(u8 tid);
151extern struct attribute_group rtl_attribute_group;
152void rtl_easy_concurrent_retrytimer_callback(unsigned long data);
153extern struct rtl_global_var rtl_global_var;
154void rtl_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation);
155
156#endif